]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 3 Jun 2010 19:52:32 +0000 (14:52 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 3 Jun 2010 19:52:32 +0000 (14:52 -0500)
1455 files changed:
.gitignore
Factor.app/Contents/Info.plist
GNUmakefile
Nmakefile
basis/alarms/alarms-docs.factor
basis/alarms/alarms-tests.factor
basis/alarms/alarms.factor
basis/alien/arrays/arrays.factor
basis/alien/c-types/c-types-docs.factor
basis/alien/c-types/c-types-tests.factor
basis/alien/c-types/c-types.factor
basis/alien/data/data-docs.factor
basis/alien/data/data.factor
basis/alien/debugger/authors.txt [new file with mode: 0644]
basis/alien/debugger/debugger.factor [new file with mode: 0644]
basis/alien/enums/enums-docs.factor [new file with mode: 0644]
basis/alien/enums/enums-tests.factor [new file with mode: 0644]
basis/alien/enums/enums.factor [new file with mode: 0644]
basis/alien/fortran/fortran-tests.factor
basis/alien/fortran/fortran.factor [changed mode: 0644->0755]
basis/alien/libraries/libraries-docs.factor
basis/alien/libraries/libraries.factor [changed mode: 0644->0755]
basis/alien/parser/authors.txt [new file with mode: 0644]
basis/alien/parser/parser-tests.factor
basis/alien/parser/parser.factor [changed mode: 0644->0755]
basis/alien/prettyprint/prettyprint-tests.factor [new file with mode: 0644]
basis/alien/prettyprint/prettyprint.factor
basis/alien/remote-control/remote-control.factor
basis/alien/syntax/syntax-docs.factor
basis/alien/syntax/syntax.factor [changed mode: 0644->0755]
basis/base64/base64.factor
basis/biassocs/biassocs.factor
basis/binary-search/binary-search-tests.factor
basis/binary-search/binary-search.factor
basis/bit-arrays/bit-arrays-tests.factor
basis/bit-arrays/bit-arrays.factor
basis/bit-sets/bit-sets-docs.factor [new file with mode: 0644]
basis/bit-sets/bit-sets-tests.factor
basis/bit-sets/bit-sets.factor
basis/bitstreams/bitstreams.factor
basis/bootstrap/compiler/compiler.factor
basis/bootstrap/compiler/timing/tags.txt
basis/bootstrap/compiler/timing/timing.factor
basis/bootstrap/handbook/handbook.factor
basis/bootstrap/help/help.factor
basis/bootstrap/image/download/download.factor
basis/bootstrap/image/image.factor
basis/bootstrap/stage2.factor
basis/bootstrap/threads/threads.factor
basis/bootstrap/tools/tools.factor
basis/bootstrap/ui/tools/tools.factor
basis/boxes/boxes.factor
basis/cairo/ffi/ffi.factor
basis/calendar/calendar-docs.factor
basis/calendar/calendar-tests.factor
basis/calendar/calendar.factor
basis/calendar/format/format.factor
basis/calendar/model/model.factor
basis/calendar/unix/unix.factor
basis/channels/channels.factor
basis/checksums/md5/md5.factor
basis/checksums/openssl/openssl.factor
basis/checksums/sha/sha.factor
basis/circular/circular.factor
basis/classes/struct/struct-docs.factor
basis/classes/struct/struct-tests.factor
basis/classes/struct/struct.factor
basis/cocoa/application/application.factor
basis/cocoa/cocoa.factor
basis/cocoa/enumeration/enumeration.factor
basis/cocoa/messages/messages.factor
basis/cocoa/nibs/nibs.factor
basis/cocoa/plists/plists.factor
basis/cocoa/runtime/runtime.factor
basis/cocoa/subclassing/subclassing.factor
basis/combinators/smart/smart-tests.factor
basis/combinators/smart/smart.factor
basis/command-line/command-line-docs.factor
basis/compiler/alien/alien.factor [deleted file]
basis/compiler/alien/summary.txt [deleted file]
basis/compiler/cfg/alias-analysis/alias-analysis-tests.factor [new file with mode: 0644]
basis/compiler/cfg/alias-analysis/alias-analysis.factor
basis/compiler/cfg/block-joining/block-joining.factor
basis/compiler/cfg/branch-splitting/branch-splitting.factor
basis/compiler/cfg/build-stack-frame/build-stack-frame.factor
basis/compiler/cfg/builder/alien/alien.factor [new file with mode: 0644]
basis/compiler/cfg/builder/alien/boxing/authors.txt [new file with mode: 0644]
basis/compiler/cfg/builder/alien/boxing/boxing.factor [new file with mode: 0644]
basis/compiler/cfg/builder/alien/params/authors.txt [new file with mode: 0644]
basis/compiler/cfg/builder/alien/params/params.factor [new file with mode: 0644]
basis/compiler/cfg/builder/blocks/blocks.factor
basis/compiler/cfg/builder/builder-tests.factor
basis/compiler/cfg/builder/builder.factor
basis/compiler/cfg/cfg.factor
basis/compiler/cfg/checker/checker.factor
basis/compiler/cfg/comparisons/comparisons.factor
basis/compiler/cfg/copy-prop/copy-prop-tests.factor [new file with mode: 0644]
basis/compiler/cfg/copy-prop/copy-prop.factor
basis/compiler/cfg/dataflow-analysis/dataflow-analysis.factor
basis/compiler/cfg/dce/dce-tests.factor
basis/compiler/cfg/dce/dce.factor
basis/compiler/cfg/debugger/debugger.factor
basis/compiler/cfg/def-use/def-use.factor
basis/compiler/cfg/dependence/dependence.factor [new file with mode: 0644]
basis/compiler/cfg/dominance/dominance.factor
basis/compiler/cfg/empty-blocks/empty-blocks.factor [deleted file]
basis/compiler/cfg/finalization/authors.txt [new file with mode: 0644]
basis/compiler/cfg/finalization/finalization.factor [new file with mode: 0644]
basis/compiler/cfg/gc-checks/gc-checks-tests.factor
basis/compiler/cfg/gc-checks/gc-checks.factor
basis/compiler/cfg/hats/hats.factor
basis/compiler/cfg/height/height.factor [new file with mode: 0644]
basis/compiler/cfg/height/summary.txt [new file with mode: 0644]
basis/compiler/cfg/instructions/instructions.factor
basis/compiler/cfg/instructions/syntax/syntax.factor
basis/compiler/cfg/intrinsics/alien/alien.factor
basis/compiler/cfg/intrinsics/allot/allot.factor
basis/compiler/cfg/intrinsics/fixnum/fixnum.factor
basis/compiler/cfg/intrinsics/float/float.factor
basis/compiler/cfg/intrinsics/intrinsics.factor
basis/compiler/cfg/intrinsics/misc/misc.factor
basis/compiler/cfg/intrinsics/simd/backend/backend.factor
basis/compiler/cfg/intrinsics/simd/simd-tests.factor
basis/compiler/cfg/intrinsics/simd/simd.factor
basis/compiler/cfg/intrinsics/slots/slots.factor
basis/compiler/cfg/intrinsics/strings/authors.txt [new file with mode: 0644]
basis/compiler/cfg/intrinsics/strings/strings.factor [new file with mode: 0644]
basis/compiler/cfg/linear-scan/allocation/allocation.factor
basis/compiler/cfg/linear-scan/allocation/spilling/spilling.factor
basis/compiler/cfg/linear-scan/allocation/splitting/splitting.factor
basis/compiler/cfg/linear-scan/allocation/state/state.factor
basis/compiler/cfg/linear-scan/assignment/assignment.factor
basis/compiler/cfg/linear-scan/debugger/debugger.factor
basis/compiler/cfg/linear-scan/linear-scan-tests.factor
basis/compiler/cfg/linear-scan/linear-scan.factor
basis/compiler/cfg/linear-scan/live-intervals/live-intervals.factor
basis/compiler/cfg/linear-scan/numbering/numbering.factor
basis/compiler/cfg/linear-scan/resolve/resolve-tests.factor
basis/compiler/cfg/linear-scan/resolve/resolve.factor
basis/compiler/cfg/linearization/linearization-tests.factor [new file with mode: 0644]
basis/compiler/cfg/linearization/linearization.factor
basis/compiler/cfg/linearization/order/order-tests.factor [deleted file]
basis/compiler/cfg/linearization/order/order.factor [deleted file]
basis/compiler/cfg/linearization/summary.txt [deleted file]
basis/compiler/cfg/liveness/ssa/ssa-tests.factor [new file with mode: 0644]
basis/compiler/cfg/liveness/ssa/ssa.factor
basis/compiler/cfg/loop-detection/loop-detection.factor
basis/compiler/cfg/mr/authors.txt [deleted file]
basis/compiler/cfg/mr/mr.factor [deleted file]
basis/compiler/cfg/optimizer/optimizer.factor
basis/compiler/cfg/registers/registers.factor
basis/compiler/cfg/representations/coalescing/authors.txt [new file with mode: 0644]
basis/compiler/cfg/representations/coalescing/coalescing-tests.factor [new file with mode: 0644]
basis/compiler/cfg/representations/coalescing/coalescing.factor [new file with mode: 0644]
basis/compiler/cfg/representations/conversion/authors.txt [new file with mode: 0644]
basis/compiler/cfg/representations/conversion/conversion.factor [new file with mode: 0644]
basis/compiler/cfg/representations/peephole/authors.txt [new file with mode: 0644]
basis/compiler/cfg/representations/peephole/peephole.factor [new file with mode: 0644]
basis/compiler/cfg/representations/preferred/preferred.factor
basis/compiler/cfg/representations/representations-tests.factor
basis/compiler/cfg/representations/representations.factor
basis/compiler/cfg/representations/rewrite/authors.txt [new file with mode: 0644]
basis/compiler/cfg/representations/rewrite/rewrite.factor [new file with mode: 0644]
basis/compiler/cfg/representations/selection/authors.txt [new file with mode: 0644]
basis/compiler/cfg/representations/selection/selection.factor [new file with mode: 0644]
basis/compiler/cfg/rpo/rpo.factor
basis/compiler/cfg/save-contexts/save-contexts.factor
basis/compiler/cfg/scheduling/scheduling-tests.factor [new file with mode: 0644]
basis/compiler/cfg/scheduling/scheduling.factor [new file with mode: 0644]
basis/compiler/cfg/ssa/construction/construction-tests.factor
basis/compiler/cfg/ssa/construction/construction.factor
basis/compiler/cfg/ssa/construction/tdmsc/tdmsc-tests.factor
basis/compiler/cfg/ssa/construction/tdmsc/tdmsc.factor
basis/compiler/cfg/ssa/cssa/cssa.factor
basis/compiler/cfg/ssa/destruction/destruction.factor
basis/compiler/cfg/ssa/interference/interference-tests.factor
basis/compiler/cfg/ssa/interference/interference.factor
basis/compiler/cfg/ssa/interference/live-ranges/live-ranges.factor
basis/compiler/cfg/ssa/liveness/liveness-tests.factor [deleted file]
basis/compiler/cfg/ssa/liveness/liveness.factor [deleted file]
basis/compiler/cfg/stack-frame/stack-frame.factor
basis/compiler/cfg/stacks/finalize/finalize.factor
basis/compiler/cfg/stacks/local/local.factor
basis/compiler/cfg/stacks/stacks.factor
basis/compiler/cfg/stacks/uninitialized/uninitialized.factor
basis/compiler/cfg/tco/tco.factor
basis/compiler/cfg/useless-conditionals/useless-conditionals.factor
basis/compiler/cfg/utilities/utilities.factor
basis/compiler/cfg/value-numbering/alien/alien.factor [new file with mode: 0644]
basis/compiler/cfg/value-numbering/alien/authors.txt [new file with mode: 0644]
basis/compiler/cfg/value-numbering/comparisons/authors.txt [new file with mode: 0644]
basis/compiler/cfg/value-numbering/comparisons/comparisons.factor [new file with mode: 0644]
basis/compiler/cfg/value-numbering/expressions/expressions.factor
basis/compiler/cfg/value-numbering/folding/authors.txt [new file with mode: 0644]
basis/compiler/cfg/value-numbering/folding/folding.factor [new file with mode: 0644]
basis/compiler/cfg/value-numbering/graph/graph.factor
basis/compiler/cfg/value-numbering/math/authors.txt [new file with mode: 0644]
basis/compiler/cfg/value-numbering/math/math.factor [new file with mode: 0644]
basis/compiler/cfg/value-numbering/misc/authors.txt [new file with mode: 0644]
basis/compiler/cfg/value-numbering/misc/misc.factor [new file with mode: 0644]
basis/compiler/cfg/value-numbering/rewrite/rewrite.factor
basis/compiler/cfg/value-numbering/simd/simd.factor
basis/compiler/cfg/value-numbering/simplify/simplify.factor [deleted file]
basis/compiler/cfg/value-numbering/simplify/summary.txt [deleted file]
basis/compiler/cfg/value-numbering/slots/authors.txt [new file with mode: 0644]
basis/compiler/cfg/value-numbering/slots/slots.factor [new file with mode: 0644]
basis/compiler/cfg/value-numbering/value-numbering-tests.factor
basis/compiler/cfg/value-numbering/value-numbering.factor
basis/compiler/cfg/write-barrier/write-barrier.factor
basis/compiler/codegen/codegen-tests.factor
basis/compiler/codegen/codegen.factor
basis/compiler/codegen/fixup/fixup.factor
basis/compiler/compiler.factor
basis/compiler/constants/constants.factor
basis/compiler/tests/alien.factor
basis/compiler/tests/codegen.factor
basis/compiler/tests/curry.factor
basis/compiler/tests/float.factor
basis/compiler/tests/linkage-errors.factor [new file with mode: 0644]
basis/compiler/tests/low-level-ir.factor
basis/compiler/tests/optimizer.factor
basis/compiler/tests/redefine23.factor
basis/compiler/tests/redefine24.factor
basis/compiler/tests/spilling.factor
basis/compiler/tree/checker/checker.factor
basis/compiler/tree/combinators/combinators.factor
basis/compiler/tree/dead-code/branches/branches.factor
basis/compiler/tree/dead-code/dead-code-tests.factor
basis/compiler/tree/dead-code/liveness/liveness.factor
basis/compiler/tree/def-use/def-use.factor
basis/compiler/tree/def-use/simplified/simplified.factor
basis/compiler/tree/escape-analysis/allocations/allocations.factor
basis/compiler/tree/escape-analysis/nodes/nodes.factor
basis/compiler/tree/modular-arithmetic/modular-arithmetic.factor
basis/compiler/tree/normalization/normalization-tests.factor
basis/compiler/tree/propagation/branches/branches.factor
basis/compiler/tree/propagation/call-effect/call-effect.factor
basis/compiler/tree/propagation/constraints/constraints.factor
basis/compiler/tree/propagation/info/info.factor
basis/compiler/tree/propagation/inlining/inlining.factor
basis/compiler/tree/propagation/known-words/known-words.factor
basis/compiler/tree/propagation/propagation-tests.factor
basis/compiler/tree/propagation/recursive/recursive-tests.factor
basis/compiler/tree/propagation/recursive/recursive.factor
basis/compiler/tree/propagation/simd/simd.factor
basis/compiler/tree/propagation/simple/simple.factor
basis/compiler/tree/propagation/slots/slots.factor
basis/compiler/tree/propagation/transforms/transforms.factor
basis/compiler/tree/recursive/recursive.factor
basis/compiler/tree/tuple-unboxing/tuple-unboxing-tests.factor
basis/compression/huffman/huffman.factor
basis/compression/lzw/lzw.factor [changed mode: 0644->0755]
basis/compression/zlib/ffi/ffi.factor
basis/concurrency/conditions/conditions.factor
basis/concurrency/distributed/distributed.factor
basis/concurrency/exchangers/exchangers.factor
basis/concurrency/mailboxes/mailboxes-docs.factor
basis/concurrency/mailboxes/mailboxes.factor
basis/concurrency/messaging/messaging.factor
basis/core-foundation/core-foundation.factor
basis/core-foundation/data/data.factor
basis/core-foundation/file-descriptors/file-descriptors.factor
basis/core-foundation/fsevents/fsevents.factor
basis/core-foundation/run-loop/run-loop.factor
basis/core-foundation/strings/strings.factor
basis/core-foundation/time/time.factor
basis/core-foundation/timers/timers.factor
basis/core-graphics/core-graphics.factor
basis/core-graphics/types/types.factor
basis/core-text/core-text.factor
basis/cpu/architecture/architecture.factor
basis/cpu/ppc/assembler/assembler-tests.factor
basis/cpu/ppc/assembler/assembler.factor
basis/cpu/ppc/bootstrap.factor
basis/cpu/ppc/linux/linux.factor
basis/cpu/ppc/linux/tags.txt
basis/cpu/ppc/macosx/macosx.factor
basis/cpu/ppc/macosx/tags.txt
basis/cpu/ppc/ppc.factor
basis/cpu/ppc/tags.txt
basis/cpu/x86/32/32-tests.factor
basis/cpu/x86/32/32.factor
basis/cpu/x86/32/bootstrap.factor
basis/cpu/x86/32/tags.txt
basis/cpu/x86/32/unix/bootstrap.factor [new file with mode: 0644]
basis/cpu/x86/32/winnt/bootstrap.factor [new file with mode: 0644]
basis/cpu/x86/64/64-tests.factor
basis/cpu/x86/64/64.factor
basis/cpu/x86/64/bootstrap.factor
basis/cpu/x86/64/tags.txt
basis/cpu/x86/64/unix/bootstrap.factor
basis/cpu/x86/64/unix/tags.txt
basis/cpu/x86/64/unix/unix.factor
basis/cpu/x86/64/winnt/bootstrap.factor
basis/cpu/x86/64/winnt/tags.txt
basis/cpu/x86/64/winnt/winnt.factor
basis/cpu/x86/assembler/assembler-tests.factor
basis/cpu/x86/assembler/assembler.factor
basis/cpu/x86/assembler/operands/operands.factor
basis/cpu/x86/assembler/syntax/syntax.factor
basis/cpu/x86/bootstrap.factor
basis/cpu/x86/features/features.factor
basis/cpu/x86/features/tags.txt
basis/cpu/x86/sse/authors.txt [new file with mode: 0644]
basis/cpu/x86/sse/sse.factor [new file with mode: 0644]
basis/cpu/x86/sse/tags.txt [new file with mode: 0644]
basis/cpu/x86/tags.txt
basis/cpu/x86/unix/bootstrap.factor [new file with mode: 0644]
basis/cpu/x86/winnt/bootstrap.factor [new file with mode: 0644]
basis/cpu/x86/x86.factor
basis/cpu/x86/x87/authors.txt [new file with mode: 0644]
basis/cpu/x86/x87/tags.txt [new file with mode: 0644]
basis/cpu/x86/x87/x87.factor [new file with mode: 0644]
basis/csv/csv-docs.factor
basis/csv/csv.factor
basis/db/postgresql/ffi/ffi.factor
basis/db/postgresql/lib/lib.factor
basis/db/sqlite/ffi/ffi.factor
basis/db/sqlite/lib/lib.factor
basis/db/tuples/tuples.factor
basis/debugger/debugger.factor
basis/debugger/windows/windows.factor
basis/delegate/delegate-docs.factor
basis/delegate/delegate-tests.factor
basis/delegate/delegate.factor
basis/deques/deques.factor
basis/disjoint-sets/disjoint-sets.factor
basis/dlists/dlists.factor
basis/documents/documents-docs.factor
basis/documents/documents.factor
basis/editors/editpadlite/tags.txt
basis/editors/editpadpro/tags.txt
basis/editors/editplus/tags.txt
basis/editors/emacs/tags.txt
basis/editors/emacs/windows/tags.txt
basis/editors/emeditor/tags.txt
basis/editors/etexteditor/tags.txt
basis/editors/gedit/tags.txt
basis/editors/gvim/tags.txt
basis/editors/gvim/unix/tags.txt
basis/editors/gvim/windows/tags.txt
basis/editors/jedit/tags.txt
basis/editors/macvim/tags.txt
basis/editors/notepad/tags.txt
basis/editors/notepad2/tags.txt
basis/editors/notepadpp/tags.txt
basis/editors/scite/tags.txt
basis/editors/ted-notepad/tags.txt
basis/editors/textedit/tags.txt
basis/editors/textmate/tags.txt
basis/editors/textpad/tags.txt
basis/editors/textwrangler/tags.txt
basis/editors/ultraedit/tags.txt
basis/editors/vim/generate-syntax/tags.txt [deleted file]
basis/editors/vim/tags.txt
basis/editors/wordpad/tags.txt
basis/farkup/farkup.factor
basis/formatting/formatting-docs.factor [changed mode: 0644->0755]
basis/formatting/formatting-tests.factor [changed mode: 0644->0755]
basis/formatting/formatting.factor
basis/ftp/server/server.factor
basis/functors/functors-tests.factor
basis/furnace/actions/actions-docs.factor
basis/furnace/auth/auth.factor
basis/furnace/cache/cache.factor
basis/furnace/chloe-tags/chloe-tags.factor
basis/furnace/recaptcha/example/example.factor
basis/furnace/recaptcha/example/example.xml
basis/furnace/recaptcha/recaptcha-docs.factor
basis/furnace/recaptcha/recaptcha.factor
basis/furnace/recaptcha/tags.txt
basis/furnace/scopes/scopes.factor
basis/furnace/syndication/syndication.factor
basis/game/input/dinput/dinput.factor
basis/game/input/input.factor
basis/game/input/iokit/iokit.factor
basis/game/input/linux/authors.txt [deleted file]
basis/game/input/linux/linux.factor [deleted file]
basis/game/input/linux/platforms.txt [deleted file]
basis/game/input/linux/summary.txt [deleted file]
basis/game/input/linux/tags.txt [deleted file]
basis/game/input/x11/authors.txt [new file with mode: 0644]
basis/game/input/x11/platforms.txt [new file with mode: 0644]
basis/game/input/x11/summary.txt [new file with mode: 0644]
basis/game/input/x11/tags.txt [new file with mode: 0644]
basis/game/input/x11/x11.factor [new file with mode: 0644]
basis/game/input/xinput/xinput.factor
basis/generalizations/generalizations-docs.factor
basis/generalizations/generalizations-tests.factor
basis/generalizations/generalizations.factor
basis/glib/glib.factor
basis/grouping/authors.txt
basis/grouping/grouping-docs.factor
basis/grouping/grouping-tests.factor
basis/grouping/grouping.factor
basis/half-floats/authors.txt [deleted file]
basis/half-floats/half-floats-tests.factor [deleted file]
basis/half-floats/half-floats.factor [deleted file]
basis/half-floats/summary.txt [deleted file]
basis/heaps/heaps.factor
basis/help/crossref/crossref-tests.factor
basis/help/definitions/definitions.factor
basis/help/handbook/handbook.factor
basis/help/lint/checks/checks.factor
basis/help/lint/lint.factor
basis/help/markup/markup.factor
basis/help/tips/tips.factor
basis/hints/hints-tests.factor
basis/hints/hints.factor
basis/html/components/components-docs.factor
basis/html/components/components.factor
basis/html/templates/chloe/chloe-docs.factor
basis/http/client/client.factor
basis/http/http-docs.factor
basis/http/http-tests.factor
basis/http/http.factor
basis/http/server/responses/responses.factor
basis/http/server/server-tests.factor
basis/http/server/server.factor
basis/http/server/static/static.factor
basis/images/bitmap/bitmap-tests.factor
basis/images/bitmap/bitmap.factor
basis/images/bitmap/loading/loading.factor
basis/images/jpeg/jpeg.factor
basis/images/normalization/normalization-tests.factor
basis/images/normalization/normalization.factor
basis/images/pbm/authors.txt [new file with mode: 0644]
basis/images/pbm/pbm-tests.factor [new file with mode: 0644]
basis/images/pbm/pbm.factor [new file with mode: 0644]
basis/images/pbm/summary.txt [new file with mode: 0644]
basis/images/pgm/authors.txt [new file with mode: 0644]
basis/images/pgm/pgm-tests.factor [new file with mode: 0644]
basis/images/pgm/pgm.factor [new file with mode: 0644]
basis/images/pgm/summary.txt [new file with mode: 0644]
basis/images/ppm/authors.txt [new file with mode: 0644]
basis/images/ppm/ppm-tests.factor [new file with mode: 0644]
basis/images/ppm/ppm.factor [new file with mode: 0755]
basis/images/ppm/summary.txt [new file with mode: 0644]
basis/images/processing/processing.factor
basis/images/tiff/tiff.factor [changed mode: 0644->0755]
basis/inspector/inspector.factor
basis/inverse/inverse.factor
basis/io/backend/unix/multiplexers/kqueue/kqueue.factor
basis/io/backend/unix/multiplexers/run-loop/run-loop.factor
basis/io/backend/unix/unix.factor
basis/io/backend/windows/nt/nt.factor [changed mode: 0644->0755]
basis/io/backend/windows/nt/privileges/privileges.factor
basis/io/backend/windows/windows.factor
basis/io/buffers/buffers-tests.factor
basis/io/buffers/buffers.factor
basis/io/directories/search/search.factor
basis/io/directories/unix/unix.factor
basis/io/encodings/8-bit/8-bit.factor
basis/io/encodings/ascii/ascii.factor
basis/io/encodings/iana/iana.factor
basis/io/encodings/iso2022/iso2022.factor
basis/io/encodings/utf32/utf32-tests.factor
basis/io/files/info/unix/freebsd/freebsd.factor
basis/io/files/info/unix/netbsd/netbsd.factor
basis/io/files/info/unix/openbsd/openbsd.factor
basis/io/files/info/windows/windows.factor [changed mode: 0644->0755]
basis/io/files/unique/unique-docs.factor
basis/io/files/unique/unique.factor
basis/io/files/unique/unix/unix.factor
basis/io/files/unix/unix-tests.factor
basis/io/files/unix/unix.factor
basis/io/files/windows/windows.factor
basis/io/launcher/launcher.factor
basis/io/launcher/unix/unix-tests.factor
basis/io/launcher/unix/unix.factor
basis/io/launcher/windows/nt/nt.factor
basis/io/launcher/windows/windows.factor
basis/io/mmap/unix/unix.factor
basis/io/mmap/windows/windows.factor
basis/io/monitors/linux/linux.factor
basis/io/monitors/monitors.factor
basis/io/monitors/recursive/recursive.factor
basis/io/monitors/windows/nt/nt.factor
basis/io/pipes/windows/nt/nt.factor
basis/io/ports/ports-tests.factor [new file with mode: 0644]
basis/io/ports/ports.factor
basis/io/servers/connection/connection.factor
basis/io/sockets/secure/openssl/openssl.factor
basis/io/sockets/sockets-docs.factor
basis/io/sockets/sockets.factor
basis/io/sockets/windows/nt/nt.factor
basis/io/sockets/windows/windows.factor
basis/io/streams/byte-array/fast/authors.txt [new file with mode: 0644]
basis/io/streams/byte-array/fast/fast.factor [new file with mode: 0644]
basis/io/streams/limited/limited.factor
basis/io/thread/thread.factor
basis/io/timeouts/timeouts.factor
basis/iokit/hid/hid.factor
basis/iokit/iokit.factor
basis/libc/libc-docs.factor
basis/libc/libc.factor
basis/lists/lists-docs.factor
basis/lists/lists.factor
basis/literals/literals-docs.factor
basis/literals/literals-tests.factor
basis/literals/literals.factor
basis/locals/errors/errors.factor
basis/locals/locals.factor
basis/locals/parser/parser.factor
basis/locals/rewrite/closures/closures.factor
basis/locals/rewrite/point-free/point-free.factor
basis/locals/rewrite/sugar/sugar.factor
basis/locals/types/types.factor
basis/logging/insomniac/insomniac.factor
basis/logging/logging.factor
basis/macros/macros.factor
basis/match/match.factor
basis/math/bitwise/bitwise-docs.factor
basis/math/bitwise/bitwise-tests.factor
basis/math/bitwise/bitwise.factor
basis/math/blas/matrices/matrices.factor
basis/math/floats/env/ppc/tags.txt
basis/math/floats/env/x86/32/32.factor
basis/math/floats/env/x86/32/tags.txt
basis/math/floats/env/x86/64/64.factor
basis/math/floats/env/x86/64/tags.txt
basis/math/floats/env/x86/tags.txt
basis/math/floats/half/authors.txt [new file with mode: 0644]
basis/math/floats/half/half-tests.factor [new file with mode: 0644]
basis/math/floats/half/half.factor [new file with mode: 0644]
basis/math/floats/half/summary.txt [new file with mode: 0644]
basis/math/libm/libm-docs.factor
basis/math/libm/libm.factor
basis/math/matrices/elimination/elimination.factor
basis/math/matrices/matrices-tests.factor
basis/math/matrices/matrices.factor
basis/math/polynomials/polynomials-docs.factor
basis/math/polynomials/polynomials.factor
basis/math/primes/factors/factors.factor
basis/math/ranges/ranges-tests.factor
basis/math/rectangles/rectangles.factor
basis/math/vectors/conversion/conversion-tests.factor
basis/math/vectors/conversion/conversion.factor
basis/math/vectors/simd/cords/cords.factor
basis/math/vectors/simd/intrinsics/intrinsics.factor
basis/math/vectors/simd/simd-docs.factor
basis/math/vectors/simd/simd-tests.factor
basis/math/vectors/simd/simd.factor
basis/math/vectors/vectors.factor
basis/memoize/memoize.factor
basis/mime/types/types.factor
basis/mirrors/mirrors.factor
basis/models/arrow/smart/smart.factor
basis/models/delay/delay.factor
basis/models/models.factor
basis/models/product/product-docs.factor
basis/models/range/range.factor
basis/nibble-arrays/nibble-arrays.factor
basis/nmake/nmake.factor
basis/opengl/framebuffers/framebuffers.factor
basis/opengl/gl/extensions/extensions.factor
basis/opengl/gl/gl.factor
basis/opengl/gl/macosx/macosx.factor
basis/opengl/gl/unix/authors.txt [deleted file]
basis/opengl/gl/unix/platforms.txt [deleted file]
basis/opengl/gl/unix/unix.factor [deleted file]
basis/opengl/gl/windows/windows.factor
basis/opengl/gl/x11/authors.txt [new file with mode: 0755]
basis/opengl/gl/x11/platforms.txt [new file with mode: 0644]
basis/opengl/gl/x11/x11.factor [new file with mode: 0644]
basis/opengl/gl3/gl3.factor
basis/opengl/opengl.factor
basis/opengl/shaders/shaders.factor
basis/opengl/textures/textures.factor
basis/openssl/libcrypto/libcrypto.factor
basis/openssl/libssl/libssl.factor
basis/pango/cairo/cairo.factor
basis/pango/fonts/fonts.factor
basis/pango/layouts/layouts.factor
basis/pango/pango.factor
basis/peg/ebnf/ebnf-tests.factor
basis/peg/ebnf/ebnf.factor
basis/peg/peg.factor
basis/prettyprint/backend/backend.factor
basis/prettyprint/config/config.factor
basis/prettyprint/prettyprint.factor
basis/prettyprint/sections/sections.factor
basis/promises/promises.factor
basis/random/random-tests.factor
basis/random/sfmt/sfmt.factor
basis/random/windows/windows.factor [changed mode: 0644->0755]
basis/refs/refs.factor
basis/regexp/classes/classes-tests.factor
basis/regexp/classes/classes.factor
basis/regexp/compiler/compiler.factor
basis/regexp/dfa/dfa.factor
basis/regexp/minimize/minimize-tests.factor
basis/regexp/minimize/minimize.factor
basis/regexp/negation/negation-tests.factor
basis/regexp/negation/negation.factor
basis/regexp/nfa/nfa.factor
basis/regexp/parser/parser.factor
basis/regexp/regexp-tests.factor
basis/regexp/regexp.factor
basis/regexp/transition-tables/transition-tables.factor
basis/see/see.factor
basis/sequences/cords/cords.factor
basis/sequences/deep/deep-docs.factor
basis/sequences/deep/deep.factor
basis/sequences/generalizations/generalizations-docs.factor
basis/sequences/generalizations/generalizations-tests.factor
basis/sequences/generalizations/generalizations.factor
basis/sequences/parser/parser.factor
basis/sequences/unrolled/authors.txt [new file with mode: 0644]
basis/sequences/unrolled/summary.txt [new file with mode: 0644]
basis/sequences/unrolled/unrolled-docs.factor [new file with mode: 0644]
basis/sequences/unrolled/unrolled-tests.factor [new file with mode: 0644]
basis/sequences/unrolled/unrolled.factor [new file with mode: 0644]
basis/serialize/serialize-tests.factor
basis/shuffle/shuffle.factor
basis/simple-flat-file/simple-flat-file.factor
basis/smtp/smtp.factor
basis/sorting/insertion/insertion.factor
basis/specialized-arrays/specialized-arrays-docs.factor
basis/specialized-arrays/specialized-arrays-tests.factor
basis/specialized-arrays/specialized-arrays.factor
basis/specialized-vectors/specialized-vectors.factor
basis/stack-checker/alien/alien.factor
basis/stack-checker/backend/backend-tests.factor
basis/stack-checker/backend/backend.factor
basis/stack-checker/branches/branches.factor
basis/stack-checker/dependencies/dependencies.factor
basis/stack-checker/errors/errors-docs.factor
basis/stack-checker/errors/errors.factor
basis/stack-checker/errors/prettyprint/prettyprint.factor
basis/stack-checker/inlining/inlining.factor
basis/stack-checker/known-words/known-words.factor
basis/stack-checker/row-polymorphism/row-polymorphism.factor [new file with mode: 0644]
basis/stack-checker/stack-checker-docs.factor
basis/stack-checker/stack-checker-tests.factor
basis/stack-checker/stack-checker.factor
basis/stack-checker/state/state.factor
basis/stack-checker/transforms/transforms.factor
basis/stack-checker/values/values.factor
basis/suffix-arrays/suffix-arrays-tests.factor
basis/suffix-arrays/suffix-arrays.factor
basis/syndication/syndication.factor
basis/system-info/linux/linux.factor
basis/system-info/windows/nt/nt-tests.factor [new file with mode: 0755]
basis/system-info/windows/nt/nt.factor
basis/threads/threads-docs.factor
basis/threads/threads-tests.factor
basis/threads/threads.factor
basis/tools/annotations/annotations.factor
basis/tools/completion/completion.factor
basis/tools/continuations/continuations.factor
basis/tools/deploy/config/config.factor
basis/tools/deploy/deploy-docs.factor
basis/tools/deploy/deploy.factor
basis/tools/deploy/macosx/macosx.factor
basis/tools/deploy/shaker/shaker.factor
basis/tools/deploy/shaker/strip-c-io.factor [new file with mode: 0644]
basis/tools/deploy/shaker/strip-debugger.factor
basis/tools/deploy/shaker/strip-ui-error-hook.factor [new file with mode: 0644]
basis/tools/deploy/test/9/9.factor
basis/tools/deploy/windows/windows.factor
basis/tools/disassembler/disassembler.factor
basis/tools/disassembler/gdb/tags.txt
basis/tools/disassembler/udis/tags.txt
basis/tools/disassembler/udis/udis.factor
basis/tools/dispatch/dispatch.factor
basis/tools/errors/model/model.factor
basis/tools/memory/memory-tests.factor
basis/tools/memory/memory.factor
basis/tools/profiler/profiler-tests.factor
basis/tools/profiler/profiler.factor
basis/tools/scaffold/scaffold.factor
basis/tools/test/test.factor
basis/tools/threads/threads.factor
basis/tools/time/time-docs.factor
basis/tools/time/time.factor
basis/tools/walker/walker.factor
basis/typed/debugger/debugger.factor
basis/typed/typed-tests.factor
basis/typed/typed.factor
basis/ui/backend/cocoa/cocoa.factor
basis/ui/backend/cocoa/views/views.factor
basis/ui/backend/windows/windows.factor [changed mode: 0644->0755]
basis/ui/backend/x11/tags.txt
basis/ui/backend/x11/x11.factor
basis/ui/clipboards/clipboards.factor
basis/ui/gadgets/buttons/buttons.factor
basis/ui/gadgets/editors/editors.factor
basis/ui/gadgets/gadgets-tests.factor
basis/ui/gadgets/gadgets.factor
basis/ui/gadgets/grids/grids-docs.factor
basis/ui/gadgets/grids/grids.factor
basis/ui/gadgets/labels/labels.factor
basis/ui/gadgets/packs/packs.factor
basis/ui/gadgets/sliders/sliders.factor
basis/ui/gadgets/tables/tables-docs.factor
basis/ui/gadgets/tables/tables.factor
basis/ui/gadgets/worlds/worlds.factor
basis/ui/gestures/gestures.factor
basis/ui/tools/browser/history/history-tests.factor
basis/ui/tools/deploy/deploy.factor
basis/ui/tools/error-list/error-list.factor
basis/ui/tools/listener/listener-tests.factor
basis/ui/tools/listener/listener.factor
basis/ui/tools/operations/operations.factor
basis/ui/tools/tools.factor
basis/ui/ui-docs.factor
basis/ui/ui.factor
basis/unicode/breaks/breaks.factor
basis/unicode/data/data.factor
basis/unix/ffi/bsd/bsd.factor
basis/unix/ffi/bsd/freebsd/freebsd.factor
basis/unix/ffi/bsd/macosx/macosx.factor
basis/unix/ffi/bsd/netbsd/netbsd.factor
basis/unix/ffi/bsd/openbsd/openbsd.factor
basis/unix/ffi/ffi.factor
basis/unix/ffi/linux/linux.factor
basis/unix/ffi/solaris/solaris.factor
basis/unix/groups/groups.factor
basis/unix/linux/inotify/inotify.factor
basis/unix/process/process.factor
basis/unix/stat/freebsd/freebsd.factor
basis/unix/stat/linux/32/32.factor
basis/unix/stat/linux/32/tags.txt
basis/unix/stat/linux/64/64.factor
basis/unix/stat/linux/64/tags.txt
basis/unix/stat/macosx/macosx.factor
basis/unix/stat/netbsd/32/32.factor
basis/unix/stat/netbsd/32/tags.txt
basis/unix/stat/netbsd/64/64.factor
basis/unix/stat/netbsd/64/tags.txt
basis/unix/stat/openbsd/openbsd.factor
basis/unix/statfs/freebsd/freebsd.factor
basis/unix/statfs/linux/linux.factor
basis/unix/statfs/macosx/macosx.factor
basis/unix/statfs/openbsd/openbsd.factor
basis/unix/statvfs/freebsd/freebsd.factor
basis/unix/statvfs/linux/linux.factor
basis/unix/statvfs/macosx/macosx.factor
basis/unix/statvfs/netbsd/netbsd.factor
basis/unix/statvfs/openbsd/openbsd.factor
basis/unix/time/time.factor
basis/unix/types/freebsd/freebsd.factor
basis/unix/types/netbsd/32/tags.txt
basis/unix/types/netbsd/64/tags.txt
basis/unix/unix.factor
basis/unix/users/users.factor
basis/unix/utmpx/utmpx.factor
basis/unrolled-lists/unrolled-lists.factor
basis/urls/urls.factor
basis/validators/validators-tests.factor
basis/validators/validators.factor
basis/values/values.factor
basis/vm/vm.factor
basis/vocabs/hierarchy/hierarchy.factor
basis/vocabs/metadata/metadata.factor
basis/vocabs/refresh/monitor/monitor.factor
basis/vocabs/refresh/refresh.factor
basis/windows/advapi32/advapi32.factor [changed mode: 0644->0755]
basis/windows/ce/ce.factor
basis/windows/com/com-tests.factor
basis/windows/com/com.factor
basis/windows/com/syntax/syntax.factor
basis/windows/com/wrapper/wrapper.factor
basis/windows/ddk/hid/hid.factor [changed mode: 0644->0755]
basis/windows/ddk/hid/summary.txt [new file with mode: 0644]
basis/windows/ddk/hid/tags.txt [new file with mode: 0644]
basis/windows/ddk/setupapi/authors.txt [new file with mode: 0644]
basis/windows/ddk/setupapi/platforms.txt [new file with mode: 0644]
basis/windows/ddk/setupapi/setupapi.factor [new file with mode: 0755]
basis/windows/ddk/setupapi/summary.txt [new file with mode: 0644]
basis/windows/ddk/setupapi/tags.txt [new file with mode: 0644]
basis/windows/ddk/winusb/authors.txt [new file with mode: 0644]
basis/windows/ddk/winusb/platforms.txt [new file with mode: 0644]
basis/windows/ddk/winusb/summary.txt [new file with mode: 0644]
basis/windows/ddk/winusb/tags.txt [new file with mode: 0644]
basis/windows/ddk/winusb/winusb.factor [new file with mode: 0755]
basis/windows/directx/d2d1/d2d1.factor
basis/windows/directx/d3d10/d3d10.factor
basis/windows/directx/d3d10effect/d3d10effect.factor
basis/windows/directx/d3d10misc/d3d10misc.factor
basis/windows/directx/d3d10shader/d3d10shader.factor
basis/windows/directx/d3d11/d3d11.factor
basis/windows/directx/d3d11shader/d3d11shader.factor
basis/windows/directx/d3d9/d3d9.factor
basis/windows/directx/d3d9types/d3d9types.factor
basis/windows/directx/d3dcsx/d3dcsx.factor
basis/windows/directx/d3dx10async/d3dx10async.factor
basis/windows/directx/d3dx11async/d3dx11async.factor
basis/windows/directx/d3dx11tex/d3dx11tex.factor
basis/windows/directx/d3dx9shader/d3dx9shader.factor
basis/windows/directx/dcommon/dcommon.factor
basis/windows/directx/dinput/constants/constants.factor [changed mode: 0644->0755]
basis/windows/directx/dwrite/dwrite.factor [changed mode: 0644->0755]
basis/windows/directx/dxgi/dxgi.factor
basis/windows/directx/dxgitype/dxgitype.factor
basis/windows/directx/xapo/xapo.factor
basis/windows/directx/xapofx/xapofx.factor
basis/windows/directx/xaudio2/xaudio2.factor
basis/windows/dwmapi/dwmapi.factor [changed mode: 0644->0755]
basis/windows/errors/errors.factor [changed mode: 0644->0755]
basis/windows/gdi32/gdi32.factor
basis/windows/kernel32/kernel32.factor
basis/windows/nt/nt.factor
basis/windows/offscreen/offscreen.factor
basis/windows/ole32/ole32.factor
basis/windows/opengl32/opengl32.factor
basis/windows/types/types.factor
basis/windows/uniscribe/uniscribe.factor [changed mode: 0644->0755]
basis/windows/user32/user32.factor
basis/windows/usp10/usp10.factor
basis/windows/winsock/winsock.factor
basis/x11/clipboard/clipboard.factor
basis/x11/constants/constants.factor
basis/x11/events/events.factor
basis/x11/glx/glx.factor
basis/x11/syntax/syntax.factor
basis/x11/windows/platforms.txt [deleted file]
basis/x11/windows/windows.factor
basis/x11/x11.factor
basis/x11/xinput2/authors.txt [new file with mode: 0644]
basis/x11/xinput2/constants/authors.txt [new file with mode: 0644]
basis/x11/xinput2/constants/constants.factor [new file with mode: 0644]
basis/x11/xinput2/ffi/authors.txt [new file with mode: 0644]
basis/x11/xinput2/ffi/ffi.factor [new file with mode: 0644]
basis/x11/xinput2/xinput2.factor [new file with mode: 0644]
basis/x11/xlib/xlib.factor
basis/xml/data/data.factor
basis/xml/elements/elements.factor
basis/xml/syntax/inverse/inverse.factor [new file with mode: 0644]
basis/xml/syntax/syntax.factor
basis/xml/tokenize/tokenize.factor
basis/xmode/catalog/catalog.factor
basis/xmode/keyword-map/keyword-map.factor
basis/xmode/loader/loader.factor
basis/xmode/loader/syntax/syntax.factor
basis/xmode/marker/marker.factor
basis/xmode/rules/rules.factor
build-support/cleanup
build-support/factor.cmd [new file with mode: 0644]
build-support/factor.sh
build-support/http-get.vbs [new file with mode: 0644]
core/alien/alien-docs.factor
core/alien/alien-tests.factor
core/alien/alien.factor [changed mode: 0644->0755]
core/alien/strings/strings.factor
core/assocs/assocs-docs.factor
core/assocs/assocs.factor
core/bootstrap/primitives.factor
core/bootstrap/stage1.factor
core/bootstrap/syntax.factor
core/classes/algebra/algebra.factor
core/classes/classes.factor
core/classes/tuple/parser/parser.factor
core/classes/tuple/tuple-docs.factor
core/classes/tuple/tuple-tests.factor
core/combinators/combinators-docs.factor
core/combinators/combinators-tests.factor
core/combinators/combinators.factor
core/compiler/units/units.factor
core/continuations/continuations-docs.factor
core/continuations/continuations.factor
core/destructors/destructors.factor
core/effects/effects-docs.factor
core/effects/effects-tests.factor
core/effects/effects.factor
core/effects/parser/parser.factor
core/generic/generic-tests.factor
core/generic/generic.factor
core/generic/math/math.factor
core/generic/single/single-tests.factor
core/growable/growable.factor
core/hash-sets/hash-sets-docs.factor [new file with mode: 0644]
core/hash-sets/hash-sets-tests.factor [new file with mode: 0644]
core/hash-sets/hash-sets.factor [new file with mode: 0644]
core/hashtables/hashtables.factor
core/io/encodings/encodings.factor
core/io/encodings/utf8/utf8.factor
core/io/files/files-tests.factor
core/io/io-docs.factor
core/io/io.factor
core/io/streams/byte-array/byte-array-tests.factor
core/io/streams/c/c-docs.factor
core/io/streams/c/c-tests.factor
core/io/streams/c/c.factor
core/kernel/kernel-docs.factor
core/kernel/kernel-tests.factor
core/kernel/kernel.factor
core/lexer/lexer-docs.factor
core/lexer/lexer.factor
core/math/math-docs.factor
core/math/math.factor
core/math/order/order-docs.factor
core/math/parser/parser.factor
core/namespaces/namespaces.factor
core/parser/parser-docs.factor
core/parser/parser-tests.factor
core/parser/parser.factor
core/sequences/sequences-docs.factor
core/sequences/sequences-tests.factor
core/sequences/sequences.factor
core/sets/sets-docs.factor
core/sets/sets-tests.factor
core/sets/sets.factor
core/slots/slots-docs.factor
core/slots/slots-tests.factor
core/slots/slots.factor
core/source-files/source-files.factor
core/splitting/splitting.factor
core/strings/parser/parser.factor
core/strings/strings-tests.factor
core/strings/strings.factor
core/syntax/syntax-docs.factor
core/syntax/syntax.factor
core/system/system.factor
core/vocabs/loader/loader-docs.factor
core/vocabs/loader/loader-tests.factor
core/vocabs/loader/loader.factor
core/vocabs/loader/test/a/tags.txt
core/vocabs/loader/test/b/tags.txt
core/vocabs/loader/test/c/tags.txt
core/vocabs/loader/test/d/tags.txt
core/vocabs/loader/test/e/tags.txt
core/vocabs/loader/test/f/tags.txt
core/vocabs/loader/test/g/tags.txt
core/vocabs/loader/test/h/tags.txt
core/vocabs/loader/test/i/tags.txt
core/vocabs/loader/test/j/tags.txt
core/vocabs/loader/test/k/tags.txt
core/vocabs/loader/test/l/tags.txt
core/vocabs/loader/test/m/m.factor [new file with mode: 0644]
core/vocabs/loader/test/m/tags.txt [new file with mode: 0644]
core/vocabs/loader/test/n/n.factor [new file with mode: 0644]
core/vocabs/loader/test/n/tags.txt [new file with mode: 0644]
core/vocabs/loader/test/o/o.factor [new file with mode: 0644]
core/vocabs/loader/test/o/tags.txt [new file with mode: 0644]
core/vocabs/parser/parser.factor
core/vocabs/vocabs-docs.factor
core/vocabs/vocabs.factor
core/words/words.factor
extra/alien/cxx/cxx.factor [new file with mode: 0644]
extra/alien/cxx/demangle/demangle.factor [new file with mode: 0644]
extra/alien/cxx/demangle/libstdcxx/libstdcxx.factor [new file with mode: 0644]
extra/alien/cxx/scaffold/scaffold.factor [new file with mode: 0644]
extra/alien/cxx/tests/test.cpp [new file with mode: 0644]
extra/alien/data/map/map-tests.factor
extra/asn1/asn1.factor
extra/audio/engine/engine.factor
extra/audio/engine/test/test.factor
extra/audio/vorbis/vorbis.factor
extra/bank/bank.factor
extra/benchmark/binary-search/binary-search.factor
extra/benchmark/binary-trees/binary-trees.factor
extra/benchmark/binary-trees/deploy.factor [new file with mode: 0644]
extra/benchmark/chameneos-redux/chameneos-redux.factor
extra/benchmark/fasta/deploy.factor [new file with mode: 0644]
extra/benchmark/fasta/fasta.factor
extra/benchmark/fib6/fib6.factor
extra/benchmark/knucleotide/deploy.factor [new file with mode: 0644]
extra/benchmark/knucleotide/knucleotide-input.txt
extra/benchmark/knucleotide/knucleotide.factor
extra/benchmark/nbody-simd/deploy.factor [new file with mode: 0644]
extra/benchmark/nbody-simd/nbody-simd.factor
extra/benchmark/nbody/nbody.factor
extra/benchmark/regex-dna/deploy.factor
extra/benchmark/regex-dna/regex-dna.factor
extra/benchmark/reverse-complement/deploy.factor [new file with mode: 0644]
extra/benchmark/spectral-norm-simd/authors.txt [new file with mode: 0644]
extra/benchmark/spectral-norm-simd/spectral-norm-simd.factor [new file with mode: 0644]
extra/benchmark/spectral-norm/deploy.factor [new file with mode: 0644]
extra/benchmark/spectral-norm/spectral-norm.factor
extra/benchmark/yuv-to-rgb/yuv-to-rgb.factor
extra/bit/ly/authors.txt [new file with mode: 0644]
extra/bit/ly/ly.factor [new file with mode: 0644]
extra/bit/ly/summary.txt [new file with mode: 0644]
extra/bit/ly/tags.txt [new file with mode: 0644]
extra/boyer-moore/authors.txt [new file with mode: 0644]
extra/boyer-moore/boyer-moore-docs.factor [new file with mode: 0644]
extra/boyer-moore/boyer-moore-tests.factor [new file with mode: 0644]
extra/boyer-moore/boyer-moore.factor [new file with mode: 0644]
extra/boyer-moore/summary.txt [new file with mode: 0644]
extra/boyer-moore/tags.txt [new file with mode: 0644]
extra/bson/writer/writer.factor
extra/build-support/authors.txt [new file with mode: 0644]
extra/build-support/build-support-tests.factor [new file with mode: 0644]
extra/build-support/build-support.factor [new file with mode: 0644]
extra/build-support/platforms.txt [new file with mode: 0644]
extra/c/lexer/lexer.factor
extra/calendar/holidays/us/us.factor
extra/chipmunk/chipmunk.factor [deleted file]
extra/chipmunk/demo/demo.factor
extra/chipmunk/ffi/ffi.factor [new file with mode: 0644]
extra/classes/struct/vectored/vectored-tests.factor
extra/classes/struct/vectored/vectored.factor
extra/closures/closures.factor [deleted file]
extra/compiler/graphviz/graphviz.factor
extra/constructors/constructors-tests.factor
extra/constructors/constructors.factor
extra/contributors/contributors.factor
extra/couchdb/tags.txt
extra/cpu/8080/emulator/emulator.factor
extra/cpu/8080/test/test.factor
extra/cuda/authors.txt [new file with mode: 0644]
extra/cuda/contexts/contexts.factor [new file with mode: 0644]
extra/cuda/cuda-tests.factor [new file with mode: 0644]
extra/cuda/cuda.factor [new file with mode: 0644]
extra/cuda/demos/hello-world/authors.txt [new file with mode: 0644]
extra/cuda/demos/hello-world/hello-world.factor [new file with mode: 0644]
extra/cuda/demos/hello-world/hello.cu [new file with mode: 0644]
extra/cuda/demos/hello-world/hello.ptx [new file with mode: 0644]
extra/cuda/demos/prefix-sum/authors.txt [new file with mode: 0644]
extra/cuda/demos/prefix-sum/prefix-sum.cu [new file with mode: 0644]
extra/cuda/demos/prefix-sum/prefix-sum.factor [new file with mode: 0644]
extra/cuda/demos/prefix-sum/prefix-sum.ptx [new file with mode: 0644]
extra/cuda/devices/authors.txt [new file with mode: 0644]
extra/cuda/devices/devices-tests.factor [new file with mode: 0644]
extra/cuda/devices/devices.factor [new file with mode: 0644]
extra/cuda/ffi/ffi.factor [new file with mode: 0644]
extra/cuda/ffi/tags.txt [new file with mode: 0644]
extra/cuda/gl/ffi/ffi.factor [new file with mode: 0644]
extra/cuda/gl/gl.factor [new file with mode: 0644]
extra/cuda/libraries/authors.txt [new file with mode: 0644]
extra/cuda/libraries/libraries.factor [new file with mode: 0644]
extra/cuda/memory/authors.txt [new file with mode: 0644]
extra/cuda/memory/memory.factor [new file with mode: 0644]
extra/cuda/nvcc/authors.txt [new file with mode: 0644]
extra/cuda/nvcc/nvcc.factor [new file with mode: 0644]
extra/cuda/ptx/ptx-tests.factor [new file with mode: 0644]
extra/cuda/ptx/ptx.factor [new file with mode: 0644]
extra/cuda/syntax/authors.txt [new file with mode: 0644]
extra/cuda/syntax/syntax.factor [new file with mode: 0644]
extra/cuda/tags.txt [new file with mode: 0644]
extra/cuda/types/types.factor [new file with mode: 0644]
extra/cuda/utils/authors.txt [new file with mode: 0644]
extra/curses/ffi/ffi.factor
extra/cursors/authors.txt
extra/cursors/cursors-tests.factor
extra/cursors/cursors.factor
extra/db/info/info.factor [deleted file]
extra/demos/demos.factor
extra/descriptive/descriptive.factor
extra/dwarf/authors.txt [new file with mode: 0644]
extra/dwarf/dwarf.factor [new file with mode: 0644]
extra/ecdsa/ecdsa.factor
extra/ecdsa/tags.txt
extra/elf/a.elf [new file with mode: 0755]
extra/elf/authors.txt [new file with mode: 0644]
extra/elf/elf-tests.factor [new file with mode: 0644]
extra/elf/elf.factor [new file with mode: 0644]
extra/elf/nm/authors.txt [new file with mode: 0644]
extra/elf/nm/nm-docs.factor [new file with mode: 0644]
extra/elf/nm/nm-tests.factor [new file with mode: 0644]
extra/elf/nm/nm.factor [new file with mode: 0644]
extra/elf/nm/summary.txt [new file with mode: 0644]
extra/elf/summary.txt [new file with mode: 0644]
extra/enter/authors.txt [deleted file]
extra/enter/enter.factor [deleted file]
extra/fluids/authors.txt [new file with mode: 0644]
extra/fluids/colors.ppm [new file with mode: 0644]
extra/fluids/fluids.factor [new file with mode: 0644]
extra/fluids/particle2.pgm [new file with mode: 0644]
extra/fluids/resources.txt [new file with mode: 0644]
extra/freetype/freetype.factor
extra/fries/authors.txt [deleted file]
extra/fries/fries.factor [deleted file]
extra/fries/summary.txt [deleted file]
extra/fuel/fuel.factor
extra/fuel/xref/xref.factor
extra/fullscreen/authors.txt [new file with mode: 0755]
extra/fullscreen/fullscreen.factor [new file with mode: 0755]
extra/fullscreen/platforms.txt [new file with mode: 0644]
extra/game/debug/authors.txt [new file with mode: 0644]
extra/game/debug/debug.factor [new file with mode: 0644]
extra/game/debug/summary.txt [new file with mode: 0644]
extra/game/debug/tags.txt [new file with mode: 0644]
extra/game/debug/tests/tests.factor [new file with mode: 0644]
extra/game/input/demos/joysticks/authors.txt [new file with mode: 0644]
extra/game/input/demos/joysticks/deploy.factor [new file with mode: 0644]
extra/game/input/demos/joysticks/joysticks.factor [new file with mode: 0644]
extra/game/input/demos/joysticks/summary.txt [new file with mode: 0644]
extra/game/input/demos/joysticks/tags.txt [new file with mode: 0755]
extra/game/input/demos/key-caps/authors.txt [new file with mode: 0644]
extra/game/input/demos/key-caps/key-caps.factor [new file with mode: 0644]
extra/game/input/demos/key-caps/summary.txt [new file with mode: 0644]
extra/game/input/demos/key-caps/tags.txt [new file with mode: 0755]
extra/game/loop/loop-docs.factor
extra/game/loop/loop.factor
extra/game/models/half-edge/authors.txt [new file with mode: 0644]
extra/game/models/half-edge/half-edge-tests.factor [new file with mode: 0644]
extra/game/models/half-edge/half-edge.factor [new file with mode: 0644]
extra/game/models/half-edge/summary.txt [new file with mode: 0644]
extra/game/models/obj/obj.factor
extra/game/models/util/util.factor
extra/game/worlds/worlds-docs.factor
extra/game/worlds/worlds.factor
extra/geo-ip/geo-ip.factor
extra/gpu/buffers/buffers-docs.factor
extra/gpu/buffers/buffers.factor
extra/gpu/demos/bunny/bunny.factor
extra/gpu/demos/raytrace/deploy.factor
extra/gpu/demos/raytrace/raytrace.factor
extra/gpu/effects/blur/authors.txt [new file with mode: 0644]
extra/gpu/effects/blur/blur.factor [new file with mode: 0644]
extra/gpu/effects/blur/summary.txt [new file with mode: 0644]
extra/gpu/effects/step/authors.txt [new file with mode: 0644]
extra/gpu/effects/step/step.factor [new file with mode: 0644]
extra/gpu/effects/step/summary.txt [new file with mode: 0644]
extra/gpu/render/render-docs.factor
extra/gpu/render/render.factor
extra/gpu/shaders/shaders.factor
extra/gpu/textures/textures.factor
extra/gpu/util/util.factor
extra/grid-meshes/grid-meshes-tests.factor
extra/html/parser/analyzer/analyzer.factor
extra/images/testing/pbm/test.ascii.fig [new file with mode: 0644]
extra/images/testing/pbm/test.ascii.pbm [new file with mode: 0644]
extra/images/testing/pbm/test.binary.fig [new file with mode: 0644]
extra/images/testing/pbm/test.binary.pbm [new file with mode: 0644]
extra/images/testing/pgm/radial.ascii.fig [new file with mode: 0644]
extra/images/testing/pgm/radial.ascii.pgm [new file with mode: 0644]
extra/images/testing/pgm/radial.binary.fig [new file with mode: 0644]
extra/images/testing/pgm/radial.binary.pgm [new file with mode: 0644]
extra/images/testing/ppm/ascii.fig [new file with mode: 0644]
extra/images/testing/ppm/ascii.ppm [new file with mode: 0644]
extra/images/testing/ppm/binary.fig [new file with mode: 0644]
extra/images/testing/ppm/binary.ppm [new file with mode: 0644]
extra/images/viewer/tags.txt [new file with mode: 0644]
extra/images/viewer/viewer-docs.factor [new file with mode: 0644]
extra/images/viewer/viewer-tests.factor [new file with mode: 0644]
extra/images/viewer/viewer.factor
extra/io/serial/unix/bsd/bsd.factor
extra/io/serial/unix/unix-tests.factor
extra/io/serial/unix/unix.factor
extra/irc/client/base/base.factor
extra/irc/client/internals/internals.factor
extra/irc/client/participants/participants.factor
extra/irc/gitbot/gitbot.factor
extra/irc/messages/base/base.factor
extra/irc/messages/parser/parser.factor
extra/javascriptcore/authors.txt [new file with mode: 0644]
extra/javascriptcore/core-foundation/authors.txt [new file with mode: 0644]
extra/javascriptcore/core-foundation/core-foundation.factor [new file with mode: 0644]
extra/javascriptcore/core-foundation/platforms.txt [new file with mode: 0644]
extra/javascriptcore/ffi/authors.txt [new file with mode: 0644]
extra/javascriptcore/ffi/ffi.factor [new file with mode: 0644]
extra/javascriptcore/ffi/hack/authors.txt [new file with mode: 0644]
extra/javascriptcore/ffi/hack/hack.factor [new file with mode: 0644]
extra/javascriptcore/javascriptcore-tests.factor [new file with mode: 0644]
extra/javascriptcore/javascriptcore.factor [new file with mode: 0644]
extra/javascriptcore/platforms.txt [new file with mode: 0644]
extra/joystick-demo/authors.txt [deleted file]
extra/joystick-demo/deploy.factor [deleted file]
extra/joystick-demo/joystick-demo.factor [deleted file]
extra/joystick-demo/summary.txt [deleted file]
extra/joystick-demo/tags.txt [deleted file]
extra/key-caps/authors.txt [deleted file]
extra/key-caps/key-caps.factor [deleted file]
extra/key-caps/summary.txt [deleted file]
extra/key-caps/tags.txt [deleted file]
extra/key-logger/authors.txt [new file with mode: 0644]
extra/key-logger/deploy.factor [new file with mode: 0644]
extra/key-logger/key-logger.factor [new file with mode: 0644]
extra/koszul/koszul.factor
extra/libusb/libusb.factor
extra/llvm/core/core.factor
extra/llvm/core/tags.txt
extra/llvm/engine/engine.factor
extra/llvm/engine/tags.txt
extra/llvm/invoker/invoker.factor
extra/llvm/invoker/tags.txt
extra/llvm/jit/jit.factor
extra/llvm/jit/tags.txt
extra/llvm/reader/tags.txt
extra/llvm/tags.txt
extra/llvm/types/tags.txt
extra/llvm/types/types.factor
extra/llvm/wrappers/tags.txt
extra/llvm/wrappers/wrappers.factor
extra/lua/authors.txt [new file with mode: 0644]
extra/lua/lua.factor [new file with mode: 0644]
extra/lua/summary.txt [new file with mode: 0644]
extra/macho/a.macho [new file with mode: 0755]
extra/macho/a2.macho [new file with mode: 0755]
extra/macho/authors.txt [new file with mode: 0644]
extra/macho/macho-tests.factor [new file with mode: 0644]
extra/macho/macho.factor [new file with mode: 0644]
extra/macho/summary.txt [new file with mode: 0644]
extra/managed-server/chat/chat.factor
extra/managed-server/managed-server.factor
extra/mason/child/child-tests.factor
extra/mason/child/child.factor
extra/mason/common/common.factor
extra/mason/config/config.factor
extra/mason/email/email-tests.factor
extra/mason/email/email.factor
extra/mason/mason.factor
extra/mason/notify/notify.factor
extra/mason/release/tidy/tidy.factor
extra/mason/server/notify/authors.txt [deleted file]
extra/mason/server/notify/notify.factor [deleted file]
extra/mason/server/release/authors.txt [deleted file]
extra/mason/server/release/release.factor [deleted file]
extra/mason/source/authors.txt [deleted file]
extra/mason/source/source.factor [deleted file]
extra/mason/test/test.factor
extra/mason/updates/updates.factor
extra/mason/version/authors.txt [new file with mode: 0644]
extra/mason/version/binary/authors.txt [new file with mode: 0644]
extra/mason/version/binary/binary.factor [new file with mode: 0644]
extra/mason/version/common/authors.txt [new file with mode: 0644]
extra/mason/version/common/common.factor [new file with mode: 0644]
extra/mason/version/data/authors.txt [new file with mode: 0644]
extra/mason/version/data/data.factor [new file with mode: 0644]
extra/mason/version/files/authors.txt [new file with mode: 0644]
extra/mason/version/files/files.factor [new file with mode: 0644]
extra/mason/version/source/authors.txt [new file with mode: 0644]
extra/mason/version/source/source.factor [new file with mode: 0644]
extra/mason/version/version.factor [new file with mode: 0644]
extra/math/matrices/simd/simd.factor
extra/model-viewer/model-viewer.factor
extra/models/conditional/conditional.factor
extra/mongodb/operations/operations.factor
extra/mongodb/tuple/collection/collection.factor
extra/multi-methods/multi-methods.factor
extra/native-thread-test/native-thread-test.factor
extra/nehe/2/2.factor
extra/nehe/4/4.factor
extra/nehe/5/5.factor
extra/noise/noise.factor
extra/ogg/ogg.factor
extra/ogg/theora/theora.factor
extra/ogg/vorbis/vorbis.factor
extra/openal/alut/alut.factor
extra/openal/openal.factor
extra/opencl/authors.txt [new file with mode: 0644]
extra/opencl/ffi/authors.txt [new file with mode: 0644]
extra/opencl/ffi/ffi-tests.factor [new file with mode: 0644]
extra/opencl/ffi/ffi.factor [new file with mode: 0644]
extra/opencl/ffi/summary.txt [new file with mode: 0644]
extra/opencl/ffi/tags.txt [new file with mode: 0644]
extra/opencl/opencl-docs.factor [new file with mode: 0644]
extra/opencl/opencl-tests.factor [new file with mode: 0644]
extra/opencl/opencl.factor [new file with mode: 0644]
extra/opencl/summary.txt [new file with mode: 0644]
extra/opencl/syntax/authors.txt [new file with mode: 0644]
extra/opencl/syntax/syntax.factor [new file with mode: 0644]
extra/opencl/syntax/tags.txt [new file with mode: 0644]
extra/opencl/tags.txt [new file with mode: 0644]
extra/opengl/glu/glu.factor
extra/pairs/pairs.factor
extra/path-finding/authors.txt [new file with mode: 0644]
extra/path-finding/path-finding-docs.factor [new file with mode: 0644]
extra/path-finding/path-finding-tests.factor [new file with mode: 0644]
extra/path-finding/path-finding.factor [new file with mode: 0644]
extra/path-finding/summary.txt [new file with mode: 0644]
extra/poker/poker.factor
extra/pop3/pop3.factor
extra/project-euler/004/004.factor
extra/project-euler/027/027.factor
extra/project-euler/029/029.factor
extra/project-euler/032/032.factor
extra/project-euler/033/033.factor
extra/project-euler/035/035.factor
extra/project-euler/043/043.factor
extra/project-euler/051/051.factor
extra/project-euler/056/056.factor
extra/project-euler/059/059.factor
extra/project-euler/079/079.factor
extra/project-euler/081/081.factor
extra/project-euler/085/085.factor
extra/project-euler/203/203.factor
extra/project-euler/206/206.factor
extra/project-euler/265/265-tests.factor [new file with mode: 0644]
extra/project-euler/265/265.factor [new file with mode: 0644]
extra/project-euler/common/common.factor
extra/project-euler/project-euler.factor
extra/quadtrees/quadtrees.factor
extra/random/cmwc/cmwc.factor
extra/sequences/repeating/repeating.factor
extra/set-n/set-n.factor [deleted file]
extra/site-watcher/site-watcher.factor
extra/slots/syntax/authors.txt [new file with mode: 0755]
extra/slots/syntax/syntax-docs.factor [new file with mode: 0755]
extra/slots/syntax/syntax-tests.factor [new file with mode: 0755]
extra/slots/syntax/syntax.factor [new file with mode: 0755]
extra/smalltalk/compiler/compiler.factor
extra/smalltalk/compiler/lexenv/lexenv-tests.factor
extra/space-invaders/space-invaders.factor
extra/spelling/authors.txt [new file with mode: 0644]
extra/spelling/spelling-tests.factor [new file with mode: 0644]
extra/spelling/spelling.factor [new file with mode: 0644]
extra/spelling/summary.txt [new file with mode: 0644]
extra/spelling/tags.txt [new file with mode: 0644]
extra/spelling/test.txt [new file with mode: 0644]
extra/spider/spider.factor
extra/synth/buffers/buffers.factor
extra/synth/synth.factor
extra/terrain/terrain.factor
extra/tetris/tetris.factor
extra/tokyo/abstractdb/abstractdb.factor
extra/tokyo/alien/tcadb/tcadb.factor
extra/tokyo/alien/tcbdb/tcbdb.factor
extra/tokyo/alien/tcfdb/tcfdb.factor
extra/tokyo/alien/tchdb/tchdb.factor
extra/tokyo/alien/tcrdb/tcrdb.factor
extra/tokyo/alien/tctdb/tctdb.factor
extra/tokyo/alien/tcutil/tcutil.factor
extra/tokyo/remotedb/remotedb.factor
extra/trees/avl/avl-tests.factor
extra/trees/avl/avl.factor
extra/trees/splay/splay.factor
extra/trees/trees.factor
extra/twitter/summary.txt [new file with mode: 0644]
extra/twitter/tags.txt [new file with mode: 0644]
extra/ui/gadgets/lists/lists.factor
extra/variables/variables.factor [new file with mode: 0644]
extra/vars/authors.txt [deleted file]
extra/vars/summary.txt [deleted file]
extra/vars/tags.txt [deleted file]
extra/vars/vars.factor [deleted file]
extra/webapps/help/search.xml
extra/webapps/mason/download-package.xml
extra/webapps/mason/downloads.xml [new file with mode: 0644]
extra/webapps/mason/downloads/authors.txt [new file with mode: 0644]
extra/webapps/mason/downloads/downloads.factor [new file with mode: 0644]
extra/webapps/mason/grids/grids.factor
extra/webapps/mason/make-release.xml
extra/webapps/mason/make-release/make-release.factor
extra/webapps/mason/mason.factor
extra/webapps/mason/package/package.factor
extra/webapps/mason/release/release.factor
extra/webapps/mason/status-update/authors.txt [new file with mode: 0644]
extra/webapps/mason/status-update/status-update.factor [new file with mode: 0644]
extra/webapps/mason/utils/utils.factor
extra/webapps/pastebin/new-paste.xml
extra/webapps/pastebin/paste.xml
extra/webapps/pastebin/pastebin.factor
extra/webapps/planet/planet.factor
extra/webapps/wiki/wiki-common.xml
extra/webkit-demo/webkit-demo.factor
extra/websites/concatenative/concatenative.factor
extra/websites/concatenative/page.css
extra/z-algorithm/authors.txt [new file with mode: 0644]
extra/z-algorithm/summary.txt [new file with mode: 0644]
extra/z-algorithm/tags.txt [new file with mode: 0644]
extra/z-algorithm/z-algorithm-docs.factor [new file with mode: 0644]
extra/z-algorithm/z-algorithm-tests.factor [new file with mode: 0644]
extra/z-algorithm/z-algorithm.factor [new file with mode: 0644]
misc/fuel/fuel-font-lock.el
misc/fuel/fuel-mode.el
misc/fuel/fuel-scaffold.el
misc/fuel/fuel-syntax.el
unmaintained/alien/inline/inline.factor
unmaintained/closures/closures.factor [new file with mode: 0644]
unmaintained/cryptlib/libcl/libcl.factor
unmaintained/db/mysql/ffi/ffi.factor
unmaintained/fries/authors.txt [new file with mode: 0644]
unmaintained/fries/fries.factor [new file with mode: 0644]
unmaintained/fries/summary.txt [new file with mode: 0644]
unmaintained/jni/jni-internals.factor
unmaintained/ldap/libldap/libldap.factor
unmaintained/lint/lint.factor
unmaintained/odbc/odbc.factor
unmaintained/oracle/liboci/liboci.factor
unmaintained/pdf/libhpdf/libhpdf.factor
unmaintained/set-n/set-n.factor [new file with mode: 0644]
vm/Config.freebsd
vm/Config.linux
vm/Config.macosx
vm/Config.netbsd
vm/Config.openbsd
vm/Config.windows.nt
vm/Config.windows.nt.x86.32
vm/Config.windows.nt.x86.64
vm/alien.cpp
vm/alien.hpp
vm/bignum.cpp
vm/booleans.cpp
vm/booleans.hpp
vm/byte_arrays.cpp
vm/byte_arrays.hpp
vm/callbacks.cpp [changed mode: 0644->0755]
vm/callbacks.hpp
vm/callstack.cpp
vm/callstack.hpp
vm/code_block_visitor.hpp
vm/code_blocks.cpp
vm/code_heap.cpp
vm/code_heap.hpp
vm/collector.hpp
vm/contexts.cpp
vm/contexts.hpp
vm/cpu-ppc.hpp
vm/cpu-x86.hpp [changed mode: 0644->0755]
vm/data_heap.cpp
vm/debug.cpp
vm/dispatch.cpp
vm/errors.cpp
vm/errors.hpp
vm/factor.cpp
vm/factor.hpp
vm/ffi_test.c
vm/ffi_test.h
vm/gc.cpp
vm/gc.hpp
vm/image.cpp
vm/image.hpp
vm/inline_cache.cpp
vm/instruction_operands.cpp
vm/instruction_operands.hpp
vm/io.cpp
vm/jit.cpp
vm/jit.hpp
vm/layouts.hpp
vm/mach_signal.cpp
vm/master.hpp
vm/math.cpp
vm/math.hpp
vm/mvm-none.cpp [new file with mode: 0644]
vm/mvm-unix.cpp [new file with mode: 0644]
vm/mvm-windows-nt.cpp [new file with mode: 0644]
vm/mvm.cpp [new file with mode: 0644]
vm/mvm.hpp [new file with mode: 0644]
vm/objects.cpp
vm/objects.hpp
vm/os-freebsd.hpp
vm/os-genunix.cpp
vm/os-genunix.hpp
vm/os-linux-arm.cpp
vm/os-linux.hpp
vm/os-macosx-ppc.hpp
vm/os-macosx-x86.32.hpp
vm/os-macosx-x86.64.hpp
vm/os-macosx.hpp
vm/os-macosx.mm
vm/os-netbsd.hpp
vm/os-openbsd.hpp [new file with mode: 0644]
vm/os-unix.cpp
vm/os-unix.hpp
vm/os-windows-nt-x86.32.cpp [new file with mode: 0644]
vm/os-windows-nt-x86.64.cpp [new file with mode: 0644]
vm/os-windows-nt.cpp
vm/os-windows-nt.hpp
vm/os-windows.cpp
vm/os-windows.hpp
vm/platform.hpp
vm/primitives.cpp
vm/primitives.hpp
vm/safeseh.asm [new file with mode: 0755]
vm/segments.hpp
vm/slot_visitor.hpp
vm/strings.cpp
vm/utilities.hpp
vm/vm.cpp
vm/vm.hpp

index 3bc5a6ffdafb1a4f6338b8a7035ddb0ce31023b1..7bd42557b782763654fd403d087d6f832171b03d 100644 (file)
@@ -12,6 +12,7 @@ Factor/factor
 *.res
 *.RES
 *.image
+factor.image.fresh
 *.dylib
 factor
 factor.com
index 1c07f95643962ceddad10d5515829684fa563c22..591886b196cdef3ca302ede890fdbe69ee59a4e5 100644 (file)
@@ -32,7 +32,7 @@
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleVersion</key>
-       <string>0.93</string>
+       <string>0.94</string>
        <key>NSHumanReadableCopyright</key>
        <string>Copyright © 2003-2010 Factor developers</string>
        <key>NSServices</key>
index eac1c696df5b5ecab92c5eb709d48b2c60f79bb7..300a62f71cb8646b2c8560eef2c5d5df8daa3767 100755 (executable)
@@ -4,7 +4,7 @@ ifdef CONFIG
        AR = ar
        LD = ld
 
-       VERSION = 0.93
+       VERSION = 0.94
 
        BUNDLE = Factor.app
        LIBPATH = -L/usr/X11R6/lib
@@ -52,6 +52,7 @@ ifdef CONFIG
                vm/io.o \
                vm/jit.o \
                vm/math.o \
+               vm/mvm.o \
                vm/nursery_collector.o \
                vm/object_start_map.o \
                vm/objects.o \
@@ -105,61 +106,63 @@ help:
        @echo "NO_UI=1  don't link with X11 libraries (ignored on Mac OS X)"
        @echo "X11=1  force link with X11 libraries instead of Cocoa (only on Mac OS X)"
 
+ALL = factor factor-ffi-test factor-lib
+
 openbsd-x86-32:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.openbsd.x86.32
+       $(MAKE) $(ALL) CONFIG=vm/Config.openbsd.x86.32
 
 openbsd-x86-64:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.openbsd.x86.64
+       $(MAKE) $(ALL) CONFIG=vm/Config.openbsd.x86.64
 
 freebsd-x86-32:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.freebsd.x86.32
+       $(MAKE) $(ALL) CONFIG=vm/Config.freebsd.x86.32
 
 freebsd-x86-64:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.freebsd.x86.64
+       $(MAKE) $(ALL) CONFIG=vm/Config.freebsd.x86.64
 
 netbsd-x86-32:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.netbsd.x86.32
+       $(MAKE) $(ALL) CONFIG=vm/Config.netbsd.x86.32
 
 netbsd-x86-64:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.netbsd.x86.64
+       $(MAKE) $(ALL) CONFIG=vm/Config.netbsd.x86.64
 
 macosx-ppc:
-       $(MAKE) factor factor-ffi-test macosx.app CONFIG=vm/Config.macosx.ppc
+       $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.ppc
 
 macosx-x86-32:
-       $(MAKE) factor factor-ffi-test macosx.app CONFIG=vm/Config.macosx.x86.32
+       $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.x86.32
 
 macosx-x86-64:
-       $(MAKE) factor factor-ffi-test macosx.app CONFIG=vm/Config.macosx.x86.64
+       $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.x86.64
 
 linux-x86-32:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.linux.x86.32
+       $(MAKE) $(ALL) CONFIG=vm/Config.linux.x86.32
 
 linux-x86-64:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.linux.x86.64
+       $(MAKE) $(ALL) CONFIG=vm/Config.linux.x86.64
 
 linux-ppc:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.linux.ppc
+       $(MAKE) $(ALL) CONFIG=vm/Config.linux.ppc
 
 linux-arm:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.linux.arm
+       $(MAKE) $(ALL) CONFIG=vm/Config.linux.arm
 
 solaris-x86-32:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.solaris.x86.32
+       $(MAKE) $(ALL) CONFIG=vm/Config.solaris.x86.32
 
 solaris-x86-64:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.solaris.x86.64
+       $(MAKE) $(ALL) CONFIG=vm/Config.solaris.x86.64
 
 winnt-x86-32:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.windows.nt.x86.32
+       $(MAKE) $(ALL) CONFIG=vm/Config.windows.nt.x86.32
        $(MAKE) factor-console CONFIG=vm/Config.windows.nt.x86.32
 
 winnt-x86-64:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.windows.nt.x86.64
+       $(MAKE) $(ALL) CONFIG=vm/Config.windows.nt.x86.64
        $(MAKE) factor-console CONFIG=vm/Config.windows.nt.x86.64
 
 wince-arm:
-       $(MAKE) factor factor-ffi-test CONFIG=vm/Config.windows.ce.arm
+       $(MAKE) $(ALL) CONFIG=vm/Config.windows.ce.arm
 
 ifdef CONFIG
 
@@ -168,22 +171,18 @@ macosx.app: factor
        mkdir -p $(BUNDLE)/Contents/Frameworks
        mv $(EXECUTABLE) $(BUNDLE)/Contents/MacOS/factor
        ln -s Factor.app/Contents/MacOS/factor ./factor
-       cp $(ENGINE) $(BUNDLE)/Contents/Frameworks/$(ENGINE)
-
-       install_name_tool \
-               -change libfactor.dylib \
-               @executable_path/../Frameworks/libfactor.dylib \
-               Factor.app/Contents/MacOS/factor
 
 $(ENGINE): $(DLL_OBJS)
        $(TOOLCHAIN_PREFIX)$(LINKER) $(ENGINE) $(DLL_OBJS)
 
-factor: $(EXE_OBJS) $(ENGINE)
-       $(TOOLCHAIN_PREFIX)$(CPP) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \
+factor-lib: $(ENGINE)
+
+factor: $(EXE_OBJS) $(DLL_OBJS)
+       $(TOOLCHAIN_PREFIX)$(CPP) $(LIBS) $(LIBPATH) -L. $(DLL_OBJS) \
                $(CFLAGS) -o $(EXECUTABLE) $(EXE_OBJS)
 
-factor-console: $(EXE_OBJS) $(ENGINE)
-       $(TOOLCHAIN_PREFIX)$(CPP) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \
+factor-console: $(EXE_OBJS) $(DLL_OBJS)
+       $(TOOLCHAIN_PREFIX)$(CPP) $(LIBS) $(LIBPATH) -L. $(DLL_OBJS) \
                $(CFLAGS) $(CFLAGS_CONSOLE) -o $(CONSOLE_EXECUTABLE) $(EXE_OBJS)
 
 factor-ffi-test: $(FFI_TEST_LIBRARY)
@@ -222,4 +221,4 @@ clean:
 tags:
        etags vm/*.{cpp,hpp,mm,S,c}
 
-.PHONY: factor factor-console factor-ffi-test tags clean macosx.app
+.PHONY: factor factor-lib factor-console factor-ffi-test tags clean macosx.app
index 7349deae23b27727f089c75bdd74060b565342f1..1e6d3a0d4256c7b01edb6a81ac99de6b67d9a99b 100755 (executable)
--- a/Nmakefile
+++ b/Nmakefile
@@ -1,15 +1,31 @@
-!IF DEFINED(DEBUG)
-LINK_FLAGS = /nologo /DEBUG shell32.lib
-CL_FLAGS = /nologo /Zi /O2 /W3 /DFACTOR_DEBUG
-!ELSE
+!IF !DEFINED(BOOTIMAGE_VERSION)
+BOOTIMAGE_VERSION = latest
+!ENDIF
+
+!IF DEFINED(PLATFORM)
+
 LINK_FLAGS = /nologo shell32.lib
-CL_FLAGS = /nologo /O2 /W3
+CL_FLAGS = /nologo /O2 /W3 /D_CRT_SECURE_NO_WARNINGS
+
+!IF DEFINED(DEBUG)
+LINK_FLAGS = $(LINK_FLAGS) /DEBUG
+CL_FLAGS = $(CL_FLAGS) /Zi /DFACTOR_DEBUG
+!ENDIF
+
+!IF "$(PLATFORM)" == "x86-32"
+LINK_FLAGS = $(LINK_FLAGS) /safeseh
+PLAF_DLL_OBJS = vm\os-windows-nt-x86.32.obj vm\safeseh.obj
+!ELSEIF "$(PLATFORM)" == "x86-64"
+PLAF_DLL_OBJS = vm\os-windows-nt-x86.64.obj
 !ENDIF
 
-EXE_OBJS = factor.dll.lib vm\main-windows-nt.obj vm\factor.res
+ML_FLAGS = /nologo /safeseh
+
+EXE_OBJS = vm\main-windows-nt.obj vm\factor.res
 
-DLL_OBJS = vm\os-windows-nt.obj \
+DLL_OBJS = $(PLAF_DLL_OBJS) \
        vm\os-windows.obj \
+       vm\os-windows-nt.obj \
        vm\aging_collector.obj \
        vm\alien.obj \
        vm\arrays.obj \
@@ -38,6 +54,8 @@ DLL_OBJS = vm\os-windows-nt.obj \
        vm\io.obj \
        vm\jit.obj \
        vm\math.obj \
+       vm\mvm.obj \
+       vm\mvm-windows-nt.obj \
        vm\nursery_collector.obj \
        vm\object_start_map.obj \
        vm\objects.obj \
@@ -58,31 +76,49 @@ DLL_OBJS = vm\os-windows-nt.obj \
 .c.obj:
        cl $(CL_FLAGS) /Fo$@ /c $<
 
+.asm.obj:
+       ml $(ML_FLAGS) /Fo$@ /c $<
+
 .rs.res:
        rc $<
 
-all: factor.com factor.exe libfactor-ffi-test.dll
-
 libfactor-ffi-test.dll: vm/ffi_test.obj
        link $(LINK_FLAGS) /out:libfactor-ffi-test.dll /dll vm/ffi_test.obj
 
 factor.dll.lib: $(DLL_OBJS)
        link $(LINK_FLAGS) /implib:factor.dll.lib /out:factor.dll /dll $(DLL_OBJS)
 
-factor.com: $(EXE_OBJS)
-       link $(LINK_FLAGS) /out:factor.com /SUBSYSTEM:console $(EXE_OBJS)
+factor.com: $(EXE_OBJS) $(DLL_OBJS)
+       link $(LINK_FLAGS) /out:factor.com /SUBSYSTEM:console $(EXE_OBJS) $(DLL_OBJS)
+
+factor.exe: $(EXE_OBJS) $(DLL_OBJS)
+       link $(LINK_FLAGS) /out:factor.exe /SUBSYSTEM:windows $(EXE_OBJS) $(DLL_OBJS)
+
+all: factor.com factor.exe factor.dll.lib libfactor-ffi-test.dll
+
+!ENDIF
+
+default:
+       @echo Usage: nmake /f Nmakefile platform
+       @echo Where platform is one of:
+       @echo x86-32
+       @echo x86-64
+       @exit 1
+
+x86-32:
+       nmake /nologo PLATFORM=x86-32 /f Nmakefile all
 
-factor.exe: $(EXE_OBJS)
-       link $(LINK_FLAGS) /out:factor.exe /SUBSYSTEM:windows $(EXE_OBJS)
+x86-64:
+       nmake /nologo PLATFORM=x86-64 /f Nmakefile all
 
 clean:
        del vm\*.obj
-       del factor.lib
-       del factor.com
-       del factor.exe
-       del factor.dll
-       del factor.dll.lib
+       if exist factor.lib del factor.lib
+       if exist factor.com del factor.com
+       if exist factor.exe del factor.exe
+       if exist factor.dll del factor.dll
+       if exist factor.dll.lib del factor.dll.lib
 
-.PHONY: all clean
+.PHONY: all default x86-32 x86-64 clean
 
 .SUFFIXES: .rs
index 396011a3515e26d791e29a7a8153ea6cf7924d47..3b70b43a2892782e994e731d564122a3d791044b 100644 (file)
@@ -2,46 +2,49 @@ USING: help.markup help.syntax calendar quotations system ;
 IN: alarms\r
 \r
 HELP: alarm\r
-{ $class-description "An alarm. Can be passed to " { $link cancel-alarm } "." } ;\r
+{ $class-description "An alarm. Can be passed to " { $link stop-alarm } "." } ;\r
 \r
-HELP: current-alarm\r
-{ $description "A symbol that contains the currently executing alarm, availble only to the alarm quotation. One use for this symbol is if a repeated alarm wishes to cancel itself from executing in the future."\r
-}\r
+HELP: start-alarm\r
+{ $values { "alarm" alarm } }\r
+{ $description "Starts an alarm." } ;\r
+\r
+HELP: restart-alarm\r
+{ $values { "alarm" alarm } }\r
+{ $description "Starts or restarts an alarm. Restarting an alarm causes the a sleep of initial delay nanoseconds before looping. An alarm's parameters may be modified and restarted with this word." } ;\r
+\r
+HELP: stop-alarm\r
+{ $values { "alarm" alarm } }\r
+{ $description "Prevents an alarm from calling its quotation again. Has no effect on alarms that are not currently running." } ;\r
+\r
+HELP: every\r
+{ $values\r
+     { "quot" quotation } { "interval-duration" duration }\r
+     { "alarm" alarm } }\r
+{ $description "Creates an alarm that calls the quotation repeatedly, using " { $snippet "duration" } " as the frequency. The first call of " { $snippet "quot" } " will happen immediately. If the quotation throws an exception, the alarm will stop." }\r
 { $examples\r
     { $unchecked-example\r
-        """USING: alarms calendar io threads ;"""\r
-        """["""\r
-        """    "Hi, this should only get printed once..." print flush"""\r
-        """    current-alarm get cancel-alarm"""\r
-        """] 1 seconds every"""\r
+        "USING: alarms io calendar ;"\r
+        """[ "Hi Buddy." print flush ] 10 seconds every drop"""\r
         ""\r
     }\r
 } ;\r
 \r
-HELP: add-alarm\r
-{ $values { "quot" quotation } { "start" duration } { "interval" { $maybe "duration/f" } } { "alarm" alarm } }\r
-{ $description "Creates and registers an alarm to start at " { $snippet "start" } " offset from the current time. If " { $snippet "interval" } " is " { $link f } ", this will be a one-time alarm, otherwise it will fire with the given frequency, with scheduling happening before the quotation is called in order to ensure that the next event will happen on time. The quotation will be called from a new thread spawned by the alarm thread. If a repeated alarm's quotation throws an exception, the alarm will not be rescheduled." } ;\r
-\r
 HELP: later\r
-{ $values { "quot" quotation } { "duration" duration } { "alarm" alarm } }\r
-{ $description "Creates and registers an alarm which calls the quotation once at " { $snippet "duration" } " offset from now." }\r
+{ $values { "quot" quotation } { "delay-duration" duration } { "alarm" alarm } }\r
+{ $description "Sleeps for " { $snippet "duration" } " and then calls a " { $snippet "quot" } ". The user may cancel the alarm before " { $snippet "quot" } " runs. This alarm is not repeated." }\r
 { $examples\r
     { $unchecked-example\r
         "USING: alarms io calendar ;"\r
-        """[ "Break's over!" print flush ] 15 minutes drop"""\r
+        """[ "Break's over!" print flush ] 15 minutes later drop"""\r
         ""\r
     }\r
 } ;\r
 \r
-HELP: cancel-alarm\r
-{ $values { "alarm" alarm } }\r
-{ $description "Cancels an alarm. Does nothing if the alarm is not active." } ;\r
-\r
-HELP: every\r
+HELP: delayed-every\r
 { $values\r
      { "quot" quotation } { "duration" duration }\r
      { "alarm" alarm } }\r
-{ $description "Creates and registers an alarm which calls the quotation repeatedly, using " { $snippet "dt" } " as the frequency. If the quotation throws an exception that is not caught inside it, the alarm scheduler will cancel the alarm and will not reschedule it again." }\r
+{ $description "Creates an alarm that calls " { $snippet "quot" } " repeatedly, waiting " { $snippet "duration" } " before calling " { $snippet "quot" } " the first time and then waiting " { $snippet "duration" } " between further calls. If the quotation throws an exception, the alarm will stop." }\r
 { $examples\r
     { $unchecked-example\r
         "USING: alarms io calendar ;"\r
@@ -51,19 +54,21 @@ HELP: every
 } ;\r
 \r
 ARTICLE: "alarms" "Alarms"\r
-"The " { $vocab-link "alarms" } " vocabulary provides a lightweight way to schedule one-time and recurring tasks without spawning a new thread. Alarms use " { $link nano-count } ", so they continue to work across system clock changes." $nl\r
+"The " { $vocab-link "alarms" } " vocabulary provides a lightweight way to schedule one-time and recurring tasks. Alarms run in a single green thread per alarm and consist of a quotation, a delay duration, and an interval duration. After starting an alarm, the alarm thread sleeps for the delay duration and calls the quotation. Then it waits out the interval duration and calls the quotation again until something stops the alarm. If a recurring alarm's quotation would be scheduled to run again before the previous quotation has finished processing, the alarm will be run again immediately afterwards. This may result in the alarm falling behind indefinitely, in which case the it will run as often as possible while still allowing other green threads to run. Recurring alarms that execute 'on time' or 'catch up' will always be scheduled for an exact multiple of the interval from the original starting time to prevent the alarm from drifting over time. Alarms use " { $link nano-count } " as the timing primitive, so they will continue to work across system clock changes." $nl\r
 "The alarm class:"\r
 { $subsections alarm }\r
-"Register a recurring alarm:"\r
+"Create an alarm before starting it:"\r
+{ $subsections <alarm> }\r
+"Starting an alarm:"\r
+{ $subsections start-alarm restart-alarm }\r
+"Stopping an alarm:"\r
+{ $subsections stop-alarm }\r
+\r
+"A recurring alarm without an initial delay:"\r
 { $subsections every }\r
-"Register a one-time alarm:"\r
+"A one-time alarm with an initial delay:"\r
 { $subsections later }\r
-"The currently executing alarm:"\r
-{ $subsections current-alarm }\r
-"Low-level interface to add alarms:"\r
-{ $subsections add-alarm }\r
-"Cancelling an alarm:"\r
-{ $subsections cancel-alarm }\r
-"Alarms do not persist across image saves. Saving and restoring an image has the effect of calling " { $link cancel-alarm } " on all " { $link alarm } " instances." ;\r
+"A recurring alarm with an initial delay:"\r
+{ $subsections delayed-every } ;\r
 \r
 ABOUT: "alarms"\r
index 2379e3e80d809baba9cd08424a94a6955f28c67a..ed1ab632aef62d152a320161b364b8df99f776f0 100644 (file)
@@ -1,17 +1,67 @@
-USING: alarms alarms.private kernel calendar sequences\r
-tools.test threads concurrency.count-downs ;\r
+USING: alarms alarms.private calendar concurrency.count-downs\r
+concurrency.promises fry kernel math math.order sequences\r
+threads tools.test tools.time ;\r
 IN: alarms.tests\r
 \r
 [ ] [\r
     1 <count-down>\r
     { f } clone 2dup\r
-    [ first cancel-alarm count-down ] 2curry 1 seconds later\r
+    [ first stop-alarm count-down ] 2curry 1 seconds later\r
     swap set-first\r
     await\r
 ] unit-test\r
 \r
 [ ] [\r
+    self [ resume ] curry instant later drop\r
+    "test" suspend drop\r
+] unit-test\r
+\r
+[ t ] [\r
     [\r
-        [ resume ] curry instant later drop\r
-    ] "test" suspend drop\r
+        <promise>\r
+        [ '[ t _ fulfill ] 2 seconds later drop ]\r
+        [ 5 seconds ?promise-timeout drop ] bi\r
+    ] benchmark 1,500,000,000 2,500,000,000 between?\r
+] unit-test\r
+\r
+[ { 3 } ] [\r
+    { 3 } dup\r
+    '[ 4 _ set-first ] 2 seconds later\r
+    1/2 seconds sleep\r
+    stop-alarm\r
+] unit-test\r
+\r
+[ { 1 } ] [\r
+    { 0 }\r
+    dup '[ 0 _ [ 1 + ] change-nth ] 3 seconds later\r
+    [ stop-alarm ] [ start-alarm ] bi\r
+    4 seconds sleep\r
+] unit-test\r
+\r
+[ { 0 } ] [\r
+    { 0 }\r
+    dup '[ 3 seconds sleep 1 _ set-first ] 1 seconds later\r
+    2 seconds sleep stop-alarm\r
+    1/2 seconds sleep\r
+] unit-test\r
+\r
+[ { 0 } ] [\r
+    { 0 }\r
+    dup '[ 1 _ set-first ] 300 milliseconds later\r
+    150 milliseconds sleep\r
+    [ restart-alarm ] [ 200 milliseconds sleep stop-alarm ] bi\r
+] unit-test\r
+\r
+[ { 1 } ] [\r
+    { 0 }\r
+    dup '[ 0 _ [ 1 + ] change-nth ] 200 milliseconds later\r
+    100 milliseconds sleep restart-alarm 300 milliseconds sleep\r
+] unit-test\r
+\r
+[ { 4 } ] [\r
+    { 0 }\r
+    dup '[ 0 _ [ 1 + ] change-nth ] 300 milliseconds 300 milliseconds\r
+    <alarm> dup start-alarm\r
+    700 milliseconds sleep dup restart-alarm\r
+    700 milliseconds sleep stop-alarm 500 milliseconds sleep\r
 ] unit-test\r
index 9ab30a1fa4db79b3fde7bb4417e2308b6ddc8cf9..92035a19c8d16277267cf6491c238eb93de19935 100644 (file)
 ! Copyright (C) 2005, 2008 Slava Pestov, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs boxes calendar combinators.short-circuit
-continuations fry heaps init kernel math.order
-namespaces quotations threads math system ;
+USING: accessors assocs calendar combinators.short-circuit fry
+heaps init kernel math math.functions math.parser namespaces
+quotations sequences system threads ;
 IN: alarms
 
 TUPLE: alarm
     { quot callable initial: [ ] }
-    { start integer }
-    interval
-    { entry box } ;
-
-SYMBOL: alarms
-SYMBOL: alarm-thread
-SYMBOL: current-alarm
-
-: cancel-alarm ( alarm -- )
-    entry>> [ alarms get-global heap-delete ] if-box? ;
+    start-nanos 
+    delay-nanos
+    interval-nanos
+    iteration-start-nanos
+    quotation-running?
+    restart?
+    thread ;
 
 <PRIVATE
 
-: notify-alarm-thread ( -- )
-    alarm-thread get-global interrupt ;
-
 GENERIC: >nanoseconds ( obj -- duration/f )
 M: f >nanoseconds ;
 M: real >nanoseconds >integer ;
 M: duration >nanoseconds duration>nanoseconds >integer ;
 
-: <alarm> ( quot start interval -- alarm )
-    alarm new
-        swap >nanoseconds >>interval
-        swap >nanoseconds nano-count + >>start
-        swap >>quot
-        <box> >>entry ;
-
-: register-alarm ( alarm -- )
-    [ dup start>> alarms get-global heap-push* ]
-    [ entry>> >box ] bi
-    notify-alarm-thread ;
-
-: alarm-expired? ( alarm n -- ? )
-    [ start>> ] dip <= ;
-
-: reschedule-alarm ( alarm -- )
-    dup interval>> nano-count + >>start register-alarm ;
+: set-next-alarm-time ( alarm -- alarm )
+    ! start + delay + ceiling((now - (start + delay)) / interval) * interval
+    nano-count 
+    over start-nanos>> -
+    over delay-nanos>> [ - ] when*
+    over interval-nanos>> / ceiling
+    over interval-nanos>> *
+    over start-nanos>> +
+    over delay-nanos>> [ + ] when*
+    >>iteration-start-nanos ;
+
+: stop-alarm? ( alarm -- ? )
+    { [ thread>> self eq? not ] [ restart?>> ] } 1|| ;
+
+DEFER: call-alarm-loop
+
+: loop-alarm ( alarm -- )
+    nano-count over
+    [ iteration-start-nanos>> - ] [ interval-nanos>> ] bi <
+    [ set-next-alarm-time ] dip
+    [ dup iteration-start-nanos>> ] [ 0 ] if
+    0 or sleep-until call-alarm-loop ;
+
+: maybe-loop-alarm ( alarm -- )
+    dup { [ stop-alarm? ] [ interval-nanos>> not ] } 1||
+    [ drop ] [ loop-alarm ] if ;
+
+: call-alarm-loop ( alarm -- )
+    dup stop-alarm? [
+        drop
+    ] [
+        [
+            [ t >>quotation-running? drop ]
+            [ quot>> call( -- ) ]
+            [ f >>quotation-running? drop ] tri
+        ] keep
+        maybe-loop-alarm
+    ] if ;
 
-: call-alarm ( alarm -- )
-    [ entry>> box> drop ]
-    [ dup interval>> [ reschedule-alarm ] [ drop ] if ]
-    [
-        [ ] [ quot>> ] [ ] tri
-        '[
-            _ current-alarm
-            [
-                _ [ _ dup interval>> [ cancel-alarm ] [ drop ] if rethrow ]
-                recover
-            ] with-variable
-        ] "Alarm execution" spawn drop
-    ] tri ;
-
-: (trigger-alarms) ( alarms n -- )
-    over heap-empty? [
-        2drop
+: sleep-delay ( alarm -- )
+    dup stop-alarm? [
+        drop
     ] [
-        over heap-peek drop over alarm-expired? [
-            over heap-pop drop call-alarm (trigger-alarms)
-        ] [
-            2drop
-        ] if
+        nano-count >>start-nanos
+        delay-nanos>> [ sleep ] when*
     ] if ;
 
-: trigger-alarms ( alarms -- )
-    nano-count (trigger-alarms) ;
+: alarm-loop ( alarm -- )
+    [ sleep-delay ]
+    [ nano-count >>iteration-start-nanos call-alarm-loop ]
+    [ dup restart?>> [ f >>restart? alarm-loop ] [ drop ] if ] tri ;
 
-: next-alarm ( alarms -- nanos/f )
-    dup heap-empty? [ drop f ] [ heap-peek drop start>> ] if ;
+PRIVATE>
 
-: alarm-thread-loop ( -- )
-    alarms get-global
-    dup next-alarm sleep-until
-    trigger-alarms ;
+: <alarm> ( quot delay-duration/f interval-duration/f -- alarm )
+    alarm new
+        swap >nanoseconds >>interval-nanos
+        swap >nanoseconds >>delay-nanos
+        swap >>quot ; inline
 
-: cancel-alarms ( alarms -- )
+: start-alarm ( alarm -- )
     [
-        heap-pop-all [ nip entry>> box> drop ] assoc-each
-    ] when* ;
+        '[ _ alarm-loop ] "Alarm execution" spawn
+    ] keep thread<< ;
+
+: stop-alarm ( alarm -- )
+    dup quotation-running?>> [
+        f >>thread drop
+    ] [
+        [ [ interrupt ] when* f ] change-thread drop
+    ] if ;
 
-: init-alarms ( -- )
-    alarms [ cancel-alarms <min-heap> ] change-global
-    [ alarm-thread-loop t ] "Alarms" spawn-server
-    alarm-thread set-global ;
+: restart-alarm ( alarm -- )
+    t >>restart?
+    dup quotation-running?>> [
+        drop
+    ] [
+        dup thread>> [ nip interrupt ] [ start-alarm ] if*
+    ] if ;
+
+<PRIVATE
 
-[ init-alarms ] "alarms" add-startup-hook
+: (start-alarm) ( quot start-duration interval-duration -- alarm )
+    <alarm> [ start-alarm ] keep ;
 
 PRIVATE>
 
-: add-alarm ( quot start interval -- alarm )
-    <alarm> [ register-alarm ] keep ;
+: every ( quot interval-duration -- alarm )
+    [ f ] dip (start-alarm) ;
 
-: later ( quot duration -- alarm ) f add-alarm ;
+: later ( quot delay-duration -- alarm )
+    f (start-alarm) ;
 
-: every ( quot duration -- alarm ) dup add-alarm ;
+: delayed-every ( quot duration -- alarm )
+    dup (start-alarm) ;
index 7eed1a0664505f7a68bf026753a9bad612fa6c7c..42e40483f6789a79a014058421e6e16ad440ccc1 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.strings alien.c-types alien.data alien.accessors
+USING: alien alien.strings alien.c-types alien.accessors
 arrays words sequences math kernel namespaces fry cpu.architecture
-io.encodings.utf8 accessors ;
+io.encodings.binary io.encodings.utf8 accessors compiler.units ;
 IN: alien.arrays
 
 INSTANCE: array value-type
@@ -22,28 +22,10 @@ M: array c-type-align first c-type-align ;
 
 M: array c-type-align-first first c-type-align-first ;
 
-M: array c-type-stack-align? drop f ;
-
-M: array unbox-parameter drop void* unbox-parameter ;
-
-M: array unbox-return drop void* unbox-return ;
-
-M: array box-parameter drop void* box-parameter ;
-
-M: array box-return drop void* box-return ;
-
-M: array stack-size drop void* stack-size ;
-
-M: array c-type-boxer-quot
-    unclip
-    [ array-length ]
-    [ [ require-c-array ] keep ] bi*
-    [ <c-direct-array> ] 2curry ;
-
-M: array c-type-unboxer-quot drop [ >c-ptr ] ;
+M: array base-type drop void* base-type ;
 
 PREDICATE: string-type < pair
-    first2 [ char* = ] [ word? ] bi* and ;
+    first2 [ c-string = ] [ word? ] bi* and ;
 
 M: string-type c-type ;
 
@@ -51,47 +33,25 @@ M: string-type c-type-class drop object ;
 
 M: string-type c-type-boxed-class drop object ;
 
-M: string-type heap-size
-    drop void* heap-size ;
-
-M: string-type c-type-align
-    drop void* c-type-align ;
-
-M: string-type c-type-align-first
-    drop void* c-type-align-first ;
-
-M: string-type c-type-stack-align?
-    drop void* c-type-stack-align? ;
-
-M: string-type unbox-parameter
-    drop void* unbox-parameter ;
-
-M: string-type unbox-return
-    drop void* unbox-return ;
-
-M: string-type box-parameter
-    drop void* box-parameter ;
-
-M: string-type box-return
-    drop void* box-return ;
+M: string-type heap-size drop void* heap-size ;
 
-M: string-type stack-size
-    drop void* stack-size ;
+M: string-type c-type-align drop void* c-type-align ;
 
-M: string-type c-type-rep
-    drop int-rep ;
+M: string-type c-type-align-first drop void* c-type-align-first ;
 
-M: string-type c-type-boxer
-    drop void* c-type-boxer ;
+M: string-type base-type drop void* base-type ;
 
-M: string-type c-type-unboxer
-    drop void* c-type-unboxer ;
+M: string-type c-type-rep drop int-rep ;
 
 M: string-type c-type-boxer-quot
-    second '[ _ alien>string ] ;
+    second dup binary =
+    [ drop void* c-type-boxer-quot ]
+    [ '[ _ alien>string ] ] if ;
 
 M: string-type c-type-unboxer-quot
-    second '[ _ string>alien ] ;
+    second dup binary =
+    [ drop void* c-type-unboxer-quot ]
+    [ '[ _ string>alien ] ] if ;
 
 M: string-type c-type-getter
     drop [ alien-cell ] ;
@@ -99,8 +59,5 @@ M: string-type c-type-getter
 M: string-type c-type-setter
     drop [ set-alien-cell ] ;
 
-{ char* utf8 } char* typedef
-char* uchar* typedef
+[ { c-string utf8 } c-string typedef ] with-compilation-unit
 
-char char* "pointer-c-type" set-word-prop
-uchar uchar* "pointer-c-type" set-word-prop
index 215ca1b0ef45dd7c10cc28037cd04c55a1588270..32c1d18d51d0154eec25e0bd7faa69b3b1f536da 100644 (file)
@@ -1,66 +1,42 @@
 USING: alien alien.complex help.syntax help.markup libc kernel.private
 byte-arrays strings hashtables alien.syntax alien.strings sequences
 io.encodings.string debugger destructors vocabs.loader
-classes.struct ;
+classes.struct math kernel ;
 QUALIFIED: math
 QUALIFIED: sequences
 IN: alien.c-types
 
-HELP: byte-length
-{ $values { "seq" "A byte array or float array" } { "n" "a non-negative integer" } }
-{ $contract "Outputs the size of the byte array, struct, or specialized array data in bytes." } ;
-
 HELP: heap-size
-{ $values { "name" "a C type name" } { "size" math:integer } }
+{ $values { "name" c-type-name } { "size" math:integer } }
 { $description "Outputs the number of bytes needed for a heap-allocated value of this C type." }
 { $examples
     { $example "USING: alien alien.c-types prettyprint ;\nint heap-size ." "4" }
 }
 { $errors "Throws a " { $link no-c-type } " error if the type does not exist." } ;
 
-HELP: stack-size
-{ $values { "name" "a C type name" } { "size" math:integer } }
-{ $description "Outputs the number of bytes to reserve on the C stack by a value of this C type. In most cases this is equal to " { $link heap-size } ", except on some platforms where C structs are passed by invisible reference, in which case a C struct type only uses as much space as a pointer on the C stack." }
-{ $errors "Throws a " { $link no-c-type } " error if the type does not exist." } ;
-
 HELP: <c-type>
 { $values { "c-type" c-type } }
 { $description "Creates a prototypical C type. User code should use higher-level facilities to define C types; see " { $link "c-data" } "." } ;
 
 HELP: no-c-type
-{ $values { "name" "a C type name" } }
+{ $values { "name" c-type-name } }
 { $description "Throws a " { $link no-c-type } " error." }
 { $error-description "Thrown by " { $link c-type } " if a given string does not name a C type. When thrown during compile time, indicates a typo in an " { $link alien-invoke } " or " { $link alien-callback } " form." } ;
 
 HELP: c-type
-{ $values { "name" "a C type" } { "c-type" c-type } }
+{ $values { "name" c-type-name } { "c-type" c-type } }
 { $description "Looks up a C type by name." }
 { $errors "Throws a " { $link no-c-type } " error if the type does not exist, or the word is not a C type." } ;
 
-HELP: c-getter
-{ $values { "name" "a C type" } { "quot" { $quotation "( c-ptr n -- obj )" } } }
-{ $description "Outputs a quotation which reads values of this C type from a C structure." }
+HELP: alien-value
+{ $values { "c-ptr" c-ptr } { "offset" integer } { "c-type" c-type-name } { "value" object } }
+{ $description "Loads a value at a byte offset from a base C pointer." }
 { $errors "Throws a " { $link no-c-type } " error if the type does not exist." } ;
 
-HELP: c-setter
-{ $values { "name" "a C type" } { "quot" { $quotation "( obj c-ptr n -- )" } } }
-{ $description "Outputs a quotation which writes values of this C type to a C structure." }
-{ $errors "Throws an error if the type does not exist." } ;
-
-HELP: box-parameter
-{ $values { "n" math:integer } { "c-type" "a C type" } }
-{ $description "Generates code for converting a C value stored at  offset " { $snippet "n" } " from the top of the stack into a Factor object to be pushed on the data stack." }
-{ $notes "This is an internal word used by the compiler when compiling callbacks." } ;
-
-HELP: box-return
-{ $values { "c-type" "a C type" } }
-{ $description "Generates code for converting a C value stored in return registers into a Factor object to be pushed on the data stack." }
-{ $notes "This is an internal word used by the compiler when compiling alien calls." } ;
-
-HELP: unbox-return
-{ $values { "c-type" "a C type" } }
-{ $description "Generates code for converting a Factor value on the data stack into a C value to be stored in the return registers." }
-{ $notes "This is an internal word used by the compiler when compiling callbacks." } ;
+HELP: set-alien-value
+{ $values { "value" object } { "c-ptr" c-ptr } { "offset" integer } { "c-type" c-type-name } }
+{ $description "Stores a value at a byte offset from a base C pointer." }
+{ $errors "Throws a " { $link no-c-type } " error if the type does not exist." } ;
 
 HELP: define-deref
 { $values { "c-type" "a C type" } }
@@ -103,8 +79,8 @@ HELP: ulonglong
 HELP: void
 { $description "This symbol is not a valid C type, but it can be used as the return type for a " { $link POSTPONE: FUNCTION: } " or " { $link POSTPONE: CALLBACK: } " definition or for an " { $link alien-invoke } " or " { $link alien-callback } " call." } ;
 HELP: void*
-{ $description "This C type represents a pointer to C memory. " { $link byte-array } " and " { $link alien } " values can be passed as " { $snippet "void*" } " function inputs, but see " { $link "byte-arrays-gc" } " for notes about passing byte arrays into C functions. " { $snippet "void*" } " output values are returned as " { $link alien } "s." } ;
-HELP: char*
+{ $description "This C type represents a generic pointer to C memory. See " { $link pointer } " for information on pointer C types." } ;
+HELP: c-string
 { $description "This C type represents a pointer to a C string. See " { $link "c-strings" } " for details about using strings with the FFI." } ;
 HELP: float
 { $description "This C type represents a single-precision IEEE 754 floating-point type. Input values will be converted to Factor " { $link math:float } "s and demoted to single-precision; output values will be returned as Factor " { $link math:float } "s." } ;
@@ -115,6 +91,19 @@ HELP: complex-float
 HELP: complex-double
 { $description "This C type represents a double-precision IEEE 754 floating-point complex type. Input values will be converted from Factor " { $link math:complex } " objects into a double-precision complex float type; output values will be returned as Factor " { $link math:complex } " objects." } ;
 
+HELP: pointer:
+{ $syntax "pointer: c-type" }
+{ $description "Constructs a " { $link pointer } " C type." } ;
+
+HELP: pointer
+{ $class-description "Represents a pointer C type. The " { $snippet "to" } " slot contains the C type being pointed to." { $link byte-array } " and " { $link alien } " values can be provided as pointer function inputs, but see " { $link "byte-arrays-gc" } " for notes about passing byte arrays into C functions. Objects with methods on " { $link >c-ptr } ", such as structs and specialized arrays, may also be used as pointer inputs."
+$nl
+"Pointer output values are represented in Factor as " { $link alien } "s. If the pointed-to type is a struct, the alien will automatically be wrapped in a struct object if it is not null."
+$nl
+"In " { $link POSTPONE: TYPEDEF: } ", " { $link POSTPONE: FUNCTION: } ", " { $link POSTPONE: CALLBACK: } ", and " { $link POSTPONE: STRUCT: } " definitions, pointer types can be created by suffixing " { $snippet "*" } " to a C type name. Outside of FFI definitions, a pointer C type can be created using the " { $link POSTPONE: pointer: } " syntax word:"
+{ $unchecked-example "FUNCTION: int* foo ( char* bar ) ;" }
+{ $unchecked-example """: foo ( bar -- int* )
+    pointer: int f \"foo\" { pointer: char } alien-invoke ;""" } } ;
 
 ARTICLE: "byte-arrays-gc" "Byte arrays and the garbage collector"
 "The Factor garbage collector can move byte arrays around, and it is only safe to pass byte arrays to C functions if the garbage collector will not run while C code still has a reference to the data."
@@ -191,11 +180,11 @@ ARTICLE: "c-types.primitives" "Primitive C types"
 "When making alien calls, Factor numbers are converted to and from the above types in a canonical way. Converting a Factor number to a C value may result in a loss of precision." ;
 
 ARTICLE: "c-types.pointers" "Pointer and array types"
-"Pointer types are specified by suffixing a C type with " { $snippet "*" } ", for example " { $snippet "float*" } ". One special case is " { $link void* } ", which denotes a generic pointer; " { $link void } " by itself is not a valid C type specifier. With the exception of strings (see " { $link "c-strings" } "), all pointer types are identical to " { $snippet "void*" } " as far as the C library interface is concerned."
+"Pointer types are specified by suffixing a C type with " { $snippet "*" } ", for example " { $snippet "float*" } ". One special case is " { $link void* } ", which denotes a generic pointer; " { $link void } " by itself is not a valid C type specifier. This syntax constructs a " { $link pointer } " object to represent the C type."
 $nl
 "Fixed-size array types are supported; the syntax consists of a C type name followed by dimension sizes in brackets; the following denotes a 3 by 4 array of integers:"
 { $code "int[3][4]" }
-"Fixed-size arrays differ from pointers in that they are allocated inside structures and unions; however when used as function parameters they behave exactly like pointers and thus the dimensions only serve as documentation." ;
+"Fixed-size arrays differ from pointers in that they are allocated inside structures and unions; however, when used as function parameters, they behave exactly like pointers with the dimensions only serving as documentation." ;
 
 ARTICLE: "c-types.ambiguity" "Word name clashes with C types"
 "Note that some of the C type word names clash with commonly-used Factor words:"
@@ -228,7 +217,7 @@ ARTICLE: "c-types.structs" "Struct and union types"
 "Struct and union types are identified by their class word. See " { $link "classes.struct" } "." ;
 
 ARTICLE: "c-types-specs" "C type specifiers"
-"C types are identified by special words, and type names occur as parameters to the " { $link alien-invoke } ", " { $link alien-indirect } " and " { $link alien-callback } " words."
+"C types are identified by special words. Type names occur as parameters to the " { $link alien-invoke } ", " { $link alien-indirect } " and " { $link alien-callback } " words."
 $nl
 "Defining new C types:"
 { $subsections
index faee8955e934e20149b933d74d9dd5299e457437..7ad4bbb07469b94adaecf1c92d50e48431a52afd 100644 (file)
@@ -1,6 +1,6 @@
 USING: alien alien.syntax alien.c-types alien.parser
 eval kernel tools.test sequences system libc alien.strings
-io.encodings.utf8 math.constants classes.struct classes
+io.encodings.ascii io.encodings.utf8 math.constants classes.struct classes
 accessors compiler.units ;
 IN: alien.c-types.tests
 
@@ -16,36 +16,39 @@ UNION-STRUCT: foo
     { a int }
     { b int } ;
 
-[ f ] [ char  resolve-pointer-type c-type void* c-type eq? ] unit-test
-[ t ] [ char* resolve-pointer-type c-type void* c-type eq? ] unit-test
+[ t ] [ pointer: void c-type void* c-type = ] unit-test
+[ t ] [ pointer: int  c-type void* c-type = ] unit-test
+[ t ] [ pointer: int* c-type void* c-type = ] unit-test
+[ f ] [ pointer: foo  c-type void* c-type = ] unit-test
+[ t ] [ pointer: foo* c-type void* c-type = ] unit-test
+
+[ t ] [ c-string c-type c-string c-type = ] unit-test
 
 [ t ] [ foo heap-size int heap-size = ] unit-test
 
 TYPEDEF: int MyInt
 
-[ t ] [ int   c-type MyInt                      c-type eq? ] unit-test
-[ t ] [ void* c-type MyInt resolve-pointer-type c-type eq? ] unit-test
+[ t ] [ int   c-type          MyInt c-type = ] unit-test
+[ t ] [ void* c-type pointer: MyInt c-type = ] unit-test
+
+[ 32 ] [ { int 8 } heap-size ] unit-test
 
 TYPEDEF: char MyChar
 
-[ t ] [ char  c-type MyChar                      c-type eq? ] unit-test
-[ f ] [ void* c-type MyChar resolve-pointer-type c-type eq? ] unit-test
-[ t ] [ char* c-type MyChar resolve-pointer-type c-type eq? ] unit-test
+[ t ] [ pointer: void c-type pointer: MyChar c-type = ] unit-test
 
-[ 32 ] [ { int 8 } heap-size ] unit-test
+TYPEDEF: { c-string ascii } MyFunkyString
 
-TYPEDEF: char* MyString
+[ { c-string ascii } ] [ MyFunkyString c-type ] unit-test
 
-[ t ] [ char* c-type MyString                      c-type eq? ] unit-test
-[ t ] [ void* c-type MyString resolve-pointer-type c-type eq? ] unit-test
+TYPEDEF: c-string MyString
 
-TYPEDEF: int* MyIntArray
-
-[ t ] [ void* c-type MyIntArray c-type eq? ] unit-test
+[ t ] [ c-string c-type MyString          c-type = ] unit-test
+[ t ] [ void* c-type pointer: MyString c-type = ] unit-test
 
-TYPEDEF: uchar* MyLPBYTE
+TYPEDEF: int* MyIntArray
 
-[ t ] [ { char* utf8 } c-type MyLPBYTE c-type = ] unit-test
+[ t ] [ void* c-type MyIntArray c-type = ] unit-test
 
 [
     0 B{ 1 2 3 4 } <displaced-alien> <void*>
@@ -63,7 +66,7 @@ os windows? cpu x86.64? and [
 
 C-TYPE: opaque
 
-[ t ] [ void* c-type opaque resolve-pointer-type c-type eq? ] unit-test
+[ t ] [ void* c-type pointer: opaque c-type = ] unit-test
 [ opaque c-type ] [ no-c-type? ] must-fail-with
 
 [ """
index fff49a44808831871d4c28bddaae6da67f17cc32..412bf9259a89e82cc18654ef99858eac5e91d8ee 100644 (file)
@@ -1,12 +1,12 @@
-! Copyright (C) 2004, 2009 Slava Pestov.
+! Copyright (C) 2004, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: byte-arrays arrays assocs kernel kernel.private math
+USING: byte-arrays arrays assocs delegate kernel kernel.private math
 math.order math.parser namespaces make parser sequences strings
 words splitting cpu.architecture alien alien.accessors
 alien.strings quotations layouts system compiler.units io
 io.files io.encodings.binary io.streams.memory accessors
 combinators effects continuations fry classes vocabs
-vocabs.loader words.symbol ;
+vocabs.loader words.symbol macros ;
 QUALIFIED: math
 IN: alien.c-types
 
@@ -38,32 +38,24 @@ TUPLE: abstract-c-type
 TUPLE: c-type < abstract-c-type
 boxer
 unboxer
-{ rep initial: int-rep }
-stack-align? ;
+{ rep initial: int-rep } ;
 
 : <c-type> ( -- c-type )
     \ c-type new ; inline
 
 ERROR: no-c-type name ;
 
-PREDICATE: c-type-word < word
-    "c-type" word-prop ;
-
-UNION: c-type-name string c-type-word ;
-
 ! C type protocol
 GENERIC: c-type ( name -- c-type ) foldable
 
-GENERIC: resolve-pointer-type ( name -- c-type )
-
-<< \ void \ void* "pointer-c-type" set-word-prop >>
+PREDICATE: c-type-word < word
+    "c-type" word-prop ;
 
-M: word resolve-pointer-type
-    dup "pointer-c-type" word-prop
-    [ ] [ drop void* ] ?if ;
+TUPLE: pointer { to initial: void read-only } ;
+C: <pointer> pointer
 
-M: array resolve-pointer-type
-    first resolve-pointer-type ;
+UNION: c-type-name
+    c-type-word pointer ;
 
 : resolve-typedef ( name -- c-type )
     dup void? [ no-c-type ] when
@@ -73,178 +65,96 @@ M: word c-type
     dup "c-type" word-prop resolve-typedef
     [ ] [ no-c-type ] ?if ;
 
-GENERIC: c-struct? ( c-type -- ? )
-
-M: object c-struct? drop f ;
-
-M: c-type-name c-struct? dup void? [ drop f ] [ c-type c-struct? ] if ;
-
-! These words being foldable means that words need to be
-! recompiled if a C type is redefined. Even so, folding the
-! size facilitates some optimizations.
 GENERIC: c-type-class ( name -- class )
 
 M: abstract-c-type c-type-class class>> ;
 
-M: c-type-name c-type-class c-type c-type-class ;
-
 GENERIC: c-type-boxed-class ( name -- class )
 
 M: abstract-c-type c-type-boxed-class boxed-class>> ;
 
-M: c-type-name c-type-boxed-class c-type c-type-boxed-class ;
-
-GENERIC: c-type-boxer ( name -- boxer )
-
-M: c-type c-type-boxer boxer>> ;
-
-M: c-type-name c-type-boxer c-type c-type-boxer ;
-
 GENERIC: c-type-boxer-quot ( name -- quot )
 
 M: abstract-c-type c-type-boxer-quot boxer-quot>> ;
 
-M: c-type-name c-type-boxer-quot c-type c-type-boxer-quot ;
-
-GENERIC: c-type-unboxer ( name -- boxer )
-
-M: c-type c-type-unboxer unboxer>> ;
-
-M: c-type-name c-type-unboxer c-type c-type-unboxer ;
-
 GENERIC: c-type-unboxer-quot ( name -- quot )
 
 M: abstract-c-type c-type-unboxer-quot unboxer-quot>> ;
 
-M: c-type-name c-type-unboxer-quot c-type c-type-unboxer-quot ;
-
 GENERIC: c-type-rep ( name -- rep )
 
 M: c-type c-type-rep rep>> ;
 
-M: c-type-name c-type-rep c-type c-type-rep ;
-
 GENERIC: c-type-getter ( name -- quot )
 
 M: c-type c-type-getter getter>> ;
 
-M: c-type-name c-type-getter c-type c-type-getter ;
-
 GENERIC: c-type-setter ( name -- quot )
 
 M: c-type c-type-setter setter>> ;
 
-M: c-type-name c-type-setter c-type c-type-setter ;
-
-GENERIC: c-type-align ( name -- n )
+GENERIC: c-type-align ( name -- n ) foldable
 
 M: abstract-c-type c-type-align align>> ;
 
-M: c-type-name c-type-align c-type c-type-align ;
-
 GENERIC: c-type-align-first ( name -- n )
 
-M: c-type-name c-type-align-first c-type c-type-align-first ;
-
 M: abstract-c-type c-type-align-first align-first>> ;
 
-GENERIC: c-type-stack-align? ( name -- ? )
-
-M: c-type c-type-stack-align? stack-align?>> ;
-
-M: c-type-name c-type-stack-align? c-type c-type-stack-align? ;
-
-: c-type-box ( n c-type -- )
-    [ c-type-rep ] [ c-type-boxer [ "No boxer" throw ] unless* ] bi
-    %box ;
-
-: c-type-unbox ( n c-type -- )
-    [ c-type-rep ] [ c-type-unboxer [ "No unboxer" throw ] unless* ] bi
-    %unbox ;
-
-GENERIC: box-parameter ( n c-type -- )
-
-M: c-type box-parameter c-type-box ;
-
-M: c-type-name box-parameter c-type box-parameter ;
+GENERIC: base-type ( c-type -- c-type )
 
-GENERIC: box-return ( c-type -- )
+M: c-type-name base-type c-type ;
 
-M: c-type box-return f swap c-type-box ;
-
-M: c-type-name box-return c-type box-return ;
-
-GENERIC: unbox-parameter ( n c-type -- )
-
-M: c-type unbox-parameter c-type-unbox ;
-
-M: c-type-name unbox-parameter c-type unbox-parameter ;
-
-GENERIC: unbox-return ( c-type -- )
-
-M: c-type unbox-return f swap c-type-unbox ;
-
-M: c-type-name unbox-return c-type unbox-return ;
+M: c-type base-type ;
 
 : little-endian? ( -- ? ) 1 <int> *char 1 = ; foldable
 
 GENERIC: heap-size ( name -- size )
 
-M: c-type-name heap-size c-type heap-size ;
-
 M: abstract-c-type heap-size size>> ;
 
-GENERIC: stack-size ( name -- size )
-
-M: c-type-name stack-size c-type stack-size ;
-
-M: c-type stack-size size>> cell align ;
-
-GENERIC: byte-length ( seq -- n ) flushable
-
-M: byte-array byte-length length ; inline
+MIXIN: value-type
 
-M: f byte-length drop 0 ; inline
+MACRO: alien-value ( c-type -- quot: ( c-ptr offset -- value ) )
+    [ c-type-getter ] [ c-type-boxer-quot ] bi append ;
 
-: >c-bool ( ? -- int ) 1 0 ? ; inline
+MACRO: set-alien-value ( c-type -- quot: ( value c-ptr offset -- ) )
+    [ c-type-unboxer-quot [ [ ] ] [ '[ _ 2dip ] ] if-empty ]
+    [ c-type-setter ]
+    bi append ;
 
-: c-bool> ( int -- ? ) 0 = not ; inline
+: array-accessor ( n c-ptr c-type -- c-ptr offset c-type )
+    [ swapd heap-size * >fixnum ] keep ; inline
 
-MIXIN: value-type
+: alien-element ( n c-ptr c-type -- value )
+    array-accessor alien-value ; inline
 
-: c-getter ( name -- quot )
-    c-type-getter [
-        [ "Cannot read struct fields with this type" throw ]
-    ] unless* ;
+: set-alien-element ( value n c-ptr c-type -- )
+    array-accessor set-alien-value ; inline
 
-: c-type-getter-boxer ( name -- quot )
-    [ c-getter ] [ c-type-boxer-quot ] bi append ;
+PROTOCOL: c-type-protocol 
+    c-type-class
+    c-type-boxed-class
+    c-type-boxer-quot
+    c-type-unboxer-quot
+    c-type-rep
+    c-type-getter
+    c-type-setter
+    c-type-align
+    c-type-align-first
+    base-type
+    heap-size ;
 
-: c-setter ( name -- quot )
-    c-type-setter [
-        [ "Cannot write struct fields with this type" throw ]
-    ] unless* ;
-
-: array-accessor ( c-type quot -- def )
-    [
-        \ swap , [ heap-size , [ * >fixnum ] % ] [ % ] bi*
-    ] [ ] make ;
-
-GENERIC: typedef ( old new -- )
+CONSULT: c-type-protocol c-type-name
+    c-type ;
 
 PREDICATE: typedef-word < c-type-word
     "c-type" word-prop c-type-name? ;
 
-M: word typedef ( old new -- )
+: typedef ( old new -- )
     {
         [ nip define-symbol ]
         [ swap "c-type" set-word-prop ]
-        [
-            swap dup c-type-name? [
-                resolve-pointer-type
-                "pointer-c-type" set-word-prop
-            ] [ 2drop ] if
-        ]
     } 2cleave ;
 
 TUPLE: long-long-type < c-type ;
@@ -252,25 +162,14 @@ TUPLE: long-long-type < c-type ;
 : <long-long-type> ( -- c-type )
     long-long-type new ;
 
-M: long-long-type unbox-parameter ( n c-type -- )
-    c-type-unboxer %unbox-long-long ;
-
-M: long-long-type unbox-return ( c-type -- )
-    f swap unbox-parameter ;
-
-M: long-long-type box-parameter ( n c-type -- )
-    c-type-boxer %box-long-long ;
-
-M: long-long-type box-return ( c-type -- )
-    f swap box-parameter ;
-
 : define-deref ( c-type -- )
-    [ name>> CHAR: * prefix "alien.c-types" create ] [ c-getter 0 prefix ] bi
-    (( c-ptr -- value )) define-inline ;
+    [ name>> CHAR: * prefix "alien.c-types" create ]
+    [ '[ 0 _ alien-value ] ]
+    bi (( c-ptr -- value )) define-inline ;
 
 : define-out ( c-type -- )
     [ name>> "alien.c-types" constructor-word ]
-    [ dup c-setter '[ _ heap-size (byte-array) [ 0 @ ] keep ] ] bi
+    [ dup '[ _ heap-size (byte-array) [ 0 _ set-alien-value ] keep ] ] bi
     (( value -- c-ptr )) define-inline ;
 
 : define-primitive-type ( c-type name -- )
@@ -279,6 +178,10 @@ M: long-long-type box-return ( c-type -- )
 : if-void ( c-type true false -- )
     pick void? [ drop nip call ] [ nip call ] if ; inline
 
+SYMBOLS:
+    ptrdiff_t intptr_t uintptr_t size_t
+    c-string ;
+
 CONSTANT: primitive-types
     {
         char uchar
@@ -288,11 +191,14 @@ CONSTANT: primitive-types
         longlong ulonglong
         float double
         void* bool
+        c-string
     }
 
-SYMBOLS:
-    ptrdiff_t intptr_t uintptr_t size_t
-    char* uchar* ;
+: >c-bool ( ? -- int ) 1 0 ? ; inline
+
+: c-bool> ( int -- ? ) 0 = not ; inline
+
+<PRIVATE
 
 : 8-byte-alignment ( c-type -- c-type )
     {
@@ -301,12 +207,32 @@ SYMBOLS:
         [ 8 >>align 8 >>align-first ]
     } cond ;
 
+: resolve-pointer-typedef ( type -- base-type )
+    dup "c-type" word-prop dup word?
+    [ nip resolve-pointer-typedef ] [
+        pointer? [ drop void* ] when
+    ] if ;
+
+: primitive-pointer-type? ( type -- ? )
+    dup c-type-word? [
+        resolve-pointer-typedef [ void? ] [ primitive-types member? ] bi or
+    ] [ drop t ] if ;
+
+: (pointer-c-type) ( void* type -- void*' )
+    [ clone ] dip c-type-boxer-quot '[ _ [ f ] if* ] >>boxer-quot ;
+
+PRIVATE>
+
+M: pointer c-type
+    [ \ void* c-type ] dip
+    to>> dup primitive-pointer-type? [ drop ] [ (pointer-c-type) ] if ;
+
 [
     <c-type>
         c-ptr >>class
         c-ptr >>boxed-class
         [ alien-cell ] >>getter
-        [ [ >c-ptr ] 2dip set-alien-cell ] >>setter
+        [ set-alien-cell ] >>setter
         bootstrap-cell >>size
         bootstrap-cell >>align
         bootstrap-cell >>align-first
@@ -315,30 +241,6 @@ SYMBOLS:
         "alien_offset" >>unboxer
     \ void* define-primitive-type
 
-    <c-type>
-        integer >>class
-        integer >>boxed-class
-        [ alien-signed-4 ] >>getter
-        [ set-alien-signed-4 ] >>setter
-        4 >>size
-        4 >>align
-        4 >>align-first
-        "from_signed_4" >>boxer
-        "to_fixnum" >>unboxer
-    \ int define-primitive-type
-
-    <c-type>
-        integer >>class
-        integer >>boxed-class
-        [ alien-unsigned-4 ] >>getter
-        [ set-alien-unsigned-4 ] >>setter
-        4 >>size
-        4 >>align
-        4 >>align-first
-        "from_unsigned_4" >>boxer
-        "to_cell" >>unboxer
-    \ uint define-primitive-type
-
     <c-type>
         fixnum >>class
         fixnum >>boxed-class
@@ -349,6 +251,7 @@ SYMBOLS:
         2 >>align-first
         "from_signed_2" >>boxer
         "to_fixnum" >>unboxer
+        [ >fixnum ] >>unboxer-quot
     \ short define-primitive-type
 
     <c-type>
@@ -361,6 +264,7 @@ SYMBOLS:
         2 >>align-first
         "from_unsigned_2" >>boxer
         "to_cell" >>unboxer
+        [ >fixnum ] >>unboxer-quot
     \ ushort define-primitive-type
 
     <c-type>
@@ -373,6 +277,7 @@ SYMBOLS:
         1 >>align-first
         "from_signed_1" >>boxer
         "to_fixnum" >>unboxer
+        [ >fixnum ] >>unboxer-quot
     \ char define-primitive-type
 
     <c-type>
@@ -385,34 +290,14 @@ SYMBOLS:
         1 >>align-first
         "from_unsigned_1" >>boxer
         "to_cell" >>unboxer
+        [ >fixnum ] >>unboxer-quot
     \ uchar define-primitive-type
 
-    cpu ppc? [
-        <c-type>
-            [ alien-unsigned-4 c-bool> ] >>getter
-            [ [ >c-bool ] 2dip set-alien-unsigned-4 ] >>setter
-            4 >>size
-            4 >>align
-            4 >>align-first
-            "from_boolean" >>boxer
-            "to_boolean" >>unboxer
-    ] [
-        <c-type>
-            [ alien-unsigned-1 c-bool> ] >>getter
-            [ [ >c-bool ] 2dip set-alien-unsigned-1 ] >>setter
-            1 >>size
-            1 >>align
-            1 >>align-first
-            "from_boolean" >>boxer
-            "to_boolean" >>unboxer
-    ] if
-    \ bool define-primitive-type
-
     <c-type>
         math:float >>class
         math:float >>boxed-class
         [ alien-float ] >>getter
-        [ [ >float ] 2dip set-alien-float ] >>setter
+        [ set-alien-float ] >>setter
         4 >>size
         4 >>align
         4 >>align-first
@@ -426,7 +311,7 @@ SYMBOLS:
         math:float >>class
         math:float >>boxed-class
         [ alien-double ] >>getter
-        [ [ >float ] 2dip set-alien-double ] >>setter
+        [ set-alien-double ] >>setter
         8 >>size
         8-byte-alignment
         "from_double" >>boxer
@@ -436,14 +321,40 @@ SYMBOLS:
     \ double define-primitive-type
 
     cell 8 = [
+        <c-type>
+            fixnum >>class
+            fixnum >>boxed-class
+            [ alien-signed-4 ] >>getter
+            [ set-alien-signed-4 ] >>setter
+            4 >>size
+            4 >>align
+            4 >>align-first
+            "from_signed_4" >>boxer
+            "to_fixnum" >>unboxer
+            [ >fixnum ] >>unboxer-quot
+        \ int define-primitive-type
+    
+        <c-type>
+            fixnum >>class
+            fixnum >>boxed-class
+            [ alien-unsigned-4 ] >>getter
+            [ set-alien-unsigned-4 ] >>setter
+            4 >>size
+            4 >>align
+            4 >>align-first
+            "from_unsigned_4" >>boxer
+            "to_cell" >>unboxer
+            [ >fixnum ] >>unboxer-quot
+        \ uint define-primitive-type
+
         <c-type>
             integer >>class
             integer >>boxed-class
             [ alien-signed-cell ] >>getter
             [ set-alien-signed-cell ] >>setter
-            bootstrap-cell >>size
-            bootstrap-cell >>align
-            bootstrap-cell >>align-first
+            8 >>size
+            8 >>align
+            8 >>align-first
             "from_signed_cell" >>boxer
             "to_fixnum" >>unboxer
         \ longlong define-primitive-type
@@ -453,9 +364,9 @@ SYMBOLS:
             integer >>boxed-class
             [ alien-unsigned-cell ] >>getter
             [ set-alien-unsigned-cell ] >>setter
-            bootstrap-cell >>size
-            bootstrap-cell >>align
-            bootstrap-cell >>align-first
+            8 >>size
+            8 >>align
+            8 >>align-first
             "from_unsigned_cell" >>boxer
             "to_cell" >>unboxer
         \ ulonglong define-primitive-type
@@ -474,6 +385,30 @@ SYMBOLS:
         \ ulonglong c-type \ uintptr_t typedef
         \ ulonglong c-type \ size_t typedef
     ] [
+        <c-type>
+            integer >>class
+            integer >>boxed-class
+            [ alien-signed-cell ] >>getter
+            [ set-alien-signed-cell ] >>setter
+            4 >>size
+            4 >>align
+            4 >>align-first
+            "from_signed_cell" >>boxer
+            "to_fixnum" >>unboxer
+        \ int define-primitive-type
+    
+        <c-type>
+            integer >>class
+            integer >>boxed-class
+            [ alien-unsigned-cell ] >>getter
+            [ set-alien-unsigned-cell ] >>setter
+            4 >>size
+            4 >>align
+            4 >>align-first
+            "from_unsigned_cell" >>boxer
+            "to_cell" >>unboxer
+        \ uint define-primitive-type
+
         <long-long-type>
             integer >>class
             integer >>boxed-class
@@ -505,6 +440,13 @@ SYMBOLS:
         \ uint c-type \ uintptr_t typedef
         \ uint c-type \ size_t typedef
     ] if
+
+    cpu ppc? \ uint \ uchar ? c-type clone
+        [ >c-bool ] >>unboxer-quot
+        [ c-bool> ] >>boxer-quot
+        object >>boxed-class
+    \ bool define-primitive-type
+
 ] with-compilation-unit
 
 M: char-16-rep rep-component-type drop char ;
index 0536d15736289f63621b19f446663381de7c8284..1401190f45d3f30d4842abc14caf169e4d4dd6c4 100644 (file)
@@ -21,11 +21,6 @@ HELP: memory>byte-array
 { $values { "alien" c-ptr } { "len" "a non-negative integer" } { "byte-array" byte-array } }
 { $description "Reads " { $snippet "len" } " bytes starting from " { $snippet "base" } " and stores them in a new byte array." } ;
 
-HELP: byte-array>memory
-{ $values { "byte-array" byte-array } { "base" c-ptr } }
-{ $description "Writes a byte array to memory starting from the " { $snippet "base" } " address." }
-{ $warning "This word is unsafe. Improper use can corrupt memory." } ;
-
 HELP: malloc-array
 { $values { "n" "a non-negative integer" } { "type" "a C type" } { "array" "a specialized array" } }
 { $description "Allocates an unmanaged memory block large enough to hold " { $snippet "n" } " values of a C type, then wraps the memory in a sequence object using " { $link <c-direct-array> } "." }
@@ -65,6 +60,8 @@ $nl
 }
 "You must always free pointers returned by any of the above words when the block of memory is no longer in use:"
 { $subsections free }
+"The above words record memory allocations, to help catch double frees and track down memory leaks with " { $link "tools.destructors" } ". To free memory allocated by a C library, another word can be used:"
+{ $subsections (free) }
 "Utilities for automatically freeing memory in conjunction with " { $link with-destructors } ":"
 { $subsections
     &free
@@ -75,9 +72,7 @@ $nl
 "You can unsafely copy a range of bytes from one memory location to another:"
 { $subsections memcpy }
 "You can copy a range of bytes from memory into a byte array:"
-{ $subsections memory>byte-array }
-"You can copy a byte array to memory unsafely:"
-{ $subsections byte-array>memory } ;
+{ $subsections memory>byte-array } ;
 
 ARTICLE: "c-pointers" "Passing pointers to C functions"
 "The following Factor objects may be passed to C function parameters with pointer types:"
@@ -85,7 +80,7 @@ ARTICLE: "c-pointers" "Passing pointers to C functions"
     { "Instances of " { $link alien } "." }
     { "Instances of " { $link f } "; this is interpreted as a null pointer." }
     { "Instances of " { $link byte-array } "; the C function receives a pointer to the first element of the array." }
-    { "Any data type which defines a method on " { $link >c-ptr } " that returns an instance of one of the above. This includes " { $link "classes.struct" } " and " { $link "specialized-arrays" } "." } 
+    { "Any data type which defines a method on " { $link >c-ptr } ". This includes " { $link "classes.struct" } " and " { $link "specialized-arrays" } "." }
 }
 "The class of primitive C pointer types:"
 { $subsections c-ptr }
@@ -110,8 +105,8 @@ $nl
 "Important guidelines for passing data in byte arrays:"
 { $subsections "byte-arrays-gc" }
 "C-style enumerated types are supported:"
-{ $subsections POSTPONE: C-ENUM: }
-"C types can be aliased for convenience and consitency with native library documentation:"
+{ $subsections "alien.enums" POSTPONE: ENUM: }
+"C types can be aliased for convenience and consistency with native library documentation:"
 { $subsections POSTPONE: TYPEDEF: }
 "A utility for defining " { $link "destructors" } " for deallocating memory:"
 { $subsections "alien.destructors" }
@@ -140,13 +135,13 @@ HELP: <c-direct-array>
 { $notes "The appropriate specialized array vocabulary must be loaded; otherwise, an error will be thrown. The vocabulary can be loaded with the " { $link require-c-array } " word. See the " { $vocab-link "specialized-arrays" } " vocabulary for details on the underlying sequence type constructed." } ;
 
 ARTICLE: "c-strings" "C strings"
-"C string types are arrays with shape " { $snippet "{ char* encoding }" } ", where " { $snippet "encoding" } " is an encoding descriptor. The type " { $link char* } " is an alias for " { $snippet "{ char* utf8 }" } ". See " { $link "encodings-descriptors" } " for information about encoding descriptors."
+"C string types are arrays with shape " { $snippet "{ c-string encoding }" } ", where " { $snippet "encoding" } " is an encoding descriptor. The type " { $link c-string } " is an alias for " { $snippet "{ c-string utf8 }" } ". See " { $link "encodings-descriptors" } " for information about encoding descriptors. In " { $link POSTPONE: TYPEDEF: } ", " { $link POSTPONE: FUNCTION: } ", " { $link POSTPONE: CALLBACK: } ", and " { $link POSTPONE: STRUCT: } " definitions, the shorthand syntax " { $snippet "c-string[encoding]" } " can be used to specify the string encoding."
 $nl
-"Passing a Factor string to a C function expecting a C string allocates a " { $link byte-array } " in the Factor heap; the string is then converted to the requested format and a raw pointer is passed to the function."
+"Passing a Factor string to a C function expecting a " { $link c-string } " allocates a " { $link byte-array } " in the Factor heap; the string is then converted to the requested format and a raw pointer is passed to the function."
 $nl
 "If the conversion fails, for example if the string contains null bytes or characters with values higher than 255, a " { $link c-string-error. } " is thrown."
 $nl
-"Care must be taken if the C function expects a " { $link char* } " with a length in bytes, rather than a null-terminated " { $link char* } "; passing the result of calling " { $link length } " on the string object will not suffice. This is because a Factor string of " { $emphasis "n" } " characters will not necessarily encode to " { $emphasis "n" } " bytes. The correct idiom for C functions which take a string with a length is to first encode the string using " { $link encode } ", and then pass the resulting byte array together with the length of this byte array."
+"Care must be taken if the C function expects a pointer to a string with its length represented by another parameter rather than a null terminator. Passing the result of calling " { $link length } " on the string object will not suffice. This is because a Factor string of " { $emphasis "n" } " characters will not necessarily encode to " { $emphasis "n" } " bytes. The correct idiom for C functions which take a string with a length is to first encode the string using " { $link encode } ", and then pass the resulting byte array together with the length of this byte array."
 $nl
 "Sometimes a C function has a parameter type of " { $link void* } ", and various data types, among them strings, can be passed in. In this case, strings are not automatically converted to aliens, and instead you must call one of these words:"
 { $subsections
@@ -155,7 +150,9 @@ $nl
 }
 "The first allocates " { $link byte-array } "s, and the latter allocates manually-managed memory which is not moved by the garbage collector and has to be explicitly freed by calling " { $link free } ". See " { $link "byte-arrays-gc" } " for a discussion of the two approaches."
 $nl
+"The C type " { $snippet "char*" } " represents a generic pointer to " { $snippet "char" } "; arguments with this type will expect and return " { $link alien } "s, and won't perform any implicit string conversion."
+$nl
 "A word to read strings from arbitrary addresses:"
 { $subsections alien>string }
-"For example, if a C function returns a " { $link char* } " but stipulates that the caller must deallocate the memory afterward, you must define the function as returning " { $link void* } ", and call one of the above words before passing the pointer to " { $link free } "." ;
+"For example, if a C function returns a " { $link c-string } " but stipulates that the caller must deallocate the memory afterward, you must define the function as returning " { $snippet "char*" } " and call " { $link (free) } " yourself." ;
 
index 93b1afd436cfd878129d4339c920f914d27830a2..81b53a1b39ee6bb16f935e17d9d85cd0efaee1be 100644 (file)
@@ -1,7 +1,8 @@
-! (c)2009 Slava Pestov, Joe Groff bsd license
-USING: accessors alien alien.c-types alien.strings arrays
-byte-arrays cpu.architecture fry io io.encodings.binary
-io.files io.streams.memory kernel libc math sequences words ;
+! (c)2009, 2010 Slava Pestov, Joe Groff bsd license
+USING: accessors alien alien.c-types alien.arrays alien.strings
+arrays byte-arrays cpu.architecture fry io io.encodings.binary
+io.files io.streams.memory kernel libc math sequences words
+macros combinators generalizations ;
 IN: alien.data
 
 GENERIC: require-c-array ( c-type -- )
@@ -48,7 +49,7 @@ M: word <c-direct-array>
     heap-size malloc ; inline
 
 : malloc-byte-array ( byte-array -- alien )
-    dup byte-length [ nip malloc dup ] 2keep memcpy ;
+    binary-object [ nip malloc dup ] 2keep memcpy ;
 
 : memory>byte-array ( alien len -- byte-array )
     [ nip (byte-array) dup ] 2keep memcpy ;
@@ -62,14 +63,46 @@ M: memory-stream stream-read
         swap memory>byte-array
     ] [ [ + ] change-index drop ] 2bi ;
 
-: byte-array>memory ( byte-array base -- )
-    swap dup byte-length memcpy ; inline
-
 M: value-type c-type-rep drop int-rep ;
 
 M: value-type c-type-getter
     drop [ swap <displaced-alien> ] ;
 
 M: value-type c-type-setter ( type -- quot )
-    [ c-type-getter ] [ c-type-unboxer-quot ] [ heap-size ] tri
-    '[ @ swap @ _ memcpy ] ;
+    [ c-type-getter ] [ heap-size ] bi '[ @ swap _ memcpy ] ;
+
+M: array c-type-boxer-quot
+    unclip [ array-length ] dip [ <c-direct-array> ] 2curry ;
+
+M: array c-type-unboxer-quot drop [ >c-ptr ] ;
+
+ERROR: local-allocation-error ;
+
+<PRIVATE
+
+: (local-allot) ( size align -- alien ) local-allocation-error ;
+
+: (cleanup-allot) ( -- )
+    ! Inhibit TCO in order for the last word in the quotation
+    ! to still be abl to access scope-allocated data.
+    ;
+
+MACRO: (local-allots) ( c-types -- quot )
+    [ '[ _ [ heap-size ] [ c-type-align ] bi (local-allot) ] ] map [ ] join ;
+
+MACRO: box-values ( c-types -- quot )
+    [ c-type-boxer-quot ] map '[ _ spread ] ;
+
+MACRO: out-parameters ( c-types -- quot )
+    [ length ] [ [ '[ 0 _ alien-value ] ] map ] bi
+    '[ _ nkeep _ spread ] ;
+
+PRIVATE>
+
+: with-scoped-allocation ( c-types quot -- )
+    [ [ (local-allots) ] [ box-values ] bi ] dip call
+    (cleanup-allot) ; inline
+
+: with-out-parameters ( c-types quot finish -- values )
+    [ [ drop (local-allots) ] [ swap out-parameters ] 2bi ] dip call
+    (cleanup-allot) ; inline
diff --git a/basis/alien/debugger/authors.txt b/basis/alien/debugger/authors.txt
new file mode 100644 (file)
index 0000000..f13c9c1
--- /dev/null
@@ -0,0 +1 @@
+Joe Groff
diff --git a/basis/alien/debugger/debugger.factor b/basis/alien/debugger/debugger.factor
new file mode 100644 (file)
index 0000000..a046971
--- /dev/null
@@ -0,0 +1,10 @@
+! Copyright (C) 2010 Joe Groff.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.parser summary sequences accessors
+prettyprint ;
+IN: alien.debugger
+
+M: no-c-type summary name>> unparse "“" "” is not a C type" surround ;
+
+M: *-in-c-type-name summary
+    name>> "Cannot define a C type “" "” that ends with an asterisk (*)" surround ;
diff --git a/basis/alien/enums/enums-docs.factor b/basis/alien/enums/enums-docs.factor
new file mode 100644 (file)
index 0000000..cc23a40
--- /dev/null
@@ -0,0 +1,36 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.syntax help.markup help.syntax words ;
+IN: alien.enums
+
+HELP: define-enum
+{ $values
+    { "word" word } { "base-type" c-type } { "members" "sequence of word and value pairs" }
+}
+{ $description "Defines an enum. This is the run-time equivalent of " { $link POSTPONE: ENUM: } "." } ;
+
+HELP: enum>number
+{ $values
+    { "enum" "an enum word" }
+    { "number" "the corresponding number value" }
+}
+{ $description "Converts an enum to a number." } ;
+
+HELP: number>enum
+{ $values
+    { "number" "an enum number" } { "enum-c-type" "an enum type" }
+    { "enum" "the corresponding enum word" }
+}
+{ $description "Convert a number to an enum." } ;
+
+ARTICLE: "alien.enums" "Enumeration types"
+"The " { $vocab-link "alien.enums" } " vocab contains the implementation for " { $link POSTPONE: ENUM: } " C types, and provides words for converting between enum symbols and integers."
+$nl
+"Defining enums at run-time:"
+{ $subsection define-enum }
+"Conversions between enums and integers:"
+{ $subsections enum>number number>enum } ;
+
+{ POSTPONE: ENUM: define-enum enum>number number>enum } related-words
+
+ABOUT: "alien.enums"
diff --git a/basis/alien/enums/enums-tests.factor b/basis/alien/enums/enums-tests.factor
new file mode 100644 (file)
index 0000000..f0c6658
--- /dev/null
@@ -0,0 +1,35 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types alien.enums alien.enums.private
+alien.syntax sequences tools.test words ;
+IN: alien.enums.tests
+
+ENUM: color_t red { green 3 } blue ;
+ENUM: instrument_t < ushort trombone trumpet ;
+
+{ { red green blue 5 } }
+[ { 0 3 4 5 } [ <color_t> ] map ] unit-test
+
+{ { 0 3 4 5 } }
+[ { red green blue 5 } [ enum>number ] map ] unit-test
+
+{ { -1 trombone trumpet } }
+[ { -1 0 1 } [ <instrument_t> ] map ] unit-test
+
+{ { -1 0 1 } }
+[ { -1 trombone trumpet } [ enum>number ] map ] unit-test
+
+{ t }
+[ color_t "c-type" word-prop enum-c-type? ] unit-test
+
+{ f }
+[ ushort "c-type" word-prop enum-c-type? ] unit-test
+
+{ int }
+[ color_t "c-type" word-prop base-type>> ] unit-test
+
+{ ushort }
+[ instrument_t "c-type" word-prop base-type>> ] unit-test
+
+{ V{ { red 0 } { green 3 } { blue 4 } } }
+[ color_t "c-type" word-prop members>> ] unit-test
diff --git a/basis/alien/enums/enums.factor b/basis/alien/enums/enums.factor
new file mode 100644 (file)
index 0000000..1800010
--- /dev/null
@@ -0,0 +1,55 @@
+! (c)2010 Joe Groff, Erik Charlebois bsd license
+USING: accessors alien.c-types arrays combinators delegate fry
+generic.parser kernel macros math parser sequences words words.symbol ;
+IN: alien.enums
+
+<PRIVATE
+TUPLE: enum-c-type base-type members ;
+C: <enum-c-type> enum-c-type
+CONSULT: c-type-protocol enum-c-type
+    base-type>> ;
+PRIVATE>
+
+GENERIC: enum>number ( enum -- number ) foldable
+M: integer enum>number ;
+M: symbol enum>number "enum-value" word-prop ;
+
+<PRIVATE
+: enum-boxer ( members -- quot )
+    [ first2 swap '[ _ ] 2array ]
+    { } map-as [ ] suffix '[ _ case ] ;
+PRIVATE>
+
+MACRO: number>enum ( enum-c-type -- )
+    c-type members>> enum-boxer ;
+
+M: enum-c-type c-type-boxed-class drop object ;
+M: enum-c-type c-type-boxer-quot members>> enum-boxer ;
+M: enum-c-type c-type-unboxer-quot drop [ enum>number ] ;
+M: enum-c-type c-type-setter
+   [ enum>number ] swap base-type>> c-type-setter '[ _ 2dip @ ] ;
+
+<PRIVATE
+
+: define-enum-value ( class value -- )
+    "enum-value" set-word-prop ;
+
+: define-enum-members ( member-names -- )
+    [
+        [ first define-symbol ]
+        [ first2 define-enum-value ] bi
+    ] each ;
+
+: define-enum-constructor ( word -- )
+    [ name>> "<" ">" surround create-in ] keep
+    [ number>enum ] curry (( number -- enum )) define-inline ;
+
+PRIVATE>
+
+: define-enum ( word base-type members -- )
+    [ dup define-enum-constructor ] 2dip
+    dup define-enum-members
+    <enum-c-type> swap typedef ;
+    
+PREDICATE: enum-c-type-word < c-type-word
+    "c-type" word-prop enum-c-type? ;
index 80a5ec8bae1e21b0aa99d994fa4d5fb8f91caf59..dc0585cab8fcadce43ae066df092f676116e73ed 100644 (file)
@@ -4,6 +4,7 @@ alien.data alien.fortran alien.fortran.private alien.strings
 classes.struct arrays assocs byte-arrays combinators fry
 generalizations io.encodings.ascii kernel macros
 macros.expander namespaces sequences shuffle tools.test vocabs.parser ;
+FROM: alien.syntax => pointer: ;
 QUALIFIED-WITH: alien.c-types c
 IN: alien.fortran.tests
 
@@ -100,16 +101,16 @@ intel-unix-abi fortran-abi [
 
     ! fortran-arg-type>c-type
 
-    [ c:void* { } ]
+    [ pointer: c:int { } ]
     [ "integer" fortran-arg-type>c-type ] unit-test
 
-    [ c:void* { } ]
+    [ pointer: { c:int 3 } { } ]
     [ "integer(3)" fortran-arg-type>c-type ] unit-test
 
-    [ c:void* { } ]
+    [ pointer: { c:int 0 } { } ]
     [ "integer(*)" fortran-arg-type>c-type ] unit-test
 
-    [ c:void* { } ]
+    [ pointer: fortran_test_record { } ]
     [
         [
             "alien.fortran.tests" use-vocab
@@ -117,13 +118,13 @@ intel-unix-abi fortran-abi [
         ] with-manifest
     ] unit-test
 
-    [ c:char* { } ]
+    [ pointer: c:char { } ]
     [ "character" fortran-arg-type>c-type ] unit-test
 
-    [ c:char* { } ]
+    [ pointer: c:char { } ]
     [ "character(1)" fortran-arg-type>c-type ] unit-test
 
-    [ c:char* { long } ]
+    [ pointer: { c:char 17 } { long } ]
     [ "character(17)" fortran-arg-type>c-type ] unit-test
 
     ! fortran-ret-type>c-type
@@ -131,7 +132,7 @@ intel-unix-abi fortran-abi [
     [ c:char { } ]
     [ "character(1)" fortran-ret-type>c-type ] unit-test
 
-    [ c:void { c:char* long } ]
+    [ c:void { pointer: { c:char 17 } long } ]
     [ "character(17)" fortran-ret-type>c-type ] unit-test
 
     [ c:int { } ]
@@ -143,22 +144,22 @@ intel-unix-abi fortran-abi [
     [ c:float { } ]
     [ "real" fortran-ret-type>c-type ] unit-test
 
-    [ c:void { c:void* } ]
+    [ c:void { pointer: { c:float 0 } } ]
     [ "real(*)" fortran-ret-type>c-type ] unit-test
 
     [ c:double { } ]
     [ "double-precision" fortran-ret-type>c-type ] unit-test
 
-    [ c:void { c:void* } ]
+    [ c:void { pointer: complex-float } ]
     [ "complex" fortran-ret-type>c-type ] unit-test
 
-    [ c:void { c:void* } ]
+    [ c:void { pointer: complex-double } ]
     [ "double-complex" fortran-ret-type>c-type ] unit-test
 
-    [ c:void { c:void* } ]
+    [ c:void { pointer: { c:int 0 } } ]
     [ "integer(*)" fortran-ret-type>c-type ] unit-test
 
-    [ c:void { c:void* } ]
+    [ c:void { pointer: fortran_test_record } ]
     [
         [
             "alien.fortran.tests" use-vocab
@@ -168,19 +169,19 @@ intel-unix-abi fortran-abi [
 
     ! fortran-sig>c-sig
 
-    [ c:float { c:void* c:char* c:void* c:void* c:long } ]
+    [ c:float { pointer: c:int pointer: { c:char 17 } pointer: c:float pointer: c:double c:long } ]
     [ "real" { "integer" "character*17" "real" "real*8" } fortran-sig>c-sig ]
     unit-test
 
-    [ c:char { c:char* c:char* c:void* c:long } ]
+    [ c:char { pointer: { c:char 17 } pointer: c:char pointer: c:int c:long } ]
     [ "character(1)" { "character*17" "character" "integer" } fortran-sig>c-sig ]
     unit-test
 
-    [ c:void { c:char* c:long c:char* c:char* c:void* c:long } ]
+    [ c:void { pointer: { c:char 18 } c:long pointer: { c:char 17 } pointer: c:char pointer: c:int c:long } ]
     [ "character*18" { "character*17" "character" "integer" } fortran-sig>c-sig ]
     unit-test
 
-    [ c:void { c:void* c:char* c:char* c:void* c:long } ]
+    [ c:void { pointer: complex-float pointer: { c:char 17 } pointer: c:char pointer: c:int c:long } ]
     [ "complex" { "character*17" "character" "integer" } fortran-sig>c-sig ]
     unit-test
 
@@ -201,7 +202,7 @@ intel-unix-abi fortran-abi [
         ! [fortran-invoke]
         [ 
             c:void "funpack" "funtimes_"
-            { c:char* c:void* c:void* c:void* c:void* c:long }
+            { pointer: { c:char 12 } pointer: c:longlong pointer: c:float pointer: complex-float pointer: c:short c:long }
             alien-invoke
         ] 6 nkeep
         ! [fortran-results>]
@@ -226,7 +227,7 @@ intel-unix-abi fortran-abi [
             [ { [ drop ] } spread ]
         } 1 ncleave
         ! [fortran-invoke]
-        [ c:float "funpack" "fun_times_" { void* } alien-invoke ]
+        [ c:float "funpack" "fun_times_" { pointer: { c:float 0 } } alien-invoke ]
         1 nkeep
         ! [fortran-results>]
         shuffle( reta aa -- reta aa ) 
@@ -244,7 +245,7 @@ intel-unix-abi fortran-abi [
         ! [fortran-invoke]
         [
             c:void "funpack" "fun_times_"
-            { void* void* } 
+            { pointer: complex-float pointer: { c:float 0 } } 
             alien-invoke
         ] 2 nkeep
         ! [fortran-results>]
@@ -261,7 +262,7 @@ intel-unix-abi fortran-abi [
         ! [fortran-invoke]
         [
             c:void "funpack" "fun_times_"
-            { c:char* long } 
+            { pointer: { c:char 20 } long } 
             alien-invoke
         ] 2 nkeep
         ! [fortran-results>]
@@ -287,7 +288,7 @@ intel-unix-abi fortran-abi [
         ! [fortran-invoke]
         [
             c:void "funpack" "fun_times_"
-            { c:char* long c:char* c:void* c:char* c:long c:long } 
+            { pointer: { c:char 10 } long pointer: { c:char 20 } pointer: c:float pointer: { c:char 30 } c:long c:long } 
             alien-invoke
         ] 7 nkeep
         ! [fortran-results>]
@@ -321,16 +322,16 @@ f2c-abi fortran-abi [
     [ { c:char 1 } ]
     [ "character(1)" fortran-type>c-type ] unit-test
 
-    [ c:char* { c:long } ]
+    [ pointer: c:char { c:long } ]
     [ "character" fortran-arg-type>c-type ] unit-test
 
-    [ c:void { c:char* c:long } ]
+    [ c:void { pointer: c:char c:long } ]
     [ "character" fortran-ret-type>c-type ] unit-test
 
     [ c:double { } ]
     [ "real" fortran-ret-type>c-type ] unit-test
 
-    [ c:void { void* } ]
+    [ c:void { pointer: { c:float 0 } } ]
     [ "real(*)" fortran-ret-type>c-type ] unit-test
 
     [ "fun_" ] [ "FUN" fortran-name>symbol-name ] unit-test
@@ -344,7 +345,7 @@ gfortran-abi fortran-abi [
     [ c:float { } ]
     [ "real" fortran-ret-type>c-type ] unit-test
 
-    [ c:void { void* } ]
+    [ c:void { pointer: { c:float 0 } } ]
     [ "real(*)" fortran-ret-type>c-type ] unit-test
 
     [ complex-float { } ]
@@ -356,10 +357,10 @@ gfortran-abi fortran-abi [
     [ { char 1 } ]
     [ "character(1)" fortran-type>c-type ] unit-test
 
-    [ c:char* { c:long } ]
+    [ pointer: c:char { c:long } ]
     [ "character" fortran-arg-type>c-type ] unit-test
 
-    [ c:void { c:char* c:long } ]
+    [ c:void { pointer: c:char c:long } ]
     [ "character" fortran-ret-type>c-type ] unit-test
 
     [ complex-float { } ]
@@ -368,7 +369,7 @@ gfortran-abi fortran-abi [
     [ complex-double { } ]
     [ "double-complex" fortran-ret-type>c-type ] unit-test
 
-    [ c:void { c:void* } ]
+    [ c:void { pointer: { complex-double 3 } } ]
     [ "double-complex(3)" fortran-ret-type>c-type ] unit-test
 
 ] with-variable
old mode 100644 (file)
new mode 100755 (executable)
index 65e927f..3d87431
@@ -1,11 +1,12 @@
 ! (c) 2009 Joe Groff, see BSD license
-USING: accessors alien alien.c-types alien.complex alien.data alien.parser
-grouping alien.strings alien.syntax arrays ascii assocs
-byte-arrays combinators combinators.short-circuit fry generalizations
-kernel lexer macros math math.parser namespaces parser sequences
-splitting stack-checker vectors vocabs.parser words locals
-io.encodings.ascii io.encodings.string shuffle effects math.ranges
-math.order sorting strings system alien.libraries ;
+USING: accessors alien alien.c-types alien.complex alien.data
+alien.parser grouping alien.strings alien.syntax arrays ascii
+assocs byte-arrays combinators combinators.short-circuit fry
+generalizations kernel lexer macros math math.parser namespaces
+parser sequences sequences.generalizations splitting
+stack-checker vectors vocabs.parser words locals
+io.encodings.ascii io.encodings.string shuffle effects
+math.ranges math.order sorting strings system alien.libraries ;
 QUALIFIED-WITH: alien.c-types c
 IN: alien.fortran
 
@@ -13,8 +14,8 @@ SINGLETONS: f2c-abi g95-abi gfortran-abi intel-unix-abi intel-windows-abi ;
 
 << 
 : add-f2c-libraries ( -- )
-    "I77" "libI77.so" "cdecl" add-library
-    "F77" "libF77.so" "cdecl" add-library ;
+    "I77" "libI77.so" cdecl add-library
+    "F77" "libF77.so" cdecl add-library ;
 
 os netbsd? [ add-f2c-libraries ] when
 >>
@@ -42,11 +43,11 @@ library-fortran-abis [ H{ } clone ] initialize
     [ "__" append ] [ "_" append ] if ;
 
 HOOK: fortran-c-abi fortran-abi ( -- abi )
-M: f2c-abi fortran-c-abi "cdecl" ;
-M: g95-abi fortran-c-abi "cdecl" ;
-M: gfortran-abi fortran-c-abi "cdecl" ;
-M: intel-unix-abi fortran-c-abi "cdecl" ;
-M: intel-windows-abi fortran-c-abi "cdecl" ;
+M: f2c-abi fortran-c-abi cdecl ;
+M: g95-abi fortran-c-abi cdecl ;
+M: gfortran-abi fortran-c-abi cdecl ;
+M: intel-unix-abi fortran-c-abi cdecl ;
+M: intel-windows-abi fortran-c-abi cdecl ;
 
 HOOK: real-functions-return-double? fortran-abi ( -- ? )
 M: f2c-abi real-functions-return-double? t ;
@@ -114,7 +115,7 @@ MACRO: size-case-type ( cases -- )
     [ append-dimensions ] bi ;
 
 : new-fortran-type ( out? dims size class -- type )
-    new [ [ (>>size) ] [ (>>dims) ] [ (>>out?) ] tri ] keep ;
+    new [ [ size<< ] [ dims<< ] [ out?<< ] tri ] keep ;
 
 GENERIC: (fortran-type>c-type) ( type -- c-type )
 
@@ -392,13 +393,13 @@ PRIVATE>
 
 : fortran-arg-type>c-type ( fortran-type -- c-type added-args )
     parse-fortran-type
-    [ (fortran-type>c-type) resolve-pointer-type ]
+    [ (fortran-type>c-type) <pointer> ]
     [ added-c-args ] bi ;
 : fortran-ret-type>c-type ( fortran-type -- c-type added-args )
     parse-fortran-type dup returns-by-value?
     [ (fortran-ret-type>c-type) { } ] [
         c:void swap 
-        [ added-c-args ] [ (fortran-type>c-type) resolve-pointer-type ] bi prefix
+        [ added-c-args ] [ (fortran-type>c-type) <pointer> ] bi prefix
     ] if ;
 
 : fortran-arg-types>c-types ( fortran-types -- c-types )
@@ -434,15 +435,15 @@ MACRO: fortran-invoke ( return library function parameters -- )
     [ \ fortran-invoke 5 [ ] nsequence ] dip define-declared ;
 
 SYNTAX: SUBROUTINE: 
-    f "c-library" get scan ";" parse-tokens
+    f current-library get scan ";" parse-tokens
     [ "()" subseq? not ] filter define-fortran-function ;
 
 SYNTAX: FUNCTION:
-    scan "c-library" get scan ";" parse-tokens
+    scan current-library get scan ";" parse-tokens
     [ "()" subseq? not ] filter define-fortran-function ;
 
 SYNTAX: LIBRARY:
     scan
-    [ "c-library" set ]
+    [ current-library set ]
     [ set-fortran-abi ] bi ;
 
index 59142733b93df8fd76f9250a5036328f9036f7b9..8676ac8c58295629d4c52e3daedbfa8531a1d359 100644 (file)
@@ -6,7 +6,7 @@ IN: alien.libraries
 
 HELP: <library>
 { $values
-     { "path" "a pathname string" } { "abi" "the ABI used by the library, either " { $snippet "cdecl" } " or " { $snippet "stdcall" } }
+     { "path" "a pathname string" } { "abi" "the ABI used by the library, either " { $link cdecl } " or " { $link stdcall } }
      { "library" library } }
 { $description "Opens a C library using the path and ABI parameters and outputs a library tuple." }
 { $notes "User code should use " { $link add-library } " so that the opened library is added to a global hashtable, " { $link libraries } "." } ;
@@ -19,7 +19,7 @@ HELP: library
 { $description "Looks up a library by its logical name. The library object is a hashtable with the following keys:"
     { $list
         { { $snippet "name" } " - the full path of the C library binary" }
-        { { $snippet "abi" } " - the ABI used by the library, either " { $snippet "cdecl" } " or " { $snippet "stdcall" } }
+        { { $snippet "abi" } " - the ABI used by the library, either " { $link cdecl } " or " { $link stdcall } }
         { { $snippet "dll" } " - an instance of the " { $link dll } " class; only set if the library is loaded" }
     }
 } ;
@@ -43,7 +43,7 @@ HELP: load-library
 { $description "Loads a library by logical name and outputs a handle which may be passed to " { $link dlsym } " or " { $link dlclose } ". If the library is already loaded, returns the existing handle." } ;
 
 HELP: add-library
-{ $values { "name" string } { "path" string } { "abi" "one of " { $snippet "\"cdecl\"" } " or " { $snippet "\"stdcall\"" } } }
+{ $values { "name" string } { "path" string } { "abi" "one of " { $link cdecl } " or " { $link stdcall } } }
 { $description "Defines a new logical library named " { $snippet "name" } " located in the file system at " { $snippet "path" } " and the specified ABI. The logical library name can then be used by a " { $link POSTPONE: LIBRARY: } " form to specify the logical library for subsequent " { $link POSTPONE: FUNCTION: } " definitions." }
 { $notes "Because the entire source file is parsed before top-level forms are executed, " { $link add-library } " must be placed within a " { $snippet "<< ... >>" } " parse-time evaluation block."
 $nl
@@ -53,8 +53,8 @@ $nl
 { $examples "Here is a typical usage of " { $link add-library } ":"
 { $code
     "<< \"freetype\" {"
-    "    { [ os macosx? ] [ \"libfreetype.6.dylib\" \"cdecl\" add-library ] }"
-    "    { [ os windows? ] [ \"freetype6.dll\" \"cdecl\" add-library ] }"
+    "    { [ os macosx? ] [ \"libfreetype.6.dylib\" cdecl add-library ] }"
+    "    { [ os windows? ] [ \"freetype6.dll\" cdecl add-library ] }"
     "    [ drop ]"
     "} cond >>"
 }
old mode 100644 (file)
new mode 100755 (executable)
index 47e34fe..a3f52df
@@ -1,7 +1,8 @@
 ! Copyright (C) 2009, 2010 Slava Pestov, Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.strings assocs io.backend
-kernel namespaces destructors sequences system io.pathnames ;
+kernel namespaces destructors sequences strings
+system io.pathnames ;
 IN: alien.libraries
 
 : dlopen ( path -- dll ) native-string>alien (dlopen) ;
@@ -12,7 +13,7 @@ SYMBOL: libraries
 
 libraries [ H{ } clone ] initialize
 
-TUPLE: library path abi dll ;
+TUPLE: library { path string } { abi abi initial: cdecl } dll ;
 
 ERROR: no-library name ;
 
@@ -36,7 +37,12 @@ M: library dispose dll>> [ dispose ] when* ;
     [ <library> swap libraries get set-at ] 3bi ;
 
 : library-abi ( library -- abi )
-    library [ abi>> ] [ "cdecl" ] if* ;
+    library [ abi>> ] [ cdecl ] if* ;
+
+ERROR: no-such-symbol name library ;
+
+: address-of ( name library -- value )
+    2dup load-library dlsym [ 2nip ] [ no-such-symbol ] if* ;
 
 SYMBOL: deploy-libraries
 
diff --git a/basis/alien/parser/authors.txt b/basis/alien/parser/authors.txt
new file mode 100644 (file)
index 0000000..c299e0a
--- /dev/null
@@ -0,0 +1,3 @@
+Slava Pestov
+Doug Coleman
+Joe Groff
index 2fec2d9a4ce750346a763d0ae1e6cad858949a62..26a71e96235c4a79a96b9d61f77868db9deb2fde 100644 (file)
@@ -18,25 +18,26 @@ CONSTANT: eleven 11
     [ { int 5 } ] [ "int[5]" parse-c-type ] unit-test
     [ { int 5 10 11 } ] [ "int[5][10][11]" parse-c-type ] unit-test
     [ { int 5 10 eleven } ] [ "int[5][10][eleven]" parse-c-type ] unit-test
-    [ void* ] [ "int*" parse-c-type ] unit-test
-    [ void* ] [ "int**" parse-c-type ] unit-test
-    [ void* ] [ "int***" parse-c-type ] unit-test
-    [ void* ] [ "int****" parse-c-type ] unit-test
-    [ char* ] [ "char*" parse-c-type ] unit-test
-    [ void* ] [ "char**" parse-c-type ] unit-test
-    [ void* ] [ "char***" parse-c-type ] unit-test
-    [ void* ] [ "char****" parse-c-type ] unit-test
+    [ pointer: void ] [ "void*" parse-c-type ] unit-test
+    [ pointer: int ] [ "int*" parse-c-type ] unit-test
+    [ pointer: int* ] [ "int**" parse-c-type ] unit-test
+    [ pointer: int** ] [ "int***" parse-c-type ] unit-test
+    [ pointer: int*** ] [ "int****" parse-c-type ] unit-test
+    [ c-string ] [ "c-string" parse-c-type ] unit-test
     [ char2 ] [ "char2" parse-c-type ] unit-test
-    [ char* ] [ "char2*" parse-c-type ] unit-test
+    [ pointer: char2 ] [ "char2*" parse-c-type ] unit-test
 
-    [ "not-c-type" parse-c-type ] [ no-c-type? ] must-fail-with
     [ "not-word" parse-c-type ] [ error>> no-word-error? ] must-fail-with
-
 ] with-file-vocabs
 
-FUNCTION: void* alien-parser-effect-test ( int *arg1 float arg2 ) ;
+FUNCTION: void* alien-parser-function-effect-test ( int *arg1 float arg2 ) ;
+[ (( arg1 arg2 -- void* )) ] [
+    \ alien-parser-function-effect-test "declared-effect" word-prop
+] unit-test
+
+CALLBACK: void* alien-parser-callback-effect-test ( int *arg1 float arg2 ) ;
 [ (( arg1 arg2 -- void* )) ] [
-    \ alien-parser-effect-test "declared-effect" word-prop
+    \ alien-parser-callback-effect-test "callback-effect" word-prop
 ] unit-test
 
 ! Reported by mnestic
old mode 100644 (file)
new mode 100755 (executable)
index 8385bfb..332683a
@@ -1,12 +1,14 @@
-! Copyright (C) 2008, 2010 Slava Pestov, Doug Coleman.
+! Copyright (C) 2008, 2010 Slava Pestov, Doug Coleman, Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types alien.parser
-alien.libraries arrays assocs classes combinators
-combinators.short-circuit compiler.units effects grouping
-kernel parser sequences splitting words fry locals lexer
-namespaces summary math vocabs.parser ;
+USING: accessors alien alien.c-types alien.libraries arrays
+assocs classes combinators combinators.short-circuit
+compiler.units effects grouping kernel parser sequences
+splitting words fry locals lexer namespaces summary math
+vocabs.parser words.constant ;
 IN: alien.parser
 
+SYMBOL: current-library
+
 : parse-c-type-name ( name -- word )
     dup search [ ] [ no-word ] ?if ;
 
@@ -18,97 +20,156 @@ IN: alien.parser
     {
         { [ dup "void" =         ] [ drop void ] }
         { [ CHAR: ] over member? ] [ parse-array-type parse-c-type-name prefix ] }
+        { [ "*" ?tail            ] [ (parse-c-type) <pointer> ] }
         { [ dup search           ] [ parse-c-type-name ] }
-        { [ "**" ?tail           ] [ drop void* ] }
-        { [ "*" ?tail            ] [ parse-c-type-name resolve-pointer-type ] }
         [ dup search [ ] [ no-word ] ?if ]
     } cond ;
 
 : valid-c-type? ( c-type -- ? )
-    { [ array? ] [ c-type-name? ] [ void? ] } 1|| ;
+    { [ array? ] [ c-type-word? ] [ pointer? ] [ void? ] } 1|| ;
 
 : parse-c-type ( string -- type )
     (parse-c-type) dup valid-c-type? [ no-c-type ] unless ;
 
 : scan-c-type ( -- c-type )
-    scan dup "{" =
-    [ drop \ } parse-until >array ]
-    [ parse-c-type ] if ; 
+    scan {
+        { [ dup "{" = ] [ drop \ } parse-until >array ] }
+        { [ dup "pointer:" = ] [ drop scan-c-type <pointer> ] }
+        [ parse-c-type ]
+    } cond ; 
 
 : reset-c-type ( word -- )
     dup "struct-size" word-prop
     [ dup [ forget-class ] [ { "struct-size" } reset-props ] bi ] when
     {
         "c-type"
-        "pointer-c-type"
         "callback-effect"
         "callback-library"
     } reset-props ;
 
-: CREATE-C-TYPE ( -- word )
-    scan current-vocab create {
+ERROR: *-in-c-type-name name ;
+
+: validate-c-type-name ( name -- name )
+    dup "*" tail?
+    [ *-in-c-type-name ] when ;
+
+: (CREATE-C-TYPE) ( word -- word )
+    validate-c-type-name current-vocab create {
         [ fake-definition ]
         [ set-word ]
         [ reset-c-type ]
         [ ]
     } cleave ;
 
-: normalize-c-arg ( type name -- type' name' )
-    [ length ]
-    [
-        [ CHAR: * = ] trim-head
-        [ length - CHAR: * <array> append ] keep
-    ] bi
-    [ parse-c-type ] dip ;
-
-: parse-arglist ( parameters return -- types effect )
-    [
-        2 group [ first2 normalize-c-arg 2array ] map
-        unzip [ "," ?tail drop ] map
-    ]
-    [ [ { } ] [ name>> 1array ] if-void ]
-    bi* <effect> ;
+: CREATE-C-TYPE ( -- word )
+    scan (CREATE-C-TYPE) ;
+
+<PRIVATE
+GENERIC: return-type-name ( type -- name )
+
+M: object return-type-name drop "void" ;
+M: word return-type-name name>> ;
+M: pointer return-type-name to>> return-type-name CHAR: * suffix ;
+
+: parse-pointers ( type name -- type' name' )
+    "*" ?head
+    [ [ <pointer> ] dip parse-pointers ] when ;
+
+: next-enum-member ( members name value -- members value' )
+    [ 2array suffix! ] [ 1 + ] bi ;
+
+: parse-enum-name ( -- name )
+    scan (CREATE-C-TYPE) dup save-location ;
+
+: parse-enum-base-type ( -- base-type token )
+    scan dup "<" =
+    [ drop scan-object scan ]
+    [ [ int ] dip ] if ;
+
+: parse-enum-member ( members name value -- members value' )
+    over "{" =
+    [ 2drop scan create-in scan-object next-enum-member "}" expect ]
+    [ [ create-in ] dip next-enum-member ] if ;
+
+: parse-enum-members ( members counter token -- members )
+    dup ";" = not
+    [ swap parse-enum-member scan parse-enum-members ] [ 2drop ] if ;
+
+PRIVATE>
+
+: parse-enum ( -- name base-type members )
+    parse-enum-name
+    parse-enum-base-type
+    [ V{ } clone 0 ] dip parse-enum-members ;
+
+: scan-function-name ( -- return function )
+    scan-c-type scan parse-pointers ;
+
+:: (scan-c-args) ( end-marker types names -- )
+    scan :> type-str
+    type-str end-marker = [
+        type-str { "(" ")" } member? [
+            type-str parse-c-type :> type
+            scan "," ?tail drop :> name
+            type name parse-pointers :> ( type' name' )
+            type' types push name' names push
+        ] unless
+        end-marker types names (scan-c-args)
+    ] unless ;
+
+: scan-c-args ( end-marker -- types names )
+    V{ } clone V{ } clone [ (scan-c-args) ] 2keep [ >array ] bi@ ;
 
 : function-quot ( return library function types -- quot )
     '[ _ _ _ _ alien-invoke ] ;
 
-:: make-function ( return library function parameters -- word quot effect )
-    return function normalize-c-arg :> ( return function )
-    function create-in dup reset-generic
-    return library function
-    parameters return parse-arglist [ function-quot ] dip ;
+: function-effect ( names return -- effect )
+    [ { } ] [ return-type-name 1array ] if-void <effect> ;
+
+: create-function ( name -- word )
+    create-in dup reset-generic ;
 
-: parse-arg-tokens ( -- tokens )
-    ";" parse-tokens [ "()" subseq? not ] filter ;
+:: (make-function) ( return function library types names -- quot effect )
+    return library function types function-quot
+    names return function-effect ;
 
-: (FUNCTION:) ( -- word quot effect )
-    scan "c-library" get scan parse-arg-tokens make-function ;
+:: make-function ( return function library types names -- word quot effect )
+    function create-function
+    return function library types names (make-function) ;
 
-: define-function ( return library function parameters -- )
-    make-function define-declared ;
+: (FUNCTION:) ( -- return function library types names )
+    scan-function-name current-library get ";" scan-c-args ;
 
 : callback-quot ( return types abi -- quot )
     '[ [ _ _ _ ] dip alien-callback ] ;
 
-:: make-callback-type ( lib return type-name parameters -- word quot effect )
-    return type-name normalize-c-arg :> ( return type-name )
+:: make-callback-type ( lib return type-name types names -- word quot effect )
     type-name current-vocab create :> type-word 
     type-word [ reset-generic ] [ reset-c-type ] bi
     void* type-word typedef
-    parameters return parse-arglist :> ( types callback-effect )
-    type-word callback-effect "callback-effect" set-word-prop
+    type-word names return function-effect "callback-effect" set-word-prop
     type-word lib "callback-library" set-word-prop
     type-word return types lib library-abi callback-quot (( quot -- alien )) ;
 
 : (CALLBACK:) ( -- word quot effect )
-    "c-library" get
-    scan scan parse-arg-tokens make-callback-type ;
+    current-library get
+    scan-function-name ";" scan-c-args make-callback-type ;
 
-PREDICATE: alien-function-word < word
+PREDICATE: alien-function-alias-word < word
     def>> {
         [ length 5 = ]
         [ last \ alien-invoke eq? ]
     } 1&& ;
 
+PREDICATE: alien-function-word < alien-function-alias-word
+    [ def>> third ] [ name>> ] bi = ;
+
 PREDICATE: alien-callback-type-word < typedef-word
     "callback-effect" word-prop ;
+
+: global-quot ( type word -- quot )
+    swap [ name>> current-library get ] dip
+    '[ _ _ address-of 0 _ alien-value ] ;
+
+: define-global ( type word -- )
+    [ nip ] [ global-quot ] 2bi (( -- value )) define-declared ;
diff --git a/basis/alien/prettyprint/prettyprint-tests.factor b/basis/alien/prettyprint/prettyprint-tests.factor
new file mode 100644 (file)
index 0000000..3a51471
--- /dev/null
@@ -0,0 +1,55 @@
+USING: alien.c-types alien.prettyprint alien.syntax\r
+io.streams.string see tools.test prettyprint ;\r
+IN: alien.prettyprint.tests\r
+\r
+CONSTANT: FOO 10\r
+\r
+FUNCTION: int function_test ( float x, int[4][FOO] y, char* z, ushort *w ) ;\r
+\r
+[ "USING: alien.c-types alien.syntax ;\r
+IN: alien.prettyprint.tests\r
+FUNCTION: int function_test\r
+    ( float x, int[4][FOO] y, char* z, ushort* w ) ;\r
+" ] [\r
+    [ \ function_test see ] with-string-writer\r
+] unit-test\r
+\r
+FUNCTION-ALIAS: function-test int function_test\r
+    ( float x, int[4][FOO] y, char* z, ushort *w ) ;\r
+\r
+[ "USING: alien.c-types alien.syntax ;\r
+IN: alien.prettyprint.tests\r
+FUNCTION-ALIAS: function-test int function_test\r
+    ( float x, int[4][FOO] y, char* z, ushort* w ) ;\r
+" ] [\r
+    [ \ function-test see ] with-string-writer\r
+] unit-test\r
+\r
+C-TYPE: opaque-c-type\r
+\r
+[ "USING: alien.syntax ;\r
+IN: alien.prettyprint.tests\r
+C-TYPE: opaque-c-type\r
+" ] [\r
+    [ \ opaque-c-type see ] with-string-writer\r
+] unit-test\r
+\r
+TYPEDEF: pointer: int pint\r
+\r
+[ "USING: alien.c-types alien.syntax ;\r
+IN: alien.prettyprint.tests\r
+TYPEDEF: int* pint\r
+" ] [\r
+    [ \ pint see ] with-string-writer\r
+] unit-test\r
+\r
+[ "pointer: int" ] [ pointer: int unparse ] unit-test\r
+\r
+CALLBACK: void callback-test ( int x, float[4] y ) ;\r
+\r
+[ "USING: alien.c-types alien.syntax ;\r
+IN: alien.prettyprint.tests\r
+CALLBACK: void callback-test ( int x, float[4] y ) ;\r
+" ] [\r
+    [ \ callback-test see ] with-string-writer\r
+] unit-test\r
index ded8f692cdf874da97dabefe3f57d2aab4c6eb19..2cf90e938dfcf1fd55ae60d5f80d4419b18160f1 100644 (file)
@@ -1,9 +1,10 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov, Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel combinators alien alien.strings alien.c-types
-alien.parser alien.syntax arrays assocs effects math.parser
-prettyprint.backend prettyprint.custom prettyprint.sections
-definitions see see.private sequences strings words ;
+USING: accessors kernel combinators alien alien.enums
+alien.strings alien.c-types alien.parser alien.syntax arrays
+assocs effects math.parser prettyprint prettyprint.backend
+prettyprint.custom prettyprint.sections definitions see
+see.private sequences strings words ;
 IN: alien.prettyprint
 
 M: alien pprint*
@@ -19,11 +20,29 @@ M: c-type-word definer drop \ C-TYPE: f ;
 M: c-type-word definition drop f ;
 M: c-type-word declarations. drop ;
 
-GENERIC: pprint-c-type ( c-type -- )
-M: word pprint-c-type pprint-word ;
-M: wrapper pprint-c-type wrapped>> pprint-word ;
-M: string pprint-c-type text ;
-M: array pprint-c-type pprint* ;
+<PRIVATE
+GENERIC: pointer-string ( pointer -- string/f )
+M: object pointer-string drop f ;
+M: word pointer-string [ record-vocab ] [ name>> ] bi ;
+M: pointer pointer-string to>> pointer-string [ CHAR: * suffix ] [ f ] if* ;
+
+GENERIC: c-type-string ( c-type -- string )
+
+M: word c-type-string [ record-vocab ] [ name>> ] bi ;
+M: pointer c-type-string dup pointer-string [ ] [ unparse ] ?if ;
+M: wrapper c-type-string wrapped>> c-type-string ;
+M: array c-type-string
+    unclip
+    [ [ unparse "[" "]" surround ] map ]
+    [ c-type-string ] bi*
+    prefix "" join ;
+PRIVATE>
+
+: pprint-c-type ( c-type -- )
+    [ c-type-string ] keep present-text ;
+
+M: pointer pprint*
+    <flow \ pointer: pprint-word to>> pprint* block> ;
 
 M: typedef-word definer drop \ TYPEDEF: f ;
 
@@ -48,22 +67,36 @@ M: typedef-word synopsis*
 : pprint-library ( library -- )
     [ \ LIBRARY: [ text ] pprint-prefix ] when* ;
 
+: pprint-function ( word quot -- )
+    [ def>> first pprint-c-type ]
+    swap
+    [
+        <block "(" text
+        [ def>> fourth ] [ stack-effect in>> ] bi
+        pprint-function-args
+        ")" text block>
+    ] tri ; inline
+
+M: alien-function-alias-word definer
+    drop \ FUNCTION-ALIAS: \ ; ;
+M: alien-function-alias-word definition drop f ;
+M: alien-function-alias-word synopsis*
+    {
+        [ seeing-word ]
+        [ def>> second pprint-library ]
+        [ definer. ]
+        [ pprint-word ]
+        [ [ def>> third text ] pprint-function ]
+    } cleave ;
+
 M: alien-function-word definer
     drop \ FUNCTION: \ ; ;
-M: alien-function-word definition drop f ;
 M: alien-function-word synopsis*
     {
         [ seeing-word ]
         [ def>> second pprint-library ]
         [ definer. ]
-        [ def>> first pprint-c-type ]
-        [ pprint-word ]
-        [
-            <block "(" text
-            [ def>> fourth ] [ stack-effect in>> ] bi
-            pprint-function-args
-            ")" text block>
-        ]
+        [ [ pprint-word ] pprint-function ]
     } cleave ;
 
 M: alien-callback-type-word definer
@@ -74,12 +107,24 @@ M: alien-callback-type-word synopsis*
         [ seeing-word ]
         [ "callback-library" word-prop pprint-library ]
         [ definer. ]
-        [ def>> first pprint-c-type ]
+        [ def>> first first pprint-c-type ]
         [ pprint-word ]
         [
             <block "(" text 
-            [ def>> second ] [ "callback-effect" word-prop in>> ] bi
+            [ def>> first second ] [ "callback-effect" word-prop in>> ] bi
             pprint-function-args
             ")" text block>
         ]
     } cleave ;
+
+M: enum-c-type-word definer
+    drop \ ENUM: \ ; ;
+M: enum-c-type-word synopsis*
+    {
+        [ seeing-word ]
+        [ definer. ]
+        [ pprint-word ]
+        [ c-type base-type>> dup int eq? [ drop ] [ "<" text pprint-word ] if ]
+    } cleave ;
+M: enum-c-type-word definition
+    c-type members>> ;
index ae694bed9c4b8da031dc212c9e187df1d92e97ca..50902809453660cee76c5461e596544d1725390f 100644 (file)
@@ -6,14 +6,14 @@ eval ;
 IN: alien.remote-control
 
 : eval-callback ( -- callback )
-    void* { char* } "cdecl"
+    void* { c-string } cdecl
     [ eval>string utf8 malloc-string ] alien-callback ;
 
 : yield-callback ( -- callback )
-    void { } "cdecl" [ yield ] alien-callback ;
+    void { } cdecl [ yield ] alien-callback ;
 
 : sleep-callback ( -- callback )
-    void { long } "cdecl" [ sleep ] alien-callback ;
+    void { long } cdecl [ sleep ] alien-callback ;
 
 : ?callback ( word -- alien )
     dup optimized? [ execute ] [ drop f ] if ; inline
index a8d3048b82e1d780c4d808307d7ef4c7735def22..c7ff228ab27679fd5ac5e3fb1571f60692b44c1e 100644 (file)
@@ -1,6 +1,6 @@
 IN: alien.syntax
-USING: alien alien.c-types alien.parser alien.libraries
-classes.struct help.markup help.syntax see ;
+USING: alien alien.c-types alien.enums alien.libraries classes.struct
+help.markup help.syntax see ;
 
 HELP: DLL"
 { $syntax "DLL\" path\"" }
@@ -26,9 +26,9 @@ HELP: LIBRARY:
 { $notes "Logical library names are defined with the " { $link add-library } " word." } ;
 
 HELP: FUNCTION:
-{ $syntax "FUNCTION: return name ( parameters )" }
+{ $syntax "FUNCTION: return name ( parameters ) ;" }
 { $values { "return" "a C return type" } { "name" "a C function name" } { "parameters" "a comma-separated sequence of type/name pairs; " { $snippet "type1 arg1, type2 arg2, ..." } } }
-{ $description "Defines a new word " { $snippet "name" } " which calls a C library function with the same name, in the logical library given by the most recent " { $link POSTPONE: LIBRARY: } " declaration."
+{ $description "Defines a new word " { $snippet "name" } " which calls the C library function with the same " { $snippet "name" } " in the logical library given by the most recent " { $link POSTPONE: LIBRARY: } " declaration."
 $nl
 "The new word must be compiled before being executed." }
 { $examples
@@ -40,44 +40,55 @@ $nl
 }
 "You can define a word for invoking it:"
 { $unchecked-example
-    "LIBRARY: foo\nFUNCTION: void the_answer ( char* question, int value ) ;"
-    "USE: compiler"
+    "LIBRARY: foo\nFUNCTION: void the_answer ( c-string question, int value ) ;"
     "\"the question\" 42 the_answer"
     "The answer to the question is 42."
 } }
-{ $notes "Note that the parentheses and commas are only syntax sugar and can be omitted; they serve no purpose other than to make the declaration slightly easier to read:"
+"Using the " { $link c-string } " type instead of " { $snippet "char*" } " causes the FFI to automatically convert Factor strings to C strings. See " { $link "c-strings" } " for more information on using strings with the FFI."
+{ $notes "Note that the parentheses and commas are only syntax sugar and can be omitted; they serve no purpose other than to make the declaration easier to read. The following definitions are equivalent:"
 { $code
     "FUNCTION: void glHint ( GLenum target, GLenum mode ) ;"
     "FUNCTION: void glHint GLenum target GLenum mode ;"
-} } ;
+}
+"To make a Factor word with a name different from the C function, use " { $link POSTPONE: FUNCTION-ALIAS: } "." } ;
+
+HELP: FUNCTION-ALIAS:
+{ $syntax "FUNCTION-ALIAS: factor-name
+    return c_name ( parameters ) ;" }
+{ $values { "factor-name" "a Factor word name" } { "return" "a C return type" } { "name" "a C function name" } { "parameters" "a comma-separated sequence of type/name pairs; " { $snippet "type1 arg1, type2 arg2, ..." } } }
+{ $description "Defines a new word " { $snippet "factor-name" } " which calls the C library function named " { $snippet "c_name" } " in the logical library given by the most recent " { $link POSTPONE: LIBRARY: } " declaration."
+$nl
+"The new word must be compiled before being executed." }
+{ $notes "Note that the parentheses and commas are only syntax sugar and can be omitted. They serve no purpose other than to make the declaration easier to read." } ;
+
+{ POSTPONE: FUNCTION: POSTPONE: FUNCTION-ALIAS: } related-words
 
 HELP: TYPEDEF:
 { $syntax "TYPEDEF: old new" }
 { $values { "old" "a C type" } { "new" "a C type" } }
-{ $description "Aliases the C type " { $snippet "old" } " under the name " { $snippet "new" } " if ." }
+{ $description "Aliases the C type " { $snippet "old" } " under the name " { $snippet "new" } "." }
 { $notes "This word differs from " { $link typedef } " in that it runs at parse time, to ensure correct ordering of operations when loading source files. Words defined in source files are compiled before top-level forms are run, so if a source file defines C binding words and uses " { $link typedef } ", the type alias won't be available at compile time." } ;
 
-HELP: C-ENUM:
-{ $syntax "C-ENUM: words... ;" }
-{ $values { "words" "a sequence of word names" } }
-{ $description "Creates a sequence of word definitions in the current vocabulary. Each word pushes an integer according to its index in the enumeration definition. The first word pushes 0." }
-{ $notes "This word emulates a C-style " { $snippet "enum" } " in Factor. While this feature can be used for any purpose, using integer constants is discouraged unless it is for interfacing with C libraries. Factor code should use " { $link "words.symbol" } " or " { $link "singletons" } " instead." }
+HELP: ENUM:
+{ $syntax "ENUM: type words... ;" "ENUM: type < base-type words..." }
+{ $values { "type" "a name to typedef to int or f" } { "words" "a sequence of word names" } }
+{ $description "Creates a c-type that boxes and unboxes integer values to symbols. A symbol is defined for each member word. The base c-type can optionally be specified and defaults to " { $link int } ". A constructor word " { $snippet "<type>" } " is defined for converting from integers to singletons. The generic word " { $link enum>number } " converts from singletons to integers. Enum-typed values are automatically prettyprinted as their singleton words. Unrecognizing enum numbers are kept as numbers." }
 { $examples
     "Here is an example enumeration definition:"
-    { $code "C-ENUM: red green blue ;" }
-    "It is equivalent to the following series of definitions:"
-    { $code "CONSTANT: red 0" "CONSTANT: green 1" "CONSTANT: blue 2" }
+    { $code "ENUM: color_t red { green 3 } blue ;" }
+    "The following expression returns true:"
+    { $code "3 <color_t> [ green = ] [ enum>number 3 = ] bi and" }
 } ;
 
 HELP: C-TYPE:
 { $syntax "C-TYPE: type" }
 { $values { "type" "a new C type" } }
-{ $description "Defines a new, opaque C type. Since it is opaque, " { $snippet "type" } " will not be directly usable as a parameter or return type of a " { $link POSTPONE: FUNCTION: } " or as a slot of a " { $link POSTPONE: STRUCT: } ". However, it can be used as the type of a pointer (that is, as " { $snippet "type*" } ")." $nl
-{ $snippet "C-TYPE:" } " can also be used to forward-declare C types to enable circular dependencies. For example:"
+{ $description "Defines a new, opaque C type. Since it is opaque, " { $snippet "type" } " will not be directly usable as a parameter or return type of a " { $link POSTPONE: FUNCTION: } " or as a slot of a " { $link POSTPONE: STRUCT: } ". However, it can be used as the type of a " { $link pointer } "."
+{ $snippet "C-TYPE:" } " can also be used to forward declare C types, allowing circular dependencies to occur between types. For example:"
 { $code """C-TYPE: forward 
 STRUCT: backward { x forward* } ;
 STRUCT: forward { x backward* } ; """ } }
-{ $notes "Primitive C types are also displayed using " { $snippet "C-TYPE:" } " syntax when they are displayed by " { $link see } "." } ;
+{ $notes "Primitive C types are displayed using " { $snippet "C-TYPE:" } " syntax when they are " { $link see } "n." } ;
 
 HELP: CALLBACK:
 { $syntax "CALLBACK: return type ( parameters ) ;" }
@@ -108,15 +119,6 @@ HELP: typedef
 
 { POSTPONE: TYPEDEF: typedef } related-words
 
-HELP: c-struct?
-{ $values { "c-type" "a C type" } { "?" "a boolean" } }
-{ $description "Tests if a C type is a structure defined by " { $link POSTPONE: STRUCT: } "." } ;
-
-HELP: define-function
-{ $values { "return" "a C return type" } { "library" "a logical library name" } { "function" "a C function name" } { "parameters" "a sequence of C parameter types" } }
-{ $description "Defines a word named " { $snippet "function" } " in the current vocabulary (see " { $link "vocabularies" } "). The word calls " { $link alien-invoke } " with the specified parameters." }
-{ $notes "This word is used to implement the " { $link POSTPONE: FUNCTION: } " parsing word." } ;
-
 HELP: C-GLOBAL:
 { $syntax "C-GLOBAL: type name" }
 { $values { "type" "a C type" } { "name" "a C global variable name" } }
old mode 100644 (file)
new mode 100755 (executable)
index 295bcff..570ebf6
@@ -1,10 +1,10 @@
 ! Copyright (C) 2005, 2010 Slava Pestov, Alex Chapman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays alien alien.c-types
-alien.arrays alien.strings kernel math namespaces parser
-sequences words quotations math.parser splitting grouping
-effects assocs combinators lexer strings.parser alien.parser 
-fry vocabs.parser words.constant alien.libraries ;
+USING: accessors arrays alien alien.c-types alien.enums alien.arrays
+alien.strings kernel math namespaces parser sequences words
+quotations math.parser splitting grouping effects assocs
+combinators lexer strings.parser alien.parser fry vocabs.parser
+words.constant alien.libraries ;
 IN: alien.syntax
 
 SYNTAX: DLL" lexer get skip-blank parse-string dlopen suffix! ;
@@ -13,10 +13,14 @@ SYNTAX: ALIEN: 16 scan-base <alien> suffix! ;
 
 SYNTAX: BAD-ALIEN <bad-alien> suffix! ;
 
-SYNTAX: LIBRARY: scan "c-library" set ;
+SYNTAX: LIBRARY: scan current-library set ;
 
 SYNTAX: FUNCTION:
-    (FUNCTION:) define-declared ;
+    (FUNCTION:) make-function define-declared ;
+
+SYNTAX: FUNCTION-ALIAS:
+    scan create-function
+    (FUNCTION:) (make-function) define-declared ;
 
 SYNTAX: CALLBACK:
     (CALLBACK:) define-inline ;
@@ -24,26 +28,16 @@ SYNTAX: CALLBACK:
 SYNTAX: TYPEDEF:
     scan-c-type CREATE-C-TYPE dup save-location typedef ;
 
-SYNTAX: C-ENUM:
-    ";" parse-tokens
-    [ [ create-in ] dip define-constant ] each-index ;
+SYNTAX: ENUM:
+    parse-enum define-enum ;
 
 SYNTAX: C-TYPE:
     void CREATE-C-TYPE typedef ;
 
-ERROR: no-such-symbol name library ;
-
-: address-of ( name library -- value )
-    2dup load-library dlsym [ 2nip ] [ no-such-symbol ] if* ;
-
 SYNTAX: &:
-    scan "c-library" get '[ _ _ address-of ] append! ;
-
-: global-quot ( type word -- quot )
-    name>> "c-library" get '[ _ _ address-of 0 ]
-    swap c-type-getter-boxer append ;
-
-: define-global ( type word -- )
-    [ nip ] [ global-quot ] 2bi (( -- value )) define-declared ;
+    scan current-library get '[ _ _ address-of ] append! ;
 
 SYNTAX: C-GLOBAL: scan-c-type CREATE-WORD define-global ;
+
+SYNTAX: pointer:
+    scan-c-type <pointer> suffix! ;
index 1a0648cef8b92f2037438ddc2686e24617e3ade3..9a577409364b1a4d545576f4fbbfa64cbc0e9e69 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: combinators io io.binary io.encodings.binary
 io.streams.byte-array kernel math namespaces
-sequences strings io.crlf ;
+sequences strings ;
 IN: base64
 
 ERROR: malformed-base64 ;
@@ -35,7 +35,7 @@ SYMBOL: column
 : write1-lines ( ch -- )
     write1
     column get [
-        1 + [ 76 = [ crlf ] when ]
+        1 + [ 76 = [ B{ CHAR: \r CHAR: \n } write ] when ]
         [ 76 mod column set ] bi
     ] when* ;
 
index 7daa478f544f0d14a1143696d70312e746054b64..ab3157d40045ebeb1779d842c8bc79bb455d2fb1 100644 (file)
@@ -13,9 +13,9 @@ TUPLE: biassoc from to ;
 
 M: biassoc assoc-size from>> assoc-size ;
 
-M: biassoc at* from>> at* ;
+M: biassoc at* from>> at* ; inline
 
-M: biassoc value-at* to>> at* ;
+M: biassoc value-at* to>> at* ; inline
 
 : once-at ( value key assoc -- )
     2dup key? [ 3drop ] [ set-at ] if ;
index a797219a01466894624323ce5832c0965f4cec64..00d67dd7e3113548be2826a55ad44081c56fbee8 100644 (file)
@@ -9,7 +9,9 @@ IN: binary-search.tests
 [ 4 ] [ 5.5 { 1 2 3 4 5 6 7 8 } [ <=> ] with search drop ] unit-test
 [ 10 ] [ 10 20 iota [ <=> ] with search drop ] unit-test
 
-[ t ] [ "hello" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-member? ] unit-test
+[ 0 ] [ "alligator" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-index ] unit-test
 [ 3 ] [ "hey" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-index ] unit-test
+[ 5 ] [ "java" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-index ] unit-test
+[ t ] [ "hello" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-member? ] unit-test
 [ f ] [ "hello" { "alligator" "cat" "fish" "ikarus" "java" } sorted-member? ] unit-test
 [ f ] [ "zebra" { "alligator" "cat" "fish" "ikarus" "java" } sorted-member? ] unit-test
index 89a300202aacf9eab56e106452c58219143bbc63..db40408d5e9235ccf2ecda44459e8cb60c6dbd75 100644 (file)
@@ -1,41 +1,29 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences sequences.private accessors math
-math.order combinators hints arrays ;
+USING: accessors arrays combinators hints kernel locals math
+math.order sequences sequences.private ;
 IN: binary-search
 
 <PRIVATE
 
-: midpoint ( seq -- elt )
-    [ midpoint@ ] keep nth-unsafe ; inline
+:: (search) ( seq from to quot: ( elt -- <=> ) -- i elt )
+    from to + 2/ :> midpoint@
+    midpoint@ seq nth-unsafe :> midpoint
 
-: decide ( quot seq -- quot seq <=> )
-    [ midpoint swap call ] 2keep rot ; inline
-
-: finish ( quot slice -- i elt )
-    [ [ from>> ] [ midpoint@ ] bi + ] [ seq>> ] bi
-    [ drop ] [ dup ] [ ] tri* nth ; inline
-
-DEFER: (search)
-
-: keep-searching ( seq quot -- slice )
-    [ dup midpoint@ ] dip call collapse-slice slice boa (search) ; inline
-
-: (search) ( quot: ( elt -- <=> ) seq -- i elt )
-    dup length 1 <= [
-        finish
+    to from - 1 <= [
+        midpoint@ midpoint
     ] [
-        decide {
-            { +eq+ [ finish ] }
-            { +lt+ [ [ (head) ] keep-searching ] }
-            { +gt+ [ [ (tail) ] keep-searching ] }
+        midpoint quot call {
+            { +eq+ [ midpoint@ midpoint ] }
+            { +lt+ [ seq from midpoint@ quot (search) ] }
+            { +gt+ [ seq midpoint@ to quot (search) ] }
         } case
     ] if ; inline recursive
 
 PRIVATE>
 
-: search ( seq quot -- i elt )
-    over empty? [ 2drop f f ] [ swap <flat-slice> (search) ] if ;
+: search ( seq quot: ( elt -- <=> ) -- i elt )
+    over empty? [ 2drop f f ] [ [ 0 over length ] dip (search) ] if ;
     inline
 
 : natural-search ( obj seq -- i elt )
index f08db68441c9484a7f17c2f3c9752abdf42719c2..46089e3f7b97d90cfe089cfe36b6198b75e045bc 100644 (file)
@@ -1,4 +1,4 @@
-USING: sequences sequences.private arrays bit-arrays kernel
+USING: alien sequences sequences.private arrays bit-arrays kernel
 tools.test math random ;
 IN: bit-arrays.tests
 
@@ -79,4 +79,8 @@ IN: bit-arrays.tests
 
 [ 49 ] [ 49 <bit-array> dup set-bits [ ] count ] unit-test
 
+[ 1 ] [ ?{ f t f t } byte-length ] unit-test
+
+[ HEX: a ] [ ?{ f t f t } bit-array>integer ] unit-test
+
 [ HEX: 100 ] [ ?{ f f f f f f f f t } bit-array>integer ] unit-test
index 4fafc528fdcb7728633915184f4ec5e97f23cdb8..ade7d8ddac0f399c765920b7c8349625a725a6fa 100644 (file)
@@ -1,8 +1,9 @@
 ! Copyright (C) 2007, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.data accessors math alien.accessors kernel
-kernel.private sequences sequences.private byte-arrays
-parser prettyprint.custom fry ;
+USING: alien alien.data accessors io.binary math math.bitwise
+alien.accessors kernel kernel.private sequences
+sequences.private byte-arrays parser prettyprint.custom fry
+locals ;
 IN: bit-arrays
 
 TUPLE: bit-array
@@ -13,11 +14,10 @@ TUPLE: bit-array
 
 : n>byte ( m -- n ) -3 shift ; inline
 
-: byte/bit ( n alien -- byte bit )
-    over n>byte alien-unsigned-1 swap 7 bitand ; inline
+: bit/byte ( n -- bit byte ) [ 7 bitand ] [ n>byte ] bi ; inline
 
-: set-bit ( ? byte bit -- byte )
-    2^ rot [ bitor ] [ bitnot bitand ] if ; inline
+: bit-index ( n bit-array -- bit# byte# byte-array )
+    [ >fixnum bit/byte ] [ underlying>> ] bi* ; inline
 
 : bits>cells ( m -- n ) 31 + -5 shift ; inline
 
@@ -25,7 +25,7 @@ TUPLE: bit-array
 
 : (set-bits) ( bit-array n -- )
     [ [ length bits>cells ] keep ] dip swap underlying>>
-    '[ 2 shift [ _ _ ] dip set-alien-unsigned-4 ] each-integer ; inline
+    '[ [ _ _ ] dip 4 * set-alien-unsigned-4 ] each-integer ; inline
 
 : clean-up ( bit-array -- )
     ! Zero bits after the end.
@@ -47,12 +47,13 @@ PRIVATE>
 M: bit-array length length>> ; inline
 
 M: bit-array nth-unsafe
-    [ >fixnum ] [ underlying>> ] bi* byte/bit bit? ; inline
+    bit-index nth-unsafe swap bit? ; inline
+
+:: toggle-bit ( ? n x -- y )
+    x n ? [ set-bit ] [ clear-bit ] if ; inline
 
 M: bit-array set-nth-unsafe
-    [ >fixnum ] [ underlying>> ] bi*
-    [ byte/bit set-bit ] 2keep
-    swap n>byte set-alien-unsigned-1 ; inline
+    bit-index [ toggle-bit ] change-nth-unsafe ; inline
 
 GENERIC: clear-bits ( bit-array -- )
 
@@ -83,25 +84,17 @@ M: bit-array resize
     bit-array boa
     dup clean-up ; inline
 
-M: bit-array byte-length length 7 + -3 shift ; inline
+M: bit-array byte-length length bits>bytes ; inline
 
 SYNTAX: ?{ \ } [ >bit-array ] parse-literal ;
 
 : integer>bit-array ( n -- bit-array )
-    dup 0 = [
-        <bit-array>
-    ] [
-        [ log2 1 + <bit-array> 0 ] keep
-        [ dup 0 = ] [
-            [ pick underlying>> pick set-alien-unsigned-1 ] keep
-            [ 1 + ] [ -8 shift ] bi*
-        ] until 2drop
-    ] if ;
+    dup 0 =
+    [ <bit-array> ]
+    [ dup log2 1 + [ nip ] [ bits>bytes >le ] 2bi bit-array boa ] if ;
 
 : bit-array>integer ( bit-array -- n )
-    0 swap underlying>> dup length iota <reversed> [
-        alien-unsigned-1 swap 8 shift bitor
-    ] with each ;
+    underlying>> le> ;
 
 INSTANCE: bit-array sequence
 
diff --git a/basis/bit-sets/bit-sets-docs.factor b/basis/bit-sets/bit-sets-docs.factor
new file mode 100644 (file)
index 0000000..706ffb5
--- /dev/null
@@ -0,0 +1,18 @@
+USING: help.markup help.syntax sequences math ;
+IN: bit-sets
+
+ARTICLE: "bit-sets" "Bit sets"
+"The " { $vocab-link "bit-sets" } " vocabulary implements bit-array-backed sets. Bitsets are efficient for implementing relatively dense sets whose members are in a contiguous range of integers starting from 0. One bit is required for each integer in this range in the underlying representation." $nl
+"Bit sets form a class:"
+{ $subsection bit-set }
+"Constructing new bit sets:"
+{ $subsection <bit-set> } ;
+
+ABOUT: "bit-sets"
+
+HELP: bit-set
+{ $class-description "The class of bit-array-based " { $link "sets" } "." } ;
+
+HELP: <bit-set>
+{ $values { "capacity" integer } { "bit-set" bit-set } }
+{ $description "Creates a new bit set with the given capacity. This set is initially empty and can contain as members integers between 0 and " { $snippet "capacity" } "-1." } ;
index 6a1366a1ea3a9956bffd889de5c2e9662d897cff..0d4543f8f2fa3685873e6470dc70888ca291f8d3 100644 (file)
@@ -1,17 +1,66 @@
-USING: bit-sets tools.test bit-arrays ;
+USING: bit-sets tools.test sets kernel bit-arrays ;
 IN: bit-sets.tests
 
-[ ?{ t f t f t f } ] [
-    ?{ t f f f t f }
-    ?{ f f t f t f } bit-set-union
+[ T{ bit-set f ?{ t f t f t f } } ] [
+    T{ bit-set f ?{ t f f f t f } }
+    T{ bit-set f ?{ f f t f t f } } union
 ] unit-test
 
-[ ?{ f f f f t f } ] [
-    ?{ t f f f t f }
-    ?{ f f t f t f } bit-set-intersect
+[ T{ bit-set f ?{ f f f f t f } } ] [
+    T{ bit-set f ?{ t f f f t f } }
+    T{ bit-set f ?{ f f t f t f } } intersect
 ] unit-test
 
-[ ?{ t f t f f f } ] [
-    ?{ t t t f f f }
-    ?{ f t f f t t } bit-set-diff
+[ f ] [ T{ bit-set f ?{ t f f f t f } } null? ] unit-test
+[ t ] [ T{ bit-set f ?{ f f f f f f } } null? ] unit-test
+
+[ T{ bit-set f ?{ t f t f f f } } ] [
+    T{ bit-set f ?{ t t t f f f } }
+    T{ bit-set f ?{ f t f f t t } } diff
+] unit-test
+
+[ f ] [
+    T{ bit-set f ?{ t t t f f f } }
+    T{ bit-set f ?{ f t f f t t } } subset?
+] unit-test
+
+[ t ] [
+    T{ bit-set f ?{ t t t f f f } }
+    T{ bit-set f ?{ f t f f f f } } subset?
+] unit-test
+
+[ t ] [
+    { 0 1 2 }
+    T{ bit-set f ?{ f t f f f f } } subset?
+] unit-test
+
+[ f ] [
+    T{ bit-set f ?{ f t f f f f } }
+    T{ bit-set f ?{ t t t f f f } } subset?
 ] unit-test
+
+[ f ] [
+    { 1 }
+    T{ bit-set f ?{ t t t f f f } } subset?
+] unit-test
+
+[ V{ 0 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } members ] unit-test
+
+[ t V{ 1 2 3 } ] [
+    { 1 2 } 5 <bit-set> set-like
+    [ bit-set? ] keep
+    3 over adjoin
+    members
+] unit-test
+
+[ V{ 0 1 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } clone [ 1 swap adjoin ] keep members ] unit-test
+[ T{ bit-set f ?{ t f t f f t } } clone [ 9 swap adjoin ] keep members ] must-fail
+[ T{ bit-set f ?{ t f t f f t } } clone [ "foo" swap adjoin ] keep members ] must-fail
+
+[ V{ 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } clone [ 0 swap delete ] keep members ] unit-test
+[ V{ 0 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } clone [ 1 swap delete ] keep members ] unit-test
+[ V{ 0 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } clone [ 9 swap delete ] keep members ] unit-test
+[ V{ 0 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } clone [ "foo" swap delete ] keep members ] unit-test
+
+[ T{ bit-set f ?{ f } } T{ bit-set f ?{ t } } ]
+[ 1 <bit-set> dup clone 0 over adjoin ] unit-test
index 34b7f13dc24c2ae9e59dc7ae97ac44fa3eb05a2a..aa74c2b9fbda35592b56ce12d22bd8e5550a96d1 100644 (file)
@@ -1,10 +1,40 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel accessors sequences byte-arrays bit-arrays math hints ;
+USING: kernel accessors sequences byte-arrays bit-arrays math hints sets ;
 IN: bit-sets
 
+TUPLE: bit-set { table bit-array read-only } ;
+
+: <bit-set> ( capacity -- bit-set )
+    <bit-array> bit-set boa ;
+
+INSTANCE: bit-set set
+
+M: bit-set in?
+    over integer? [ table>> ?nth ] [ 2drop f ] if ; inline
+
+M: bit-set adjoin
+    ! This is allowed to crash when the elt couldn't go in the set
+    [ t ] 2dip table>> set-nth ;
+
+M: bit-set delete
+    ! This isn't allowed to crash if the elt wasn't in the set
+    over integer? [
+        table>> 2dup bounds-check? [
+            [ f ] 2dip set-nth
+        ] [ 2drop ] if
+    ] [ 2drop ] if ;
+
+! If you do binary set operations with a bitset, it's expected
+! that the other thing can also be represented as a bitset
+! of the same length.
 <PRIVATE
 
+ERROR: check-bit-set-failed ;
+
+: check-bit-set ( bit-set -- bit-set )
+    dup bit-set? [ check-bit-set-failed ] unless ; inline
+
 : bit-set-map ( seq1 seq2 quot -- seq )
     [ 2drop length>> ]
     [
@@ -14,18 +44,43 @@ IN: bit-sets
         ] dip 2map
     ] 3bi bit-array boa ; inline
 
+: (bit-set-op) ( set1 set2 -- table1 table2 )
+    [ set-like ] keep [ table>> ] bi@ ; inline
+
+: bit-set-op ( set1 set2 quot: ( a b -- c ) -- bit-set )
+    [ (bit-set-op) ] dip bit-set-map bit-set boa ; inline
+
 PRIVATE>
 
-: bit-set-union ( seq1 seq2 -- seq ) [ bitor ] bit-set-map ;
+M: bit-set union
+    [ bitor ] bit-set-op ;
 
-HINTS: bit-set-union bit-array bit-array ;
+M: bit-set intersect
+    [ bitand ] bit-set-op ;
 
-: bit-set-intersect ( seq1 seq2 -- seq ) [ bitand ] bit-set-map ;
+M: bit-set diff
+    [ bitnot bitand ] bit-set-op ;
 
-HINTS: bit-set-intersect bit-array bit-array ;
+M: bit-set subset?
+    [ intersect ] keep = ;
 
-: bit-set-diff ( seq1 seq2 -- seq ) [ bitnot bitand ] bit-set-map ;
+M: bit-set members
+    [ table>> length iota ] keep [ in? ] curry filter ;
+
+<PRIVATE
+
+: bit-set-like ( set bit-set -- bit-set' )
+    ! This crashes if there are keys that can't be put in the bit set
+    over bit-set? [ 2dup [ table>> length ] bi@ = ] [ f ] if
+    [ drop ] [
+        [ members ] dip table>> length <bit-set>
+        [ [ adjoin ] curry each ] keep
+    ] if ;
+
+PRIVATE>
 
-HINTS: bit-set-diff bit-array bit-array ;
+M: bit-set set-like
+    bit-set-like check-bit-set ; inline
 
-: bit-set-subset? ( seq1 seq2 -- ? ) dupd bit-set-intersect = ;
\ No newline at end of file
+M: bit-set clone
+    table>> clone bit-set boa ;
index c4e1ec42b2fca6943629f7495f735f5191141e03..5581e47056634e2c5fa0b13b783b13d1eebf4c03 100644 (file)
@@ -64,7 +64,7 @@ GENERIC: poke ( value n bitstream -- )
     [ byte-pos>> 8 * ] [ bit-pos>> + ] bi ; inline
     
 : set-abp ( abp bitstream -- ) 
-    [ 8 /mod ] dip [ (>>bit-pos) ] [ (>>byte-pos) ] bi ; inline
+    [ 8 /mod ] dip [ bit-pos<< ] [ byte-pos<< ] bi ; inline
 
 : seek ( n bitstream -- )
     [ get-abp + ] [ set-abp ] bi ; inline
@@ -117,11 +117,11 @@ M:: lsb0-bit-writer poke ( value n bs -- )
     byte bs widthed>> |widthed :> new-byte
     new-byte #bits>> 8 = [
         new-byte bits>> bs bytes>> push
-        zero-widthed bs (>>widthed)
+        zero-widthed bs widthed<<
         remainder widthed>bytes
-        [ bs bytes>> push-all ] [ bs (>>widthed) ] bi*
+        [ bs bytes>> push-all ] [ bs widthed<< ] bi*
     ] [
-        byte bs (>>widthed)
+        byte bs widthed<<
     ] if ;
 
 : enough-bits? ( n bs -- ? )
@@ -146,10 +146,10 @@ ERROR: not-enough-bits n bit-reader ;
     n 8 /mod :> ( #bytes #bits )
     bs [ #bytes + ] change-byte-pos
     bit-pos>> #bits + dup 8 >= [
-        8 - bs (>>bit-pos)
+        8 - bs bit-pos<<
         bs [ 1 + ] change-byte-pos drop
     ] [
-        bs (>>bit-pos)
+        bs bit-pos<<
     ] if ;
 
 :: (peek) ( n bs endian> subseq-endian -- bits )
index edb0bdf2ae13dae698386e561b3b33770a7cd6b0..9c753ce08f96da6f2b46c989ca8a1823fd5fe477 100644 (file)
@@ -20,10 +20,8 @@ IN: bootstrap.compiler
     "alien.remote-control" require
 ] unless
 
-"prettyprint" vocab [
-    "stack-checker.errors.prettyprint" require
-    "alien.prettyprint" require
-] when
+{ "boostrap.compiler" "prettyprint" } "alien.prettyprint" require-when
+{ "boostrap.compiler" "debugger" } "alien.debugger" require-when
 
 "cpu." cpu name>> append require
 
@@ -37,7 +35,7 @@ gc
     [ optimized? not ] filter compile ;
 
 "debug-compiler" get [
-    
+
     nl
     "Compiling..." write flush
 
@@ -59,7 +57,7 @@ gc
 
         curry compose uncurry
 
-        array-nth set-array-nth length>>
+        array-nth set-array-nth
 
         wrap probe
 
@@ -119,4 +117,8 @@ gc
 
     " done" print flush
 
+    "alien.syntax" require
+    "alien.complex" require
+    "io.streams.byte-array.fast" require
+
 ] unless
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 04c75c549d8852546dff1c4903a50437c1228a76..199887f2a4cc958b89cb18218620b6c8c052503f 100644 (file)
@@ -1,15 +1,15 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel make sequences tools.annotations tools.crossref ;
 QUALIFIED: compiler.cfg.builder
 QUALIFIED: compiler.cfg.linear-scan
-QUALIFIED: compiler.cfg.mr
 QUALIFIED: compiler.cfg.optimizer
-QUALIFIED: compiler.cfg.stacks.finalize
-QUALIFIED: compiler.cfg.stacks.global
+QUALIFIED: compiler.cfg.finalization
 QUALIFIED: compiler.codegen
 QUALIFIED: compiler.tree.builder
 QUALIFIED: compiler.tree.optimizer
+QUALIFIED: compiler.cfg.liveness
+QUALIFIED: compiler.cfg.liveness.ssa
 IN: bootstrap.compiler.timing
 
 : passes ( word -- seq )
@@ -19,7 +19,7 @@ IN: bootstrap.compiler.timing
 
 : low-level-passes ( -- seq ) \ compiler.cfg.optimizer:optimize-cfg passes ;
 
-: machine-passes ( -- seq ) \ compiler.cfg.mr:build-mr passes ;
+: machine-passes ( -- seq ) \ compiler.cfg.finalization:finalize-cfg passes ;
 
 : linear-scan-passes ( -- seq ) \ compiler.cfg.linear-scan:(linear-scan) passes ;
 
@@ -29,14 +29,14 @@ IN: bootstrap.compiler.timing
         \ compiler.tree.optimizer:optimize-tree ,
         high-level-passes %
         \ compiler.cfg.builder:build-cfg ,
-        \ compiler.cfg.stacks.global:compute-global-sets ,
-        \ compiler.cfg.stacks.finalize:finalize-stack-shuffling ,
         \ compiler.cfg.optimizer:optimize-cfg ,
         low-level-passes %
-        \ compiler.cfg.mr:build-mr ,
+        \ compiler.cfg.finalization:finalize-cfg ,
         machine-passes %
         linear-scan-passes %
         \ compiler.codegen:generate ,
+        \ compiler.cfg.liveness:compute-live-sets ,
+        \ compiler.cfg.liveness.ssa:compute-ssa-live-sets ,
     ] { } make ;
 
 all-passes [ [ reset ] [ add-timing ] bi ] each
\ No newline at end of file
index 51aa9eefafb7b560c99f8931d4b913624472938e..f680c0e328233b8a63bb3082113df289dc689dc7 100644 (file)
@@ -1,4 +1,4 @@
 USING: vocabs.loader vocabs kernel ;\r
 IN: bootstrap.handbook\r
 \r
-"bootstrap.help" vocab [ "help.handbook" require ] when\r
+{ "bootstrap.handbook" "bootstrap.help" } "help.handbook" require-when\r
index 553b91a6aee084ce85489bf540bcf75646a693eb..f77829ae860ec5cdcdf2a965d43118e8288761af 100644 (file)
@@ -6,12 +6,10 @@ IN: bootstrap.help
 : load-help ( -- )
     "help.lint" require
     "help.vocabs" require
-    "alien.syntax" require
-    "compiler" require
 
     t load-help? set-global
 
-    [ vocab ] load-vocab-hook [
+    [ dup vocab [ ] [ no-vocab ] ?if ] load-vocab-hook [
         dictionary get values
         [ docs-loaded?>> not ] filter
         [ load-docs ] each
index e2de6219844e439ea8488777a7e77ea80fa04e64..3a1abb3b2d0a300b5e3d67f7b247d2882c6cb5e4 100644 (file)
@@ -18,20 +18,19 @@ CONSTANT: url URL" http://factorcode.org/images/latest/"
         bi = not
     ] [ drop t ] if ;
 
-: download-image ( arch -- )
-    url swap boot-image-name >url derive-url download ;
-
-: maybe-download-image ( arch -- )
-    dup boot-image-name need-new-image? [
-         dup download-image
-         need-new-image? [
-             "Boot image corrupt, or checksums.txt on server out of date" throw
-         ] when
-    ] [
-        "Boot image up to date" print
-        drop
-    ] if ;
-
-: download-my-image ( -- ) my-arch maybe-download-image ;
+: verify-image ( image -- )
+    need-new-image? [ "Boot image corrupt" throw ] when ;
+
+: download-image ( image -- )
+    [ url swap >url derive-url download ]
+    [ verify-image ]
+    bi ;
+
+: maybe-download-image ( image -- ? )
+    dup need-new-image?
+    [ download-image t ] [ drop f ] if ;
+
+: download-my-image ( -- )
+    my-arch boot-image-name maybe-download-image drop ;
 
 MAIN: download-my-image
index 3552f0bd92ca44c5bff578ca35d01d031a039f38..68fbf55105c3530ec648cf3b275c893ce255cdb2 100644 (file)
@@ -3,11 +3,11 @@
 USING: alien alien.strings arrays byte-arrays generic hashtables
 hashtables.private io io.binary io.files io.encodings.binary
 io.pathnames kernel kernel.private math namespaces make parser
-prettyprint sequences strings sbufs vectors words quotations
-assocs system layouts splitting grouping growable classes
-classes.private classes.builtin classes.tuple
-classes.tuple.private vocabs vocabs.loader source-files
-definitions debugger quotations.private combinators
+prettyprint sequences sequences.generalizations strings sbufs
+vectors words quotations assocs system layouts splitting
+grouping growable classes classes.private classes.builtin
+classes.tuple classes.tuple.private vocabs vocabs.loader
+source-files definitions debugger quotations.private combinators
 combinators.short-circuit math.order math.private accessors
 slots.private generic.single.private compiler.units
 compiler.constants fry locals bootstrap.image.syntax
@@ -15,10 +15,11 @@ generalizations ;
 IN: bootstrap.image
 
 : arch ( os cpu -- arch )
+    [ dup "winnt" = "winnt" "unix" ? ] dip
     {
-        { "ppc" [ "-ppc" append ] }
-        { "x86.64" [ "winnt" = "winnt" "unix" ? "-x86.64" append ] }
-        [ nip ]
+        { "ppc" [ drop "-ppc" append ] }
+        { "x86.32" [ nip "-x86.32" append ] }
+        { "x86.64" [ nip "-x86.64" append ] }
     } case ;
 
 : my-arch ( -- arch )
@@ -32,7 +33,7 @@ IN: bootstrap.image
 
 : images ( -- seq )
     {
-        "x86.32"
+        "winnt-x86.32" "unix-x86.32"
         "winnt-x86.64" "unix-x86.64"
         "linux-ppc" "macosx-ppc"
     } ;
@@ -129,8 +130,8 @@ SYMBOL: jit-literals
 : jit-vm ( offset rc -- )
     [ jit-parameter ] dip rt-vm jit-rel ;
 
-: jit-dlsym ( name library rc -- )
-    rt-dlsym jit-rel [ string>symbol jit-parameter ] bi@ ;
+: jit-dlsym ( name rc -- )
+    rt-dlsym jit-rel string>symbol jit-parameter f jit-parameter ;
 
 :: jit-conditional ( test-quot false-quot -- )
     [ 0 test-quot call ] B{ } make length :> len
index 98b6a472edc0e0ad49b44076e790379c67d11a7c..da4fbc444b8f0cad187d96b22d3de51a9a42f32c 100644 (file)
@@ -51,9 +51,11 @@ SYMBOL: bootstrap-time
 
 : save/restore-error ( quot -- )
     error get-global
+    original-error get-global
     error-continuation get-global
-    [ call ] 2dip
+    [ call ] 3dip
     error-continuation set-global
+    original-error set-global
     error set-global ; inline
 
 
@@ -89,6 +91,7 @@ SYMBOL: bootstrap-time
     run-bootstrap-init
 
     f error set-global
+    f original-error set-global
     f error-continuation set-global
 
     nano-count swap - bootstrap-time set-global
index 24cbba6af815eab92c0c103940c7677d56884979..2bc8d612b699fb916bdf986819ab7f99bc61b802 100644 (file)
@@ -1,11 +1,9 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: vocabs vocabs.loader kernel io.thread threads
+USING: vocabs.loader kernel io.thread threads
 compiler.utilities namespaces ;
 IN: bootstrap.threads
 
-"debugger" vocab [
-    "debugger.threads" require
-] when
+{ "bootstrap.threads" "debugger" } "debugger.threads" require-when
 
-[ yield ] yield-hook set-global
\ No newline at end of file
+[ yield ] yield-hook set-global
index 51f44025c9c7fe42d0826d7d6fcec1a06d5ec043..c76d4f78981347deacae44a481f4a4ae89d5541b 100644 (file)
@@ -1,4 +1,4 @@
-USING: vocabs.loader sequences ;
+USING: vocabs.loader sequences system combinators ;
 IN: bootstrap.tools
 
 {
@@ -23,3 +23,8 @@ IN: bootstrap.tools
     "vocabs.refresh"
     "vocabs.refresh.monitor"
 } [ require ] each
+
+{
+    { [ os windows? ] [ "debugger.windows" require ] }
+    { [ os unix? ] [ "debugger.unix" require ] }
+} cond
index 5cf05aef91a539723bb8292f7ec1a039066d76de..3efd15698301969c7343453d93bf4a5983c599ce 100644 (file)
@@ -4,9 +4,7 @@ USING: kernel vocabs vocabs.loader sequences system ;
 [ "bootstrap." prepend vocab ] all? [
     "ui.tools" require
 
-    "ui.backend.cocoa" vocab [
-        "ui.backend.cocoa.tools" require
-    ] when
+    { "ui.backend.cocoa" } "ui.backend.cocoa.tools" require-when
 
     "ui.tools.walker" require
 ] when
index 39f8eb44cc354c3a68e19396a0dd69943e21d963..15c22bea88a4a64cc874cc05f9cc045ba23fe986 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Slava Pestov.\r
+! Copyright (C) 2008, 2010 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: kernel accessors ;\r
 IN: boxes\r
@@ -11,16 +11,18 @@ ERROR: box-full box ;
 \r
 : >box ( value box -- )\r
     dup occupied>>\r
-    [ box-full ] [ t >>occupied (>>value) ] if ;\r
+    [ box-full ] [ t >>occupied value<< ] if ; inline\r
 \r
 ERROR: box-empty box ;\r
 \r
+: check-box ( box -- box )\r
+    dup occupied>> [ box-empty ] unless ; inline\r
+\r
 : box> ( box -- value )\r
-    dup occupied>>\r
-    [ [ f ] change-value f >>occupied drop ] [ box-empty ] if ;\r
+    check-box [ f ] change-value f >>occupied drop ; inline\r
 \r
 : ?box ( box -- value/f ? )\r
-    dup occupied>> [ box> t ] [ drop f f ] if ;\r
+    dup occupied>> [ box> t ] [ drop f f ] if ; inline\r
 \r
 : if-box? ( box quot -- )\r
     [ ?box ] dip [ drop ] if ; inline\r
index 947869e357149a7f9aa1b31a49aab918dc9f0257..026fa621f8c7797cd3dfbc19dd471e1debde2c48 100644 (file)
@@ -1,6 +1,8 @@
 ! Copyright (c) 2007 Sampo Vuori
 ! Copyright (c) 2008 Matthew Willis
 !
+
+
 ! Adapted from cairo.h, version 1.5.14
 ! License: http://factorcode.org/license.txt
 
@@ -10,15 +12,15 @@ alien.libraries classes.struct ;
 
 IN: cairo.ffi
 << {
-    { [ os winnt? ] [ "cairo" "libcairo-2.dll" "cdecl" add-library ] }
-    { [ os macosx? ] [ "cairo" "/opt/local/lib/libcairo.dylib" "cdecl" add-library ] }
+    { [ os winnt? ] [ "cairo" "libcairo-2.dll" cdecl add-library ] }
+    { [ os macosx? ] [ "cairo" "/opt/local/lib/libcairo.dylib" cdecl add-library ] }
     { [ os unix? ] [ ] }
 } cond >>
 
 LIBRARY: cairo
 
 FUNCTION: int cairo_version ( ) ;
-FUNCTION: char* cairo_version_string ( ) ;
+FUNCTION: c-string cairo_version_string ( ) ;
 
 TYPEDEF: int cairo_bool_t
 
@@ -38,14 +40,13 @@ TYPEDEF: void* cairo_pattern_t
 
 TYPEDEF: void* cairo_destroy_func_t
 : cairo-destroy-func ( quot -- callback )
-    [ void { void* } "cdecl" ] dip alien-callback ; inline
+    [ void { pointer: void } cdecl ] dip alien-callback ; inline
 
 ! See cairo.h for details
 STRUCT: cairo_user_data_key_t
     { unused int } ;
 
-TYPEDEF: int cairo_status_t
-C-ENUM:
+ENUM: cairo_status_t
     CAIRO_STATUS_SUCCESS
     CAIRO_STATUS_NO_MEMORY
     CAIRO_STATUS_INVALID_RESTORE
@@ -79,11 +80,11 @@ CONSTANT: CAIRO_CONTENT_COLOR_ALPHA HEX: 3000
 
 TYPEDEF: void* cairo_write_func_t
 : cairo-write-func ( quot -- callback )
-    [ cairo_status_t { void* uchar* int } "cdecl" ] dip alien-callback ; inline
+    [ cairo_status_t { pointer: void c-string int } cdecl ] dip alien-callback ; inline
                           
 TYPEDEF: void* cairo_read_func_t
 : cairo-read-func ( quot -- callback )
-    [ cairo_status_t { void* uchar* int } "cdecl" ] dip alien-callback ; inline
+    [ cairo_status_t { pointer: void c-string int } cdecl ] dip alien-callback ; inline
 
 ! Functions for manipulating state objects
 FUNCTION: cairo_t*
@@ -125,8 +126,7 @@ FUNCTION: void
 cairo_pop_group_to_source ( cairo_t* cr ) ;
 
 ! Modify state
-TYPEDEF: int cairo_operator_t
-C-ENUM:
+ENUM: cairo_operator_t
     CAIRO_OPERATOR_CLEAR
 
     CAIRO_OPERATOR_SOURCE
@@ -163,8 +163,7 @@ cairo_set_source_surface ( cairo_t* cr, cairo_surface_t* surface, double x, doub
 FUNCTION: void
 cairo_set_tolerance ( cairo_t* cr, double tolerance ) ;
 
-TYPEDEF: int cairo_antialias_t
-C-ENUM:
+ENUM: cairo_antialias_t
     CAIRO_ANTIALIAS_DEFAULT
     CAIRO_ANTIALIAS_NONE
     CAIRO_ANTIALIAS_GRAY
@@ -173,8 +172,7 @@ C-ENUM:
 FUNCTION: void
 cairo_set_antialias ( cairo_t* cr, cairo_antialias_t antialias ) ;
 
-TYPEDEF: int cairo_fill_rule_t
-C-ENUM:
+ENUM: cairo_fill_rule_t
     CAIRO_FILL_RULE_WINDING
     CAIRO_FILL_RULE_EVEN_ODD ;
 
@@ -184,8 +182,7 @@ cairo_set_fill_rule ( cairo_t* cr, cairo_fill_rule_t fill_rule ) ;
 FUNCTION: void
 cairo_set_line_width ( cairo_t* cr, double width ) ;
 
-TYPEDEF: int cairo_line_cap_t
-C-ENUM:
+ENUM: cairo_line_cap_t
     CAIRO_LINE_CAP_BUTT
     CAIRO_LINE_CAP_ROUND
     CAIRO_LINE_CAP_SQUARE ;
@@ -193,8 +190,7 @@ C-ENUM:
 FUNCTION: void
 cairo_set_line_cap ( cairo_t* cr, cairo_line_cap_t line_cap ) ;
 
-TYPEDEF: int cairo_line_join_t
-C-ENUM:
+ENUM: cairo_line_join_t
     CAIRO_LINE_JOIN_MITER
     CAIRO_LINE_JOIN_ROUND
     CAIRO_LINE_JOIN_BEVEL ;
@@ -379,35 +375,30 @@ STRUCT: cairo_font_extents_t
     { max_x_advance double }
     { max_y_advance double } ;
 
-TYPEDEF: int cairo_font_slant_t
-C-ENUM:
+ENUM: cairo_font_slant_t
     CAIRO_FONT_SLANT_NORMAL
     CAIRO_FONT_SLANT_ITALIC
     CAIRO_FONT_SLANT_OBLIQUE ;
 
-TYPEDEF: int cairo_font_weight_t
-C-ENUM:
+ENUM: cairo_font_weight_t
     CAIRO_FONT_WEIGHT_NORMAL
     CAIRO_FONT_WEIGHT_BOLD ;
 
-TYPEDEF: int cairo_subpixel_order_t
-C-ENUM:
+ENUM: cairo_subpixel_order_t
     CAIRO_SUBPIXEL_ORDER_DEFAULT
     CAIRO_SUBPIXEL_ORDER_RGB
     CAIRO_SUBPIXEL_ORDER_BGR
     CAIRO_SUBPIXEL_ORDER_VRGB
     CAIRO_SUBPIXEL_ORDER_VBGR ;
 
-TYPEDEF: int cairo_hint_style_t
-C-ENUM:
+ENUM: cairo_hint_style_t
     CAIRO_HINT_STYLE_DEFAULT
     CAIRO_HINT_STYLE_NONE
     CAIRO_HINT_STYLE_SLIGHT
     CAIRO_HINT_STYLE_MEDIUM
     CAIRO_HINT_STYLE_FULL ;
 
-TYPEDEF: int cairo_hint_metrics_t
-C-ENUM:
+ENUM: cairo_hint_metrics_t
     CAIRO_HINT_METRICS_DEFAULT
     CAIRO_HINT_METRICS_OFF
     CAIRO_HINT_METRICS_ON ;
@@ -463,7 +454,7 @@ cairo_font_options_get_hint_metrics ( cairo_font_options_t* options ) ;
 !  font object inside the the cairo_t.
 
 FUNCTION: void
-cairo_select_font_face ( cairo_t* cr, char* family, cairo_font_slant_t slant, cairo_font_weight_t weight ) ;
+cairo_select_font_face ( cairo_t* cr, c-string family, cairo_font_slant_t slant, cairo_font_weight_t weight ) ;
 
 FUNCTION: void
 cairo_set_font_size ( cairo_t* cr, double size ) ;
@@ -493,19 +484,19 @@ FUNCTION: cairo_scaled_font_t*
 cairo_get_scaled_font ( cairo_t* cr ) ;
 
 FUNCTION: void
-cairo_show_text ( cairo_t* cr, char* utf8 ) ;
+cairo_show_text ( cairo_t* cr, c-string utf8 ) ;
 
 FUNCTION: void
 cairo_show_glyphs ( cairo_t* cr, cairo_glyph_t* glyphs, int num_glyphs ) ;
 
 FUNCTION: void
-cairo_text_path  ( cairo_t* cr, char* utf8 ) ;
+cairo_text_path  ( cairo_t* cr, c-string utf8 ) ;
 
 FUNCTION: void
 cairo_glyph_path ( cairo_t* cr, cairo_glyph_t* glyphs, int num_glyphs ) ;
 
 FUNCTION: void
-cairo_text_extents ( cairo_t* cr, char* utf8, cairo_text_extents_t* extents ) ;
+cairo_text_extents ( cairo_t* cr, c-string utf8, cairo_text_extents_t* extents ) ;
 
 FUNCTION: void
 cairo_glyph_extents ( cairo_t* cr, cairo_glyph_t* glyphs, int num_glyphs, cairo_text_extents_t* extents ) ;
@@ -527,8 +518,7 @@ cairo_font_face_get_reference_count ( cairo_font_face_t* font_face ) ;
 FUNCTION: cairo_status_t
 cairo_font_face_status ( cairo_font_face_t* font_face ) ;
 
-TYPEDEF: int cairo_font_type_t
-C-ENUM:
+ENUM: cairo_font_type_t
     CAIRO_FONT_TYPE_TOY
     CAIRO_FONT_TYPE_FT
     CAIRO_FONT_TYPE_WIN32
@@ -573,7 +563,7 @@ FUNCTION: void
 cairo_scaled_font_extents ( cairo_scaled_font_t* scaled_font, cairo_font_extents_t* extents ) ;
 
 FUNCTION: void
-cairo_scaled_font_text_extents ( cairo_scaled_font_t* scaled_font, char* utf8, cairo_text_extents_t* extents ) ;
+cairo_scaled_font_text_extents ( cairo_scaled_font_t* scaled_font, c-string utf8, cairo_text_extents_t* extents ) ;
 
 FUNCTION: void
 cairo_scaled_font_glyph_extents ( cairo_scaled_font_t* scaled_font, cairo_glyph_t* glyphs, int num_glyphs, cairo_text_extents_t* extents ) ;
@@ -640,8 +630,7 @@ cairo_get_target ( cairo_t* cr ) ;
 FUNCTION: cairo_surface_t*
 cairo_get_group_target ( cairo_t* cr ) ;
 
-TYPEDEF: int cairo_path_data_type_t
-C-ENUM:
+ENUM: cairo_path_data_type_t
     CAIRO_PATH_MOVE_TO
     CAIRO_PATH_LINE_TO
     CAIRO_PATH_CURVE_TO
@@ -682,7 +671,7 @@ cairo_path_destroy ( cairo_path_t* path ) ;
 FUNCTION: cairo_status_t
 cairo_status ( cairo_t* cr ) ;
 
-FUNCTION: char* 
+FUNCTION: c-string 
 cairo_status_to_string ( cairo_status_t status ) ;
 
 ! Surface manipulation
@@ -707,8 +696,7 @@ cairo_surface_get_reference_count ( cairo_surface_t* surface ) ;
 FUNCTION: cairo_status_t
 cairo_surface_status ( cairo_surface_t* surface ) ;
 
-TYPEDEF: int cairo_surface_type_t
-C-ENUM:
+ENUM: cairo_surface_type_t
     CAIRO_SURFACE_TYPE_IMAGE
     CAIRO_SURFACE_TYPE_PDF
     CAIRO_SURFACE_TYPE_PS
@@ -731,7 +719,7 @@ FUNCTION: cairo_content_t
 cairo_surface_get_content ( cairo_surface_t* surface ) ;
 
 FUNCTION: cairo_status_t
-cairo_surface_write_to_png ( cairo_surface_t* surface, char* filename ) ;
+cairo_surface_write_to_png ( cairo_surface_t* surface, c-string filename ) ;
 
 FUNCTION: cairo_status_t
 cairo_surface_write_to_png_stream ( cairo_surface_t* surface, cairo_write_func_t write_func, void* closure ) ;
@@ -771,8 +759,7 @@ cairo_surface_show_page ( cairo_surface_t* surface ) ;
 
 ! Image-surface functions
 
-TYPEDEF: int cairo_format_t
-C-ENUM:
+ENUM: cairo_format_t
     CAIRO_FORMAT_ARGB32
     CAIRO_FORMAT_RGB24
     CAIRO_FORMAT_A8
@@ -786,7 +773,7 @@ FUNCTION: int
 cairo_format_stride_for_width ( cairo_format_t format, int width ) ;
 
 FUNCTION: cairo_surface_t*
-cairo_image_surface_create_for_data ( uchar* data, cairo_format_t format, int width, int height, int stride ) ;
+cairo_image_surface_create_for_data ( char* data, cairo_format_t format, int width, int height, int stride ) ;
 
 FUNCTION: uchar*
 cairo_image_surface_get_data ( cairo_surface_t* surface ) ;
@@ -804,7 +791,7 @@ FUNCTION: int
 cairo_image_surface_get_stride ( cairo_surface_t* surface ) ;
 
 FUNCTION: cairo_surface_t*
-cairo_image_surface_create_from_png ( char* filename ) ;
+cairo_image_surface_create_from_png ( c-string filename ) ;
 
 FUNCTION: cairo_surface_t*
 cairo_image_surface_create_from_png_stream ( cairo_read_func_t read_func, void* closure ) ;
@@ -844,8 +831,7 @@ cairo_pattern_get_user_data ( cairo_pattern_t* pattern, cairo_user_data_key_t* k
 FUNCTION: cairo_status_t
 cairo_pattern_set_user_data ( cairo_pattern_t* pattern, cairo_user_data_key_t* key, void* user_data, cairo_destroy_func_t destroy ) ;
 
-TYPEDEF: int cairo_pattern_type_t
-C-ENUM:
+ENUM: cairo_pattern_type_t
     CAIRO_PATTERN_TYPE_SOLID
     CAIRO_PATTERN_TYPE_SURFACE
     CAIRO_PATTERN_TYPE_LINEAR
@@ -866,8 +852,7 @@ cairo_pattern_set_matrix ( cairo_pattern_t* pattern, cairo_matrix_t* matrix ) ;
 FUNCTION: void
 cairo_pattern_get_matrix ( cairo_pattern_t* pattern, cairo_matrix_t* matrix ) ;
 
-TYPEDEF: int cairo_extend_t
-C-ENUM:
+ENUM: cairo_extend_t
     CAIRO_EXTEND_NONE
     CAIRO_EXTEND_REPEAT
     CAIRO_EXTEND_REFLECT
@@ -879,8 +864,7 @@ cairo_pattern_set_extend ( cairo_pattern_t* pattern, cairo_extend_t extend ) ;
 FUNCTION: cairo_extend_t
 cairo_pattern_get_extend ( cairo_pattern_t* pattern ) ;
 
-TYPEDEF: int cairo_filter_t
-C-ENUM:
+ENUM: cairo_filter_t
     CAIRO_FILTER_FAST
     CAIRO_FILTER_GOOD
     CAIRO_FILTER_BEST
index 6ce8b1d5fde4fd86b2744750b37b13ea98ceeb10..e76aace4647a74d5b18fa9f44ade55449c059f6f 100644 (file)
@@ -8,7 +8,7 @@ HELP: duration
 { $description "A duration is a period of time years, months, days, hours, minutes, and seconds.  All duration slots can store " { $link real } " numbers. Compare two durations with the " { $link <=> } " word." } ;
 
 HELP: timestamp
-{ $description "A timestamp is a date and a time with a timezone offset.  Timestamp slots must store integers except for " { $snippet "seconds" } ", which stores reals, and " { $snippet "gmt-offset" } ", which stores a " { $link duration } ". Compare two duarionts with the " { $link <=> } " word." } ;
+{ $description "A timestamp is a date and a time with a timezone offset.  Timestamp slots must store integers except for " { $snippet "seconds" } ", which stores reals, and " { $snippet "gmt-offset" } ", which stores a " { $link duration } ". Compare two durations with the " { $link <=> } " word." } ;
 
 { timestamp duration } related-words
 
@@ -76,27 +76,27 @@ HELP: day-abbreviation3
 } related-words
 
 HELP: average-month
-{ $values { "ratio" ratio } }
+{ $values { "value" ratio } }
 { $description "The length of an average month averaged over 400 years. Used internally for adding an arbitrary real number of months to a timestamp." } ;
 
 HELP: months-per-year
-{ $values { "integer" integer } }
+{ $values { "value" integer } }
 { $description "Returns the number of months in a year." } ;
 
 HELP: days-per-year
-{ $values { "ratio" ratio } }
+{ $values { "value" ratio } }
 { $description "Returns the number of days in a year averaged over 400 years. Used internally for adding an arbitrary real number of days to a timestamp." } ;
 
 HELP: hours-per-year
-{ $values { "ratio" ratio } }
+{ $values { "value" ratio } }
 { $description "Returns the number of hours in a year averaged over 400 years. Used internally for adding an arbitrary real number of hours to a timestamp." } ;
 
 HELP: minutes-per-year
-{ $values { "ratio" ratio } }
+{ $values { "value" ratio } }
 { $description "Returns the number of minutes in a year averaged over 400 years. Used internally for adding an arbitrary real number of minutes to a timestamp." } ;
 
 HELP: seconds-per-year
-{ $values { "integer" integer } }
+{ $values { "value" integer } }
 { $description "Returns the number of seconds in a year averaged over 400 years. Used internally for adding an arbitrary real number of seconds to a timestamp." } ;
 
 HELP: julian-day-number
index 2490b87c374b0876dc6bf991d2b7ec232f305a31..3f52b4d2e7f2da50688a450580d9112070201647 100644 (file)
@@ -176,3 +176,13 @@ IN: calendar.tests
 [ t ] [ 1356998399 unix-time>timestamp 2013 <year-gmt> 1 seconds time- = ] unit-test
 
 [ t ] [ 1500000000 random [ unix-time>timestamp timestamp>unix-time ] keep = ] unit-test
+
+[ t ] [
+    2009 1 29 <date> 1 months time+
+    2009 3 1 <date> =
+] unit-test
+
+[ t ] [
+    2008 1 29 <date> 1 months time+
+    2008 2 29 <date> =
+] unit-test
index 1a64ceb646a5c3dffa0e5b7740819d4167966536..8758b8198b2df520b80631b02bec4a7205169a3e 100644 (file)
@@ -99,12 +99,12 @@ CONSTANT: day-abbreviations3
 : day-abbreviation3 ( n -- string )
     day-abbreviations3 nth ; inline
 
-: average-month ( -- ratio ) 30+5/12 ; inline
-: months-per-year ( -- integer ) 12 ; inline
-: days-per-year ( -- ratio ) 3652425/10000 ; inline
-: hours-per-year ( -- ratio ) 876582/100 ; inline
-: minutes-per-year ( -- ratio ) 5259492/10 ; inline
-: seconds-per-year ( -- integer ) 31556952 ; inline
+CONSTANT: average-month 30+5/12
+CONSTANT: months-per-year 12
+CONSTANT: days-per-year 3652425/10000
+CONSTANT: hours-per-year 876582/100
+CONSTANT: minutes-per-year 5259492/10
+CONSTANT: seconds-per-year 31556952
 
 :: julian-day-number ( year month day -- n )
     #! Returns a composite date number
@@ -170,18 +170,6 @@ M: timestamp easter ( timestamp -- timestamp )
 : microseconds ( x -- duration ) 1000000 / seconds ;
 : nanoseconds ( x -- duration ) 1000000000 / seconds ;
 
-GENERIC: year ( obj -- n )
-M: integer year ;
-M: timestamp year year>> ;
-
-GENERIC: month ( obj -- n )
-M: integer month ;
-M: timestamp month month>> ;
-
-GENERIC: day ( obj -- n )
-M: integer day ;
-M: timestamp day day>> ;
-
 GENERIC: leap-year? ( obj -- ? )
 
 M: integer leap-year? ( year -- ? )
@@ -212,7 +200,7 @@ GENERIC: +second ( timestamp x -- timestamp )
     [ 3 >>month 1 >>day ] when ;
 
 M: integer +year ( timestamp n -- timestamp )
-    [ [ + ] curry change-year adjust-leap-year ] unless-zero ;
+    [ + ] curry change-year adjust-leap-year ;
 
 M: real +year ( timestamp n -- timestamp )
     [ float>whole-part swapd days-per-year * +day swap +year ] unless-zero ;
index 96d76d0ce86430c5e7b9badbd0502b7393f8aba8..35e364e6aafe1a746469728bddf160c2a5c25c20 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2008, 2010 Slava Pestov, Doug Coleman.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
-USING: math math.order math.parser math.functions kernel\r
-sequences io accessors arrays io.streams.string splitting\r
-combinators calendar calendar.format.macros present ;\r
+USING: accessors arrays calendar calendar.format.macros\r
+combinators io io.streams.string kernel math math.functions\r
+math.order math.parser present sequences typed ;\r
 IN: calendar.format\r
 \r
 : pad-00 ( n -- str ) number>string 2 CHAR: 0 pad-head ;\r
@@ -272,16 +272,16 @@ ERROR: invalid-timestamp-format ;
 : (timestamp>ymd) ( timestamp -- )\r
     { YYYY "-" MM "-" DD } formatted ;\r
 \r
-: timestamp>ymd ( timestamp -- str )\r
+TYPED: timestamp>ymd ( timestamp: timestamp -- str )\r
     [ (timestamp>ymd) ] with-string-writer ;\r
 \r
 : (timestamp>hms) ( timestamp -- )\r
     { hh ":" mm ":" ss } formatted ;\r
 \r
-: timestamp>hms ( timestamp -- str )\r
+TYPED: timestamp>hms ( timestamp: timestamp -- str )\r
     [ (timestamp>hms) ] with-string-writer ;\r
 \r
-: timestamp>ymdhms ( timestamp -- str )\r
+TYPED: timestamp>ymdhms ( timestamp: timestamp -- str )\r
     [\r
         >gmt\r
         { (timestamp>ymd) " " (timestamp>hms) } formatted\r
index 38ad986952c224800a29ca4e4b58ca1c4a94fb9e..305c31c385e2d4f90db3ff47b13ebed027aece6e 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Slava Pestov\r
+! Copyright (C) 2008, 2010 Slava Pestov\r
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: calendar namespaces models threads kernel init ;\r
 IN: calendar.model\r
@@ -15,5 +15,7 @@ SYMBOL: time
         (time-thread)\r
     ] "Time model update" spawn drop ;\r
 \r
-f <model> time set-global\r
-[ time-thread ] "calendar.model" add-startup-hook\r
+[\r
+    f <model> time set-global\r
+    time-thread\r
+] "calendar.model" add-startup-hook\r
index ac72385d8c75a33d8ce55270a7cfcaf4b17eaa40..fdc85c943a422041d50848861ebec70fee6a6006 100644 (file)
@@ -21,7 +21,7 @@ IN: calendar.unix
     timespec>seconds since-1970 ;
 
 : get-time ( -- alien )
-    f time <time_t> localtime tm memory>struct ;
+    f time <time_t> localtime ;
 
 : timezone-name ( -- string )
     get-time zone>> ;
index 0eb7881f95915c9c336ba09400e731ac2aaf1d1f..870085f77afbee1540475f5d3293a5d6892212b0 100644 (file)
@@ -17,7 +17,7 @@ GENERIC: from ( channel -- value )
 <PRIVATE
 
 : wait ( channel -- )
-    [ senders>> push ] curry
+    [ self ] dip senders>> push
     "channel send" suspend drop ;
 
 : (to) ( value receivers -- )
@@ -36,7 +36,7 @@ M: channel to ( value channel -- )
     [ dup wait to ] [ nip (to) ] if-empty ;
 
 M: channel from ( channel -- value )
-    [
-        notify senders>>
-        [ (from) ] unless-empty
-    ] curry "channel receive" suspend ;
+    [ self ] dip
+    notify senders>>
+    [ (from) ] unless-empty
+    "channel receive" suspend ;
index a2b6d4fd79e49b0bbe80489ac220500f29cb605a..f83d0354f658ebc2f8b67134d4846870da5ab259 100644 (file)
@@ -29,7 +29,7 @@ M: md5 initialize-checksum-state drop <md5-state> ;
 
 : update-md5 ( md5 -- )
     [ state>> ] [ old-state>> v-w+ dup clone ] [ ] tri
-    [ (>>old-state) ] [ (>>state) ] bi ;
+    [ old-state<< ] [ state<< ] bi ;
 
 CONSTANT: T
     $[
@@ -182,10 +182,10 @@ HINTS: (process-md5-block-I) { uint-array md5-state } ;
         ] each
     ] unless ;
 
-: byte-array>uint-array-le ( byte-array -- uint-array )
-    byte-array>le byte-array>uint-array ;
+: uint-array-cast-le ( byte-array -- uint-array )
+    byte-array>le uint-array-cast ;
 
-HINTS: byte-array>uint-array-le byte-array ;
+HINTS: uint-array-cast-le byte-array ;
 
 : uint-array>byte-array-le ( uint-array -- byte-array )
     underlying>> byte-array>le ;
@@ -194,7 +194,7 @@ HINTS: uint-array>byte-array-le uint-array ;
 
 M: md5-state checksum-block ( block state -- )
     [
-        [ byte-array>uint-array-le ] [ state>> ] bi* {
+        [ uint-array-cast-le ] [ state>> ] bi* {
             [ (process-md5-block-F) ]
             [ (process-md5-block-G) ]
             [ (process-md5-block-H) ]
index 095ab38ace5e0f15737ab47a5f4810fae44b3222..1fec109d5f105219ee545c69de34f75cb2e38e2d 100644 (file)
@@ -1,4 +1,4 @@
-! copyright (C) 2008 Slava Pestov
+! Copyright (C) 2008, 2010 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors byte-arrays alien.c-types alien.data kernel
 continuations destructors sequences io openssl openssl.libcrypto
@@ -47,9 +47,10 @@ M: evp-md-context dispose*
 
 : digest-value ( ctx -- value )
     handle>>
-    EVP_MAX_MD_SIZE <byte-array> 0 <int>
-    [ EVP_DigestFinal_ex ssl-error ] 2keep
-    *int memory>byte-array ;
+    { { int EVP_MAX_MD_SIZE } int }
+    [ EVP_DigestFinal_ex ssl-error ]
+    [ memory>byte-array ]
+    with-out-parameters ;
 
 PRIVATE>
 
index ba85add03c63727406fb6d650b5f745b2b911e68..82d2c2b4919606e33739a5e274842e295868b15f 100644 (file)
@@ -4,7 +4,7 @@ USING: accessors checksums checksums.common checksums.stream
 combinators combinators.smart fry generalizations grouping
 io.binary kernel literals locals make math math.bitwise
 math.ranges multiline namespaces sbufs sequences
-sequences.private splitting strings ;
+sequences.generalizations sequences.private splitting strings ;
 IN: checksums.sha
 
 SINGLETON: sha1
@@ -395,7 +395,7 @@ M: sha-256 checksum-stream ( stream checksum -- byte-array )
     state [ H [ w+ ] 2map ] change-H drop ; inline
 
 M:: sha1-state checksum-block ( bytes state -- )
-    bytes prepare-sha1-message-schedule state (>>W)
+    bytes prepare-sha1-message-schedule state W<<
 
     bytes
     state [ H>> clone ] [ W>> ] [ K>> ] tri state process-sha1-chunk ;
index ccb70c617f534f4af67498ae0c51adf91012ad04..db60bb12075a84eac6a83e30ddc2e51a718714fa 100644 (file)
@@ -25,7 +25,7 @@ M: circular virtual-exemplar seq>> ; inline
 
 : change-circular-start ( n circular -- )
     #! change start to (start + n) mod length
-    circular-wrap (>>start) ; inline
+    circular-wrap start<< ; inline
 
 : rotate-circular ( circular -- )
     [ 1 ] dip change-circular-start ; inline
@@ -64,7 +64,7 @@ TUPLE: circular-iterator
 
 <PRIVATE
 
-: (circular-while) ( iterator quot: ( obj -- ? ) -- )
+: (circular-while) ( ... iterator quot: ( ... obj -- ... ? ) -- ... )
     [ [ [ n>> ] [ circular>> ] bi nth ] dip call ] 2keep
     rot [ [ dup n>> >>last-start ] dip ] when
     over [ n>> ] [ [ last-start>> ] [ circular>> length ] bi + 1 - ] bi = [
@@ -75,5 +75,5 @@ TUPLE: circular-iterator
 
 PRIVATE>
 
-: circular-while ( circular quot: ( obj -- ? ) -- )
+: circular-while ( ... circular quot: ( ... obj -- ... ? ) -- ... )
     [ clone ] dip [ <circular-iterator> ] dip (circular-while) ; inline
index 1a5294992e8789c78ebb4e861c4771c8441977a0..68a4876f926cb9fd84449d15c8aef8595b966794 100644 (file)
@@ -35,7 +35,8 @@ HELP: STRUCT:
 { "Struct classes cannot have a superclass defined." }
 { "The slots of a struct must all have a type declared. The type must be a C type." } 
 { { $link read-only } " slots on structs are not enforced, though they may be declared." }
-} } ;
+}
+"Additionally, structs may use bit fields. A slot specifier may use the syntax " { $snippet "bits: n" } " to specify that the bit width of the slot is " { $snippet "n" } ". Bit width may be specified on signed or unsigned integer slots. The layout of bit fields is not guaranteed to match that of any particular C compiler." } ;
 
 HELP: S{
 { $syntax "S{ class slots... }" }
@@ -159,7 +160,7 @@ $nl
 "A C function which returns a struct by value:"
 { $code
     "USING: alien.syntax ;"
-    "FUNCTION: Point give_me_a_point ( char* description ) ;"
+    "FUNCTION: Point give_me_a_point ( c-string description ) ;"
 }
 "A C function which takes a struct parameter by reference:"
 { $code
index cddca7118833e77a15557a78acad740deb9b9fe8..e841881d28190257f38862e3780646be3470958b 100644 (file)
@@ -1,12 +1,14 @@
 ! (c)Joe Groff bsd license
-USING: accessors alien alien.c-types alien.data ascii
-assocs byte-arrays classes.struct classes.tuple.private classes.tuple
-combinators compiler.tree.debugger compiler.units destructors
-io.encodings.utf8 io.pathnames io.streams.string kernel libc
-literals math mirrors namespaces prettyprint
-prettyprint.config see sequences specialized-arrays system
-tools.test parser lexer eval layouts generic.single classes ;
+USING: accessors alien alien.c-types alien.data alien.syntax ascii
+assocs byte-arrays classes.struct classes.tuple.parser
+classes.tuple.private classes.tuple combinators compiler.tree.debugger
+compiler.units destructors io.encodings.utf8 io.pathnames
+io.streams.string kernel libc literals math mirrors namespaces
+prettyprint prettyprint.config see sequences specialized-arrays
+system tools.test parser lexer eval layouts generic.single classes
+vocabs ;
 FROM: math => float ;
+FROM: specialized-arrays.private => specialized-array-vocab ;
 QUALIFIED-WITH: alien.c-types c
 SPECIALIZED-ARRAY: char
 SPECIALIZED-ARRAY: int
@@ -139,7 +141,7 @@ UNION-STRUCT: struct-test-float-and-bits
 [ 123 ] [ [ struct-test-foo malloc-struct &free y>> ] with-destructors ] unit-test
 
 STRUCT: struct-test-string-ptr
-    { x char* } ;
+    { x c-string } ;
 
 [ "hello world" ] [
     [
@@ -209,7 +211,7 @@ UNION-STRUCT: struct-test-float-and-bits
         { name "y" }
         { offset 4 }
         { initial 123 }
-        { class integer }
+        { class $[ cell 4 = integer fixnum ? ] }
         { type int }
     }
     T{ struct-slot-spec
@@ -233,7 +235,7 @@ UNION-STRUCT: struct-test-float-and-bits
         { name "bits" }
         { offset 0 }
         { type uint }
-        { class integer }
+        { class $[ cell 4 = integer fixnum ? ] }
         { initial 0 }
     }
 } ] [ struct-test-float-and-bits c-type fields>> ] unit-test
@@ -303,6 +305,12 @@ SPECIALIZED-ARRAY: struct-test-optimization
     { x>> } inlined?
 ] unit-test
 
+[ ] [
+    [
+        struct-test-optimization specialized-array-vocab forget-vocab
+    ] with-compilation-unit
+] unit-test
+
 ! Test cloning structs
 STRUCT: clone-test-struct { x int } { y char[3] } ;
 
@@ -334,6 +342,14 @@ STRUCT: struct-that's-a-word { x int } ;
     "struct-class-test-1" parse-stream
 ] [ error>> error>> unexpected-eof? ] must-fail-with
 
+[
+    "USING: alien.c-types classes.struct ; IN: classes.struct.tests STRUCT: struct-test-duplicate-slots { x uint } { x uint } ;" eval( -- )
+] [ error>> duplicate-slot-names? ] must-fail-with
+
+[
+    "USING: alien.c-types classes.struct ; IN: classes.struct.tests STRUCT: struct-test-duplicate-slots { x uint } { x float } ;" eval( -- )
+] [ error>> duplicate-slot-names? ] must-fail-with
+
 ! S{ with non-struct type
 [
     "USE: classes.struct IN: classes.struct.tests TUPLE: not-a-struct ; S{ not-a-struct }"
@@ -374,6 +390,63 @@ STRUCT: bit-field-test
 [ 1 ] [ bit-field-test <struct> 257 >>c c>> ] unit-test
 [ 3 ] [ bit-field-test heap-size ] unit-test
 
+STRUCT: referent
+    { y int } ;
+STRUCT: referrer
+    { x referent* } ;
+
+[ 57 ] [
+    [
+        referrer <struct>
+            referent malloc-struct &free
+                57 >>y
+            >>x
+        x>> y>>
+    ] with-destructors
+] unit-test
+
+STRUCT: self-referent
+    { x self-referent* }
+    { y int } ;
+
+[ 75 ] [
+    [
+        self-referent <struct>
+            self-referent malloc-struct &free
+                75 >>y
+            >>x
+        x>> y>>
+    ] with-destructors
+] unit-test
+
+C-TYPE: forward-referent
+STRUCT: backward-referent
+    { x forward-referent* }
+    { y int } ;
+STRUCT: forward-referent
+    { x backward-referent* }
+    { y int } ;
+
+[ 41 ] [
+    [
+        forward-referent <struct>
+            backward-referent malloc-struct &free
+                41 >>y
+            >>x
+        x>> y>>
+    ] with-destructors
+] unit-test
+
+[ 14 ] [
+    [
+        backward-referent <struct>
+            forward-referent malloc-struct &free
+                14 >>y
+            >>x
+        x>> y>>
+    ] with-destructors
+] unit-test
+
 cpu ppc? [
     STRUCT: ppc-align-test-1
         { x longlong }
index 4e7a565a5aba4fa8b6fba621c93e046afbee426e..97dbe16d30ba4f3f13acc88ac01706589aba99c4 100644 (file)
@@ -8,7 +8,8 @@ generalizations generic.parser kernel kernel.private lexer libc
 locals macros make math math.order parser quotations sequences
 slots slots.private specialized-arrays vectors words summary
 namespaces assocs vocabs.parser math.functions
-classes.struct.bit-accessors bit-arrays ;
+classes.struct.bit-accessors bit-arrays
+stack-checker.dependencies system layouts ;
 QUALIFIED: math
 IN: classes.struct
 
@@ -45,11 +46,11 @@ M: struct >c-ptr
 M: struct equal?
     {
         [ [ class ] bi@ = ]
-        [ [ >c-ptr ] [ [ >c-ptr ] [ byte-length ] bi ] bi* memory= ]
+        [ [ >c-ptr ] [ binary-object ] bi* memory= ]
     } 2&& ; inline
 
 M: struct hashcode*
-    [ >c-ptr ] [ byte-length ] bi <direct-uchar-array> hashcode* ; inline    
+    binary-object <direct-uchar-array> hashcode* ; inline
 
 : struct-prototype ( class -- prototype ) "prototype" word-prop ; foldable
 
@@ -100,8 +101,7 @@ MACRO: <struct-boa> ( class -- quot: ( ... -- struct ) )
 GENERIC: (reader-quot) ( slot -- quot )
 
 M: struct-slot-spec (reader-quot)
-    [ type>> c-type-getter-boxer ]
-    [ offset>> [ >c-ptr ] swap suffix ] bi prepend ;
+    [ offset>> ] [ type>> ] bi '[ >c-ptr _ _ alien-value ] ;
 
 M: struct-bit-slot-spec (reader-quot)
     [ [ offset>> ] [ bits>> ] bi bit-reader ]
@@ -112,23 +112,29 @@ M: struct-bit-slot-spec (reader-quot)
 GENERIC: (writer-quot) ( slot -- quot )
 
 M: struct-slot-spec (writer-quot)
-    [ type>> c-setter ]
-    [ offset>> [ >c-ptr ] swap suffix ] bi prepend ;
+    [ offset>> ] [ type>> ] bi '[ >c-ptr _ _ set-alien-value ] ;
 
 M: struct-bit-slot-spec (writer-quot)
-    [ offset>> ] [ bits>> ] bi bit-writer
-    [ >c-ptr ] prepose ;
+    [ offset>> ] [ bits>> ] bi bit-writer [ >c-ptr ] prepose ;
 
 : (boxer-quot) ( class -- quot )
     '[ _ memory>struct ] ;
 
 : (unboxer-quot) ( class -- quot )
     drop [ >c-ptr ] ;
+
+MACRO: read-struct-slot ( slot -- )
+    dup type>> depends-on-c-type
+    (reader-quot) ;
+
+MACRO: write-struct-slot ( slot -- )
+    dup type>> depends-on-c-type
+    (writer-quot) ;
 PRIVATE>
 
 M: struct-class boa>object
     swap pad-struct-slots
-    [ <struct> ] [ struct-slots ] bi 
+    [ <struct> ] [ struct-slots ] bi
     [ [ (writer-quot) call( value struct -- ) ] with 2each ] curry keep ;
 
 M: struct-class initial-value* <struct> ; inline
@@ -138,10 +144,11 @@ M: struct-class initial-value* <struct> ; inline
 GENERIC: struct-slot-values ( struct -- sequence )
 
 M: struct-class reader-quot
-    nip (reader-quot) ;
+    dup type>> array? [ dup type>> first define-array-vocab drop ] when
+    nip '[ _ read-struct-slot ] ;
 
 M: struct-class writer-quot
-    nip (writer-quot) ;
+    nip '[ _ write-struct-slot ] ;
 
 : offset-of ( field struct -- offset )
     struct-slots slot-named offset>> ; inline
@@ -156,30 +163,14 @@ INSTANCE: struct-c-type value-type
 
 M: struct-c-type c-type ;
 
-M: struct-c-type c-type-stack-align? drop f ;
-
-: if-value-struct ( ctype true false -- )
-    [ dup value-struct? ] 2dip '[ drop void* @ ] if ; inline
-
-M: struct-c-type unbox-parameter
-    [ %unbox-large-struct ] [ unbox-parameter ] if-value-struct ;
-
-M: struct-c-type box-parameter
-    [ %box-large-struct ] [ box-parameter ] if-value-struct ;
+M: struct-c-type base-type ;
 
-: if-small-struct ( c-type true false -- ? )
-    [ dup return-struct-in-registers? ] 2dip '[ f swap @ ] if ; inline
-
-M: struct-c-type unbox-return
-    [ %unbox-small-struct ] [ %unbox-large-struct ] if-small-struct ;
-
-M: struct-c-type box-return
-    [ %box-small-struct ] [ %box-large-struct ] if-small-struct ;
-
-M: struct-c-type stack-size
-    [ heap-size ] [ stack-size ] if-value-struct ;
-
-M: struct-c-type c-struct? drop t ;
+: large-struct? ( type -- ? )
+    {
+        { [ dup void? ] [ drop f ] }
+        { [ dup base-type struct-c-type? not ] [ drop f ] }
+        [ return-struct-in-registers? not ]
+    } cond ;
 
 <PRIVATE
 : struct-slot-values-quot ( class -- quot )
@@ -193,7 +184,7 @@ M: struct-c-type c-struct? drop t ;
     define-inline-method ;
 
 : clone-underlying ( struct -- byte-array )
-    [ >c-ptr ] [ byte-length ] bi memory>byte-array ; inline
+    binary-object memory>byte-array ; inline
 
 : (define-clone-method) ( class -- )
     [ \ clone ]
@@ -218,10 +209,10 @@ GENERIC: compute-slot-offset ( offset class -- offset' )
 
 M: struct-slot-spec compute-slot-offset
     [ type>> over c-type-align-at 8 * align ] keep
-    [ [ 8 /i ] dip (>>offset) ] [ type>> heap-size 8 * + ] 2bi ;
+    [ [ 8 /i ] dip offset<< ] [ type>> heap-size 8 * + ] 2bi ;
 
 M: struct-bit-slot-spec compute-slot-offset
-    [ (>>offset) ] [ bits>> + ] 2bi ;
+    [ offset<< ] [ bits>> + ] 2bi ;
 
 : compute-struct-offsets ( slots -- size )
     0 [ compute-slot-offset ] reduce 8 align 8 /i ;
@@ -343,7 +334,7 @@ PRIVATE>
 <PRIVATE
 : parse-struct-slot ( -- slot )
     scan scan-c-type \ } parse-until <struct-slot-spec> ;
-    
+
 : parse-struct-slots ( slots -- slots' more? )
     scan {
         { ";" [ f ] }
@@ -353,7 +344,8 @@ PRIVATE>
     } case ;
 
 : parse-struct-definition ( -- class slots )
-    CREATE-CLASS 8 <vector> [ parse-struct-slots ] [ ] while >array ;
+    CREATE-CLASS 8 <vector> [ parse-struct-slots ] [ ] while >array
+    dup [ name>> ] map check-duplicate-slots ;
 PRIVATE>
 
 SYNTAX: STRUCT:
@@ -393,4 +385,4 @@ FUNCTOR-SYNTAX: STRUCT:
 
 USING: vocabs vocabs.loader ;
 
-"prettyprint" vocab [ "classes.struct.prettyprint" require ] when
+{ "classes.struct" "prettyprint" } "classes.struct.prettyprint" require-when
index df56ce5c4c43568bf9cbdcd5226d64aac3a21156..db1eefca14fcdef89c5188c0a1b1a39086284625 100644 (file)
@@ -8,10 +8,9 @@ IN: cocoa.application
 
 : <NSString> ( str -- alien ) <CFString> -> autorelease ;
 
-C-ENUM:
-NSApplicationDelegateReplySuccess
-NSApplicationDelegateReplyCancel
-NSApplicationDelegateReplyFailure ;
+CONSTANT: NSApplicationDelegateReplySuccess 0
+CONSTANT: NSApplicationDelegateReplyCancel  1
+CONSTANT: NSApplicationDelegateReplyFailure 2
 
 : with-autorelease-pool ( quot -- )
     NSAutoreleasePool -> new [ call ] [ -> release ] bi* ; inline
index 34bac0a5055229e13b7a738190f577359fd3ab7e..fb21843c0f6f4e396dd6723e19073dc7779eb8dd 100644 (file)
@@ -39,6 +39,7 @@ SYNTAX: IMPORT: scan [ ] import-objc-class ;
 
 [
     {
+        "NSAlert"
         "NSApplication"
         "NSArray"
         "NSAutoreleasePool"
index c7bdf625d9e0c5debf04d8c83660fc771037a65a..f4d1053f0ade9758c6be5f7b00de78d763adb695 100644 (file)
@@ -15,7 +15,7 @@ CONSTANT: NS-EACH-BUFFER-SIZE 16
         @
     ] with-destructors ; inline
 
-:: (NSFastEnumeration-each) ( object quot: ( elt -- ) state stackbuf count -- )
+:: (NSFastEnumeration-each) ( ... object quot: ( ... elt -- ) state stackbuf count -- ... )
     object state stackbuf count -> countByEnumeratingWithState:objects:count: :> items-count
     items-count 0 = [
         state itemsPtr>> [ items-count id <c-direct-array> ] [ stackbuf ] if* :> items
@@ -23,10 +23,10 @@ CONSTANT: NS-EACH-BUFFER-SIZE 16
         object quot state stackbuf count (NSFastEnumeration-each)
     ] unless ; inline recursive
 
-: NSFastEnumeration-each ( object quot -- )
+: NSFastEnumeration-each ( ... object quot: ( ... elt -- ... ) -- ... )
     [ (NSFastEnumeration-each) ] with-enumeration-buffers ; inline
 
-: NSFastEnumeration-map ( object quot -- vector )
+: NSFastEnumeration-map ( ... object quot: ( ... elt -- ... newelt ) -- ... vector )
     NS-EACH-BUFFER-SIZE <vector>
     [ '[ @ _ push ] NSFastEnumeration-each ] keep ; inline
 
index 76b77721ffe1ca60aeec4b3b55c66ff5153fa096..029b3f46e6150a4ed41fe96b7d709dc030afa1d0 100644 (file)
@@ -1,12 +1,11 @@
 ! Copyright (C) 2006, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types alien.strings arrays assocs
-classes.struct continuations combinators compiler compiler.alien
+USING: accessors alien alien.c-types alien.data alien.strings
+arrays assocs classes.struct continuations combinators compiler
 core-graphics.types stack-checker kernel math namespaces make
 quotations sequences strings words cocoa.runtime cocoa.types io
-macros memoize io.encodings.utf8 effects layouts libc
-libc.private lexer init core-foundation fry generalizations
-specialized-arrays ;
+macros memoize io.encodings.utf8 effects layouts libc lexer init
+core-foundation fry generalizations specialized-arrays ;
 QUALIFIED-WITH: alien.c-types c
 IN: cocoa.messages
 
@@ -110,7 +109,7 @@ H{
     { "d" c:double }
     { "B" c:bool }
     { "v" c:void }
-    { "*" c:char* }
+    { "*" c:c-string }
     { "?" unknown_type }
     { "@" id }
     { "#" Class }
@@ -217,7 +216,7 @@ ERROR: no-objc-type name ;
     objc-methods get set-at ;
 
 : each-method-in-class ( class quot -- )
-    [ 0 <uint> [ class_copyMethodList ] keep *uint ] dip
+    [ { uint } [ class_copyMethodList ] [ ] with-out-parameters ] dip
     over 0 = [ 3drop ] [
         [ <direct-void*-array> ] dip
         [ each ] [ drop (free) ] 2bi
@@ -237,8 +236,8 @@ ERROR: no-objc-type name ;
 
 : import-objc-class ( name quot -- )
     2dup swap define-objc-class-word
-    over objc_getClass [ drop ] [ call( -- ) ] if
-    dup objc_getClass [
+    over class-exists? [ drop ] [ call( -- ) ] if
+    dup class-exists? [
         [ objc_getClass register-objc-methods ]
         [ objc_getMetaClass register-objc-methods ] bi
     ] [ drop ] if ;
index a39cc794d0f09d2f41f2468d563975f2a54c8896..d4a11cc9d59606fc1ecd06c5536b4cfa1b729173 100644 (file)
@@ -1,8 +1,8 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: cocoa.application cocoa.messages cocoa.classes
-cocoa.runtime kernel cocoa alien.c-types core-foundation
-core-foundation.arrays ;
+USING: alien.c-types alien.data cocoa.application cocoa.messages
+cocoa.classes cocoa.runtime cocoa core-foundation
+core-foundation.arrays kernel ;
 IN: cocoa.nibs
 
 : load-nib ( name -- )
@@ -15,5 +15,7 @@ IN: cocoa.nibs
     dup [ -> autorelease ] when ;
 
 : nib-objects ( anNSNib -- objects/f )
-    f f <void*> [ -> instantiateNibWithOwner:topLevelObjects: ] keep
-    swap [ *void* CF>array ] [ drop f ] if ;
\ No newline at end of file
+    f
+    { void* } [ -> instantiateNibWithOwner:topLevelObjects: ] [ ]
+    with-out-parameters
+    swap [ CF>array ] [ drop f ] if ;
\ No newline at end of file
index 86b13b2ddc2e83341c83480bad3b81b16e20ea17..80d58e634061525383bd2db22899468c62a8e913 100644 (file)
@@ -36,9 +36,11 @@ DEFER: plist>
     NSFastEnumeration-map >hashtable ;
 
 : (read-plist) ( NSData -- id )
-    NSPropertyListSerialization swap kCFPropertyListImmutable f f <void*>
-    [ -> propertyListFromData:mutabilityOption:format:errorDescription: ] keep
-    *void* [ -> release "read-plist failed" throw ] when* ;
+    NSPropertyListSerialization swap kCFPropertyListImmutable f
+    { void* }
+    [ -> propertyListFromData:mutabilityOption:format:errorDescription: ] [ ]
+    with-out-parameters
+    [ -> release "read-plist failed" throw ] when* ;
 
 MACRO: objc-class-case ( alist -- quot )
     [
index f02f1f6182d6de07a6e1a33d31c513953c20a30e..9e4983524239b0ecc94ee28f8ac35c3c166b46cd 100644 (file)
@@ -7,11 +7,11 @@ TYPEDEF: void* SEL
 
 TYPEDEF: void* id
 
-FUNCTION: char* sel_getName ( SEL aSelector ) ;
+FUNCTION: c-string sel_getName ( SEL aSelector ) ;
 
 FUNCTION: char sel_isMapped ( SEL aSelector ) ;
 
-FUNCTION: SEL sel_registerName ( char* str ) ;
+FUNCTION: SEL sel_registerName ( c-string str ) ;
 
 TYPEDEF: void* Class
 TYPEDEF: void* Method
@@ -33,13 +33,13 @@ CONSTANT: CLS_METHOD_ARRAY HEX: 100
 
 FUNCTION: int objc_getClassList ( void* buffer, int bufferLen ) ;
 
-FUNCTION: Class objc_getClass ( char* class ) ;
+FUNCTION: Class objc_getClass ( c-string class ) ;
 
-FUNCTION: Class objc_getMetaClass ( char* class ) ;
+FUNCTION: Class objc_getMetaClass ( c-string class ) ;
 
-FUNCTION: Protocol objc_getProtocol ( char* class ) ;
+FUNCTION: Protocol objc_getProtocol ( c-string class ) ;
 
-FUNCTION: Class objc_allocateClassPair ( Class superclass, char* name, size_t extraBytes ) ;
+FUNCTION: Class objc_allocateClassPair ( Class superclass, c-string name, size_t extraBytes ) ;
 FUNCTION: void objc_registerClassPair ( Class cls ) ;
 
 FUNCTION: id class_createInstance ( Class class, uint additionalByteCount ) ;
@@ -54,7 +54,7 @@ FUNCTION: Method* class_copyMethodList ( Class class, uint* outCount ) ;
 
 FUNCTION: Class class_getSuperclass ( Class cls ) ;
 
-FUNCTION: char* class_getName ( Class cls ) ;
+FUNCTION: c-string class_getName ( Class cls ) ;
 
 FUNCTION: char class_addMethod ( Class class, SEL name, void* imp, void* types ) ;
 
@@ -64,7 +64,7 @@ FUNCTION: uint method_getNumberOfArguments ( Method method ) ;
 
 FUNCTION: uint method_getSizeOfArguments ( Method method ) ;
 
-FUNCTION: uint method_getArgumentInfo ( Method method, int argIndex, char** type, int* offset ) ;
+FUNCTION: uint method_getArgumentInfo ( Method method, int argIndex, c-string* type, int* offset ) ;
 
 FUNCTION: void* method_copyReturnType ( Method method ) ;
 
index e4db56221f33a40e0c7ba5911bb0e7d3a04f6896..1accb1e8dc1390c9683a80f57b58b021b6676cd5 100644 (file)
@@ -40,7 +40,7 @@ IN: cocoa.subclassing
 
 : prepare-method ( ret types quot -- type imp )
     [ [ encode-types ] 2keep ] dip
-    '[ _ _ "cdecl" _ alien-callback ]
+    '[ _ _ cdecl _ alien-callback ]
     (( -- callback )) define-temp ;
 
 : prepare-methods ( methods -- methods )
index 11624dcf1046d715b5ee27c144829977beb215e9..8933c4bb39f1545572fa1ebedc316ab261423cee 100644 (file)
@@ -63,3 +63,16 @@ IN: combinators.smart.tests
 
 [ { 1 2 } { 3 4 } { 5 6 } ] [ 1 2 3 4 5 6 [ 2array ] 3 smart-apply ] unit-test
 [ { 1 2 3 } { 4 5 6 } ] [ 1 2 3 4 5 6 [ 3array ] 2 smart-apply ] unit-test
+
+[ 4 ] [ 2 [ even? ] [ 2 + ] smart-when ] unit-test
+[ 3 ] [ 3 [ even? ] [ 2 + ] smart-when ] unit-test
+[ 4 ] [ 2 [ odd? ] [ 2 + ] smart-unless ] unit-test
+[ 3 ] [ 3 [ odd? ] [ 2 + ] smart-unless ] unit-test
+
+[ 4 ] [ 2 [ even? ] [ 2 + ] smart-when* ] unit-test
+[ ] [ 3 [ even? ] [ 2 + ] smart-when* ] unit-test
+[ 3 ] [ 2 [ odd? ] [ 3 ] smart-unless* ] unit-test
+[ 3 ] [ 3 [ odd? ] [ 5 ] smart-unless* ] unit-test
+
+[ -1 ] [ 1 2 [ + odd? ] [ - ] smart-when* ] unit-test
+[ ] [ 2 2 [ + odd? ] [ ] smart-unless* ] unit-test
index 5576421742708a93423eb02cf612870940d1112d..c0ce938abb20e9dc49e3b271a805da2a5a84ec67 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors fry generalizations kernel macros math.order
-stack-checker math sequences ;
+USING: accessors fry generalizations sequences.generalizations
+kernel macros math.order stack-checker math sequences ;
 IN: combinators.smart
 
 MACRO: drop-outputs ( quot -- quot' )
@@ -49,8 +49,29 @@ MACRO: preserving ( quot -- )
 MACRO: nullary ( quot -- quot' )
     dup outputs '[ @ _ ndrop ] ;
 
-MACRO: smart-if ( pred true false -- )
+MACRO: dropping ( quot -- quot' )
+    inputs '[ [ _ ndrop ] ] ;
+
+MACRO: balancing ( quot -- quot' )
+    '[ _ [ preserving ] [ dropping ] bi ] ;
+
+MACRO: smart-if ( pred true false -- quot )
     '[ _ preserving _ _ if ] ;
 
-MACRO: smart-apply ( quot n -- )
+MACRO: smart-when ( pred true -- quot )
+    '[ _ _ [ ] smart-if ] ;
+
+MACRO: smart-unless ( pred false -- quot )
+    '[ _ [ ] _ smart-if ] ;
+
+MACRO: smart-if* ( pred true false -- quot )
+    '[ _ balancing _ swap _ compose if ] ;
+
+MACRO: smart-when* ( pred true -- quot )
+    '[ _ _ [ ] smart-if* ] ;
+
+MACRO: smart-unless* ( pred false -- quot )
+    '[ _ [ ] _ smart-if* ] ;
+
+MACRO: smart-apply ( quot n -- quot )
     [ dup inputs ] dip '[ _ _ _ mnapply ] ;
index 9a69614766843c5d9c31958072f88ddcf2471a5b..b17f8250dd34ffa31d1ed28c799273410be935e7 100644 (file)
@@ -43,14 +43,16 @@ ARTICLE: "runtime-cli-args" "Command line switches for the VM"
     { { $snippet "-i=" { $emphasis "image" } } { "Specifies the image file to use; see " { $link "images" } } }
     { { $snippet "-datastack=" { $emphasis "n" } } "Data stack size, kilobytes" }
     { { $snippet "-retainstack=" { $emphasis "n" } } "Retain stack size, kilobytes" }
+    { { $snippet "-callstack=" { $emphasis "n" } } "Call stack size, kilobytes" }
     { { $snippet "-young=" { $emphasis "n" } } { "Size of youngest generation (0), megabytes" } }
     { { $snippet "-aging=" { $emphasis "n" } } "Size of aging generation (1), megabytes" }
     { { $snippet "-tenured=" { $emphasis "n" } } "Size of oldest generation (2), megabytes" }
     { { $snippet "-codeheap=" { $emphasis "n" } } "Code heap size, megabytes" }
+    { { $snippet "-callbacks=" { $emphasis "n" } } "Callback heap size, megabytes" }
     { { $snippet "-pic=" { $emphasis "n" } } "Maximum inline cache size. Setting of 0 disables inline caching, > 1 enables polymorphic inline caching" }
     { { $snippet "-securegc" } "If specified, unused portions of the data heap will be zeroed out after every garbage collection" }
 }
-"If an " { $snippet "-i=" } " switch is not present, the default image file is used, which is usually a file named " { $snippet "factor.image" } " in the same directory as the runtime executable (on Windows and Mac OS X) or the current directory (on Unix)." ;
+"If an " { $snippet "-i=" } " switch is not present, the default image file is used, which is usually a file named " { $snippet "factor.image" } " in the same directory as the Factor executable." ;
 
 ARTICLE: "bootstrap-cli-args" "Command line switches for bootstrap"
 "A number of command line switches can be passed to a bootstrap image to modify the behavior of the resulting image:"
diff --git a/basis/compiler/alien/alien.factor b/basis/compiler/alien/alien.factor
deleted file mode 100644 (file)
index 6a63b71..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-! Copyright (C) 2008 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel namespaces make math sequences layouts
-alien.c-types cpu.architecture ;
-IN: compiler.alien
-
-: large-struct? ( ctype -- ? )
-    dup c-struct? [ return-struct-in-registers? not ] [ drop f ] if ;
-
-: alien-parameters ( params -- seq )
-    dup parameters>>
-    swap return>> large-struct? [ void* prefix ] when ;
-
-: alien-return ( params -- ctype )
-    return>> dup large-struct? [ drop void ] when ;
-
-: c-type-stack-align ( type -- align )
-    dup c-type-stack-align? [ c-type-align ] [ drop cell ] if ;
-
-: parameter-align ( n type -- n delta )
-    [ c-type-stack-align align dup ] [ drop ] 2bi - ;
-
-: parameter-offsets ( types -- total offsets )
-    [
-        0 [
-            [ parameter-align drop dup , ] keep stack-size +
-        ] reduce cell align
-    ] { } make ;
diff --git a/basis/compiler/alien/summary.txt b/basis/compiler/alien/summary.txt
deleted file mode 100644 (file)
index 5fc715b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Common code used for analysis and code generation of alien bindings
diff --git a/basis/compiler/cfg/alias-analysis/alias-analysis-tests.factor b/basis/compiler/cfg/alias-analysis/alias-analysis-tests.factor
new file mode 100644 (file)
index 0000000..dfbb70f
--- /dev/null
@@ -0,0 +1,289 @@
+USING: arrays compiler.cfg.alias-analysis compiler.cfg.instructions
+compiler.cfg.registers compiler.cfg.debugger compiler.cfg.comparisons
+cpu.architecture tools.test byte-arrays layouts literals alien
+accessors sequences ;
+IN: compiler.cfg.alias-analysis.tests
+
+: test-alias-analysis ( insn -- insn )
+    init-alias-analysis
+    alias-analysis-step
+    [ f >>insn# ] map ;
+
+! Redundant load elimination
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##slot-imm f 1 0 1 0 }
+        T{ ##copy f 2 1 any-rep }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##slot-imm f 1 0 1 0 }
+        T{ ##slot-imm f 2 0 1 0 }
+    } test-alias-analysis
+] unit-test
+
+! Store-load forwarding
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##set-slot-imm f 1 0 1 0 }
+        T{ ##copy f 2 1 any-rep }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##set-slot-imm f 1 0 1 0 }
+        T{ ##slot-imm f 2 0 1 0 }
+    } test-alias-analysis
+] unit-test
+
+! Dead store elimination
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##set-slot-imm f 2 0 1 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##set-slot-imm f 1 0 1 0 }
+        T{ ##set-slot-imm f 2 0 1 0 }
+    } test-alias-analysis
+] unit-test
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##set-slot-imm f 3 0 1 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##set-slot-imm f 1 0 1 0 }
+        T{ ##set-slot-imm f 2 0 1 0 }
+        T{ ##set-slot-imm f 3 0 1 0 }
+    } test-alias-analysis
+] unit-test
+
+! Redundant store elimination
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##slot-imm f 1 0 1 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##slot-imm f 1 0 1 0 }
+        T{ ##set-slot-imm f 1 0 1 0 }
+    } test-alias-analysis
+] unit-test
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##slot-imm f 1 0 1 0 }
+        T{ ##copy f 2 1 any-rep }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##slot-imm f 1 0 1 0 }
+        T{ ##copy f 2 1 any-rep }
+        T{ ##set-slot-imm f 2 0 1 0 }
+    } test-alias-analysis
+] unit-test
+
+! Not a redundant load
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##slot-imm f 1 0 1 0 }
+        T{ ##set-slot-imm f 0 1 1 0 }
+        T{ ##slot-imm f 2 0 1 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##slot-imm f 1 0 1 0 }
+        T{ ##set-slot-imm f 0 1 1 0 }
+        T{ ##slot-imm f 2 0 1 0 }
+    } test-alias-analysis
+] unit-test
+
+! Not a redundant store
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##set-slot-imm f 2 1 1 0 }
+        T{ ##slot-imm f 4 0 1 0 }
+        T{ ##set-slot-imm f 3 1 1 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##set-slot-imm f 2 1 1 0 }
+        T{ ##slot-imm f 4 0 1 0 }
+        T{ ##set-slot-imm f 3 1 1 0 }
+    } test-alias-analysis
+] unit-test
+
+! There's a redundant load, but not a redundant store
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##slot-imm f 4 0 1 0 }
+        T{ ##set-slot-imm f 2 0 1 0 }
+        T{ ##slot f 5 0 3 0 0 }
+        T{ ##set-slot-imm f 3 0 1 0 }
+        T{ ##copy f 6 3 any-rep }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##slot-imm f 4 0 1 0 }
+        T{ ##set-slot-imm f 2 0 1 0 }
+        T{ ##slot f 5 0 3 0 0 }
+        T{ ##set-slot-imm f 3 0 1 0 }
+        T{ ##slot-imm f 6 0 1 0 }
+    } test-alias-analysis
+] unit-test
+
+! Fresh allocations don't alias existing values
+
+! Redundant load elimination
+[
+    V{
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##allot f 4 16 array }
+        T{ ##set-slot-imm f 3 4 1 0 }
+        T{ ##set-slot-imm f 2 1 1 0 }
+        T{ ##copy f 5 3 any-rep }
+    }
+] [
+    V{
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##allot f 4 16 array }
+        T{ ##set-slot-imm f 3 4 1 0 }
+        T{ ##set-slot-imm f 2 1 1 0 }
+        T{ ##slot-imm f 5 4 1 0 }
+    } test-alias-analysis
+] unit-test
+
+! Redundant store elimination
+[
+    V{
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##allot f 4 16 array }
+        T{ ##slot-imm f 5 1 1 0 }
+        T{ ##set-slot-imm f 3 4 1 0 }
+    }
+] [
+    V{
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##allot f 4 16 array }
+        T{ ##set-slot-imm f 1 4 1 0 }
+        T{ ##slot-imm f 5 1 1 0 }
+        T{ ##set-slot-imm f 3 4 1 0 }
+    } test-alias-analysis
+] unit-test
+
+! Storing a new alias class into another object means that heap-ac
+! can now alias the new ac
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##allot f 4 16 array }
+        T{ ##set-slot-imm f 0 4 1 0 }
+        T{ ##set-slot-imm f 4 2 1 0 }
+        T{ ##slot-imm f 5 3 1 0 }
+        T{ ##set-slot-imm f 1 5 1 0 }
+        T{ ##slot-imm f 6 4 1 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##peek f 3 D 3 }
+        T{ ##allot f 4 16 array }
+        T{ ##set-slot-imm f 0 4 1 0 }
+        T{ ##set-slot-imm f 4 2 1 0 }
+        T{ ##slot-imm f 5 3 1 0 }
+        T{ ##set-slot-imm f 1 5 1 0 }
+        T{ ##slot-imm f 6 4 1 0 }
+    } test-alias-analysis
+] unit-test
+
+! Compares between objects which cannot alias are eliminated
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##allot f 1 16 array }
+        T{ ##load-reference f 2 f }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##allot f 1 16 array }
+        T{ ##compare f 2 0 1 cc= }
+    } test-alias-analysis
+] unit-test
+
+! Make sure that input to ##box-displaced-alien becomes heap-ac
+[
+    V{
+        T{ ##allot f 1 16 byte-array }
+        T{ ##load-reference f 2 10 }
+        T{ ##box-displaced-alien f 3 2 1 4 byte-array }
+        T{ ##slot-imm f 5 3 1 $[ alien type-number ] }
+        T{ ##compare f 6 5 1 cc= }
+    }
+] [
+    V{
+        T{ ##allot f 1 16 byte-array }
+        T{ ##load-reference f 2 10 }
+        T{ ##box-displaced-alien f 3 2 1 4 byte-array }
+        T{ ##slot-imm f 5 3 1 $[ alien type-number ] }
+        T{ ##compare f 6 5 1 cc= }
+    } test-alias-analysis
+] unit-test
index 9fffa0eed247093ad1c4e023d4a36a349fa5326c..ad6a5c011ef1c1bd0098807d92c466c3a14fcb05 100644 (file)
@@ -1,17 +1,18 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel math namespaces assocs hashtables sequences arrays
 accessors words vectors combinators combinators.short-circuit
-sets classes layouts cpu.architecture
+sets classes layouts fry locals cpu.architecture
 compiler.cfg
 compiler.cfg.rpo
 compiler.cfg.def-use
 compiler.cfg.liveness
-compiler.cfg.copy-prop
 compiler.cfg.registers
+compiler.cfg.utilities
 compiler.cfg.comparisons
 compiler.cfg.instructions
 compiler.cfg.representations.preferred ;
+FROM: namespaces => set ;
 IN: compiler.cfg.alias-analysis
 
 ! We try to eliminate redundant slot operations using some simple heuristics.
@@ -67,6 +68,14 @@ IN: compiler.cfg.alias-analysis
 ! e = c
 ! x[1] = c
 
+! Local copy propagation
+SYMBOL: copies
+
+: resolve ( vreg -- vreg ) copies get ?at drop ;
+
+: record-copy ( ##copy -- )
+    [ src>> resolve ] [ dst>> ] bi copies get set-at ; inline
+
 ! Map vregs -> alias classes
 SYMBOL: vregs>acs
 
@@ -84,44 +93,39 @@ SYMBOL: acs>vregs
 
 : ac>vregs ( ac -- vregs ) acs>vregs get at ;
 
-GENERIC: aliases ( vreg -- vregs )
-
-M: integer aliases
+: aliases ( vreg -- vregs )
     #! All vregs which may contain the same value as vreg.
     vreg>ac ac>vregs ;
 
-M: word aliases
-    1array ;
-
 : each-alias ( vreg quot -- )
     [ aliases ] dip each ; inline
 
+: merge-acs ( vreg into -- )
+    [ vreg>ac ] dip
+    2dup eq? [ 2drop ] [
+        [ ac>vregs ] dip
+        [ vregs>acs get '[ [ _ ] dip _ set-at ] each ]
+        [ acs>vregs get at push-all ]
+        2bi
+    ] if ;
+
 ! Map vregs -> slot# -> vreg
 SYMBOL: live-slots
 
-! Current instruction number
-SYMBOL: insn#
-
-! Load/store history, for dead store elimination
-TUPLE: load insn# ;
-TUPLE: store insn# ;
+! Maps vreg -> slot# -> insn# of last store or f
+SYMBOL: recent-stores
 
-: new-action ( class -- action )
-    insn# get swap boa ; inline
+! A set of insn#s of dead stores
+SYMBOL: dead-stores
 
-! Maps vreg -> slot# -> sequence of loads/stores
-SYMBOL: histories
+: dead-store ( insn# -- ) dead-stores get adjoin ;
 
-: history ( vreg -- history ) histories get at ;
-
-: set-ac ( vreg ac -- )
+:: set-ac ( vreg ac -- )
     #! Set alias class of newly-seen vreg.
-    {
-        [ drop H{ } clone swap histories get set-at ]
-        [ drop H{ } clone swap live-slots get set-at ]
-        [ swap vregs>acs get set-at ]
-        [ acs>vregs get push-at ]
-    } 2cleave ;
+    H{ } clone vreg recent-stores get set-at
+    H{ } clone vreg live-slots get set-at
+    ac vreg vregs>acs get set-at
+    vreg ac acs>vregs get push-at ;
 
 : live-slot ( slot#/f vreg -- vreg' )
     #! If the slot number is unknown, we never reuse a previous
@@ -139,20 +143,17 @@ ERROR: vreg-has-no-slots vreg ;
 : record-constant-slot ( slot# vreg -- )
     #! A load can potentially read every store of this slot#
     #! in that alias class.
-    [
-        history [ load new-action swap ?push ] change-at
-    ] with each-alias ;
+    [ recent-stores get at delete-at ] with each-alias ;
 
 : record-computed-slot ( vreg -- )
     #! Computed load is like a load of every slot touched so far
-    [
-        history values [ load new-action swap push ] each
-    ] each-alias ;
+    [ recent-stores get at clear-assoc ] each-alias ;
 
-: remember-slot ( value slot#/f vreg -- )
-    over
-    [ [ record-constant-slot ] [ load-constant-slot ] 2bi ]
-    [ 2nip record-computed-slot ] if ;
+:: remember-slot ( value slot# vreg -- )
+    slot# [
+        slot# vreg record-constant-slot
+        value slot# vreg load-constant-slot
+    ] [ vreg record-computed-slot ] if ;
 
 SYMBOL: ac-counter
 
@@ -171,106 +172,94 @@ SYMBOL: heap-ac
 : kill-constant-set-slot ( slot# vreg -- )
     [ live-slots get at delete-at ] with each-alias ;
 
-: record-constant-set-slot ( slot# vreg -- )
-    history [
-        dup empty? [ dup last store? [ dup pop* ] when ] unless
-        store new-action swap ?push
-    ] change-at ;
+:: record-constant-set-slot ( insn# slot# vreg -- )
+    vreg recent-stores get at :> recent-stores
+    slot# recent-stores at [ dead-store ] when*
+    insn# slot# recent-stores set-at ;
 
-: kill-computed-set-slot ( ac -- )
+: kill-computed-set-slot ( vreg -- )
     [ live-slots get at clear-assoc ] each-alias ;
 
-: remember-set-slot ( slot#/f vreg -- )
-    over [
-        [ record-constant-set-slot ]
-        [ kill-constant-set-slot ] 2bi
-    ] [ nip kill-computed-set-slot ] if ;
-
-SYMBOL: constants
-
-: constant ( vreg -- n/f )
-    #! Return a ##load-immediate value, or f if the vreg was not
-    #! assigned by an ##load-immediate.
-    resolve constants get at ;
+:: remember-set-slot ( insn# slot# vreg -- )
+    slot# [
+        insn# slot# vreg record-constant-set-slot
+        slot# vreg kill-constant-set-slot
+    ] [ vreg kill-computed-set-slot ] if ;
 
 GENERIC: insn-slot# ( insn -- slot#/f )
 GENERIC: insn-object ( insn -- vreg )
 
-M: ##slot insn-slot# slot>> constant ;
+M: ##slot insn-slot# drop f ;
 M: ##slot-imm insn-slot# slot>> ;
-M: ##set-slot insn-slot# slot>> constant ;
+M: ##set-slot insn-slot# drop f ;
 M: ##set-slot-imm insn-slot# slot>> ;
 M: ##alien-global insn-slot# [ library>> ] [ symbol>> ] bi 2array ;
-M: ##vm-field-ptr insn-slot# field-name>> ;
+M: ##vm-field insn-slot# offset>> ;
+M: ##set-vm-field insn-slot# offset>> ;
 
 M: ##slot insn-object obj>> resolve ;
 M: ##slot-imm insn-object obj>> resolve ;
 M: ##set-slot insn-object obj>> resolve ;
 M: ##set-slot-imm insn-object obj>> resolve ;
 M: ##alien-global insn-object drop \ ##alien-global ;
-M: ##vm-field-ptr insn-object drop \ ##vm-field-ptr ;
-
-: init-alias-analysis ( insns -- insns' )
-    H{ } clone histories set
-    H{ } clone vregs>acs set
-    H{ } clone acs>vregs set
-    H{ } clone live-slots set
-    H{ } clone constants set
-    H{ } clone copies set
-
-    0 ac-counter set
-    next-ac heap-ac set
+M: ##vm-field insn-object drop \ ##vm-field ;
+M: ##set-vm-field insn-object drop \ ##vm-field ;
 
-    \ ##vm-field-ptr set-new-ac
-    \ ##alien-global set-new-ac
+GENERIC: analyze-aliases ( insn -- insn' )
 
-    dup local-live-in [ set-heap-ac ] each ;
+M: insn analyze-aliases ;
 
-GENERIC: analyze-aliases* ( insn -- insn' )
-
-M: insn analyze-aliases*
+M: vreg-insn analyze-aliases
     ! If an instruction defines a value with a non-integer
     ! representation it means that the value will be boxed
     ! anywhere its used as a tagged pointer. Boxing allocates
     ! a new value, except boxing instructions haven't been
     ! inserted yet.
     dup defs-vreg [
-        over defs-vreg-rep int-rep eq?
+        over defs-vreg-rep { int-rep tagged-rep } member?
         [ set-heap-ac ] [ set-new-ac ] if
     ] when* ;
 
-M: ##phi analyze-aliases*
+M: ##phi analyze-aliases
     dup defs-vreg set-heap-ac ;
 
-M: ##load-immediate analyze-aliases*
-    call-next-method
-    dup [ val>> ] [ dst>> ] bi constants get set-at ;
-
-M: ##allocation analyze-aliases*
+M: ##allocation analyze-aliases
     #! A freshly allocated object is distinct from any other
     #! object.
     dup dst>> set-new-ac ;
 
-M: ##read analyze-aliases*
+M: ##box-displaced-alien analyze-aliases
+    [ call-next-method ]
+    [ base>> heap-ac get merge-acs ] bi ;
+
+M: ##read analyze-aliases
     call-next-method
     dup [ dst>> ] [ insn-slot# ] [ insn-object ] tri
-    2dup live-slot dup [
-        2nip any-rep \ ##copy new-insn analyze-aliases* nip
-    ] [
-        drop remember-slot
-    ] if ;
+    2dup live-slot dup
+    [ 2nip <copy> analyze-aliases nip ]
+    [ drop remember-slot ]
+    if ;
 
 : idempotent? ( value slot#/f vreg -- ? )
     #! Are we storing a value back to the same slot it was read
     #! from?
     live-slot = ;
 
-M: ##write analyze-aliases*
-    dup
-    [ src>> resolve ] [ insn-slot# ] [ insn-object ] tri
-    [ remember-set-slot drop ] [ load-slot ] 3bi ;
+M:: ##write analyze-aliases ( insn -- insn )
+    insn src>> resolve :> src
+    insn insn-slot# :> slot#
+    insn insn-object :> vreg
+    insn insn#>> :> insn#
 
-M: ##copy analyze-aliases*
+    src slot# vreg idempotent? [ insn# dead-store ] [
+        src heap-ac get merge-acs
+        insn insn#>> slot# vreg remember-set-slot
+        src slot# vreg load-slot
+    ] if
+
+    insn ;
+
+M: ##copy analyze-aliases
     #! The output vreg gets the same alias class as the input
     #! vreg, since they both contain the same value.
     dup record-copy ;
@@ -281,48 +270,47 @@ M: ##copy analyze-aliases*
         [ [ src1>> ] [ src2>> ] bi [ resolve vreg>ac ] bi@ = not ]
     } 1&& ; inline
 
-M: ##compare analyze-aliases*
+M: ##compare analyze-aliases
     call-next-method
     dup useless-compare? [
-        dst>> \ f type-number \ ##load-immediate new-insn
-        analyze-aliases*
+        dst>> f \ ##load-reference new-insn
+        analyze-aliases
     ] when ;
 
-: analyze-aliases ( insns -- insns' )
-    [ insn# set analyze-aliases* ] map-index sift ;
-
-SYMBOL: live-stores
+GENERIC: eliminate-dead-stores ( insn -- ? )
 
-: compute-live-stores ( -- )
-    histories get
-    values [
-        values [ [ store? ] filter [ insn#>> ] map ] map concat
-    ] map concat unique
-    live-stores set ;
+M: ##set-slot-imm eliminate-dead-stores
+    insn#>> dead-stores get in? not ;
 
-GENERIC: eliminate-dead-stores* ( insn -- insn' )
-
-: (eliminate-dead-stores) ( insn -- insn' )
-    dup insn-slot# [
-        insn# get live-stores get key? [
-            drop f
-        ] unless
-    ] when ;
+M: insn eliminate-dead-stores drop t ;
 
-M: ##set-slot eliminate-dead-stores* (eliminate-dead-stores) ;
-
-M: ##set-slot-imm eliminate-dead-stores* (eliminate-dead-stores) ;
-
-M: insn eliminate-dead-stores* ;
+: init-alias-analysis ( -- )
+    H{ } clone vregs>acs set
+    H{ } clone acs>vregs set
+    H{ } clone live-slots set
+    H{ } clone copies set
+    H{ } clone recent-stores set
+    HS{ } clone dead-stores set
+    0 ac-counter set ;
+
+: reset-alias-analysis ( -- )
+    recent-stores get clear-assoc
+    vregs>acs get clear-assoc
+    acs>vregs get clear-assoc
+    live-slots get clear-assoc
+    copies get clear-assoc
+    dead-stores get table>> clear-assoc
 
-: eliminate-dead-stores ( insns -- insns' )
-    [ insn# set eliminate-dead-stores* ] map-index sift ;
+    next-ac heap-ac set
+    \ ##vm-field set-new-ac
+    \ ##alien-global set-new-ac ;
 
 : alias-analysis-step ( insns -- insns' )
-    init-alias-analysis
-    analyze-aliases
-    compute-live-stores
-    eliminate-dead-stores ;
+    reset-alias-analysis
+    [ local-live-in [ set-heap-ac ] each ]
+    [ 0 [ [ insn#<< ] [ drop 1 + ] 2bi ] reduce drop ]
+    [ [ analyze-aliases ] map! [ eliminate-dead-stores ] filter! ] tri ;
 
-: alias-analysis ( cfg -- cfg' )
-    [ alias-analysis-step ] local-optimization ;
+: alias-analysis ( cfg -- cfg )
+    init-alias-analysis
+    dup [ alias-analysis-step ] simple-optimization ;
index 60528a61bbdf1f32ba621cd670988bed14c798f7..54cff306ed3c12f4a1ef996c87f71e44b0d42262 100644 (file)
@@ -10,9 +10,9 @@ IN: compiler.cfg.block-joining
 ! before stack analysis.
 : join-block? ( bb -- ? )
     {
-        [ kill-block? not ]
+        [ kill-block?>> not ]
         [ predecessors>> length 1 = ]
-        [ predecessor kill-block? not ]
+        [ predecessor kill-block?>> not ]
         [ predecessor successors>> length 1 = ]
         [ [ predecessor ] keep back-edge? not ]
     } 1&& ;
@@ -21,7 +21,7 @@ IN: compiler.cfg.block-joining
     [ instructions>> ] bi@ dup pop* push-all ;
 
 : update-successors ( bb pred -- )
-    [ successors>> ] dip (>>successors) ;
+    [ successors>> ] dip successors<< ;
 
 : join-block ( bb pred -- )
     [ join-instructions ] [ update-successors ] 2bi ;
index 1daabf6f0efaee6fdb49b0124121ab1f3a2901da..b6cde4d43560783ee6d896c092a59634f2056981 100644 (file)
@@ -1,9 +1,10 @@
-! Copyright (C) 2009 Doug Coleman, Slava Pestov.
+! Copyright (C) 2009, 2010 Doug Coleman, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors combinators.short-circuit kernel math math.order
-sequences assocs namespaces vectors fry arrays splitting
-compiler.cfg.def-use compiler.cfg compiler.cfg.rpo compiler.cfg.predecessors
-compiler.cfg.renaming compiler.cfg.instructions compiler.cfg.utilities ;
+USING: accessors combinators combinators.short-circuit kernel
+math math.order sequences assocs namespaces vectors fry arrays
+splitting compiler.cfg.def-use compiler.cfg compiler.cfg.rpo
+compiler.cfg.predecessors compiler.cfg.renaming
+compiler.cfg.instructions compiler.cfg.utilities ;
 IN: compiler.cfg.branch-splitting
 
 : clone-instructions ( insns -- insns' )
@@ -15,10 +16,12 @@ IN: compiler.cfg.branch-splitting
     ! 'back-edge?' work.
     <basic-block>
         swap
-        [ instructions>> clone-instructions >>instructions ]
-        [ successors>> clone >>successors ]
-        [ number>> >>number ]
-        tri ;
+        {
+            [ instructions>> clone-instructions >>instructions ]
+            [ successors>> clone >>successors ]
+            [ kill-block?>> >>kill-block? ]
+            [ number>> >>number ]
+        } cleave ;
 
 : new-blocks ( bb -- copies )
     dup predecessors>> [
index 670e34e5f9b4282b6b82e75a263781d09c103b4b..a973a3721c4c5441af8ea13db212d7002bb185ba 100644 (file)
@@ -1,73 +1,77 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: namespaces accessors math.order assocs kernel sequences
-combinators make classes words cpu.architecture layouts
+USING: namespaces accessors math math.order assocs kernel
+sequences combinators classes words system fry locals
+cpu.architecture layouts compiler.cfg compiler.cfg.rpo
 compiler.cfg.instructions compiler.cfg.registers
 compiler.cfg.stack-frame ;
 IN: compiler.cfg.build-stack-frame
 
-SYMBOL: frame-required?
+SYMBOLS: param-area-size allot-area-size allot-area-align
+frame-required? ;
 
-GENERIC: compute-stack-frame* ( insn -- )
-
-: request-stack-frame ( stack-frame -- )
-    frame-required? on
-    stack-frame [ max-stack-frame ] change ;
-
-UNION: stack-frame-insn
-    ##alien-invoke
-    ##alien-indirect
-    ##alien-assembly
-    ##alien-callback ;
-
-M: stack-frame-insn compute-stack-frame*
-    stack-frame>> request-stack-frame ;
-
-M: ##call compute-stack-frame* drop frame-required? on ;
-
-M: ##gc compute-stack-frame*
-    frame-required? on
-    stack-frame new
-        swap tagged-values>> length cells >>gc-root-size
-        t >>calls-vm?
-    request-stack-frame ;
-
-M: _spill-area-size compute-stack-frame*
-    n>> stack-frame get (>>spill-area-size) ;
-
-M: insn compute-stack-frame*
-    class frame-required? word-prop [
-        frame-required? on
-    ] when ;
+: frame-required ( -- ) frame-required? on ;
 
-\ _spill t frame-required? set-word-prop
-\ ##unary-float-function t frame-required? set-word-prop
-\ ##binary-float-function t frame-required? set-word-prop
-
-: compute-stack-frame ( insns -- )
-    frame-required? off
-    stack-frame new stack-frame set
-    [ compute-stack-frame* ] each
-    stack-frame get dup stack-frame-size >>total-size drop ;
-
-GENERIC: insert-pro/epilogues* ( insn -- )
-
-M: ##prologue insert-pro/epilogues*
-    drop frame-required? get [ stack-frame get _prologue ] when ;
-
-M: ##epilogue insert-pro/epilogues*
-    drop frame-required? get [ stack-frame get _epilogue ] when ;
-
-M: insn insert-pro/epilogues* , ;
-
-: insert-pro/epilogues ( insns -- insns )
-    [ [ insert-pro/epilogues* ] each ] { } make ;
+GENERIC: compute-stack-frame* ( insn -- )
 
-: build-stack-frame ( mr -- mr )
-    [
-        [
-            [ compute-stack-frame ]
-            [ insert-pro/epilogues ]
-            bi
-        ] change-instructions
-    ] with-scope ;
+M:: ##local-allot compute-stack-frame* ( insn -- )
+    frame-required
+    insn size>> :> s
+    insn align>> :> a
+    allot-area-align [ a max ] change
+    allot-area-size [ a align [ insn offset<< ] [ s + ] bi ] change ;
+
+M: ##stack-frame compute-stack-frame*
+    frame-required
+    stack-frame>> param-area-size [ max ] change ;
+
+: vm-frame-required ( -- )
+    frame-required
+    vm-stack-space param-area-size [ max ] change ;
+
+M: ##call-gc compute-stack-frame* drop vm-frame-required ;
+M: ##box compute-stack-frame* drop vm-frame-required ;
+M: ##unbox compute-stack-frame* drop vm-frame-required ;
+M: ##box-long-long compute-stack-frame* drop vm-frame-required ;
+M: ##begin-callback compute-stack-frame* drop vm-frame-required ;
+M: ##end-callback compute-stack-frame* drop vm-frame-required ;
+M: ##unary-float-function compute-stack-frame* drop vm-frame-required ;
+M: ##binary-float-function compute-stack-frame* drop vm-frame-required ;
+
+M: ##call compute-stack-frame* drop frame-required ;
+M: ##alien-callback compute-stack-frame* drop frame-required ;
+M: ##spill compute-stack-frame* drop frame-required ;
+M: ##reload compute-stack-frame* drop frame-required ;
+
+M: ##float>integer compute-stack-frame*
+    drop integer-float-needs-stack-frame? [ frame-required ] when ;
+
+M: ##integer>float compute-stack-frame*
+    drop integer-float-needs-stack-frame? [ frame-required ] when ;
+
+M: insn compute-stack-frame* drop ;
+
+: finalize-stack-frame ( stack-frame -- )
+    dup [ params>> ] [ allot-area-align>> ] bi align >>allot-area-base
+    dup [ [ allot-area-base>> ] [ allot-area-size>> ] bi + ] [ spill-area-align>> ] bi align >>spill-area-base
+    dup stack-frame-size >>total-size drop ;
+
+: <stack-frame> ( cfg -- stack-frame )
+    [ stack-frame new ] dip
+    [ spill-area-size>> >>spill-area-size ]
+    [ spill-area-align>> >>spill-area-align ] bi
+    allot-area-size get >>allot-area-size
+    allot-area-align get >>allot-area-align
+    param-area-size get >>params
+    dup finalize-stack-frame ;
+
+: compute-stack-frame ( cfg -- stack-frame/f )
+    [ [ instructions>> [ compute-stack-frame* ] each ] each-basic-block ]
+    [ frame-required? get [ <stack-frame> ] [ drop f ] if ]
+    bi ;
+
+: build-stack-frame ( cfg -- cfg )
+    0 param-area-size set
+    0 allot-area-size set
+    cell allot-area-align set
+    dup compute-stack-frame >>stack-frame ;
diff --git a/basis/compiler/cfg/builder/alien/alien.factor b/basis/compiler/cfg/builder/alien/alien.factor
new file mode 100644 (file)
index 0000000..7bf45e9
--- /dev/null
@@ -0,0 +1,198 @@
+! Copyright (C) 2008, 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors assocs arrays layouts math math.order math.parser
+combinators combinators.short-circuit fry make sequences
+sequences.generalizations alien alien.private alien.strings
+alien.c-types alien.libraries classes.struct namespaces kernel
+strings libc locals quotations words cpu.architecture
+compiler.utilities compiler.tree compiler.cfg
+compiler.cfg.builder compiler.cfg.builder.alien.params
+compiler.cfg.builder.alien.boxing compiler.cfg.builder.blocks
+compiler.cfg.instructions compiler.cfg.stack-frame
+compiler.cfg.stacks compiler.cfg.registers compiler.cfg.hats ;
+FROM: compiler.errors => no-such-symbol no-such-library ;
+IN: compiler.cfg.builder.alien
+
+: unbox-parameters ( parameters -- vregs reps )
+    [
+        [ length iota <reversed> ] keep
+        [ [ <ds-loc> ^^peek ] [ base-type ] bi* unbox-parameter ]
+        2 2 mnmap [ concat ] bi@
+    ]
+    [ length neg ##inc-d ] bi ;
+
+: prepare-struct-caller ( vregs reps return -- vregs' reps' return-vreg/f )
+    dup large-struct? [
+        heap-size cell f ^^local-allot [
+            '[ _ prefix ]
+            [ int-rep struct-return-on-stack? 2array prefix ] bi*
+        ] keep
+    ] [ drop f ] if ;
+
+: caller-parameter ( vreg rep on-stack? -- insn )
+    [ dup reg-class-of reg-class-full? ] dip or
+    [ [ alloc-stack-param ] keep \ ##store-stack-param new-insn ]
+    [ [ next-reg-param ] keep \ ##store-reg-param new-insn ]
+    if ;
+
+: (caller-parameters) ( vregs reps -- )
+    ! Place ##store-stack-param instructions first. This ensures
+    ! that no registers are used after the ##store-reg-param
+    ! instructions.
+    [ first2 caller-parameter ] 2map
+    [ ##store-stack-param? ] partition [ % ] bi@ ;
+
+: caller-parameters ( params -- stack-size )
+    [ abi>> ] [ parameters>> ] [ return>> ] tri
+    '[ 
+        _ unbox-parameters
+        _ prepare-struct-caller struct-return-area set
+        (caller-parameters)
+        stack-params get
+        struct-return-area get
+    ] with-param-regs
+    struct-return-area set ;
+
+: box-return* ( node -- )
+    return>> [ ] [ base-type box-return 1 ##inc-d D 0 ##replace ] if-void ;
+
+GENERIC# dlsym-valid? 1 ( symbols dll -- ? )
+
+M: string dlsym-valid? dlsym ;
+
+M: array dlsym-valid? '[ _ dlsym ] any? ;
+
+: check-dlsym ( symbols dll -- )
+    dup dll-valid? [
+        dupd dlsym-valid?
+        [ drop ] [ cfg get word>> no-such-symbol ] if
+    ] [ dll-path cfg get word>> no-such-library drop ] if ;
+
+: decorated-symbol ( params -- symbols )
+    [ function>> ] [ parameters>> [ stack-size ] map-sum number>string ] bi
+    {
+        [ drop ]
+        [ "@" glue ]
+        [ "@" glue "_" prepend ]
+        [ "@" glue "@" prepend ]
+    } 2cleave
+    4array ;
+
+: alien-invoke-dlsym ( params -- symbols dll )
+    [ dup abi>> callee-cleanup? [ decorated-symbol ] [ function>> ] if ]
+    [ library>> load-library ]
+    bi 2dup check-dlsym ;
+
+: alien-node-height ( params -- )
+    [ out-d>> length ] [ in-d>> length ] bi - adjust-d ;
+
+: emit-alien-block ( node quot: ( params -- ) -- )
+    '[
+        make-kill-block
+        params>>
+        _ [ alien-node-height ] bi
+    ] emit-trivial-block ; inline
+
+: emit-stack-frame ( stack-size params -- )
+    [ [ return>> ] [ abi>> ] bi stack-cleanup ##cleanup ]
+    [ drop ##stack-frame ]
+    2bi ;
+
+M: #alien-invoke emit-node
+    [
+        {
+            [ caller-parameters ]
+            [ ##prepare-var-args alien-invoke-dlsym ##alien-invoke ]
+            [ emit-stack-frame ]
+            [ box-return* ]
+        } cleave
+    ] emit-alien-block ;
+
+M:: #alien-indirect emit-node ( node -- )
+    node [
+        D 0 ^^peek -1 ##inc-d ^^unbox-any-c-ptr :> src
+        [ caller-parameters src ##alien-indirect ]
+        [ emit-stack-frame ]
+        [ box-return* ]
+        tri
+    ] emit-alien-block ;
+
+M: #alien-assembly emit-node
+    [
+        {
+            [ caller-parameters ]
+            [ quot>> ##alien-assembly ]
+            [ emit-stack-frame ]
+            [ box-return* ]
+        } cleave
+    ] emit-alien-block ;
+
+: callee-parameter ( rep on-stack? -- dst insn )
+    [ next-vreg dup ] 2dip
+    [ dup reg-class-of reg-class-full? ] dip or
+    [ [ alloc-stack-param ] keep \ ##load-stack-param new-insn ]
+    [ [ next-reg-param ] keep \ ##load-reg-param new-insn ]
+    if ;
+
+: prepare-struct-callee ( c-type -- vreg )
+    large-struct?
+    [ int-rep struct-return-on-stack? callee-parameter , ] [ f ] if ;
+
+: (callee-parameters) ( params -- vregs reps )
+    [ flatten-parameter-type ] map
+    [
+        [ [ first2 callee-parameter ] 1 2 mnmap ] 1 2 mnmap
+        concat [ ##load-reg-param? ] partition [ % ] bi@
+    ]
+    [ [ keys ] map ]
+    bi ;
+
+: box-parameters ( vregs reps params -- )
+    ##begin-callback
+    next-vreg next-vreg ##restore-context
+    [
+        next-vreg next-vreg ##save-context
+        box-parameter
+        1 ##inc-d D 0 ##replace
+    ] 3each ;
+
+: callee-parameters ( params -- stack-size )
+    [ abi>> ] [ return>> ] [ parameters>> ] tri
+    '[ 
+        _ prepare-struct-callee struct-return-area set
+        _ [ base-type ] map [ (callee-parameters) ] [ box-parameters ] bi
+        stack-params get
+        struct-return-area get
+    ] with-param-regs
+    struct-return-area set ;
+
+: callback-stack-cleanup ( stack-size params -- )
+    [ nip xt>> ] [ [ return>> ] [ abi>> ] bi stack-cleanup ] 2bi
+    "stack-cleanup" set-word-prop ;
+
+: needs-frame-pointer ( -- )
+    cfg get t >>frame-pointer? drop ;
+
+M: #alien-callback emit-node
+    dup params>> xt>> dup
+    [
+        needs-frame-pointer
+
+        ##prologue
+        [
+            {
+                [ callee-parameters ]
+                [ quot>> ##alien-callback ]
+                [
+                    return>> [ ##end-callback ] [
+                        [ D 0 ^^peek ] dip
+                        ##end-callback
+                        base-type unbox-return
+                    ] if-void
+                ]
+                [ callback-stack-cleanup ]
+            } cleave
+        ] emit-alien-block
+        ##epilogue
+        ##return
+    ] with-cfg-builder ;
diff --git a/basis/compiler/cfg/builder/alien/boxing/authors.txt b/basis/compiler/cfg/builder/alien/boxing/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/builder/alien/boxing/boxing.factor b/basis/compiler/cfg/builder/alien/boxing/boxing.factor
new file mode 100644 (file)
index 0000000..6f5f46b
--- /dev/null
@@ -0,0 +1,145 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types arrays assocs classes.struct fry
+kernel layouts locals math namespaces sequences
+sequences.generalizations system
+compiler.cfg.builder.alien.params compiler.cfg.hats
+compiler.cfg.instructions cpu.architecture ;
+IN: compiler.cfg.builder.alien.boxing
+
+SYMBOL: struct-return-area
+
+! pairs have shape { rep on-stack? }
+GENERIC: flatten-c-type ( c-type -- pairs )
+
+M: c-type flatten-c-type
+    rep>> f 2array 1array ;
+
+M: long-long-type flatten-c-type
+    drop 2 [ int-rep long-long-on-stack? 2array ] replicate ;
+
+HOOK: flatten-struct-type cpu ( type -- pairs )
+
+M: object flatten-struct-type
+    heap-size cell align cell /i { int-rep f } <repetition> ;
+
+M: struct-c-type flatten-c-type
+    flatten-struct-type ;
+
+: stack-size ( c-type -- n )
+    base-type flatten-c-type keys 0 [ rep-size + ] reduce ;
+
+: component-offsets ( reps -- offsets )
+    0 [ rep-size + ] accumulate nip ;
+
+:: explode-struct ( src c-type -- vregs reps )
+    c-type flatten-struct-type :> reps
+    reps keys dup component-offsets
+    [| rep offset | src offset rep f ^^load-memory-imm ] 2map
+    reps ;
+
+:: implode-struct ( src vregs reps -- )
+    vregs reps dup component-offsets
+    [| vreg rep offset | vreg src offset rep f ##store-memory-imm ] 3each ;
+
+GENERIC: unbox ( src c-type -- vregs reps )
+
+M: c-type unbox
+    [ unboxer>> ] [ rep>> ] bi
+    [ ^^unbox 1array ] [ nip f 2array 1array ] 2bi ;
+
+M: long-long-type unbox
+    [ 8 cell f ^^local-allot ] dip '[ _ unboxer>> ##unbox-long-long ] keep
+    0 cell [ int-rep f ^^load-memory-imm ] bi-curry@ bi 2array
+    int-rep long-long-on-stack? 2array dup 2array ;
+
+M: struct-c-type unbox ( src c-type -- vregs )
+    [ ^^unbox-any-c-ptr ] dip explode-struct ;
+
+: frob-struct ( c-type -- c-type )
+    dup value-struct? [ drop void* base-type ] unless ;
+
+GENERIC: unbox-parameter ( src c-type -- vregs reps )
+
+M: c-type unbox-parameter unbox ;
+
+M: long-long-type unbox-parameter unbox ;
+
+M: struct-c-type unbox-parameter
+    dup value-struct? [ unbox ] [
+        [ nip heap-size cell f ^^local-allot dup ]
+        [ [ ^^unbox-any-c-ptr ] dip explode-struct keys ] 2bi
+        implode-struct
+        1array { { int-rep f } }
+    ] if ;
+
+GENERIC: unbox-return ( src c-type -- )
+
+: store-return ( vregs reps -- )
+    [
+        [ [ next-return-reg ] keep ##store-reg-param ] 2each
+    ] with-return-regs ;
+
+: (unbox-return) ( src c-type -- vregs reps )
+    ! Don't care about on-stack? flag when looking at return
+    ! values.
+    unbox keys ;
+
+M: c-type unbox-return (unbox-return) store-return ;
+
+M: long-long-type unbox-return (unbox-return) store-return ;
+
+M: struct-c-type unbox-return
+    dup return-struct-in-registers?
+    [ (unbox-return) store-return ]
+    [ [ struct-return-area get ] 2dip (unbox-return) implode-struct ] if ;
+
+GENERIC: flatten-parameter-type ( c-type -- reps )
+
+M: c-type flatten-parameter-type flatten-c-type ;
+
+M: long-long-type flatten-parameter-type flatten-c-type ;
+
+M: struct-c-type flatten-parameter-type frob-struct flatten-c-type ;
+
+GENERIC: box ( vregs reps c-type -- dst )
+
+M: c-type box
+    [ first ] [ drop ] [ [ boxer>> ] [ rep>> ] bi ] tri* ^^box ;
+
+M: long-long-type box
+    [ first2 ] [ drop ] [ boxer>> ] tri* ^^box-long-long ;
+
+M: struct-c-type box
+    '[ _ heap-size ^^allot-byte-array dup ^^unbox-byte-array ] 2dip
+    implode-struct ;
+
+GENERIC: box-parameter ( vregs reps c-type -- dst )
+
+M: c-type box-parameter box ;
+
+M: long-long-type box-parameter box ;
+
+M: struct-c-type box-parameter
+    dup value-struct?
+    [ [ [ drop first ] dip explode-struct keys ] keep ] unless
+    box ;
+
+GENERIC: box-return ( c-type -- dst )
+
+: load-return ( c-type -- vregs reps )
+    [
+        flatten-c-type keys
+        [ [ [ next-return-reg ] keep ^^load-reg-param ] map ] keep
+    ] with-return-regs ;
+
+M: c-type box-return [ load-return ] keep box ;
+
+M: long-long-type box-return [ load-return ] keep box ;
+
+M: struct-c-type box-return
+    [
+        dup return-struct-in-registers?
+        [ load-return ]
+        [ [ struct-return-area get ] dip explode-struct keys ] if
+    ] keep box ;
diff --git a/basis/compiler/cfg/builder/alien/params/authors.txt b/basis/compiler/cfg/builder/alien/params/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/builder/alien/params/params.factor b/basis/compiler/cfg/builder/alien/params/params.factor
new file mode 100644 (file)
index 0000000..4509401
--- /dev/null
@@ -0,0 +1,53 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: cpu.architecture fry kernel layouts math math.order
+namespaces sequences vectors assocs ;
+IN: compiler.cfg.builder.alien.params
+
+SYMBOL: stack-params
+
+: alloc-stack-param ( rep -- n )
+    stack-params get
+    [ rep-size cell align stack-params +@ ] dip ;
+
+: ?dummy-stack-params ( rep -- )
+    dummy-stack-params? [ alloc-stack-param drop ] [ drop ] if ;
+
+: ?dummy-int-params ( rep -- )
+    dummy-int-params? [
+        rep-size cell /i 1 max
+        [ int-regs get [ pop* ] unless-empty ] times
+    ] [ drop ] if ;
+
+: ?dummy-fp-params ( rep -- )
+    drop dummy-fp-params? [ float-regs get [ pop* ] unless-empty ] when ;
+
+GENERIC: next-reg-param ( rep -- reg )
+
+M: int-rep next-reg-param
+    [ ?dummy-stack-params ] [ ?dummy-fp-params ] bi
+    int-regs get pop ;
+
+M: float-rep next-reg-param
+    [ ?dummy-stack-params ] [ ?dummy-int-params ] bi
+    float-regs get pop ;
+
+M: double-rep next-reg-param
+    [ ?dummy-stack-params ] [ ?dummy-int-params ] bi
+    float-regs get pop ;
+
+: reg-class-full? ( reg-class -- ? ) get empty? ;
+
+: init-reg-class ( abi reg-class -- )
+    [ swap param-regs at <reversed> >vector ] keep set ;
+
+: init-regs ( regs -- )
+    [ <reversed> >vector swap set ] assoc-each ;
+
+: with-param-regs ( abi quot -- )
+    '[ param-regs init-regs 0 stack-params set @ ] with-scope ; inline
+
+: next-return-reg ( rep -- reg ) reg-class-of get pop ;
+
+: with-return-regs ( quot -- )
+    '[ return-regs init-regs @ ] with-scope ; inline
index 8e96255bdd05c70014576eeb0bd0e344ffe087e6..293c3fe09b21fc63f8cc4a3477ae32a13c2c82e5 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays fry kernel make math namespaces sequences
 compiler.cfg compiler.cfg.instructions compiler.cfg.stacks
@@ -31,6 +31,9 @@ IN: compiler.cfg.builder.blocks
     call
     ##branch begin-basic-block ; inline
 
+: make-kill-block ( -- )
+    basic-block get t >>kill-block? drop ;
+
 : call-height ( #call -- n )
     [ out-d>> length ] [ in-d>> length ] bi - ;
 
@@ -38,6 +41,7 @@ IN: compiler.cfg.builder.blocks
     [
         [ word>> ##call ]
         [ call-height adjust-d ] bi
+        make-kill-block
     ] emit-trivial-block ;
 
 : begin-branch ( -- ) clone-current-height (begin-basic-block) ;
@@ -66,7 +70,7 @@ IN: compiler.cfg.builder.blocks
     [ ] find nip [ second current-height set ] [ end-basic-block ] if* ;
 
 : emit-conditional ( branches -- )
-    ! branchies is a sequence of pairs as above
+    ! branches is a sequence of pairs as above
     end-basic-block
     [ merge-heights begin-basic-block ]
     [ set-successors ]
index 7f1b6aa6f28fa742777184c1718e1f4484d7136f..5d2c5e2e3c3595bed56eb8f5edc7a793188aa80e 100644 (file)
@@ -1,17 +1,19 @@
 USING: tools.test kernel sequences words sequences.private fry
-prettyprint alien alien.accessors math.private compiler.tree.builder
-compiler.tree.optimizer compiler.cfg.builder compiler.cfg.debugger
-compiler.cfg.optimizer compiler.cfg.predecessors compiler.cfg.checker
-compiler.cfg arrays locals byte-arrays kernel.private math
-slots.private vectors sbufs strings math.partial-dispatch
-hashtables assocs combinators.short-circuit
-strings.private accessors compiler.cfg.instructions ;
+prettyprint alien alien.accessors math.private
+compiler.tree.builder compiler.tree.optimizer
+compiler.cfg.builder compiler.cfg.debugger
+compiler.cfg.optimizer compiler.cfg.rpo
+compiler.cfg.predecessors compiler.cfg.checker compiler.cfg
+arrays locals byte-arrays kernel.private math slots.private
+vectors sbufs strings math.partial-dispatch hashtables assocs
+combinators.short-circuit strings.private accessors
+compiler.cfg.instructions compiler.cfg.representations ;
 FROM: alien.c-types => int ;
 IN: compiler.cfg.builder.tests
 
 ! Just ensure that various CFGs build correctly.
-: unit-test-cfg ( quot -- )
-    '[ _ test-cfg [ [ optimize-cfg check-cfg ] with-cfg ] each ] [ ] swap unit-test ;
+: unit-test-builder ( quot -- )
+    '[ _ test-builder [ [ optimize-cfg check-cfg ] with-cfg ] each ] [ ] swap unit-test ;
 
 : blahblah ( nodes -- ? )
     { fixnum } declare [
@@ -68,8 +70,8 @@ IN: compiler.cfg.builder.tests
     [ [ dup ] loop ]
     [ [ 2 ] [ 3 throw ] if 4 ]
     [ int f "malloc" { int } alien-invoke ]
-    [ int { int } "cdecl" alien-indirect ]
-    [ int { int } "cdecl" [ ] alien-callback ]
+    [ int { int } cdecl alien-indirect ]
+    [ int { int } cdecl [ ] alien-callback ]
     [ swap - + * ]
     [ swap slot ]
     [ blahblah ]
@@ -104,7 +106,7 @@ IN: compiler.cfg.builder.tests
         set-string-nth-fast
     ]
 } [
-    unit-test-cfg
+    unit-test-builder
 ] each
 
 : test-1 ( -- ) test-1 ;
@@ -115,7 +117,7 @@ IN: compiler.cfg.builder.tests
     test-1
     test-2
     test-3
-} [ unit-test-cfg ] each
+} [ unit-test-builder ] each
 
 {
     byte-array
@@ -133,8 +135,8 @@ IN: compiler.cfg.builder.tests
         alien-float
         alien-double
     } [| word |
-        { class } word '[ _ declare 10 _ execute ] unit-test-cfg
-        { class fixnum } word '[ _ declare _ execute ] unit-test-cfg
+        { class } word '[ _ declare 10 _ execute ] unit-test-builder
+        { class fixnum } word '[ _ declare _ execute ] unit-test-builder
     ] each
     
     {
@@ -145,23 +147,23 @@ IN: compiler.cfg.builder.tests
         set-alien-unsigned-2
         set-alien-unsigned-4
     } [| word |
-        { fixnum class } word '[ _ declare 10 _ execute ] unit-test-cfg
-        { fixnum class fixnum } word '[ _ declare _ execute ] unit-test-cfg
+        { fixnum class } word '[ _ declare 10 _ execute ] unit-test-builder
+        { fixnum class fixnum } word '[ _ declare _ execute ] unit-test-builder
     ] each
     
-    { float class } \ set-alien-float '[ _ declare 10 _ execute ] unit-test-cfg
-    { float class fixnum } \ set-alien-float '[ _ declare _ execute ] unit-test-cfg
+    { float class } \ set-alien-float '[ _ declare 10 _ execute ] unit-test-builder
+    { float class fixnum } \ set-alien-float '[ _ declare _ execute ] unit-test-builder
     
-    { float class } \ set-alien-double '[ _ declare 10 _ execute ] unit-test-cfg
-    { float class fixnum } \ set-alien-double '[ _ declare _ execute ] unit-test-cfg
+    { float class } \ set-alien-double '[ _ declare 10 _ execute ] unit-test-builder
+    { float class fixnum } \ set-alien-double '[ _ declare _ execute ] unit-test-builder
     
-    { pinned-c-ptr class } \ set-alien-cell '[ _ declare 10 _ execute ] unit-test-cfg
-    { pinned-c-ptr class fixnum } \ set-alien-cell '[ _ declare _ execute ] unit-test-cfg
+    { pinned-c-ptr class } \ set-alien-cell '[ _ declare 10 _ execute ] unit-test-builder
+    { pinned-c-ptr class fixnum } \ set-alien-cell '[ _ declare _ execute ] unit-test-builder
 ] each
 
 : count-insns ( quot insn-check -- ? )
-    [ test-mr [ instructions>> ] map ] dip
-    '[ _ count ] map-sum ; inline
+    [ test-regs [ post-order [ instructions>> ] map concat ] map concat ] dip
+    count ; inline
 
 : contains-insn? ( quot insn-check -- ? )
     count-insns 0 > ; inline
@@ -172,17 +174,29 @@ IN: compiler.cfg.builder.tests
 
 [ t ] [
     [ { fixnum byte-array fixnum } declare set-alien-unsigned-1 ]
-    [ ##set-alien-integer-1? ] contains-insn?
+    [ [ ##store-memory? ] [ ##store-memory-imm? ] bi or ] contains-insn?
 ] unit-test
 
 [ t ] [
     [ { fixnum byte-array fixnum } declare [ dup * dup * ] 2dip set-alien-unsigned-1 ]
-    [ ##set-alien-integer-1? ] contains-insn?
+    [ [ ##store-memory? ] [ ##store-memory-imm? ] bi or ] contains-insn?
 ] unit-test
 
 [ f ] [
     [ { byte-array fixnum } declare set-alien-unsigned-1 ]
-    [ ##set-alien-integer-1? ] contains-insn?
+    [ [ ##store-memory? ] [ ##store-memory-imm? ] bi or ] contains-insn?
+] unit-test
+
+[ t t ] [
+    [ { byte-array fixnum } declare alien-cell ]
+    [ [ [ ##load-memory? ] [ ##load-memory-imm? ] bi or ] contains-insn? ]
+    [ [ ##box-alien? ] contains-insn? ]
+    bi
+] unit-test
+
+[ f ] [
+    [ { byte-array integer } declare alien-cell ]
+    [ [ ##load-memory? ] [ ##load-memory-imm? ] bi or ] contains-insn?
 ] unit-test
 
 [ f ] [
@@ -209,7 +223,7 @@ IN: compiler.cfg.builder.tests
         [ [ ##allot? ] contains-insn? ] bi
     ] unit-test
     
-    [ 1 ] [ [ dup float+ ] [ ##alien-double? ] count-insns ] unit-test
+    [ 1 ] [ [ dup float+ ] [ ##load-memory-imm? ] count-insns ] unit-test
 ] when
 
 ! Regression. Make sure everything is inlined correctly
index 529c3b5ae6540c5357b2534944d918b289d1c054..c6d541460ab0ca1003e8e10d6510685c3f584504 100644 (file)
@@ -19,8 +19,7 @@ compiler.cfg.instructions
 compiler.cfg.predecessors
 compiler.cfg.builder.blocks
 compiler.cfg.stacks
-compiler.cfg.stacks.local
-compiler.alien ;
+compiler.cfg.stacks.local ;
 IN: compiler.cfg.builder
 
 ! Convert tree SSA IR to CFG IR. The result is not in SSA form; this is
@@ -57,6 +56,7 @@ GENERIC: emit-node ( node -- )
     [ basic-block get [ emit-node ] [ drop ] if ] each ;
 
 : begin-word ( -- )
+    make-kill-block
     ##prologue
     ##branch
     begin-basic-block ;
@@ -82,8 +82,12 @@ GENERIC: emit-node ( node -- )
 : emit-call ( word height -- )
     over loops get key?
     [ drop loops get at emit-loop-call ]
-    [ [ [ ##call ] [ adjust-d ] bi* ] emit-trivial-block ]
-    if ;
+    [
+        [
+            [ ##call ] [ adjust-d ] bi*
+            make-kill-block
+        ] emit-trivial-block
+    ] if ;
 
 ! #recursive
 : recursive-height ( #recursive -- n )
@@ -123,7 +127,7 @@ M: #recursive emit-node
     and ;
 
 : emit-trivial-if ( -- )
-    ds-pop \ f type-number cc/= ^^compare-imm ds-push ;
+    [ f cc/= ^^compare-imm ] unary-op ;
 
 : trivial-not-if? ( #if -- ? )
     children>> first2
@@ -132,12 +136,12 @@ M: #recursive emit-node
     and ;
 
 : emit-trivial-not-if ( -- )
-    ds-pop \ f type-number cc= ^^compare-imm ds-push ;
+    [ f cc= ^^compare-imm ] unary-op ;
 
 : emit-actual-if ( #if -- )
     ! Inputs to the final instruction need to be copied because of
     ! loc>vreg sync
-    ds-pop any-rep ^^copy \ f type-number cc/= ##compare-imm-branch emit-if ;
+    ds-pop any-rep ^^copy f cc/= ##compare-imm-branch emit-if ;
 
 M: #if emit-node
     {
@@ -195,7 +199,11 @@ M: #shuffle emit-node
 
 ! #return
 : emit-return ( -- )
-    ##branch begin-basic-block ##epilogue ##return ;
+    ##branch
+    begin-basic-block
+    make-kill-block
+    ##epilogue
+    ##return ;
 
 M: #return emit-node drop emit-return ;
 
@@ -205,49 +213,6 @@ M: #return-recursive emit-node
 ! #terminate
 M: #terminate emit-node drop ##no-tco end-basic-block ;
 
-! FFI
-: return-size ( ctype -- n )
-    #! Amount of space we reserve for a return value.
-    {
-        { [ dup c-struct? not ] [ drop 0 ] }
-        { [ dup large-struct? not ] [ drop 2 cells ] }
-        [ heap-size ]
-    } cond ;
-
-: <alien-stack-frame> ( params -- stack-frame )
-    stack-frame new
-        swap
-        [ return>> return-size >>return ]
-        [ alien-parameters parameter-offsets drop >>params ] bi
-        t >>calls-vm? ;
-
-: alien-node-height ( params -- )
-    [ out-d>> length ] [ in-d>> length ] bi - adjust-d ;
-
-: emit-alien-node ( node quot -- )
-    [
-        [ params>> dup dup <alien-stack-frame> ] dip call
-        alien-node-height
-    ] emit-trivial-block ; inline
-
-M: #alien-invoke emit-node
-    [ ##alien-invoke ] emit-alien-node ;
-
-M: #alien-indirect emit-node
-    [ ##alien-indirect ] emit-alien-node ;
-
-M: #alien-assembly emit-node
-    [ ##alien-assembly ] emit-alien-node ;
-
-M: #alien-callback emit-node
-    dup params>> xt>> dup
-    [
-        ##prologue
-        [ ##alien-callback ] emit-alien-node
-        ##epilogue
-        ##return
-    ] with-cfg-builder ;
-
 ! No-op nodes
 M: #introduce emit-node drop ;
 
index 5d815e3b0f06b79edb1fce4524d077ebc5c3f3a2..7fde6c137149911d2211a08433fafa55e7306663 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel math vectors arrays accessors namespaces ;
 IN: compiler.cfg
@@ -8,7 +8,9 @@ TUPLE: basic-block < identity-tuple
 number
 { instructions vector }
 { successors vector }
-{ predecessors vector } ;
+{ predecessors vector }
+{ kill-block? boolean }
+{ unlikely? boolean } ;
 
 : <basic-block> ( -- bb )
     basic-block new
@@ -20,7 +22,9 @@ number
 M: basic-block hashcode* nip id>> ;
 
 TUPLE: cfg { entry basic-block } word label
-spill-area-size reps
+spill-area-size spill-area-align
+stack-frame
+frame-pointer?
 post-order linear-order
 predecessors-valid? dominance-valid? loops-valid? ;
 
@@ -39,13 +43,5 @@ predecessors-valid? dominance-valid? loops-valid? ;
 : predecessors-changed ( cfg -- cfg )
     f >>predecessors-valid? ;
 
-: with-cfg ( cfg quot: ( cfg -- ) -- )
+: with-cfg ( ..a cfg quot: ( ..a cfg -- ..b ) -- ..b )
     [ dup cfg ] dip with-variable ; inline
-
-TUPLE: mr { instructions array } word label ;
-
-: <mr> ( instructions word label -- mr )
-    mr new
-        swap >>label
-        swap >>word
-        swap >>instructions ;
index d6f2702ee79873a868b3b67327d8216ec9683737..f4fee8b7b229172a4254b2973a77762fce4c27e0 100644 (file)
@@ -3,72 +3,15 @@
 USING: kernel combinators.short-circuit accessors math sequences
 sets assocs compiler.cfg.instructions compiler.cfg.rpo
 compiler.cfg.def-use compiler.cfg.linearization
-compiler.cfg.utilities compiler.cfg.mr compiler.utilities ;
+compiler.cfg.utilities compiler.cfg.finalization
+compiler.utilities ;
 IN: compiler.cfg.checker
 
-! Check invariants
-
-ERROR: bad-kill-block bb ;
-
-: check-kill-block ( bb -- )
-    dup instructions>> dup penultimate ##epilogue? [
-        {
-            [ length 2 = ]
-            [ last { [ ##return? ] [ ##jump? ] } 1|| ]
-        } 1&&
-    ] [ last ##branch? ] if
-    [ drop ] [ bad-kill-block ] if ;
-
-ERROR: last-insn-not-a-jump bb ;
-
-: check-last-instruction ( bb -- )
-    dup instructions>> last {
-        [ ##branch? ]
-        [ ##dispatch? ]
-        [ ##compare-branch? ]
-        [ ##compare-imm-branch? ]
-        [ ##compare-float-ordered-branch? ]
-        [ ##compare-float-unordered-branch? ]
-        [ ##fixnum-add? ]
-        [ ##fixnum-sub? ]
-        [ ##fixnum-mul? ]
-        [ ##no-tco? ]
-    } 1|| [ drop ] [ last-insn-not-a-jump ] if ;
-
-ERROR: bad-kill-insn bb ;
-
-: check-kill-instructions ( bb -- )
-    dup instructions>> [ kill-vreg-insn? ] any?
-    [ bad-kill-insn ] [ drop ] if ;
-
-: check-normal-block ( bb -- )
-    [ check-last-instruction ]
-    [ check-kill-instructions ]
-    bi ;
-
 ERROR: bad-successors ;
 
 : check-successors ( bb -- )
     dup successors>> [ predecessors>> member-eq? ] with all?
     [ bad-successors ] unless ;
 
-: check-basic-block ( bb -- )
-    [ dup kill-block? [ check-kill-block ] [ check-normal-block ] if ]
-    [ check-successors ]
-    bi ;
-
-ERROR: bad-live-in ;
-
-ERROR: undefined-values uses defs ;
-
-: check-mr ( mr -- )
-    ! Check that every used register has a definition
-    instructions>>
-    [ [ uses-vregs ] map concat ]
-    [ [ [ temp-vregs ] [ defs-vreg ] bi [ suffix ] when* ] map concat ] bi
-    2dup subset? [ 2drop ] [ undefined-values ] if ;
-
 : check-cfg ( cfg -- )
-    [ [ check-basic-block ] each-basic-block ]
-    [ build-mr check-mr ]
-    bi ;
+    [ check-successors ] each-basic-block ;
index 35f25c2d40417ee2ebff7b76b7106414f6a5c3ac..019bfd7a7456f801033d38e18e0aa49299cdc993 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: assocs math.order sequences ;
 IN: compiler.cfg.comparisons
@@ -12,6 +12,8 @@ SYMBOLS:
 SYMBOLS:
     vcc-all vcc-notall vcc-any vcc-none ;
 
+SYMBOLS: cc-o cc/o ;
+
 : negate-cc ( cc -- cc' )
     H{
         { cc<    cc/<   }
@@ -28,6 +30,8 @@ SYMBOLS:
         { cc/=   cc=    } 
         { cc/<>  cc<>   } 
         { cc/<>= cc<>=  }
+        { cc-o   cc/o   }
+        { cc/o   cc-o   }
     } at ;
 
 : negate-vcc ( cc -- cc' )
diff --git a/basis/compiler/cfg/copy-prop/copy-prop-tests.factor b/basis/compiler/cfg/copy-prop/copy-prop-tests.factor
new file mode 100644 (file)
index 0000000..8464118
--- /dev/null
@@ -0,0 +1,107 @@
+USING: compiler.cfg.copy-prop tools.test namespaces kernel
+compiler.cfg.debugger compiler.cfg accessors
+compiler.cfg.registers compiler.cfg.instructions
+cpu.architecture ;
+IN: compiler.cfg.copy-prop.tests
+
+: test-copy-propagation ( -- )
+    cfg new 0 get >>entry copy-propagation drop ;
+
+! Simple example
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##peek f 0 D 0 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##peek f 1 D 1 }
+    T{ ##branch }
+} 2 test-bb
+
+V{
+    T{ ##copy f 2 0 any-rep }
+    T{ ##branch }
+} 3 test-bb
+
+V{
+    T{ ##phi f 3 H{ { 2 0 } { 3 2 } } }
+    T{ ##phi f 4 H{ { 2 1 } { 3 2 } } }
+    T{ ##phi f 5 H{ { 2 1 } { 3 0 } } }
+    T{ ##branch }
+} 4 test-bb
+
+V{
+    T{ ##copy f 6 4 any-rep }
+    T{ ##replace f 3 D 0 }
+    T{ ##replace f 5 D 1 }
+    T{ ##replace f 6 D 2 }
+    T{ ##branch }
+} 5 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 6 test-bb
+
+0 1 edge
+1 { 2 3 } edges
+2 4 edge
+3 4 edge
+4 5 edge
+
+[ ] [ test-copy-propagation ] unit-test
+
+[
+    V{
+        T{ ##replace f 0 D 0 }
+        T{ ##replace f 4 D 1 }
+        T{ ##replace f 4 D 2 }
+        T{ ##branch }
+    }
+] [ 5 get instructions>> ] unit-test
+
+! Test optimistic assumption
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##peek f 0 D 0 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##phi f 1 H{ { 1 0 } { 2 2 } } }
+    T{ ##copy f 2 1 any-rep }
+    T{ ##branch }
+} 2 test-bb
+
+V{
+    T{ ##replace f 2 D 1 }
+    T{ ##branch }
+} 3 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 4 test-bb
+
+0 1 edge
+1 2 edge
+2 { 2 3 } edges
+3 4 edge
+
+[ ] [ test-copy-propagation ] unit-test
+
+[
+    V{
+        T{ ##replace f 0 D 1 }
+        T{ ##branch }
+    }
+] [ 3 get instructions>> ] unit-test
index 23382c3dbecd22c762bac9395cc73280b1d2d574..e18c0fa792be14358fcab76e1bc6eebef2c88d71 100644 (file)
@@ -1,78 +1,90 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel namespaces assocs accessors sequences grouping
-combinators compiler.cfg.rpo compiler.cfg.renaming
-compiler.cfg.instructions compiler.cfg.predecessors ;
+USING: sets kernel namespaces assocs accessors sequences grouping
+combinators fry compiler.cfg.def-use compiler.cfg.rpo
+compiler.cfg.renaming compiler.cfg.instructions
+compiler.cfg.predecessors ;
+FROM: namespaces => set ;
 IN: compiler.cfg.copy-prop
 
-! The first three definitions are also used in compiler.cfg.alias-analysis.
+<PRIVATE
+
+SYMBOL: changed?
+
 SYMBOL: copies
 
-! Initialized per-basic-block; a mapping from inputs to dst for eliminating
-! redundant phi instructions
+! Initialized per-basic-block; a mapping from inputs to dst for
+! eliminating redundant ##phi instructions
 SYMBOL: phis
 
 : resolve ( vreg -- vreg )
-    copies get ?at drop ;
-
-: (record-copy) ( dst src -- )
-    swap copies get set-at ; inline
+    copies get at ;
 
-: record-copy ( ##copy -- )
-    [ dst>> ] [ src>> resolve ] bi (record-copy) ; inline
-
-<PRIVATE
+: record-copy ( dst src -- )
+    swap copies get maybe-set-at [ changed? on ] when ; inline
 
 GENERIC: visit-insn ( insn -- )
 
-M: ##copy visit-insn record-copy ;
+M: ##copy visit-insn
+    [ dst>> ] [ src>> resolve ] bi
+    dup [ record-copy ] [ 2drop ] if ;
 
-: useless-phi ( dst inputs -- ) first (record-copy) ;
+: useless-phi ( dst inputs -- ) first record-copy ;
 
-: redundant-phi ( dst inputs -- ) phis get at (record-copy) ;
+: redundant-phi ( dst inputs -- ) phis get at record-copy ;
 
-: record-phi ( dst inputs -- ) phis get set-at ;
+: record-phi ( dst inputs -- )
+    [ phis get set-at ] [ drop dup record-copy ] 2bi ;
 
 M: ##phi visit-insn
     [ dst>> ] [ inputs>> values [ resolve ] map ] bi
-    {
-        { [ dup all-equal? ] [ useless-phi ] }
-        { [ dup phis get key? ] [ redundant-phi ] }
-        [ record-phi ]
-    } cond ;
+    dup phis get key? [ redundant-phi ] [
+        dup sift
+        dup all-equal?
+        [ nip useless-phi ]
+        [ drop record-phi ] if
+    ] if ;
+
+M: vreg-insn visit-insn
+    defs-vreg [ dup record-copy ] when* ;
 
 M: insn visit-insn drop ;
 
-: collect-copies ( cfg -- )
-    H{ } clone copies set
+: (collect-copies) ( cfg -- )
     [
-        H{ } clone phis set
+        phis get clear-assoc
         instructions>> [ visit-insn ] each
     ] each-basic-block ;
 
+: collect-copies ( cfg -- )
+    H{ } clone copies set
+    H{ } clone phis set
+    '[
+        changed? off
+        _ (collect-copies)
+        changed? get
+    ] loop ;
+
 GENERIC: update-insn ( insn -- keep? )
 
 M: ##copy update-insn drop f ;
 
 M: ##phi update-insn
-    dup dst>> copies get key? [ drop f ] [ call-next-method ] if ;
+    dup call-next-method drop
+    [ dst>> ] [ inputs>> values ] bi [ = not ] with any? ;
+
+M: vreg-insn update-insn rename-insn-uses t ;
 
-M: insn update-insn rename-insn-uses t ;
+M: insn update-insn drop t ;
 
 : rename-copies ( cfg -- )
-    copies get dup assoc-empty? [ 2drop ] [
-        renamings set
-        [
-            instructions>> [ update-insn ] filter! drop
-        ] each-basic-block
-    ] if ;
+    copies get renamings set
+    [ [ update-insn ] filter! ] simple-optimization ;
 
 PRIVATE>
 
 : copy-propagation ( cfg -- cfg' )
     needs-predecessors
 
-    [ collect-copies ]
-    [ rename-copies ]
-    [ ]
-    tri ;
+    dup collect-copies
+    dup rename-copies ;
index dde44fd15ddcfe8306242491e040274f2fa06c0e..553b84383334cbd60bca6567c2caf8895d03a503 100644 (file)
@@ -18,27 +18,21 @@ MIXIN: dataflow-analysis
 : <dfa-worklist> ( cfg dfa -- queue )
     block-order <hashed-dlist> [ push-all-front ] keep ;
 
-GENERIC# compute-in-set 2 ( bb out-sets dfa -- set )
-
-M: kill-block compute-in-set 3drop f ;
-
-M:: basic-block compute-in-set ( bb out-sets dfa -- set )
+:: compute-in-set ( bb out-sets dfa -- set )
     ! Only consider initialized sets.
-    bb dfa predecessors
-    [ out-sets key? ] filter
-    [ out-sets at ] map
-    bb dfa join-sets ;
+    bb kill-block?>> [ f ] [
+        bb dfa predecessors
+        [ out-sets key? ] filter
+        [ out-sets at ] map
+        bb dfa join-sets
+    ] if ;
 
 :: update-in-set ( bb in-sets out-sets dfa -- ? )
     bb out-sets dfa compute-in-set
     bb in-sets maybe-set-at ; inline
 
-GENERIC# compute-out-set 2 ( bb out-sets dfa -- set )
-
-M: kill-block compute-out-set 3drop f ;
-
-M:: basic-block compute-out-set ( bb in-sets dfa -- set )
-    bb in-sets at bb dfa transfer-set ;
+:: compute-out-set ( bb in-sets dfa -- set )
+    bb kill-block?>> [ f ] [ bb in-sets at bb dfa transfer-set ] if ;
 
 :: update-out-set ( bb in-sets out-sets dfa -- ? )
     bb in-sets dfa compute-out-set
index 6a7ef08257a0ed0a34bd60877f7138e3ba0ed7f3..460d1a53d1c18b14356c4426ca509560e56392af 100644 (file)
@@ -11,41 +11,41 @@ IN: compiler.cfg.dce.tests
     entry>> instructions>> ; 
 
 [ V{
-    T{ ##load-immediate { dst 1 } { val 8 } }
-    T{ ##load-immediate { dst 2 } { val 16 } }
+    T{ ##load-integer { dst 1 } { val 8 } }
+    T{ ##load-integer { dst 2 } { val 16 } }
     T{ ##add { dst 3 } { src1 1 } { src2 2 } }
     T{ ##replace { src 3 } { loc D 0 } }
 } ] [ V{
-    T{ ##load-immediate { dst 1 } { val 8 } }
-    T{ ##load-immediate { dst 2 } { val 16 } }
+    T{ ##load-integer { dst 1 } { val 8 } }
+    T{ ##load-integer { dst 2 } { val 16 } }
     T{ ##add { dst 3 } { src1 1 } { src2 2 } }
     T{ ##replace { src 3 } { loc D 0 } }
 } test-dce ] unit-test
 
 [ V{ } ] [ V{
-    T{ ##load-immediate { dst 1 } { val 8 } }
-    T{ ##load-immediate { dst 2 } { val 16 } }
+    T{ ##load-integer { dst 1 } { val 8 } }
+    T{ ##load-integer { dst 2 } { val 16 } }
     T{ ##add { dst 3 } { src1 1 } { src2 2 } }
 } test-dce ] unit-test
 
 [ V{ } ] [ V{
-    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##load-integer { dst 3 } { val 8 } }
     T{ ##allot { dst 1 } { temp 2 } }
 } test-dce ] unit-test
 
 [ V{ } ] [ V{
-    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##load-integer { dst 3 } { val 8 } }
     T{ ##allot { dst 1 } { temp 2 } }
     T{ ##set-slot-imm { obj 1 } { src 3 } }
 } test-dce ] unit-test
 
 [ V{
-    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##load-integer { dst 3 } { val 8 } }
     T{ ##allot { dst 1 } { temp 2 } }
     T{ ##set-slot-imm { obj 1 } { src 3 } }
     T{ ##replace { src 1 } { loc D 0 } }
 } ] [ V{
-    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##load-integer { dst 3 } { val 8 } }
     T{ ##allot { dst 1 } { temp 2 } }
     T{ ##set-slot-imm { obj 1 } { src 3 } }
     T{ ##replace { src 1 } { loc D 0 } }
@@ -62,11 +62,11 @@ IN: compiler.cfg.dce.tests
 [ V{
     T{ ##allot { dst 1 } { temp 2 } }
     T{ ##replace { src 1 } { loc D 0 } }
-    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##load-integer { dst 3 } { val 8 } }
     T{ ##set-slot-imm { obj 1 } { src 3 } }
 } ] [ V{
     T{ ##allot { dst 1 } { temp 2 } }
     T{ ##replace { src 1 } { loc D 0 } }
-    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##load-integer { dst 3 } { val 8 } }
     T{ ##set-slot-imm { obj 1 } { src 3 } }
 } test-dce ] unit-test
index 03a43d0ab7860f641d633e583719946a530bc055..c6b3819fb06d1aeae4e872387336a52a1892838c 100644 (file)
@@ -1,8 +1,9 @@
 ! Copyright (C) 2008, 2009 Slava Pestov, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs sets kernel namespaces sequences
+USING: accessors assocs kernel namespaces sequences
 compiler.cfg.instructions compiler.cfg.def-use
-compiler.cfg.rpo compiler.cfg.predecessors ;
+compiler.cfg.rpo compiler.cfg.predecessors hash-sets sets ;
+FROM: namespaces => set ;
 IN: compiler.cfg.dce
 
 ! Maps vregs to sequences of vregs
@@ -12,18 +13,18 @@ SYMBOL: liveness-graph
 SYMBOL: live-vregs
 
 : live-vreg? ( vreg -- ? )
-    live-vregs get key? ;
+    live-vregs get in? ;
 
 ! vregs which are the result of an allocation
 SYMBOL: allocations
 
 : allocation? ( vreg -- ? )
-    allocations get key? ;
+    allocations get in? ;
 
 : init-dead-code ( -- )
     H{ } clone liveness-graph set
-    H{ } clone live-vregs set
-    H{ } clone allocations set ;
+    HS{ } clone live-vregs set
+    HS{ } clone allocations set ;
 
 GENERIC: build-liveness-graph ( insn -- )
 
@@ -46,17 +47,19 @@ M: ##write-barrier-imm build-liveness-graph
     dup src>> setter-liveness-graph ;
 
 M: ##allot build-liveness-graph
-    [ dst>> allocations get conjoin ] [ call-next-method ] bi ;
+    [ dst>> allocations get adjoin ] [ call-next-method ] bi ;
 
-M: insn build-liveness-graph
+M: vreg-insn build-liveness-graph
     dup defs-vreg dup [ add-edges ] [ 2drop ] if ;
 
+M: insn build-liveness-graph drop ;
+
 GENERIC: compute-live-vregs ( insn -- )
 
 : (record-live) ( vregs -- )
     [
-        dup live-vregs get key? [ drop ] [
-            [ live-vregs get conjoin ]
+        dup live-vreg? [ drop ] [
+            [ live-vregs get adjoin ]
             [ liveness-graph get at (record-live) ]
             bi
         ] if
@@ -86,9 +89,11 @@ M: ##fixnum-sub compute-live-vregs record-live ;
 
 M: ##fixnum-mul compute-live-vregs record-live ;
 
-M: insn compute-live-vregs
+M: vreg-insn compute-live-vregs
     dup defs-vreg [ drop ] [ record-live ] if ;
 
+M: insn compute-live-vregs drop ;
+
 GENERIC: live-insn? ( insn -- ? )
 
 M: ##set-slot live-insn? obj>> live-vreg? ;
@@ -105,7 +110,9 @@ M: ##fixnum-sub live-insn? drop t ;
 
 M: ##fixnum-mul live-insn? drop t ;
 
-M: insn live-insn? defs-vreg [ live-vreg? ] [ t ] if* ;
+M: vreg-insn live-insn? defs-vreg [ live-vreg? ] [ t ] if* ;
+
+M: insn live-insn? defs-vreg drop t ;
 
 : eliminate-dead-code ( cfg -- cfg' )
     ! Even though we don't use predecessors directly, we depend
@@ -115,7 +122,7 @@ M: insn live-insn? defs-vreg [ live-vreg? ] [ t ] if* ;
 
     init-dead-code
     dup
-    [ [ instructions>> [ build-liveness-graph ] each ] each-basic-block ]
-    [ [ instructions>> [ compute-live-vregs ] each ] each-basic-block ]
-    [ [ instructions>> [ live-insn? ] filter! drop ] each-basic-block ]
+    [ [ [ build-liveness-graph ] each ] simple-analysis ]
+    [ [ [ compute-live-vregs ] each ] simple-analysis ]
+    [ [ [ live-insn? ] filter! ] simple-optimization ]
     tri ;
index d4e8c5401a4c8ef3024fe746349dae0fab033332..dc0be45cc0687f1b8307ca411a80b6b735026656 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel words sequences quotations namespaces io vectors
 arrays hashtables classes.tuple accessors prettyprint
@@ -7,45 +7,87 @@ prettyprint.sections parser compiler.tree.builder
 compiler.tree.optimizer cpu.architecture compiler.cfg.builder
 compiler.cfg.linearization compiler.cfg.registers
 compiler.cfg.stack-frame compiler.cfg.linear-scan
-compiler.cfg.optimizer compiler.cfg.instructions
-compiler.cfg.utilities compiler.cfg.def-use compiler.cfg.rpo
-compiler.cfg.mr compiler.cfg.representations.preferred
-compiler.cfg ;
+compiler.cfg.optimizer compiler.cfg.finalization
+compiler.cfg.instructions compiler.cfg.utilities
+compiler.cfg.def-use compiler.cfg.rpo
+compiler.cfg.representations compiler.cfg.gc-checks
+compiler.cfg.save-contexts compiler.cfg
+compiler.cfg.representations.preferred ;
+FROM: compiler.cfg.linearization => number-blocks ;
 IN: compiler.cfg.debugger
 
-GENERIC: test-cfg ( quot -- cfgs )
+GENERIC: test-builder ( quot -- cfgs )
 
-M: callable test-cfg
+M: callable test-builder
     0 vreg-counter set-global
     build-tree optimize-tree gensym build-cfg ;
 
-M: word test-cfg
+M: word test-builder
     0 vreg-counter set-global
     [ build-tree optimize-tree ] keep build-cfg ;
 
-: test-mr ( quot -- mrs )
-    test-cfg [
+: test-optimizer ( quot -- cfgs )
+    test-builder [ [ optimize-cfg ] with-cfg ] map ;
+
+: test-ssa ( quot -- cfgs )
+    test-builder [
         [
             optimize-cfg
-            build-mr
         ] with-cfg
     ] map ;
 
-: insn. ( insn -- )
-    tuple>array but-last [ pprint bl ] each nl ;
+: test-flat ( quot -- cfgs )
+    test-builder [
+        [
+            optimize-cfg
+            select-representations
+            insert-gc-checks
+            insert-save-contexts
+        ] with-cfg
+    ] map ;
 
-: mr. ( mrs -- )
+: test-regs ( quot -- cfgs )
+    test-builder [
+        [
+            optimize-cfg
+            finalize-cfg
+        ] with-cfg
+    ] map ;
+
+GENERIC: insn. ( insn -- )
+
+M: ##phi insn.
+    clone [ [ [ number>> ] dip ] assoc-map ] change-inputs
+    call-next-method ;
+
+M: insn insn. tuple>array but-last [ bl ] [ pprint ] interleave nl ;
+
+: block. ( bb -- )
+    "=== Basic block #" write dup block-number . nl
+    dup instructions>> [ insn. ] each nl
+    successors>> [
+        "Successors: " write
+        [ block-number unparse ] map ", " join print nl
+    ] unless-empty ;
+
+: cfg. ( cfg -- )
     [
+        dup linearization-order number-blocks
         "=== word: " write
         dup word>> pprint
         ", label: " write
         dup label>> pprint nl nl
-        instructions>> [ insn. ] each
-        nl
-    ] each ;
+        dup linearization-order [ block. ] each
+        "=== stack frame: " write
+        stack-frame>> .
+    ] with-scope ;
+
+: cfgs. ( cfgs -- )
+    [ nl ] [ cfg. ] interleave ;
 
-: test-mr. ( quot -- )
-    test-mr mr. ; inline
+: ssa. ( quot -- ) test-ssa cfgs. ;
+: flat. ( quot -- ) test-flat cfgs. ;
+: regs. ( quot -- ) test-regs cfgs. ;
 
 ! Prettyprinting
 : pprint-loc ( loc word -- ) <block pprint-word n>> pprint* block> ;
index 54cff2ccaa7aeb3bcac9c5321b223c3e57f601f8..a2a0b2d8be41bbd2b1e0c9cffccf80dc42a55ec3 100644 (file)
@@ -1,10 +1,12 @@
-! Copyright (C) 2008, 2009 Slava Pestov, Daniel Ehrenberg.
+! Copyright (C) 2008, 2010 Slava Pestov, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs arrays classes combinators
-compiler.units fry generalizations generic kernel locals
-namespaces quotations sequences sets slots words
-compiler.cfg.instructions compiler.cfg.instructions.syntax
+compiler.units fry generalizations sequences.generalizations
+generic kernel locals namespaces quotations sequences sets slots
+words compiler.cfg.instructions compiler.cfg.instructions.syntax
 compiler.cfg.rpo ;
+FROM: namespaces => set ;
+FROM: sets => members ;
 IN: compiler.cfg.def-use
 
 GENERIC: defs-vreg ( insn -- vreg/f )
@@ -94,9 +96,9 @@ SYMBOLS: defs insns uses ;
     cfg [| block |
         block instructions>> [
             dup ##phi?
-            [ inputs>> [ use conjoin-at ] assoc-each ]
-            [ uses-vregs [ block swap use conjoin-at ] each ]
+            [ inputs>> [ use adjoin-at ] assoc-each ]
+            [ uses-vregs [ block swap use adjoin-at ] each ]
             if
         ] each
     ] each-basic-block
-    use [ keys ] assoc-map uses set ;
+    use [ members ] assoc-map uses set ;
diff --git a/basis/compiler/cfg/dependence/dependence.factor b/basis/compiler/cfg/dependence/dependence.factor
new file mode 100644 (file)
index 0000000..ff9b822
--- /dev/null
@@ -0,0 +1,169 @@
+! Copyright (C) 2009, 2010 Daniel Ehrenberg.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors assocs combinators compiler.cfg.def-use
+compiler.cfg.instructions compiler.cfg.registers fry kernel
+locals namespaces sequences sets sorting math.vectors
+make math combinators.short-circuit vectors ;
+FROM: namespaces => set ;
+IN: compiler.cfg.dependence
+
+! Dependence graph construction
+
+SYMBOL: roots
+SYMBOL: node-number
+SYMBOL: nodes
+
+SYMBOL: +data+
+SYMBOL: +control+
+
+! Nodes in the dependency graph
+! These need to be numbered so that the same instruction
+! will get distinct nodes if it occurs multiple times
+TUPLE: node
+    number insn precedes follows
+    children parent
+    registers parent-index ;
+
+M: node equal?  [ number>> ] bi@ = ;
+
+M: node hashcode* nip number>> ;
+
+: <node> ( insn -- node )
+    node new
+        node-number counter >>number
+        swap >>insn
+        H{ } clone >>precedes
+        V{ } clone >>follows ;
+
+: ready? ( node -- ? ) precedes>> assoc-empty? ;
+
+:: precedes ( first second how -- )
+    how second first precedes>> set-at ;
+
+:: add-data-edges ( nodes -- )
+    ! This builds up def-use information on the fly, since
+    ! we only care about local def-use
+    H{ } clone :> definers
+    nodes [| node |
+        node insn>> defs-vreg [ node swap definers set-at ] when*
+        node insn>> uses-vregs [ definers at [ node +data+ precedes ] when* ] each
+    ] each ;
+
+UNION: stack-insn ##peek ##replace ##replace-imm ;
+
+UNION: slot-insn
+    ##read ##write ;
+
+UNION: memory-insn
+    ##load-memory ##load-memory-imm
+    ##store-memory ##store-memory-imm ;
+
+UNION: alien-call-insn
+    ##save-context
+    ##alien-invoke ##alien-indirect ##alien-callback
+    ##unary-float-function ##binary-float-function ;
+
+: chain ( node var -- )
+    dup get [
+        pick +control+ precedes
+    ] when*
+    set ;
+
+GENERIC: add-control-edge ( node insn -- )
+
+M: stack-insn add-control-edge
+    loc>> chain ;
+
+M: memory-insn add-control-edge
+    drop memory-insn chain ;
+
+M: slot-insn add-control-edge
+    drop slot-insn chain ;
+
+M: alien-call-insn add-control-edge
+    drop alien-call-insn chain ;
+
+M: object add-control-edge 2drop ;
+
+: add-control-edges ( nodes -- )
+    [
+        [ dup insn>> add-control-edge ] each
+    ] with-scope ;
+
+: set-follows ( nodes -- )
+    [
+        dup precedes>> keys [
+            follows>> push
+        ] with each
+    ] each ;
+
+: set-roots ( nodes -- )
+    [ ready? ] V{ } filter-as roots set ;
+
+: build-dependence-graph ( instructions -- )
+    [ <node> ] map {
+        [ add-control-edges ]
+        [ add-data-edges ]
+        [ set-follows ]
+        [ set-roots ]
+        [ nodes set ]
+    } cleave ;
+
+! Sethi-Ulmann numbering
+:: calculate-registers ( node -- registers )
+    node children>> [ 0 ] [
+        [ [ calculate-registers ] map natural-sort ]
+        [ length iota ]
+        bi v+ supremum
+    ] if-empty
+    node insn>> temp-vregs length +
+    dup node registers<< ;
+
+! Constructing fan-in trees
+
+: attach-parent ( node parent -- )
+    [ >>parent drop ]
+    [ [ ?push ] change-children drop ] 2bi ;
+
+: keys-for ( assoc value -- keys )
+    '[ nip _ = ] assoc-filter keys ;
+
+: choose-parent ( node -- )
+    ! If a node has control dependences, it has to be a root
+    ! Otherwise, choose one of the data dependences for a parent
+    dup precedes>> +control+ keys-for empty? [
+        dup precedes>> +data+ keys-for [ drop ] [
+            first attach-parent
+        ] if-empty
+    ] [ drop ] if ;
+
+: make-trees ( -- trees )
+    nodes get
+    [ [ choose-parent ] each ]
+    [ [ parent>> not ] filter ] bi ;
+
+ERROR: node-missing-parent trees nodes ;
+ERROR: node-missing-children trees nodes ;
+
+: flatten-tree ( node -- nodes )
+    [ children>> [ flatten-tree ] map concat ] keep
+    suffix ;
+
+: verify-parents ( trees -- trees )
+    nodes get over '[ [ parent>> ] [ _ member? ] bi or ] all?
+    [ nodes get node-missing-parent ] unless ;
+
+: verify-children ( trees -- trees )
+    dup [ flatten-tree ] map concat
+    nodes get
+    { [ [ length ] bi@ = ] [ set= ] } 2&&
+    [ nodes get node-missing-children ] unless ;
+
+: verify-trees ( trees -- trees )
+    verify-parents verify-children ;
+
+: build-fan-in-trees ( -- )
+    make-trees verify-trees [
+        -1/0. >>parent-index 
+        calculate-registers drop
+    ] each ;
index d21e81526e426d2299f6475b9cfe36f7bc503c8d..71dc12f6a14f44bb84775a414d9aa1bbd8059cd7 100644 (file)
@@ -3,6 +3,7 @@
 USING: accessors assocs combinators sets math fry kernel math.order
 dlists deques vectors namespaces sequences sorting locals
 compiler.cfg.rpo compiler.cfg.predecessors ;
+FROM: namespaces => set ;
 IN: compiler.cfg.dominance
 
 ! Reference:
@@ -103,4 +104,4 @@ PRIVATE>
         [ accum push ]
         [ dom-children work-list push-all-front ] bi
     ] slurp-deque
-    accum ;
\ No newline at end of file
+    accum ;
diff --git a/basis/compiler/cfg/empty-blocks/empty-blocks.factor b/basis/compiler/cfg/empty-blocks/empty-blocks.factor
deleted file mode 100644 (file)
index 605c572..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel accessors sequences namespaces combinators
-combinators.short-circuit classes vectors compiler.cfg
-compiler.cfg.instructions compiler.cfg.rpo ;
-IN: compiler.cfg.empty-blocks
-
-<PRIVATE
-
-: update-predecessor ( bb -- )
-    ! We have to replace occurrences of bb with bb's successor
-    ! in bb's predecessor's list of successors.
-    dup predecessors>> first [
-        [
-            2dup eq? [ drop successors>> first ] [ nip ] if
-        ] with map
-    ] change-successors drop ;
-: update-successor ( bb -- )
-    ! We have to replace occurrences of bb with bb's predecessor
-    ! in bb's sucessor's list of predecessors.
-    dup successors>> first [
-        [
-            2dup eq? [ drop predecessors>> first ] [ nip ] if
-        ] with map
-    ] change-predecessors drop ;
-
-SYMBOL: changed?
-
-: delete-basic-block ( bb -- )
-    [ update-predecessor ] [ update-successor ] bi
-    changed? on ;
-: delete-basic-block? ( bb -- ? )
-    {
-        [ instructions>> length 1 = ]
-        [ predecessors>> length 1 = ]
-        [ successors>> length 1 = ]
-        [ instructions>> first ##branch? ]
-    } 1&& ;
-
-PRIVATE>
-
-: delete-empty-blocks ( cfg -- cfg' )
-    changed? off
-    dup [ dup delete-basic-block? [ delete-basic-block ] [ drop ] if ] each-basic-block
-    changed? get [ cfg-changed ] when ;
\ No newline at end of file
diff --git a/basis/compiler/cfg/finalization/authors.txt b/basis/compiler/cfg/finalization/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/finalization/finalization.factor b/basis/compiler/cfg/finalization/finalization.factor
new file mode 100644 (file)
index 0000000..5440ba6
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: compiler.cfg.gc-checks compiler.cfg.representations
+compiler.cfg.save-contexts compiler.cfg.ssa.destruction
+compiler.cfg.build-stack-frame compiler.cfg.linear-scan
+compiler.cfg.scheduling ;
+IN: compiler.cfg.finalization
+
+: finalize-cfg ( cfg -- cfg' )
+    select-representations
+    schedule-instructions
+    insert-gc-checks
+    insert-save-contexts
+    destruct-ssa
+    linear-scan
+    build-stack-frame ;
index 27d37b115f46b6b546cd60a43369a6fead2a8d8c..496954de2c83cd87d6c51a7e1a251cc6b39b3730 100644 (file)
@@ -1,14 +1,14 @@
-USING: compiler.cfg.gc-checks compiler.cfg.debugger
+USING: arrays compiler.cfg.gc-checks
+compiler.cfg.gc-checks.private compiler.cfg.debugger
 compiler.cfg.registers compiler.cfg.instructions compiler.cfg
-compiler.cfg.predecessors cpu.architecture tools.test kernel vectors
-namespaces accessors sequences ;
+compiler.cfg.predecessors compiler.cfg.rpo cpu.architecture
+tools.test kernel vectors namespaces accessors sequences alien
+memory classes make combinators.short-circuit byte-arrays ;
 IN: compiler.cfg.gc-checks.tests
 
 : test-gc-checks ( -- )
     H{ } clone representations set
-    cfg new 0 get >>entry
-    insert-gc-checks
-    drop ;
+    cfg new 0 get >>entry cfg set ;
 
 V{
     T{ ##inc-d f 3 }
@@ -23,4 +23,184 @@ V{
 
 [ ] [ test-gc-checks ] unit-test
 
-[ V{ D 0 D 2 } ] [ 1 get instructions>> first uninitialized-locs>> ] unit-test
+[ t ] [ cfg get blocks-with-gc 1 get 1array sequence= ] unit-test
+
+[ ] [ 1 get allocation-size 123 <alien> size assert= ] unit-test
+
+2 \ vreg-counter set-global
+
+[
+    V{
+        T{ ##load-tagged f 3 0 }
+        T{ ##replace f 3 D 0 }
+        T{ ##replace f 3 R 3 }
+    }
+] [ [ { D 0 R 3 } wipe-locs ] V{ } make ] unit-test
+
+: gc-check? ( bb -- ? )
+    instructions>>
+    {
+        [ length 1 = ]
+        [ first ##check-nursery-branch? ]
+    } 1&& ;
+
+[ t ] [ V{ } 100 <gc-check> gc-check? ] unit-test
+
+4 \ vreg-counter set-global
+
+[
+    V{
+        T{ ##load-tagged f 5 0 }
+        T{ ##replace f 5 D 0 }
+        T{ ##replace f 5 R 3 }
+        T{ ##call-gc f { 0 1 2 } }
+        T{ ##branch }
+    }
+]
+[
+    { D 0 R 3 } { 0 1 2 } <gc-call> instructions>>
+] unit-test
+
+30 \ vreg-counter set-global
+
+V{
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##branch }
+} 2 test-bb
+
+V{
+    T{ ##branch }
+} 3 test-bb
+
+V{
+    T{ ##branch }
+} 4 test-bb
+
+0 { 1 2 } edges
+1 3 edge
+2 3 edge
+3 4 edge
+
+[ ] [ test-gc-checks ] unit-test
+
+[ ] [ cfg get needs-predecessors drop ] unit-test
+
+[ ] [ { D 1 R 2 } { 10 20 } V{ } 31337 3 get (insert-gc-check) ] unit-test
+
+[ t ] [ 1 get successors>> first gc-check? ] unit-test
+
+[ t ] [ 2 get successors>> first gc-check? ] unit-test
+
+[ t ] [ 3 get predecessors>> first gc-check? ] unit-test
+
+30 \ vreg-counter set-global
+
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##peek f 2 D 0 }
+    T{ ##inc-d f 3 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##allot f 1 64 byte-array }
+    T{ ##branch }
+} 2 test-bb
+
+V{
+    T{ ##branch }
+} 3 test-bb
+
+V{
+    T{ ##replace f 2 D 1 }
+    T{ ##branch }
+} 4 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 5 test-bb
+
+0 1 edge
+1 { 2 3 } edges
+2 4 edge
+3 4 edge
+4 5 edge
+
+[ ] [ test-gc-checks ] unit-test
+
+H{
+    { 2 tagged-rep }
+} representations set
+
+[ ] [ cfg get insert-gc-checks drop ] unit-test
+
+[ 2 ] [ 2 get predecessors>> length ] unit-test
+
+[ t ] [ 1 get successors>> first gc-check? ] unit-test
+
+[ 64 ] [ 1 get successors>> first instructions>> first size>> ] unit-test
+
+[ t ] [ 2 get predecessors>> first gc-check? ] unit-test
+
+[
+    V{
+        T{ ##load-tagged f 31 0 }
+        T{ ##replace f 31 D 0 }
+        T{ ##replace f 31 D 1 }
+        T{ ##replace f 31 D 2 }
+        T{ ##call-gc f { 2 } }
+        T{ ##branch }
+    }
+] [ 2 get predecessors>> second instructions>> ] unit-test
+
+! Don't forget to invalidate RPO after inserting basic blocks!
+[ 8 ] [ cfg get reverse-post-order length ] unit-test
+
+! Do the right thing with ##phi instructions
+V{
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##load-reference f 1 "hi" }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##load-reference f 2 "bye" }
+    T{ ##branch }
+} 2 test-bb
+
+V{
+    T{ ##phi f 3 H{ { 1 1 } { 2 2 } } }
+    T{ ##allot f 1 64 byte-array }
+    T{ ##branch }
+} 3 test-bb
+
+0 { 1 2 } edges
+1 3 edge
+2 3 edge
+
+[ ] [ test-gc-checks ] unit-test
+
+H{
+    { 1 tagged-rep }
+    { 2 tagged-rep }
+    { 3 tagged-rep }
+} representations set
+
+[ ] [ cfg get insert-gc-checks drop ] unit-test
+[ t ] [ 2 get successors>> first instructions>> first ##phi? ] unit-test
+[ 2 ] [ 3 get instructions>> length ] unit-test
index 6d192ec54a627d6bf44d8320a317fef9d95fb452..255e5476e684992d433e6ef530d12f204422fb0d 100644 (file)
@@ -1,22 +1,81 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel sequences assocs fry math
-cpu.architecture layouts namespaces
+USING: accessors assocs combinators fry kernel layouts locals
+math make namespaces sequences cpu.architecture
+compiler.cfg
 compiler.cfg.rpo
+compiler.cfg.hats
 compiler.cfg.registers
+compiler.cfg.utilities
+compiler.cfg.comparisons
 compiler.cfg.instructions
+compiler.cfg.predecessors
+compiler.cfg.liveness
+compiler.cfg.liveness.ssa
 compiler.cfg.stacks.uninitialized ;
 IN: compiler.cfg.gc-checks
 
-! Garbage collection check insertion. This pass runs after representation
-! selection, so it must keep track of representations.
+<PRIVATE
+
+! Garbage collection check insertion. This pass runs after
+! representation selection, since it needs to know which vregs
+! can contain tagged pointers.
 
 : insert-gc-check? ( bb -- ? )
-    instructions>> [ ##allocation? ] any? ;
+    dup kill-block?>>
+    [ drop f ] [ instructions>> [ ##allocation? ] any? ] if ;
 
 : blocks-with-gc ( cfg -- bbs )
     post-order [ insert-gc-check? ] filter ;
 
+! A GC check for bb consists of two new basic blocks, gc-check
+! and gc-call:
+!
+!    gc-check
+!   /      \
+!  |     gc-call
+!   \      /
+!      bb
+
+! Any ##phi instructions at the start of bb are transplanted
+! into the gc-check block.
+
+: <gc-check> ( phis size -- bb )
+    [ <basic-block> ] 2dip
+    [
+        [ % ]
+        [
+            cc<= int-rep next-vreg-rep int-rep next-vreg-rep
+            ##check-nursery-branch
+        ] bi*
+    ] V{ } make >>instructions ;
+
+: wipe-locs ( uninitialized-locs -- )
+    '[
+        int-rep next-vreg-rep
+        [ 0 ##load-tagged ]
+        [ '[ [ _ ] dip ##replace ] each ] bi
+    ] unless-empty ;
+
+: <gc-call> ( uninitialized-locs gc-roots -- bb )
+    [ <basic-block> ] 2dip
+    [ [ wipe-locs ] [ ##call-gc ] bi* ##branch ] V{ } make
+    >>instructions t >>unlikely? ;
+
+:: insert-guard ( body check bb -- )
+    bb predecessors>> check predecessors<<
+    V{ bb body }      check successors<<
+
+    V{ check }        body predecessors<<
+    V{ bb }           body successors<<
+
+    V{ check body }   bb predecessors<<
+
+    check predecessors>> [ bb check update-successors ] each ;
+
+: (insert-gc-check) ( uninitialized-locs gc-roots phis size bb -- )
+    [ [ <gc-call> ] 2dip <gc-check> ] dip insert-guard ;
+
 GENERIC: allocation-size* ( insn -- n )
 
 M: ##allot allocation-size* size>> ;
@@ -30,20 +89,35 @@ M: ##box-displaced-alien allocation-size* drop 5 cells ;
     [ ##allocation? ] filter
     [ allocation-size* data-alignment get align ] map-sum ;
 
+: gc-live-in ( bb -- vregs )
+    [ live-in keys ] [ instructions>> [ ##phi? ] filter [ dst>> ] map ] bi
+    append ;
+
+: live-tagged ( bb -- vregs )
+    gc-live-in [ rep-of tagged-rep? ] filter ;
+
+: remove-phis ( bb -- phis )
+    [ [ ##phi? ] partition ] change-instructions drop ;
+
 : insert-gc-check ( bb -- )
-    dup dup '[
-        int-rep next-vreg-rep
-        int-rep next-vreg-rep
-        _ allocation-size
-        f
-        f
-        _ uninitialized-locs
-        \ ##gc new-insn
-        prefix
-    ] change-instructions drop ;
+    {
+        [ uninitialized-locs ]
+        [ live-tagged ]
+        [ remove-phis ]
+        [ allocation-size ]
+        [ ]
+    } cleave
+    (insert-gc-check) ;
+
+PRIVATE>
 
 : insert-gc-checks ( cfg -- cfg' )
     dup blocks-with-gc [
-        over compute-uninitialized-sets
+        [
+            needs-predecessors
+            dup compute-ssa-live-sets
+            dup compute-uninitialized-sets
+        ] dip
         [ insert-gc-check ] each
+        cfg-changed
     ] unless-empty ;
index 9d1945c525440d28dd4d0d4f9ca1a4597bc39c05..a03f1f83bc74d8e153b2e6f32a3692327105a487 100644 (file)
@@ -1,8 +1,9 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays byte-arrays kernel layouts math
-namespaces sequences combinators splitting parser effects
-words cpu.architecture compiler.cfg.registers
+USING: accessors alien arrays byte-arrays classes.algebra
+combinators.short-circuit kernel layouts math namespaces
+sequences combinators splitting parser effects words
+cpu.architecture compiler.constants compiler.cfg.registers
 compiler.cfg.instructions compiler.cfg.instructions.syntax ;
 IN: compiler.cfg.hats
 
@@ -42,18 +43,21 @@ insn-classes get [
 >>
 
 : ^^load-literal ( obj -- dst )
-    [ next-vreg dup ] dip {
-        { [ dup not ] [ drop \ f type-number ##load-immediate ] }
-        { [ dup fixnum? ] [ tag-fixnum ##load-immediate ] }
-        { [ dup float? ] [ ##load-constant ] }
-        [ ##load-reference ]
-    } cond ;
+    dup fixnum? [ ^^load-integer ] [ ^^load-reference ] if ;
 
 : ^^offset>slot ( slot -- vreg' )
-    cell 4 = 2 1 ? ^^shr-imm ;
+    cell 4 = 2 3 ? ^^shl-imm ;
+
+: ^^unbox-f ( src -- dst )
+    drop 0 ^^load-literal ;
 
-: ^^tag-fixnum ( src -- dst )
-    tag-bits get ^^shl-imm ;
+: ^^unbox-byte-array ( src -- dst )
+    ^^tagged>integer byte-array-offset ^^add-imm ;
 
-: ^^untag-fixnum ( src -- dst )
-    tag-bits get ^^sar-imm ;
+: ^^unbox-c-ptr ( src class -- dst )
+    {
+        { [ dup \ f class<= ] [ drop ^^unbox-f ] }
+        { [ dup alien class<= ] [ drop ^^unbox-alien ] }
+        { [ dup byte-array class<= ] [ drop ^^unbox-byte-array ] }
+        [ drop ^^unbox-any-c-ptr ]
+    } cond ;
diff --git a/basis/compiler/cfg/height/height.factor b/basis/compiler/cfg/height/height.factor
new file mode 100644 (file)
index 0000000..4471508
--- /dev/null
@@ -0,0 +1,55 @@
+! Copyright (C) 2008, 2009 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors math namespaces sequences kernel fry
+compiler.cfg compiler.cfg.registers compiler.cfg.instructions
+compiler.cfg.rpo ;
+IN: compiler.cfg.height
+
+! Combine multiple stack height changes into one at the
+! start of the basic block.
+
+SYMBOL: ds-height
+SYMBOL: rs-height
+
+GENERIC: compute-heights ( insn -- )
+
+M: ##inc-d compute-heights n>> ds-height [ + ] change ;
+M: ##inc-r compute-heights n>> rs-height [ + ] change ;
+M: insn compute-heights drop ;
+
+GENERIC: normalize-height* ( insn -- insn' )
+
+: normalize-inc-d/r ( insn stack -- insn' )
+    swap n>> '[ _ - ] change f ; inline
+
+M: ##inc-d normalize-height* ds-height normalize-inc-d/r ;
+M: ##inc-r normalize-height* rs-height normalize-inc-d/r ;
+
+GENERIC: loc-stack ( loc -- stack )
+
+M: ds-loc loc-stack drop ds-height ;
+M: rs-loc loc-stack drop rs-height ;
+
+GENERIC: <loc> ( n stack -- loc )
+
+M: ds-loc <loc> drop <ds-loc> ;
+M: rs-loc <loc> drop <rs-loc> ;
+
+: normalize-peek/replace ( insn -- insn' )
+    [ [ [ n>> ] [ loc-stack get ] bi + ] keep <loc> ] change-loc ; inline
+
+M: ##peek normalize-height* normalize-peek/replace ;
+M: ##replace normalize-height* normalize-peek/replace ;
+
+M: insn normalize-height* ;
+
+: height-step ( insns -- insns' )
+    0 ds-height set
+    0 rs-height set
+    [ [ compute-heights ] each ]
+    [ [ [ normalize-height* ] map sift ] with-scope ] bi
+    ds-height get dup 0 = [ drop ] [ \ ##inc-d new-insn prefix ] if
+    rs-height get dup 0 = [ drop ] [ \ ##inc-r new-insn prefix ] if ;
+
+: normalize-height ( cfg -- cfg' )
+    dup [ height-step ] simple-optimization ;
diff --git a/basis/compiler/cfg/height/summary.txt b/basis/compiler/cfg/height/summary.txt
new file mode 100644 (file)
index 0000000..ce1974a
--- /dev/null
@@ -0,0 +1 @@
+Stack height normalization coalesces height changes at start of basic block
index 68a8b8ce59d6fc376e2d6251a1be2f1c9cf12d06..e05335b06c00ea4c2f3c41ddba34e61ce934cd95 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: assocs accessors arrays kernel sequences namespaces words
-math math.order layouts classes.algebra classes.union
-compiler.units alien byte-arrays compiler.constants combinators
-compiler.cfg.registers compiler.cfg.instructions.syntax ;
+math math.order layouts classes.union compiler.units alien
+byte-arrays combinators compiler.cfg.registers
+compiler.cfg.instructions.syntax ;
 IN: compiler.cfg.instructions
 
 <<
@@ -13,34 +13,54 @@ V{ } clone insn-classes set-global
 
 : new-insn ( ... class -- insn ) f swap boa ; inline
 
-! Virtual CPU instructions, used by CFG and machine IRs
+! Virtual CPU instructions, used by CFG IR
 TUPLE: insn ;
 
+! Instructions which use vregs
+TUPLE: vreg-insn < insn ;
+
 ! Instructions which are referentially transparent; used for
 ! value numbering
-TUPLE: pure-insn < insn ;
+TUPLE: pure-insn < vreg-insn ;
 
-! Stack operations
-INSN: ##load-immediate
+! Constants
+INSN: ##load-integer
 def: dst/int-rep
-constant: val ;
+literal: val ;
 
 INSN: ##load-reference
-def: dst/int-rep
-constant: obj ;
+def: dst/tagged-rep
+literal: obj ;
 
-INSN: ##load-constant
-def: dst/int-rep
-constant: obj ;
+! These three are inserted by representation selection
+INSN: ##load-tagged
+def: dst/tagged-rep
+literal: val ;
+
+INSN: ##load-float
+def: dst/float-rep
+literal: val ;
+
+INSN: ##load-double
+def: dst/double-rep
+literal: val ;
+
+INSN: ##load-vector
+def: dst
+literal: val rep ;
 
+! Stack operations
 INSN: ##peek
-def: dst/int-rep
+def: dst/tagged-rep
 literal: loc ;
 
 INSN: ##replace
-use: src/int-rep
+use: src/tagged-rep
 literal: loc ;
 
+INSN: ##replace-imm
+literal: src loc ;
+
 INSN: ##inc-d
 literal: n ;
 
@@ -54,6 +74,10 @@ literal: word ;
 INSN: ##jump
 literal: word ;
 
+INSN: ##prologue ;
+
+INSN: ##epilogue ;
+
 INSN: ##return ;
 
 ! Dummy instruction that simply inhibits TCO
@@ -66,36 +90,33 @@ temp: temp/int-rep ;
 
 ! Slot access
 INSN: ##slot
-def: dst/int-rep
-use: obj/int-rep slot/int-rep ;
+def: dst/tagged-rep
+use: obj/tagged-rep slot/int-rep
+literal: scale tag ;
 
 INSN: ##slot-imm
-def: dst/int-rep
-use: obj/int-rep
+def: dst/tagged-rep
+use: obj/tagged-rep
 literal: slot tag ;
 
 INSN: ##set-slot
-use: src/int-rep obj/int-rep slot/int-rep ;
+use: src/tagged-rep obj/tagged-rep slot/int-rep
+literal: scale tag ;
 
 INSN: ##set-slot-imm
-use: src/int-rep obj/int-rep
+use: src/tagged-rep obj/tagged-rep
 literal: slot tag ;
 
-! String element access
-INSN: ##string-nth
-def: dst/int-rep
-use: obj/int-rep index/int-rep
-temp: temp/int-rep ;
-
-INSN: ##set-string-nth-fast
-use: src/int-rep obj/int-rep index/int-rep
-temp: temp/int-rep ;
-
-PURE-INSN: ##copy
+! Register transfers
+INSN: ##copy
 def: dst
 use: src
 literal: rep ;
 
+PURE-INSN: ##tagged>integer
+def: dst/int-rep
+use: src/tagged-rep ;
+
 ! Integer arithmetic
 PURE-INSN: ##add
 def: dst/int-rep
@@ -104,7 +125,7 @@ use: src1/int-rep src2/int-rep ;
 PURE-INSN: ##add-imm
 def: dst/int-rep
 use: src1/int-rep
-constant: src2 ;
+literal: src2 ;
 
 PURE-INSN: ##sub
 def: dst/int-rep
@@ -113,7 +134,7 @@ use: src1/int-rep src2/int-rep ;
 PURE-INSN: ##sub-imm
 def: dst/int-rep
 use: src1/int-rep
-constant: src2 ;
+literal: src2 ;
 
 PURE-INSN: ##mul
 def: dst/int-rep
@@ -122,7 +143,7 @@ use: src1/int-rep src2/int-rep ;
 PURE-INSN: ##mul-imm
 def: dst/int-rep
 use: src1/int-rep
-constant: src2 ;
+literal: src2 ;
 
 PURE-INSN: ##and
 def: dst/int-rep
@@ -131,7 +152,7 @@ use: src1/int-rep src2/int-rep ;
 PURE-INSN: ##and-imm
 def: dst/int-rep
 use: src1/int-rep
-constant: src2 ;
+literal: src2 ;
 
 PURE-INSN: ##or
 def: dst/int-rep
@@ -140,7 +161,7 @@ use: src1/int-rep src2/int-rep ;
 PURE-INSN: ##or-imm
 def: dst/int-rep
 use: src1/int-rep
-constant: src2 ;
+literal: src2 ;
 
 PURE-INSN: ##xor
 def: dst/int-rep
@@ -149,7 +170,7 @@ use: src1/int-rep src2/int-rep ;
 PURE-INSN: ##xor-imm
 def: dst/int-rep
 use: src1/int-rep
-constant: src2 ;
+literal: src2 ;
 
 PURE-INSN: ##shl
 def: dst/int-rep
@@ -158,7 +179,7 @@ use: src1/int-rep src2/int-rep ;
 PURE-INSN: ##shl-imm
 def: dst/int-rep
 use: src1/int-rep
-constant: src2 ;
+literal: src2 ;
 
 PURE-INSN: ##shr
 def: dst/int-rep
@@ -167,7 +188,7 @@ use: src1/int-rep src2/int-rep ;
 PURE-INSN: ##shr-imm
 def: dst/int-rep
 use: src1/int-rep
-constant: src2 ;
+literal: src2 ;
 
 PURE-INSN: ##sar
 def: dst/int-rep
@@ -176,7 +197,7 @@ use: src1/int-rep src2/int-rep ;
 PURE-INSN: ##sar-imm
 def: dst/int-rep
 use: src1/int-rep
-constant: src2 ;
+literal: src2 ;
 
 PURE-INSN: ##min
 def: dst/int-rep
@@ -198,6 +219,10 @@ PURE-INSN: ##log2
 def: dst/int-rep
 use: src/int-rep ;
 
+PURE-INSN: ##bit-count
+def: dst/int-rep
+use: src/int-rep ;
+
 ! Float arithmetic
 PURE-INSN: ##add-float
 def: dst/double-rep
@@ -270,16 +295,36 @@ def: dst
 use: src1/scalar-rep src2/scalar-rep
 literal: rep ;
 
+PURE-INSN: ##gather-int-vector-2
+def: dst
+use: src1/int-rep src2/int-rep
+literal: rep ;
+
 PURE-INSN: ##gather-vector-4
 def: dst
 use: src1/scalar-rep src2/scalar-rep src3/scalar-rep src4/scalar-rep
 literal: rep ;
 
+PURE-INSN: ##gather-int-vector-4
+def: dst
+use: src1/int-rep src2/int-rep src3/int-rep src4/int-rep
+literal: rep ;
+
+PURE-INSN: ##select-vector
+def: dst/int-rep
+use: src
+literal: n rep ;
+
 PURE-INSN: ##shuffle-vector
 def: dst
 use: src shuffle
 literal: rep ;
 
+PURE-INSN: ##shuffle-vector-halves-imm
+def: dst
+use: src1 src2
+literal: shuffle rep ;
+
 PURE-INSN: ##shuffle-vector-imm
 def: dst
 use: src
@@ -300,6 +345,11 @@ def: dst
 use: src1 src2
 literal: rep ;
 
+PURE-INSN: ##float-pack-vector
+def: dst
+use: src
+literal: rep ;
+
 PURE-INSN: ##signed-pack-vector
 def: dst
 use: src1 src2
@@ -336,7 +386,7 @@ use: src1 src2
 literal: rep cc ;
 
 PURE-INSN: ##test-vector
-def: dst/int-rep
+def: dst/tagged-rep
 use: src1
 temp: temp/int-rep
 literal: rep vcc ;
@@ -346,12 +396,6 @@ use: src1
 temp: temp/int-rep
 literal: rep vcc ;
 
-INSN: _test-vector-branch
-literal: label
-use: src1
-temp: temp/int-rep
-literal: rep vcc ;
-
 PURE-INSN: ##add-vector
 def: dst
 use: src1 src2
@@ -525,191 +569,209 @@ literal: rep ;
 
 ! Boxing and unboxing aliens
 PURE-INSN: ##box-alien
-def: dst/int-rep
+def: dst/tagged-rep
 use: src/int-rep
 temp: temp/int-rep ;
 
 PURE-INSN: ##box-displaced-alien
-def: dst/int-rep
-use: displacement/int-rep base/int-rep
+def: dst/tagged-rep
+use: displacement/int-rep base/tagged-rep
 temp: temp/int-rep
 literal: base-class ;
 
 PURE-INSN: ##unbox-any-c-ptr
 def: dst/int-rep
-use: src/int-rep ;
-
-: ##unbox-f ( dst src -- ) drop 0 ##load-immediate ;
-: ##unbox-byte-array ( dst src -- ) byte-array-offset ##add-imm ;
+use: src/tagged-rep ;
 
 PURE-INSN: ##unbox-alien
 def: dst/int-rep
-use: src/int-rep ;
+use: src/tagged-rep ;
 
-: ##unbox-c-ptr ( dst src class -- )
-    {
-        { [ dup \ f class<= ] [ drop ##unbox-f ] }
-        { [ dup alien class<= ] [ drop ##unbox-alien ] }
-        { [ dup byte-array class<= ] [ drop ##unbox-byte-array ] }
-        [ drop ##unbox-any-c-ptr ]
-    } cond ;
+! Raw memory accessors
+INSN: ##load-memory
+def: dst
+use: base/int-rep displacement/int-rep
+literal: scale offset rep c-type ;
 
-! Alien accessors
-INSN: ##alien-unsigned-1
-def: dst/int-rep
-use: src/int-rep
-literal: offset ;
+INSN: ##load-memory-imm
+def: dst
+use: base/int-rep
+literal: offset rep c-type ;
 
-INSN: ##alien-unsigned-2
-def: dst/int-rep
-use: src/int-rep
-literal: offset ;
+INSN: ##store-memory
+use: src base/int-rep displacement/int-rep
+literal: scale offset rep c-type ;
 
-INSN: ##alien-unsigned-4
-def: dst/int-rep
-use: src/int-rep
-literal: offset ;
+INSN: ##store-memory-imm
+use: src base/int-rep
+literal: offset rep c-type ;
 
-INSN: ##alien-signed-1
-def: dst/int-rep
-use: src/int-rep
-literal: offset ;
+! Memory allocation
+INSN: ##allot
+def: dst/tagged-rep
+literal: size class
+temp: temp/int-rep ;
 
-INSN: ##alien-signed-2
-def: dst/int-rep
-use: src/int-rep
-literal: offset ;
+INSN: ##write-barrier
+use: src/tagged-rep slot/int-rep
+literal: scale tag
+temp: temp1/int-rep temp2/int-rep ;
 
-INSN: ##alien-signed-4
-def: dst/int-rep
-use: src/int-rep
-literal: offset ;
+INSN: ##write-barrier-imm
+use: src/tagged-rep
+literal: slot tag
+temp: temp1/int-rep temp2/int-rep ;
 
-INSN: ##alien-cell
+INSN: ##alien-global
 def: dst/int-rep
-use: src/int-rep
-literal: offset ;
+literal: symbol library ;
 
-INSN: ##alien-float
-def: dst/float-rep
-use: src/int-rep
+INSN: ##vm-field
+def: dst/tagged-rep
 literal: offset ;
 
-INSN: ##alien-double
-def: dst/double-rep
-use: src/int-rep
+INSN: ##set-vm-field
+use: src/tagged-rep
 literal: offset ;
 
-INSN: ##alien-vector
-def: dst
-use: src/int-rep
-literal: offset rep ;
+! FFI
+INSN: ##stack-frame
+literal: stack-frame ;
 
-INSN: ##set-alien-integer-1
-use: src/int-rep
-literal: offset
-use: value/int-rep ;
+INSN: ##unbox
+def: dst
+use: src/tagged-rep
+literal: unboxer rep ;
 
-INSN: ##set-alien-integer-2
-use: src/int-rep
-literal: offset
-use: value/int-rep ;
+INSN: ##unbox-long-long
+use: src/tagged-rep out/int-rep
+literal: unboxer ;
 
-INSN: ##set-alien-integer-4
-use: src/int-rep
-literal: offset
-use: value/int-rep ;
-
-INSN: ##set-alien-cell
-use: src/int-rep
-literal: offset
-use: value/int-rep ;
+INSN: ##store-reg-param
+use: src
+literal: reg rep ;
 
-INSN: ##set-alien-float
-use: src/int-rep
-literal: offset
-use: value/float-rep ;
+INSN: ##store-stack-param
+use: src
+literal: n rep ;
 
-INSN: ##set-alien-double
-use: src/int-rep
-literal: offset
-use: value/double-rep ;
+INSN: ##load-reg-param
+def: dst
+literal: reg rep ;
 
-INSN: ##set-alien-vector
-use: src/int-rep
-literal: offset
-use: value
-literal: rep ;
+INSN: ##load-stack-param
+def: dst
+literal: n rep ;
 
-! Memory allocation
-INSN: ##allot
+INSN: ##local-allot
 def: dst/int-rep
-literal: size class
-temp: temp/int-rep ;
+literal: size align offset ;
 
-INSN: ##write-barrier
-use: src/int-rep slot/int-rep
-temp: temp1/int-rep temp2/int-rep ;
+INSN: ##box
+def: dst/tagged-rep
+use: src
+literal: boxer rep ;
 
-INSN: ##write-barrier-imm
-use: src/int-rep
-literal: slot
-temp: temp1/int-rep temp2/int-rep ;
+INSN: ##box-long-long
+def: dst/tagged-rep
+use: src1/int-rep src2/int-rep
+literal: boxer ;
 
-INSN: ##alien-global
-def: dst/int-rep
-literal: symbol library ;
+INSN: ##allot-byte-array
+def: dst/tagged-rep
+literal: size ;
 
-INSN: ##vm-field-ptr
-def: dst/int-rep
-literal: field-name ;
+INSN: ##prepare-var-args ;
 
-! FFI
 INSN: ##alien-invoke
-literal: params stack-frame ;
+literal: symbols dll ;
+
+INSN: ##cleanup
+literal: n ;
 
 INSN: ##alien-indirect
-literal: params stack-frame ;
+use: src/int-rep ;
 
 INSN: ##alien-assembly
-literal: params stack-frame ;
+literal: quot ;
 
-INSN: ##alien-callback
-literal: params stack-frame ;
+INSN: ##begin-callback ;
 
-! Instructions used by CFG IR only.
-INSN: ##prologue ;
-INSN: ##epilogue ;
+INSN: ##alien-callback
+literal: quot ;
 
-INSN: ##branch ;
+INSN: ##end-callback ;
 
+! Control flow
 INSN: ##phi
 def: dst
 literal: inputs ;
 
-! Conditionals
+INSN: ##branch ;
+
+! Tagged conditionals
 INSN: ##compare-branch
-use: src1/int-rep src2/int-rep
+use: src1/tagged-rep src2/tagged-rep
 literal: cc ;
 
 INSN: ##compare-imm-branch
+use: src1/tagged-rep
+literal: src2 cc ;
+
+PURE-INSN: ##compare
+def: dst/tagged-rep
+use: src1/tagged-rep src2/tagged-rep
+literal: cc
+temp: temp/int-rep ;
+
+PURE-INSN: ##compare-imm
+def: dst/tagged-rep
+use: src1/tagged-rep
+literal: src2 cc
+temp: temp/int-rep ;
+
+! Integer conditionals
+INSN: ##compare-integer-branch
+use: src1/int-rep src2/int-rep
+literal: cc ;
+
+INSN: ##compare-integer-imm-branch
 use: src1/int-rep
-constant: src2
+literal: src2 cc ;
+
+INSN: ##test-branch
+use: src1/int-rep src2/int-rep
 literal: cc ;
 
-PURE-INSN: ##compare
-def: dst/int-rep
+INSN: ##test-imm-branch
+use: src1/int-rep
+literal: src2 cc ;
+
+PURE-INSN: ##compare-integer
+def: dst/tagged-rep
 use: src1/int-rep src2/int-rep
 literal: cc
 temp: temp/int-rep ;
 
-PURE-INSN: ##compare-imm
-def: dst/int-rep
+PURE-INSN: ##compare-integer-imm
+def: dst/tagged-rep
 use: src1/int-rep
-constant: src2
+literal: src2 cc
+temp: temp/int-rep ;
+
+PURE-INSN: ##test
+def: dst/tagged-rep
+use: src1/int-rep src2/int-rep
 literal: cc
 temp: temp/int-rep ;
 
+PURE-INSN: ##test-imm
+def: dst/tagged-rep
+use: src1/int-rep
+literal: src2 cc
+temp: temp/int-rep ;
+
+! Float conditionals
 INSN: ##compare-float-ordered-branch
 use: src1/double-rep src2/double-rep
 literal: cc ;
@@ -719,149 +781,112 @@ use: src1/double-rep src2/double-rep
 literal: cc ;
 
 PURE-INSN: ##compare-float-ordered
-def: dst/int-rep
+def: dst/tagged-rep
 use: src1/double-rep src2/double-rep
 literal: cc
 temp: temp/int-rep ;
 
 PURE-INSN: ##compare-float-unordered
-def: dst/int-rep
+def: dst/tagged-rep
 use: src1/double-rep src2/double-rep
 literal: cc
 temp: temp/int-rep ;
 
 ! Overflowing arithmetic
 INSN: ##fixnum-add
-def: dst/int-rep
-use: src1/int-rep src2/int-rep ;
+def: dst/tagged-rep
+use: src1/tagged-rep src2/tagged-rep
+literal: cc ;
 
 INSN: ##fixnum-sub
-def: dst/int-rep
-use: src1/int-rep src2/int-rep ;
+def: dst/tagged-rep
+use: src1/tagged-rep src2/tagged-rep
+literal: cc ;
 
 INSN: ##fixnum-mul
-def: dst/int-rep
-use: src1/int-rep src2/int-rep ;
-
-INSN: ##gc
-temp: temp1/int-rep temp2/int-rep
-literal: size data-values tagged-values uninitialized-locs ;
+def: dst/tagged-rep
+use: src1/tagged-rep src2/int-rep
+literal: cc ;
 
 INSN: ##save-context
 temp: temp1/int-rep temp2/int-rep ;
 
-! Instructions used by machine IR only.
-INSN: _prologue
-literal: stack-frame ;
-
-INSN: _epilogue
-literal: stack-frame ;
-
-INSN: _label
-literal: label ;
-
-INSN: _branch
-literal: label ;
-
-INSN: _loop-entry ;
-
-INSN: _dispatch
-use: src/int-rep
-temp: temp ;
-
-INSN: _dispatch-label
-literal: label ;
-
-INSN: _compare-branch
-literal: label
-use: src1/int-rep src2/int-rep
-literal: cc ;
-
-INSN: _compare-imm-branch
-literal: label
-use: src1/int-rep
-constant: src2
-literal: cc ;
-
-INSN: _compare-float-unordered-branch
-literal: label
-use: src1/int-rep src2/int-rep
-literal: cc ;
-
-INSN: _compare-float-ordered-branch
-literal: label
-use: src1/int-rep src2/int-rep
-literal: cc ;
-
-! Overflowing arithmetic
-INSN: _fixnum-add
-literal: label
-def: dst/int-rep
-use: src1/int-rep src2/int-rep ;
+INSN: ##restore-context
+temp: temp1/int-rep temp2/int-rep ;
 
-INSN: _fixnum-sub
-literal: label
-def: dst/int-rep
-use: src1/int-rep src2/int-rep ;
+! GC checks
+INSN: ##check-nursery-branch
+literal: size cc
+temp: temp1/int-rep temp2/int-rep ;
 
-INSN: _fixnum-mul
-literal: label
-def: dst/int-rep
-use: src1/int-rep src2/int-rep ;
+INSN: ##call-gc
+literal: gc-roots ;
 
+! Spills and reloads, inserted by register allocator
 TUPLE: spill-slot { n integer } ;
 C: <spill-slot> spill-slot
 
-! These instructions operate on machine registers and not
-! virtual registers
-INSN: _spill
+INSN: ##spill
 use: src
 literal: rep dst ;
 
-INSN: _reload
+INSN: ##reload
 def: dst
 literal: rep src ;
 
-INSN: _spill-area-size
-literal: n ;
-
 UNION: ##allocation
 ##allot
 ##box-alien
 ##box-displaced-alien ;
 
-! For alias analysis
-UNION: ##read ##slot ##slot-imm ##vm-field-ptr ##alien-global ;
-UNION: ##write ##set-slot ##set-slot-imm ;
+UNION: conditional-branch-insn
+##compare-branch
+##compare-imm-branch
+##compare-integer-branch
+##compare-integer-imm-branch
+##test-branch
+##test-imm-branch
+##compare-float-ordered-branch
+##compare-float-unordered-branch
+##test-vector-branch
+##check-nursery-branch
+##fixnum-add
+##fixnum-sub
+##fixnum-mul ;
 
-! Instructions that kill all live vregs but cannot trigger GC
-UNION: partial-sync-insn
-##unary-float-function
-##binary-float-function ;
-
-! Instructions that kill all live vregs
-UNION: kill-vreg-insn
-##call
-##prologue
-##epilogue
+! For alias analysis
+UNION: ##read ##slot ##slot-imm ##vm-field ##alien-global ;
+UNION: ##write ##set-slot ##set-slot-imm ##set-vm-field ;
+
+! Instructions that clobber registers. They receive inputs and
+! produce outputs in spill slots.
+UNION: hairy-clobber-insn
+##load-reg-param
+##store-reg-param
+##call-gc
 ##alien-invoke
 ##alien-indirect
-##alien-callback ;
+##alien-assembly
+##begin-callback
+##end-callback ;
+
+! Instructions that clobber registers but are allowed to produce
+! outputs in registers. Inputs are in spill slots, except for
+! inputs coalesced with the output, in which case that input
+! will be in a register.
+UNION: clobber-insn
+hairy-clobber-insn
+##unary-float-function
+##binary-float-function
+##unbox
+##unbox-long-long
+##box
+##box-long-long
+##allot-byte-array ;
 
 ! Instructions that have complex expansions and require that the
 ! output registers are not equal to any of the input registers
 UNION: def-is-use-insn
 ##box-alien
 ##box-displaced-alien
-##string-nth
 ##unbox-any-c-ptr ;
-
-SYMBOL: vreg-insn
-
-[
-    vreg-insn
-    insn-classes get [
-        "insn-slots" word-prop [ type>> { def use temp } member-eq? ] any?
-    ] filter
-    define-union-class
-] with-compilation-unit
index cd76652d06076508be8cfaa3308093cc26c23ef8..223ae26b42b60150e1c45bceddbd51893df52b3c 100644 (file)
@@ -5,7 +5,7 @@ make fry sequences parser accessors effects namespaces
 combinators splitting classes.parser lexer quotations ;
 IN: compiler.cfg.instructions.syntax
 
-SYMBOLS: def use temp literal constant ;
+SYMBOLS: def use temp literal ;
 
 SYMBOL: scalar-rep
 
@@ -31,23 +31,22 @@ TUPLE: insn-slot-spec type name rep ;
                 { "use:" [ drop use ] }
                 { "temp:" [ drop temp ] }
                 { "literal:" [ drop literal ] }
-                { "constant:" [ drop constant ] }
                 [ dupd parse-insn-slot-spec , ]
             } case
         ] reduce drop
     ] { } make ;
 
-: insn-def-slot ( class -- slot/f )
-    "insn-slots" word-prop
+: find-def-slot ( slots -- slot/f )
     [ type>> def eq? ] find nip ;
 
+: insn-def-slot ( class -- slot/f )
+    "insn-slots" word-prop find-def-slot ;
+
 : insn-use-slots ( class -- slots )
-    "insn-slots" word-prop
-    [ type>> use eq? ] filter ;
+    "insn-slots" word-prop [ type>> use eq? ] filter ;
 
 : insn-temp-slots ( class -- slots )
-    "insn-slots" word-prop
-    [ type>> temp eq? ] filter ;
+    "insn-slots" word-prop [ type>> temp eq? ] filter ;
 
 ! We cannot reference words in compiler.cfg.instructions directly
 ! since that would create circularity.
@@ -57,21 +56,32 @@ TUPLE: insn-slot-spec type name rep ;
 : insn-word ( -- word )
     "insn" "compiler.cfg.instructions" lookup ;
 
+: vreg-insn-word ( -- word )
+    "vreg-insn" "compiler.cfg.instructions" lookup ;
+
 : pure-insn-word ( -- word )
     "pure-insn" "compiler.cfg.instructions" lookup ;
 
 : insn-effect ( word -- effect )
     boa-effect in>> but-last { } <effect> ;
 
-: define-insn-tuple ( class superclass specs -- )
+: uses-vregs? ( specs -- ? )
+    [ type>> { def use temp } member-eq? ] any? ;
+
+: insn-superclass ( pure? specs -- superclass )
+    pure-insn-word swap uses-vregs? vreg-insn-word insn-word ? ? ;
+
+: define-insn-tuple ( class pure? specs -- )
+    [ insn-superclass ] keep
     [ name>> ] map "insn#" suffix define-tuple-class ;
 
 : define-insn-ctor ( class specs -- )
     [ dup '[ _ ] [ f ] [ boa , ] surround ] dip
     [ name>> ] map { } <effect> define-declared ;
 
-: define-insn ( class superclass specs -- )
-    parse-insn-slot-specs {
+: define-insn ( class pure? specs -- )
+    parse-insn-slot-specs
+    {
         [ nip "insn-slots" set-word-prop ]
         [ 2drop insn-classes-word get push ]
         [ define-insn-tuple ]
@@ -79,6 +89,6 @@ TUPLE: insn-slot-spec type name rep ;
         [ nip define-insn-ctor ]
     } 3cleave ;
 
-SYNTAX: INSN: CREATE-CLASS insn-word ";" parse-tokens define-insn ;
+SYNTAX: INSN: CREATE-CLASS f ";" parse-tokens define-insn ;
 
-SYNTAX: PURE-INSN: CREATE-CLASS pure-insn-word ";" parse-tokens define-insn ;
+SYNTAX: PURE-INSN: CREATE-CLASS t ";" parse-tokens define-insn ;
index 320a0a08f7c89982fd0445a305ddd8b48af086b9..23143b2f8611a84b69ea38ff3747fbd24aad32b9 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel sequences alien math classes.algebra fry
 locals combinators combinators.short-circuit cpu.architecture
@@ -16,104 +16,72 @@ IN: compiler.cfg.intrinsics.alien
 
 : emit-<displaced-alien> ( node -- )
     dup emit-<displaced-alien>? [
-        [ 2inputs [ ^^untag-fixnum ] dip ] dip
-        node-input-infos second class>>
-        ^^box-displaced-alien ds-push
+        '[
+            _ node-input-infos second class>>
+            ^^box-displaced-alien
+        ] binary-op
     ] [ emit-primitive ] if ;
 
-:: inline-alien ( node quot test -- )
+:: inline-accessor ( node quot test -- )
     node node-input-infos :> infos
     infos test call
     [ infos quot call ]
     [ node emit-primitive ] if ; inline
 
-: inline-alien-getter? ( infos -- ? )
+: inline-load-memory? ( infos -- ? )
     [ first class>> c-ptr class<= ]
     [ second class>> fixnum class<= ]
     bi and ;
 
-: ^^unbox-c-ptr ( src class -- dst )
-    [ next-vreg dup ] 2dip ##unbox-c-ptr ;
+: prepare-accessor ( base offset info -- base offset )
+    class>> swap [ ^^unbox-c-ptr ] dip ^^add 0 ;
 
-: prepare-alien-accessor ( info -- ptr-vreg offset )
-    class>> [ 2inputs ^^untag-fixnum swap ] dip ^^unbox-c-ptr ^^add 0 ;
+: prepare-load-memory ( infos -- base offset )
+    [ 2inputs ] dip first prepare-accessor ;
 
-: prepare-alien-getter ( infos -- ptr-vreg offset )
-    first prepare-alien-accessor ;
+: (emit-load-memory) ( node rep c-type quot -- )
+    '[ prepare-load-memory _ _ ^^load-memory-imm @ ds-push ]
+    [ inline-load-memory? ]
+    inline-accessor ; inline
 
-: inline-alien-getter ( node quot -- )
-    '[ prepare-alien-getter @ ds-push ]
-    [ inline-alien-getter? ] inline-alien ; inline
+: emit-load-memory ( node rep c-type -- )
+    [ ] (emit-load-memory) ;
 
-: inline-alien-setter? ( infos class -- ? )
+: emit-alien-cell ( node -- )
+    int-rep f [ ^^box-alien ] (emit-load-memory) ;
+
+: inline-store-memory? ( infos class -- ? )
     '[ first class>> _ class<= ]
     [ second class>> c-ptr class<= ]
     [ third class>> fixnum class<= ]
     tri and and ;
 
-: prepare-alien-setter ( infos -- ptr-vreg offset )
-    second prepare-alien-accessor ;
-
-: inline-alien-integer-setter ( node quot -- )
-    '[ prepare-alien-setter ds-pop ^^untag-fixnum @ ]
-    [ fixnum inline-alien-setter? ]
-    inline-alien ; inline
-
-: inline-alien-cell-setter ( node quot -- )
-    '[ [ prepare-alien-setter ds-pop ] [ first class>> ] bi ^^unbox-c-ptr @ ]
-    [ pinned-c-ptr inline-alien-setter? ]
-    inline-alien ; inline
-
-: inline-alien-float-setter ( node quot -- )
-    '[ prepare-alien-setter ds-pop @ ]
-    [ float inline-alien-setter? ]
-    inline-alien ; inline
-
-: emit-alien-unsigned-getter ( node n -- )
-    '[
-        _ {
-            { 1 [ ^^alien-unsigned-1 ] }
-            { 2 [ ^^alien-unsigned-2 ] }
-            { 4 [ ^^alien-unsigned-4 ] }
-        } case ^^tag-fixnum
-    ] inline-alien-getter ;
-
-: emit-alien-signed-getter ( node n -- )
-    '[
-        _ {
-            { 1 [ ^^alien-signed-1 ] }
-            { 2 [ ^^alien-signed-2 ] }
-            { 4 [ ^^alien-signed-4 ] }
-        } case ^^tag-fixnum
-    ] inline-alien-getter ;
-
-: emit-alien-integer-setter ( node n -- )
-    '[
-        _ {
-            { 1 [ ##set-alien-integer-1 ] }
-            { 2 [ ##set-alien-integer-2 ] }
-            { 4 [ ##set-alien-integer-4 ] }
-        } case
-    ] inline-alien-integer-setter ;
-
-: emit-alien-cell-getter ( node -- )
-    [ ^^alien-cell ^^box-alien ] inline-alien-getter ;
-
-: emit-alien-cell-setter ( node -- )
-    [ ##set-alien-cell ] inline-alien-cell-setter ;
-
-: emit-alien-float-getter ( node rep -- )
-    '[
-        _ {
-            { float-rep [ ^^alien-float ] }
-            { double-rep [ ^^alien-double ] }
-        } case
-    ] inline-alien-getter ;
-
-: emit-alien-float-setter ( node rep -- )
-    '[
-        _ {
-            { float-rep [ ##set-alien-float ] }
-            { double-rep [ ##set-alien-double ] }
+: prepare-store-memory ( infos -- value base offset )
+    [ 3inputs ] dip second prepare-accessor ;
+
+:: (emit-store-memory) ( node rep c-type prepare-quot test-quot -- )
+    node
+    [ prepare-quot call rep c-type ##store-memory-imm ]
+    [ test-quot call inline-store-memory? ]
+    inline-accessor ; inline
+
+:: emit-store-memory ( node rep c-type -- )
+    node rep c-type
+    [ prepare-store-memory ]
+    [
+        rep {
+            { int-rep [ fixnum ] }
+            { float-rep [ float ] }
+            { double-rep [ float ] }
         } case
-    ] inline-alien-float-setter ;
+    ]
+    (emit-store-memory) ;
+
+: emit-set-alien-cell ( node -- )
+    int-rep f
+    [
+        [ first class>> ] [ prepare-store-memory ] bi
+        [ swap ^^unbox-c-ptr ] 2dip
+    ]
+    [ pinned-c-ptr ]
+    (emit-store-memory) ;
index 31a8a898bc1fb07837e1a88425dda876e0f27210..ff4c28a4887b0600d185c52d662fbffe00bc191c 100644 (file)
@@ -4,7 +4,8 @@ USING: kernel math math.order sequences accessors arrays
 byte-arrays layouts classes.tuple.private fry locals
 compiler.tree.propagation.info compiler.cfg.hats
 compiler.cfg.instructions compiler.cfg.stacks
-compiler.cfg.utilities compiler.cfg.builder.blocks ;
+compiler.cfg.utilities compiler.cfg.builder.blocks
+compiler.constants cpu.architecture alien.c-types ;
 IN: compiler.cfg.intrinsics.allot
 
 : ##set-slots ( regs obj class -- )
@@ -73,10 +74,16 @@ IN: compiler.cfg.intrinsics.allot
     dup node-input-infos first literal>> dup expand-(byte-array)?
     [ nip emit-allot-byte-array drop ] [ drop emit-primitive ] if ;
 
+:: zero-byte-array ( len reg -- )
+    0 ^^load-literal :> elt
+    reg ^^tagged>integer :> reg
+    len cell align cell /i iota [
+        [ elt reg ] dip cells byte-array-offset + int-rep f ##store-memory-imm
+    ] each ;
+
 :: emit-<byte-array> ( node -- )
     node node-input-infos first literal>> dup expand-<byte-array>? [
         :> len
-        0 ^^load-literal :> elt
         len emit-allot-byte-array :> reg
-        len reg elt byte-array store-initial-element
+        len reg zero-byte-array
     ] [ drop node emit-primitive ] if ;
index e4d1735eae6b19cedc4b33854f1709a13c564b82..6b87ca8fd6f727414233e7abf26a6fef7dbc9cb9 100644 (file)
@@ -1,9 +1,10 @@
-! Copyright (C) 2008, 2009 Slava Pestov, Doug Coleman.
+! Copyright (C) 2008, 2010 Slava Pestov, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: sequences accessors layouts kernel math math.intervals
 namespaces combinators fry arrays
 cpu.architecture
 compiler.tree.propagation.info
+compiler.cfg
 compiler.cfg.hats
 compiler.cfg.stacks
 compiler.cfg.instructions
@@ -14,26 +15,24 @@ compiler.cfg.comparisons ;
 IN: compiler.cfg.intrinsics.fixnum
 
 : emit-both-fixnums? ( -- )
-    2inputs
-    ^^or
-    tag-mask get ^^and-imm
-    0 cc= ^^compare-imm
-    ds-push ;
-
-: tag-literal ( n -- tagged )
-    literal>> [ tag-fixnum ] [ \ f type-number ] if* ;
-
-: emit-fixnum-op ( insn -- )
-    [ 2inputs ] dip call ds-push ; inline
+    [
+        [ ^^tagged>integer ] bi@
+        ^^or tag-mask get ^^and-imm
+        0 cc= ^^compare-integer-imm
+    ] binary-op ;
 
 : emit-fixnum-left-shift ( -- )
-    [ ^^untag-fixnum ^^shl ] emit-fixnum-op ;
+    [ ^^shl ] binary-op ;
 
 : emit-fixnum-right-shift ( -- )
-    [ ^^untag-fixnum ^^neg ^^sar dup tag-mask get ^^and-imm ^^xor ] emit-fixnum-op ;
+    [
+        [ tag-bits get ^^shl-imm ] dip
+        ^^neg ^^sar
+        tag-bits get ^^sar-imm
+    ] binary-op ;
 
 : emit-fixnum-shift-general ( -- )
-    ds-peek 0 cc> ##compare-imm-branch
+    ds-peek 0 cc> ##compare-integer-imm-branch
     [ emit-fixnum-left-shift ] with-branch
     [ emit-fixnum-right-shift ] with-branch
     2array emit-conditional ;
@@ -44,29 +43,24 @@ IN: compiler.cfg.intrinsics.fixnum
         { [ dup 0 [-inf,a] interval-subset? ] [ drop emit-fixnum-right-shift ] }
         [ drop emit-fixnum-shift-general ]
     } cond ;
-    
-: emit-fixnum-bitnot ( -- )
-    ds-pop ^^not tag-mask get ^^xor-imm ds-push ;
-
-: emit-fixnum-log2 ( -- )
-    ds-pop ^^log2 tag-bits get ^^sub-imm ^^tag-fixnum ds-push ;
-
-: emit-fixnum*fast ( -- )
-    2inputs ^^untag-fixnum ^^mul ds-push ;
 
 : emit-fixnum-comparison ( cc -- )
-    '[ _ ^^compare ] emit-fixnum-op ;
+    '[ _ ^^compare-integer ] binary-op ;
 
 : emit-no-overflow-case ( dst -- final-bb )
     [ ds-drop ds-drop ds-push ] with-branch ;
 
 : emit-overflow-case ( word -- final-bb )
-    [ ##call -1 adjust-d ] with-branch ;
+    [
+        ##call
+        -1 adjust-d
+        make-kill-block
+    ] with-branch ;
 
 : emit-fixnum-overflow-op ( quot word -- )
     ! Inputs to the final instruction need to be copied because
     ! of loc>vreg sync
-    [ [ (2inputs) [ any-rep ^^copy ] bi@ ] dip call ] dip
+    [ [ (2inputs) [ any-rep ^^copy ] bi@ cc/o ] dip call ] dip
     [ emit-no-overflow-case ] [ emit-overflow-case ] bi* 2array
     emit-conditional ; inline
 
@@ -83,4 +77,4 @@ IN: compiler.cfg.intrinsics.fixnum
     [ ^^fixnum-sub ] \ fixnum-overflow emit-fixnum-overflow-op ;
 
 : emit-fixnum* ( -- )
-    [ ^^untag-fixnum ^^fixnum-mul ] \ fixnum*overflow emit-fixnum-overflow-op ;
\ No newline at end of file
+    [ ^^fixnum-mul ] \ fixnum*overflow emit-fixnum-overflow-op ;
\ No newline at end of file
index 8a65de5805f2dfa9a0da682b831565bc92c595d2..480b46f9b3ec8525d8ce66a327f64046320c02ac 100644 (file)
@@ -1,29 +1,17 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel compiler.cfg.stacks compiler.cfg.hats
+USING: fry kernel compiler.cfg.stacks compiler.cfg.hats
 compiler.cfg.instructions compiler.cfg.utilities ;
 IN: compiler.cfg.intrinsics.float
 
-: emit-float-op ( insn -- )
-    [ 2inputs ] dip call ds-push ; inline
-
 : emit-float-ordered-comparison ( cc -- )
-    [ 2inputs ] dip ^^compare-float-ordered ds-push ; inline
+    '[ _ ^^compare-float-ordered ] binary-op ; inline
 
 : emit-float-unordered-comparison ( cc -- )
-    [ 2inputs ] dip ^^compare-float-unordered ds-push ; inline
-
-: emit-float>fixnum ( -- )
-    ds-pop ^^float>integer ^^tag-fixnum ds-push ;
-
-: emit-fixnum>float ( -- )
-    ds-pop ^^untag-fixnum ^^integer>float ds-push ;
-
-: emit-fsqrt ( -- )
-    ds-pop ^^sqrt ds-push ;
+    '[ _ ^^compare-float-unordered ] binary-op ; inline
 
 : emit-unary-float-function ( func -- )
-    [ ds-pop ] dip ^^unary-float-function ds-push ;
+    '[ _ ^^unary-float-function ] unary-op ;
 
 : emit-binary-float-function ( func -- )
-    [ 2inputs ] dip ^^binary-float-function ds-push ;
+    '[ _ ^^binary-float-function ] binary-op ;
index d753a4c1b496c75cbf0a329e9147bc685689ba23..bf8ba96c342647bdfcf17fff09614e6b6b827bd0 100644 (file)
@@ -1,17 +1,21 @@
-! Copyright (C) 2008, 2009 Slava Pestov, Doug Coleman.
+! Copyright (C) 2008, 2010 Slava Pestov, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: words sequences kernel combinators cpu.architecture assocs
 compiler.cfg.hats
+compiler.cfg.stacks
 compiler.cfg.instructions
 compiler.cfg.intrinsics.alien
 compiler.cfg.intrinsics.allot
 compiler.cfg.intrinsics.fixnum
 compiler.cfg.intrinsics.float
 compiler.cfg.intrinsics.slots
+compiler.cfg.intrinsics.strings
 compiler.cfg.intrinsics.misc
 compiler.cfg.comparisons ;
 QUALIFIED: alien
 QUALIFIED: alien.accessors
+QUALIFIED: alien.data.private
+QUALIFIED: alien.c-types
 QUALIFIED: kernel
 QUALIFIED: arrays
 QUALIFIED: byte-arrays
@@ -20,6 +24,7 @@ QUALIFIED: slots.private
 QUALIFIED: strings.private
 QUALIFIED: classes.tuple.private
 QUALIFIED: math.private
+QUALIFIED: math.bitwise.private
 QUALIFIED: math.integers.private
 QUALIFIED: math.floats.private
 QUALIFIED: math.libm
@@ -30,61 +35,65 @@ IN: compiler.cfg.intrinsics
 
 {
     { kernel.private:tag [ drop emit-tag ] }
+    { kernel.private:context-object [ emit-context-object ] }
     { kernel.private:special-object [ emit-special-object ] }
+    { kernel.private:set-special-object [ emit-set-special-object ] }
     { kernel.private:(identity-hashcode) [ drop emit-identity-hashcode ] }
     { math.private:both-fixnums? [ drop emit-both-fixnums? ] }
     { math.private:fixnum+ [ drop emit-fixnum+ ] }
     { math.private:fixnum- [ drop emit-fixnum- ] }
     { math.private:fixnum* [ drop emit-fixnum* ] }
-    { math.private:fixnum+fast [ drop [ ^^add ] emit-fixnum-op ] }
-    { math.private:fixnum-fast [ drop [ ^^sub ] emit-fixnum-op ] }
-    { math.private:fixnum*fast [ drop emit-fixnum*fast ] }
-    { math.private:fixnum-bitand [ drop [ ^^and ] emit-fixnum-op ] }
-    { math.private:fixnum-bitor [ drop [ ^^or ] emit-fixnum-op ] }
-    { math.private:fixnum-bitxor [ drop [ ^^xor ] emit-fixnum-op ] }
+    { math.private:fixnum+fast [ drop [ ^^add ] binary-op ] }
+    { math.private:fixnum-fast [ drop [ ^^sub ] binary-op ] }
+    { math.private:fixnum*fast [ drop [ ^^mul ] binary-op ] }
+    { math.private:fixnum-bitand [ drop [ ^^and ] binary-op ] }
+    { math.private:fixnum-bitor [ drop [ ^^or ] binary-op ] }
+    { math.private:fixnum-bitxor [ drop [ ^^xor ] binary-op ] }
     { math.private:fixnum-shift-fast [ emit-fixnum-shift-fast ] }
-    { math.private:fixnum-bitnot [ drop emit-fixnum-bitnot ] }
+    { math.private:fixnum-bitnot [ drop [ ^^not ] unary-op ] }
     { math.private:fixnum< [ drop cc< emit-fixnum-comparison ] }
     { math.private:fixnum<= [ drop cc<= emit-fixnum-comparison ] }
     { math.private:fixnum>= [ drop cc>= emit-fixnum-comparison ] }
     { math.private:fixnum> [ drop cc> emit-fixnum-comparison ] }
-    { kernel:eq? [ drop cc= emit-fixnum-comparison ] }
+    { kernel:eq? [ emit-eq ] }
     { slots.private:slot [ emit-slot ] }
     { slots.private:set-slot [ emit-set-slot ] }
-    { strings.private:string-nth [ drop emit-string-nth ] }
+    { strings.private:string-nth-fast [ drop emit-string-nth-fast ] }
     { strings.private:set-string-nth-fast [ drop emit-set-string-nth-fast ] }
     { classes.tuple.private:<tuple-boa> [ emit-<tuple-boa> ] }
     { arrays:<array> [ emit-<array> ] }
     { byte-arrays:<byte-array> [ emit-<byte-array> ] }
     { byte-arrays:(byte-array) [ emit-(byte-array) ] }
     { kernel:<wrapper> [ emit-simple-allot ] }
+    { alien.data.private:(local-allot) [ emit-local-allot ] }
+    { alien.data.private:(cleanup-allot) [ drop emit-cleanup-allot ] }
     { alien:<displaced-alien> [ emit-<displaced-alien> ] }
-    { alien.accessors:alien-unsigned-1 [ 1 emit-alien-unsigned-getter ] }
-    { alien.accessors:set-alien-unsigned-1 [ 1 emit-alien-integer-setter ] }
-    { alien.accessors:alien-signed-1 [ 1 emit-alien-signed-getter ] }
-    { alien.accessors:set-alien-signed-1 [ 1 emit-alien-integer-setter ] }
-    { alien.accessors:alien-unsigned-2 [ 2 emit-alien-unsigned-getter ] }
-    { alien.accessors:set-alien-unsigned-2 [ 2 emit-alien-integer-setter ] }
-    { alien.accessors:alien-signed-2 [ 2 emit-alien-signed-getter ] }
-    { alien.accessors:set-alien-signed-2 [ 2 emit-alien-integer-setter ] }
-    { alien.accessors:alien-cell [ emit-alien-cell-getter ] }
-    { alien.accessors:set-alien-cell [ emit-alien-cell-setter ] }
+    { alien.accessors:alien-unsigned-1 [ int-rep alien.c-types:uchar emit-load-memory ] }
+    { alien.accessors:set-alien-unsigned-1 [ int-rep alien.c-types:uchar emit-store-memory ] }
+    { alien.accessors:alien-signed-1 [ int-rep alien.c-types:char emit-load-memory ] }
+    { alien.accessors:set-alien-signed-1 [ int-rep alien.c-types:char emit-store-memory ] }
+    { alien.accessors:alien-unsigned-2 [ int-rep alien.c-types:ushort emit-load-memory ] }
+    { alien.accessors:set-alien-unsigned-2 [ int-rep alien.c-types:ushort emit-store-memory ] }
+    { alien.accessors:alien-signed-2 [ int-rep alien.c-types:short emit-load-memory ] }
+    { alien.accessors:set-alien-signed-2 [ int-rep alien.c-types:short emit-store-memory ] }
+    { alien.accessors:alien-cell [ emit-alien-cell ] }
+    { alien.accessors:set-alien-cell [ emit-set-alien-cell ] }
 } enable-intrinsics
 
 : enable-alien-4-intrinsics ( -- )
     {
-        { alien.accessors:alien-unsigned-4 [ 4 emit-alien-unsigned-getter ] }
-        { alien.accessors:set-alien-unsigned-4 [ 4 emit-alien-integer-setter ] }
-        { alien.accessors:alien-signed-4 [ 4 emit-alien-signed-getter ] }
-        { alien.accessors:set-alien-signed-4 [ 4 emit-alien-integer-setter ] }
+        { alien.accessors:alien-signed-4 [ int-rep alien.c-types:int emit-load-memory ] }
+        { alien.accessors:set-alien-signed-4 [ int-rep alien.c-types:int emit-store-memory ] }
+        { alien.accessors:alien-unsigned-4 [ int-rep alien.c-types:uint emit-load-memory ] }
+        { alien.accessors:set-alien-unsigned-4 [ int-rep alien.c-types:uint emit-store-memory ] }
     } enable-intrinsics ;
 
 : enable-float-intrinsics ( -- )
     {
-        { math.private:float+ [ drop [ ^^add-float ] emit-float-op ] }
-        { math.private:float- [ drop [ ^^sub-float ] emit-float-op ] }
-        { math.private:float* [ drop [ ^^mul-float ] emit-float-op ] }
-        { math.private:float/f [ drop [ ^^div-float ] emit-float-op ] }
+        { math.private:float+ [ drop [ ^^add-float ] binary-op ] }
+        { math.private:float- [ drop [ ^^sub-float ] binary-op ] }
+        { math.private:float* [ drop [ ^^mul-float ] binary-op ] }
+        { math.private:float/f [ drop [ ^^div-float ] binary-op ] }
         { math.private:float< [ drop cc< emit-float-ordered-comparison ] }
         { math.private:float<= [ drop cc<= emit-float-ordered-comparison ] }
         { math.private:float>= [ drop cc>= emit-float-ordered-comparison ] }
@@ -94,24 +103,24 @@ IN: compiler.cfg.intrinsics
         { math.private:float-u>= [ drop cc>= emit-float-unordered-comparison ] }
         { math.private:float-u> [ drop cc> emit-float-unordered-comparison ] }
         { math.private:float= [ drop cc= emit-float-unordered-comparison ] }
-        { math.private:float>fixnum [ drop emit-float>fixnum ] }
-        { math.private:fixnum>float [ drop emit-fixnum>float ] }
+        { math.private:float>fixnum [ drop [ ^^float>integer ] unary-op ] }
+        { math.private:fixnum>float [ drop [ ^^integer>float ] unary-op ] }
         { math.floats.private:float-unordered? [ drop cc/<>= emit-float-unordered-comparison ] }
-        { alien.accessors:alien-float [ float-rep emit-alien-float-getter ] }
-        { alien.accessors:set-alien-float [ float-rep emit-alien-float-setter ] }
-        { alien.accessors:alien-double [ double-rep emit-alien-float-getter ] }
-        { alien.accessors:set-alien-double [ double-rep emit-alien-float-setter ] }
+        { alien.accessors:alien-float [ float-rep f emit-load-memory ] }
+        { alien.accessors:set-alien-float [ float-rep f emit-store-memory ] }
+        { alien.accessors:alien-double [ double-rep f emit-load-memory ] }
+        { alien.accessors:set-alien-double [ double-rep f emit-store-memory ] }
     } enable-intrinsics ;
 
 : enable-fsqrt ( -- )
     {
-        { math.libm:fsqrt [ drop emit-fsqrt ] }
+        { math.libm:fsqrt [ drop [ ^^sqrt ] unary-op ] }
     } enable-intrinsics ;
 
 : enable-float-min/max ( -- )
     {
-        { math.floats.private:float-min [ drop [ ^^min-float ] emit-float-op ] }
-        { math.floats.private:float-max [ drop [ ^^max-float ] emit-float-op ] }
+        { math.floats.private:float-min [ drop [ ^^min-float ] binary-op ] }
+        { math.floats.private:float-max [ drop [ ^^max-float ] binary-op ] }
     } enable-intrinsics ;
 
 : enable-float-functions ( -- )
@@ -141,13 +150,18 @@ IN: compiler.cfg.intrinsics
 
 : enable-min/max ( -- )
     {
-        { math.integers.private:fixnum-min [ drop [ ^^min ] emit-fixnum-op ] }
-        { math.integers.private:fixnum-max [ drop [ ^^max ] emit-fixnum-op ] }
+        { math.integers.private:fixnum-min [ drop [ ^^min ] binary-op ] }
+        { math.integers.private:fixnum-max [ drop [ ^^max ] binary-op ] }
     } enable-intrinsics ;
 
-: enable-fixnum-log2 ( -- )
+: enable-log2 ( -- )
     {
-        { math.integers.private:fixnum-log2 [ drop emit-fixnum-log2 ] }
+        { math.integers.private:fixnum-log2 [ drop [ ^^log2 ] unary-op ] }
+    } enable-intrinsics ;
+
+: enable-bit-count ( -- )
+    {
+        { math.bitwise.private:fixnum-bit-count [ drop [ ^^bit-count ] unary-op ] }
     } enable-intrinsics ;
 
 : emit-intrinsic ( node word -- )
index fed5492220847bbd760935147a1995d2c94151f3..62bb15f95333c65809913f316d1c507df6ad2ae0 100644 (file)
@@ -1,22 +1,63 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: namespaces layouts sequences kernel math accessors
-compiler.tree.propagation.info compiler.cfg.stacks
-compiler.cfg.hats compiler.cfg.instructions
+USING: accessors classes.algebra layouts kernel math namespaces
+sequences cpu.architecture
+compiler.tree.propagation.info
+compiler.cfg.stacks
+compiler.cfg.hats
+compiler.cfg.comparisons
+compiler.cfg.instructions
+compiler.cfg.builder.blocks
 compiler.cfg.utilities ;
+FROM: vm => context-field-offset vm-field-offset ;
+QUALIFIED-WITH: alien.c-types c
 IN: compiler.cfg.intrinsics.misc
 
 : emit-tag ( -- )
-    ds-pop tag-mask get ^^and-imm ^^tag-fixnum ds-push ;
+    [ ^^tagged>integer tag-mask get ^^and-imm ] unary-op ;
+
+: emit-eq ( node -- )
+    node-input-infos first2 [ class>> fixnum class<= ] both?
+    [ [ cc= ^^compare-integer ] binary-op ] [ [ cc= ^^compare ] binary-op ] if ;
+
+: special-object-offset ( n -- offset )
+    cells "special-objects" vm-field-offset + ;
 
 : emit-special-object ( node -- )
-    "special-objects" ^^vm-field-ptr
-    swap node-input-infos first literal>>
-    [ ds-drop 0 ^^slot-imm ] [ ds-pop ^^offset>slot ^^slot ] if*
-    ds-push ;
+    dup node-input-infos first literal>> [
+        ds-drop
+        special-object-offset ^^vm-field
+        ds-push
+    ] [ emit-primitive ] ?if ;
+
+: emit-set-special-object ( node -- )
+    dup node-input-infos second literal>> [
+        ds-drop
+        [ ds-pop ] dip special-object-offset ##set-vm-field
+    ] [ emit-primitive ] ?if ;
+
+: context-object-offset ( n -- n )
+    cells "context-objects" context-field-offset + ;
+
+: emit-context-object ( node -- )
+    dup node-input-infos first literal>> [
+        "ctx" vm-field-offset ^^vm-field
+        ds-drop swap context-object-offset cell /i 0 ^^slot-imm ds-push
+    ] [ emit-primitive ] ?if ;
 
 : emit-identity-hashcode ( -- )
-    ds-pop tag-mask get bitnot ^^load-immediate ^^and 0 0 ^^slot-imm
-    hashcode-shift ^^shr-imm
-    ^^tag-fixnum
-    ds-push ;
+    [
+        ^^tagged>integer
+        tag-mask get bitnot ^^load-integer ^^and
+        0 int-rep f ^^load-memory-imm
+        hashcode-shift ^^shr-imm
+    ] unary-op ;
+
+: emit-local-allot ( node -- )
+    dup node-input-infos first2 [ literal>> ] bi@ 2dup [ integer? ] both?
+    [ ds-drop ds-drop f ^^local-allot ^^box-alien ds-push drop ]
+    [ 2drop emit-primitive ]
+    if ;
+
+: emit-cleanup-allot ( -- )
+    [ ##no-tco ] emit-trivial-block ;
index e8b9e3c5de3bc2abfc31138d76c16991815faf1d..84ffc208d5975bff0d49a1a9bf4b4ed067a8a22e 100644 (file)
@@ -3,145 +3,100 @@ USING: accessors arrays assocs classes combinators
 combinators.short-circuit compiler.cfg.builder.blocks
 compiler.cfg.registers compiler.cfg.stacks
 compiler.cfg.stacks.local compiler.tree.propagation.info
+compiler.cfg.instructions
 cpu.architecture effects fry generalizations
-kernel locals macros math namespaces quotations sequences
-splitting stack-checker words ;
+kernel locals macros make math namespaces quotations sequences
+sequences.generalizations splitting stack-checker words ;
 IN: compiler.cfg.intrinsics.simd.backend
 
 ! Selection of implementation based on available CPU instructions
 
-: can-has? ( quot -- ? )
-    [ t \ can-has? ] dip '[ @ drop \ can-has? get ] with-variable ; inline
-
-: can-has-rep? ( rep reps -- )
-    member? \ can-has? [ and ] change ; inline
-
-GENERIC: create-can-has ( word -- word' )
-
-PREDICATE: hat-word < word
-    {
-        [ name>> { [ "^" head? ] [ "##" head? ] } 1|| ]
-        [ vocabulary>> { "compiler.cfg.intrinsics.simd" "compiler.cfg.hats" } member? ]
-    } 1&& ;
-
-PREDICATE: vector-op-word < hat-word
-    name>> "-vector" swap subseq? ;
-
-: reps-word ( word -- word' )
-    name>> "^^" ?head drop "##" ?head drop
-    "%" "-reps" surround "cpu.architecture" lookup ;
-
-SYMBOL: blub
-
-:: can-has-^^-quot ( word def effect -- quot )
-    effect in>> { "rep" } split1 [ length ] bi@ 1 +
-    word reps-word 1quotation
-    effect out>> length blub <array> >quotation
-    '[ [ _ ndrop ] _ ndip @ can-has-rep? @ ] ;
-
-:: can-has-^-quot ( word def effect -- quot )
-    def create-can-has first ;
-
-: map-concat-like ( seq quot -- seq' )
-    '[ _ map ] [ concat-as ] bi ; inline
-
-M: object create-can-has 1quotation ;
-
-M: array create-can-has
-    [ create-can-has ] map-concat-like 1quotation ;
-M: callable create-can-has
-    [ create-can-has ] map-concat-like 1quotation ;
-
-: (can-has-word) ( word -- word' )
-    name>> "can-has-" prepend "compiler.cfg.intrinsics.simd.backend" lookup ;
-
-: (can-has-quot) ( word -- quot )
-    [ ] [ def>> ] [ stack-effect ] tri {
-        { [ pick name>> "^^" head? ] [ can-has-^^-quot ] }
-        { [ pick name>> "##" head? ] [ can-has-^^-quot ] }
-        { [ pick name>> "^"  head? ] [ can-has-^-quot  ] }
-    } cond ;
-
-: (can-has-nop-quot) ( word -- quot )
-    stack-effect in>> length '[ _ ndrop blub ] ;
-
-DEFER: can-has-words
-
-M: word create-can-has
-    can-has-words ?at drop 1quotation ;
-
-M: hat-word create-can-has
-    (can-has-nop-quot) ;
-
-M: vector-op-word create-can-has
-    dup (can-has-word) [ 1quotation ] [ (can-has-quot) ] ?if ;
-
-GENERIC# >can-has-cond 2 ( quot #pick #dup -- quotpair )
-M:: callable >can-has-cond ( quot #pick #dup -- quotpair )
-    #dup quot create-can-has '[ _ ndup @ can-has? ] quot 2array ;
-
-M:: pair >can-has-cond ( pair #pick #dup -- quotpair )
+GENERIC: insn-available? ( ## -- reps )
+
+M: object insn-available? drop t ;
+
+M: ##zero-vector insn-available? rep>> %zero-vector-reps member? ;
+M: ##fill-vector insn-available? rep>> %fill-vector-reps member? ;
+M: ##gather-vector-2 insn-available? rep>> %gather-vector-2-reps member? ;
+M: ##gather-vector-4 insn-available? rep>> %gather-vector-4-reps member? ;
+M: ##gather-int-vector-2 insn-available? rep>> %gather-int-vector-2-reps member? ;
+M: ##gather-int-vector-4 insn-available? rep>> %gather-int-vector-4-reps member? ;
+M: ##select-vector insn-available? rep>> %select-vector-reps member? ;
+M: ##store-memory-imm insn-available? rep>> %alien-vector-reps member? ;
+M: ##shuffle-vector insn-available? rep>> %shuffle-vector-reps member? ;
+M: ##shuffle-vector-imm insn-available? rep>> %shuffle-vector-imm-reps member? ;
+M: ##shuffle-vector-halves-imm insn-available? rep>> %shuffle-vector-halves-imm-reps member? ;
+M: ##merge-vector-head insn-available? rep>> %merge-vector-reps member? ;
+M: ##merge-vector-tail insn-available? rep>> %merge-vector-reps member? ;
+M: ##float-pack-vector insn-available? rep>> %float-pack-vector-reps member? ;
+M: ##signed-pack-vector insn-available? rep>> %signed-pack-vector-reps member? ;
+M: ##unsigned-pack-vector insn-available? rep>> %unsigned-pack-vector-reps member? ;
+M: ##unpack-vector-head insn-available? rep>> %unpack-vector-head-reps member? ;
+M: ##unpack-vector-tail insn-available? rep>> %unpack-vector-tail-reps member? ;
+M: ##tail>head-vector insn-available? rep>> %unpack-vector-head-reps member? ;
+M: ##integer>float-vector insn-available? rep>> %integer>float-vector-reps member? ;
+M: ##float>integer-vector insn-available? rep>> %float>integer-vector-reps member? ;
+M: ##compare-vector insn-available? [ rep>> ] [ cc>> ] bi %compare-vector-reps member? ;
+M: ##test-vector insn-available? rep>> %test-vector-reps member? ;
+M: ##add-vector insn-available? rep>> %add-vector-reps member? ;
+M: ##saturated-add-vector insn-available? rep>> %saturated-add-vector-reps member? ;
+M: ##add-sub-vector insn-available? rep>> %add-sub-vector-reps member? ;
+M: ##sub-vector insn-available? rep>> %sub-vector-reps member? ;
+M: ##saturated-sub-vector insn-available? rep>> %saturated-sub-vector-reps member? ;
+M: ##mul-vector insn-available? rep>> %mul-vector-reps member? ;
+M: ##mul-high-vector insn-available? rep>> %mul-high-vector-reps member? ;
+M: ##mul-horizontal-add-vector insn-available? rep>> %mul-horizontal-add-vector-reps member? ;
+M: ##saturated-mul-vector insn-available? rep>> %saturated-mul-vector-reps member? ;
+M: ##div-vector insn-available? rep>> %div-vector-reps member? ;
+M: ##min-vector insn-available? rep>> %min-vector-reps member? ;
+M: ##max-vector insn-available? rep>> %max-vector-reps member? ;
+M: ##avg-vector insn-available? rep>> %avg-vector-reps member? ;
+M: ##dot-vector insn-available? rep>> %dot-vector-reps member? ;
+M: ##sad-vector insn-available? rep>> %sad-vector-reps member? ;
+M: ##sqrt-vector insn-available? rep>> %sqrt-vector-reps member? ;
+M: ##horizontal-add-vector insn-available? rep>> %horizontal-add-vector-reps member? ;
+M: ##horizontal-sub-vector insn-available? rep>> %horizontal-sub-vector-reps member? ;
+M: ##abs-vector insn-available? rep>> %abs-vector-reps member? ;
+M: ##and-vector insn-available? rep>> %and-vector-reps member? ;
+M: ##andn-vector insn-available? rep>> %andn-vector-reps member? ;
+M: ##or-vector insn-available? rep>> %or-vector-reps member? ;
+M: ##xor-vector insn-available? rep>> %xor-vector-reps member? ;
+M: ##not-vector insn-available? rep>> %not-vector-reps member? ;
+M: ##shl-vector insn-available? rep>> %shl-vector-reps member? ;
+M: ##shr-vector insn-available? rep>> %shr-vector-reps member? ;
+M: ##shl-vector-imm insn-available? rep>> %shl-vector-imm-reps member? ;
+M: ##shr-vector-imm insn-available? rep>> %shr-vector-imm-reps member? ;
+M: ##horizontal-shl-vector-imm insn-available? rep>> %horizontal-shl-vector-imm-reps member? ;
+M: ##horizontal-shr-vector-imm insn-available? rep>> %horizontal-shr-vector-imm-reps member? ;
+
+: [vector-op-checked] ( #dup quot -- quot )
+    '[ _ ndup [ @ ] { } make dup [ insn-available? ] all? ] ;
+
+GENERIC# >vector-op-cond 2 ( quot #pick #dup -- quotpair )
+M:: callable >vector-op-cond ( quot #pick #dup -- quotpair )
+    #dup quot [vector-op-checked] '[ 2drop @ ]
+    #dup '[ % _ nnip ]
+    2array ;
+
+M:: pair >vector-op-cond ( pair #pick #dup -- quotpair )
     pair first2 :> ( class quot )
-    #pick class #dup quot create-can-has
-    '[ _ npick _ instance? [ _ ndup @ can-has? ] dip and ]
-    quot 2array ;
+    #pick class #dup quot [vector-op-checked]
+    '[ 2drop _ npick _ instance? _ [ f f f ] if ]
+    #dup '[ % _ nnip ]
+    2array ;
 
 MACRO: v-vector-op ( trials -- )
-    [ 1 2 >can-has-cond ] map '[ _ cond ] ;
+    [ 1 2 >vector-op-cond ] map '[ f f _ cond ] ;
 MACRO: vl-vector-op ( trials -- )
-    [ 1 3 >can-has-cond ] map '[ _ cond ] ;
+    [ 1 3 >vector-op-cond ] map '[ f f _ cond ] ;
+MACRO: vvl-vector-op ( trials -- )
+    [ 1 4 >vector-op-cond ] map '[ f f _ cond ] ;
 MACRO: vv-vector-op ( trials -- )
-    [ 1 3 >can-has-cond ] map '[ _ cond ] ;
+    [ 1 3 >vector-op-cond ] map '[ f f _ cond ] ;
 MACRO: vv-cc-vector-op ( trials -- )
-    [ 2 4 >can-has-cond ] map '[ _ cond ] ;
+    [ 2 4 >vector-op-cond ] map '[ f f _ cond ] ;
 MACRO: vvvv-vector-op ( trials -- )
-    [ 1 5 >can-has-cond ] map '[ _ cond ] ;
-
-! Special-case conditional instructions
-
-: can-has-^(compare-vector) ( src1 src2 rep cc -- dst )
-    [ 2drop ] 2dip %compare-vector-reps member?
-    \ can-has? [ and ] change
-    blub ;
-
-: can-has-^^test-vector ( src rep vcc -- dst )
-    [ drop ] 2dip drop %test-vector-reps member?
-    \ can-has? [ and ] change
-    blub ;
-
-MACRO: can-has-case ( cases -- )
-    dup first second inputs 1 +
-    '[ _ ndrop f ] suffix '[ _ case ] ;
-
-GENERIC# >can-has-trial 1 ( obj #pick -- quot )
-
-M: callable >can-has-trial
-    drop '[ _ can-has? ] ;
-M: pair >can-has-trial
-    swap first2 dup inputs
-    '[ _ npick _ instance? [ _ can-has? ] [ _ ndrop blub ] if ] ; 
-
-MACRO: can-has-vector-op ( trials #pick #dup -- )
-    [ '[ _ >can-has-trial ] map ] dip '[ _ _ n|| \ can-has? [ and ] change blub ] ;
-
-: can-has-v-vector-op ( trials -- ? )
-    1 2 can-has-vector-op ; inline
-: can-has-vv-vector-op ( trials -- ? )
-    1 3 can-has-vector-op ; inline
-: can-has-vv-cc-vector-op ( trials -- ? )
-    2 4 can-has-vector-op ; inline
-: can-has-vvvv-vector-op ( trials -- ? )
-    1 5 can-has-vector-op ; inline
-
-CONSTANT: can-has-words
-    H{
-        { case can-has-case }
-        { v-vector-op     can-has-v-vector-op  }
-        { vl-vector-op    can-has-vv-vector-op }
-        { vv-vector-op    can-has-vv-vector-op }
-        { vv-cc-vector-op can-has-vv-cc-vector-op }
-        { vvvv-vector-op  can-has-vvvv-vector-op }
-    }
+    [ 1 5 >vector-op-cond ] map '[ f f _ cond ] ;
 
 ! Intrinsic code emission
 
@@ -170,9 +125,10 @@ MACRO: if-literals-match ( quots -- )
         ] [ 2drop bad-simd-intrinsic ] if
     ] ;
 
-CONSTANT: [unary]       [ ds-drop  ds-pop ]
-CONSTANT: [unary/param] [ [ -2 inc-d ds-pop ] dip ]
-CONSTANT: [binary]      [ ds-drop 2inputs ]
+CONSTANT: [unary]        [ ds-drop  ds-pop ]
+CONSTANT: [unary/param]  [ [ -2 inc-d ds-pop ] dip ]
+CONSTANT: [binary]       [ ds-drop 2inputs ]
+CONSTANT: [binary/param] [ [ -2 inc-d 2inputs ] dip ]
 CONSTANT: [quaternary]
     [
         ds-drop 
@@ -193,6 +149,8 @@ MACRO: emit-vl-vector-op ( trials literal-pred -- )
     [ [unary/param] [ vl-vector-op ] { [ representation? ] } ] dip prefix [emit-vector-op] ;
 MACRO: emit-vv-vector-op ( trials -- )
     [binary] [ vv-vector-op ] { [ representation? ] } [emit-vector-op] ;
+MACRO: emit-vvl-vector-op ( trials literal-pred -- )
+    [ [binary/param] [ vvl-vector-op ] { [ representation? ] } ] dip prefix [emit-vector-op] ;
 MACRO: emit-vvvv-vector-op ( trials -- )
     [quaternary] [ vvvv-vector-op ] { [ representation? ] } [emit-vector-op] ;
 
index 8bd936c4f6f33d6a255357cc81d0c4124aea8696..96c8da8ace2e616f1973db8e34e246a315f98f6c 100644 (file)
@@ -127,7 +127,7 @@ unit-test
 unit-test
 
 ! vneg
-[ { ##load-constant ##sub-vector } ]
+[ { ##load-reference ##sub-vector } ]
 [ simple-ops-cpu float-4-rep [ emit-simd-vneg ] test-emit ]
 unit-test
 
@@ -153,11 +153,11 @@ M: addsub-cpu %add-sub-vector-reps { int-4-rep float-4-rep } ;
 [ addsub-cpu float-4-rep [ emit-simd-v+- ] test-emit ]
 unit-test
 
-[ { ##load-constant ##xor-vector ##add-vector } ]
+[ { ##load-reference ##xor-vector ##add-vector } ]
 [ simple-ops-cpu float-4-rep [ emit-simd-v+- ] test-emit ]
 unit-test
 
-[ { ##load-constant ##xor-vector ##sub-vector ##add-vector } ]
+[ { ##load-reference ##xor-vector ##sub-vector ##add-vector } ]
 [ simple-ops-cpu int-4-rep [ emit-simd-v+- ] test-emit ]
 unit-test
 
@@ -301,7 +301,7 @@ unit-test
 [ abs-cpu float-4-rep [ emit-simd-vabs ] test-emit ]
 unit-test
 
-[ { ##load-constant ##andn-vector } ]
+[ { ##load-reference ##andn-vector } ]
 [ simple-ops-cpu float-4-rep [ emit-simd-vabs ] test-emit ]
 unit-test
 
@@ -388,7 +388,7 @@ TUPLE: shuffle-cpu < simple-ops-cpu ;
 M: shuffle-cpu %shuffle-vector-reps signed-reps ;
 
 ! vshuffle-elements
-[ { ##load-constant ##shuffle-vector } ]
+[ { ##load-reference ##shuffle-vector } ]
 [ shuffle-cpu { 0 1 2 3 } int-4-rep [ emit-simd-vshuffle-elements ] test-emit-literal ]
 unit-test
 
@@ -420,7 +420,7 @@ unit-test
 [ minmax-cpu int-4-rep [ emit-simd-v<= ] test-emit ]
 unit-test
 
-[ { ##load-constant ##xor-vector ##xor-vector ##compare-vector } ]
+[ { ##load-reference ##xor-vector ##xor-vector ##compare-vector } ]
 [ compare-cpu uint-4-rep [ emit-simd-v<= ] test-emit ]
 unit-test
 
index 0d413f1346c7773a6289aa3840e275a2d9f4e70d..9d15feb96f0a8323e1d15ccd7780128b86f8017a 100644 (file)
@@ -43,24 +43,24 @@ IN: compiler.cfg.intrinsics.simd
 
 : ^load-neg-zero-vector ( rep -- dst )
     {
-        { float-4-rep [ float-array{ -0.0 -0.0 -0.0 -0.0 } underlying>> ^^load-constant ] }
-        { double-2-rep [ double-array{ -0.0 -0.0 } underlying>> ^^load-constant ] }
+        { float-4-rep [ float-array{ -0.0 -0.0 -0.0 -0.0 } underlying>> ^^load-literal ] }
+        { double-2-rep [ double-array{ -0.0 -0.0 } underlying>> ^^load-literal ] }
     } case ;
 
 : ^load-add-sub-vector ( rep -- dst )
     signed-rep {
-        { float-4-rep    [ float-array{ -0.0  0.0 -0.0  0.0 } underlying>> ^^load-constant ] }
-        { double-2-rep   [ double-array{ -0.0  0.0 } underlying>> ^^load-constant ] }
-        { char-16-rep    [ char-array{ -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 } underlying>> ^^load-constant ] }
-        { short-8-rep    [ short-array{ -1 0 -1 0 -1 0 -1 0 } underlying>> ^^load-constant ] }
-        { int-4-rep      [ int-array{ -1 0 -1 0 } underlying>> ^^load-constant ] }
-        { longlong-2-rep [ longlong-array{ -1 0 } underlying>> ^^load-constant ] }
+        { float-4-rep    [ float-array{ -0.0  0.0 -0.0  0.0 } underlying>> ^^load-literal ] }
+        { double-2-rep   [ double-array{ -0.0  0.0 } underlying>> ^^load-literal ] }
+        { char-16-rep    [ char-array{ -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 } underlying>> ^^load-literal ] }
+        { short-8-rep    [ short-array{ -1 0 -1 0 -1 0 -1 0 } underlying>> ^^load-literal ] }
+        { int-4-rep      [ int-array{ -1 0 -1 0 } underlying>> ^^load-literal ] }
+        { longlong-2-rep [ longlong-array{ -1 0 } underlying>> ^^load-literal ] }
     } case ;
 
 : ^load-half-vector ( rep -- dst )
     {
-        { float-4-rep  [ float-array{  0.5 0.5 0.5 0.5 } underlying>> ^^load-constant ] }
-        { double-2-rep [ double-array{ 0.5 0.5 }         underlying>> ^^load-constant ] }
+        { float-4-rep  [ float-array{  0.5 0.5 0.5 0.5 } underlying>> ^^load-literal ] }
+        { double-2-rep [ double-array{ 0.5 0.5 }         underlying>> ^^load-literal ] }
     } case ;
 
 : >variable-shuffle ( shuffle rep -- shuffle' )
@@ -70,7 +70,7 @@ IN: compiler.cfg.intrinsics.simd
     '[ _ n*v _ v+ ] map concat ;
 
 : ^load-immediate-shuffle ( shuffle rep -- dst )
-    >variable-shuffle ^^load-constant ;
+    >variable-shuffle ^^load-literal ;
 
 :: ^blend-vector ( mask true false rep -- dst )
     true mask rep ^^and-vector
@@ -118,7 +118,7 @@ IN: compiler.cfg.intrinsics.simd
         [ ^(compare-vector) ]
         [ ^minmax-compare-vector ]
         { unsigned-int-vector-rep [| src1 src2 rep cc |
-            rep sign-bit-mask ^^load-constant :> sign-bits
+            rep sign-bit-mask ^^load-literal :> sign-bits
             src1 sign-bits rep ^^xor-vector
             src2 sign-bits rep ^^xor-vector
             rep signed-rep cc ^(compare-vector)
@@ -275,6 +275,26 @@ PREDICATE: fixnum-vector-rep < int-vector-rep
         [ [ ^load-immediate-shuffle ] [ ^^shuffle-vector ] bi ]
     } vl-vector-op ;
 
+: ^shuffle-2-vectors-imm ( src1 src2 shuffle rep -- dst )
+    [ rep-length 0 pad-tail ] keep {
+        { double-2-rep [| src1 src2 shuffle rep |
+            shuffle first2 [ 4 mod ] bi@ :> ( i j )
+            {
+                { [ i j [ 2 < ] both? ] [
+                    src1 shuffle rep ^shuffle-vector-imm
+                ] }
+                { [ i j [ 2 >= ] both? ] [
+                    src2 shuffle [ 2 - ] map rep ^shuffle-vector-imm
+                ] }
+                { [ i 2 < ] [
+                    src1 src2 i j 2 - 2array rep ^^shuffle-vector-halves-imm
+                ] }
+                ! [ j 2 < ]
+                [ src2 src1 i 2 - j 2array rep ^^shuffle-vector-halves-imm ]
+            } cond
+        ] }
+    } vvl-vector-op ;
+
 : ^broadcast-vector ( src n rep -- dst )
     [ rep-length swap <array> ] keep
     ^shuffle-vector-imm ;
@@ -283,7 +303,10 @@ PREDICATE: fixnum-vector-rep < int-vector-rep
     [ ^^scalar>vector ] keep [ 0 ] dip ^broadcast-vector ;
 
 : ^select-vector ( src n rep -- dst )
-    [ ^broadcast-vector ] keep ^^vector>scalar ;
+    {
+        [ ^^select-vector ]
+        [ [ ^broadcast-vector ] keep ^^vector>scalar ]
+    } vl-vector-op ;
 
 ! intrinsic emitters
 
@@ -475,6 +498,11 @@ PREDICATE: fixnum-vector-rep < int-vector-rep
         [ ^shuffle-vector-imm ]
     } [ shuffle? ] emit-vl-vector-op ;
 
+: emit-simd-vshuffle2-elements ( node -- )
+    {
+        [ ^shuffle-2-vectors-imm ]
+    } [ shuffle? ] emit-vvl-vector-op ;
+
 : emit-simd-vshuffle-bytes ( node -- )
     {
         [ ^^shuffle-vector ]
@@ -542,7 +570,12 @@ PREDICATE: fixnum-vector-rep < int-vector-rep
 
 : emit-simd-vpack-signed ( node -- )
     {
-        [ ^^signed-pack-vector ]
+        { double-2-rep [| src1 src2 rep |
+            src1 double-2-rep ^^float-pack-vector :> dst-head
+            src2 double-2-rep ^^float-pack-vector :> dst-tail
+            dst-head dst-tail { 0 1 0 1 } float-4-rep ^^shuffle-vector-halves-imm
+        ] }
+        { int-vector-rep [ ^^signed-pack-vector ] }
     } emit-vv-vector-op ;
 
 : emit-simd-vpack-unsigned ( node -- )
@@ -568,12 +601,14 @@ PREDICATE: fixnum-vector-rep < int-vector-rep
 
 : emit-simd-gather-2 ( node -- )
     {
+        { fixnum-vector-rep [ ^^gather-int-vector-2 ] }
         { fixnum-vector-rep [ ^^gather-vector-2 ] }
         { float-vector-rep  [ ^^gather-vector-2 ] }
     } emit-vv-vector-op ;
 
 : emit-simd-gather-4 ( node -- )
     {
+        { fixnum-vector-rep [ ^^gather-int-vector-4 ] }
         { fixnum-vector-rep [ ^^gather-vector-4 ] }
         { float-vector-rep  [ ^^gather-vector-4 ] }
     } emit-vvvv-vector-op ;
@@ -587,83 +622,84 @@ PREDICATE: fixnum-vector-rep < int-vector-rep
 : emit-alien-vector ( node -- )
     dup [
         '[
-            ds-drop prepare-alien-getter
-            _ ^^alien-vector ds-push
+            ds-drop prepare-load-memory
+            _ f ^^load-memory-imm ds-push
         ]
-        [ inline-alien-getter? ] inline-alien
+        [ inline-load-memory? ] inline-accessor
     ] with { [ %alien-vector-reps member? ] } if-literals-match ;
 
 : emit-set-alien-vector ( node -- )
     dup [
         '[
-            ds-drop prepare-alien-setter ds-pop
-            _ ##set-alien-vector
+            ds-drop prepare-store-memory
+            _ f ##store-memory-imm
         ]
-        [ byte-array inline-alien-setter? ]
-        inline-alien
+        [ byte-array inline-store-memory? ]
+        inline-accessor
     ] with { [ %alien-vector-reps member? ] } if-literals-match ;
 
 : enable-simd ( -- )
     {
-        { (simd-v+)                [ emit-simd-v+                  ] }
-        { (simd-v-)                [ emit-simd-v-                  ] }
-        { (simd-vneg)              [ emit-simd-vneg                ] }
-        { (simd-v+-)               [ emit-simd-v+-                 ] }
-        { (simd-vs+)               [ emit-simd-vs+                 ] }
-        { (simd-vs-)               [ emit-simd-vs-                 ] }
-        { (simd-vs*)               [ emit-simd-vs*                 ] }
-        { (simd-v*)                [ emit-simd-v*                  ] }
-        { (simd-v*high)            [ emit-simd-v*high              ] }
-        { (simd-v*hs+)             [ emit-simd-v*hs+               ] }
-        { (simd-v/)                [ emit-simd-v/                  ] }
-        { (simd-vmin)              [ emit-simd-vmin                ] }
-        { (simd-vmax)              [ emit-simd-vmax                ] }
-        { (simd-vavg)              [ emit-simd-vavg                ] }
-        { (simd-v.)                [ emit-simd-v.                  ] }
-        { (simd-vsad)              [ emit-simd-vsad                ] }
-        { (simd-vsqrt)             [ emit-simd-vsqrt               ] }
-        { (simd-sum)               [ emit-simd-sum                 ] }
-        { (simd-vabs)              [ emit-simd-vabs                ] }
-        { (simd-vbitand)           [ emit-simd-vand                ] }
-        { (simd-vbitandn)          [ emit-simd-vandn               ] }
-        { (simd-vbitor)            [ emit-simd-vor                 ] }
-        { (simd-vbitxor)           [ emit-simd-vxor                ] }
-        { (simd-vbitnot)           [ emit-simd-vnot                ] }
-        { (simd-vand)              [ emit-simd-vand                ] }
-        { (simd-vandn)             [ emit-simd-vandn               ] }
-        { (simd-vor)               [ emit-simd-vor                 ] }
-        { (simd-vxor)              [ emit-simd-vxor                ] }
-        { (simd-vnot)              [ emit-simd-vnot                ] }
-        { (simd-vlshift)           [ emit-simd-vlshift             ] }
-        { (simd-vrshift)           [ emit-simd-vrshift             ] }
-        { (simd-hlshift)           [ emit-simd-hlshift             ] }
-        { (simd-hrshift)           [ emit-simd-hrshift             ] }
-        { (simd-vshuffle-elements) [ emit-simd-vshuffle-elements   ] }
-        { (simd-vshuffle-bytes)    [ emit-simd-vshuffle-bytes      ] }
-        { (simd-vmerge-head)       [ emit-simd-vmerge-head         ] }
-        { (simd-vmerge-tail)       [ emit-simd-vmerge-tail         ] }
-        { (simd-v<=)               [ emit-simd-v<=                 ] }
-        { (simd-v<)                [ emit-simd-v<                  ] }
-        { (simd-v=)                [ emit-simd-v=                  ] }
-        { (simd-v>)                [ emit-simd-v>                  ] }
-        { (simd-v>=)               [ emit-simd-v>=                 ] }
-        { (simd-vunordered?)       [ emit-simd-vunordered?         ] }
-        { (simd-vany?)             [ emit-simd-vany?               ] }
-        { (simd-vall?)             [ emit-simd-vall?               ] }
-        { (simd-vnone?)            [ emit-simd-vnone?              ] }
-        { (simd-v>float)           [ emit-simd-v>float             ] }
-        { (simd-v>integer)         [ emit-simd-v>integer           ] }
-        { (simd-vpack-signed)      [ emit-simd-vpack-signed        ] }
-        { (simd-vpack-unsigned)    [ emit-simd-vpack-unsigned      ] }
-        { (simd-vunpack-head)      [ emit-simd-vunpack-head        ] }
-        { (simd-vunpack-tail)      [ emit-simd-vunpack-tail        ] }
-        { (simd-with)              [ emit-simd-with                ] }
-        { (simd-gather-2)          [ emit-simd-gather-2            ] }
-        { (simd-gather-4)          [ emit-simd-gather-4            ] }
-        { (simd-select)            [ emit-simd-select              ] }
-        { alien-vector             [ emit-alien-vector             ] }
-        { set-alien-vector         [ emit-set-alien-vector         ] }
-        { assert-positive          [ drop                          ] }
+        { (simd-v+)                 [ emit-simd-v+                  ] }
+        { (simd-v-)                 [ emit-simd-v-                  ] }
+        { (simd-vneg)               [ emit-simd-vneg                ] }
+        { (simd-v+-)                [ emit-simd-v+-                 ] }
+        { (simd-vs+)                [ emit-simd-vs+                 ] }
+        { (simd-vs-)                [ emit-simd-vs-                 ] }
+        { (simd-vs*)                [ emit-simd-vs*                 ] }
+        { (simd-v*)                 [ emit-simd-v*                  ] }
+        { (simd-v*high)             [ emit-simd-v*high              ] }
+        { (simd-v*hs+)              [ emit-simd-v*hs+               ] }
+        { (simd-v/)                 [ emit-simd-v/                  ] }
+        { (simd-vmin)               [ emit-simd-vmin                ] }
+        { (simd-vmax)               [ emit-simd-vmax                ] }
+        { (simd-vavg)               [ emit-simd-vavg                ] }
+        { (simd-v.)                 [ emit-simd-v.                  ] }
+        { (simd-vsad)               [ emit-simd-vsad                ] }
+        { (simd-vsqrt)              [ emit-simd-vsqrt               ] }
+        { (simd-sum)                [ emit-simd-sum                 ] }
+        { (simd-vabs)               [ emit-simd-vabs                ] }
+        { (simd-vbitand)            [ emit-simd-vand                ] }
+        { (simd-vbitandn)           [ emit-simd-vandn               ] }
+        { (simd-vbitor)             [ emit-simd-vor                 ] }
+        { (simd-vbitxor)            [ emit-simd-vxor                ] }
+        { (simd-vbitnot)            [ emit-simd-vnot                ] }
+        { (simd-vand)               [ emit-simd-vand                ] }
+        { (simd-vandn)              [ emit-simd-vandn               ] }
+        { (simd-vor)                [ emit-simd-vor                 ] }
+        { (simd-vxor)               [ emit-simd-vxor                ] }
+        { (simd-vnot)               [ emit-simd-vnot                ] }
+        { (simd-vlshift)            [ emit-simd-vlshift             ] }
+        { (simd-vrshift)            [ emit-simd-vrshift             ] }
+        { (simd-hlshift)            [ emit-simd-hlshift             ] }
+        { (simd-hrshift)            [ emit-simd-hrshift             ] }
+        { (simd-vshuffle-elements)  [ emit-simd-vshuffle-elements   ] }
+        { (simd-vshuffle2-elements) [ emit-simd-vshuffle2-elements  ] }
+        { (simd-vshuffle-bytes)     [ emit-simd-vshuffle-bytes      ] }
+        { (simd-vmerge-head)        [ emit-simd-vmerge-head         ] }
+        { (simd-vmerge-tail)        [ emit-simd-vmerge-tail         ] }
+        { (simd-v<=)                [ emit-simd-v<=                 ] }
+        { (simd-v<)                 [ emit-simd-v<                  ] }
+        { (simd-v=)                 [ emit-simd-v=                  ] }
+        { (simd-v>)                 [ emit-simd-v>                  ] }
+        { (simd-v>=)                [ emit-simd-v>=                 ] }
+        { (simd-vunordered?)        [ emit-simd-vunordered?         ] }
+        { (simd-vany?)              [ emit-simd-vany?               ] }
+        { (simd-vall?)              [ emit-simd-vall?               ] }
+        { (simd-vnone?)             [ emit-simd-vnone?              ] }
+        { (simd-v>float)            [ emit-simd-v>float             ] }
+        { (simd-v>integer)          [ emit-simd-v>integer           ] }
+        { (simd-vpack-signed)       [ emit-simd-vpack-signed        ] }
+        { (simd-vpack-unsigned)     [ emit-simd-vpack-unsigned      ] }
+        { (simd-vunpack-head)       [ emit-simd-vunpack-head        ] }
+        { (simd-vunpack-tail)       [ emit-simd-vunpack-tail        ] }
+        { (simd-with)               [ emit-simd-with                ] }
+        { (simd-gather-2)           [ emit-simd-gather-2            ] }
+        { (simd-gather-4)           [ emit-simd-gather-4            ] }
+        { (simd-select)             [ emit-simd-select              ] }
+        { alien-vector              [ emit-alien-vector             ] }
+        { set-alien-vector          [ emit-set-alien-vector         ] }
+        { assert-positive           [ drop                          ] }
     } enable-intrinsics ;
 
 enable-simd
index 1ceac4990ace32a93fdea8342e6af3bf07474b3c..a3f532b4dbee7889d4bdd7d7baf28b37af217db5 100644 (file)
@@ -1,9 +1,10 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: layouts namespaces kernel accessors sequences math
 classes.algebra classes.builtin locals combinators
-cpu.architecture compiler.tree.propagation.info
-compiler.cfg.stacks compiler.cfg.hats compiler.cfg.registers
+combinators.short-circuit cpu.architecture
+compiler.tree.propagation.info compiler.cfg.stacks
+compiler.cfg.hats compiler.cfg.registers
 compiler.cfg.instructions compiler.cfg.utilities
 compiler.cfg.builder.blocks compiler.constants ;
 IN: compiler.cfg.intrinsics.slots
@@ -13,12 +14,13 @@ IN: compiler.cfg.intrinsics.slots
 
 : value-tag ( info -- n ) class>> class-tag ;
 
-: ^^tag-offset>slot ( slot tag -- vreg' )
-    [ ^^offset>slot ] dip ^^sub-imm ;
+: slot-indexing ( slot tag -- slot scale tag )
+    complex-addressing?
+    [ [ cell log2 ] dip ] [ [ ^^offset>slot ] dip ^^sub-imm 0 0 ] if ;
 
 : (emit-slot) ( infos -- dst )
     [ 2inputs ] [ first value-tag ] bi*
-    ^^tag-offset>slot ^^slot ;
+    slot-indexing ^^slot ;
 
 : (emit-slot-imm) ( infos -- dst )
     ds-drop
@@ -28,9 +30,9 @@ IN: compiler.cfg.intrinsics.slots
 
 : immediate-slot-offset? ( value-info -- ? )
     literal>> {
-        { [ dup fixnum? ] [ tag-fixnum immediate-arithmetic? ] }
-        [ drop f ]
-    } cond ;
+        [ fixnum? ]
+        [ cell * immediate-arithmetic? ]
+    } 1&& ;
 
 : emit-slot ( node -- )
     dup node-input-infos
@@ -47,12 +49,13 @@ IN: compiler.cfg.intrinsics.slots
 :: (emit-set-slot) ( infos -- )
     3inputs :> ( src obj slot )
 
-    slot infos second value-tag ^^tag-offset>slot :> slot
+    infos second value-tag :> tag
 
-    src obj slot ##set-slot
+    slot tag slot-indexing :> ( slot scale tag )
+    src obj slot scale tag ##set-slot
 
     infos emit-write-barrier?
-    [ obj slot next-vreg next-vreg ##write-barrier ] when ;
+    [ obj slot scale tag next-vreg next-vreg ##write-barrier ] when ;
 
 :: (emit-set-slot-imm) ( infos -- )
     ds-drop
@@ -65,7 +68,7 @@ IN: compiler.cfg.intrinsics.slots
     src obj slot tag ##set-slot-imm
 
     infos emit-write-barrier?
-    [ obj slot tag slot-offset next-vreg next-vreg ##write-barrier-imm ] when ;
+    [ obj slot tag next-vreg next-vreg ##write-barrier-imm ] when ;
 
 : emit-set-slot ( node -- )
     dup node-input-infos
@@ -74,10 +77,3 @@ IN: compiler.cfg.intrinsics.slots
         dup third immediate-slot-offset?
         [ (emit-set-slot-imm) ] [ (emit-set-slot) ] if
     ] [ drop emit-primitive ] if ;
-
-: emit-string-nth ( -- )
-    2inputs swap ^^untag-fixnum ^^string-nth ^^tag-fixnum ds-push ;
-
-: emit-set-string-nth-fast ( -- )
-    3inputs [ ^^untag-fixnum ] [ ^^untag-fixnum ] [ ] tri*
-    swap next-vreg ##set-string-nth-fast ;
diff --git a/basis/compiler/cfg/intrinsics/strings/authors.txt b/basis/compiler/cfg/intrinsics/strings/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/intrinsics/strings/strings.factor b/basis/compiler/cfg/intrinsics/strings/strings.factor
new file mode 100644 (file)
index 0000000..70d8442
--- /dev/null
@@ -0,0 +1,15 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types kernel compiler.constants compiler.cfg.hats
+compiler.cfg.instructions compiler.cfg.registers
+compiler.cfg.stacks cpu.architecture ;
+IN: compiler.cfg.intrinsics.strings
+
+: (string-nth) ( n string -- base offset rep c-type )
+    ^^tagged>integer swap ^^add string-offset int-rep uchar ; inline
+
+: emit-string-nth-fast ( -- )
+    2inputs (string-nth) ^^load-memory-imm ds-push ;
+
+: emit-set-string-nth-fast ( -- )
+    3inputs (string-nth) ##store-memory-imm ;
index 8951d7a1f1e15b9e34bfc2535485755d1a13f8a2..722698e7890e6328fece5c6399ea2535713dc3e7 100644 (file)
@@ -1,7 +1,9 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs heaps kernel namespaces sequences fry math
-math.order combinators arrays sorting compiler.utilities locals
+USING: accessors assocs binary-search combinators
+combinators.short-circuit heaps kernel namespaces
+sequences fry locals math math.order arrays sorting
+compiler.utilities
 compiler.cfg.linear-scan.live-intervals
 compiler.cfg.linear-scan.allocation.spilling
 compiler.cfg.linear-scan.allocation.splitting
@@ -9,11 +11,11 @@ compiler.cfg.linear-scan.allocation.state ;
 IN: compiler.cfg.linear-scan.allocation
 
 : active-positions ( new assoc -- )
-    [ vreg>> active-intervals-for ] dip
+    [ active-intervals-for ] dip
     '[ [ 0 ] dip reg>> _ add-use-position ] each ;
 
 : inactive-positions ( new assoc -- )
-    [ [ vreg>> inactive-intervals-for ] keep ] dip
+    [ [ inactive-intervals-for ] keep ] dip
     '[
         [ _ relevant-ranges intersect-live-ranges 1/0. or ] [ reg>> ] bi
         _ add-use-position
@@ -34,46 +36,51 @@ IN: compiler.cfg.linear-scan.allocation
         [ drop assign-blocked-register ]
     } cond ;
 
-: spill-at-sync-point ( live-interval n -- ? )
-    ! If the live interval has a usage at 'n', don't spill it,
-    ! since this means its being defined by the sync point
-    ! instruction. Output t if this is the case.
-    2dup [ uses>> ] dip swap member? [ 2drop t ] [ spill f ] if ;
+: spill-at-sync-point? ( sync-point live-interval -- ? )
+    ! If the live interval has a definition at a keep-dst?
+    ! sync-point, don't spill.
+    {
+        [ drop keep-dst?>> not ]
+        [ [ n>> ] dip find-use dup [ def-rep>> ] when not ]
+    } 2|| ;
+
+: spill-at-sync-point ( sync-point live-interval -- ? )
+    2dup spill-at-sync-point?
+    [ swap n>> spill f ] [ 2drop t ] if ;
+
+GENERIC: handle-progress* ( obj -- )
+
+M: live-interval handle-progress* drop ;
 
-: handle-sync-point ( n -- )
-    [ active-intervals get values ] dip
-    '[ [ _ spill-at-sync-point ] filter! drop ] each ;
+M: sync-point handle-progress*
+    active-intervals get values
+    [ [ spill-at-sync-point ] with filter! drop ] with each ;
 
-:: handle-progress ( n sync? -- )
-    n {
-        [ progress set ]
-        [ deactivate-intervals ]
-        [ sync? [ handle-sync-point ] [ drop ] if ]
-        [ activate-intervals ]
-    } cleave ;
+:: handle-progress ( n obj -- )
+    n progress set
+    n deactivate-intervals
+    obj handle-progress*
+    n activate-intervals ;
 
 GENERIC: handle ( obj -- )
 
 M: live-interval handle ( live-interval -- )
-    [ start>> f handle-progress ] [ assign-register ] bi ;
+    [ [ start>> ] keep handle-progress ] [ assign-register ] bi ;
 
 M: sync-point handle ( sync-point -- )
-    n>> t handle-progress ;
+    [ n>> ] keep handle-progress ;
 
 : smallest-heap ( heap1 heap2 -- heap )
     ! If heap1 and heap2 have the same key, favors heap1.
-    [ [ heap-peek nip ] bi@ <= ] most ;
+    {
+        { [ dup heap-empty? ] [ drop ] }
+        { [ over heap-empty? ] [ nip ] }
+        [ [ [ heap-peek nip ] bi@ <= ] most ]
+    } cond ;
 
 : (allocate-registers) ( -- )
-    {
-        { [ unhandled-intervals get heap-empty? ] [ unhandled-sync-points get ] }
-        { [ unhandled-sync-points get heap-empty? ] [ unhandled-intervals get ] }
-        ! If a live interval begins at the same location as a sync point,
-        ! process the sync point before the live interval. This ensures that the
-        ! return value of C function calls doesn't get spilled and reloaded
-        ! unnecessarily.
-        [ unhandled-sync-points get unhandled-intervals get smallest-heap ]
-    } cond dup heap-empty? [ drop ] [ heap-pop drop handle (allocate-registers) ] if ;
+    unhandled-intervals get unhandled-sync-points get smallest-heap
+    dup heap-empty? [ drop ] [ heap-pop drop handle (allocate-registers) ] if ;
 
 : finish-allocation ( -- )
     active-intervals inactive-intervals
index 845cb14d5c8738f5fb3985e5fa25979f8be3dd47..e773cb9e46e98606db812337e23c6f4e8981fe6f 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs combinators fry hints kernel locals
 math sequences sets sorting splitting namespaces linked-assocs
@@ -17,24 +17,31 @@ ERROR: bad-live-ranges interval ;
     ] [ drop ] if ;
 
 : trim-before-ranges ( live-interval -- )
-    [ ranges>> ] [ uses>> last 1 + ] bi
-    [ '[ from>> _ <= ] filter! drop ]
-    [ swap last (>>to) ]
+    dup last-use n>> 1 +
+    [ '[ [ from>> _ >= ] trim-tail-slice ] change-ranges drop ]
+    [ swap ranges>> last to<< ]
     2bi ;
 
 : trim-after-ranges ( live-interval -- )
-    [ ranges>> ] [ uses>> first ] bi
-    [ '[ to>> _ >= ] filter! drop ]
-    [ swap first (>>from) ]
+    dup first-use n>>
+    [ '[ [ to>> _ < ] trim-head-slice ] change-ranges drop ]
+    [ swap ranges>> first from<< ]
     2bi ;
 
+: last-use-rep ( live-interval -- rep/f )
+    last-use [ def-rep>> ] [ use-rep>> ] bi or ; inline
+
 : assign-spill ( live-interval -- )
-    dup vreg>> vreg-spill-slot >>spill-to drop ;
+    dup last-use-rep dup [
+        >>spill-rep
+        dup [ vreg>> ] [ spill-rep>> ] bi
+        assign-spill-slot >>spill-to drop
+    ] [ 2drop ] if ;
 
 : spill-before ( before -- before/f )
     ! If the interval does not have any usages before the spill location,
     ! then it is the second child of an interval that was split. We reload
-    ! the value and let the resolve pass insert a split later.
+    ! the value and let the resolve pass insert a spill later.
     dup uses>> empty? [ drop f ] [
         {
             [ ]
@@ -45,8 +52,15 @@ ERROR: bad-live-ranges interval ;
         } cleave
     ] if ;
 
+: first-use-rep ( live-interval -- rep/f )
+    first-use use-rep>> ; inline
+
 : assign-reload ( live-interval -- )
-    dup vreg>> vreg-spill-slot >>reload-from drop ;
+    dup first-use-rep dup [
+        >>reload-rep
+        dup [ vreg>> ] [ reload-rep>> ] bi
+        assign-spill-slot >>reload-from drop
+    ] [ 2drop ] if ;
 
 : spill-after ( after -- after/f )
     ! If the interval has no more usages after the spill location,
@@ -66,18 +80,19 @@ ERROR: bad-live-ranges interval ;
     split-interval [ spill-before ] [ spill-after ] bi* ;
 
 : find-use-position ( live-interval new -- n )
-    [ uses>> ] [ start>> '[ _ >= ] ] bi* find nip 1/0. or ;
+    [ uses>> ] [ start>> '[ n>> _ >= ] ] bi* find nip
+    [ n>> ] [ 1/0. ] if* ;
 
 : find-use-positions ( live-intervals new assoc -- )
     '[ [ _ find-use-position ] [ reg>> ] bi _ add-use-position ] each ;
 
 : active-positions ( new assoc -- )
-    [ [ vreg>> active-intervals-for ] keep ] dip
+    [ [ active-intervals-for ] keep ] dip
     find-use-positions ;
 
 : inactive-positions ( new assoc -- )
     [
-        [ vreg>> inactive-intervals-for ] keep
+        [ inactive-intervals-for ] keep
         [ '[ _ intervals-intersect? ] filter ] keep
     ] dip
     find-use-positions ;
@@ -88,7 +103,7 @@ ERROR: bad-live-ranges interval ;
     >alist alist-max ;
 
 : spill-new? ( new pair -- ? )
-    [ uses>> first ] [ second ] bi* > ;
+    [ first-use n>> ] [ second ] bi* > ;
 
 : spill-new ( new pair -- )
     drop spill-after add-unhandled ;
@@ -102,13 +117,13 @@ ERROR: bad-live-ranges interval ;
     ! If there is an active interval using 'reg' (there should be at
     ! most one) are split and spilled and removed from the inactive
     ! set.
-    new vreg>> active-intervals-for [ [ reg>> reg = ] find swap dup ] keep
+    new active-intervals-for [ [ reg>> reg = ] find swap dup ] keep
     '[ _ remove-nth! drop  new start>> spill ] [ 2drop ] if ;
 
 :: spill-intersecting-inactive ( new reg -- )
     ! Any inactive intervals using 'reg' are split and spilled
     ! and removed from the inactive set.
-    new vreg>> inactive-intervals-for [
+    new inactive-intervals-for [
         dup reg>> reg = [
             dup new intervals-intersect? [
                 new start>> spill f
index 1a2b0f2f2bdceae154b0e8b71d3a2691f1fdd1ef..0430bfef85ed870b2c0e4c097294c56499727e36 100644 (file)
@@ -1,7 +1,8 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs combinators fry hints kernel locals
-math sequences sets sorting splitting namespaces
+USING: accessors arrays assocs binary-search combinators
+combinators.short-circuit fry hints kernel locals
+math math.order sequences sets sorting splitting namespaces
 compiler.cfg.linear-scan.allocation.state
 compiler.cfg.linear-scan.live-intervals ;
 IN: compiler.cfg.linear-scan.allocation.splitting
@@ -24,8 +25,13 @@ IN: compiler.cfg.linear-scan.allocation.splitting
         [ split-last-range ] [ 2drop ] if
     ] bi ;
 
-: split-uses ( uses n -- before after )
-    '[ _ <= ] partition ;
+:: split-uses ( uses n -- before after )
+    uses n uses [ n>> <=> ] with search
+    n>> n <=> {
+        { +eq+ [ [ head-slice ] [ 1 + tail-slice ] 2bi ] }
+        { +lt+ [ 1 + cut-slice ] }
+        { +gt+ [ cut-slice ] }
+    } case ;
 
 ERROR: splitting-too-early ;
 
@@ -36,7 +42,7 @@ ERROR: splitting-atomic-interval ;
 : check-split ( live-interval n -- )
     check-allocation? get [
         [ [ start>> ] dip > [ splitting-too-early ] when ]
-        [ [ end>> ] dip <= [ splitting-too-late ] when ]
+        [ [ end>> ] dip < [ splitting-too-late ] when ]
         [ drop [ end>> ] [ start>> ] bi = [ splitting-atomic-interval ] when ]
         2tri
     ] [ 2drop ] if ; inline
@@ -51,8 +57,8 @@ ERROR: splitting-atomic-interval ;
     live-interval n check-split
     live-interval clone :> before
     live-interval clone :> after
-    live-interval uses>> n split-uses before after [ (>>uses) ] bi-curry@ bi*
-    live-interval ranges>> n split-ranges before after [ (>>ranges) ] bi-curry@ bi*
+    live-interval uses>> n split-uses before after [ uses<< ] bi-curry@ bi*
+    live-interval ranges>> n split-ranges before after [ ranges<< ] bi-curry@ bi*
     before split-before
     after split-after ;
 
index 4c825c9d7ce62c9c6eab8be06c3e9186a67096f3..e0cc80f15c02825f0f9a3ffde4d02b7db326e897 100644 (file)
@@ -1,9 +1,10 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs combinators cpu.architecture fry heaps
-kernel math math.order namespaces sequences vectors
+USING: arrays accessors assocs combinators cpu.architecture fry
+heaps kernel math math.order namespaces layouts sequences vectors
 linked-assocs compiler.cfg compiler.cfg.registers
-compiler.cfg.instructions compiler.cfg.linear-scan.live-intervals ;
+compiler.cfg.instructions
+compiler.cfg.linear-scan.live-intervals ;
 IN: compiler.cfg.linear-scan.allocation.state
 
 ! Start index of current live interval. We ensure that all
@@ -26,14 +27,14 @@ SYMBOL: registers
 ! Vector of active live intervals
 SYMBOL: active-intervals
 
-: active-intervals-for ( vreg -- seq )
-    rep-of reg-class-of active-intervals get at ;
+: active-intervals-for ( live-interval -- seq )
+    reg-class>> active-intervals get at ;
 
 : add-active ( live-interval -- )
-    dup vreg>> active-intervals-for push ;
+    dup active-intervals-for push ;
 
 : delete-active ( live-interval -- )
-    dup vreg>> active-intervals-for remove-eq! drop ;
+    dup active-intervals-for remove-eq! drop ;
 
 : assign-free-register ( new registers -- )
     pop >>reg add-active ;
@@ -41,14 +42,14 @@ SYMBOL: active-intervals
 ! Vector of inactive live intervals
 SYMBOL: inactive-intervals
 
-: inactive-intervals-for ( vreg -- seq )
-    rep-of reg-class-of inactive-intervals get at ;
+: inactive-intervals-for ( live-interval -- seq )
+    reg-class>> inactive-intervals get at ;
 
 : add-inactive ( live-interval -- )
-    dup vreg>> inactive-intervals-for push ;
+    dup inactive-intervals-for push ;
 
 : delete-inactive ( live-interval -- )
-    dup vreg>> inactive-intervals-for remove-eq! drop ;
+    dup inactive-intervals-for remove-eq! drop ;
 
 ! Vector of handled live intervals
 SYMBOL: handled-intervals
@@ -67,7 +68,7 @@ ERROR: register-already-used live-interval ;
 
 : check-activate ( live-interval -- )
     check-allocation? get [
-        dup [ reg>> ] [ vreg>> active-intervals-for [ reg>> ] map ] bi member?
+        dup [ reg>> ] [ active-intervals-for [ reg>> ] map ] bi member?
         [ register-already-used ] [ drop ] if
     ] [ drop ] if ;
 
@@ -116,19 +117,28 @@ SYMBOL: unhandled-intervals
 : reg-class-assoc ( quot -- assoc )
     [ reg-classes ] dip { } map>assoc ; inline
 
-: next-spill-slot ( rep -- n )
-    rep-size cfg get
+: next-spill-slot ( size -- n )
+    cfg get
     [ swap [ align dup ] [ + ] bi ] change-spill-area-size drop
     <spill-slot> ;
 
+: align-spill-area ( align -- )
+    cfg get [ max ] change-spill-area-align drop ;
+
 ! Minheap of sync points which still need to be processed
 SYMBOL: unhandled-sync-points
 
 ! Mapping from vregs to spill slots
 SYMBOL: spill-slots
 
-: vreg-spill-slot ( vreg -- spill-slot )
-    spill-slots get [ rep-of next-spill-slot ] cache ;
+: assign-spill-slot ( coalesced-vreg rep -- spill-slot )
+    rep-size
+    [ align-spill-area ]
+    [ spill-slots get [ nip next-spill-slot ] 2cache ]
+    bi ;
+
+: lookup-spill-slot ( coalesced-vreg rep -- spill-slot )
+    rep-size 2array spill-slots get ?at [ ] [ bad-vreg ] if ;
 
 : init-allocator ( registers -- )
     registers set
@@ -137,7 +147,7 @@ SYMBOL: spill-slots
     [ V{ } clone ] reg-class-assoc active-intervals set
     [ V{ } clone ] reg-class-assoc inactive-intervals set
     V{ } clone handled-intervals set
-    cfg get 0 >>spill-area-size drop
+    cfg get 0 >>spill-area-size cell >>spill-area-align drop
     H{ } clone spill-slots set
     -1 progress set ;
 
@@ -148,7 +158,7 @@ SYMBOL: spill-slots
 
 ! A utility used by register-status and spill-status words
 : free-positions ( new -- assoc )
-    vreg>> rep-of reg-class-of registers get at
+    reg-class>> registers get at
     [ 1/0. ] H{ } <linked-assoc> map>assoc ;
 
 : add-use-position ( n reg assoc -- ) [ [ min ] when* ] change-at ;
index f69db1deea1dd3748ee7041ab29af63fcd5ef79f..1780a1c907793d46a857ab3e21c9f6107253d052 100644 (file)
@@ -1,18 +1,21 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel math assocs namespaces sequences heaps
-fry make combinators sets locals arrays
+fry make combinators combinators.short-circuit sets locals arrays
 cpu.architecture layouts
 compiler.cfg
 compiler.cfg.def-use
 compiler.cfg.liveness
+compiler.cfg.liveness.ssa
 compiler.cfg.registers
 compiler.cfg.instructions
+compiler.cfg.linearization
+compiler.cfg.ssa.destruction
 compiler.cfg.renaming.functor
-compiler.cfg.linearization.order
 compiler.cfg.linear-scan.allocation
 compiler.cfg.linear-scan.allocation.state
 compiler.cfg.linear-scan.live-intervals ;
+FROM: namespaces => set ;
 IN: compiler.cfg.linear-scan.assignment
 
 ! This contains both active and inactive intervals; any interval
@@ -28,21 +31,16 @@ SYMBOL: pending-interval-assoc
 : remove-pending ( live-interval -- )
     vreg>> pending-interval-assoc get delete-at ;
 
-ERROR: bad-vreg vreg ;
-
-: (vreg>reg) ( vreg pending -- reg )
+:: vreg>reg ( vreg -- reg )
     ! If a live vreg is not in the pending set, then it must
     ! have been spilled.
-    ?at [ spill-slots get ?at [ ] [ bad-vreg ] if ] unless ;
-
-: vreg>reg ( vreg -- reg )
-    pending-interval-assoc get (vreg>reg) ;
+    vreg leader :> leader
+    leader pending-interval-assoc get at* [
+        drop leader vreg rep-of lookup-spill-slot
+    ] unless ;
 
 : vregs>regs ( vregs -- assoc )
-    dup assoc-empty? [
-        pending-interval-assoc get
-        '[ _ (vreg>reg) ] assoc-map
-    ] unless ;
+    [ f ] [ [ dup vreg>reg ] H{ } map>assoc ] if-empty ;
 
 ! Minheap of live intervals which still need a register allocation
 SYMBOL: unhandled-intervals
@@ -53,22 +51,49 @@ SYMBOL: unhandled-intervals
 : init-unhandled ( live-intervals -- )
     [ add-unhandled ] each ;
 
+! Liveness info is used by resolve pass
+
 ! Mapping from basic blocks to values which are live at the start
-SYMBOL: register-live-ins
+! on all incoming CFG edges
+SYMBOL: machine-live-ins
+
+: machine-live-in ( bb -- assoc )
+    machine-live-ins get at ;
+
+: compute-live-in ( bb -- )
+    [ live-in keys vregs>regs ] keep machine-live-ins get set-at ;
+
+! Mapping from basic blocks to predecessors to values which are
+! live on a particular incoming edge
+SYMBOL: machine-edge-live-ins
+
+: machine-edge-live-in ( predecessor bb -- assoc )
+    machine-edge-live-ins get at at ;
+
+: compute-edge-live-in ( bb -- )
+    [ edge-live-ins get at [ keys vregs>regs ] assoc-map ] keep
+    machine-edge-live-ins get set-at ;
 
 ! Mapping from basic blocks to values which are live at the end
-SYMBOL: register-live-outs
+SYMBOL: machine-live-outs
+
+: machine-live-out ( bb -- assoc )
+    machine-live-outs get at ;
+
+: compute-live-out ( bb -- )
+    [ live-out keys vregs>regs ] keep machine-live-outs get set-at ;
 
 : init-assignment ( live-intervals -- )
     <min-heap> pending-interval-heap set
     H{ } clone pending-interval-assoc set
     <min-heap> unhandled-intervals set
-    H{ } clone register-live-ins set
-    H{ } clone register-live-outs set
+    H{ } clone machine-live-ins set
+    H{ } clone machine-edge-live-ins set
+    H{ } clone machine-live-outs set
     init-unhandled ;
 
 : insert-spill ( live-interval -- )
-    [ reg>> ] [ vreg>> rep-of ] [ spill-to>> ] tri _spill ;
+    [ reg>> ] [ spill-rep>> ] [ spill-to>> ] tri ##spill ;
 
 : handle-spill ( live-interval -- )
     dup spill-to>> [ insert-spill ] [ drop ] if ;
@@ -88,7 +113,7 @@ SYMBOL: register-live-outs
     pending-interval-heap get (expire-old-intervals) ;
 
 : insert-reload ( live-interval -- )
-    [ reg>> ] [ vreg>> rep-of ] [ reload-from>> ] tri _reload ;
+    [ reg>> ] [ reload-rep>> ] [ reload-from>> ] tri ##reload ;
 
 : handle-reload ( live-interval -- )
     dup reload-from>> [ insert-reload ] [ drop ] if ;
@@ -117,55 +142,19 @@ RENAMING: assign [ vreg>reg ] [ vreg>reg ] [ vreg>reg ]
 M: vreg-insn assign-registers-in-insn
     [ assign-insn-defs ] [ assign-insn-uses ] [ assign-insn-temps ] tri ;
 
-: trace-on-gc ( assoc -- assoc' )
-    ! When a GC occurs, virtual registers which contain tagged data
-    ! are traced by the GC. Outputs a sequence physical registers.
-    [ drop rep-of int-rep eq? ] { } assoc-filter-as values ;
-
-: spill-on-gc? ( vreg reg -- ? )
-    [ rep-of int-rep? not ] [ spill-slot? not ] bi* and ;
-
-: spill-on-gc ( assoc -- assoc' )
-    ! When a GC occurs, virtual registers which contain untagged data,
-    ! and are stored in physical registers, are saved to their spill
-    ! slots. Outputs sequence of triples:
-    ! - physical register
-    ! - spill slot
-    ! - representation
-    [
-        [
-            2dup spill-on-gc?
-            [ swap [ rep-of ] [ vreg-spill-slot ] bi 3array , ] [ 2drop ] if
-        ] assoc-each
-    ] { } make ;
-
-: gc-root-offsets ( registers -- alist )
-    ! Outputs a sequence of { offset register/spill-slot } pairs
-    [ length iota [ cell * ] map ] keep zip ;
-
-M: ##gc assign-registers-in-insn
-    ! Since ##gc is always the first instruction in a block, the set of
-    ! values live at the ##gc is just live-in.
+M: ##call-gc assign-registers-in-insn
     dup call-next-method
-    basic-block get register-live-ins get at
-    [ trace-on-gc gc-root-offsets >>tagged-values ] [ spill-on-gc >>data-values ] bi
-    drop ;
+    [ [ vreg>reg ] map ] change-gc-roots drop ;
 
 M: insn assign-registers-in-insn drop ;
 
 : begin-block ( bb -- )
-    dup basic-block set
-    dup block-from activate-new-intervals
-    [ live-in vregs>regs ] keep register-live-ins get set-at ;
-
-: end-block ( bb -- )
-    [ live-out vregs>regs ] keep register-live-outs get set-at ;
-
-: vreg-at-start ( vreg bb -- state )
-    register-live-ins get at ?at [ bad-vreg ] unless ;
-
-: vreg-at-end ( vreg bb -- state )
-    register-live-outs get at ?at [ bad-vreg ] unless ;
+    {
+        [ basic-block set ]
+        [ block-from activate-new-intervals ]
+        [ compute-edge-live-in ]
+        [ compute-live-in ]
+    } cleave ;
 
 :: assign-registers-in-block ( bb -- )
     bb [
@@ -179,7 +168,7 @@ M: insn assign-registers-in-insn drop ;
                     [ , ]
                 } cleave
             ] each
-            bb end-block
+            bb compute-live-out
         ] V{ } make
     ] change-instructions drop ;
 
index fa248dd4e8e99f956bfdaa9b1944a6e595c1d5c5..d93ebcccf07d6c1bc8eec497d9ef12fed06d2f51 100644 (file)
@@ -3,6 +3,7 @@
 USING: accessors kernel sequences sets arrays math strings fry
 namespaces prettyprint compiler.cfg.linear-scan.live-intervals
 compiler.cfg.linear-scan.allocation compiler.cfg assocs ;
+FROM: namespaces => set ;
 IN: compiler.cfg.linear-scan.debugger
 
 : check-linear-scan ( live-intervals machine-registers -- )
index c144b5f07f0e087ce1522ecdafc69d9e07ce34c7..873ba6ee5ce1273472fe47636355a9724cde4bba 100644 (file)
@@ -1,4 +1,3 @@
-IN: compiler.cfg.linear-scan.tests
 USING: tools.test random sorting sequences sets hashtables assocs
 kernel fry arrays splitting namespaces math accessors vectors locals
 math.order grouping strings strings.private classes layouts
@@ -9,7 +8,6 @@ compiler.cfg.instructions
 compiler.cfg.registers
 compiler.cfg.predecessors
 compiler.cfg.rpo
-compiler.cfg.linearization
 compiler.cfg.debugger
 compiler.cfg.def-use
 compiler.cfg.comparisons
@@ -21,6 +19,8 @@ compiler.cfg.linear-scan.allocation.state
 compiler.cfg.linear-scan.allocation.splitting
 compiler.cfg.linear-scan.allocation.spilling
 compiler.cfg.linear-scan.debugger ;
+FROM: namespaces => set ;
+IN: compiler.cfg.linear-scan.tests
 
 check-allocation? on
 check-numbering? on
@@ -76,7 +76,7 @@ check-numbering? on
     { T{ live-range f 0 5 } } 0 split-ranges
 ] unit-test
 
-cfg new 0 >>spill-area-size cfg set
+cfg new 0 >>spill-area-size 4 >>spill-area-align cfg set
 H{ } spill-slots set
 
 H{
@@ -85,85 +85,243 @@ H{
     { 3 float-rep }
 } representations set
 
+: clean-up-split ( a b -- a b )
+    [ dup [ [ >vector ] change-uses [ >vector ] change-ranges ] when ] bi@ ;
+
 [
     T{ live-interval
        { vreg 1 }
+       { reg-class float-regs }
        { start 0 }
        { end 2 }
-       { uses V{ 0 1 } }
+       { uses V{ T{ vreg-use f 0 float-rep f } T{ vreg-use f 1 f float-rep } } }
        { ranges V{ T{ live-range f 0 2 } } }
        { spill-to T{ spill-slot f 0 } }
+       { spill-rep float-rep }
     }
     T{ live-interval
        { vreg 1 }
+       { reg-class float-regs }
        { start 5 }
        { end 5 }
-       { uses V{ 5 } }
+       { uses V{ T{ vreg-use f 5 f float-rep } } }
        { ranges V{ T{ live-range f 5 5 } } }
        { reload-from T{ spill-slot f 0 } }
+       { reload-rep float-rep }
     }
 ] [
     T{ live-interval
        { vreg 1 }
+       { reg-class float-regs }
        { start 0 }
        { end 5 }
-       { uses V{ 0 1 5 } }
+       { uses V{ T{ vreg-use f 0 float-rep f } T{ vreg-use f 1 f float-rep } T{ vreg-use f 5 f float-rep } } }
        { ranges V{ T{ live-range f 0 5 } } }
     } 2 split-for-spill
+    clean-up-split
 ] unit-test
 
 [
+    f
     T{ live-interval
        { vreg 2 }
-       { start 0 }
-       { end 1 }
-       { uses V{ 0 } }
-       { ranges V{ T{ live-range f 0 1 } } }
-       { spill-to T{ spill-slot f 4 } }
-    }
-    T{ live-interval
-       { vreg 2 }
+       { reg-class float-regs }
        { start 1 }
        { end 5 }
-       { uses V{ 1 5 } }
+       { uses V{ T{ vreg-use f 1 f float-rep } T{ vreg-use f 5 f float-rep } } }
        { ranges V{ T{ live-range f 1 5 } } }
        { reload-from T{ spill-slot f 4 } }
+       { reload-rep float-rep }
     }
 ] [
     T{ live-interval
        { vreg 2 }
+       { reg-class float-regs }
        { start 0 }
        { end 5 }
-       { uses V{ 0 1 5 } }
+       { uses V{ T{ vreg-use f 0 float-rep f } T{ vreg-use f 1 f float-rep } T{ vreg-use f 5 f float-rep } } }
        { ranges V{ T{ live-range f 0 5 } } }
     } 0 split-for-spill
+    clean-up-split
 ] unit-test
 
 [
     T{ live-interval
        { vreg 3 }
+       { reg-class float-regs }
        { start 0 }
-       { end 1 }
-       { uses V{ 0 } }
-       { ranges V{ T{ live-range f 0 1 } } }
+       { end 2 }
+       { uses V{ T{ vreg-use f 0 float-rep f } T{ vreg-use f 1 f float-rep } } }
+       { ranges V{ T{ live-range f 0 2 } } }
        { spill-to T{ spill-slot f 8 } }
+       { spill-rep float-rep }
     }
+    f
+] [
     T{ live-interval
        { vreg 3 }
+       { reg-class float-regs }
+       { start 0 }
+       { end 5 }
+       { uses V{ T{ vreg-use f 0 float-rep f } T{ vreg-use f 1 f float-rep } T{ vreg-use f 5 f float-rep } } }
+       { ranges V{ T{ live-range f 0 5 } } }
+    } 5 split-for-spill
+    clean-up-split
+] unit-test
+
+[
+    T{ live-interval
+       { vreg 4 }
+       { reg-class float-regs }
+       { start 0 }
+       { end 1 }
+       { uses V{ T{ vreg-use f 0 float-rep f } } }
+       { ranges V{ T{ live-range f 0 1 } } }
+       { spill-to T{ spill-slot f 12 } }
+       { spill-rep float-rep }
+    }
+    T{ live-interval
+       { vreg 4 }
+       { reg-class float-regs }
        { start 20 }
        { end 30 }
-       { uses V{ 20 30 } }
+       { uses V{ T{ vreg-use f 20 f float-rep } T{ vreg-use f 30 f float-rep } } }
        { ranges V{ T{ live-range f 20 30 } } }
-       { reload-from T{ spill-slot f 8 } }
+       { reload-from T{ spill-slot f 12 } }
+       { reload-rep float-rep }
     }
 ] [
     T{ live-interval
-       { vreg 3 }
+       { vreg 4 }
+       { reg-class float-regs }
        { start 0 }
        { end 30 }
-       { uses V{ 0 20 30 } }
+       { uses V{ T{ vreg-use f 0 float-rep f } T{ vreg-use f 20 f float-rep } T{ vreg-use f 30 f float-rep } } }
        { ranges V{ T{ live-range f 0 8 } T{ live-range f 10 18 } T{ live-range f 20 30 } } }
     } 10 split-for-spill
+    clean-up-split
+] unit-test
+
+! Don't insert reload if first usage is a def
+[
+    T{ live-interval
+       { vreg 5 }
+       { reg-class float-regs }
+       { start 0 }
+       { end 1 }
+       { uses V{ T{ vreg-use f 0 float-rep f } } }
+       { ranges V{ T{ live-range f 0 1 } } }
+       { spill-to T{ spill-slot f 16 } }
+       { spill-rep float-rep }
+    }
+    T{ live-interval
+       { vreg 5 }
+       { reg-class float-regs }
+       { start 20 }
+       { end 30 }
+       { uses V{ T{ vreg-use f 20 float-rep f } T{ vreg-use f 30 f float-rep } } }
+       { ranges V{ T{ live-range f 20 30 } } }
+    }
+] [
+    T{ live-interval
+       { vreg 5 }
+       { reg-class float-regs }
+       { start 0 }
+       { end 30 }
+       { uses V{ T{ vreg-use f 0 float-rep f } T{ vreg-use f 20 float-rep f } T{ vreg-use f 30 f float-rep } } }
+       { ranges V{ T{ live-range f 0 8 } T{ live-range f 10 18 } T{ live-range f 20 30 } } }
+    } 10 split-for-spill
+    clean-up-split
+] unit-test
+
+! Multiple representations
+[
+    T{ live-interval
+       { vreg 6 }
+       { reg-class float-regs }
+       { start 0 }
+       { end 11 }
+       { uses V{ T{ vreg-use f 0 float-rep f } T{ vreg-use f 10 double-rep float-rep } } }
+       { ranges V{ T{ live-range f 0 11 } } }
+       { spill-to T{ spill-slot f 24 } }
+       { spill-rep double-rep }
+    }
+    T{ live-interval
+       { vreg 6 }
+       { reg-class float-regs }
+       { start 20 }
+       { end 20 }
+       { uses V{ T{ vreg-use f 20 f double-rep } } }
+       { ranges V{ T{ live-range f 20 20 } } }
+       { reload-from T{ spill-slot f 24 } }
+       { reload-rep double-rep }
+    }
+] [
+    T{ live-interval
+       { vreg 6 }
+       { reg-class float-regs }
+       { start 0 }
+       { end 20 }
+       { uses V{ T{ vreg-use f 0 float-rep f } T{ vreg-use f 10 double-rep float-rep } T{ vreg-use f 20 f double-rep } } }
+       { ranges V{ T{ live-range f 0 20 } } }
+    } 15 split-for-spill
+    clean-up-split
+] unit-test
+
+[
+    f
+    T{ live-interval
+        { vreg 7 }
+        { start 8 }
+        { end 8 }
+        { ranges V{ T{ live-range f 8 8 } } }
+        { uses V{ T{ vreg-use f 8 int-rep } } }
+        { reg-class int-regs }
+    }
+] [
+    T{ live-interval
+        { vreg 7 }
+        { start 4 }
+        { end 8 }
+        { ranges V{ T{ live-range f 4 8 } } }
+        { uses V{ T{ vreg-use f 8 int-rep } } }
+        { reg-class int-regs }
+    } 4 split-for-spill
+    clean-up-split
+] unit-test
+
+! trim-before-ranges, trim-after-ranges
+[
+    T{ live-interval
+        { vreg 8 }
+        { start 0 }
+        { end 3 }
+        { ranges V{ T{ live-range f 0 3 } } }
+        { uses V{ T{ vreg-use f 0 f int-rep } T{ vreg-use f 2 f int-rep } } }
+        { reg-class int-regs }
+        { spill-to T{ spill-slot f 32 } }
+        { spill-rep int-rep }
+    }
+    T{ live-interval
+        { vreg 8 }
+        { start 14 }
+        { end 16 }
+        { ranges V{ T{ live-range f 14 16 } } }
+        { uses V{ T{ vreg-use f 14 f int-rep } } }
+        { reg-class int-regs }
+        { reload-from T{ spill-slot f 32 } }
+        { reload-rep int-rep }
+    }
+] [
+    T{ live-interval
+        { vreg 8 }
+        { start 0 }
+        { end 16 }
+        { ranges V{ T{ live-range f 0 4 } T{ live-range f 6 10 } T{ live-range f 12 16 } } }
+        { uses V{ T{ vreg-use f 0 f int-rep } T{ vreg-use f 2 f int-rep } T{ vreg-use f 14 f int-rep } } }
+        { reg-class int-regs }
+    } 8 split-for-spill
+    clean-up-split
 ] unit-test
 
 H{
@@ -183,24 +341,27 @@ H{
           V{
               T{ live-interval
                  { vreg 1 }
+                 { reg-class int-regs }
                  { reg 1 }
                  { start 1 }
                  { end 15 }
-                 { uses V{ 1 3 7 10 15 } }
+                 { uses V{ T{ vreg-use f 1 int-rep f } T{ vreg-use f 3 f int-rep } T{ vreg-use f 7 f int-rep } T{ vreg-use f 10 f int-rep } T{ vreg-use f 15 f int-rep } } }
               }
               T{ live-interval
                  { vreg 2 }
+                 { reg-class int-regs }
                  { reg 2 }
                  { start 3 }
                  { end 8 }
-                 { uses V{ 3 4 8 } }
+                 { uses V{ T{ vreg-use f 3 int-rep f } T{ vreg-use f 4 f int-rep } T{ vreg-use f 8 f int-rep } } }
               }
               T{ live-interval
                  { vreg 3 }
+                 { reg-class int-regs }
                  { reg 3 }
                  { start 3 }
                  { end 10 }
-                 { uses V{ 3 10 } }
+                 { uses V{ T{ vreg-use f 3 int-rep f } T{ vreg-use f 10 f int-rep } } }
               }
           }
         }
@@ -208,9 +369,10 @@ H{
     H{ } inactive-intervals set
     T{ live-interval
         { vreg 1 }
+        { reg-class int-regs }
         { start 5 }
         { end 5 }
-        { uses V{ 5 } }
+        { uses V{ T{ vreg-use f 5 int-rep f } } }
     }
     spill-status
 ] unit-test
@@ -226,17 +388,19 @@ H{
           V{
               T{ live-interval
                  { vreg 1 }
+                 { reg-class int-regs }
                  { reg 1 }
                  { start 1 }
                  { end 15 }
-                 { uses V{ 1 } }
+                 { uses V{ T{ vreg-use f 1 int-rep f } } }
               }
               T{ live-interval
                  { vreg 2 }
+                 { reg-class int-regs }
                  { reg 2 }
                  { start 3 }
                  { end 8 }
-                 { uses V{ 3 8 } }
+                 { uses V{ T{ vreg-use f 3 int-rep f } T{ vreg-use f 8 f int-rep } } }
               }
           }
         }
@@ -244,9 +408,10 @@ H{
     H{ } inactive-intervals set
     T{ live-interval
         { vreg 3 }
+        { reg-class int-regs }
         { start 5 }
         { end 5 }
-        { uses V{ 5 } }
+        { uses V{ T{ vreg-use f 5 int-rep f } } }
     }
     spill-status
 ] unit-test
@@ -257,9 +422,10 @@ H{ { 1 int-rep } { 2 int-rep } } representations set
     {
         T{ live-interval
            { vreg 1 }
+           { reg-class int-regs }
            { start 0 }
            { end 100 }
-           { uses V{ 0 100 } }
+           { uses V{ T{ vreg-use f 0 int-rep f } T{ vreg-use f 100 f int-rep } } }
            { ranges V{ T{ live-range f 0 100 } } }
         }
     }
@@ -271,16 +437,18 @@ H{ { 1 int-rep } { 2 int-rep } } representations set
     {
         T{ live-interval
            { vreg 1 }
+           { reg-class int-regs }
            { start 0 }
            { end 10 }
-           { uses V{ 0 10 } }
+           { uses V{ T{ vreg-use f 0 int-rep f } T{ vreg-use f 10 f int-rep } } }
            { ranges V{ T{ live-range f 0 10 } } }
         }
         T{ live-interval
            { vreg 2 }
+           { reg-class int-regs }
            { start 11 }
            { end 20 }
-           { uses V{ 11 20 } }
+           { uses V{ T{ vreg-use f 11 int-rep f } T{ vreg-use f 20 f int-rep } } }
            { ranges V{ T{ live-range f 11 20 } } }
         }
     }
@@ -292,16 +460,18 @@ H{ { 1 int-rep } { 2 int-rep } } representations set
     {
         T{ live-interval
            { vreg 1 }
+           { reg-class int-regs }
            { start 0 }
            { end 100 }
-           { uses V{ 0 100 } }
+           { uses V{ T{ vreg-use f 0 int-rep f } T{ vreg-use f 100 f int-rep } } }
            { ranges V{ T{ live-range f 0 100 } } }
         }
         T{ live-interval
            { vreg 2 }
+           { reg-class int-regs }
            { start 30 }
            { end 60 }
-           { uses V{ 30 60 } }
+           { uses V{ T{ vreg-use f 30 int-rep f } T{ vreg-use f 60 f int-rep } } }
            { ranges V{ T{ live-range f 30 60 } } }
         }
     }
@@ -313,16 +483,18 @@ H{ { 1 int-rep } { 2 int-rep } } representations set
     {
         T{ live-interval
            { vreg 1 }
+           { reg-class int-regs }
            { start 0 }
            { end 100 }
-           { uses V{ 0 100 } }
+           { uses V{ T{ vreg-use f 0 int-rep f } T{ vreg-use f 100 f int-rep } } }
            { ranges V{ T{ live-range f 0 100 } } }
         }
         T{ live-interval
            { vreg 2 }
+           { reg-class int-regs }
            { start 30 }
            { end 200 }
-           { uses V{ 30 200 } }
+           { uses V{ T{ vreg-use f 30 int-rep f } T{ vreg-use f 200 f int-rep } } }
            { ranges V{ T{ live-range f 30 200 } } }
         }
     }
@@ -334,16 +506,18 @@ H{ { 1 int-rep } { 2 int-rep } } representations set
     {
         T{ live-interval
            { vreg 1 }
+           { reg-class int-regs }
            { start 0 }
            { end 100 }
-           { uses V{ 0 100 } }
+           { uses V{ T{ vreg-use f 0 int-rep f } T{ vreg-use f 100 f int-rep } } }
            { ranges V{ T{ live-range f 0 100 } } }
         }
         T{ live-interval
            { vreg 2 }
+           { reg-class int-regs }
            { start 30 }
            { end 100 }
-           { uses V{ 30 100 } }
+           { uses V{ T{ vreg-use f 30 int-rep f } T{ vreg-use f 100 f int-rep } } }
            { ranges V{ T{ live-range f 30 100 } } }
         }
     }
@@ -364,39 +538,44 @@ H{
     {
         T{ live-interval
            { vreg 1 }
+           { reg-class int-regs }
            { start 0 }
            { end 20 }
-           { uses V{ 0 10 20 } }
+           { uses V{ T{ vreg-use f 0 int-rep f } T{ vreg-use f 10 f int-rep } T{ vreg-use f 20 f int-rep } } }
            { ranges V{ T{ live-range f 0 2 } T{ live-range f 10 20 } } }
         }
         T{ live-interval
            { vreg 2 }
+           { reg-class int-regs }
            { start 0 }
            { end 20 }
-           { uses V{ 0 10 20 } }
+           { uses V{ T{ vreg-use f 0 int-rep f } T{ vreg-use f 10 f int-rep } T{ vreg-use f 20 f int-rep } } }
            { ranges V{ T{ live-range f 0 2 } T{ live-range f 10 20 } } }
         }
         T{ live-interval
            { vreg 3 }
+           { reg-class int-regs }
            { start 4 }
            { end 8 }
-           { uses V{ 6 } }
+           { uses V{ T{ vreg-use f 6 int-rep f } } }
            { ranges V{ T{ live-range f 4 8 } } }
         }
         T{ live-interval
            { vreg 4 }
+           { reg-class int-regs }
            { start 4 }
            { end 8 }
-           { uses V{ 8 } }
+           { uses V{ T{ vreg-use f 8 int-rep f } } }
            { ranges V{ T{ live-range f 4 8 } } }
         }
 
         ! This guy will invoke the 'spill partially available' code path
         T{ live-interval
            { vreg 5 }
+           { reg-class int-regs }
            { start 4 }
            { end 8 }
-           { uses V{ 8 } }
+           { uses V{ T{ vreg-use f 8 int-rep f } } }
            { ranges V{ T{ live-range f 4 8 } } }
         }
     }
@@ -410,18 +589,20 @@ H{
     {
         T{ live-interval
            { vreg 1 }
+           { reg-class int-regs }
            { start 0 }
            { end 10 }
-           { uses V{ 0 6 10 } }
+           { uses V{ T{ vreg-use f 0 int-rep f } T{ vreg-use f 6 f int-rep } T{ vreg-use f 10 f int-rep } } }
            { ranges V{ T{ live-range f 0 10 } } }
         }
 
         ! This guy will invoke the 'spill new' code path
         T{ live-interval
            { vreg 5 }
+           { reg-class int-regs }
            { start 2 }
            { end 8 }
-           { uses V{ 8 } }
+           { uses V{ T{ vreg-use f 8 int-rep f } } }
            { ranges V{ T{ live-range f 2 8 } } }
         }
     }
@@ -490,12 +671,14 @@ H{
 [ 5 ] [
     T{ live-interval
        { start 0 }
+       { reg-class int-regs }
        { end 10 }
        { uses { 0 10 } }
        { ranges V{ T{ live-range f 0 10 } } }
     }
     T{ live-interval
        { start 5 }
+       { reg-class int-regs }
        { end 10 }
        { uses { 5 10 } }
        { ranges V{ T{ live-range f 5 10 } } }
@@ -519,6 +702,7 @@ H{
           {
               T{ live-interval
                  { vreg 1 }
+                 { reg-class int-regs }
                  { start 0 }
                  { end 20 }
                  { reg 0 }
@@ -528,6 +712,7 @@ H{
 
               T{ live-interval
                  { vreg 2 }
+                 { reg-class int-regs }
                  { start 4 }
                  { end 40 }
                  { reg 0 }
@@ -542,6 +727,7 @@ H{
           {
               T{ live-interval
                  { vreg 3 }
+                 { reg-class int-regs }
                  { start 0 }
                  { end 40 }
                  { reg 1 }
@@ -553,939 +739,12 @@ H{
     } active-intervals set
 
     T{ live-interval
-       { vreg 4 }
+        { vreg 4 }
+        { reg-class int-regs }
         { start 8 }
         { end 10 }
         { ranges V{ T{ live-range f 8 10 } } }
-        { uses V{ 8 10 } }
+        { uses V{ T{ vreg-use f 8 int-rep f } T{ vreg-use f 10 f int-rep } } }
     }
     register-status
 ] unit-test
-
-:: test-linear-scan-on-cfg ( regs -- )
-    [
-        cfg new 0 get >>entry
-        dup cfg set
-        dup fake-representations
-        dup { { int-regs regs } } (linear-scan)
-        flatten-cfg 1array mr.
-    ] with-scope ;
-
-! Bug in live spill slots calculation
-
-V{ T{ ##prologue } T{ ##branch } } 0 test-bb
-
-V{
-    T{ ##peek
-       { dst 703128 }
-       { loc D 1 }
-    }
-    T{ ##peek
-       { dst 703129 }
-       { loc D 0 }
-    }
-    T{ ##copy
-       { dst 703134 }
-       { src 703128 }
-    }
-    T{ ##copy
-       { dst 703135 }
-       { src 703129 }
-    }
-    T{ ##compare-imm-branch
-       { src1 703128 }
-       { src2 5 }
-       { cc cc/= }
-    }
-} 1 test-bb
-
-V{
-    T{ ##copy
-       { dst 703134 }
-       { src 703129 }
-    }
-    T{ ##copy
-       { dst 703135 }
-       { src 703128 }
-    }
-    T{ ##branch }
-} 2 test-bb
-
-V{
-    T{ ##replace
-       { src 703134 }
-       { loc D 0 }
-    }
-    T{ ##replace
-       { src 703135 }
-       { loc D 1 }
-    }
-    T{ ##epilogue }
-    T{ ##return }
-} 3 test-bb
-
-0 1 edge
-1 { 2 3 } edges
-2 3 edge
-
-! Bug in inactive interval handling
-! [ rot dup [ -rot ] when ]
-V{ T{ ##prologue } T{ ##branch } } 0 test-bb
-    
-V{
-    T{ ##peek
-       { dst 689473 }
-       { loc D 2 }
-    }
-    T{ ##peek
-       { dst 689474 }
-       { loc D 1 }
-    }
-    T{ ##peek
-       { dst 689475 }
-       { loc D 0 }
-    }
-    T{ ##compare-imm-branch
-       { src1 689473 }
-       { src2 5 }
-       { cc cc/= }
-    }
-} 1 test-bb
-
-V{
-    T{ ##copy
-       { dst 689481 }
-       { src 689475 }
-       { rep int-rep }
-    }
-    T{ ##copy
-       { dst 689482 }
-       { src 689474 }
-       { rep int-rep }
-    }
-    T{ ##copy
-       { dst 689483 }
-       { src 689473 }
-       { rep int-rep }
-    }
-    T{ ##branch }
-} 2 test-bb
-
-V{
-    T{ ##copy
-       { dst 689481 }
-       { src 689473 }
-       { rep int-rep }
-    }
-    T{ ##copy
-       { dst 689482 }
-       { src 689475 }
-       { rep int-rep }
-    }
-    T{ ##copy
-       { dst 689483 }
-       { src 689474 }
-       { rep int-rep }
-    }
-    T{ ##branch }
-} 3 test-bb
-
-V{
-    T{ ##replace
-       { src 689481 }
-       { loc D 0 }
-    }
-    T{ ##replace
-       { src 689482 }
-       { loc D 1 }
-    }
-    T{ ##replace
-       { src 689483 }
-       { loc D 2 }
-    }
-    T{ ##epilogue }
-    T{ ##return }
-} 4 test-bb
-
-test-diamond
-
-[ ] [ { 1 2 3 4 } test-linear-scan-on-cfg ] unit-test
-
-! Similar to the above
-! [ swap dup [ rot ] when ]
-
-T{ basic-block
-   { id 201537 }
-   { number 0 }
-   { instructions V{ T{ ##prologue } T{ ##branch } } }
-} 0 set
-    
-V{
-    T{ ##peek
-       { dst 689600 }
-       { loc D 1 }
-    }
-    T{ ##peek
-       { dst 689601 }
-       { loc D 0 }
-    }
-    T{ ##compare-imm-branch
-       { src1 689600 }
-       { src2 5 }
-       { cc cc/= }
-    }
-} 1 test-bb
-    
-V{
-    T{ ##peek
-       { dst 689604 }
-       { loc D 2 }
-    }
-    T{ ##copy
-       { dst 689607 }
-       { src 689604 }
-    }
-    T{ ##copy
-       { dst 689608 }
-       { src 689600 }
-       { rep int-rep }
-    }
-    T{ ##copy
-       { dst 689610 }
-       { src 689601 }
-       { rep int-rep }
-    }
-    T{ ##branch }
-} 2 test-bb
-    
-V{
-    T{ ##peek
-       { dst 689609 }
-       { loc D 2 }
-    }
-    T{ ##copy
-       { dst 689607 }
-       { src 689600 }
-       { rep int-rep }
-    }
-    T{ ##copy
-       { dst 689608 }
-       { src 689601 }
-       { rep int-rep }
-    }
-    T{ ##copy
-       { dst 689610 }
-       { src 689609 }
-       { rep int-rep }
-    }
-    T{ ##branch }
-} 3 test-bb
-    
-V{
-    T{ ##replace
-       { src 689607 }
-       { loc D 0 }
-    }
-    T{ ##replace
-       { src 689608 }
-       { loc D 1 }
-    }
-    T{ ##replace
-       { src 689610 }
-       { loc D 2 }
-    }
-    T{ ##epilogue }
-    T{ ##return }
-} 4 test-bb
-
-test-diamond
-
-[ ] [ { 1 2 3 4 } test-linear-scan-on-cfg ] unit-test
-
-! compute-live-registers was inaccurate since it didn't take
-! lifetime holes into account
-
-V{ T{ ##prologue } T{ ##branch } } 0 test-bb
-
-V{
-    T{ ##peek
-       { dst 0 }
-       { loc D 0 }
-    }
-    T{ ##compare-imm-branch
-       { src1 0 }
-       { src2 5 }
-       { cc cc/= }
-    }
-} 1 test-bb
-
-V{
-    T{ ##peek
-       { dst 1 }
-       { loc D 1 }
-    }
-    T{ ##copy
-       { dst 2 }
-       { src 1 }
-       { rep int-rep }
-    }
-    T{ ##branch }
-} 2 test-bb
-
-V{
-    T{ ##peek
-       { dst 3 }
-       { loc D 2 }
-    }
-    T{ ##copy
-       { dst 2 }
-       { src 3 }
-       { rep int-rep }
-    }
-    T{ ##branch }
-} 3 test-bb
-
-V{
-    T{ ##replace
-       { src 2 }
-       { loc D 0 }
-    }
-    T{ ##return }
-} 4 test-bb
-
-test-diamond
-
-[ ] [ { 1 2 3 4 } test-linear-scan-on-cfg ] unit-test
-
-! Inactive interval handling: splitting active interval
-! if it fits in lifetime hole only partially
-
-V{ T{ ##peek f 3 R 1 } T{ ##branch } } 0 test-bb
-
-V{
-    T{ ##peek f 2 R 0 }
-    T{ ##compare-imm-branch f 2 5 cc= }
-} 1 test-bb
-
-V{
-    T{ ##peek f 0 D 0 }
-    T{ ##branch }
-} 2 test-bb
-
-
-V{
-    T{ ##peek f 1 D 1 }
-    T{ ##peek f 0 D 0 }
-    T{ ##replace f 1 D 2 }
-    T{ ##branch }
-} 3 test-bb
-
-V{
-    T{ ##replace f 3 R 2 }
-    T{ ##replace f 0 D 0 }
-    T{ ##return }
-} 4 test-bb
-
-test-diamond
-
-[ ] [ { 1 2 } test-linear-scan-on-cfg ] unit-test
-
-! Not until splitting is finished
-! [ _copy ] [ 3 get instructions>> second class ] unit-test
-
-! Resolve pass; make sure the spilling is done correctly
-V{ T{ ##peek f 3 R 1 } T{ ##branch } } 0 test-bb
-
-V{
-    T{ ##peek f 2 R 0 }
-    T{ ##compare-imm-branch f 2 5 cc= }
-} 1 test-bb
-
-V{
-    T{ ##branch }
-} 2 test-bb
-
-V{
-    T{ ##replace f 3 R 1 }
-    T{ ##peek f 1 D 1 }
-    T{ ##peek f 0 D 0 }
-    T{ ##replace f 1 D 2 }
-    T{ ##replace f 0 D 2 }
-    T{ ##branch }
-} 3 test-bb
-
-V{
-    T{ ##replace f 3 R 2 }
-    T{ ##return }
-} 4 test-bb
-
-test-diamond
-
-[ ] [ { 1 2 } test-linear-scan-on-cfg ] unit-test
-
-[ _spill ] [ 2 get successors>> first instructions>> first class ] unit-test
-
-[ _spill ] [ 3 get instructions>> second class ] unit-test
-
-[ f ] [ 3 get instructions>> [ _reload? ] any? ] unit-test
-
-[ _reload ] [ 4 get instructions>> first class ] unit-test
-
-! Resolve pass
-V{
-    T{ ##branch }
-} 0 test-bb
-
-V{
-    T{ ##peek f 0 D 0 }
-    T{ ##compare-imm-branch f 0 5 cc= }
-} 1 test-bb
-
-V{
-    T{ ##replace f 0 D 0 }
-    T{ ##peek f 1 D 0 }
-    T{ ##peek f 2 D 0 }
-    T{ ##replace f 1 D 0 }
-    T{ ##replace f 2 D 0 }
-    T{ ##branch }
-} 2 test-bb
-
-V{
-    T{ ##branch }
-} 3 test-bb
-
-V{
-    T{ ##peek f 1 D 0 }
-    T{ ##compare-imm-branch f 1 5 cc= }
-} 4 test-bb
-
-V{
-    T{ ##replace f 0 D 0 }
-    T{ ##return }
-} 5 test-bb
-
-V{
-    T{ ##replace f 0 D 0 }
-    T{ ##return }
-} 6 test-bb
-
-0 1 edge
-1 { 2 3 } edges
-2 4 edge
-3 4 edge
-4 { 5 6 } edges
-
-[ ] [ { 1 2 } test-linear-scan-on-cfg ] unit-test
-
-[ t ] [ 2 get instructions>> [ _spill? ] any? ] unit-test
-
-[ t ] [ 3 get predecessors>> first instructions>> [ _spill? ] any? ] unit-test
-
-[ t ] [ 5 get instructions>> [ _reload? ] any? ] unit-test
-
-! A more complicated failure case with resolve that came up after the above
-! got fixed
-V{ T{ ##branch } } 0 test-bb
-V{
-    T{ ##peek f 0 D 0 }
-    T{ ##peek f 1 D 1 }
-    T{ ##peek f 2 D 2 }
-    T{ ##peek f 3 D 3 }
-    T{ ##peek f 4 D 0 }
-    T{ ##branch }
-} 1 test-bb
-V{ T{ ##branch } } 2 test-bb
-V{ T{ ##branch } } 3 test-bb
-V{
-    
-    T{ ##replace f 1 D 1 }
-    T{ ##replace f 2 D 2 }
-    T{ ##replace f 3 D 3 }
-    T{ ##replace f 4 D 4 }
-    T{ ##replace f 0 D 0 }
-    T{ ##branch }
-} 4 test-bb
-V{ T{ ##replace f 0 D 0 } T{ ##branch } } 5 test-bb
-V{ T{ ##return } } 6 test-bb
-V{ T{ ##branch } } 7 test-bb
-V{
-    T{ ##replace f 1 D 1 }
-    T{ ##replace f 2 D 2 }
-    T{ ##replace f 3 D 3 }
-    T{ ##peek f 5 D 1 }
-    T{ ##peek f 6 D 2 }
-    T{ ##peek f 7 D 3 }
-    T{ ##peek f 8 D 4 }
-    T{ ##replace f 5 D 1 }
-    T{ ##replace f 6 D 2 }
-    T{ ##replace f 7 D 3 }
-    T{ ##replace f 8 D 4 }
-    T{ ##branch }
-} 8 test-bb
-V{
-    T{ ##replace f 1 D 1 }
-    T{ ##replace f 2 D 2 }
-    T{ ##replace f 3 D 3 }
-    T{ ##return }
-} 9 test-bb
-
-0 1 edge
-1 { 2 7 } edges
-7 8 edge
-8 9 edge
-2 { 3 5 } edges
-3 4 edge
-4 9 edge
-5 6 edge
-
-[ ] [ { 1 2 3 4 } test-linear-scan-on-cfg ] unit-test
-
-[ _spill ] [ 1 get instructions>> second class ] unit-test
-[ _reload ] [ 4 get instructions>> 4 swap nth class ] unit-test
-[ V{ 3 2 1 } ] [ 8 get instructions>> [ _spill? ] filter [ dst>> n>> cell / ] map ] unit-test
-[ V{ 3 2 1 } ] [ 9 get instructions>> [ _reload? ] filter [ src>> n>> cell / ] map ] unit-test
-
-! Resolve pass should insert this
-[ _reload ] [ 5 get predecessors>> first instructions>> first class ] unit-test
-
-! Some random bug
-V{
-    T{ ##peek f 1 D 1 }
-    T{ ##peek f 2 D 2 }
-    T{ ##replace f 1 D 1 }
-    T{ ##replace f 2 D 2 }
-    T{ ##peek f 3 D 0 }
-    T{ ##peek f 0 D 0 }
-    T{ ##branch }
-} 0 test-bb
-
-V{ T{ ##branch } } 1 test-bb
-
-V{
-    T{ ##peek f 1 D 1 }
-    T{ ##peek f 2 D 2 }
-    T{ ##replace f 3 D 3 }
-    T{ ##replace f 1 D 1 }
-    T{ ##replace f 2 D 2 }
-    T{ ##replace f 0 D 3 }
-    T{ ##branch }
-} 2 test-bb
-
-V{ T{ ##branch } } 3 test-bb
-
-V{
-    T{ ##return }
-} 4 test-bb
-
-test-diamond
-
-[ ] [ { 1 2 } test-linear-scan-on-cfg ] unit-test
-
-! Spilling an interval immediately after its activated;
-! and the interval does not have a use at the activation point
-V{
-    T{ ##peek f 1 D 1 }
-    T{ ##peek f 2 D 2 }
-    T{ ##replace f 1 D 1 }
-    T{ ##replace f 2 D 2 }
-    T{ ##peek f 0 D 0 }
-    T{ ##branch }
-} 0 test-bb
-
-V{ T{ ##branch } } 1 test-bb
-
-V{
-    T{ ##peek f 1 D 1 }
-    T{ ##branch }
-} 2 test-bb
-
-V{
-    T{ ##replace f 1 D 1 }
-    T{ ##peek f 2 D 2 }
-    T{ ##replace f 2 D 2 }
-    T{ ##branch }
-} 3 test-bb
-
-V{ T{ ##branch } } 4 test-bb
-
-V{
-    T{ ##replace f 0 D 0 }
-    T{ ##return }
-} 5 test-bb
-
-0 1 edge
-1 { 2 4 } edges
-4 5 edge
-2 3 edge
-3 5 edge
-
-[ ] [ { 1 2 } test-linear-scan-on-cfg ] unit-test
-
-! Reduction of push-all regression, x86-32
-V{ T{ ##prologue } T{ ##branch } } 0 test-bb
-
-V{
-    T{ ##load-immediate { dst 61 } }
-    T{ ##peek { dst 62 } { loc D 0 } }
-    T{ ##peek { dst 64 } { loc D 1 } }
-    T{ ##slot-imm
-        { dst 69 }
-        { obj 64 }
-        { slot 1 }
-        { tag 2 }
-    }
-    T{ ##copy { dst 79 } { src 69 } { rep int-rep } }
-    T{ ##slot-imm
-        { dst 85 }
-        { obj 62 }
-        { slot 2 }
-        { tag 7 }
-    }
-    T{ ##compare-branch
-        { src1 69 }
-        { src2 85 }
-        { cc cc> }
-    }
-} 1 test-bb
-
-V{
-    T{ ##slot-imm
-        { dst 97 }
-        { obj 62 }
-        { slot 2 }
-        { tag 7 }
-    }
-    T{ ##replace { src 79 } { loc D 3 } }
-    T{ ##replace { src 62 } { loc D 4 } }
-    T{ ##replace { src 79 } { loc D 1 } }
-    T{ ##replace { src 62 } { loc D 2 } }
-    T{ ##replace { src 61 } { loc D 5 } }
-    T{ ##replace { src 62 } { loc R 0 } }
-    T{ ##replace { src 69 } { loc R 1 } }
-    T{ ##replace { src 97 } { loc D 0 } }
-    T{ ##call { word resize-array } }
-    T{ ##branch }
-} 2 test-bb
-
-V{
-    T{ ##peek { dst 98 } { loc R 0 } }
-    T{ ##peek { dst 100 } { loc D 0 } }
-    T{ ##set-slot-imm
-        { src 100 }
-        { obj 98 }
-        { slot 2 }
-        { tag 7 }
-    }
-    T{ ##peek { dst 108 } { loc D 2 } }
-    T{ ##peek { dst 110 } { loc D 3 } }
-    T{ ##peek { dst 112 } { loc D 0 } }
-    T{ ##peek { dst 114 } { loc D 1 } }
-    T{ ##peek { dst 116 } { loc D 4 } }
-    T{ ##peek { dst 119 } { loc R 0 } }
-    T{ ##copy { dst 109 } { src 108 } { rep int-rep } }
-    T{ ##copy { dst 111 } { src 110 } { rep int-rep } }
-    T{ ##copy { dst 113 } { src 112 } { rep int-rep } }
-    T{ ##copy { dst 115 } { src 114 } { rep int-rep } }
-    T{ ##copy { dst 117 } { src 116 } { rep int-rep } }
-    T{ ##copy { dst 120 } { src 119 } { rep int-rep } }
-    T{ ##branch }
-} 3 test-bb
-
-V{
-    T{ ##copy { dst 109 } { src 62 } { rep int-rep } }
-    T{ ##copy { dst 111 } { src 61 } { rep int-rep } }
-    T{ ##copy { dst 113 } { src 62 } { rep int-rep } }
-    T{ ##copy { dst 115 } { src 79 } { rep int-rep } }
-    T{ ##copy { dst 117 } { src 64 } { rep int-rep } }
-    T{ ##copy { dst 120 } { src 69 } { rep int-rep } }
-    T{ ##branch }
-} 4 test-bb
-
-V{
-    T{ ##replace { src 120 } { loc D 0 } }
-    T{ ##replace { src 109 } { loc D 3 } }
-    T{ ##replace { src 111 } { loc D 4 } }
-    T{ ##replace { src 113 } { loc D 1 } }
-    T{ ##replace { src 115 } { loc D 2 } }
-    T{ ##replace { src 117 } { loc D 5 } }
-    T{ ##epilogue }
-    T{ ##return }
-} 5 test-bb
-
-0 1 edge
-1 { 2 4 } edges
-2 3 edge
-3 5 edge
-4 5 edge
-
-[ ] [ { 1 2 3 4 5 } test-linear-scan-on-cfg ] unit-test
-
-! Another reduction of push-all
-V{ T{ ##prologue } T{ ##branch } } 0 test-bb
-
-V{
-    T{ ##peek { dst 85 } { loc D 0 } }
-    T{ ##slot-imm
-        { dst 89 }
-        { obj 85 }
-        { slot 3 }
-        { tag 7 }
-    }
-    T{ ##peek { dst 91 } { loc D 1 } }
-    T{ ##slot-imm
-        { dst 96 }
-        { obj 91 }
-        { slot 1 }
-        { tag 2 }
-    }
-    T{ ##add
-        { dst 109 }
-        { src1 89 }
-        { src2 96 }
-    }
-    T{ ##slot-imm
-        { dst 115 }
-        { obj 85 }
-        { slot 2 }
-        { tag 7 }
-    }
-    T{ ##slot-imm
-        { dst 118 }
-        { obj 115 }
-        { slot 1 }
-        { tag 2 }
-    }
-    T{ ##compare-branch
-        { src1 109 }
-        { src2 118 }
-        { cc cc> }
-    }
-} 1 test-bb
-
-V{
-    T{ ##add-imm
-        { dst 128 }
-        { src1 109 }
-        { src2 8 }
-    }
-    T{ ##load-immediate { dst 129 } { val 24 } }
-    T{ ##inc-d { n 4 } }
-    T{ ##inc-r { n 1 } }
-    T{ ##replace { src 109 } { loc D 2 } }
-    T{ ##replace { src 85 } { loc D 3 } }
-    T{ ##replace { src 128 } { loc D 0 } }
-    T{ ##replace { src 85 } { loc D 1 } }
-    T{ ##replace { src 89 } { loc D 4 } }
-    T{ ##replace { src 96 } { loc R 0 } }
-    T{ ##replace { src 129 } { loc R 0 } }
-    T{ ##branch }
-} 2 test-bb
-
-V{
-    T{ ##peek { dst 134 } { loc D 1 } }
-    T{ ##slot-imm
-        { dst 140 }
-        { obj 134 }
-        { slot 2 }
-        { tag 7 }
-    }
-    T{ ##inc-d { n 1 } }
-    T{ ##inc-r { n 1 } }
-    T{ ##replace { src 140 } { loc D 0 } }
-    T{ ##replace { src 134 } { loc R 0 } }
-    T{ ##call { word resize-array } }
-    T{ ##branch }
-} 3 test-bb
-
-V{
-    T{ ##peek { dst 141 } { loc R 0 } }
-    T{ ##peek { dst 143 } { loc D 0 } }
-    T{ ##set-slot-imm
-        { src 143 }
-        { obj 141 }
-        { slot 2 }
-        { tag 7 }
-    }
-    T{ ##write-barrier-imm
-        { src 141 }
-        { slot 2 }
-        { temp1 145 }
-        { temp2 146 }
-    }
-    T{ ##inc-d { n -1 } }
-    T{ ##inc-r { n -1 } }
-    T{ ##peek { dst 156 } { loc D 2 } }
-    T{ ##peek { dst 158 } { loc D 3 } }
-    T{ ##peek { dst 160 } { loc D 0 } }
-    T{ ##peek { dst 162 } { loc D 1 } }
-    T{ ##peek { dst 164 } { loc D 4 } }
-    T{ ##peek { dst 167 } { loc R 0 } }
-    T{ ##copy { dst 157 } { src 156 } { rep int-rep } }
-    T{ ##copy { dst 159 } { src 158 } { rep int-rep } }
-    T{ ##copy { dst 161 } { src 160 } { rep int-rep } }
-    T{ ##copy { dst 163 } { src 162 } { rep int-rep } }
-    T{ ##copy { dst 165 } { src 164 } { rep int-rep } }
-    T{ ##copy { dst 168 } { src 167 } { rep int-rep } }
-    T{ ##branch }
-} 4 test-bb
-
-V{
-    T{ ##inc-d { n 3 } }
-    T{ ##inc-r { n 1 } }
-    T{ ##copy { dst 157 } { src 85 } }
-    T{ ##copy { dst 159 } { src 89 } }
-    T{ ##copy { dst 161 } { src 85 } }
-    T{ ##copy { dst 163 } { src 109 } }
-    T{ ##copy { dst 165 } { src 91 } }
-    T{ ##copy { dst 168 } { src 96 } }
-    T{ ##branch }
-} 5 test-bb
-
-V{
-    T{ ##set-slot-imm
-        { src 163 }
-        { obj 161 }
-        { slot 3 }
-        { tag 7 }
-    }
-    T{ ##inc-d { n 1 } }
-    T{ ##inc-r { n -1 } }
-    T{ ##replace { src 168 } { loc D 0 } }
-    T{ ##replace { src 157 } { loc D 3 } }
-    T{ ##replace { src 159 } { loc D 4 } }
-    T{ ##replace { src 161 } { loc D 1 } }
-    T{ ##replace { src 163 } { loc D 2 } }
-    T{ ##replace { src 165 } { loc D 5 } }
-    T{ ##epilogue }
-    T{ ##return }
-} 6 test-bb
-
-0 1 edge
-1 { 2 5 } edges
-2 3 edge
-3 4 edge
-4 6 edge
-5 6 edge
-
-[ ] [ { 1 2 3 4 5 } test-linear-scan-on-cfg ] unit-test
-
-! Fencepost error in assignment pass
-V{ T{ ##branch } } 0 test-bb
-
-V{
-    T{ ##peek f 0 D 0 }
-    T{ ##compare-imm-branch f 0 5 cc= }
-} 1 test-bb
-
-V{ T{ ##branch } } 2 test-bb
-
-V{
-    T{ ##peek f 1 D 0 }
-    T{ ##peek f 2 D 0 }
-    T{ ##replace f 1 D 0 }
-    T{ ##replace f 2 D 0 }
-    T{ ##branch }
-} 3 test-bb
-
-V{
-    T{ ##replace f 0 D 0 }
-    T{ ##return }
-} 4 test-bb
-
-test-diamond
-
-[ ] [ { 1 2 } test-linear-scan-on-cfg ] unit-test
-
-[ 0 ] [ 1 get instructions>> [ _spill? ] count ] unit-test
-
-[ 1 ] [ 2 get instructions>> [ _spill? ] count ] unit-test
-
-[ 1 ] [ 3 get predecessors>> first instructions>> [ _spill? ] count ] unit-test
-
-[ 1 ] [ 4 get instructions>> [ _reload? ] count ] unit-test
-
-! Another test case for fencepost error in assignment pass
-V{ T{ ##branch } } 0 test-bb
-
-V{
-    T{ ##peek f 0 D 0 }
-    T{ ##compare-imm-branch f 0 5 cc= }
-} 1 test-bb
-
-V{
-    T{ ##peek f 1 D 0 }
-    T{ ##peek f 2 D 0 }
-    T{ ##replace f 1 D 0 }
-    T{ ##replace f 2 D 0 }
-    T{ ##replace f 0 D 0 }
-    T{ ##branch }
-} 2 test-bb
-
-V{
-    T{ ##branch }
-} 3 test-bb
-
-V{
-    T{ ##replace f 0 D 0 }
-    T{ ##return }
-} 4 test-bb
-
-test-diamond
-
-[ ] [ { 1 2 } test-linear-scan-on-cfg ] unit-test
-
-[ 0 ] [ 1 get instructions>> [ _spill? ] count ] unit-test
-
-[ 1 ] [ 2 get instructions>> [ _spill? ] count ] unit-test
-
-[ 1 ] [ 2 get instructions>> [ _reload? ] count ] unit-test
-
-[ 0 ] [ 3 get instructions>> [ _spill? ] count ] unit-test
-
-[ 0 ] [ 4 get instructions>> [ _reload? ] count ] unit-test
-
-V{
-    T{ ##peek f 0 D 0 }
-    T{ ##peek f 1 D 1 }
-    T{ ##replace f 1 D 1 }
-    T{ ##branch }
-} 0 test-bb
-
-V{
-    T{ ##gc f 2 3 }
-    T{ ##branch }
-} 1 test-bb
-
-V{
-    T{ ##replace f 0 D 0 }
-    T{ ##return }
-} 2 test-bb
-
-0 1 edge
-1 2 edge
-
-[ ] [ { 1 2 3 } test-linear-scan-on-cfg ] unit-test
-
-[ { { 0 1 } } ] [ 1 get instructions>> first tagged-values>> ] unit-test
-
-V{
-    T{ ##peek f 0 D 0 }
-    T{ ##peek f 1 D 1 }
-    T{ ##compare-imm-branch f 1 5 cc= }
-} 0 test-bb
-
-V{
-    T{ ##gc f 2 3 }
-    T{ ##replace f 0 D 0 }
-    T{ ##return }
-} 1 test-bb
-
-V{
-    T{ ##return }
-} 2 test-bb
-
-0 { 1 2 } edges
-
-[ ] [ { 1 2 3 } test-linear-scan-on-cfg ] unit-test
-
-[ { { 0 1 } } ] [ 1 get instructions>> first tagged-values>> ] unit-test
index 5e723f098a06dcbd9f8c7a5f675179c8864d6210..5f1abd31658a8cc03d3abb977e1cf37ad7e0d277 100644 (file)
@@ -1,10 +1,9 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel accessors namespaces make locals
+USING: kernel accessors assocs sequences namespaces make locals
 cpu.architecture
 compiler.cfg
 compiler.cfg.rpo
-compiler.cfg.liveness
 compiler.cfg.registers
 compiler.cfg.instructions
 compiler.cfg.linear-scan.numbering
@@ -29,13 +28,21 @@ IN: compiler.cfg.linear-scan
 ! by Omri Traub, Glenn Holloway, Michael D. Smith
 ! http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.8435
 
+! SSA liveness must have been computed already
+
 :: (linear-scan) ( cfg machine-registers -- )
-    cfg compute-live-sets
     cfg number-instructions
     cfg compute-live-intervals machine-registers allocate-registers
     cfg assign-registers
     cfg resolve-data-flow
     cfg check-numbering ;
 
+: admissible-registers ( cfg -- regs )
+    [ machine-registers ] dip
+    frame-pointer?>> [
+        [ int-regs ] dip [ clone ] map
+        [ [ [ frame-reg ] dip remove ] change-at ] keep
+    ] when ;
+
 : linear-scan ( cfg -- cfg' )
-    dup machine-registers (linear-scan) ;
+    dup dup admissible-registers (linear-scan) ;
index 00d6f73517ec3dd8949dd5fd0549dfd8547d141b..65f341feb8be1420f3404841c941a821ad8fd735 100644 (file)
@@ -1,19 +1,43 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: namespaces kernel assocs accessors sequences math math.order fry
-combinators binary-search compiler.cfg.instructions compiler.cfg.registers
-compiler.cfg.def-use compiler.cfg.liveness compiler.cfg.linearization.order
-compiler.cfg ;
+USING: namespaces kernel assocs accessors locals sequences math
+math.order fry combinators binary-search
+compiler.cfg.instructions
+compiler.cfg.registers
+compiler.cfg.def-use
+compiler.cfg.liveness
+compiler.cfg.linearization
+compiler.cfg.ssa.destruction
+compiler.cfg
+cpu.architecture ;
 IN: compiler.cfg.linear-scan.live-intervals
 
 TUPLE: live-range from to ;
 
 C: <live-range> live-range
 
+TUPLE: vreg-use n def-rep use-rep ;
+
+: <vreg-use> ( n -- vreg-use ) vreg-use new swap >>n ;
+
 TUPLE: live-interval
 vreg
-reg spill-to reload-from
-start end ranges uses ;
+reg spill-to spill-rep reload-from reload-rep
+start end ranges uses
+reg-class ;
+
+: first-use ( live-interval -- use ) uses>> first ; inline
+
+: last-use ( live-interval -- use ) uses>> last ; inline
+
+: new-use ( insn# uses -- use )
+    [ <vreg-use> dup ] dip push ;
+
+: last-use? ( insn# uses -- use/f )
+    [ drop f ] [ last [ n>> = ] keep and ] if-empty ;
+
+: (add-use) ( insn# live-interval -- use )
+    uses>> 2dup last-use? dup [ 2nip ] [ drop new-use ] if ;
 
 GENERIC: covers? ( insn# obj -- ? )
 
@@ -29,13 +53,17 @@ M: live-interval covers? ( insn# live-interval -- ? )
         [ drop ] [ [ from>> <=> ] with search nip ] 2bi
         covers?
     ] if ;
-        
+
+:: find-use ( insn# live-interval -- vreg-use )
+    insn# live-interval uses>> [ n>> <=> ] with search nip
+    dup [ dup n>> insn# = [ drop f ] unless ] when ;
+
 : add-new-range ( from to live-interval -- )
     [ <live-range> ] dip ranges>> push ;
 
 : shorten-range ( n live-interval -- )
     dup ranges>> empty?
-    [ dupd add-new-range ] [ ranges>> last (>>from) ] if ;
+    [ dupd add-new-range ] [ ranges>> last from<< ] if ;
 
 : extend-range ( from to live-range -- )
     ranges>> last
@@ -50,66 +78,63 @@ M: live-interval covers? ( insn# live-interval -- ? )
     2dup extend-range?
     [ extend-range ] [ add-new-range ] if ;
 
-GENERIC: operands-in-registers? ( insn -- ? )
-
-M: vreg-insn operands-in-registers? drop t ;
-
-M: partial-sync-insn operands-in-registers? drop f ;
-
-: add-def ( insn live-interval -- )
-    [ insn#>> ] [ uses>> ] bi* push ;
-
-: add-use ( insn live-interval -- )
-    ! Every use is a potential def, no SSA here baby!
-    over operands-in-registers? [ add-def ] [ 2drop ] if ;
-
-: <live-interval> ( vreg -- live-interval )
+: <live-interval> ( vreg reg-class -- live-interval )
     \ live-interval new
         V{ } clone >>uses
         V{ } clone >>ranges
+        swap >>reg-class
         swap >>vreg ;
 
 : block-from ( bb -- n ) instructions>> first insn#>> 1 - ;
 
 : block-to ( bb -- n ) instructions>> last insn#>> ;
 
-M: live-interval hashcode*
-    nip [ start>> ] [ end>> 1000 * ] bi + ;
+SYMBOLS: from to ;
 
 ! Mapping from vreg to live-interval
 SYMBOL: live-intervals
 
 : live-interval ( vreg -- live-interval )
-    live-intervals get [ <live-interval> ] cache ;
+    leader live-intervals get
+    [ dup rep-of reg-class-of <live-interval> ] cache ;
 
 GENERIC: compute-live-intervals* ( insn -- )
 
 M: insn compute-live-intervals* drop ;
 
-: handle-output ( insn vreg -- )
-    live-interval
-    [ [ insn#>> ] dip shorten-range ] [ add-def ] 2bi ;
+:: record-def ( vreg n -- )
+    vreg live-interval :> live-interval
+
+    n live-interval shorten-range
+    n live-interval (add-use) vreg rep-of >>def-rep drop ;
 
-: handle-input ( insn vreg -- )
-    live-interval
-    [ [ [ basic-block get block-from ] dip insn#>> ] dip add-range ] [ add-use ] 2bi ;
+:: record-use ( vreg n -- )
+    vreg live-interval :> live-interval
 
-: handle-temp ( insn vreg -- )
-    live-interval
-    [ [ insn#>> dup ] dip add-range ] [ add-use ] 2bi ;
+    from get n live-interval add-range
+    n live-interval (add-use) vreg rep-of >>use-rep drop ;
 
-M: vreg-insn compute-live-intervals*
-    [ dup defs-vreg [ handle-output ] with when* ]
-    [ dup uses-vregs [ handle-input ] with each ]
-    [ dup temp-vregs [ handle-temp ] with each ]
-    tri ;
+:: record-temp ( vreg n -- )
+    vreg live-interval :> live-interval
+
+    n n live-interval add-range
+    n live-interval (add-use) vreg rep-of >>def-rep drop ;
+
+M: vreg-insn compute-live-intervals* ( insn -- )
+    dup insn#>>
+    [ [ defs-vreg ] dip '[ _ record-def ] when* ]
+    [ [ uses-vregs ] dip '[ _ record-use ] each ]
+    [ [ temp-vregs ] dip '[ _ record-temp ] each ]
+    2tri ;
 
 : handle-live-out ( bb -- )
-    [ block-from ] [ block-to ] [ live-out keys ] tri
-    [ live-interval add-range ] with with each ;
+    live-out dup assoc-empty? [ drop ] [
+        [ from get to get ] dip keys
+        [ live-interval add-range ] with with each
+    ] if ;
 
 ! A location where all registers have to be spilled
-TUPLE: sync-point n ;
+TUPLE: sync-point n keep-dst? ;
 
 C: <sync-point> sync-point
 
@@ -118,26 +143,32 @@ SYMBOL: sync-points
 
 GENERIC: compute-sync-points* ( insn -- )
 
-M: partial-sync-insn compute-sync-points*
-    insn#>> <sync-point> sync-points get push ;
+M: hairy-clobber-insn compute-sync-points*
+    insn#>> f <sync-point> sync-points get push ;
+
+M: clobber-insn compute-sync-points*
+    insn#>> t <sync-point> sync-points get push ;
 
 M: insn compute-sync-points* drop ;
 
 : compute-live-intervals-step ( bb -- )
-    [ basic-block set ]
-    [ handle-live-out ]
-    [
-        instructions>> <reversed> [
-            [ compute-live-intervals* ]
-            [ compute-sync-points* ]
-            bi
-        ] each
-    ] tri ;
+    {
+        [ block-from from set ]
+        [ block-to to set ]
+        [ handle-live-out ]
+        [
+            instructions>> <reversed> [
+                [ compute-live-intervals* ]
+                [ compute-sync-points* ]
+                bi
+            ] each
+        ]
+    } cleave ;
 
 : init-live-intervals ( -- )
     H{ } clone live-intervals set
     V{ } clone sync-points set ;
-    
+
 : compute-start/end ( live-interval -- )
     dup ranges>> [ first from>> ] [ last to>> ] bi
     [ >>start ] [ >>end ] bi* drop ;
@@ -152,8 +183,8 @@ ERROR: bad-live-interval live-interval ;
     ! to reverse some sequences, and compute the start and end.
     values dup [
         {
-            [ ranges>> reverse! drop ]
-            [ uses>> reverse! drop ]
+            [ [ { } like reverse! ] change-ranges drop ]
+            [ [ { } like reverse! ] change-uses drop ]
             [ compute-start/end ]
             [ check-start ]
         } cleave
index 44b2ff907a19ad9400e7f525d30519935478ab1e..bc9c4c4b5595017104049f36ce39be9a581446ea 100644 (file)
@@ -1,16 +1,11 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel accessors math sequences grouping namespaces
-compiler.cfg.linearization.order ;
+compiler.cfg.linearization ;
 IN: compiler.cfg.linear-scan.numbering
 
-ERROR: already-numbered insn ;
-
 : number-instruction ( n insn -- n' )
-    [ nip dup insn#>> [ already-numbered ] [ drop ] if ]
-    [ (>>insn#) ]
-    [ drop 2 + ]
-    2tri ;
+    [ insn#<< ] [ drop 2 + ] 2bi ;
 
 : number-instructions ( cfg -- )
     linearization-order
index e7f291d61312b5a21de70ecbd43cca4ce2f7b831..7aff066e0ba0449432373c8df1c589ac70ad6ac2 100644 (file)
@@ -7,7 +7,10 @@ IN: compiler.cfg.linear-scan.resolve.tests
 
 [
     {
-        { { T{ spill-slot f 0 } int-rep } { 1 int-rep } }
+        {
+            T{ location f T{ spill-slot f 0 } int-rep int-regs }
+            T{ location f 1 int-rep int-regs }
+        }
     }
 ] [
     [
@@ -17,21 +20,25 @@ IN: compiler.cfg.linear-scan.resolve.tests
 
 [
     {
-        T{ _reload { dst 1 } { rep int-rep } { src T{ spill-slot f 0 } } }
+        T{ ##reload { dst 1 } { rep int-rep } { src T{ spill-slot f 0 } } }
     }
 ] [
     [
-        { T{ spill-slot f 0 } int-rep } { 1 int-rep } >insn
+        T{ location f T{ spill-slot f 0 } int-rep int-regs }
+        T{ location f 1 int-rep int-regs }
+        >insn
     ] { } make
 ] unit-test
 
 [
     {
-        T{ _spill { src 1 } { rep int-rep } { dst T{ spill-slot f 0 } } }
+        T{ ##spill { src 1 } { rep int-rep } { dst T{ spill-slot f 0 } } }
     }
 ] [
     [
-        { 1 int-rep } { T{ spill-slot f 0 } int-rep } >insn
+        T{ location f 1 int-rep int-regs }
+        T{ location f T{ spill-slot f 0 } int-rep int-regs }
+        >insn
     ] { } make
 ] unit-test
 
@@ -41,27 +48,84 @@ IN: compiler.cfg.linear-scan.resolve.tests
     }
 ] [
     [
-        { 1 int-rep } { 2 int-rep } >insn
+        T{ location f 1 int-rep int-regs }
+        T{ location f 2 int-rep int-regs }
+        >insn
     ] { } make
 ] unit-test
 
-cfg new 8 >>spill-area-size cfg set
-H{ } clone spill-temps set
+[
+    {
+        T{ ##copy { src 1 } { dst 2 } { rep int-rep } }
+        T{ ##branch }
+    }
+] [
+    { { T{ location f 1 int-rep int-regs } T{ location f 2 int-rep int-regs } } }
+    mapping-instructions
+] unit-test
 
 [
-    t
+    {
+        T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 0 } } }
+        T{ ##reload { dst 0 } { rep tagged-rep } { src T{ spill-slot f 1 } } }
+        T{ ##branch }
+    }
 ] [
-    { { { 0 int-rep } { 1 int-rep } } { { 1 int-rep } { 0 int-rep } } }
+    {
+        { T{ location f T{ spill-slot f 1 } tagged-rep int-regs } T{ location f 0 tagged-rep int-regs } }
+        { T{ location f 0 int-rep int-regs } T{ location f T{ spill-slot f 0 } int-rep int-regs } }
+    }
+    mapping-instructions
+] unit-test
+
+[
+    {
+        T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 1 } } }
+        T{ ##reload { dst 0 } { rep tagged-rep } { src T{ spill-slot f 0 } } }
+        T{ ##branch }
+    }
+] [
+    {
+        { T{ location f T{ spill-slot f 0 } tagged-rep int-regs } T{ location f 0 tagged-rep int-regs } }
+        { T{ location f 0 int-rep int-regs } T{ location f T{ spill-slot f 1 } int-rep int-regs } }
+    }
+    mapping-instructions
+] unit-test
+
+[
+    {
+        T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 1 } } }
+        T{ ##reload { dst 0 } { rep tagged-rep } { src T{ spill-slot f 0 } } }
+        T{ ##branch }
+    }
+] [
+    {
+        { T{ location f 0 int-rep int-regs } T{ location f T{ spill-slot f 1 } int-rep int-regs } }
+        { T{ location f T{ spill-slot f 0 } tagged-rep int-regs } T{ location f 0 tagged-rep int-regs } }
+    }
+    mapping-instructions
+] unit-test
+
+cfg new 8 >>spill-area-size cfg set
+H{ } clone spill-temps set
+
+[ t ] [
+    {
+        { T{ location f 0 int-rep int-regs } T{ location f 1 int-rep int-regs } }
+        { T{ location f 1 int-rep int-regs } T{ location f 0 int-rep int-regs } }
+    }
     mapping-instructions {
         {
-            T{ _spill { src 0 } { rep int-rep } { dst T{ spill-slot f 8 } } }
+            T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 8 } } }
             T{ ##copy { dst 0 } { src 1 } { rep int-rep } }
-            T{ _reload { dst 1 } { rep int-rep } { src T{ spill-slot f 8 } } }
+            T{ ##reload { dst 1 } { rep int-rep } { src T{ spill-slot f 8 } } }
+            T{ ##branch }
         }
         {
-            T{ _spill { src 1 } { rep int-rep } { dst T{ spill-slot f 8 } } }
+            T{ ##spill { src 1 } { rep int-rep } { dst T{ spill-slot f 8 } } }
             T{ ##copy { dst 1 } { src 0 } { rep int-rep } }
-            T{ _reload { dst 0 } { rep int-rep } { src T{ spill-slot f 8 } } }
+            T{ ##reload { dst 0 } { rep int-rep } { src T{ spill-slot f 8 } } }
+            T{ ##branch }
         }
     } member?
 ] unit-test
index 20c9ee4e99d257dc09f42bc2df3883d7d2fd2d2c..9d3c91ca18b0a4ab86177e1dedb7260a926c24b2 100644 (file)
@@ -1,8 +1,9 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs combinators
 combinators.short-circuit fry kernel locals namespaces
 make math sequences hashtables
+cpu.architecture
 compiler.cfg
 compiler.cfg.rpo
 compiler.cfg.liveness
@@ -11,42 +12,67 @@ compiler.cfg.utilities
 compiler.cfg.instructions
 compiler.cfg.predecessors
 compiler.cfg.parallel-copy
+compiler.cfg.ssa.destruction
 compiler.cfg.linear-scan.assignment
 compiler.cfg.linear-scan.allocation.state ;
 IN: compiler.cfg.linear-scan.resolve
 
+TUPLE: location
+{ reg read-only }
+{ rep read-only }
+{ reg-class read-only } ;
+
+: <location> ( reg rep -- location )
+    dup reg-class-of location boa ;
+
+M: location equal?
+    over location? [
+        { [ [ reg>> ] bi@ = ] [ [ reg-class>> ] bi@ = ] } 2&&
+    ] [ 2drop f ] if ;
+
+M: location hashcode*
+    reg>> hashcode* ;
+
 SYMBOL: spill-temps
 
 : spill-temp ( rep -- n )
-    spill-temps get [ next-spill-slot ] cache ;
+    rep-size spill-temps get [ next-spill-slot ] cache ;
 
 : add-mapping ( from to rep -- )
-    '[ _ 2array ] bi@ 2array , ;
+    '[ _ <location> ] bi@ 2array , ;
 
-:: resolve-value-data-flow ( bb to vreg -- )
-    vreg bb vreg-at-end
-    vreg to vreg-at-start
+:: resolve-value-data-flow ( vreg live-out live-in edge-live-in -- )
+    vreg live-out ?at [ bad-vreg ] unless
+    vreg live-in ?at [ edge-live-in ?at [ bad-vreg ] unless ] unless
     2dup = [ 2drop ] [ vreg rep-of add-mapping ] if ;
 
-: compute-mappings ( bb to -- mappings )
-    dup live-in dup assoc-empty? [ 3drop f ] [
-        [ keys [ resolve-value-data-flow ] with with each ] { } make
+:: compute-mappings ( bb to -- mappings )
+    bb machine-live-out :> live-out
+    to machine-live-in :> live-in
+    bb to machine-edge-live-in :> edge-live-in
+    live-out assoc-empty? [ f ] [
+        [
+            live-in keys edge-live-in keys append [
+                live-out live-in edge-live-in
+                resolve-value-data-flow
+            ] each
+        ] { } make
     ] if ;
 
 : memory->register ( from to -- )
-    swap [ first2 ] [ first ] bi* _reload ;
+    swap [ reg>> ] [ [ rep>> ] [ reg>> ] bi ] bi* ##reload ;
 
 : register->memory ( from to -- )
-    [ first2 ] [ first ] bi* _spill ;
+    [ [ reg>> ] [ rep>> ] bi ] [ reg>> ] bi* ##spill ;
 
 : temp->register ( from to -- )
-    nip [ first ] [ second ] [ second spill-temp ] tri _reload ;
+    nip [ reg>> ] [ rep>> ] [ rep>> spill-temp ] tri ##reload ;
 
 : register->temp ( from to -- )
-    drop [ first2 ] [ second spill-temp ] bi _spill ;
+    drop [ [ reg>> ] [ rep>> ] bi ] [ rep>> spill-temp ] bi ##spill ;
 
 : register->register ( from to -- )
-    swap [ first ] [ first2 ] bi* ##copy ;
+    swap [ reg>> ] [ [ reg>> ] [ rep>> ] bi ] bi* ##copy ;
 
 SYMBOL: temp
 
@@ -54,18 +80,18 @@ SYMBOL: temp
     {
         { [ over temp eq? ] [ temp->register ] }
         { [ dup temp eq? ] [ register->temp ] }
-        { [ over first spill-slot? ] [ memory->register ] }
-        { [ dup first spill-slot? ] [ register->memory ] }
+        { [ over reg>> spill-slot? ] [ memory->register ] }
+        { [ dup reg>> spill-slot? ] [ register->memory ] }
         [ register->register ]
     } cond ;
 
 : mapping-instructions ( alist -- insns )
     [ swap ] H{ } assoc-map-as
-    [ temp [ swap >insn ] parallel-mapping ] { } make ;
+    [ temp [ swap >insn ] parallel-mapping ##branch ] { } make ;
 
 : perform-mappings ( bb to mappings -- )
     dup empty? [ 3drop ] [
-        mapping-instructions insert-simple-basic-block
+        mapping-instructions insert-basic-block
         cfg get cfg-changed drop
     ] if ;
 
diff --git a/basis/compiler/cfg/linearization/linearization-tests.factor b/basis/compiler/cfg/linearization/linearization-tests.factor
new file mode 100644 (file)
index 0000000..edaeb72
--- /dev/null
@@ -0,0 +1,14 @@
+USING: compiler.cfg.debugger compiler.cfg compiler.cfg.linearization
+kernel accessors sequences sets tools.test namespaces ;
+IN: compiler.cfg.linearization.tests
+
+V{ } 0 test-bb
+
+V{ } 1 test-bb
+
+V{ } 2 test-bb
+
+0 { 1 1 } edges
+1 2 edge
+
+[ t ] [ cfg new 0 get >>entry linearization-order [ id>> ] map all-unique? ] unit-test
index 34ae7f8cc649b269f715749a1a99e0544a5788c2..c44b29d27122dcbfb7df9075a9faa7e42d176973 100644 (file)
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel math accessors sequences namespaces make
-combinators assocs arrays locals layouts hashtables
-cpu.architecture generalizations
-compiler.cfg
-compiler.cfg.comparisons
-compiler.cfg.stack-frame
-compiler.cfg.instructions
-compiler.cfg.utilities
-compiler.cfg.linearization.order ;
+USING: accessors arrays assocs deques dlists hashtables kernel
+make sorting namespaces sequences combinators
+combinators.short-circuit fry math compiler.cfg.rpo
+compiler.cfg.utilities compiler.cfg.loop-detection
+compiler.cfg.predecessors sets hash-sets ;
+FROM: namespaces => set ;
 IN: compiler.cfg.linearization
 
-<PRIVATE
-
-SYMBOL: numbers
-
-: block-number ( bb -- n ) numbers get at ;
-
-: number-blocks ( bbs -- ) [ 2array ] map-index >hashtable numbers set ;
-
-! Convert CFG IR to machine IR.
-GENERIC: linearize-insn ( basic-block insn -- )
-
-: linearize-basic-block ( bb -- )
-    [ block-number _label ]
-    [ dup instructions>> [ linearize-insn ] with each ]
-    bi ;
-
-M: insn linearize-insn , drop ;
-
-: useless-branch? ( basic-block successor -- ? )
-    ! If our successor immediately follows us in linearization
-    ! order then we don't need to branch.
-    [ block-number ] bi@ 1 - = ; inline
-
-: emit-branch ( bb successor -- )
-    2dup useless-branch? [ 2drop ] [ nip block-number _branch ] if ;
-
-M: ##branch linearize-insn
-    drop dup successors>> first emit-branch ;
-
-: successors ( bb -- first second ) successors>> first2 ; inline
-
-:: conditional ( bb insn n conditional-quot negate-cc-quot -- bb successor label ... )
-    bb insn
-    conditional-quot
-    [ drop dup successors>> second useless-branch? ] 2bi
-    [ [ swap block-number ] n ndip ]
-    [ [ block-number ] n ndip negate-cc-quot call ] if ; inline
+! This is RPO except loops are rotated and unlikely blocks go
+! at the end. Based on SBCL's src/compiler/control.lisp
 
-: (binary-conditional) ( bb insn -- bb successor1 successor2 src1 src2 cc )
-    [ dup successors ]
-    [ [ src1>> ] [ src2>> ] [ cc>> ] tri ] bi* ; inline
-
-: binary-conditional ( bb insn -- bb successor label2 src1 src2 cc )
-    3 [ (binary-conditional) ] [ negate-cc ] conditional ;
-
-: (test-vector-conditional) ( bb insn -- bb successor1 successor2 src1 temp rep vcc )
-    [ dup successors ]
-    [ { [ src1>> ] [ temp>> ] [ rep>> ] [ vcc>> ] } cleave ] bi* ; inline
-
-: test-vector-conditional ( bb insn -- bb successor label src1 temp rep vcc )
-    4 [ (test-vector-conditional) ] [ negate-vcc ] conditional ;
-
-M: ##compare-branch linearize-insn
-    binary-conditional _compare-branch emit-branch ;
-
-M: ##compare-imm-branch linearize-insn
-    binary-conditional _compare-imm-branch emit-branch ;
-
-M: ##compare-float-ordered-branch linearize-insn
-    binary-conditional _compare-float-ordered-branch emit-branch ;
-
-M: ##compare-float-unordered-branch linearize-insn
-    binary-conditional _compare-float-unordered-branch emit-branch ;
-
-M: ##test-vector-branch linearize-insn
-    test-vector-conditional _test-vector-branch emit-branch ;
+<PRIVATE
 
-: overflow-conditional ( bb insn -- bb successor label2 dst src1 src2 )
-    [ dup successors block-number ]
-    [ [ dst>> ] [ src1>> ] [ src2>> ] tri ] bi* ; inline
+SYMBOLS: work-list loop-heads visited ;
+
+: visited? ( bb -- ? ) visited get in? ;
+
+: add-to-work-list ( bb -- )
+    dup visited? [ drop ] [
+        work-list get push-back
+    ] if ;
+
+: init-linearization-order ( cfg -- )
+    <dlist> work-list set
+    HS{ } clone visited set
+    entry>> add-to-work-list ;
+
+: (find-alternate-loop-head) ( bb -- bb' )
+    dup {
+        [ predecessor visited? not ]
+        [ predecessors>> length 1 = ]
+        [ predecessor successors>> length 1 = ]
+        [ [ number>> ] [ predecessor number>> ] bi > ]
+    } 1&& [ predecessor (find-alternate-loop-head) ] when ;
+
+: find-back-edge ( bb -- pred )
+    [ predecessors>> ] keep '[ _ back-edge? ] find nip ;
+
+: find-alternate-loop-head ( bb -- bb' )
+    dup find-back-edge dup visited? [ drop ] [
+        nip (find-alternate-loop-head)
+    ] if ;
+
+: predecessors-ready? ( bb -- ? )
+    [ predecessors>> ] keep '[
+        _ 2dup back-edge?
+        [ 2drop t ] [ drop visited? ] if
+    ] all? ;
+
+: process-successor ( bb -- )
+    dup predecessors-ready? [
+        dup loop-entry? [ find-alternate-loop-head ] when
+        add-to-work-list
+    ] [ drop ] if ;
+
+: sorted-successors ( bb -- seq )
+    successors>> <reversed> [ loop-nesting-at ] sort-with ;
+
+: process-block ( bb -- )
+    dup visited? [ drop ] [
+        [ , ]
+        [ visited get adjoin ]
+        [ sorted-successors [ process-successor ] each ]
+        tri
+    ] if ;
+
+: (linearization-order) ( cfg -- bbs )
+    init-linearization-order
+
+    [ work-list get [ process-block ] slurp-deque ] { } make
+    ! [ unlikely?>> not ] partition append
+    ;
 
-M: ##fixnum-add linearize-insn
-    overflow-conditional _fixnum-add emit-branch ;
+PRIVATE>
 
-M: ##fixnum-sub linearize-insn
-    overflow-conditional _fixnum-sub emit-branch ;
+: linearization-order ( cfg -- bbs )
+    needs-post-order needs-loops needs-predecessors
 
-M: ##fixnum-mul linearize-insn
-    overflow-conditional _fixnum-mul emit-branch ;
+    dup linear-order>> [ ] [
+        dup (linearization-order)
+        >>linear-order linear-order>>
+    ] ?if ;
 
-M: ##dispatch linearize-insn
-    swap
-    [ [ src>> ] [ temp>> ] bi _dispatch ]
-    [ successors>> [ block-number _dispatch-label ] each ]
-    bi* ;
+SYMBOL: numbers
 
-: linearize-basic-blocks ( cfg -- insns )
-    [
-        [
-            linearization-order
-            [ number-blocks ]
-            [ [ linearize-basic-block ] each ] bi
-        ] [ spill-area-size>> _spill-area-size ] bi
-    ] { } make ;
+: block-number ( bb -- n ) numbers get at ;
 
-PRIVATE>
-        
-: flatten-cfg ( cfg -- mr )
-    [ linearize-basic-blocks ] [ word>> ] [ label>> ] tri
-    <mr> ;
+: number-blocks ( bbs -- )
+    [ 2array ] map-index >hashtable numbers set ;
diff --git a/basis/compiler/cfg/linearization/order/order-tests.factor b/basis/compiler/cfg/linearization/order/order-tests.factor
deleted file mode 100644 (file)
index 67fb55f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-USING: compiler.cfg.debugger compiler.cfg compiler.cfg.linearization.order
-kernel accessors sequences sets tools.test namespaces ;
-IN: compiler.cfg.linearization.order.tests
-
-V{ } 0 test-bb
-
-V{ } 1 test-bb
-
-V{ } 2 test-bb
-
-0 { 1 1 } edges
-1 2 edge
-
-[ t ] [ cfg new 0 get >>entry linearization-order [ id>> ] map all-unique? ] unit-test
diff --git a/basis/compiler/cfg/linearization/order/order.factor b/basis/compiler/cfg/linearization/order/order.factor
deleted file mode 100644 (file)
index 1fcc137..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-! Copyright (C) 2009 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs deques dlists kernel make sorting
-namespaces sequences combinators combinators.short-circuit
-fry math sets compiler.cfg.rpo compiler.cfg.utilities
-compiler.cfg.loop-detection compiler.cfg.predecessors ;
-IN: compiler.cfg.linearization.order
-
-! This is RPO except loops are rotated. Based on SBCL's src/compiler/control.lisp
-
-<PRIVATE
-
-SYMBOLS: work-list loop-heads visited ;
-
-: visited? ( bb -- ? ) visited get key? ;
-
-: add-to-work-list ( bb -- )
-    dup visited get key? [ drop ] [
-        work-list get push-back
-    ] if ;
-
-: init-linearization-order ( cfg -- )
-    <dlist> work-list set
-    H{ } clone visited set
-    entry>> add-to-work-list ;
-
-: (find-alternate-loop-head) ( bb -- bb' )
-    dup {
-        [ predecessor visited? not ]
-        [ predecessors>> length 1 = ]
-        [ predecessor successors>> length 1 = ]
-        [ [ number>> ] [ predecessor number>> ] bi > ]
-    } 1&& [ predecessor (find-alternate-loop-head) ] when ;
-
-: find-back-edge ( bb -- pred )
-    [ predecessors>> ] keep '[ _ back-edge? ] find nip ;
-
-: find-alternate-loop-head ( bb -- bb' )
-    dup find-back-edge dup visited? [ drop ] [
-        nip (find-alternate-loop-head)
-    ] if ;
-
-: predecessors-ready? ( bb -- ? )
-    [ predecessors>> ] keep '[
-        _ 2dup back-edge?
-        [ 2drop t ] [ drop visited? ] if
-    ] all? ;
-
-: process-successor ( bb -- )
-    dup predecessors-ready? [
-        dup loop-entry? [ find-alternate-loop-head ] when
-        add-to-work-list
-    ] [ drop ] if ;
-
-: sorted-successors ( bb -- seq )
-    successors>> <reversed> [ loop-nesting-at ] sort-with ;
-
-: process-block ( bb -- )
-    dup visited? [ drop ] [
-        [ , ]
-        [ visited get conjoin ]
-        [ sorted-successors [ process-successor ] each ]
-        tri
-    ] if ;
-
-: (linearization-order) ( cfg -- bbs )
-    init-linearization-order
-
-    [ work-list get [ process-block ] slurp-deque ] { } make ;
-
-PRIVATE>
-
-: linearization-order ( cfg -- bbs )
-    needs-post-order needs-loops needs-predecessors
-
-    dup linear-order>> [ ] [
-        dup (linearization-order)
-        >>linear-order linear-order>>
-    ] ?if ;
\ No newline at end of file
diff --git a/basis/compiler/cfg/linearization/summary.txt b/basis/compiler/cfg/linearization/summary.txt
deleted file mode 100644 (file)
index 96daec8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Flattening CFG into MR (machine representation)
diff --git a/basis/compiler/cfg/liveness/ssa/ssa-tests.factor b/basis/compiler/cfg/liveness/ssa/ssa-tests.factor
new file mode 100644 (file)
index 0000000..5413c65
--- /dev/null
@@ -0,0 +1,61 @@
+USING: accessors compiler.cfg compiler.cfg.debugger
+compiler.cfg.instructions compiler.cfg.liveness.ssa
+compiler.cfg.liveness arrays sequences assocs
+compiler.cfg.registers kernel namespaces tools.test ;
+IN: compiler.cfg.liveness.ssa.tests
+
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##load-integer f 0 0 }
+    T{ ##branch }
+} 2 test-bb
+
+V{
+    T{ ##load-integer f 1 1 }
+    T{ ##branch }
+} 3 test-bb
+
+V{
+    T{ ##phi f 2 H{ { 2 0 } { 3 1 } } }
+    T{ ##branch }
+} 4 test-bb
+
+V{
+    T{ ##branch }
+} 5 test-bb
+
+V{
+    T{ ##replace f 2 D 0 }
+    T{ ##branch }
+} 6 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 7 test-bb
+
+0 1 edge
+1 { 2 3 } edges
+2 4 edge
+3 4 edge
+4 { 5 6 } edges
+5 6 edge
+6 7 edge
+
+[ ] [ cfg new 0 get >>entry dup cfg set compute-ssa-live-sets ] unit-test
+
+[ t ] [ 0 get live-in assoc-empty? ] unit-test
+
+[ H{ { 2 2 } } ] [ 4 get live-out ] unit-test
+
+[ H{ { 0 0 } } ] [ 2 get 4 get edge-live-in ] unit-test
+
+[ H{ { 1 1 } } ] [ 3 get 4 get edge-live-in ] unit-test
index 81263c8e9ac3ddcaef1863fc1f8ff6ca15c5b7f7..84428514aa19ae4c46c8f2ebf5d378790bdfe46c 100644 (file)
@@ -1,18 +1,19 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel namespaces deques accessors sets sequences assocs fry
 hashtables dlists compiler.cfg.def-use compiler.cfg.instructions
 compiler.cfg.rpo compiler.cfg.liveness compiler.cfg.utilities
 compiler.cfg.predecessors ;
+FROM: namespaces => set ;
 IN: compiler.cfg.liveness.ssa
 
 ! TODO: merge with compiler.cfg.liveness
 
 ! Assoc mapping basic blocks to sequences of sets of vregs; each sequence
 ! is in correspondence with a predecessor
-SYMBOL: phi-live-ins
+SYMBOL: edge-live-ins
 
-: phi-live-in ( predecessor basic-block -- set ) phi-live-ins get at at ;
+: edge-live-in ( predecessor basic-block -- set ) edge-live-ins get at at ;
 
 SYMBOL: work-list
 
@@ -22,19 +23,19 @@ SYMBOL: work-list
 : compute-live-in ( basic-block -- live-in )
     [ live-out ] keep instructions>> transfer-liveness ;
 
-: compute-phi-live-in ( basic-block -- phi-live-in )
+: compute-edge-live-in ( basic-block -- edge-live-in )
     H{ } clone [
         '[ inputs>> [ swap _ conjoin-at ] assoc-each ] each-phi
     ] keep ;
 
 : update-live-in ( basic-block -- changed? )
     [ [ compute-live-in ] keep live-ins get maybe-set-at ]
-    [ [ compute-phi-live-in ] keep phi-live-ins get maybe-set-at ]
+    [ [ compute-edge-live-in ] keep edge-live-ins get maybe-set-at ]
     bi or ;
 
 : compute-live-out ( basic-block -- live-out )
     [ successors>> [ live-in ] map ]
-    [ dup successors>> [ phi-live-in ] with map ] bi
+    [ dup successors>> [ edge-live-in ] with map ] bi
     append assoc-combine ;
 
 : update-live-out ( basic-block -- changed? )
@@ -47,16 +48,16 @@ SYMBOL: work-list
         [ predecessors>> add-to-work-list ] [ drop ] if
     ] [ drop ] if ;
 
-: compute-ssa-live-sets ( cfg -- cfg' )
+: compute-ssa-live-sets ( cfg -- )
     needs-predecessors
 
     <hashed-dlist> work-list set
     H{ } clone live-ins set
-    H{ } clone phi-live-ins set
+    H{ } clone edge-live-ins set
     H{ } clone live-outs set
-    dup post-order add-to-work-list
+    post-order add-to-work-list
     work-list get [ liveness-step ] slurp-deque ;
 
 : live-in? ( vreg bb -- ? ) live-in key? ;
 
-: live-out? ( vreg bb -- ? ) live-out key? ;
\ No newline at end of file
+: live-out? ( vreg bb -- ? ) live-out key? ;
index 73b99ee132144643ffe3b203b867625d9e18d36d..d8fc92aaa63ffe1f6c03f27f261f8648fba038bb 100644 (file)
@@ -2,6 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs combinators deques dlists fry kernel
 namespaces sequences sets compiler.cfg compiler.cfg.predecessors ;
+FROM: namespaces => set ;
 IN: compiler.cfg.loop-detection
 
 TUPLE: natural-loop header index ends blocks ;
@@ -78,6 +79,8 @@ PRIVATE>
 
 : loop-nesting-at ( bb -- n ) loop-nesting get at 0 or ;
 
+: current-loop-nesting ( -- n ) basic-block get loop-nesting-at ;
+
 : needs-loops ( cfg -- cfg' )
     needs-predecessors
     dup loops-valid?>> [ detect-loops t >>loops-valid? ] unless ;
diff --git a/basis/compiler/cfg/mr/authors.txt b/basis/compiler/cfg/mr/authors.txt
deleted file mode 100644 (file)
index d4f5d6b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Slava Pestov
\ No newline at end of file
diff --git a/basis/compiler/cfg/mr/mr.factor b/basis/compiler/cfg/mr/mr.factor
deleted file mode 100644 (file)
index a46e6c1..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-! Copyright (C) 2009 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel namespaces accessors compiler.cfg
-compiler.cfg.linearization compiler.cfg.gc-checks
-compiler.cfg.save-contexts compiler.cfg.linear-scan
-compiler.cfg.build-stack-frame ;
-IN: compiler.cfg.mr
-
-: build-mr ( cfg -- mr )
-    insert-gc-checks
-    insert-save-contexts
-    linear-scan
-    flatten-cfg
-    build-stack-frame ;
\ No newline at end of file
index 84726a9b99de44d52f876780a53975ff3ac3945e..5881cd78ea32280068d418b9bcc726d9882e050a 100644 (file)
@@ -1,41 +1,27 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences accessors combinators namespaces
-compiler.cfg.tco
+USING: compiler.cfg.tco
 compiler.cfg.useless-conditionals
 compiler.cfg.branch-splitting
 compiler.cfg.block-joining
+compiler.cfg.height
 compiler.cfg.ssa.construction
 compiler.cfg.alias-analysis
 compiler.cfg.value-numbering
 compiler.cfg.copy-prop
 compiler.cfg.dce
-compiler.cfg.write-barrier
-compiler.cfg.representations
-compiler.cfg.ssa.destruction
-compiler.cfg.empty-blocks
-compiler.cfg.checker ;
+compiler.cfg.write-barrier ;
 IN: compiler.cfg.optimizer
 
-SYMBOL: check-optimizer?
-
-: ?check ( cfg -- cfg' )
-    check-optimizer? get [
-        dup check-cfg
-    ] when ;
-
 : optimize-cfg ( cfg -- cfg' )
     optimize-tail-calls
     delete-useless-conditionals
     split-branches
     join-blocks
+    normalize-height
     construct-ssa
     alias-analysis
     value-numbering
     copy-propagation
     eliminate-dead-code
-    eliminate-write-barriers
-    select-representations
-    destruct-ssa
-    delete-empty-blocks
-    ?check ;
+    eliminate-write-barriers ;
index 2f4f2a99e69be5735c423c0b1b048fd672b48e5a..9c7896be7e9f5cbb351300e9bac48633457ab04b 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors namespaces kernel parser assocs sequences ;
+USING: accessors namespaces kernel math parser assocs sequences ;
 IN: compiler.cfg.registers
 
 ! Virtual registers, used by CFG and machine IRs, are just integers
@@ -34,7 +34,7 @@ ERROR: bad-vreg vreg ;
 
 ! ##inc-d and ##inc-r affect locations as follows. Location D 0 before
 ! an ##inc-d 1 becomes D 1 after ##inc-d 1.
-TUPLE: loc { n read-only } ;
+TUPLE: loc { n integer read-only } ;
 
 TUPLE: ds-loc < loc ;
 C: <ds-loc> ds-loc
diff --git a/basis/compiler/cfg/representations/coalescing/authors.txt b/basis/compiler/cfg/representations/coalescing/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/representations/coalescing/coalescing-tests.factor b/basis/compiler/cfg/representations/coalescing/coalescing-tests.factor
new file mode 100644 (file)
index 0000000..cc1bde3
--- /dev/null
@@ -0,0 +1,40 @@
+USING: arrays sequences kernel namespaces accessors compiler.cfg
+compiler.cfg.instructions
+compiler.cfg.registers
+compiler.cfg.debugger
+compiler.cfg.representations.coalescing
+tools.test ;
+IN: compiler.cfg.representations.coalescing.tests
+
+: test-scc ( -- )
+    cfg new 0 get >>entry compute-components ;
+
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##peek f 2 D 0 }
+    T{ ##load-integer f 0 0 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##load-integer f 1 0 }
+    T{ ##branch }
+} 2 test-bb
+
+V{
+    T{ ##phi f 3 H{ { 1 0 } { 2 1 } } }
+} 3 test-bb
+
+0 { 1 2 } edges
+1 3 edge
+2 3 edge
+
+[ ] [ test-scc ] unit-test
+
+[ t ] [ 0 vreg>scc 1 vreg>scc = ] unit-test
+[ t ] [ 0 vreg>scc 3 vreg>scc = ] unit-test
+[ f ] [ 2 vreg>scc 3 vreg>scc = ] unit-test
diff --git a/basis/compiler/cfg/representations/coalescing/coalescing.factor b/basis/compiler/cfg/representations/coalescing/coalescing.factor
new file mode 100644 (file)
index 0000000..2061064
--- /dev/null
@@ -0,0 +1,43 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors assocs compiler.cfg.def-use
+compiler.cfg.instructions compiler.cfg.rpo disjoint-sets fry
+kernel namespaces sequences ;
+IN: compiler.cfg.representations.coalescing
+
+! Find all strongly connected components in the graph where the
+! edges are ##phi or ##copy vreg uses
+SYMBOL: components
+
+: init-components ( cfg components -- )
+    '[
+        instructions>> [
+            defs-vreg [ _ add-atom ] when*
+        ] each
+    ] each-basic-block ;
+
+GENERIC# visit-insn 1 ( insn disjoint-set -- )
+
+M: ##copy visit-insn
+    [ [ dst>> ] [ src>> ] bi ] dip equate ;
+
+M: ##phi visit-insn
+    [ [ inputs>> values ] [ dst>> ] bi ] dip equate-all-with ;
+
+M: insn visit-insn 2drop ;
+
+: merge-components ( cfg components -- )
+    '[
+        instructions>> [
+            _ visit-insn
+        ] each
+    ] each-basic-block ;
+
+: compute-components ( cfg -- )
+    <disjoint-set>
+    [ init-components ]
+    [ merge-components ]
+    [ components set drop ] 2tri ;
+
+: vreg>scc ( vreg -- scc )
+    components get representative ;
diff --git a/basis/compiler/cfg/representations/conversion/authors.txt b/basis/compiler/cfg/representations/conversion/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/representations/conversion/conversion.factor b/basis/compiler/cfg/representations/conversion/conversion.factor
new file mode 100644 (file)
index 0000000..b8346fe
--- /dev/null
@@ -0,0 +1,84 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays byte-arrays combinators compiler.cfg.instructions
+compiler.cfg.registers compiler.constants cpu.architecture
+kernel layouts locals math namespaces ;
+IN: compiler.cfg.representations.conversion
+
+ERROR: bad-conversion dst src dst-rep src-rep ;
+
+GENERIC: rep>tagged ( dst src rep -- )
+GENERIC: tagged>rep ( dst src rep -- )
+
+M: int-rep rep>tagged ( dst src rep -- )
+    drop tag-bits get ##shl-imm ;
+
+M: int-rep tagged>rep ( dst src rep -- )
+    drop tag-bits get ##sar-imm ;
+
+M:: float-rep rep>tagged ( dst src rep -- )
+    double-rep next-vreg-rep :> temp
+    temp src ##single>double-float
+    dst temp double-rep rep>tagged ;
+
+M:: float-rep tagged>rep ( dst src rep -- )
+    double-rep next-vreg-rep :> temp
+    temp src double-rep tagged>rep
+    dst temp ##double>single-float ;
+
+M:: double-rep rep>tagged ( dst src rep -- )
+    dst 16 float int-rep next-vreg-rep ##allot
+    src dst float-offset double-rep f ##store-memory-imm ;
+
+M: double-rep tagged>rep
+    drop float-offset double-rep f ##load-memory-imm ;
+
+M:: vector-rep rep>tagged ( dst src rep -- )
+    tagged-rep next-vreg-rep :> temp
+    dst 16 2 cells + byte-array int-rep next-vreg-rep ##allot
+    temp 16 tag-fixnum ##load-tagged
+    temp dst 1 byte-array type-number ##set-slot-imm
+    src dst byte-array-offset rep f ##store-memory-imm ;
+
+M: vector-rep tagged>rep
+    [ byte-array-offset ] dip f ##load-memory-imm ;
+
+M:: scalar-rep rep>tagged ( dst src rep -- )
+    tagged-rep next-vreg-rep :> temp
+    temp src rep ##scalar>integer
+    dst temp int-rep rep>tagged ;
+
+M:: scalar-rep tagged>rep ( dst src rep -- )
+    tagged-rep next-vreg-rep :> temp
+    temp src int-rep tagged>rep
+    dst temp rep ##integer>scalar ;
+
+GENERIC: rep>int ( dst src rep -- )
+GENERIC: int>rep ( dst src rep -- )
+
+M: scalar-rep rep>int ( dst src rep -- )
+    ##scalar>integer ;
+
+M: scalar-rep int>rep ( dst src rep -- )
+    ##integer>scalar ;
+
+: emit-conversion ( dst src dst-rep src-rep -- )
+    {
+        { [ 2dup eq? ] [ drop ##copy ] }
+        { [ dup tagged-rep? ] [ drop tagged>rep ] }
+        { [ over tagged-rep? ] [ nip rep>tagged ] }
+        { [ dup int-rep? ] [ drop int>rep ] }
+        { [ over int-rep? ] [ nip rep>int ] }
+        [
+            2dup 2array {
+                { { double-rep float-rep } [ 2drop ##single>double-float ] }
+                { { float-rep double-rep } [ 2drop ##double>single-float ] }
+                ! Punning SIMD vector types? Naughty naughty! But
+                ! it is allowed... otherwise bail out.
+                [
+                    drop 2dup [ reg-class-of ] bi@ eq?
+                    [ drop ##copy ] [ bad-conversion ] if
+                ]
+            } case
+        ]
+    } cond ;
diff --git a/basis/compiler/cfg/representations/peephole/authors.txt b/basis/compiler/cfg/representations/peephole/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/representations/peephole/peephole.factor b/basis/compiler/cfg/representations/peephole/peephole.factor
new file mode 100644 (file)
index 0000000..d862599
--- /dev/null
@@ -0,0 +1,289 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors byte-arrays combinators
+combinators.short-circuit kernel layouts locals make math
+namespaces sequences cpu.architecture compiler.cfg.registers
+compiler.cfg.instructions
+compiler.cfg.representations.rewrite
+compiler.cfg.representations.selection ;
+IN: compiler.cfg.representations.peephole
+
+! Representation selection performs some peephole optimizations
+! when inserting conversions to optimize for a few common cases
+
+GENERIC: optimize-insn ( insn -- )
+
+SYMBOL: insn-index
+
+: here ( -- )
+    building get length 1 - insn-index set ;
+
+: finish ( insn -- ) , here ;
+
+: unchanged ( insn -- )
+    [ no-use-conversion ] [ finish ] [ no-def-conversion ] tri ;
+
+: last-insn ( -- insn ) insn-index get building get nth ;
+
+M: vreg-insn conversions-for-insn
+    init-renaming-set
+    optimize-insn
+    last-insn perform-renaming ;
+
+M: vreg-insn optimize-insn
+    [ emit-use-conversion ] [ finish ] [ emit-def-conversion ] tri ;
+
+M: ##load-integer optimize-insn
+    {
+        {
+            [ dup dst>> rep-of tagged-rep? ]
+            [ [ dst>> ] [ val>> tag-fixnum ] bi ##load-tagged here ]
+        }
+        [ call-next-method ]
+    } cond ;
+
+! When a constant float is unboxed, we replace the
+! ##load-reference with a ##load-float or ##load-double if the
+! architecture supports it
+: convert-to-load-float? ( insn -- ? )
+    {
+        [ drop fused-unboxing? ]
+        [ dst>> rep-of float-rep? ]
+        [ obj>> float? ]
+    } 1&& ;
+
+: convert-to-load-double? ( insn -- ? )
+    {
+        [ drop fused-unboxing? ]
+        [ dst>> rep-of double-rep? ]
+        [ obj>> float? ]
+    } 1&& ;
+
+: convert-to-load-vector? ( insn -- ? )
+    {
+        [ drop fused-unboxing? ]
+        [ dst>> rep-of vector-rep? ]
+        [ obj>> byte-array? ]
+    } 1&& ;
+
+! When a literal zeroes/ones vector is unboxed, we replace the ##load-reference
+! with a ##zero-vector or ##fill-vector instruction since this is more efficient.
+: convert-to-zero-vector? ( insn -- ? )
+    {
+        [ dst>> rep-of vector-rep? ]
+        [ obj>> B{ 0 0 0 0  0 0 0 0  0 0 0 0  0 0 0 0 } = ]
+    } 1&& ;
+
+: convert-to-fill-vector? ( insn -- ? )
+    {
+        [ dst>> rep-of vector-rep? ]
+        [ obj>> B{ 255 255 255 255  255 255 255 255  255 255 255 255  255 255 255 255 } = ]
+    } 1&& ;
+
+M: ##load-reference optimize-insn
+    {
+        {
+            [ dup convert-to-load-float? ]
+            [ [ dst>> ] [ obj>> ] bi ##load-float here ]
+        }
+        {
+            [ dup convert-to-load-double? ]
+            [ [ dst>> ] [ obj>> ] bi ##load-double here ]
+        }
+        {
+            [ dup convert-to-zero-vector? ]
+            [ dst>> dup rep-of ##zero-vector here ]
+        }
+        {
+            [ dup convert-to-fill-vector? ]
+            [ dst>> dup rep-of ##fill-vector here ]
+        }
+        {
+            [ dup convert-to-load-vector? ]
+            [ [ dst>> ] [ obj>> ] [ dst>> rep-of ] tri ##load-vector here ]
+        }
+        [ call-next-method ]
+    } cond ;
+
+! Optimize this:
+! ##sar-imm temp src tag-bits
+! ##shl-imm dst temp X
+! Into either
+! ##shl-imm by X - tag-bits, or
+! ##sar-imm by tag-bits - X.
+: combine-shl-imm-input ( insn -- )
+    [ dst>> ] [ src1>> ] [ src2>> ] tri tag-bits get {
+        { [ 2dup < ] [ swap - ##sar-imm here ] }
+        { [ 2dup > ] [ - ##shl-imm here ] }
+        [ 2drop int-rep ##copy here ]
+    } cond ;
+
+: dst-tagged? ( insn -- ? ) dst>> rep-of tagged-rep? ;
+: src1-tagged? ( insn -- ? ) src1>> rep-of tagged-rep? ;
+: src2-tagged? ( insn -- ? ) src2>> rep-of tagged-rep? ;
+
+: src2-tagged-arithmetic? ( insn -- ? ) src2>> tag-fixnum immediate-arithmetic? ;
+: src2-tagged-bitwise? ( insn -- ? ) src2>> tag-fixnum immediate-bitwise? ;
+: src2-tagged-shift-count? ( insn -- ? ) src2>> tag-bits get + immediate-shift-count? ;
+
+: >tagged-shift ( insn -- ) [ tag-bits get + ] change-src2 finish ; inline
+
+M: ##shl-imm optimize-insn
+    {
+        {
+            [ dup { [ dst-tagged? ] [ src1-tagged? ] } 1&& ]
+            [ unchanged ]
+        }
+        {
+            [ dup { [ dst-tagged? ] [ src2-tagged-shift-count? ] } 1&& ]
+            [ [ emit-use-conversion ] [ >tagged-shift ] [ no-def-conversion ] tri ]
+        }
+        {
+            [ dup src1-tagged? ]
+            [ [ no-use-conversion ] [ combine-shl-imm-input ] [ emit-def-conversion ] tri ]
+        }
+        [ call-next-method ]
+    } cond ;
+
+! Optimize this:
+! ##sar-imm temp src tag-bits
+! ##sar-imm dst temp X
+! Into
+! ##sar-imm by X + tag-bits
+! assuming X + tag-bits is a valid shift count.
+M: ##sar-imm optimize-insn
+    {
+        {
+            [ dup { [ src1-tagged? ] [ src2-tagged-shift-count? ] } 1&& ]
+            [ [ no-use-conversion ] [ >tagged-shift ] [ emit-def-conversion ] tri ]
+        }
+        [ call-next-method ]
+    } cond ;
+
+! Peephole optimization: for X = add, sub, and, or, xor, min, max
+! we have
+! tag(untag(a) X untag(b)) = a X b
+!
+! so if all inputs and outputs of ##X or ##X-imm are tagged,
+! don't have to insert any conversions
+M: inert-tag-untag-insn optimize-insn
+    {
+        {
+            [ dup { [ dst-tagged? ] [ src1-tagged? ] [ src2-tagged? ] } 1&& ]
+            [ unchanged ]
+        }
+        [ call-next-method ]
+    } cond ;
+
+! -imm variant of above
+: >tagged-imm ( insn -- )
+    [ tag-fixnum ] change-src2 unchanged ; inline
+
+M: inert-arithmetic-tag-untag-insn optimize-insn
+    {
+        {
+            [ dup { [ dst-tagged? ] [ src1-tagged? ] [ src2-tagged-arithmetic? ] } 1&& ]
+            [ >tagged-imm ]
+        }
+        [ call-next-method ]
+    } cond ;
+
+M: inert-bitwise-tag-untag-insn optimize-insn
+    {
+        {
+            [ dup { [ dst-tagged? ] [ src1-tagged? ] [ src2-tagged-bitwise? ] } 1&& ]
+            [ >tagged-imm ]
+        }
+        [ call-next-method ]
+    } cond ;
+
+M: ##mul-imm optimize-insn
+    {
+        { [ dup { [ dst-tagged? ] [ src1-tagged? ] } 1&& ] [ unchanged ] }
+        { [ dup { [ dst-tagged? ] [ src2-tagged-arithmetic? ] } 1&& ] [ >tagged-imm ] }
+        [ call-next-method ]
+    } cond ;
+
+! Similar optimization for comparison operators
+M: ##compare-integer-imm optimize-insn
+    {
+        { [ dup { [ src1-tagged? ] [ src2-tagged-arithmetic? ] } 1&& ] [ >tagged-imm ] }
+        [ call-next-method ]
+    } cond ;
+
+M: ##test-imm optimize-insn
+    {
+        { [ dup { [ src1-tagged? ] [ src2-tagged-bitwise? ] } 1&& ] [ >tagged-imm ] }
+        [ call-next-method ]
+    } cond ;
+
+M: ##compare-integer-imm-branch optimize-insn
+    {
+        { [ dup { [ src1-tagged? ] [ src2-tagged-arithmetic? ] } 1&& ] [ >tagged-imm ] }
+        [ call-next-method ]
+    } cond ;
+
+M: ##test-imm-branch optimize-insn
+    {
+        { [ dup { [ src1-tagged? ] [ src2-tagged-bitwise? ] } 1&& ] [ >tagged-imm ] }
+        [ call-next-method ]
+    } cond ;
+
+M: ##compare-integer optimize-insn
+    {
+        { [ dup { [ src1-tagged? ] [ src2-tagged? ] } 1&& ] [ unchanged ] }
+        [ call-next-method ]
+    } cond ;
+
+M: ##test optimize-insn
+    {
+        { [ dup { [ src1-tagged? ] [ src2-tagged? ] } 1&& ] [ unchanged ] }
+        [ call-next-method ]
+    } cond ;
+
+M: ##compare-integer-branch optimize-insn
+    {
+        { [ dup { [ src1-tagged? ] [ src2-tagged? ] } 1&& ] [ unchanged ] }
+        [ call-next-method ]
+    } cond ;
+
+M: ##test-branch optimize-insn
+    {
+        { [ dup { [ src1-tagged? ] [ src2-tagged? ] } 1&& ] [ unchanged ] }
+        [ call-next-method ]
+    } cond ;
+
+! Identities:
+! tag(neg(untag(x))) = x
+! tag(neg(x)) = x * -2^tag-bits
+: inert-tag/untag-unary? ( insn -- ? )
+    [ dst>> ] [ src>> ] bi [ rep-of tagged-rep? ] both? ;
+
+: combine-neg-tag ( insn -- )
+    [ dst>> ] [ src>> ] bi tag-bits get 2^ neg ##mul-imm here ;
+
+M: ##neg optimize-insn
+    {
+        { [ dup inert-tag/untag-unary? ] [ unchanged ] }
+        {
+            [ dup dst>> rep-of tagged-rep? ]
+            [ [ emit-use-conversion ] [ combine-neg-tag ] [ no-def-conversion ] tri ]
+        }
+        [ call-next-method ]
+    } cond ;
+
+! Identity:
+! tag(not(untag(x))) = not(x) xor tag-mask
+:: emit-tagged-not ( insn -- )
+    tagged-rep next-vreg-rep :> temp
+    temp insn src>> ##not
+    insn dst>> temp tag-mask get ##xor-imm here ;
+
+M: ##not optimize-insn
+    {
+        {
+            [ dup inert-tag/untag-unary? ]
+            [ [ no-use-conversion ] [ emit-tagged-not ] [ no-def-conversion ] tri ]
+        }
+        [ call-next-method ]
+    } cond ;
index 726521cfe1922b4fbfda67de04f296f05f8b319e..8ca91c4389069cd5453beb49cdcfc1782efd7ced 100644 (file)
@@ -1,10 +1,12 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel accessors sequences arrays fry namespaces generic
-words sets combinators generalizations cpu.architecture compiler.units
-compiler.cfg.utilities compiler.cfg compiler.cfg.rpo
-compiler.cfg.instructions compiler.cfg.def-use ;
+words sets combinators generalizations sequences.generalizations
+cpu.architecture compiler.units compiler.cfg.utilities
+compiler.cfg compiler.cfg.rpo compiler.cfg.instructions
+compiler.cfg.def-use ;
 FROM: compiler.cfg.instructions.syntax => insn-def-slot insn-use-slots insn-temp-slots scalar-rep ;
+FROM: namespaces => set ;
 IN: compiler.cfg.representations.preferred
 
 GENERIC: defs-vreg-rep ( insn -- rep/f )
@@ -76,14 +78,14 @@ PRIVATE>
 : each-temp-rep ( insn vreg-quot: ( vreg rep -- ) -- )
     [ [ temp-vregs ] [ temp-vreg-reps ] bi ] dip 2each ; inline
 
+: each-rep ( insn vreg-quot: ( vreg rep -- ) -- )
+    [ each-def-rep ] [ each-use-rep ] [ each-temp-rep ] 2tri ; inline
+
 : with-vreg-reps ( cfg vreg-quot: ( vreg rep -- ) -- )
     '[
         [ basic-block set ] [
             [
-                _
-                [ each-def-rep ]
-                [ each-use-rep ]
-                [ each-temp-rep ] 2tri
+                _ each-rep
             ] each-non-phi
         ] bi
     ] each-basic-block ; inline
index c50cfc4c86d4678798af618b6e49c52931a12cdc..9955814ed9eaa95f4c07b1dcfc22522038c6a016 100644 (file)
@@ -1,6 +1,11 @@
-USING: tools.test cpu.architecture
-compiler.cfg.registers compiler.cfg.instructions
-compiler.cfg.representations.preferred ;
+USING: accessors compiler.cfg compiler.cfg.debugger
+compiler.cfg.instructions compiler.cfg.registers
+compiler.cfg.representations.preferred cpu.architecture kernel
+namespaces tools.test sequences arrays system literals layouts
+math compiler.constants compiler.cfg.representations.conversion
+compiler.cfg.representations.rewrite
+compiler.cfg.comparisons
+make ;
 IN: compiler.cfg.representations
 
 [ { double-rep double-rep } ] [
@@ -12,8 +17,761 @@ IN: compiler.cfg.representations
 ] unit-test
 
 [ double-rep ] [
-    T{ ##alien-double
+    T{ ##load-memory-imm
        { dst 5 }
-       { src 3 }
+       { base 3 }
+       { offset 0 }
+       { rep double-rep }
     } defs-vreg-rep
+] unit-test
+
+H{ } clone representations set
+
+3 \ vreg-counter set-global
+
+[
+    {
+        T{ ##allot f 2 16 float 4 }
+        T{ ##store-memory-imm f 1 2 $[ float-offset ] double-rep f }
+    }
+] [
+    [
+        2 1 tagged-rep double-rep emit-conversion
+    ] { } make
+] unit-test
+
+[
+    {
+        T{ ##load-memory-imm f 2 1 $[ float-offset ] double-rep f }
+    }
+] [
+    [
+        2 1 double-rep tagged-rep emit-conversion
+    ] { } make
+] unit-test
+
+: test-representations ( -- )
+    cfg new 0 get >>entry dup cfg set select-representations drop ;
+
+! Make sure cost calculation isn't completely wrong
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##peek f 1 D 0 }
+    T{ ##peek f 2 D 1 }
+    T{ ##add-float f 3 1 2 }
+    T{ ##replace f 3 D 0 }
+    T{ ##replace f 3 D 1 }
+    T{ ##replace f 3 D 2 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 2 test-bb
+
+0 1 edge
+1 2 edge
+
+[ ] [ test-representations ] unit-test
+
+[ 1 ] [ 1 get instructions>> [ ##allot? ] count ] unit-test
+
+! Don't dereference the result of a peek
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##peek f 1 D 0 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##add-float f 2 1 1 }
+    T{ ##replace f 2 D 0 }
+    T{ ##epilogue }
+    T{ ##return }
+} 2 test-bb
+
+V{
+    T{ ##add-float f 3 1 1 }
+    T{ ##replace f 3 D 0 }
+    T{ ##epilogue }
+    T{ ##return }
+} 3 test-bb
+
+0 1 edge
+1 { 2 3 } edges
+
+[ ] [ test-representations ] unit-test
+
+[
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##branch }
+    }
+] [ 1 get instructions>> ] unit-test
+
+! We cannot untag-fixnum the result of a peek if there are usages
+! of it as a tagged-rep
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##peek f 1 D 0 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##replace f 1 R 0 }
+    T{ ##epilogue }
+    T{ ##return }
+} 2 test-bb
+
+V{
+    T{ ##mul f 2 1 1 }
+    T{ ##replace f 2 D 0 }
+    T{ ##branch }
+} 3 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 4 test-bb
+
+0 1 edge
+1 { 2 3 } edges
+3 { 3 4 } edges
+2 4 edge
+
+[ ] [ test-representations ] unit-test
+
+[
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##branch }
+    }
+] [ 1 get instructions>> ] unit-test
+
+! But its ok to untag-fixnum the result of a peek if all usages use
+! it as int-rep
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##peek f 1 D 0 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 2 test-bb
+
+V{
+    T{ ##add f 2 1 1 }
+    T{ ##mul f 3 1 1 }
+    T{ ##replace f 2 D 0 }
+    T{ ##replace f 3 D 1 }
+    T{ ##branch }
+} 3 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 4 test-bb
+
+0 1 edge
+1 { 2 3 } edges
+3 { 3 4 } edges
+2 4 edge
+
+3 \ vreg-counter set-global
+
+[ ] [ test-representations ] unit-test
+
+[
+    V{
+        T{ ##peek f 4 D 0 }
+        T{ ##sar-imm f 1 4 $[ tag-bits get ] }
+        T{ ##branch }
+    }
+] [ 1 get instructions>> ] unit-test
+
+! scalar-rep => int-rep conversion
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##peek f 1 D 0 }
+    T{ ##peek f 2 D 0 }
+    T{ ##vector>scalar f 3 2 int-4-rep }
+    T{ ##replace f 3 D 0 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 2 test-bb
+
+0 1 edge
+1 2 edge
+
+[ ] [ test-representations ] unit-test
+
+[ t ] [ 1 get instructions>> 4 swap nth ##scalar>integer? ] unit-test
+
+! Test phi node behavior
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##load-integer f 1 1 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##load-integer f 2 2 }
+    T{ ##branch }
+} 2 test-bb
+
+V{
+    T{ ##phi f 3 H{ { 1 1 } { 2 2 } } }
+    T{ ##replace f 3 D 0 }
+    T{ ##branch }
+} 3 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 4 test-bb
+
+0 { 1 2 } edges
+1 3 edge
+2 3 edge
+3 4 edge
+
+[ ] [ test-representations ] unit-test
+
+[ T{ ##load-tagged f 1 $[ 1 tag-fixnum ] } ]
+[ 1 get instructions>> first ]
+unit-test
+
+[ T{ ##load-tagged f 2 $[ 2 tag-fixnum ] } ]
+[ 2 get instructions>> first ]
+unit-test
+
+! ##load-reference corner case
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##peek f 0 D 0 }
+    T{ ##peek f 1 D 1 }
+    T{ ##add f 2 0 1 }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##load-reference f 3 f }
+    T{ ##branch }
+} 2 test-bb
+
+V{
+    T{ ##phi f 4 H{ { 1 2 } { 2 3 } } }
+    T{ ##replace f 4 D 0 }
+    T{ ##branch }
+} 3 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 4 test-bb
+
+0 { 1 2 } edges
+1 3 edge
+2 3 edge
+3 4 edge
+
+[ ] [ test-representations ] unit-test
+
+! Don't untag the f!
+[ 2 ] [ 2 get instructions>> length ] unit-test
+
+cpu x86.32? [
+
+    ! Make sure load-constant is converted into load-double
+    V{
+        T{ ##prologue }
+        T{ ##branch }
+    } 0 test-bb
+
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##load-reference f 2 0.5 }
+        T{ ##add-float f 3 1 2 }
+        T{ ##replace f 3 D 0 }
+        T{ ##branch }
+    } 1 test-bb
+
+    V{
+        T{ ##epilogue }
+        T{ ##return }
+    } 2 test-bb
+
+    0 1 edge
+    1 2 edge
+
+    [ ] [ test-representations ] unit-test
+
+    [ t ] [ 1 get instructions>> second ##load-double? ] unit-test
+
+    ! Make sure phi nodes are handled in a sane way
+    V{
+        T{ ##prologue }
+        T{ ##branch }
+    } 0 test-bb
+
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##compare-imm-branch f 1 2 cc= }
+    } 1 test-bb
+
+    V{
+        T{ ##load-reference f 2 1.5 }
+        T{ ##branch }
+    } 2 test-bb
+
+    V{
+        T{ ##load-reference f 3 2.5 }
+        T{ ##branch }
+    } 3 test-bb
+
+    V{
+        T{ ##phi f 4 H{ { 2 2 } { 3 3 } } }
+        T{ ##peek f 5 D 0 }
+        T{ ##add-float f 6 4 5 }
+        T{ ##replace f 6 D 0 }
+    } 4 test-bb
+
+    V{
+        T{ ##epilogue }
+        T{ ##return }
+    } 5 test-bb
+
+    test-diamond
+    4 5 edge
+
+    [ ] [ test-representations ] unit-test
+
+    [ t ] [ 2 get instructions>> first ##load-double? ] unit-test
+
+    [ t ] [ 3 get instructions>> first ##load-double? ] unit-test
+
+    [ t ] [ 4 get instructions>> first ##phi? ] unit-test
+] when
+
+: test-peephole ( insns -- insns )
+    0 test-bb
+    test-representations
+    0 get instructions>> ;
+
+! Don't convert the def site into anything but tagged-rep since
+! we might lose precision
+5 \ vreg-counter set-global
+
+[ f ] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 1 }
+        T{ ##add-float f 3 0 0 }
+        T{ ##store-memory-imm f 3 2 0 float-rep f }
+        T{ ##store-memory-imm f 3 2 4 float-rep f }
+        T{ ##mul-float f 4 0 0 }
+        T{ ##replace f 4 D 0 }
+    } test-peephole
+    [ ##single>double-float? ] any?
+] unit-test
+
+! Converting a ##load-integer into a ##load-tagged
+[
+    V{
+        T{ ##load-tagged f 1 $[ 100 tag-fixnum ] }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    V{
+        T{ ##load-integer f 1 100 }
+        T{ ##replace f 1 D 0 }
+    } test-peephole
+] unit-test
+
+! Peephole optimization if input to ##shl-imm is tagged
+3 \ vreg-counter set-global
+
+[
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##sar-imm f 2 1 1 }
+        T{ ##add f 4 2 2 }
+        T{ ##shl-imm f 3 4 $[ tag-bits get ] }
+        T{ ##replace f 3 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##shl-imm f 2 1 3 }
+        T{ ##add f 3 2 2 }
+        T{ ##replace f 3 D 0 }
+    } test-peephole
+] unit-test
+
+3 \ vreg-counter set-global
+
+[
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##shl-imm f 2 1 $[ 10 tag-bits get - ] }
+        T{ ##add f 4 2 2 }
+        T{ ##shl-imm f 3 4 $[ tag-bits get ] }
+        T{ ##replace f 3 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##shl-imm f 2 1 10 }
+        T{ ##add f 3 2 2 }
+        T{ ##replace f 3 D 0 }
+    } test-peephole
+] unit-test
+
+[
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##copy f 2 1 int-rep }
+        T{ ##add f 5 2 2 }
+        T{ ##shl-imm f 3 5 $[ tag-bits get ] }
+        T{ ##replace f 3 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##shl-imm f 2 1 $[ tag-bits get ] }
+        T{ ##add f 3 2 2 }
+        T{ ##replace f 3 D 0 }
+    } test-peephole
+] unit-test
+
+! Peephole optimization if output of ##shl-imm needs to be tagged
+[
+    V{
+        T{ ##load-integer f 1 100 }
+        T{ ##shl-imm f 2 1 $[ 3 tag-bits get + ] }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    V{
+        T{ ##load-integer f 1 100 }
+        T{ ##shl-imm f 2 1 3 }
+        T{ ##replace f 2 D 0 }
+    } test-peephole
+] unit-test
+
+! Peephole optimization if both input and output of ##shl-imm
+! needs to be tagged
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##shl-imm f 1 0 3 }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##shl-imm f 1 0 3 }
+        T{ ##replace f 1 D 0 }
+    } test-peephole
+] unit-test
+
+6 \ vreg-counter set-global
+
+! Peephole optimization if input to ##sar-imm is tagged
+[
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##sar-imm f 7 1 $[ 3 tag-bits get + ] }
+        T{ ##shl-imm f 2 7 $[ tag-bits get ] }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##sar-imm f 2 1 3 }
+        T{ ##replace f 2 D 0 }
+    } test-peephole
+] unit-test
+
+! Tag/untag elimination
+[
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##add-imm f 2 1 $[ 100 tag-fixnum ] }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##add-imm f 2 1 100 }
+        T{ ##replace f 2 D 0 }
+    } test-peephole
+] unit-test
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##add f 2 0 1 }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##add f 2 0 1 }
+        T{ ##replace f 2 D 0 }
+    } test-peephole
+] unit-test
+
+! Make sure we don't exceed immediate bounds
+cpu x86.64? [
+    4 \ vreg-counter set-global
+
+    [
+        V{
+            T{ ##peek f 0 D 0 }
+            T{ ##sar-imm f 5 0 $[ tag-bits get ] }
+            T{ ##add-imm f 6 5 $[ 30 2^ ] }
+            T{ ##shl-imm f 2 6 $[ tag-bits get ] }
+            T{ ##replace f 2 D 0 }
+        }
+    ] [
+        V{
+            T{ ##peek f 0 D 0 }
+            T{ ##add-imm f 2 0 $[ 30 2^ ] }
+            T{ ##replace f 2 D 0 }
+        } test-peephole
+    ] unit-test
+
+    [
+        V{
+            T{ ##load-integer f 0 100 }
+            T{ ##mul-imm f 7 0 $[ 30 2^ ] }
+            T{ ##shl-imm f 1 7 $[ tag-bits get ] }
+            T{ ##replace f 1 D 0 }
+        }
+    ] [
+        V{
+            T{ ##load-integer f 0 100 }
+            T{ ##mul-imm f 1 0 $[ 30 2^ ] }
+            T{ ##replace f 1 D 0 }
+        } test-peephole
+    ] unit-test
+] when
+
+! Tag/untag elimination for ##mul-imm
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##mul-imm f 1 0 100 }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##mul-imm f 1 0 100 }
+        T{ ##replace f 1 D 0 }
+    } test-peephole
+] unit-test
+
+4 \ vreg-counter set-global
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##sar-imm f 5 1 $[ tag-bits get ] }
+        T{ ##add-imm f 2 5 30 }
+        T{ ##mul-imm f 3 2 $[ 100 tag-fixnum ] }
+        T{ ##replace f 3 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##add-imm f 2 1 30 }
+        T{ ##mul-imm f 3 2 100 }
+        T{ ##replace f 3 D 0 }
+    } test-peephole
+] unit-test
+
+! Tag/untag elimination for ##compare-integer and ##test
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##test f 2 0 1 cc= }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##test f 2 0 1 cc= }
+        T{ ##replace f 2 D 0 }
+    } test-peephole
+] unit-test
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##compare-integer f 2 0 1 cc= }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##compare-integer f 2 0 1 cc= }
+        T{ ##replace f 2 D 0 }
+    } test-peephole
+] unit-test
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##compare-integer-branch f 0 1 cc= }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##compare-integer-branch f 0 1 cc= }
+    } test-peephole
+] unit-test
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##test-branch f 0 1 cc= }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##test-branch f 0 1 cc= }
+    } test-peephole
+] unit-test
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##compare-integer-imm-branch f 0 $[ 10 tag-fixnum ] cc= }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##compare-integer-imm-branch f 0 10 cc= }
+    } test-peephole
+] unit-test
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##test-imm-branch f 0 $[ 10 tag-fixnum ] cc= }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##test-imm-branch f 0 10 cc= }
+    } test-peephole
+] unit-test
+
+! Tag/untag elimination for ##neg
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##neg f 1 0 }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##neg f 1 0 }
+        T{ ##replace f 1 D 0 }
+    } test-peephole
+] unit-test
+
+4 \ vreg-counter set-global
+
+[
+    V{
+        T{ ##peek f 5 D 0 }
+        T{ ##sar-imm f 0 5 $[ tag-bits get ] }
+        T{ ##peek f 6 D 1 }
+        T{ ##sar-imm f 1 6 $[ tag-bits get ] }
+        T{ ##mul f 2 0 1 }
+        T{ ##mul-imm f 3 2 -16 }
+        T{ ##replace f 3 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##mul f 2 0 1 }
+        T{ ##neg f 3 2 }
+        T{ ##replace f 3 D 0 }
+    } test-peephole
+] unit-test
+
+! Tag/untag elimination for ##not
+2 \ vreg-counter set-global
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##not f 3 0 }
+        T{ ##xor-imm f 1 3 $[ tag-mask get ] }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##not f 1 0 }
+        T{ ##replace f 1 D 0 }
+    } test-peephole
 ] unit-test
\ No newline at end of file
index 005fe8c90b3b1a887f102766860862dbfc734d56..2160ad26e6e7e2f2fe14aa66fa78013f5d48a9d8 100644 (file)
-! Copyright (C) 2009 Slava Pestov
+! Copyright (C) 2009, 2010 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel fry accessors sequences assocs sets namespaces
-arrays combinators combinators.short-circuit math make locals
-deques dlists layouts byte-arrays cpu.architecture
-compiler.utilities
-compiler.constants
+USING: combinators
 compiler.cfg
-compiler.cfg.rpo
-compiler.cfg.hats
 compiler.cfg.registers
-compiler.cfg.instructions
-compiler.cfg.def-use
-compiler.cfg.utilities
+compiler.cfg.predecessors
 compiler.cfg.loop-detection
-compiler.cfg.renaming.functor
-compiler.cfg.representations.preferred ;
+compiler.cfg.representations.rewrite
+compiler.cfg.representations.peephole
+compiler.cfg.representations.selection
+compiler.cfg.representations.coalescing ;
 IN: compiler.cfg.representations
 
-! Virtual register representation selection.
-
-ERROR: bad-conversion dst src dst-rep src-rep ;
-
-GENERIC: emit-box ( dst src rep -- )
-GENERIC: emit-unbox ( dst src rep -- )
-
-M:: float-rep emit-box ( dst src rep -- )
-    double-rep next-vreg-rep :> temp
-    temp src ##single>double-float
-    dst temp double-rep emit-box ;
-
-M:: float-rep emit-unbox ( dst src rep -- )
-    double-rep next-vreg-rep :> temp
-    temp src double-rep emit-unbox
-    dst temp ##double>single-float ;
-
-M: double-rep emit-box
-    drop
-    [ drop 16 float int-rep next-vreg-rep ##allot ]
-    [ float-offset swap ##set-alien-double ]
-    2bi ;
-
-M: double-rep emit-unbox
-    drop float-offset ##alien-double ;
-
-M:: vector-rep emit-box ( dst src rep -- )
-    int-rep next-vreg-rep :> temp
-    dst 16 2 cells + byte-array int-rep next-vreg-rep ##allot
-    temp 16 tag-fixnum ##load-immediate
-    temp dst 1 byte-array type-number ##set-slot-imm
-    dst byte-array-offset src rep ##set-alien-vector ;
-
-M: vector-rep emit-unbox
-    [ byte-array-offset ] dip ##alien-vector ;
-
-M:: scalar-rep emit-box ( dst src rep -- )
-    int-rep next-vreg-rep :> temp
-    temp src rep ##scalar>integer
-    dst temp tag-bits get ##shl-imm ;
-
-M:: scalar-rep emit-unbox ( dst src rep -- )
-    int-rep next-vreg-rep :> temp
-    temp src tag-bits get ##sar-imm
-    dst temp rep ##integer>scalar ;
-
-: emit-conversion ( dst src dst-rep src-rep -- )
-    {
-        { [ 2dup eq? ] [ drop ##copy ] }
-        { [ dup int-rep eq? ] [ drop emit-unbox ] }
-        { [ over int-rep eq? ] [ nip emit-box ] }
-        [
-            2dup 2array {
-                { { double-rep float-rep } [ 2drop ##single>double-float ] }
-                { { float-rep double-rep } [ 2drop ##double>single-float ] }
-                ! Punning SIMD vector types? Naughty naughty! But
-                ! it is allowed... otherwise bail out.
-                [
-                    drop 2dup [ reg-class-of ] bi@ eq?
-                    [ drop ##copy ] [ bad-conversion ] if
-                ]
-            } case
-        ]
-    } cond ;
-
-<PRIVATE
-
-! For every vreg, compute possible representations.
-SYMBOL: possibilities
-
-: possible ( vreg -- reps ) possibilities get at ;
-
-: compute-possibilities ( cfg -- )
-    H{ } clone [ '[ swap _ conjoin-at ] with-vreg-reps ] keep
-    [ keys ] assoc-map possibilities set ;
-
-! Compute vregs which must remain tagged for their lifetime.
-SYMBOL: always-boxed
-
-:: (compute-always-boxed) ( vreg rep assoc -- )
-    rep int-rep eq? [
-        int-rep vreg assoc set-at
-    ] when ;
-
-: compute-always-boxed ( cfg -- assoc )
-    H{ } clone [
-        '[
-            [
-                dup [ ##load-reference? ] [ ##load-constant? ] bi or
-                [ drop ] [ [ _ (compute-always-boxed) ] each-def-rep ] if
-            ] each-non-phi
-        ] each-basic-block
-    ] keep ;
-
-! For every vreg, compute the cost of keeping it in every possible
-! representation.
-
-! Cost map maps vreg to representation to cost.
-SYMBOL: costs
-
-: init-costs ( -- )
-    possibilities get [ [ 0 ] H{ } map>assoc ] assoc-map costs set ;
-
-: increase-cost ( rep vreg -- )
-    ! Increase cost of keeping vreg in rep, making a choice of rep less
-    ! likely.
-    [ basic-block get loop-nesting-at ] 2dip costs get at at+ ;
-
-: maybe-increase-cost ( possible vreg preferred -- )
-    pick eq? [ 2drop ] [ increase-cost ] if ;
-
-: representation-cost ( vreg preferred -- )
-    ! 'preferred' is a representation that the instruction can accept with no cost.
-    ! So, for each representation that's not preferred, increase the cost of keeping
-    ! the vreg in that representation.
-    [ drop possible ]
-    [ '[ _ _ maybe-increase-cost ] ]
-    2bi each ;
-
-: compute-costs ( cfg -- costs )
-    init-costs [ representation-cost ] with-vreg-reps costs get ;
-
-! For every vreg, compute preferred representation, that minimizes costs.
-: minimize-costs ( costs -- representations )
-    [ >alist alist-min first ] assoc-map ;
-
-: compute-representations ( cfg -- )
-    [ compute-costs minimize-costs ]
-    [ compute-always-boxed ]
-    bi assoc-union
-    representations set ;
-
-! Insert conversions. This introduces new temporaries, so we need
-! to rename opearands too.
-
-! Mapping from vreg,rep pairs to vregs
-SYMBOL: alternatives
-
-:: emit-def-conversion ( dst preferred required -- new-dst' )
-    ! If an instruction defines a register with representation 'required',
-    ! but the register has preferred representation 'preferred', then
-    ! we rename the instruction's definition to a new register, which
-    ! becomes the input of a conversion instruction.
-    dst required next-vreg-rep [ preferred required emit-conversion ] keep ;
-
-:: emit-use-conversion ( src preferred required -- new-src' )
-    ! If an instruction uses a register with representation 'required',
-    ! but the register has preferred representation 'preferred', then
-    ! we rename the instruction's input to a new register, which
-    ! becomes the output of a conversion instruction.
-    preferred required eq? [ src ] [
-        src required alternatives get [
-            required next-vreg-rep :> new-src
-            [ new-src ] 2dip preferred emit-conversion
-            new-src
-        ] 2cache
-    ] if ;
-
-SYMBOLS: renaming-set needs-renaming? ;
-
-: init-renaming-set ( -- )
-    needs-renaming? off
-    V{ } clone renaming-set set ;
-
-: no-renaming ( vreg -- )
-    dup 2array renaming-set get push ;
-
-: record-renaming ( from to -- )
-    2array renaming-set get push needs-renaming? on ;
-
-:: (compute-renaming-set) ( vreg required quot: ( vreg preferred required -- ) -- )
-    vreg rep-of :> preferred
-    preferred required eq?
-    [ vreg no-renaming ]
-    [ vreg vreg preferred required quot call record-renaming ] if ; inline
-
-: compute-renaming-set ( insn -- )
-    ! temp vregs don't need conversions since they're always in their
-    ! preferred representation
-    init-renaming-set
-    [ [ [ emit-use-conversion ] (compute-renaming-set) ] each-use-rep ]
-    [ , ]
-    [ [ [ emit-def-conversion ] (compute-renaming-set) ] each-def-rep ]
-    tri ;
-
-: converted-value ( vreg -- vreg' )
-    renaming-set get pop first2 [ assert= ] dip ;
-
-RENAMING: convert [ converted-value ] [ converted-value ] [ ]
-
-: perform-renaming ( insn -- )
-    needs-renaming? get [
-        renaming-set get reverse! drop
-        [ convert-insn-uses ] [ convert-insn-defs ] bi
-        renaming-set get length 0 assert=
-    ] [ drop ] if ;
-
-GENERIC: conversions-for-insn ( insn -- )
-
-SYMBOL: phi-mappings
-
-! compiler.cfg.cssa inserts conversions which convert phi inputs into
-!  the representation of the output. However, we still have to do some
-!  processing here, because if the only node that uses the output of
-!  the phi instruction is another phi instruction then this phi node's
-! output won't have a representation assigned.
-M: ##phi conversions-for-insn
-    [ , ] [ [ inputs>> values ] [ dst>> ] bi phi-mappings get set-at ] bi ;
-
-! When a literal zeroes/ones vector is unboxed, we replace the ##load-reference
-! with a ##zero-vector or ##fill-vector instruction since this is more efficient.
-: convert-to-zero-vector? ( insn -- ? )
-    {
-        [ dst>> rep-of vector-rep? ]
-        [ obj>> B{ 0 0 0 0  0 0 0 0  0 0 0 0  0 0 0 0 } = ]
-    } 1&& ;
-: convert-to-fill-vector? ( insn -- ? )
-    {
-        [ dst>> rep-of vector-rep? ]
-        [ obj>> B{ 255 255 255 255  255 255 255 255  255 255 255 255  255 255 255 255 } = ]
-    } 1&& ;
-
-: (convert-to-zero/fill-vector) ( insn -- dst rep )
-    dst>> dup rep-of ; inline
-
-: conversions-for-load-insn ( insn -- ?insn )
-    {
-        {
-            [ dup convert-to-zero-vector? ]
-            [ (convert-to-zero/fill-vector) ##zero-vector f ]
-        }
-        {
-            [ dup convert-to-fill-vector? ]
-            [ (convert-to-zero/fill-vector) ##fill-vector f ]
-        }
-        [ ]
-    } cond ;
-
-M: ##load-reference conversions-for-insn
-    conversions-for-load-insn [ call-next-method ] when* ;
-
-M: ##load-constant conversions-for-insn
-    conversions-for-load-insn [ call-next-method ] when* ;
-
-M: vreg-insn conversions-for-insn
-    [ compute-renaming-set ] [ perform-renaming ] bi ;
-
-M: insn conversions-for-insn , ;
-
-: conversions-for-block ( bb -- )
-    dup kill-block? [ drop ] [
-        [
-            [
-                H{ } clone alternatives set
-                [ conversions-for-insn ] each
-            ] V{ } make
-        ] change-instructions drop
-    ] if ;
-
-! If the output of a phi instruction is only used as the input to another
-! phi instruction, then we want to use the same representation for both
-! if possible.
-SYMBOL: work-list
-
-: add-to-work-list ( vregs -- )
-    work-list get push-all-front ;
-
-: rep-assigned ( vregs -- vregs' )
-    representations get '[ _ key? ] filter ;
-
-: rep-not-assigned ( vregs -- vregs' )
-    representations get '[ _ key? not ] filter ;
-
-: add-ready-phis ( -- )
-    phi-mappings get keys rep-assigned add-to-work-list ;
-
-: process-phi-mapping ( dst -- )
-    ! If dst = phi(src1,src2,...) and dst's representation has been
-    ! determined, assign that representation to each one of src1,...
-    ! that does not have a representation yet, and process those, too.
-    dup phi-mappings get at* [
-        [ rep-of ] [ rep-not-assigned ] bi*
-        [ [ set-rep-of ] with each ] [ add-to-work-list ] bi
-    ] [ 2drop ] if ;
-
-: remaining-phi-mappings ( -- )
-    phi-mappings get keys rep-not-assigned
-    [ [ int-rep ] dip set-rep-of ] each ;
-
-: process-phi-mappings ( -- )
-    <hashed-dlist> work-list set
-    add-ready-phis
-    work-list get [ process-phi-mapping ] slurp-deque
-    remaining-phi-mappings ;
-
-: insert-conversions ( cfg -- )
-    H{ } clone phi-mappings set
-    [ conversions-for-block ] each-basic-block
-    process-phi-mappings ;
-
-PRIVATE>
+! Virtual register representation selection. This is where
+! decisions about integer tagging and float and vector boxing
+! are made. The appropriate conversion operations inserted
+! after a cost analysis.
 
 : select-representations ( cfg -- cfg' )
     needs-loops
+    needs-predecessors
 
     {
+        [ compute-components ]
         [ compute-possibilities ]
         [ compute-representations ]
         [ insert-conversions ]
         [ ]
-    } cleave
-    representations get cfg get (>>reps) ;
+    } cleave ;
diff --git a/basis/compiler/cfg/representations/rewrite/authors.txt b/basis/compiler/cfg/representations/rewrite/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/representations/rewrite/rewrite.factor b/basis/compiler/cfg/representations/rewrite/rewrite.factor
new file mode 100644 (file)
index 0000000..b997c35
--- /dev/null
@@ -0,0 +1,101 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays assocs combinators
+combinators.short-circuit layouts kernel locals make math
+namespaces sequences
+compiler.cfg.instructions
+compiler.cfg.registers
+compiler.cfg.renaming.functor
+compiler.cfg.representations.conversion
+compiler.cfg.representations.preferred
+compiler.cfg.rpo
+compiler.cfg.utilities
+cpu.architecture ;
+IN: compiler.cfg.representations.rewrite
+
+! Insert conversions. This introduces new temporaries, so we need
+! to rename opearands too.
+
+! Mapping from vreg,rep pairs to vregs
+SYMBOL: alternatives
+
+:: (emit-def-conversion) ( dst preferred required -- new-dst' )
+    ! If an instruction defines a register with representation 'required',
+    ! but the register has preferred representation 'preferred', then
+    ! we rename the instruction's definition to a new register, which
+    ! becomes the input of a conversion instruction.
+    dst required next-vreg-rep [ preferred required emit-conversion ] keep ;
+
+:: (emit-use-conversion) ( src preferred required -- new-src' )
+    ! If an instruction uses a register with representation 'required',
+    ! but the register has preferred representation 'preferred', then
+    ! we rename the instruction's input to a new register, which
+    ! becomes the output of a conversion instruction.
+    preferred required eq? [ src ] [
+        src required alternatives get [
+            required next-vreg-rep :> new-src
+            [ new-src ] 2dip preferred emit-conversion
+            new-src
+        ] 2cache
+    ] if ;
+
+SYMBOLS: renaming-set needs-renaming? ;
+
+: init-renaming-set ( -- )
+    needs-renaming? off
+    renaming-set get delete-all ;
+
+: no-renaming ( vreg -- )
+    dup 2array renaming-set get push ;
+
+: record-renaming ( from to -- )
+    2array renaming-set get push needs-renaming? on ;
+
+:: (compute-renaming-set) ( vreg required quot: ( vreg preferred required -- new-vreg ) -- )
+    vreg rep-of :> preferred
+    preferred required eq?
+    [ vreg no-renaming ]
+    [ vreg vreg preferred required quot call record-renaming ] if ; inline
+
+: emit-use-conversion ( insn -- )
+    [ [ (emit-use-conversion) ] (compute-renaming-set) ] each-use-rep ;
+
+: no-use-conversion ( insn -- )
+    [ drop no-renaming ] each-use-rep ;
+
+: emit-def-conversion ( insn -- )
+    [ [ (emit-def-conversion) ] (compute-renaming-set) ] each-def-rep ;
+
+: no-def-conversion ( insn -- )
+    [ drop no-renaming ] each-def-rep ;
+
+: converted-value ( vreg -- vreg' )
+    renaming-set get pop first2 [ assert= ] dip ;
+
+RENAMING: convert [ converted-value ] [ converted-value ] [ ]
+
+: perform-renaming ( insn -- )
+    needs-renaming? get [
+        renaming-set get reverse! drop
+        [ convert-insn-uses ] [ convert-insn-defs ] bi
+        renaming-set get length 0 assert=
+    ] [ drop ] if ;
+
+GENERIC: conversions-for-insn ( insn -- )
+
+M: ##phi conversions-for-insn , ;
+
+M: ##copy conversions-for-insn , ;
+
+M: insn conversions-for-insn , ;
+
+: conversions-for-block ( insns -- insns )
+    [
+        alternatives get clear-assoc
+        [ conversions-for-insn ] each
+    ] V{ } make ;
+
+: insert-conversions ( cfg -- )
+    H{ } clone alternatives set
+    V{ } clone renaming-set set
+    [ conversions-for-block ] simple-optimization ;
diff --git a/basis/compiler/cfg/representations/selection/authors.txt b/basis/compiler/cfg/representations/selection/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/representations/selection/selection.factor b/basis/compiler/cfg/representations/selection/selection.factor
new file mode 100644 (file)
index 0000000..330e5d8
--- /dev/null
@@ -0,0 +1,154 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays assocs byte-arrays combinators
+disjoint-sets fry kernel locals math namespaces sequences sets
+compiler.cfg
+compiler.cfg.instructions
+compiler.cfg.loop-detection
+compiler.cfg.registers
+compiler.cfg.representations.preferred
+compiler.cfg.representations.coalescing
+compiler.cfg.rpo
+compiler.cfg.utilities
+compiler.utilities
+cpu.architecture ;
+FROM: namespaces => set ;
+IN: compiler.cfg.representations.selection
+
+! vregs which must be tagged at the definition site because
+! there is at least one usage that is not int-rep. If all usages
+! are int-rep it is safe to untag at the definition site.
+SYMBOL: tagged-vregs
+
+SYMBOL: vreg-reps
+
+: handle-def ( vreg rep -- )
+    swap vreg>scc vreg-reps get
+    [ [ intersect ] when* ] change-at ;
+
+: handle-use ( vreg rep -- )
+    int-rep eq? [ drop ] [ vreg>scc tagged-vregs get adjoin ] if ;
+
+GENERIC: (collect-vreg-reps) ( insn -- )
+
+M: ##load-reference (collect-vreg-reps)
+    [ dst>> ] [ obj>> ] bi {
+        { [ dup float? ] [ drop { float-rep double-rep } ] }
+        { [ dup byte-array? ] [ drop vector-reps ] }
+        [ drop { } ]
+    } cond handle-def ;
+
+M: vreg-insn (collect-vreg-reps)
+    [ [ handle-use ] each-use-rep ]
+    [ [ 1array handle-def ] each-def-rep ]
+    [ [ 1array handle-def ] each-temp-rep ]
+    tri ;
+
+M: insn (collect-vreg-reps) drop ;
+
+: collect-vreg-reps ( cfg -- )
+    H{ } clone vreg-reps set
+    HS{ } clone tagged-vregs set
+    [ [ (collect-vreg-reps) ] each-non-phi ] each-basic-block ;
+
+SYMBOL: possibilities
+
+: possible-reps ( vreg reps -- vreg reps )
+    { tagged-rep } union
+    2dup [ tagged-vregs get in? not ] [ { tagged-rep } = ] bi* and
+    [ drop { tagged-rep int-rep } ] [ ] if ;
+
+: compute-possibilities ( cfg -- )
+    collect-vreg-reps
+    vreg-reps get [ possible-reps ] assoc-map possibilities set ;
+
+! For every vreg, compute the cost of keeping it in every possible
+! representation.
+
+! Cost map maps vreg to representation to cost.
+SYMBOL: costs
+
+: init-costs ( -- )
+    ! Initialize cost as 0 for each possibility.
+    possibilities get [ [ 0 ] H{ } map>assoc ] assoc-map costs set ;
+
+: 10^ ( n -- x ) 10 <repetition> product ;
+
+: increase-cost ( rep scc factor -- )
+    ! Increase cost of keeping vreg in rep, making a choice of rep less
+    ! likely. If the rep is not in the cost alist, it means this
+    ! representation is prohibited.
+    [ costs get at 2dup key? ] dip
+    '[ [ current-loop-nesting 10^ _ * + ] change-at ] [ 2drop ] if ;
+
+:: increase-costs ( vreg preferred factor -- )
+    vreg vreg>scc :> scc
+    scc possibilities get at [
+        dup preferred eq? [ drop ] [ scc factor increase-cost ] if
+    ] each ; inline
+
+UNION: inert-tag-untag-insn
+##add
+##sub
+##and
+##or
+##xor
+##min
+##max ;
+
+UNION: inert-arithmetic-tag-untag-insn
+##add-imm
+##sub-imm ;
+
+UNION: inert-bitwise-tag-untag-insn
+##and-imm
+##or-imm
+##xor-imm ;
+
+GENERIC: has-peephole-opts? ( insn -- ? )
+
+M: insn has-peephole-opts? drop f ;
+M: ##load-integer has-peephole-opts? drop t ;
+M: ##load-reference has-peephole-opts? drop t ;
+M: ##neg has-peephole-opts? drop t ;
+M: ##not has-peephole-opts? drop t ;
+M: inert-tag-untag-insn has-peephole-opts? drop t ;
+M: inert-arithmetic-tag-untag-insn has-peephole-opts? drop t ;
+M: inert-bitwise-tag-untag-insn has-peephole-opts? drop t ;
+M: ##mul-imm has-peephole-opts? drop t ;
+M: ##shl-imm has-peephole-opts? drop t ;
+M: ##shr-imm has-peephole-opts? drop t ;
+M: ##sar-imm has-peephole-opts? drop t ;
+M: ##compare-integer-imm has-peephole-opts? drop t ;
+M: ##compare-integer has-peephole-opts? drop t ;
+M: ##compare-integer-imm-branch has-peephole-opts? drop t ;
+M: ##compare-integer-branch has-peephole-opts? drop t ;
+M: ##test-imm has-peephole-opts? drop t ;
+M: ##test has-peephole-opts? drop t ;
+M: ##test-imm-branch has-peephole-opts? drop t ;
+M: ##test-branch has-peephole-opts? drop t ;
+
+GENERIC: compute-insn-costs ( insn -- )
+
+M: insn compute-insn-costs drop ;
+
+M: vreg-insn compute-insn-costs
+    dup has-peephole-opts? 2 5 ? '[ _ increase-costs ] each-rep ;
+
+: compute-costs ( cfg -- )
+    init-costs
+    [
+        [ basic-block set ]
+        [ [ compute-insn-costs ] each-non-phi ] bi
+    ] each-basic-block ;
+
+! For every vreg, compute preferred representation, that minimizes costs.
+: minimize-costs ( costs -- representations )
+    [ nip assoc-empty? not ] assoc-filter
+    [ >alist alist-min first ] assoc-map ;
+
+: compute-representations ( cfg -- )
+    compute-costs costs get minimize-costs
+    [ components get [ disjoint-set-members ] keep ] dip
+    '[ dup _ representative _ at ] H{ } map>assoc
+    representations set ;
index b6322730ee72bd2a80ff881a8e95f5e17dd0a901..711657e8e589d1196d248c8ba55db6f2d18bea3e 100644 (file)
@@ -2,6 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel accessors namespaces make math sequences sets
 assocs fry compiler.cfg compiler.cfg.instructions ;
+FROM: namespaces => set ;
 IN: compiler.cfg.rpo
 
 SYMBOL: visited
@@ -35,11 +36,21 @@ SYMBOL: visited
     [ reverse-post-order ] dip each ; inline
 
 : optimize-basic-block ( bb quot -- )
-    [ drop basic-block set ]
-    [ change-instructions drop ] 2bi ; inline
+    over kill-block?>> [ 2drop ] [
+        over basic-block set
+        change-instructions drop
+    ] if ; inline
 
-: local-optimization ( cfg quot: ( insns -- insns' ) -- cfg' )
-    dupd '[ _ optimize-basic-block ] each-basic-block ; inline
+: simple-optimization ( ... cfg quot: ( ... insns -- ... insns' ) -- ... )
+    '[ _ optimize-basic-block ] each-basic-block ; inline
+
+: analyze-basic-block ( bb quot -- )
+    over kill-block?>> [ 2drop ] [
+        [ dup basic-block set instructions>> ] dip call
+    ] if ; inline
+
+: simple-analysis ( ... cfg quot: ( ... insns -- ... ) -- ... )
+    '[ _ analyze-basic-block ] each-basic-block ; inline
 
 : needs-post-order ( cfg -- cfg' )
-    dup post-order drop ;
\ No newline at end of file
+    dup post-order drop ;
index c7b6db06715000941bc0255c73fd769d382ab4df..e5edd7cdffb37fa296b9d28d0139df313e8ba2e1 100644 (file)
@@ -10,6 +10,7 @@ IN: compiler.cfg.save-contexts
 : needs-save-context? ( insns -- ? )
     [
         {
+            [ ##call-gc? ]
             [ ##unary-float-function? ]
             [ ##binary-float-function? ]
             [ ##alien-invoke? ]
@@ -20,8 +21,8 @@ IN: compiler.cfg.save-contexts
 
 : insert-save-context ( bb -- )
     dup instructions>> dup needs-save-context? [
-        int-rep next-vreg-rep
-        int-rep next-vreg-rep
+        tagged-rep next-vreg-rep
+        tagged-rep next-vreg-rep
         \ ##save-context new-insn prefix
         >>instructions drop
     ] [ 2drop ] if ;
diff --git a/basis/compiler/cfg/scheduling/scheduling-tests.factor b/basis/compiler/cfg/scheduling/scheduling-tests.factor
new file mode 100644 (file)
index 0000000..fd61790
--- /dev/null
@@ -0,0 +1,11 @@
+USING: compiler.cfg.scheduling vocabs.loader namespaces tools.test ;
+IN: compiler.cfg.scheduling.tests
+
+! Recompile compiler.cfg.scheduling with extra tests,
+! and see if any errors come up. Back when there were
+! errors of this kind, they always surfaced this way.
+
+t check-scheduling? [
+    [ ] [ "compiler.cfg.scheduling" reload ] unit-test
+    [ ] [ "compiler.cfg.dependence" reload ] unit-test
+] with-variable
diff --git a/basis/compiler/cfg/scheduling/scheduling.factor b/basis/compiler/cfg/scheduling/scheduling.factor
new file mode 100644 (file)
index 0000000..04e4142
--- /dev/null
@@ -0,0 +1,134 @@
+! Copyright (C) 2009, 2010 Daniel Ehrenberg.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays assocs fry kernel locals make math
+namespaces sequences sets combinators.short-circuit
+compiler.cfg.def-use compiler.cfg.dependence
+compiler.cfg.instructions compiler.cfg.liveness compiler.cfg.rpo
+cpu.architecture ;
+IN: compiler.cfg.scheduling
+
+! Instruction scheduling to reduce register pressure, from:
+! "Register-sensitive selection, duplication, and
+!  sequencing of instructions"
+! by Vivek Sarkar, et al.
+! http://portal.acm.org/citation.cfm?id=377849
+
+ERROR: bad-delete-at key assoc ;
+
+: check-delete-at ( key assoc -- )
+    2dup key? [ delete-at ] [ bad-delete-at ] if ;
+
+: set-parent-indices ( node -- )
+    children>> building get length
+    '[ _ >>parent-index drop ] each ;
+
+: remove-node ( node -- )
+    [ follows>> members ] keep
+    '[ [ precedes>> _ swap check-delete-at ] each ]
+    [ [ ready? ] filter roots get push-all ] bi ;
+
+: score ( insn -- n )
+    [ parent-index>> ] [ registers>> neg ] [ insn>> insn#>> ] tri 3array ;
+
+: pull-out-nth ( n seq -- elt )
+    [ nth ] [ remove-nth! drop ] 2bi ;
+
+: select ( vector quot -- elt )
+    ! This could be sped up by a constant factor
+    [ dup <enum> ] dip '[ _ call( insn -- score ) ] assoc-map
+    dup values supremum '[ nip _ = ] assoc-find
+    2drop swap pull-out-nth ; inline
+
+: select-instruction ( -- insn/f )
+    roots get [ f ] [
+        [ score ] select 
+        [ insn>> ]
+        [ set-parent-indices ]
+        [ remove-node ] tri
+    ] if-empty ;
+
+: (reorder) ( -- )
+    select-instruction [
+        , (reorder)
+    ] when* ;
+
+: cut-by ( seq quot -- before after )
+    dupd find drop [ cut ] [ f ] if* ; inline
+
+UNION: initial-insn
+    ##phi ##inc-d ##inc-r ;
+
+: split-3-ways ( insns -- first middle last )
+    [ initial-insn? not ] cut-by unclip-last ;
+
+: reorder ( insns -- insns' )
+    split-3-ways [
+        build-dependence-graph
+        build-fan-in-trees
+        [ (reorder) ] V{ } make reverse
+    ] dip suffix append ;
+
+ERROR: not-all-instructions-were-scheduled old-bb new-bb ;
+
+SYMBOL: check-scheduling?
+f check-scheduling? set-global
+
+:: check-instructions ( new-bb old-bb -- )
+    new-bb old-bb [ instructions>> ] bi@
+    [ [ length ] bi@ = ] [ [ unique ] bi@ = ] 2bi and
+    [ old-bb new-bb not-all-instructions-were-scheduled ] unless ;
+
+ERROR: definition-after-usage vreg old-bb new-bb ;
+
+:: check-usages ( new-bb old-bb -- )
+    HS{ } clone :> useds
+    new-bb instructions>> split-3-ways drop nip
+    [| insn |
+        insn uses-vregs [ useds adjoin ] each
+        insn defs-vreg :> def-reg
+        def-reg useds in?
+        [ def-reg old-bb new-bb definition-after-usage ] when
+    ] each ;
+
+: check-scheduling ( new-bb old-bb -- )
+    [ check-instructions ] [ check-usages ] 2bi ;
+
+: with-scheduling-check ( bb quot: ( bb -- ) -- )
+    check-scheduling? get [
+        over dup clone
+        [ call( bb -- ) ] 2dip
+        check-scheduling
+    ] [
+        call( bb -- )
+    ] if ; inline
+
+: number-insns ( insns -- )
+    [ >>insn# drop ] each-index ;
+
+: clear-numbers ( insns -- )
+    [ f >>insn# drop ] each ;
+
+: schedule-block ( bb -- )
+    [
+        [
+            [ number-insns ]
+            [ reorder ]
+            [ clear-numbers ] tri
+        ] change-instructions drop
+    ] with-scheduling-check ;
+
+! Really, instruction scheduling should be aware that there are
+! multiple types of registers, but this number is just used
+! to decide whether to schedule instructions
+: num-registers ( -- x ) int-regs machine-registers at length ;
+
+: might-spill? ( bb -- ? )
+    [ live-in assoc-size ]
+    [ instructions>> [ defs-vreg ] count ] bi
+    + num-registers >= ;
+
+: schedule-instructions ( cfg -- cfg' )
+    dup [
+        dup { [ kill-block?>> not ] [ might-spill? ] } 1&&
+        [ schedule-block ] [ drop ] if
+    ] each-basic-block ;
index 3d743176b139338df8a6ec33c432c3a5f5d03f35..54b02b74509c3e98eb7b5d0d89a1f35f962bc52c 100644 (file)
@@ -13,19 +13,19 @@ IN: compiler.cfg.ssa.construction.tests
 reset-counters
 
 V{
-    T{ ##load-immediate f 1 100 }
+    T{ ##load-integer f 1 100 }
     T{ ##add-imm f 2 1 50 }
     T{ ##add-imm f 2 2 10 }
     T{ ##branch }
 } 0 test-bb
 
 V{
-    T{ ##load-immediate f 3 3 }
+    T{ ##load-integer f 3 3 }
     T{ ##branch }
 } 1 test-bb
 
 V{
-    T{ ##load-immediate f 3 4 }
+    T{ ##load-integer f 3 4 }
     T{ ##branch }
 } 2 test-bb
 
@@ -48,7 +48,7 @@ V{
 
 [
     V{
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##add-imm f 2 1 50 }
         T{ ##add-imm f 3 2 10 }
         T{ ##branch }
@@ -57,14 +57,14 @@ V{
 
 [
     V{
-        T{ ##load-immediate f 4 3 }
+        T{ ##load-integer f 4 3 }
         T{ ##branch }
     }
 ] [ 1 get instructions>> ] unit-test
 
 [
     V{
-        T{ ##load-immediate f 5 4 }
+        T{ ##load-integer f 5 4 }
         T{ ##branch }
     }
 ] [ 2 get instructions>> ] unit-test
index 7662b8ab01093fd288fd340b5b998ed220a9fa2d..526587dabecb71013b3218850b5966979c482fba 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: namespaces kernel accessors sequences fry assocs
 sets math combinators
@@ -12,6 +12,7 @@ compiler.cfg.instructions
 compiler.cfg.renaming
 compiler.cfg.renaming.functor
 compiler.cfg.ssa.construction.tdmsc ;
+FROM: namespaces => set ;
 IN: compiler.cfg.ssa.construction
 
 ! The phi placement algorithm is implemented in
@@ -41,10 +42,9 @@ SYMBOL: defs-multi
     H{ } clone defs set
     H{ } clone defs-multi set
     [
-        dup instructions>> [
-            compute-insn-defs
-        ] with each
-    ] each-basic-block ;
+        [ basic-block get ] dip
+        [ compute-insn-defs ] with each
+    ] simple-analysis ;
 
 ! Maps basic blocks to sequences of vregs
 SYMBOL: inserting-phi-nodes
@@ -56,7 +56,7 @@ SYMBOL: inserting-phi-nodes
     ] [ 2drop ] if ;
 
 : compute-phi-nodes-for ( vreg bbs -- )
-    keys [ insert-phi-node-later ] with merge-set-each ;
+    keys merge-set [ insert-phi-node-later ] with each ;
 
 : compute-phi-nodes ( -- )
     H{ } clone inserting-phi-nodes set
@@ -87,7 +87,9 @@ RENAMING: ssa-rename [ gen-name ] [ top-name ] [ ]
 
 GENERIC: rename-insn ( insn -- )
 
-M: insn rename-insn
+M: insn rename-insn drop ;
+
+M: vreg-insn rename-insn
     [ ssa-rename-insn-uses ]
     [ ssa-rename-insn-defs ]
     bi ;
@@ -135,4 +137,4 @@ PRIVATE>
         [ compute-defs compute-phi-nodes insert-phi-nodes ]
         [ rename ]
         [ ]
-    } cleave ;
\ No newline at end of file
+    } cleave ;
index 955d41814fe6e39f2b61169dc92ea1df83873f85..9b24c55078c81122c72127a0cd2496417479224a 100644 (file)
@@ -2,6 +2,7 @@ USING: accessors arrays compiler.cfg compiler.cfg.debugger
 compiler.cfg.dominance compiler.cfg.predecessors
 compiler.cfg.ssa.construction.tdmsc kernel namespaces sequences
 tools.test vectors sets ;
+FROM: namespaces => set ;
 IN: compiler.cfg.ssa.construction.tdmsc.tests
 
 : test-tdmsc ( -- )
@@ -70,4 +71,4 @@ V{ } 7 test-bb
 [ ] [ test-tdmsc ] unit-test
 
 [ V{ 2 } ] [ { 2 3 4 5 } [ get ] map merge-set [ number>> ] map ] unit-test
-[ V{ } ] [ { 0 1 6 7 } [ get ] map merge-set ] unit-test
\ No newline at end of file
+[ V{ } ] [ { 0 1 6 7 } [ get ] map merge-set ] unit-test
index 4b459e90fb57749cfc20b43da223217eb1130b5c..4cdc290c41569588420117d878c868ef09f5805e 100644 (file)
@@ -3,6 +3,7 @@
 USING: accessors arrays assocs bit-arrays bit-sets fry
 hashtables hints kernel locals math namespaces sequences sets
 compiler.cfg compiler.cfg.dominance compiler.cfg.rpo ;
+FROM: namespaces => set ;
 IN: compiler.cfg.ssa.construction.tdmsc
 
 ! TDMSC-I algorithm from "A Practical and Fast Iterative Algorithm for
@@ -15,7 +16,7 @@ IN: compiler.cfg.ssa.construction.tdmsc
 SYMBOLS: visited merge-sets levels again? ;
 
 : init-merge-sets ( cfg -- )
-    post-order dup length '[ _ <bit-array> ] H{ } map>assoc merge-sets set ;
+    post-order dup length '[ _ <bit-set> ] H{ } map>assoc merge-sets set ;
 
 : compute-levels ( cfg -- )
     0 over entry>> associate [
@@ -29,15 +30,12 @@ SYMBOLS: visited merge-sets levels again? ;
 
 : level ( bb -- n ) levels get at ; inline
 
-: set-bit ( bit-array n -- )
-    [ t ] 2dip swap set-nth ;
-
 : update-merge-set ( tmp to -- )
     [ merge-sets get ] dip
     '[
         _
-        [ merge-sets get at bit-set-union ]
-        [ dupd number>> set-bit ]
+        [ merge-sets get at union ]
+        [ number>> over adjoin ]
         bi
     ] change-at ;
 
@@ -47,14 +45,14 @@ SYMBOLS: visited merge-sets levels again? ;
         tmp dom-parent to tmp walk
     ] [ lnode ] if ;
 
-: each-incoming-j-edge ( bb quot: ( from to -- ) -- )
+: each-incoming-j-edge ( ... bb quot: ( ... from to -- ... ) -- ... )
     [ [ predecessors>> ] keep ] dip
     '[ _ 2dup j-edge? _ [ 2drop ] if ] each ; inline
 
-: visited? ( pair -- ? ) visited get key? ;
+: visited? ( pair -- ? ) visited get in? ;
 
 : consistent? ( snode lnode -- ? )
-    [ merge-sets get at ] bi@ swap bit-set-subset? ;
+    [ merge-sets get at ] bi@ subset? ;
 
 : (process-edge) ( from to -- )
     f walk [
@@ -65,7 +63,7 @@ SYMBOLS: visited merge-sets levels again? ;
 
 : process-edge ( from to -- )
     2dup 2array dup visited? [ 3drop ] [
-        visited get conjoin
+        visited get adjoin
         (process-edge)
     ] if ;
 
@@ -73,7 +71,7 @@ SYMBOLS: visited merge-sets levels again? ;
     [ process-edge ] each-incoming-j-edge ;
 
 : compute-merge-set-step ( bfo -- )
-    visited get clear-assoc
+    HS{ } clone visited set
     [ process-block ] each ;
 
 : compute-merge-set-loop ( cfg -- )
@@ -82,29 +80,18 @@ SYMBOLS: visited merge-sets levels again? ;
     loop ;
 
 : (merge-set) ( bbs -- flags rpo )
-    merge-sets get '[ _ at ] [ bit-set-union ] map-reduce
+    merge-sets get '[ _ at ] [ union ] map-reduce
     cfg get reverse-post-order ; inline
 
-: filter-by ( flags seq -- seq' )
-    [ drop ] selector [ 2each ] dip ;
-
-HINTS: filter-by { bit-array object } ;
-
 PRIVATE>
 
 : compute-merge-sets ( cfg -- )
     needs-dominance
 
-    H{ } clone visited set
     [ compute-levels ]
     [ init-merge-sets ]
     [ compute-merge-set-loop ]
     tri ;
 
-: merge-set-each ( bbs quot: ( bb -- ) -- )
-    [ (merge-set) ] dip '[
-        swap _ [ drop ] if
-    ] 2each ; inline
-
 : merge-set ( bbs -- bbs' )
-     (merge-set) filter-by ;
+     (merge-set) [ members ] dip nths ;
index d58cebac654d41c1b001d3f70d8f26ea6d10457d..06ae6767cae9e7f5e7471a7b1b261344f31048fa 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs kernel locals fry sequences
 cpu.architecture
@@ -6,8 +6,7 @@ compiler.cfg.rpo
 compiler.cfg.def-use
 compiler.cfg.utilities
 compiler.cfg.registers
-compiler.cfg.instructions
-compiler.cfg.representations ;
+compiler.cfg.instructions ;
 IN: compiler.cfg.ssa.cssa
 
 ! Convert SSA to conventional SSA. This pass runs after representation
@@ -24,7 +23,7 @@ IN: compiler.cfg.ssa.cssa
 :: insert-copy ( bb src rep -- bb dst )
     bb src insert-copy? [
         rep next-vreg-rep :> dst
-        bb [ dst src rep src rep-of emit-conversion ] add-instructions
+        bb [ dst src rep ##copy ] add-instructions
         bb dst
     ] [ bb src ] if ;
 
index d93045da550acb9dbc496a7e7fc81ccddd391ed7..1bb19bd8b062f7d7675b1c4f800e2b0e8caecf1f 100644 (file)
@@ -1,11 +1,11 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs fry kernel namespaces
+USING: accessors arrays assocs fry locals kernel namespaces
 sequences sequences.deep
 sets vectors
+cpu.architecture
 compiler.cfg.rpo
 compiler.cfg.def-use
-compiler.cfg.renaming
 compiler.cfg.registers
 compiler.cfg.dominance
 compiler.cfg.instructions
@@ -15,9 +15,23 @@ compiler.cfg.ssa.interference
 compiler.cfg.ssa.interference.live-ranges
 compiler.cfg.utilities
 compiler.utilities ;
+FROM: namespaces => set ;
 IN: compiler.cfg.ssa.destruction
 
-! Maps vregs to leaders.
+! Because of the design of the register allocator, this pass
+! has three peculiar properties.
+!
+! 1) Instead of renaming vreg usages in the CFG, a map from
+! vregs to canonical representatives is computed. This allows
+! the register allocator to use the original SSA names to get
+! reaching definitions.
+! 2) Useless ##copy instructions, and all ##phi instructions,
+! are eliminated, so the register allocator does not have to
+! remove any redundant operations.
+! 3) A side effect of running this pass is that SSA liveness
+! information is computed, so the register allocator does not
+! need to compute it again.
+
 SYMBOL: leader-map
 
 : leader ( vreg -- vreg' ) leader-map get compress-path ;
@@ -27,91 +41,104 @@ SYMBOL: class-element-map
 
 : class-elements ( vreg -- elts ) class-element-map get at ;
 
+<PRIVATE
+
 ! Sequence of vreg pairs
 SYMBOL: copies
 
+: value-of ( vreg -- value )
+    insn-of dup ##tagged>integer? [ src>> ] [ dst>> ] if ;
+
 : init-coalescing ( -- )
-    H{ } clone leader-map set
-    H{ } clone class-element-map set
+    defs get
+    [ [ drop dup ] assoc-map leader-map set ]
+    [ [ [ dup dup value-of ] dip <vreg-info> 1array ] assoc-map class-element-map set ] bi
     V{ } clone copies set ;
 
-: classes-interfere? ( vreg1 vreg2 -- ? )
-    [ leader ] bi@ 2dup eq? [ 2drop f ] [
-        [ class-elements flatten ] bi@ sets-interfere?
-    ] if ;
-
-: update-leaders ( vreg1 vreg2 -- )
+: coalesce-leaders ( vreg1 vreg2 -- )
+    ! leader2 becomes the leader.
     swap leader-map get set-at ;
 
-: merge-classes ( vreg1 vreg2 -- )
-    [ [ class-elements ] bi@ push ]
-    [ drop class-element-map get delete-at ] 2bi ;
+: coalesce-elements ( merged vreg1 vreg2 -- )
+    ! delete leader1's class, and set leader2's class to merged.
+    class-element-map get [ delete-at ] [ set-at ] bi-curry bi* ;
 
-: eliminate-copy ( vreg1 vreg2 -- )
-    [ leader ] bi@
-    2dup eq? [ 2drop ] [
-        [ update-leaders ]
-        [ merge-classes ]
-        2bi
-    ] if ;
+: coalesce-vregs ( merged leader1 leader2 -- )
+    [ coalesce-leaders ] [ coalesce-elements ] 2bi ;
 
-: introduce-vreg ( vreg -- )
-    [ leader-map get conjoin ]
-    [ [ 1vector ] keep class-element-map get set-at ] bi ;
+:: maybe-eliminate-copy ( vreg1 vreg2 -- )
+    ! Eliminate a copy of possible.
+    vreg1 leader :> vreg1
+    vreg2 leader :> vreg2
+    vreg1 vreg2 eq? [
+        vreg1 class-elements vreg2 class-elements sets-interfere?
+        [ drop ] [ vreg1 vreg2 coalesce-vregs ] if
+    ] unless ;
 
 GENERIC: prepare-insn ( insn -- )
 
-: try-to-coalesce ( dst src -- ) 2array copies get push ;
+: maybe-eliminate-copy-later ( dst src -- )
+    2array copies get push ;
 
-M: insn prepare-insn
-    [ defs-vreg ] [ uses-vregs ] bi
-    2dup empty? not and [
-        first 
-        2dup [ rep-of ] bi@ eq?
-        [ try-to-coalesce ] [ 2drop ] if
-    ] [ 2drop ] if ;
+M: insn prepare-insn drop ;
+
+M: vreg-insn prepare-insn
+    [ temp-vregs [ leader-map get conjoin ] each ]
+    [
+        [ defs-vreg ] [ uses-vregs ] bi
+        2dup empty? not and [
+            first
+            2dup [ rep-of reg-class-of ] bi@ eq?
+            [ maybe-eliminate-copy-later ] [ 2drop ] if
+        ] [ 2drop ] if
+    ] bi ;
 
 M: ##copy prepare-insn
-    [ dst>> ] [ src>> ] bi try-to-coalesce ;
+    [ dst>> ] [ src>> ] bi maybe-eliminate-copy-later ;
+
+M: ##tagged>integer prepare-insn
+    [ dst>> ] [ src>> ] bi maybe-eliminate-copy ;
 
 M: ##phi prepare-insn
     [ dst>> ] [ inputs>> values ] bi
-    [ eliminate-copy ] with each ;
+    [ maybe-eliminate-copy ] with each ;
 
 : prepare-block ( bb -- )
     instructions>> [ prepare-insn ] each ;
 
 : prepare-coalescing ( cfg -- )
     init-coalescing
-    defs get keys [ introduce-vreg ] each
     [ prepare-block ] each-basic-block ;
 
 : process-copies ( -- )
-    copies get [
-        2dup classes-interfere?
-        [ 2drop ] [ eliminate-copy ] if
-    ] assoc-each ;
+    copies get [ maybe-eliminate-copy ] assoc-each ;
 
-: useless-copy? ( ##copy -- ? )
-    dup ##copy? [ [ dst>> ] [ src>> ] bi eq? ] [ drop f ] if ;
+GENERIC: useful-insn? ( insn -- ? )
 
-: perform-renaming ( cfg -- )
-    leader-map get keys [ dup leader ] H{ } map>assoc renamings set
-    [
-        instructions>> [
-            [ rename-insn-defs ]
-            [ rename-insn-uses ]
-            [ [ useless-copy? ] [ ##phi? ] bi or not ] tri
-        ] filter! drop
-    ] each-basic-block ;
+: useful-copy? ( insn -- ? )
+    [ dst>> leader ] [ src>> leader ] bi eq? not ; inline
+
+M: ##copy useful-insn? useful-copy? ;
+
+M: ##tagged>integer useful-insn? useful-copy? ;
+
+M: ##phi useful-insn? drop f ;
+
+M: insn useful-insn? drop t ;
+
+: cleanup-cfg ( cfg -- )
+    [ [ useful-insn? ] filter! ] simple-optimization ;
+
+PRIVATE>
 
 : destruct-ssa ( cfg -- cfg' )
     needs-dominance
 
     dup construct-cssa
     dup compute-defs
-    compute-ssa-live-sets
+    dup compute-insns
+    dup compute-ssa-live-sets
     dup compute-live-ranges
     dup prepare-coalescing
     process-copies
-    dup perform-renaming ;
+    dup cleanup-cfg ;
index 2f13331024c3a957baff7e1e1736c5124d9642d8..4e3da1c6dcf1fea0fd640562714133d3dac8ff9a 100644 (file)
@@ -2,17 +2,35 @@ USING: accessors compiler.cfg compiler.cfg.debugger
 compiler.cfg.def-use compiler.cfg.dominance
 compiler.cfg.instructions compiler.cfg.liveness.ssa
 compiler.cfg.registers compiler.cfg.predecessors
-compiler.cfg.ssa.interference
-compiler.cfg.ssa.interference.live-ranges cpu.architecture
-kernel namespaces tools.test ;
+compiler.cfg.comparisons compiler.cfg.ssa.interference
+compiler.cfg.ssa.interference.private
+compiler.cfg.ssa.interference.live-ranges
+cpu.architecture kernel namespaces tools.test alien.c-types
+arrays sequences slots ;
 IN: compiler.cfg.ssa.interference.tests
 
 : test-interference ( -- )
     cfg new 0 get >>entry
-    compute-ssa-live-sets
+    dup compute-ssa-live-sets
     dup compute-defs
+    dup compute-insns
     compute-live-ranges ;
 
+: <test-vreg-info> ( vreg -- info )
+    [ ] [ insn-of dup ##tagged>integer? [ src>> ] [ dst>> ] if ] [ def-of ] tri
+    <vreg-info> ;
+
+: test-vregs-intersect? ( vreg1 vreg2 -- ? )
+    [ <test-vreg-info> ] bi@ vregs-intersect? ;
+
+: test-vregs-interfere? ( vreg1 vreg2 -- ? )
+    [ <test-vreg-info> ] bi@
+    [ blue >>color ] [ red >>color ] bi*
+    vregs-interfere? ;
+
+: test-sets-interfere? ( seq1 seq2 -- merged ? )
+    [ [ <test-vreg-info> ] map ] bi@ sets-interfere? ;
+
 V{
     T{ ##peek f 0 D 0 }
     T{ ##peek f 2 D 0 }
@@ -34,17 +52,310 @@ V{
 
 [ ] [ test-interference ] unit-test
 
-[ f ] [ 0 1 vregs-interfere? ] unit-test
-[ f ] [ 1 0 vregs-interfere? ] unit-test
-[ f ] [ 2 3 vregs-interfere? ] unit-test
-[ f ] [ 3 2 vregs-interfere? ] unit-test
-[ t ] [ 0 2 vregs-interfere? ] unit-test
-[ t ] [ 2 0 vregs-interfere? ] unit-test
-[ f ] [ 1 3 vregs-interfere? ] unit-test
-[ f ] [ 3 1 vregs-interfere? ] unit-test
-[ t ] [ 3 4 vregs-interfere? ] unit-test
-[ t ] [ 4 3 vregs-interfere? ] unit-test
-[ t ] [ 3 5 vregs-interfere? ] unit-test
-[ t ] [ 5 3 vregs-interfere? ] unit-test
-[ f ] [ 3 6 vregs-interfere? ] unit-test
-[ f ] [ 6 3 vregs-interfere? ] unit-test
\ No newline at end of file
+[ f ] [ 0 1 test-vregs-intersect? ] unit-test
+[ f ] [ 1 0 test-vregs-intersect? ] unit-test
+[ f ] [ 2 3 test-vregs-intersect? ] unit-test
+[ f ] [ 3 2 test-vregs-intersect? ] unit-test
+[ t ] [ 0 2 test-vregs-intersect? ] unit-test
+[ t ] [ 2 0 test-vregs-intersect? ] unit-test
+[ f ] [ 1 3 test-vregs-intersect? ] unit-test
+[ f ] [ 3 1 test-vregs-intersect? ] unit-test
+[ t ] [ 3 4 test-vregs-intersect? ] unit-test
+[ t ] [ 4 3 test-vregs-intersect? ] unit-test
+[ t ] [ 3 5 test-vregs-intersect? ] unit-test
+[ t ] [ 5 3 test-vregs-intersect? ] unit-test
+[ f ] [ 3 6 test-vregs-intersect? ] unit-test
+[ f ] [ 6 3 test-vregs-intersect? ] unit-test
+
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+
+V{
+    T{ ##inc-d f -3 }
+    T{ ##peek f 12 D -2 }
+    T{ ##peek f 23 D -1 }
+    T{ ##sar-imm f 13 23 4 }
+    T{ ##peek f 24 D -3 }
+    T{ ##sar-imm f 14 24 4 }
+    T{ ##mul f 15 13 13 }
+    T{ ##mul f 16 15 15 }
+    T{ ##tagged>integer f 17 12 }
+    T{ ##store-memory f 16 17 14 0 7 int-rep uchar }
+    T{ ##branch }
+} 1 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 2 test-bb
+
+0 1 edge
+1 2 edge
+
+[ ] [ test-interference ] unit-test
+
+[ t ] [ { 15 } { 23 13 } test-sets-interfere? nip ] unit-test
+
+V{
+    T{ ##prologue f }
+    T{ ##branch f }
+} 0 test-bb
+
+V{
+    T{ ##inc-d f 2 }
+    T{ ##peek f 32 D 2 }
+    T{ ##load-reference f 33 ##check-nursery-branch }
+    T{ ##load-integer f 34 11 }
+    T{ ##tagged>integer f 35 32 }
+    T{ ##and-imm f 36 35 15 }
+    T{ ##compare-integer-imm-branch f 36 7 cc= }
+} 1 test-bb
+
+V{
+    T{ ##slot-imm f 48 32 1 7 }
+    T{ ##slot-imm f 50 48 1 2 }
+    T{ ##sar-imm f 65 50 4 }
+    T{ ##compare-integer-branch f 34 65 cc<= }
+} 2 test-bb
+
+V{
+    T{ ##inc-d f -2 }
+    T{ ##slot-imm f 57 48 11 2 }
+    T{ ##compare f 58 33 57 cc= 20 }
+    T{ ##replace f 58 D 0 }
+    T{ ##branch f }
+} 3 test-bb
+
+V{
+    T{ ##epilogue f }
+    T{ ##return f }
+} 4 test-bb
+
+V{
+    T{ ##inc-d f -2 }
+    T{ ##replace-imm f f D 0 }
+    T{ ##branch f }
+} 5 test-bb
+
+V{
+    T{ ##epilogue f }
+    T{ ##return f }
+} 6 test-bb
+
+V{
+    T{ ##inc-d f -2 }
+    T{ ##replace-imm f f D 0 }
+    T{ ##branch f }
+} 7 test-bb
+
+V{
+    T{ ##epilogue f }
+    T{ ##return f }
+} 8 test-bb
+
+0 1 edge
+1 { 2 7 } edges
+2 { 3 5 } edges
+3 4 edge
+5 6 edge
+7 8 edge
+
+[ ] [ test-interference ] unit-test
+
+[ f ] [ { 48 } { 32 35 } test-sets-interfere? nip ] unit-test
+
+TUPLE: bab ;
+TUPLE: gfg { x bab } ;
+: bah ( -- x ) f ;
+
+V{
+    T{ ##prologue }
+    T{ ##branch }
+} 0 test-bb
+
+V{
+    T{ ##check-nursery-branch f 16 cc<= 75 76 }
+} 1 test-bb
+
+V{
+    T{ ##save-context f 77 78 }
+    T{ ##call-gc f { } }
+    T{ ##branch }
+} 2 test-bb
+
+V{
+    T{ ##inc-d f 1 }
+    T{ ##load-reference f 37 T{ bab } }
+    T{ ##load-reference f 38 { gfg 1 1 tuple 57438726 gfg 7785907 } }
+    T{ ##allot f 40 12 tuple 4 }
+    T{ ##set-slot-imm f 38 40 1 7 }
+    T{ ##set-slot-imm f 37 40 2 7 }
+    T{ ##replace f 40 D 0 }
+    T{ ##branch }
+} 3 test-bb
+
+V{
+    T{ ##call f bah }
+    T{ ##branch }
+} 4 test-bb
+
+V{
+    T{ ##inc-r f 1 }
+    T{ ##inc-d f 1 }
+    T{ ##peek f 43 D 1 }
+    T{ ##peek f 44 D 2 }
+    T{ ##tagged>integer f 45 43 }
+    T{ ##and-imm f 46 45 15 }
+    T{ ##compare-integer-imm-branch f 46 7 cc= }
+} 5 test-bb
+
+V{
+    T{ ##inc-d f -1 }
+    T{ ##slot-imm f 58 43 1 7 }
+    T{ ##slot-imm f 60 58 7 2 }
+    T{ ##compare-imm-branch f 60 bab cc= }
+} 6 test-bb
+
+V{
+    T{ ##branch }
+} 7 test-bb
+
+V{
+    T{ ##inc-r f -1 }
+    T{ ##inc-d f -1 }
+    T{ ##set-slot-imm f 43 44 2 7 }
+    T{ ##write-barrier-imm f 44 2 7 34 35 }
+    T{ ##branch }
+} 8 test-bb
+
+V{
+    T{ ##epilogue }
+    T{ ##return }
+} 9 test-bb
+
+V{
+    T{ ##inc-d f 1 }
+    T{ ##replace f 44 R 0 }
+    T{ ##replace-imm f bab D 0 }
+    T{ ##branch }
+} 10 test-bb
+
+V{
+    T{ ##call f bad-slot-value }
+    T{ ##branch }
+} 11 test-bb
+
+V{
+    T{ ##no-tco }
+} 12 test-bb
+
+V{
+    T{ ##inc-d f -1 }
+    T{ ##branch }
+} 13 test-bb
+
+V{
+    T{ ##inc-d f 1 }
+    T{ ##replace f 44 R 0 }
+    T{ ##replace-imm f bab D 0 }
+    T{ ##branch }
+} 14 test-bb
+
+V{
+    T{ ##call f bad-slot-value }
+    T{ ##branch }
+} 15 test-bb
+
+V{
+    T{ ##no-tco }
+} 16 test-bb
+
+0 1 edge
+1 { 3 2 } edges
+2 3 edge
+3 4 edge
+4 5 edge
+5 { 6 13 } edges
+6 { 7 10 } edges
+7 8 edge
+8 9 edge
+10 11 edge
+11 12 edge
+13 14 edge
+14 15 edge
+15 16 edge
+
+[ ] [ test-interference ] unit-test
+
+[ t ] [ 43 45 test-vregs-intersect? ] unit-test
+[ f ] [ 43 45 test-vregs-interfere? ] unit-test
+
+[ t ] [ 43 46 test-vregs-intersect? ] unit-test
+[ t ] [ 43 46 test-vregs-interfere? ] unit-test
+
+[ f ] [ 45 46 test-vregs-intersect? ] unit-test
+[ f ] [ 45 46 test-vregs-interfere? ] unit-test
+
+[ f ] [ { 43 } { 45 } test-sets-interfere? nip ] unit-test
+
+[ t f ] [
+    { 46 } { 43 } { 45 }
+    [ [ <test-vreg-info> ] map ] tri@
+    sets-interfere? [ sets-interfere? nip ] dip
+] unit-test
+
+V{
+    T{ ##prologue f }
+    T{ ##branch f }
+} 0 test-bb
+
+V{
+    T{ ##inc-d f 1 }
+    T{ ##peek f 31 D 1 }
+    T{ ##sar-imm f 16 31 4 }
+    T{ ##load-integer f 17 0 }
+    T{ ##copy f 33 17 int-rep }
+    T{ ##branch f }
+} 1 test-bb
+
+V{
+    T{ ##phi f 21 H{ { 1 33 } { 3 32 } } }
+    T{ ##compare-integer-branch f 21 16 cc< }
+} 2 test-bb
+
+V{
+    T{ ##add-imm f 27 21 1 }
+    T{ ##copy f 32 27 int-rep }
+    T{ ##branch f }
+} 3 test-bb
+
+V{
+    T{ ##inc-d f -2 }
+    T{ ##branch f }
+} 4 test-bb
+
+V{
+    T{ ##epilogue f }
+    T{ ##return f }
+} 5 test-bb
+
+0 1 edge
+1 2 edge
+2 { 3 4 } edges
+3 2 edge
+4 5 edge
+
+[ ] [ test-interference ] unit-test
+
+[ f f ] [
+    { 33 } { 21 } { 32 }
+    [ [ <test-vreg-info> ] map ] tri@
+    sets-interfere? [ sets-interfere? nip ] dip
+] unit-test
+
+[ f ] [ 33 21 test-vregs-intersect? ] unit-test
+[ f ] [ 32 21 test-vregs-intersect? ] unit-test
+[ f ] [ 32 33 test-vregs-intersect? ] unit-test
\ No newline at end of file
index a76b55cd83dcc8fecd489af7f800e10d05ea85ae..0beb9ef01035d03e6a273121ea7b99b506158233 100644 (file)
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs combinators combinators.short-circuit fry
-kernel math math.order sorting namespaces sequences locals
-compiler.cfg.def-use compiler.cfg.dominance
-compiler.cfg.ssa.interference.live-ranges ;
+USING: accessors arrays assocs combinators
+combinators.short-circuit fry kernel math math.order sorting
+sorting.slots namespaces sequences locals compiler.cfg.def-use
+compiler.cfg.dominance compiler.cfg.ssa.interference.live-ranges ;
 IN: compiler.cfg.ssa.interference
 
-! Interference testing using SSA properties. Actually the only SSA property
-! used here is that definitions dominate uses; because of this, the input
-! is allowed to have multiple definitions of each vreg as long as they're
-! all in the same basic block. This is needed because two-operand conversion
-! runs before coalescing, which uses SSA interference testing.
+! Interference testing using SSA properties.
+!
+! Based on:
+!
+! Revisiting Out-of-SSA Translation for Correctness, Code Quality, and Efficiency
+! http://hal.archives-ouvertes.fr/docs/00/34/99/25/PDF/OutSSA-RR.pdf
+
+TUPLE: vreg-info vreg value def-index bb pre-of color equal-anc-in equal-anc-out ;
+
+:: <vreg-info> ( vreg value bb -- info )
+    vreg-info new
+        vreg >>vreg
+        bb >>bb
+        value >>value
+        bb pre-of >>pre-of
+        vreg bb def-index >>def-index ;
+
 <PRIVATE
 
-:: kill-after-def? ( vreg1 vreg2 bb -- ? )
+! Our dominance pass computes dominance information on a
+! per-basic block level. Rig up a more fine-grained dominance
+! test here.
+: locally-dominates? ( vreg1 vreg2 -- ? )
+    [ def-index>> ] bi@ < ;
+
+:: vreg-dominates? ( vreg1 vreg2 -- ? )
+    vreg1 bb>> :> bb1
+    vreg2 bb>> :> bb2
+    bb1 bb2 eq?
+    [ vreg1 vreg2 locally-dominates? ] [ bb1 bb2 dominates? ] if ;
+
+! Testing individual vregs for live range intersection.
+: kill-after-def? ( vreg1 vreg2 bb -- ? )
     ! If first register is used after second one is defined, they interfere.
     ! If they are used in the same instruction, no interference. If the
     ! instruction is a def-is-use-insn, then there will be a use at +1
     ! (instructions are 2 apart) and so outputs will interfere with
     ! inputs.
-    vreg1 bb kill-index
-    vreg2 bb def-index > ;
+    [ kill-index ] [ def-index ] bi-curry bi* > ;
 
-:: interferes-same-block? ( vreg1 vreg2 bb1 bb2 -- ? )
-    ! If both are defined in the same basic block, they interfere if their
-    ! local live ranges intersect.
-    vreg1 bb1 def-index
-    vreg2 bb1 def-index <
-    [ vreg1 vreg2 ] [ vreg2 vreg1 ] if
-    bb1 kill-after-def? ;
-
-: interferes-first-dominates? ( vreg1 vreg2 bb1 bb2 -- ? )
+: interferes-first-dominates? ( vreg1 vreg2 -- ? )
     ! If vreg1 dominates vreg2, then they interfere if vreg2's definition
     ! occurs before vreg1 is killed.
-    nip
-    kill-after-def? ;
+    [ [ vreg>> ] bi@ ] [ nip bb>> ] 2bi kill-after-def? ;
 
-: interferes-second-dominates? ( vreg1 vreg2 bb1 bb2 -- ? )
+: interferes-second-dominates? ( vreg1 vreg2 -- ? )
     ! If vreg2 dominates vreg1, then they interfere if vreg1's definition
     ! occurs before vreg2 is killed.
-    drop
-    swapd kill-after-def? ;
-
-PRIVATE>
+    swap interferes-first-dominates? ;
 
-: vregs-interfere? ( vreg1 vreg2 -- ? )
-    2dup [ def-of ] bi@ {
-        { [ 2dup eq? ] [ interferes-same-block? ] }
-        { [ 2dup dominates? ] [ interferes-first-dominates? ] }
-        { [ 2dup swap dominates? ] [ interferes-second-dominates? ] }
-        [ 2drop 2drop f ]
+: interferes-same-block? ( vreg1 vreg2 -- ? )
+    ! If both are defined in the same basic block, they interfere if their
+    ! local live ranges intersect.
+    2dup locally-dominates? [ swap ] unless
+    interferes-first-dominates? ;
+
+:: vregs-intersect? ( vreg1 vreg2 -- ? )
+    vreg1 bb>> :> bb1
+    vreg2 bb>> :> bb2
+    {
+        { [ bb1 bb2 eq? ] [ vreg1 vreg2 interferes-same-block? ] }
+        { [ bb1 bb2 dominates? ] [ vreg1 vreg2 interferes-first-dominates? ] }
+        { [ bb2 bb1 dominates? ] [ vreg1 vreg2 interferes-second-dominates? ] }
+        [ f ]
     } cond ;
 
-<PRIVATE
-
-! Debug this stuff later
+! Value-based interference test.
+: chain-intersect ( vreg1 vreg2 -- vreg )
+    [ 2dup { [ nip ] [ vregs-intersect? not ] } 2&& ]
+    [ equal-anc-in>> ]
+    while nip ;
 
-: quadratic-test? ( seq1 seq2 -- ? ) [ length ] bi@ + 10 < ;
+: update-equal-anc-out ( vreg1 vreg2 -- )
+    dupd chain-intersect >>equal-anc-out drop ;
 
-: quadratic-test ( seq1 seq2 -- ? )
-    '[ _ [ vregs-interfere? ] with any? ] any? ;
+: same-sets? ( vreg1 vreg2 -- ? )
+    [ color>> ] bi@ eq? ;
 
-: sort-vregs-by-bb ( vregs -- alist )
-    defs get
-    '[ dup _ at ] { } map>assoc
-    [ second pre-of ] sort-with ;
+: same-values? ( vreg1 vreg2 -- ? )
+    [ value>> ] bi@ eq? ;
 
-: ?last ( seq -- elt/f ) [ f ] [ last ] if-empty ; inline
-
-: find-parent ( dom current -- parent )
+: vregs-interfere? ( vreg1 vreg2 -- ? )
+    [ f >>equal-anc-out ] dip
+
+    2dup same-sets? [ equal-anc-out>> ] when
+
+    2dup same-values?
+    [ update-equal-anc-out f ] [ chain-intersect >boolean ] if ;
+
+! Merging lists of vregs sorted by dominance.
+M: vreg-info <=> ( vreg1 vreg2 -- <=> )
+    { { pre-of>> <=> } { def-index>> <=> } } compare-slots ;
+
+SYMBOLS: blue red ;
+
+TUPLE: iterator seq n ;
+: <iterator> ( seq -- iterator ) 0 iterator boa ; inline
+: done? ( iterator -- ? ) [ seq>> length ] [ n>> ] bi = ; inline
+: this ( iterator -- obj ) [ n>> ] [ seq>> ] bi nth ; inline
+: ++ ( iterator -- ) [ 1 + ] change-n drop ; inline
+: take ( iterator -- obj ) [ this ] [ ++ ] bi ; inline
+
+: blue-smaller? ( blue red -- ? )
+    [ this ] bi@ before? ; inline
+
+: take-blue? ( blue red -- ? )
+    {
+        [ nip done? ]
+        [
+            {
+                [ drop done? not ]
+                [ blue-smaller? ]
+            } 2&&
+        ]
+    } 2|| ; inline
+
+: merge-sets ( blue red -- seq )
+    [ <iterator> ] bi@
+    [ 2dup [ done? ] both? not ]
+    [
+        2dup take-blue?
+        [ over take blue >>color ]
+        [ dup take red >>color ]
+        if
+    ] produce 2nip ;
+
+: update-for-merge ( seq -- )
+    [
+        dup [ equal-anc-in>> ] [ equal-anc-out>> ] bi
+        2dup and [ [ vreg-dominates? ] most ] [ or ] if
+        >>equal-anc-in
+        drop
+    ] each ;
+
+! Linear-time live range intersection test in a merged set.
+: find-parent ( dom current -- vreg )
     over empty? [ 2drop f ] [
-        over last over dominates? [ drop last ] [
-            over pop* find-parent
-        ] if
+        over last over vreg-dominates?
+        [ drop last ] [ over pop* find-parent ] if
     ] if ;
 
-:: linear-test ( seq1 seq2 -- ? )
-    ! Instead of sorting, SSA destruction should keep equivalence
-    ! classes sorted by merging them on append
+:: linear-interference-test ( seq -- ? )
     V{ } clone :> dom
-    seq1 seq2 append sort-vregs-by-bb [| pair |
-        pair first :> current
-        dom current find-parent
-        dup [ current vregs-interfere? ] when
-        [ t ] [ current dom push f ] if
+    seq [| vreg |
+        dom vreg find-parent
+        { [ ] [ vreg same-sets? not ] [ vreg swap vregs-interfere? ] } 1&&
+        [ t ] [ vreg dom push f ] if
     ] any? ;
 
+: sets-interfere-1? ( seq1 seq2 -- merged/f ? )
+    [ first ] bi@
+    2dup before? [ swap ] unless
+    2dup same-values? [
+        2dup equal-anc-in<<
+        2array f
+    ] [
+        2dup vregs-intersect?
+        [ 2drop f t ] [ 2array f ] if
+    ] if ;
+
 PRIVATE>
 
-: sets-interfere? ( seq1 seq2 -- ? )
-    quadratic-test ;
\ No newline at end of file
+: sets-interfere? ( seq1 seq2 -- merged/f ? )
+    2dup [ length 1 = ] both? [ sets-interfere-1? ] [
+        merge-sets dup linear-interference-test
+        [ drop f t ] [ dup update-for-merge f ] if
+    ] if ;
\ No newline at end of file
index ef249142690cf83d82f4d742b7774b84ee62c660..d0c729556d97d7ccbae58957b7e1efe0aea8198f 100644 (file)
@@ -1,8 +1,9 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs fry kernel namespaces sequences math
 arrays compiler.cfg.def-use compiler.cfg.instructions
-compiler.cfg.liveness.ssa compiler.cfg.rpo compiler.cfg.dominance ;
+compiler.cfg.liveness.ssa compiler.cfg.rpo
+compiler.cfg.dominance compiler.cfg ;
 IN: compiler.cfg.ssa.interference.live-ranges
 
 ! Live ranges for interference testing
@@ -12,31 +13,35 @@ IN: compiler.cfg.ssa.interference.live-ranges
 SYMBOLS: local-def-indices local-kill-indices ;
 
 : record-def ( n insn -- )
-    ! We allow multiple defs of a vreg as long as they're
-    ! all in the same basic block
-    defs-vreg dup [
-        local-def-indices get 2dup key?
-        [ 3drop ] [ set-at ] if
-    ] [ 2drop ] if ;
+    defs-vreg dup [ local-def-indices get set-at ] [ 2drop ] if ;
 
 : record-uses ( n insn -- )
     ! Record live intervals so that all but the first input interfere
     ! with the output. This lets us coalesce the output with the
     ! first input.
-    [ uses-vregs ] [ def-is-use-insn? ] bi over empty? [ 3drop ] [
+    dup uses-vregs dup empty? [ 3drop ] [
+        swap def-is-use-insn?
         [ [ first local-kill-indices get set-at ] [ rest-slice ] 2bi ] unless
         [ 1 + ] dip [ local-kill-indices get set-at ] with each
     ] if ;
 
-: visit-insn ( insn n -- )
-    2 * swap [ record-def ] [ record-uses ] 2bi ;
+GENERIC: record-insn ( n insn -- )
+
+M: ##phi record-insn
+    record-def ;
+
+M: vreg-insn record-insn
+    [ 2 * ] dip [ record-def ] [ record-uses ] 2bi ;
+
+M: insn record-insn
+    2drop ;
 
 SYMBOLS: def-indices kill-indices ;
 
 : compute-local-live-ranges ( bb -- )
     H{ } clone local-def-indices set
     H{ } clone local-kill-indices set
-    [ instructions>> [ visit-insn ] each-index ]
+    [ instructions>> [ swap record-insn ] each-index ]
     [ [ local-def-indices get ] dip def-indices get set-at ]
     [ [ local-kill-indices get ] dip kill-indices get set-at ]
     tri ;
diff --git a/basis/compiler/cfg/ssa/liveness/liveness-tests.factor b/basis/compiler/cfg/ssa/liveness/liveness-tests.factor
deleted file mode 100644 (file)
index bc58070..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-! Copyright (C) 2009 Daniel Ehrenberg
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel tools.test namespaces sequences vectors accessors sets
-arrays math.ranges assocs
-cpu.architecture
-compiler.cfg
-compiler.cfg.ssa.liveness.private
-compiler.cfg.ssa.liveness 
-compiler.cfg.debugger
-compiler.cfg.instructions
-compiler.cfg.predecessors
-compiler.cfg.registers
-compiler.cfg.dominance
-compiler.cfg.def-use ;
-IN: compiler.cfg.ssa.liveness
-
-[ t ] [ { 1 } 1 only? ] unit-test
-[ t ] [ { } 1 only? ] unit-test
-[ f ] [ { 2 1 } 1 only? ] unit-test
-[ f ] [ { 2 } 1 only? ] unit-test
-
-: test-liveness ( -- )
-    cfg new 0 get >>entry
-    dup compute-defs
-    dup compute-uses
-    needs-dominance
-    precompute-liveness ;
-
-V{
-    T{ ##peek f 0 D 0 }
-    T{ ##replace f 0 D 0 }
-    T{ ##replace f 1 D 1 }
-} 0 test-bb
-
-V{
-    T{ ##replace f 2 D 0 }
-} 1 test-bb
-
-V{
-    T{ ##replace f 3 D 0 }
-} 2 test-bb
-
-0 { 1 2 } edges
-
-[ ] [ test-liveness ] unit-test
-
-[ H{ } ] [ back-edge-targets get ] unit-test
-[ t ] [ 0 get R_q { 0 1 2 } [ get ] map unique = ] unit-test
-[ t ] [ 1 get R_q { 1 } [ get ] map unique = ] unit-test
-[ t ] [ 2 get R_q { 2 } [ get ] map unique = ] unit-test
-
-: self-T_q ( n -- ? )
-    get [ T_q ] [ 1array unique ] bi = ;
-
-[ t ] [ 0 self-T_q ] unit-test
-[ t ] [ 1 self-T_q ] unit-test
-[ t ] [ 2 self-T_q ] unit-test
-
-[ f ] [ 0 0 get live-in? ] unit-test
-[ t ] [ 1 0 get live-in? ] unit-test
-[ t ] [ 2 0 get live-in? ] unit-test
-[ t ] [ 3 0 get live-in? ] unit-test
-
-[ f ] [ 0 0 get live-out? ] unit-test
-[ f ] [ 1 0 get live-out? ] unit-test
-[ t ] [ 2 0 get live-out? ] unit-test
-[ t ] [ 3 0 get live-out? ] unit-test
-
-[ f ] [ 0 1 get live-in? ] unit-test
-[ f ] [ 1 1 get live-in? ] unit-test
-[ t ] [ 2 1 get live-in? ] unit-test
-[ f ] [ 3 1 get live-in? ] unit-test
-
-[ f ] [ 0 1 get live-out? ] unit-test
-[ f ] [ 1 1 get live-out? ] unit-test
-[ f ] [ 2 1 get live-out? ] unit-test
-[ f ] [ 3 1 get live-out? ] unit-test
-
-[ f ] [ 0 2 get live-in? ] unit-test
-[ f ] [ 1 2 get live-in? ] unit-test
-[ f ] [ 2 2 get live-in? ] unit-test
-[ t ] [ 3 2 get live-in? ] unit-test
-
-[ f ] [ 0 2 get live-out? ] unit-test
-[ f ] [ 1 2 get live-out? ] unit-test
-[ f ] [ 2 2 get live-out? ] unit-test
-[ f ] [ 3 2 get live-out? ] unit-test
-
-V{ } 0 test-bb
-V{ } 1 test-bb
-V{ } 2 test-bb
-V{ } 3 test-bb
-V{
-    T{ ##phi f 2 H{ { 2 0 } { 3 1 } } }
-} 4 test-bb
-test-diamond
-
-[ ] [ test-liveness ] unit-test
-
-[ t ] [ 0 1 get live-in? ] unit-test
-[ t ] [ 1 1 get live-in? ] unit-test
-[ f ] [ 2 1 get live-in? ] unit-test
-
-[ t ] [ 0 1 get live-out? ] unit-test
-[ t ] [ 1 1 get live-out? ] unit-test
-[ f ] [ 2 1 get live-out? ] unit-test
-
-[ t ] [ 0 2 get live-in? ] unit-test
-[ f ] [ 1 2 get live-in? ] unit-test
-[ f ] [ 2 2 get live-in? ] unit-test
-
-[ f ] [ 0 2 get live-out? ] unit-test
-[ f ] [ 1 2 get live-out? ] unit-test
-[ f ] [ 2 2 get live-out? ] unit-test
-
-[ f ] [ 0 3 get live-in? ] unit-test
-[ t ] [ 1 3 get live-in? ] unit-test
-[ f ] [ 2 3 get live-in? ] unit-test
-
-[ f ] [ 0 3 get live-out? ] unit-test
-[ f ] [ 1 3 get live-out? ] unit-test
-[ f ] [ 2 3 get live-out? ] unit-test
-
-[ f ] [ 0 4 get live-in? ] unit-test
-[ f ] [ 1 4 get live-in? ] unit-test
-[ f ] [ 2 4 get live-in? ] unit-test
-
-[ f ] [ 0 4 get live-out? ] unit-test
-[ f ] [ 1 4 get live-out? ] unit-test
-[ f ] [ 2 4 get live-out? ] unit-test
-
-! This is the CFG in Figure 3 from the paper
-V{ } 0 test-bb
-V{ } 1 test-bb
-0 1 edge
-V{ } 2 test-bb
-1 2 edge
-V{
-    T{ ##peek f 0 D 0 }
-    T{ ##peek f 1 D 0 }
-    T{ ##peek f 2 D 0 }
-} 3 test-bb
-V{ } 11 test-bb
-2 { 3 11 } edges
-V{
-    T{ ##replace f 0 D 0 }
-} 4 test-bb
-V{ } 8 test-bb
-3 { 8 4 } edges
-V{
-    T{ ##replace f 1 D 0 }
-} 9 test-bb
-8 9 edge
-V{
-    T{ ##replace f 2 D 0 }
-} 5 test-bb
-4 5 edge
-V{ } 10 test-bb
-V{ } 6 test-bb
-5 6 edge
-9 { 6 10 } edges
-V{ } 7 test-bb
-6 { 5 7 } edges
-10 8 edge
-7 2 edge
-
-[ ] [ test-liveness ] unit-test
-
-[ t ] [ 1 get R_q 1 11 [a,b] [ get ] map unique = ] unit-test
-[ t ] [ 2 get R_q 2 11 [a,b] [ get ] map unique = ] unit-test
-[ t ] [ 3 get R_q 3 10 [a,b] [ get ] map unique = ] unit-test
-[ t ] [ 4 get R_q 4 7 [a,b] [ get ] map unique = ] unit-test
-[ t ] [ 5 get R_q 5 7 [a,b] [ get ] map unique = ] unit-test
-[ t ] [ 6 get R_q 6 7 [a,b] [ get ] map unique = ] unit-test
-[ t ] [ 7 get R_q 7 7 [a,b] [ get ] map unique = ] unit-test
-[ t ] [ 8 get R_q 6 10 [a,b] [ get ] map unique = ] unit-test
-[ t ] [ 9 get R_q 8 6 10 [a,b] remove [ get ] map unique = ] unit-test
-[ t ] [ 10 get R_q 10 10 [a,b] [ get ] map unique = ] unit-test
-[ t ] [ 11 get R_q 11 11 [a,b] [ get ] map unique = ] unit-test
-
-[ t ] [ 1 get T_q 1 get 1array unique = ] unit-test
-[ t ] [ 2 get T_q 2 get 1array unique = ] unit-test
-[ t ] [ 3 get T_q 3 get 2 get 2array unique = ] unit-test
-[ t ] [ 4 get T_q 4 get 2 get 2array unique = ] unit-test
-[ t ] [ 5 get T_q 5 get 2 get 2array unique = ] unit-test
-[ t ] [ 6 get T_q { 6 2 5 } [ get ] map unique = ] unit-test
-[ t ] [ 7 get T_q { 7 2 } [ get ] map unique = ] unit-test
-[ t ] [ 8 get T_q { 8 2 5 } [ get ] map unique = ] unit-test
-[ t ] [ 9 get T_q { 2 5 8 9 } [ get ] map unique = ] unit-test
-[ t ] [ 10 get T_q { 2 5 8 10 } [ get ] map unique = ] unit-test
-[ t ] [ 11 get T_q 11 get 1array unique = ] unit-test
-
-[ f ] [ 1 get back-edge-target? ] unit-test
-[ t ] [ 2 get back-edge-target? ] unit-test
-[ f ] [ 3 get back-edge-target? ] unit-test
-[ f ] [ 4 get back-edge-target? ] unit-test
-[ t ] [ 5 get back-edge-target? ] unit-test
-[ f ] [ 6 get back-edge-target? ] unit-test
-[ f ] [ 7 get back-edge-target? ] unit-test
-[ t ] [ 8 get back-edge-target? ] unit-test
-[ f ] [ 9 get back-edge-target? ] unit-test
-[ f ] [ 10 get back-edge-target? ] unit-test
-[ f ] [ 11 get back-edge-target? ] unit-test
-
-[ f ] [ 0 1 get live-in? ] unit-test
-[ f ] [ 1 1 get live-in? ] unit-test
-[ f ] [ 2 1 get live-in? ] unit-test
-
-[ f ] [ 0 1 get live-out? ] unit-test
-[ f ] [ 1 1 get live-out? ] unit-test
-[ f ] [ 2 1 get live-out? ] unit-test
-
-[ f ] [ 0 2 get live-in? ] unit-test
-[ f ] [ 1 2 get live-in? ] unit-test
-[ f ] [ 2 2 get live-in? ] unit-test
-
-[ f ] [ 0 2 get live-out? ] unit-test
-[ f ] [ 1 2 get live-out? ] unit-test
-[ f ] [ 2 2 get live-out? ] unit-test
-
-[ f ] [ 0 3 get live-in? ] unit-test
-[ f ] [ 1 3 get live-in? ] unit-test
-[ f ] [ 2 3 get live-in? ] unit-test
-
-[ t ] [ 0 3 get live-out? ] unit-test
-[ t ] [ 1 3 get live-out? ] unit-test
-[ t ] [ 2 3 get live-out? ] unit-test
-
-[ t ] [ 0 4 get live-in? ] unit-test
-[ f ] [ 1 4 get live-in? ] unit-test
-[ t ] [ 2 4 get live-in? ] unit-test
-
-[ f ] [ 0 4 get live-out? ] unit-test
-[ f ] [ 1 4 get live-out? ] unit-test
-[ t ] [ 2 4 get live-out? ] unit-test
-
-[ f ] [ 0 5 get live-in? ] unit-test
-[ f ] [ 1 5 get live-in? ] unit-test
-[ t ] [ 2 5 get live-in? ] unit-test
-
-[ f ] [ 0 5 get live-out? ] unit-test
-[ f ] [ 1 5 get live-out? ] unit-test
-[ t ] [ 2 5 get live-out? ] unit-test
-
-[ f ] [ 0 6 get live-in? ] unit-test
-[ f ] [ 1 6 get live-in? ] unit-test
-[ t ] [ 2 6 get live-in? ] unit-test
-
-[ f ] [ 0 6 get live-out? ] unit-test
-[ f ] [ 1 6 get live-out? ] unit-test
-[ t ] [ 2 6 get live-out? ] unit-test
-
-[ f ] [ 0 7 get live-in? ] unit-test
-[ f ] [ 1 7 get live-in? ] unit-test
-[ f ] [ 2 7 get live-in? ] unit-test
-
-[ f ] [ 0 7 get live-out? ] unit-test
-[ f ] [ 1 7 get live-out? ] unit-test
-[ f ] [ 2 7 get live-out? ] unit-test
-
-[ f ] [ 0 8 get live-in? ] unit-test
-[ t ] [ 1 8 get live-in? ] unit-test
-[ t ] [ 2 8 get live-in? ] unit-test
-
-[ f ] [ 0 8 get live-out? ] unit-test
-[ t ] [ 1 8 get live-out? ] unit-test
-[ t ] [ 2 8 get live-out? ] unit-test
-
-[ f ] [ 0 9 get live-in? ] unit-test
-[ t ] [ 1 9 get live-in? ] unit-test
-[ t ] [ 2 9 get live-in? ] unit-test
-
-[ f ] [ 0 9 get live-out? ] unit-test
-[ t ] [ 1 9 get live-out? ] unit-test
-[ t ] [ 2 9 get live-out? ] unit-test
-
-[ f ] [ 0 10 get live-in? ] unit-test
-[ t ] [ 1 10 get live-in? ] unit-test
-[ t ] [ 2 10 get live-in? ] unit-test
-
-[ f ] [ 0 10 get live-out? ] unit-test
-[ t ] [ 1 10 get live-out? ] unit-test
-[ t ] [ 2 10 get live-out? ] unit-test
-
-[ f ] [ 0 11 get live-in? ] unit-test
-[ f ] [ 1 11 get live-in? ] unit-test
-[ f ] [ 2 11 get live-in? ] unit-test
-
-[ f ] [ 0 11 get live-out? ] unit-test
-[ f ] [ 1 11 get live-out? ] unit-test
-[ f ] [ 2 11 get live-out? ] unit-test
diff --git a/basis/compiler/cfg/ssa/liveness/liveness.factor b/basis/compiler/cfg/ssa/liveness/liveness.factor
deleted file mode 100644 (file)
index 7847de2..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-! Copyright (C) 2009 Daniel Ehrenberg
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences assocs accessors
-namespaces fry math sets combinators locals
-compiler.cfg.rpo
-compiler.cfg.dominance
-compiler.cfg.def-use
-compiler.cfg.instructions ;
-IN: compiler.cfg.ssa.liveness
-
-! Liveness checking on SSA IR, as described in
-! "Fast Liveness Checking for SSA-Form Programs", Sebastian Hack et al.
-! http://hal.archives-ouvertes.fr/docs/00/19/22/19/PDF/fast_liveness.pdf
-
-<PRIVATE
-
-! The sets T_q and R_q are described there
-SYMBOL: T_q-sets
-SYMBOL: R_q-sets
-
-! Targets of back edges
-SYMBOL: back-edge-targets
-
-: T_q ( q -- T_q )
-    T_q-sets get at ;
-
-: R_q ( q -- R_q )
-    R_q-sets get at ;
-
-: back-edge-target? ( block -- ? )
-    back-edge-targets get key? ;
-
-: next-R_q ( q -- R_q )
-    [ ] [ successors>> ] [ number>> ] tri
-    '[ number>> _ >= ] filter
-    [ R_q ] map assoc-combine
-    [ conjoin ] keep ;
-
-: set-R_q ( q -- )
-    [ next-R_q ] keep R_q-sets get set-at ;
-
-: set-back-edges ( q -- )
-    [ successors>> ] [ number>> ] bi '[
-        dup number>> _ < 
-        [ back-edge-targets get conjoin ] [ drop ] if
-    ] each ;
-
-: init-R_q ( -- )
-    H{ } clone R_q-sets set
-    H{ } clone back-edge-targets set ;
-
-: compute-R_q ( cfg -- )
-    init-R_q
-    post-order [
-        [ set-R_q ] [ set-back-edges ] bi
-    ] each ;
-
-! This algorithm for computing T_q uses equation (1)
-! but not the faster algorithm described in the paper
-
-: back-edges-from ( q -- edges )
-    R_q keys [
-        [ successors>> ] [ number>> ] bi
-        '[ number>> _ < ] filter
-    ] gather ;
-
-: T^_q ( q -- T^_q )
-    [ back-edges-from ] [ R_q ] bi
-    '[ _ key? not ] filter ;
-
-: next-T_q ( q -- T_q )
-    dup dup T^_q [ next-T_q keys ] map 
-    concat unique [ conjoin ] keep
-    [ swap T_q-sets get set-at ] keep ;
-
-: compute-T_q ( cfg -- )
-    H{ } T_q-sets set
-    [ next-T_q drop ] each-basic-block ;
-
-PRIVATE>
-
-: precompute-liveness ( cfg -- )
-    [ compute-R_q ] [ compute-T_q ] bi ;
-
-<PRIVATE
-
-! This doesn't take advantage of ordering T_q,a so you 
-! only have to check one if the CFG is reducible.
-! It should be changed to be more efficient.
-
-: only? ( seq obj -- ? )
-    '[ _ eq? ] all? ;
-
-: strictly-dominates? ( bb1 bb2 -- ? )
-    [ dominates? ] [ eq? not ] 2bi and ;
-
-: T_q,a ( a q -- T_q,a )
-    ! This could take advantage of the structure of dominance,
-    ! but probably I'll replace it with the algorithm that works
-    ! on reducible CFGs anyway
-    T_q keys swap def-of 
-    [ '[ _ swap strictly-dominates? ] filter ] when* ;
-
-: live? ( vreg node quot -- ? )
-    [ [ T_q,a ] [ drop uses-of ] 2bi ] dip
-    '[ [ R_q keys _ ] keep @ intersects? ] any? ; inline
-
-PRIVATE>
-
-: live-in? ( vreg node -- ? )
-    [ drop ] live? ;
-
-<PRIVATE
-
-: (live-out?) ( vreg node -- ? )
-    dup dup dup '[
-        _ = _ back-edge-target? not and
-        [ _ swap remove ] when
-    ] live? ;
-
-PRIVATE>
-
-:: live-out? ( vreg node -- ? )
-    vreg def-of :> def
-    {
-        { [ node def eq? ] [ vreg uses-of def only? not ] }
-        { [ def node strictly-dominates? ] [ vreg node (live-out?) ] }
-        [ f ]
-    } cond ;
index 3cfade23e1c94720277a75762d211d0424dd2c17..790d93a907bad1a26a5cd2e0484a730f83ef4b88 100644 (file)
@@ -1,44 +1,26 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: math math.order namespaces accessors kernel layouts combinators
-combinators.smart assocs sequences cpu.architecture ;
+USING: math math.order namespaces accessors kernel layouts
+combinators assocs sequences cpu.architecture
+words compiler.cfg.instructions ;
 IN: compiler.cfg.stack-frame
 
 TUPLE: stack-frame
 { params integer }
-{ return integer }
-{ total-size integer }
-{ gc-root-size integer }
+{ allot-area-size integer }
+{ allot-area-align integer }
 { spill-area-size integer }
-{ calls-vm? boolean } ;
-
-! Stack frame utilities
-: param-base ( -- n )
-    stack-frame get [ params>> ] [ return>> ] bi + ;
+{ spill-area-align integer }
 
-: spill-offset ( n -- offset )
-    param-base + ;
+{ total-size integer }
+{ allot-area-base integer }
+{ spill-area-base integer } ;
 
-: gc-root-base ( -- n )
-    stack-frame get spill-area-size>> param-base + ;
+: local-allot-offset ( n -- offset )
+    stack-frame get allot-area-base>> + ;
 
-: gc-root-offset ( n -- n' ) gc-root-base + ;
+: spill-offset ( n -- offset )
+    stack-frame get spill-area-base>> + ;
 
 : (stack-frame-size) ( stack-frame -- n )
-    [
-        {
-            [ params>> ]
-            [ return>> ]
-            [ gc-root-size>> ]
-            [ spill-area-size>> ]
-        } cleave
-    ] sum-outputs ;
-
-: max-stack-frame ( frame1 frame2 -- frame3 )
-    [ stack-frame new ] 2dip
-    {
-        [ [ params>> ] bi@ max >>params ]
-        [ [ return>> ] bi@ max >>return ]
-        [ [ gc-root-size>> ] bi@ max >>gc-root-size ]
-        [ [ calls-vm?>> ] bi@ or >>calls-vm? ]
-    } 2cleave ;
\ No newline at end of file
+    [ spill-area-base>> ] [ spill-area-size>> ] bi + ;
index f1f7880c901ed17739a0b51a887ea5653836cb0f..a35d82bbb58ea3a5a115362a8cba6e8f638b3af0 100644 (file)
@@ -27,7 +27,7 @@ IN: compiler.cfg.stacks.finalize
     to dead-in to live-in to anticip-in assoc-diff assoc-diff
     assoc-diff ;
 
-: each-insertion ( assoc bb quot: ( vreg loc -- ) -- )
+: each-insertion ( ... assoc bb quot: ( ... vreg loc -- ... ) -- ... )
     '[ drop [ loc>vreg ] [ _ untranslate-loc ] bi @ ] assoc-each ; inline
 
 ERROR: bad-peek dst loc ;
@@ -43,9 +43,9 @@ ERROR: bad-peek dst loc ;
 : visit-edge ( from to -- )
     ! If both blocks are subroutine calls, don't bother
     ! computing anything.
-    2dup [ kill-block? ] both? [ 2drop ] [
-        2dup [ [ insert-replaces ] [ insert-peeks ] 2bi ] V{ } make
-        [ 2drop ] [ insert-simple-basic-block ] if-empty
+    2dup [ kill-block?>> ] both? [ 2drop ] [
+        2dup [ [ insert-replaces ] [ insert-peeks ] 2bi ##branch ] V{ } make
+        [ 2drop ] [ insert-basic-block ] if-empty
     ] if ;
 
 : visit-block ( bb -- )
index 30a2c4c13f2fe43e48450c293857d068bb03fc84..95feb4c0340af5b86bfff9be527ce4c576a54599 100644 (file)
@@ -8,6 +8,7 @@ compiler.cfg.instructions
 compiler.cfg.registers
 compiler.cfg.stacks.height
 compiler.cfg.parallel-copy ;
+FROM: namespaces => set ;
 IN: compiler.cfg.stacks.local
 
 ! Local stack analysis. We build three sets for every basic block
@@ -106,4 +107,4 @@ M: rs-loc translate-local-loc n>> current-height get r>> - <rs-loc> ;
 
 : peek-set ( bb -- assoc ) peek-sets get at ;
 : replace-set ( bb -- assoc ) replace-sets get at ;
-: kill-set ( bb -- assoc ) kill-sets get at ;
\ No newline at end of file
+: kill-set ( bb -- assoc ) kill-sets get at ;
index 6cf362c2308a4f278c09e04db1dc48cbf63c7691..fdd6e405f56a97d328fbfdc0b5c22023da56772b 100644 (file)
@@ -68,9 +68,14 @@ IN: compiler.cfg.stacks
 : 3inputs ( -- vreg1 vreg2 vreg3 )
     (3inputs) -3 inc-d ;
 
+: binary-op ( quot -- )
+    [ 2inputs ] dip call ds-push ; inline
+
+: unary-op ( quot -- )
+    [ ds-pop ] dip call ds-push ; inline
+
 ! adjust-d/adjust-r: these are called when other instructions which
 ! internally adjust the stack height are emitted, such as ##call and
 ! ##alien-invoke
 : adjust-d ( n -- ) current-height get [ + ] change-d drop ;
 : adjust-r ( n -- ) current-height get [ + ] change-r drop ;
-
index 5b2bbf3765baf0583b6e48cac2670f9e3c9db67d..3d7519e14ba9e79dcbaeba863af4ece84c793c74 100644 (file)
@@ -33,14 +33,19 @@ M: ##inc-r visit-insn n>> rs-loc handle-inc ;
 
 ERROR: uninitialized-peek insn ;
 
-M: ##peek visit-insn
+: visit-peek ( ##peek -- )
     dup loc>> [ n>> ] [ class get ] bi ?nth 0 =
-    [ uninitialized-peek ] [ drop ] if ;
+    [ uninitialized-peek ] [ drop ] if ; inline
 
-M: ##replace visit-insn
+M: ##peek visit-insn visit-peek ;
+
+: visit-replace ( ##replace -- )
     loc>> [ n>> ] [ class get ] bi
     2dup length < [ [ 1 ] 2dip set-nth ] [ 2drop ] if ;
 
+M: ##replace visit-insn visit-replace ;
+M: ##replace-imm visit-insn visit-replace ;
+
 M: insn visit-insn drop ;
 
 : prepare ( pair -- )
index 810b9010130d47716f9cd3d1a0cad8613efbfd9d..bd8a7cf7540e53a4a4835d5c7beb24860ef730f2 100644 (file)
@@ -29,7 +29,7 @@ IN: compiler.cfg.tco
 : word-tail-call? ( bb -- ? )
     instructions>> penultimate ##call? ;
 
-: convert-tail-call ( bb quot: ( insn -- tail-insn ) -- )
+: convert-tail-call ( ..a bb quot: ( ..a insn -- ..a tail-insn ) -- ..b )
     '[
         instructions>>
         [ pop* ] [ pop ] [ ] tri
@@ -65,4 +65,4 @@ IN: compiler.cfg.tco
 : optimize-tail-calls ( cfg -- cfg' )
     dup [ optimize-tail-call ] each-basic-block
 
-    cfg-changed predecessors-changed ;
\ No newline at end of file
+    cfg-changed predecessors-changed ;
index a2885ae26e775ed6b1a6e3a426e5aa1672397cfe..b2529655bb9762c3ebaa1c12404647edc1ccb44d 100644 (file)
@@ -1,19 +1,22 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel accessors sequences math combinators combinators.short-circuit
-classes vectors compiler.cfg compiler.cfg.instructions compiler.cfg.rpo
+USING: kernel accessors sequences math combinators
+combinators.short-circuit vectors compiler.cfg
+compiler.cfg.instructions compiler.cfg.rpo
 compiler.cfg.utilities ;
 IN: compiler.cfg.useless-conditionals
 
 : delete-conditional? ( bb -- ? )
     {
         [
-            instructions>> last class {
-                ##compare-branch
-                ##compare-imm-branch
-                ##compare-float-ordered-branch
-                ##compare-float-unordered-branch
-            } member-eq?
+            instructions>> last {
+                [ ##compare-branch? ]
+                [ ##compare-imm-branch? ]
+                [ ##compare-integer-branch? ]
+                [ ##compare-integer-imm-branch? ]
+                [ ##compare-float-ordered-branch? ]
+                [ ##compare-float-unordered-branch? ]
+            } 1||
         ]
         [ successors>> first2 [ skip-empty-blocks ] bi@ eq? ]
     } 1&& ;
index 3710f4974bf81fd2ea428232eed1a48193873c38..38ca9a950f497125469e44dc8bcf28fb6fb08f75 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs combinators combinators.short-circuit
 cpu.architecture kernel layouts locals make math namespaces sequences
@@ -6,12 +6,6 @@ sets vectors fry arrays compiler.cfg compiler.cfg.instructions
 compiler.cfg.rpo compiler.utilities ;
 IN: compiler.cfg.utilities
 
-PREDICATE: kill-block < basic-block
-    instructions>> {
-        [ length 2 >= ]
-        [ penultimate kill-vreg-insn? ]
-    } 1&& ;
-
 : back-edge? ( from to -- ? )
     [ number>> ] bi@ >= ;
 
@@ -37,11 +31,24 @@ SYMBOL: visited
 : skip-empty-blocks ( bb -- bb' )
     H{ } clone visited [ (skip-empty-blocks) ] with-variable ;
 
-:: insert-basic-block ( froms to bb -- )
-    bb froms V{ } like >>predecessors drop
-    bb to 1vector >>successors drop
-    to predecessors>> [ dup froms member-eq? [ drop bb ] when ] map! drop
-    froms [ successors>> [ dup to eq? [ drop bb ] when ] map! drop ] each ;
+:: update-predecessors ( from to bb -- )
+    ! Update 'to' predecessors for insertion of 'bb' between
+    ! 'from' and 'to'.
+    to predecessors>> [ dup from eq? [ drop bb ] when ] map! drop ;
+
+:: update-successors ( from to bb -- )
+    ! Update 'from' successors for insertion of 'bb' between
+    ! 'from' and 'to'.
+    from successors>> [ dup to eq? [ drop bb ] when ] map! drop ;
+
+:: insert-basic-block ( from to insns -- )
+    ! Insert basic block on the edge between 'from' and 'to'.
+    <basic-block> :> bb
+    insns V{ } like bb instructions<<
+    V{ from } bb predecessors<<
+    V{ to } bb successors<<
+    from to bb update-predecessors
+    from to bb update-successors ;
 
 : add-instructions ( bb quot -- )
     [ instructions>> building ] dip '[
@@ -50,32 +57,25 @@ SYMBOL: visited
         ,
     ] with-variable ; inline
 
-: <simple-block> ( insns -- bb )
-    <basic-block>
-    swap >vector
-    \ ##branch new-insn over push
-    >>instructions ;
-
-: insert-simple-basic-block ( from to insns -- )
-    [ 1vector ] 2dip <simple-block> insert-basic-block ;
-
 : has-phis? ( bb -- ? )
     instructions>> first ##phi? ;
 
 : cfg-has-phis? ( cfg -- ? )
     post-order [ has-phis? ] any? ;
 
-: if-has-phis ( bb quot: ( bb -- ) -- )
+: if-has-phis ( ..a bb quot: ( ..a bb -- ..b ) -- ..b )
     [ dup has-phis? ] dip [ drop ] if ; inline
 
-: each-phi ( bb quot: ( ##phi -- ) -- )
+: each-phi ( ... bb quot: ( ... ##phi -- ... ) -- ... )
     [ instructions>> ] dip
     '[ dup ##phi? [ @ t ] [ drop f ] if ] all? drop ; inline
 
-: each-non-phi ( bb quot: ( insn -- ) -- )
+: each-non-phi ( ... bb quot: ( ... insn -- ... ) -- ... )
     [ instructions>> ] dip
     '[ dup ##phi? [ drop ] _ if ] each ; inline
 
 : predecessor ( bb -- pred )
     predecessors>> first ; inline
 
+: <copy> ( dst src -- insn )
+    any-rep \ ##copy new-insn ;
diff --git a/basis/compiler/cfg/value-numbering/alien/alien.factor b/basis/compiler/cfg/value-numbering/alien/alien.factor
new file mode 100644 (file)
index 0000000..5867460
--- /dev/null
@@ -0,0 +1,131 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors combinators combinators.short-circuit fry
+kernel make math sequences
+cpu.architecture
+compiler.cfg.hats
+compiler.cfg.utilities
+compiler.cfg.registers
+compiler.cfg.instructions
+compiler.cfg.value-numbering.math
+compiler.cfg.value-numbering.graph
+compiler.cfg.value-numbering.rewrite ;
+IN: compiler.cfg.value-numbering.alien
+
+M: ##box-displaced-alien rewrite
+    dup displacement>> vreg>insn zero-insn?
+    [ [ dst>> ] [ base>> ] bi <copy> ] [ drop f ] if ;
+
+! ##box-displaced-alien f 1 2 3 <class>
+! ##unbox-c-ptr 4 1 <class>
+! =>
+! ##box-displaced-alien f 1 2 3 <class>
+! ##unbox-c-ptr 5 3 <class>
+! ##add 4 5 2
+
+: rewrite-unbox-alien ( insn box-insn -- insn )
+    [ dst>> ] [ src>> ] bi* <copy> ;
+
+: rewrite-unbox-displaced-alien ( insn box-insn -- insns )
+    [
+        [ dst>> ]
+        [ [ base>> ] [ base-class>> ] [ displacement>> ] tri ] bi*
+        [ ^^unbox-c-ptr ] dip
+        ##add
+    ] { } make ;
+
+: rewrite-unbox-any-c-ptr ( insn -- insn/f )
+    dup src>> vreg>insn
+    {
+        { [ dup ##box-alien? ] [ rewrite-unbox-alien ] }
+        { [ dup ##box-displaced-alien? ] [ rewrite-unbox-displaced-alien ] }
+        [ 2drop f ]
+    } cond ;
+
+M: ##unbox-any-c-ptr rewrite rewrite-unbox-any-c-ptr ;
+
+M: ##unbox-alien rewrite rewrite-unbox-any-c-ptr ;
+
+! Fuse ##add-imm into ##load-memory(-imm) and ##store-memory(-imm)
+! just update the offset in the instruction
+: fuse-base-offset? ( insn -- ? )
+    base>> vreg>insn ##add-imm? ;
+
+: fuse-base-offset ( insn -- insn' )
+    dup base>> vreg>insn
+    [ src1>> ] [ src2>> ] bi
+    [ >>base ] [ '[ _ + ] change-offset ] bi* ;
+
+! Fuse ##add-imm into ##load-memory and ##store-memory
+! just update the offset in the instruction
+: fuse-displacement-offset? ( insn -- ? )
+    { [ scale>> 0 = ] [ displacement>> vreg>insn ##add-imm? ] } 1&& ;
+
+: fuse-displacement-offset ( insn -- insn' )
+    dup displacement>> vreg>insn
+    [ src1>> ] [ src2>> ] bi
+    [ >>displacement ] [ '[ _ + ] change-offset ] bi* ;
+
+! Fuse ##add into ##load-memory-imm and ##store-memory-imm
+! construct a new ##load-memory or ##store-memory with the
+! ##add's operand as the displacement
+: fuse-displacement? ( insn -- ? )
+    {
+        [ offset>> 0 = complex-addressing? or ]
+        [ base>> vreg>insn ##add? ]
+    } 1&& ;
+
+GENERIC: alien-insn-value ( insn -- value )
+
+M: ##load-memory-imm alien-insn-value dst>> ;
+M: ##store-memory-imm alien-insn-value src>> ;
+
+GENERIC: new-alien-insn ( value base displacement scale offset rep c-type insn -- insn )
+
+M: ##load-memory-imm new-alien-insn drop \ ##load-memory new-insn ;
+M: ##store-memory-imm new-alien-insn drop \ ##store-memory new-insn ;
+
+: fuse-displacement ( insn -- insn' )
+    {
+        [ alien-insn-value ]
+        [ base>> vreg>insn [ src1>> ] [ src2>> ] bi ]
+        [ drop 0 ]
+        [ offset>> ]
+        [ rep>> ]
+        [ c-type>> ]
+        [ ]
+    } cleave new-alien-insn ;
+
+! Fuse ##shl-imm into ##load-memory or ##store-memory
+: scale-insn? ( insn -- ? )
+    { [ ##shl-imm? ] [ src2>> { 1 2 3 } member? ] } 1&& ;
+
+: fuse-scale? ( insn -- ? )
+    { [ scale>> 0 = ] [ displacement>> vreg>insn scale-insn? ] } 1&& ;
+
+: fuse-scale ( insn -- insn' )
+    dup displacement>> vreg>insn
+    [ src1>> ] [ src2>> ] bi
+    [ >>displacement ] [ >>scale ] bi* ;
+
+: rewrite-memory-op ( insn -- insn/f )
+    complex-addressing? [
+        {
+            { [ dup fuse-base-offset? ] [ fuse-base-offset ] }
+            { [ dup fuse-displacement-offset? ] [ fuse-displacement-offset ] }
+            { [ dup fuse-scale? ] [ fuse-scale ] }
+            [ drop f ]
+        } cond
+    ] [ drop f ] if ;
+
+: rewrite-memory-imm-op ( insn -- insn/f )
+    {
+        { [ dup fuse-base-offset? ] [ fuse-base-offset ] }
+        { [ dup fuse-displacement? ] [ fuse-displacement ] }
+        [ drop f ]
+    } cond ;
+
+M: ##load-memory rewrite rewrite-memory-op ;
+M: ##load-memory-imm rewrite rewrite-memory-imm-op ;
+M: ##store-memory rewrite rewrite-memory-op ;
+M: ##store-memory-imm rewrite rewrite-memory-imm-op ;
diff --git a/basis/compiler/cfg/value-numbering/alien/authors.txt b/basis/compiler/cfg/value-numbering/alien/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/value-numbering/comparisons/authors.txt b/basis/compiler/cfg/value-numbering/comparisons/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/value-numbering/comparisons/comparisons.factor b/basis/compiler/cfg/value-numbering/comparisons/comparisons.factor
new file mode 100644 (file)
index 0000000..8bbacd2
--- /dev/null
@@ -0,0 +1,316 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors combinators kernel math math.order namespaces
+sequences vectors combinators.short-circuit
+cpu.architecture
+compiler.cfg
+compiler.cfg.comparisons
+compiler.cfg.instructions
+compiler.cfg.registers
+compiler.cfg.value-numbering.math
+compiler.cfg.value-numbering.graph
+compiler.cfg.value-numbering.rewrite ;
+IN: compiler.cfg.value-numbering.comparisons
+
+! Optimizations performed here:
+!
+! 1) Eliminating intermediate boolean values when the result of
+! a comparison is used by a compare-branch
+! 2) Folding comparisons where both inputs are literal
+! 3) Folding comparisons where both inputs are congruent
+! 4) Converting compare instructions into compare-imm instructions
+
+: fold-compare-imm? ( insn -- ? )
+    src1>> vreg>insn literal-insn? ;
+
+: evaluate-compare-imm ( insn -- ? )
+    [ src1>> vreg>literal ] [ src2>> ] [ cc>> ] tri
+    {
+        { cc= [ eq? ] }
+        { cc/= [ eq? not ] }
+    } case ;
+
+: fold-compare-integer-imm? ( insn -- ? )
+    src1>> vreg>insn ##load-integer? ;
+
+: evaluate-compare-integer-imm ( insn -- ? )
+    [ src1>> vreg>integer ] [ src2>> ] [ cc>> ] tri
+    [ <=> ] dip evaluate-cc ;
+
+: fold-test-imm? ( insn -- ? )
+    src1>> vreg>insn ##load-integer? ;
+
+: evaluate-test-imm ( insn -- ? )
+    [ src1>> vreg>integer ] [ src2>> ] [ cc>> ] tri
+    [ bitand ] dip {
+        { cc= [ 0 = ] }
+        { cc/= [ 0 = not ] }
+    } case ;
+
+: rewrite-into-test? ( insn -- ? )
+    {
+        [ drop test-instruction? ]
+        [ cc>> { cc= cc/= } member-eq? ]
+        [ src2>> 0 = ]
+    } 1&& ;
+
+: >compare< ( insn -- in1 in2 cc )
+    [ src1>> ] [ src2>> ] [ cc>> ] tri ; inline
+
+: >test-vector< ( insn -- src1 temp rep vcc )
+    {
+        [ src1>> ]
+        [ drop next-vreg ]
+        [ rep>> ]
+        [ vcc>> ]
+    } cleave ; inline
+
+UNION: scalar-compare-insn
+    ##compare
+    ##compare-imm
+    ##compare-integer
+    ##compare-integer-imm
+    ##test
+    ##test-imm
+    ##compare-float-unordered
+    ##compare-float-ordered ;
+
+UNION: general-compare-insn scalar-compare-insn ##test-vector ;
+
+: rewrite-boolean-comparison? ( insn -- ? )
+    {
+        [ src1>> vreg>insn general-compare-insn? ]
+        [ src2>> not ]
+        [ cc>> cc/= eq? ]
+    } 1&& ; inline
+
+: rewrite-boolean-comparison ( insn -- insn )
+    src1>> vreg>insn {
+        { [ dup ##compare? ] [ >compare< \ ##compare-branch new-insn ] }
+        { [ dup ##compare-imm? ] [ >compare< \ ##compare-imm-branch new-insn ] }
+        { [ dup ##compare-integer? ] [ >compare< \ ##compare-integer-branch new-insn ] }
+        { [ dup ##compare-integer-imm? ] [ >compare< \ ##compare-integer-imm-branch new-insn ] }
+        { [ dup ##test? ] [ >compare< \ ##test-branch new-insn ] }
+        { [ dup ##test-imm? ] [ >compare< \ ##test-imm-branch new-insn ] }
+        { [ dup ##compare-float-unordered? ] [ >compare< \ ##compare-float-unordered-branch new-insn ] }
+        { [ dup ##compare-float-ordered? ] [ >compare< \ ##compare-float-ordered-branch new-insn ] }
+        { [ dup ##test-vector? ] [ >test-vector< \ ##test-vector-branch new-insn ] }
+    } cond ;
+
+: fold-branch ( ? -- insn )
+    0 1 ?
+    basic-block get [ nth 1vector ] change-successors drop
+    \ ##branch new-insn ;
+
+: fold-compare-imm-branch ( insn -- insn/f )
+    evaluate-compare-imm fold-branch ;
+
+: >test-branch ( insn -- insn )
+    [ src1>> ] [ src1>> ] [ cc>> ] tri \ ##test-branch new-insn ;
+
+M: ##compare-imm-branch rewrite
+    {
+        { [ dup rewrite-boolean-comparison? ] [ rewrite-boolean-comparison ] }
+        { [ dup fold-compare-imm? ] [ fold-compare-imm-branch ] }
+        [ drop f ]
+    } cond ;
+
+: fold-compare-integer-imm-branch ( insn -- insn/f )
+    evaluate-compare-integer-imm fold-branch ;
+
+M: ##compare-integer-imm-branch rewrite
+    {
+        { [ dup fold-compare-integer-imm? ] [ fold-compare-integer-imm-branch ] }
+        { [ dup rewrite-into-test? ] [ >test-branch ] }
+        [ drop f ]
+    } cond ;
+
+: fold-test-imm-branch ( insn -- insn/f )
+    evaluate-test-imm fold-branch ;
+
+M: ##test-imm-branch rewrite
+    {
+        { [ dup fold-test-imm? ] [ fold-test-imm-branch ] }
+        [ drop f ]
+    } cond ;
+
+: swap-compare ( src1 src2 cc swap? -- src1 src2 cc )
+    [ [ swap ] dip swap-cc ] when ; inline
+
+: (>compare-imm-branch) ( insn swap? -- src1 src2 cc )
+    [ [ src1>> ] [ src2>> ] [ cc>> ] tri ] dip swap-compare ; inline
+
+: >compare-imm-branch ( insn swap? -- insn' )
+    (>compare-imm-branch)
+    [ vreg>literal ] dip
+    \ ##compare-imm-branch new-insn ; inline
+
+: >compare-integer-imm-branch ( insn swap? -- insn' )
+    (>compare-imm-branch)
+    [ vreg>integer ] dip
+    \ ##compare-integer-imm-branch new-insn ; inline
+
+: evaluate-self-compare ( insn -- ? )
+    cc>> { cc= cc<= cc>= } member-eq? ;
+
+: rewrite-self-compare-branch ( insn -- insn' )
+    evaluate-self-compare fold-branch ;
+
+M: ##compare-branch rewrite
+    {
+        { [ dup src1>> vreg-immediate-comparand? ] [ t >compare-imm-branch ] }
+        { [ dup src2>> vreg-immediate-comparand? ] [ f >compare-imm-branch ] }
+        { [ dup diagonal? ] [ rewrite-self-compare-branch ] }
+        [ drop f ]
+    } cond ;
+
+M: ##compare-integer-branch rewrite
+    {
+        { [ dup src1>> vreg-immediate-arithmetic? ] [ t >compare-integer-imm-branch ] }
+        { [ dup src2>> vreg-immediate-arithmetic? ] [ f >compare-integer-imm-branch ] }
+        { [ dup diagonal? ] [ rewrite-self-compare-branch ] }
+        [ drop f ]
+    } cond ;
+
+: (>compare-imm) ( insn swap? -- dst src1 src2 cc )
+    [ { [ dst>> ] [ src1>> ] [ src2>> ] [ cc>> ] } cleave ] dip
+    swap-compare ; inline
+
+: >compare-imm ( insn swap? -- insn' )
+    (>compare-imm)
+    [ vreg>literal ] dip
+    next-vreg \ ##compare-imm new-insn ; inline
+
+: >compare-integer-imm ( insn swap? -- insn' )
+    (>compare-imm)
+    [ vreg>integer ] dip
+    next-vreg \ ##compare-integer-imm new-insn ; inline
+
+: >boolean-insn ( insn ? -- insn' )
+    [ dst>> ] dip \ ##load-reference new-insn ;
+
+: rewrite-self-compare ( insn -- insn' )
+    dup evaluate-self-compare >boolean-insn ;
+
+M: ##compare rewrite
+    {
+        { [ dup src1>> vreg-immediate-comparand? ] [ t >compare-imm ] }
+        { [ dup src2>> vreg-immediate-comparand? ] [ f >compare-imm ] }
+        { [ dup diagonal? ] [ rewrite-self-compare ] }
+        [ drop f ]
+    } cond ;
+
+M: ##compare-integer rewrite
+    {
+        { [ dup src1>> vreg-immediate-arithmetic? ] [ t >compare-integer-imm ] }
+        { [ dup src2>> vreg-immediate-arithmetic? ] [ f >compare-integer-imm ] }
+        { [ dup diagonal? ] [ rewrite-self-compare ] }
+        [ drop f ]
+    } cond ;
+
+: rewrite-redundant-comparison? ( insn -- ? )
+    {
+        [ src1>> vreg>insn scalar-compare-insn? ]
+        [ src2>> not ]
+        [ cc>> { cc= cc/= } member? ]
+    } 1&& ; inline
+
+: rewrite-redundant-comparison ( insn -- insn' )
+    [ cc>> ] [ dst>> ] [ src1>> vreg>insn ] tri {
+        { [ dup ##compare? ] [ >compare< next-vreg \ ##compare new-insn ] }
+        { [ dup ##compare-imm? ] [ >compare< next-vreg \ ##compare-imm new-insn ] }
+        { [ dup ##compare-integer? ] [ >compare< next-vreg \ ##compare-integer new-insn ] }
+        { [ dup ##compare-integer-imm? ] [ >compare< next-vreg \ ##compare-integer-imm new-insn ] }
+        { [ dup ##test? ] [ >compare< next-vreg \ ##test new-insn ] }
+        { [ dup ##test-imm? ] [ >compare< next-vreg \ ##test-imm new-insn ] }
+        { [ dup ##compare-float-unordered? ] [ >compare< next-vreg \ ##compare-float-unordered new-insn ] }
+        { [ dup ##compare-float-ordered? ] [ >compare< next-vreg \ ##compare-float-ordered new-insn ] }
+    } cond
+    swap cc= eq? [ [ negate-cc ] change-cc ] when ;
+
+: fold-compare-imm ( insn -- insn' )
+    dup evaluate-compare-imm >boolean-insn ;
+
+M: ##compare-imm rewrite
+    {
+        { [ dup rewrite-redundant-comparison? ] [ rewrite-redundant-comparison ] }
+        { [ dup fold-compare-imm? ] [ fold-compare-imm ] }
+        [ drop f ]
+    } cond ;
+
+: fold-compare-integer-imm ( insn -- insn' )
+    dup evaluate-compare-integer-imm >boolean-insn ;
+
+: >test ( insn -- insn' )
+    { [ dst>> ] [ src1>> ] [ src1>> ] [ cc>> ] [ temp>> ] } cleave
+    \ ##test new-insn ;
+
+M: ##compare-integer-imm rewrite
+    {
+        { [ dup fold-compare-integer-imm? ] [ fold-compare-integer-imm ] }
+        { [ dup rewrite-into-test? ] [ >test ] }
+        [ drop f ]
+    } cond ;
+
+: (simplify-test) ( insn -- src1 src2 cc )
+    [ src1>> vreg>insn [ src1>> ] [ src2>> ] bi ] [ cc>> ] bi ; inline
+
+: simplify-test ( insn -- insn )
+    dup (simplify-test) drop [ >>src1 ] [ >>src2 ] bi* ; inline
+
+: simplify-test-branch ( insn -- insn )
+    dup (simplify-test) drop [ >>src1 ] [ >>src2 ] bi* ; inline
+
+: (simplify-test-imm) ( insn -- src1 src2 cc )
+    [ src1>> vreg>insn [ src1>> ] [ src2>> ] bi ] [ cc>> ] bi ; inline
+
+: simplify-test-imm ( insn -- insn )
+    [ dst>> ] [ (simplify-test-imm) ] [ temp>> ] tri \ ##test-imm new-insn ; inline
+
+: simplify-test-imm-branch ( insn -- insn )
+    (simplify-test-imm) \ ##test-imm-branch new-insn ; inline
+
+: >test-imm ( insn ? -- insn' )
+    (>compare-imm) [ vreg>integer ] dip next-vreg
+    \ ##test-imm new-insn ; inline
+
+: >test-imm-branch ( insn ? -- insn' )
+    (>compare-imm-branch) [ vreg>integer ] dip
+    \ ##test-imm-branch new-insn ; inline
+
+M: ##test rewrite
+    {
+        { [ dup src1>> vreg-immediate-comparand? ] [ t >test-imm ] }
+        { [ dup src2>> vreg-immediate-comparand? ] [ f >test-imm ] }
+        { [ dup diagonal? ] [
+            {
+                { [ dup src1>> vreg>insn ##and? ] [ simplify-test ] }
+                { [ dup src1>> vreg>insn ##and-imm? ] [ simplify-test-imm ] }
+                [ drop f ]
+            } cond
+        ] }
+        [ drop f ]
+    } cond ;
+
+M: ##test-branch rewrite
+    {
+        { [ dup src1>> vreg-immediate-comparand? ] [ t >test-imm-branch ] }
+        { [ dup src2>> vreg-immediate-comparand? ] [ f >test-imm-branch ] }
+        { [ dup diagonal? ] [
+            {
+                { [ dup src1>> vreg>insn ##and? ] [ simplify-test-branch ] }
+                { [ dup src1>> vreg>insn ##and-imm? ] [ simplify-test-imm-branch ] }
+                [ drop f ]
+            } cond
+        ] }
+        [ drop f ]
+    } cond ;
+
+: fold-test-imm ( insn -- insn' )
+    dup evaluate-test-imm >boolean-insn ;
+
+M: ##test-imm rewrite
+    {
+        { [ dup fold-test-imm? ] [ fold-test-imm ] }
+        [ drop f ]
+    } cond ;
index d2e7c2ac864fd48a0ff07e0ffb3265ead010cdd1..46e5a099072955228943d4f3edd88c0ece2a2c32 100644 (file)
@@ -1,77 +1,84 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors classes classes.algebra classes.parser
-classes.tuple combinators combinators.short-circuit fry
+USING: accessors arrays classes classes.algebra combinators fry
 generic.parser kernel math namespaces quotations sequences slots
-splitting words compiler.cfg.instructions
+words make
+compiler.cfg.instructions
 compiler.cfg.instructions.syntax
 compiler.cfg.value-numbering.graph ;
+FROM: sequences.private => set-array-nth ;
 IN: compiler.cfg.value-numbering.expressions
 
-TUPLE: constant-expr < expr value ;
-
-C: <constant> constant-expr
-
-M: constant-expr equal?
-    over constant-expr? [
-        [ value>> ] bi@
-        2dup [ float? ] both? [ fp-bitwise= ] [
-            { [ [ class ] bi@ = ] [ = ] } 2&&
-        ] if
-    ] [ 2drop f ] if ;
-
-TUPLE: reference-expr < expr value ;
-
-C: <reference> reference-expr
-
-M: reference-expr equal?
-    over reference-expr? [ [ value>> ] bi@ eq? ] [ 2drop f ] if ;
-
-M: reference-expr hashcode*
-    nip value>> identity-hashcode ;
-
-: constant>vn ( constant -- vn ) <constant> expr>vn ; inline
+<<
 
 GENERIC: >expr ( insn -- expr )
 
-M: insn >expr drop next-input-expr ;
-
-M: ##load-immediate >expr val>> <constant> ;
+: input-values ( slot-specs -- slot-specs' )
+    [ type>> { use literal } member-eq? ] filter ;
+
+: slot->expr-quot ( slot-spec -- quot )
+    [ name>> reader-word 1quotation ]
+    [
+        type>> {
+            { use [ [ vreg>vn ] ] }
+            { literal [ [ ] ] }
+        } case
+    ] bi append ;
+
+: narray-quot ( length -- quot )
+    [
+        [ , [ f <array> ] % ]
+        [ 
+            dup iota [
+                - 1 - , [ swap [ set-array-nth ] keep ] %
+            ] with each
+        ] bi
+    ] [ ] make ;
+
+: >expr-quot ( insn slot-specs -- quot )
+    [
+        [ literalize , \ swap , ]
+        [
+            [ [ slot->expr-quot ] map cleave>quot % ]
+            [ length 1 + narray-quot % ]
+            bi
+        ] bi*
+    ] [ ] make ;
+
+: define->expr-method ( insn slot-specs -- )
+    [ drop \ >expr create-method-in ] [ >expr-quot ] 2bi define ;
+
+insn-classes get
+[ pure-insn class<= ] filter
+[
+    dup "insn-slots" word-prop input-values
+    define->expr-method
+] each
 
-M: ##load-reference >expr obj>> <reference> ;
+>>
 
-M: ##load-constant >expr obj>> <constant> ;
+TUPLE: integer-expr value ;
 
-<<
+C: <integer-expr> integer-expr
 
-: input-values ( slot-specs -- slot-specs' )
-    [ type>> { use literal constant } member-eq? ] filter ;
+TUPLE: reference-expr value ;
 
-: expr-class ( insn -- expr )
-    name>> "##" ?head drop "-expr" append create-class-in ;
+C: <reference-expr> reference-expr
 
-: define-expr-class ( insn expr slot-specs -- )
-    [ nip expr ] dip [ name>> ] map define-tuple-class ;
+M: reference-expr equal?
+    over reference-expr? [
+        [ value>> ] bi@
+        2dup [ float? ] both?
+        [ fp-bitwise= ] [ eq? ] if
+    ] [ 2drop f ] if ;
 
-: >expr-quot ( expr slot-specs -- quot )
-     [
-        [ name>> reader-word 1quotation ]
-        [
-            type>> {
-                { use [ [ vreg>vn ] ] }
-                { literal [ [ ] ] }
-                { constant [ [ constant>vn ] ] }
-            } case
-        ] bi append
-    ] map cleave>quot swap suffix \ boa suffix ;
+M: reference-expr hashcode*
+    nip value>> dup float? [ double>bits ] [ identity-hashcode ] if ;
 
-: define->expr-method ( insn expr slot-specs -- )
-    [ 2drop \ >expr create-method-in ] [ >expr-quot nip ] 3bi define ;
+M: insn >expr drop input-expr-counter counter neg ;
 
-: handle-pure-insn ( insn -- )
-    [ ] [ expr-class ] [ "insn-slots" word-prop input-values ] tri
-    [ define-expr-class ] [ define->expr-method ] 3bi ;
+M: ##copy >expr "Fail" throw ;
 
-insn-classes get [ pure-insn class<= ] filter [ handle-pure-insn ] each
+M: ##load-integer >expr val>> <integer-expr> ;
 
->>
+M: ##load-reference >expr obj>> <reference-expr> ;
diff --git a/basis/compiler/cfg/value-numbering/folding/authors.txt b/basis/compiler/cfg/value-numbering/folding/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/value-numbering/folding/folding.factor b/basis/compiler/cfg/value-numbering/folding/folding.factor
new file mode 100644 (file)
index 0000000..4d79ed5
--- /dev/null
@@ -0,0 +1,39 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors kernel layouts math math.bitwise
+compiler.cfg.instructions
+compiler.cfg.value-numbering.graph
+compiler.cfg.value-numbering.rewrite ;
+IN: compiler.cfg.value-numbering.folding
+
+: binary-constant-fold? ( insn -- ? )
+    src1>> vreg>insn ##load-integer? ; inline
+
+GENERIC: binary-constant-fold* ( x y insn -- z )
+
+M: ##add-imm binary-constant-fold* drop + ;
+M: ##sub-imm binary-constant-fold* drop - ;
+M: ##mul-imm binary-constant-fold* drop * ;
+M: ##and-imm binary-constant-fold* drop bitand ;
+M: ##or-imm binary-constant-fold* drop bitor ;
+M: ##xor-imm binary-constant-fold* drop bitxor ;
+M: ##shr-imm binary-constant-fold* drop [ cell-bits 2^ wrap ] dip neg shift ;
+M: ##sar-imm binary-constant-fold* drop neg shift ;
+M: ##shl-imm binary-constant-fold* drop shift ;
+
+: binary-constant-fold ( insn -- insn' )
+    [ dst>> ]
+    [ [ src1>> vreg>integer ] [ src2>> ] [ ] tri binary-constant-fold* ] bi
+    \ ##load-integer new-insn ; inline
+
+: unary-constant-fold? ( insn -- ? )
+    src>> vreg>insn ##load-integer? ; inline
+
+GENERIC: unary-constant-fold* ( x insn -- y )
+
+M: ##not unary-constant-fold* drop bitnot ;
+M: ##neg unary-constant-fold* drop neg ;
+
+: unary-constant-fold ( insn -- insn' )
+    [ dst>> ] [ [ src>> vreg>integer ] [ ] bi unary-constant-fold* ] bi
+    \ ##load-integer new-insn ; inline
index f380ecd02f885acfa74737f6255cfe3d8365a871..1ea1a52d02b5ecbb0ed615758c1653281d8b8500 100644 (file)
@@ -1,46 +1,30 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel math namespaces assocs biassocs ;
+USING: accessors kernel math namespaces assocs ;
 IN: compiler.cfg.value-numbering.graph
 
-SYMBOL: vn-counter
-
-: next-vn ( -- vn ) vn-counter [ dup 1 + ] change ;
-
-! biassoc mapping expressions to value numbers
-SYMBOL: exprs>vns
-
-TUPLE: expr ;
-
-: expr>vn ( expr -- vn ) exprs>vns get [ drop next-vn ] cache ;
-
-: vn>expr ( vn -- expr ) exprs>vns get value-at ;
-
-! Expressions whose values are inputs to the basic block.
-TUPLE: input-expr < expr n ;
-
 SYMBOL: input-expr-counter
 
-: next-input-expr ( -- expr )
-    input-expr-counter counter input-expr boa ;
-
+! assoc mapping vregs to value numbers
+! this is the identity on canonical representatives
 SYMBOL: vregs>vns
 
-: vreg>vn ( vreg -- vn )
-    vregs>vns get [ drop next-input-expr expr>vn ] cache ;
+! assoc mapping expressions to value numbers
+SYMBOL: exprs>vns
 
-: vn>vreg ( vn -- vreg ) vregs>vns get value-at ;
+! assoc mapping value numbers to instructions
+SYMBOL: vns>insns
 
-: set-vn ( vn vreg -- ) vregs>vns get set-at ;
+: vn>insn ( vn -- insn ) vns>insns get at ;
 
-: vreg>expr ( vreg -- expr ) vreg>vn vn>expr ; inline
+: vreg>vn ( vreg -- vn ) vregs>vns get [ ] cache ;
 
-: vn>constant ( vn -- constant ) vn>expr value>> ; inline
+: set-vn ( vn vreg -- ) vregs>vns get set-at ;
 
-: vreg>constant ( vreg -- constant ) vreg>vn vn>constant ; inline
+: vreg>insn ( vreg -- insn ) vreg>vn vn>insn ;
 
 : init-value-graph ( -- )
-    0 vn-counter set
     0 input-expr-counter set
-    <bihash> exprs>vns set
-    <bihash> vregs>vns set ;
+    H{ } clone vregs>vns set
+    H{ } clone exprs>vns set
+    H{ } clone vns>insns set ;
diff --git a/basis/compiler/cfg/value-numbering/math/authors.txt b/basis/compiler/cfg/value-numbering/math/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/value-numbering/math/math.factor b/basis/compiler/cfg/value-numbering/math/math.factor
new file mode 100644 (file)
index 0000000..c2f6369
--- /dev/null
@@ -0,0 +1,287 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors combinators combinators.short-circuit
+cpu.architecture fry kernel layouts locals make math sequences
+compiler.cfg.instructions
+compiler.cfg.registers
+compiler.cfg.utilities
+compiler.cfg.value-numbering.folding
+compiler.cfg.value-numbering.graph
+compiler.cfg.value-numbering.rewrite ;
+IN: compiler.cfg.value-numbering.math
+
+: f-insn? ( insn -- ? )
+    { [ ##load-reference? ] [ obj>> not ] } 1&& ; inline
+
+: zero-insn? ( insn -- ? )
+    { [ ##load-integer? ] [ val>> 0 = ] } 1&& ; inline
+
+M: ##tagged>integer rewrite
+    [ dst>> ] [ src>> vreg>insn ] bi {
+        { [ dup ##load-integer? ] [ val>> tag-fixnum \ ##load-integer new-insn ] }
+        { [ dup f-insn? ] [ drop \ f type-number \ ##load-integer new-insn ] }
+        [ 2drop f ]
+    } cond ;
+
+: self-inverse ( insn -- insn' )
+    [ dst>> ] [ src>> vreg>insn src>> ] bi <copy> ;
+
+: identity ( insn -- insn' )
+    [ dst>> ] [ src1>> ] bi <copy> ;
+
+M: ##neg rewrite
+    {
+        { [ dup src>> vreg>insn ##neg? ] [ self-inverse ] }
+        { [ dup unary-constant-fold? ] [ unary-constant-fold ] }
+        [ drop f ]
+    } cond ;
+
+M: ##not rewrite
+    {
+        { [ dup src>> vreg>insn ##not? ] [ self-inverse ] }
+        { [ dup unary-constant-fold? ] [ unary-constant-fold ] }
+        [ drop f ]
+    } cond ;
+
+! Reassociation converts
+! ## *-imm 2 1 X
+! ## *-imm 3 2 Y
+! into
+! ## *-imm 3 1 (X $ Y)
+! If * is associative, then $ is the same operation as *.
+! In the case of shifts, $ is addition.
+: (reassociate) ( insn -- dst src1 src2' src2'' )
+    {
+        [ dst>> ]
+        [ src1>> vreg>insn [ src1>> ] [ src2>> ] bi ]
+        [ src2>> ]
+    } cleave ; inline
+
+: reassociate ( insn -- dst src1 src2 )
+    [ (reassociate) ] keep binary-constant-fold* ;
+
+: ?new-insn ( dst src1 src2 ? class -- insn/f )
+    '[ _ new-insn ] [ 3drop f ] if ; inline
+
+: reassociate-arithmetic ( insn new-insn -- insn/f )
+    [ reassociate dup immediate-arithmetic? ] dip ?new-insn ; inline
+
+: reassociate-bitwise ( insn new-insn -- insn/f )
+    [ reassociate dup immediate-bitwise? ] dip ?new-insn ; inline
+
+: reassociate-shift ( insn new-insn -- insn/f )
+    [ (reassociate) + dup immediate-shift-count? ] dip ?new-insn ; inline
+
+M: ##add-imm rewrite
+    {
+        { [ dup src2>> 0 = ] [ identity ] }
+        { [ dup binary-constant-fold? ] [ binary-constant-fold ] }
+        { [ dup src1>> vreg>insn ##add-imm? ] [ \ ##add-imm reassociate-arithmetic ] }
+        [ drop f ]
+    } cond ;
+
+: sub-imm>add-imm ( insn -- insn' )
+    [ dst>> ] [ src1>> ] [ src2>> neg ] tri
+    dup immediate-arithmetic?
+    \ ##add-imm ?new-insn ;
+
+M: ##sub-imm rewrite sub-imm>add-imm ;
+
+! Convert ##mul-imm -1 => ##neg
+: mul-to-neg? ( insn -- ? )
+    src2>> -1 = ;
+
+: mul-to-neg ( insn -- insn' )
+    [ dst>> ] [ src1>> ] bi \ ##neg new-insn ;
+
+! Convert ##mul-imm 2^X => ##shl-imm X
+: mul-to-shl? ( insn -- ? )
+    src2>> power-of-2? ;
+
+: mul-to-shl ( insn -- insn' )
+    [ [ dst>> ] [ src1>> ] bi ] [ src2>> log2 ] bi \ ##shl-imm new-insn ;
+
+! Distribution converts
+! ##+-imm 2 1 X
+! ##*-imm 3 2 Y
+! Into
+! ##*-imm 4 1 Y
+! ##+-imm 3 4 X*Y
+! Where * is mul or shl, + is add or sub
+! Have to make sure that X*Y fits in an immediate
+:: (distribute) ( outer inner imm temp add-op mul-op -- new-outers/f )
+    imm immediate-arithmetic? [
+        [
+            temp inner src1>> outer src2>> mul-op execute
+            outer dst>> temp imm add-op execute
+        ] { } make
+    ] [ f ] if ; inline
+
+: distribute-over-add? ( insn -- ? )
+    src1>> vreg>insn ##add-imm? ;
+
+: distribute-over-sub? ( insn -- ? )
+    src1>> vreg>insn ##sub-imm? ;
+
+: distribute ( insn add-op mul-op -- new-insns/f )
+    [
+        dup src1>> vreg>insn
+        2dup src2>> swap [ src2>> ] keep binary-constant-fold*
+        next-vreg
+    ] 2dip (distribute) ; inline
+
+M: ##mul-imm rewrite
+    {
+        { [ dup binary-constant-fold? ] [ binary-constant-fold ] }
+        { [ dup mul-to-neg? ] [ mul-to-neg ] }
+        { [ dup mul-to-shl? ] [ mul-to-shl ] }
+        { [ dup src1>> vreg>insn ##mul-imm? ] [ \ ##mul-imm reassociate-arithmetic ] }
+        { [ dup distribute-over-add? ] [ \ ##add-imm \ ##mul-imm distribute ] }
+        { [ dup distribute-over-sub? ] [ \ ##sub-imm \ ##mul-imm distribute ] }
+        [ drop f ]
+    } cond ;
+
+M: ##and-imm rewrite
+    {
+        { [ dup binary-constant-fold? ] [ binary-constant-fold ] }
+        { [ dup src1>> vreg>insn ##and-imm? ] [ \ ##and-imm reassociate-bitwise ] }
+        { [ dup src2>> 0 = ] [ dst>> 0 \ ##load-integer new-insn ] }
+        { [ dup src2>> -1 = ] [ identity ] }
+        [ drop f ]
+    } cond ;
+
+M: ##or-imm rewrite
+    {
+        { [ dup src2>> 0 = ] [ identity ] }
+        { [ dup src2>> -1 = ] [ dst>> -1 \ ##load-integer new-insn ] }
+        { [ dup binary-constant-fold? ] [ binary-constant-fold ] }
+        { [ dup src1>> vreg>insn ##or-imm? ] [ \ ##or-imm reassociate-bitwise ] }
+        [ drop f ]
+    } cond ;
+
+M: ##xor-imm rewrite
+    {
+        { [ dup src2>> 0 = ] [ identity ] }
+        { [ dup src2>> -1 = ] [ [ dst>> ] [ src1>> ] bi \ ##not new-insn ] }
+        { [ dup binary-constant-fold? ] [ binary-constant-fold ] }
+        { [ dup src1>> vreg>insn ##xor-imm? ] [ \ ##xor-imm reassociate-bitwise ] }
+        [ drop f ]
+    } cond ;
+
+M: ##shl-imm rewrite
+    {
+        { [ dup src2>> 0 = ] [ identity ] }
+        { [ dup binary-constant-fold? ] [ binary-constant-fold ] }
+        { [ dup src1>> vreg>insn ##shl-imm? ] [ \ ##shl-imm reassociate-shift ] }
+        { [ dup distribute-over-add? ] [ \ ##add-imm \ ##shl-imm distribute ] }
+        { [ dup distribute-over-sub? ] [ \ ##sub-imm \ ##shl-imm distribute ] }
+        [ drop f ]
+    } cond ;
+
+M: ##shr-imm rewrite
+    {
+        { [ dup src2>> 0 = ] [ identity ] }
+        { [ dup binary-constant-fold? ] [ binary-constant-fold ] }
+        { [ dup src1>> vreg>insn ##shr-imm? ] [ \ ##shr-imm reassociate-shift ] }
+        [ drop f ]
+    } cond ;
+
+M: ##sar-imm rewrite
+    {
+        { [ dup src2>> 0 = ] [ identity ] }
+        { [ dup binary-constant-fold? ] [ binary-constant-fold ] }
+        { [ dup src1>> vreg>insn ##sar-imm? ] [ \ ##sar-imm reassociate-shift ] }
+        [ drop f ]
+    } cond ;
+
+! Convert
+! ##load-integer 2 X
+! ##* 3 1 2
+! Where * is an operation with an -imm equivalent into
+! ##*-imm 3 1 X
+: insn>imm-insn ( insn op swap? -- new-insn )
+    swap [
+        [ [ dst>> ] [ src1>> ] [ src2>> ] tri ] dip
+        [ swap ] when vreg>integer
+    ] dip new-insn ; inline
+
+M: ##add rewrite
+    {
+        { [ dup src2>> vreg-immediate-arithmetic? ] [ \ ##add-imm f insn>imm-insn ] }
+        { [ dup src1>> vreg-immediate-arithmetic? ] [ \ ##add-imm t insn>imm-insn ] }
+        [ drop f ]
+    } cond ;
+
+: diagonal? ( insn -- ? )
+    [ src1>> vreg>vn ] [ src2>> vreg>vn ] bi = ; inline
+
+! ##sub 2 1 1 => ##load-integer 2 0
+: rewrite-subtraction-identity ( insn -- insn' )
+    dst>> 0 \ ##load-integer new-insn ;
+
+! ##load-integer 1 0
+! ##sub 3 1 2
+! =>
+! ##neg 3 2
+: sub-to-neg? ( ##sub -- ? )
+    src1>> vreg>insn zero-insn? ;
+
+: sub-to-neg ( ##sub -- insn )
+    [ dst>> ] [ src2>> ] bi \ ##neg new-insn ;
+
+M: ##sub rewrite
+    {
+        { [ dup sub-to-neg? ] [ sub-to-neg ] }
+        { [ dup diagonal? ] [ rewrite-subtraction-identity ] }
+        { [ dup src2>> vreg-immediate-arithmetic? ] [ \ ##sub-imm f insn>imm-insn ] }
+        [ drop f ]
+    } cond ;
+
+M: ##mul rewrite
+    {
+        { [ dup src2>> vreg-immediate-arithmetic? ] [ \ ##mul-imm f insn>imm-insn ] }
+        { [ dup src1>> vreg-immediate-arithmetic? ] [ \ ##mul-imm t insn>imm-insn ] }
+        [ drop f ]
+    } cond ;
+
+M: ##and rewrite
+    {
+        { [ dup diagonal? ] [ identity ] }
+        { [ dup src2>> vreg-immediate-bitwise? ] [ \ ##and-imm f insn>imm-insn ] }
+        { [ dup src1>> vreg-immediate-bitwise? ] [ \ ##and-imm t insn>imm-insn ] }
+        [ drop f ]
+    } cond ;
+
+M: ##or rewrite
+    {
+        { [ dup diagonal? ] [ identity ] }
+        { [ dup src2>> vreg-immediate-bitwise? ] [ \ ##or-imm f insn>imm-insn ] }
+        { [ dup src1>> vreg-immediate-bitwise? ] [ \ ##or-imm t insn>imm-insn ] }
+        [ drop f ]
+    } cond ;
+
+M: ##xor rewrite
+    {
+        { [ dup diagonal? ] [ dst>> 0 \ ##load-integer new-insn ] }
+        { [ dup src2>> vreg-immediate-bitwise? ] [ \ ##xor-imm f insn>imm-insn ] }
+        { [ dup src1>> vreg-immediate-bitwise? ] [ \ ##xor-imm t insn>imm-insn ] }
+        [ drop f ]
+    } cond ;
+
+M: ##shl rewrite
+    {
+        { [ dup src2>> vreg-immediate-bitwise? ] [ \ ##shl-imm f insn>imm-insn ] }
+        [ drop f ]
+    } cond ;
+
+M: ##shr rewrite
+    {
+        { [ dup src2>> vreg-immediate-bitwise? ] [ \ ##shr-imm f insn>imm-insn ] }
+        [ drop f ]
+    } cond ;
+
+M: ##sar rewrite
+    {
+        { [ dup src2>> vreg-immediate-bitwise? ] [ \ ##sar-imm f insn>imm-insn ] }
+        [ drop f ]
+    } cond ;
diff --git a/basis/compiler/cfg/value-numbering/misc/authors.txt b/basis/compiler/cfg/value-numbering/misc/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/value-numbering/misc/misc.factor b/basis/compiler/cfg/value-numbering/misc/misc.factor
new file mode 100644 (file)
index 0000000..2624b29
--- /dev/null
@@ -0,0 +1,14 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors cpu.architecture kernel
+compiler.cfg.instructions
+compiler.cfg.value-numbering.graph
+compiler.cfg.value-numbering.rewrite ;
+IN: compiler.cfg.value-numbering.misc
+
+M: ##replace rewrite
+    [ loc>> ] [ src>> vreg>insn ] bi
+    dup literal-insn? [
+        insn>literal dup immediate-store?
+        [ swap \ ##replace-imm new-insn ] [ 2drop f ] if
+    ] [ 2drop f ] if ;
index 0fa0314c3ee6eb7563cacdfbd36fae7e78792b26..4f22c5bec2243c3b43f366af87e3a1e7d7e62c46 100644 (file)
-! Copyright (C) 2008, 2009 Slava Pestov, Doug Coleman, Daniel Ehrenberg.
+! Copyright (C) 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors combinators combinators.short-circuit arrays
-fry kernel layouts math namespaces sequences cpu.architecture
-math.bitwise math.order classes
-vectors locals make alien.c-types io.binary grouping
-compiler.cfg
-compiler.cfg.registers
-compiler.cfg.comparisons
+USING: accessors combinators combinators.short-circuit kernel
+layouts math cpu.architecture
 compiler.cfg.instructions
-compiler.cfg.value-numbering.expressions
-compiler.cfg.value-numbering.graph
-compiler.cfg.value-numbering.simplify ;
+compiler.cfg.value-numbering.graph ;
 IN: compiler.cfg.value-numbering.rewrite
 
-: vreg-immediate-arithmetic? ( vreg -- ? )
-    vreg>expr {
-        [ constant-expr? ]
-        [ value>> fixnum? ]
-        [ value>> immediate-arithmetic? ]
-    } 1&& ;
-
-: vreg-immediate-bitwise? ( vreg -- ? )
-    vreg>expr {
-        [ constant-expr? ]
-        [ value>> fixnum? ]
-        [ value>> immediate-bitwise? ]
-    } 1&& ;
-
 ! Outputs f to mean no change
-
 GENERIC: rewrite ( insn -- insn/f )
 
 M: insn rewrite drop f ;
 
-: ##branch-t? ( insn -- ? )
-    dup ##compare-imm-branch? [
-        {
-            [ cc>> cc/= eq? ]
-            [ src2>> \ f type-number eq? ]
-        } 1&&
-    ] [ drop f ] if ; inline
-
-: general-compare-expr? ( insn -- ? )
-    {
-        [ compare-expr? ]
-        [ compare-imm-expr? ]
-        [ compare-float-unordered-expr? ]
-        [ compare-float-ordered-expr? ]
-    } 1|| ;
-
-: general-or-vector-compare-expr? ( insn -- ? )
-    {
-        [ compare-expr? ]
-        [ compare-imm-expr? ]
-        [ compare-float-unordered-expr? ]
-        [ compare-float-ordered-expr? ]
-        [ test-vector-expr? ]
-    } 1|| ;
-
-: rewrite-boolean-comparison? ( insn -- ? )
-    dup ##branch-t? [
-        src1>> vreg>expr general-or-vector-compare-expr?
-    ] [ drop f ] if ; inline
-: >compare-expr< ( expr -- in1 in2 cc )
-    [ src1>> vn>vreg ] [ src2>> vn>vreg ] [ cc>> ] tri ; inline
-
-: >compare-imm-expr< ( expr -- in1 in2 cc )
-    [ src1>> vn>vreg ] [ src2>> vn>constant ] [ cc>> ] tri ; inline
-
-: >test-vector-expr< ( expr -- src1 temp rep vcc )
-    {
-        [ src1>> vn>vreg ]
-        [ drop next-vreg ]
-        [ rep>> ]
-        [ vcc>> ]
-    } cleave ; inline
-
-: rewrite-boolean-comparison ( expr -- insn )
-    src1>> vreg>expr {
-        { [ dup compare-expr? ] [ >compare-expr< \ ##compare-branch new-insn ] }
-        { [ dup compare-imm-expr? ] [ >compare-imm-expr< \ ##compare-imm-branch new-insn ] }
-        { [ dup compare-float-unordered-expr? ] [ >compare-expr< \ ##compare-float-unordered-branch new-insn ] }
-        { [ dup compare-float-ordered-expr? ] [ >compare-expr< \ ##compare-float-ordered-branch new-insn ] }
-        { [ dup test-vector-expr? ] [ >test-vector-expr< \ ##test-vector-branch new-insn ] }
-    } cond ;
-
-: tag-fixnum-expr? ( expr -- ? )
-    dup shl-imm-expr?
-    [ src2>> vn>constant tag-bits get = ] [ drop f ] if ;
-
-: rewrite-tagged-comparison? ( insn -- ? )
-    #! Are we comparing two tagged fixnums? Then untag them.
-    {
-        [ src1>> vreg>expr tag-fixnum-expr? ]
-        [ src2>> tag-mask get bitand 0 = ]
-    } 1&& ; inline
-
-: tagged>constant ( n -- n' )
-    tag-bits get neg shift ; inline
-
-: (rewrite-tagged-comparison) ( insn -- src1 src2 cc )
-    [ src1>> vreg>expr src1>> vn>vreg ]
-    [ src2>> tagged>constant ]
-    [ cc>> ]
-    tri ; inline
-
-GENERIC: rewrite-tagged-comparison ( insn -- insn/f )
-
-M: ##compare-imm-branch rewrite-tagged-comparison
-    (rewrite-tagged-comparison) \ ##compare-imm-branch new-insn ;
-
-M: ##compare-imm rewrite-tagged-comparison
-    [ dst>> ] [ (rewrite-tagged-comparison) ] bi
-    next-vreg \ ##compare-imm new-insn ;
-
-: rewrite-redundant-comparison? ( insn -- ? )
-    {
-        [ src1>> vreg>expr general-compare-expr? ]
-        [ src2>> \ f type-number = ]
-        [ cc>> { cc= cc/= } member-eq? ]
-    } 1&& ; inline
-
-: rewrite-redundant-comparison ( insn -- insn' )
-    [ cc>> ] [ dst>> ] [ src1>> vreg>expr ] tri {
-        { [ dup compare-expr? ] [ >compare-expr< next-vreg \ ##compare new-insn ] }
-        { [ dup compare-imm-expr? ] [ >compare-imm-expr< next-vreg \ ##compare-imm new-insn ] }
-        { [ dup compare-float-unordered-expr? ] [ >compare-expr< next-vreg \ ##compare-float-unordered new-insn ] }
-        { [ dup compare-float-ordered-expr? ] [ >compare-expr< next-vreg \ ##compare-float-ordered new-insn ] }
-    } cond
-    swap cc= eq? [ [ negate-cc ] change-cc ] when ;
-
-ERROR: bad-comparison ;
-
-: (fold-compare-imm) ( insn -- ? )
-    [ [ src1>> vreg>constant ] [ src2>> ] bi ] [ cc>> ] bi
-    pick integer?
-    [ [ <=> ] dip evaluate-cc ]
-    [
-        2nip {
-            { cc= [ f ] }
-            { cc/= [ t ] }
-            [ bad-comparison ]
-        } case
-    ] if ;
-
-: fold-compare-imm? ( insn -- ? )
-    src1>> vreg>expr [ constant-expr? ] [ reference-expr? ] bi or ;
-
-: fold-branch ( ? -- insn )
-    0 1 ?
-    basic-block get [ nth 1vector ] change-successors drop
-    \ ##branch new-insn ;
-
-: fold-compare-imm-branch ( insn -- insn/f )
-    (fold-compare-imm) fold-branch ;
-
-M: ##compare-imm-branch rewrite
-    {
-        { [ dup rewrite-boolean-comparison? ] [ rewrite-boolean-comparison ] }
-        { [ dup rewrite-tagged-comparison? ] [ rewrite-tagged-comparison ] }
-        { [ dup fold-compare-imm? ] [ fold-compare-imm-branch ] }
-        [ drop f ]
-    } cond ;
-
-: swap-compare ( src1 src2 cc swap? -- src1 src2 cc )
-    [ [ swap ] dip swap-cc ] when ; inline
-
-: >compare-imm-branch ( insn swap? -- insn' )
-    [
-        [ src1>> ]
-        [ src2>> ]
-        [ cc>> ]
-        tri
-    ] dip
-    swap-compare
-    [ vreg>constant ] dip
-    \ ##compare-imm-branch new-insn ; inline
-
-: self-compare? ( insn -- ? )
-    [ src1>> ] [ src2>> ] bi [ vreg>vn ] bi@ = ; inline
-
-: (rewrite-self-compare) ( insn -- ? )
-    cc>> { cc= cc<= cc>= } member-eq? ;
-
-: rewrite-self-compare-branch ( insn -- insn' )
-    (rewrite-self-compare) fold-branch ;
-
-M: ##compare-branch rewrite
-    {
-        { [ dup src1>> vreg-immediate-arithmetic? ] [ t >compare-imm-branch ] }
-        { [ dup src2>> vreg-immediate-arithmetic? ] [ f >compare-imm-branch ] }
-        { [ dup self-compare? ] [ rewrite-self-compare-branch ] }
-        [ drop f ]
-    } cond ;
-
-: >compare-imm ( insn swap? -- insn' )
-    [
-        {
-            [ dst>> ]
-            [ src1>> ]
-            [ src2>> ]
-            [ cc>> ]
-        } cleave
-    ] dip
-    swap-compare
-    [ vreg>constant ] dip
-    next-vreg \ ##compare-imm new-insn ; inline
-
-: >boolean-insn ( insn ? -- insn' )
-    [ dst>> ] dip
-    {
-        { t [ t \ ##load-constant new-insn ] }
-        { f [ \ f type-number \ ##load-immediate new-insn ] }
-    } case ;
-
-: rewrite-self-compare ( insn -- insn' )
-    dup (rewrite-self-compare) >boolean-insn ;
-
-M: ##compare rewrite
-    {
-        { [ dup src1>> vreg-immediate-arithmetic? ] [ t >compare-imm ] }
-        { [ dup src2>> vreg-immediate-arithmetic? ] [ f >compare-imm ] }
-        { [ dup self-compare? ] [ rewrite-self-compare ] }
-        [ drop f ]
-    } cond ;
-
-: fold-compare-imm ( insn -- insn' )
-    dup (fold-compare-imm) >boolean-insn ;
-
-M: ##compare-imm rewrite
-    {
-        { [ dup rewrite-redundant-comparison? ] [ rewrite-redundant-comparison ] }
-        { [ dup rewrite-tagged-comparison? ] [ rewrite-tagged-comparison ] }
-        { [ dup fold-compare-imm? ] [ fold-compare-imm ] }
-        [ drop f ]
-    } cond ;
-
-: constant-fold? ( insn -- ? )
-    src1>> vreg>expr constant-expr? ; inline
-
-GENERIC: constant-fold* ( x y insn -- z )
-
-M: ##add-imm constant-fold* drop + ;
-M: ##sub-imm constant-fold* drop - ;
-M: ##mul-imm constant-fold* drop * ;
-M: ##and-imm constant-fold* drop bitand ;
-M: ##or-imm constant-fold* drop bitor ;
-M: ##xor-imm constant-fold* drop bitxor ;
-M: ##shr-imm constant-fold* drop [ cell-bits 2^ wrap ] dip neg shift ;
-M: ##sar-imm constant-fold* drop neg shift ;
-M: ##shl-imm constant-fold* drop shift ;
-
-: constant-fold ( insn -- insn' )
-    [ dst>> ]
-    [ [ src1>> vreg>constant ] [ src2>> ] [ ] tri constant-fold* ] bi
-    \ ##load-immediate new-insn ; inline
-
-: unary-constant-fold? ( insn -- ? )
-    src>> vreg>expr constant-expr? ; inline
-
-GENERIC: unary-constant-fold* ( x insn -- y )
+! Utilities
+GENERIC: insn>integer ( insn -- n )
 
-M: ##not unary-constant-fold* drop bitnot ;
-M: ##neg unary-constant-fold* drop neg ;
+M: ##load-integer insn>integer val>> ;
 
-: unary-constant-fold ( insn -- insn' )
-    [ dst>> ]
-    [ [ src>> vreg>constant ] [ ] bi unary-constant-fold* ] bi
-    \ ##load-immediate new-insn ; inline
+: vreg>integer ( vreg -- n ) vreg>insn insn>integer ; inline
 
-: maybe-unary-constant-fold ( insn -- insn' )
-    dup unary-constant-fold? [ unary-constant-fold ] [ drop f ] if ;
-
-M: ##neg rewrite
-    maybe-unary-constant-fold ;
-
-M: ##not rewrite
-    maybe-unary-constant-fold ;
-
-: arithmetic-op? ( op -- ? )
-    {
-        ##add
-        ##add-imm
-        ##sub
-        ##sub-imm
-        ##mul
-        ##mul-imm
-    } member-eq? ;
-
-: immediate? ( value op -- ? )
-    arithmetic-op? [ immediate-arithmetic? ] [ immediate-bitwise? ] if ;
-
-: reassociate ( insn op -- insn )
-    [
-        {
-            [ dst>> ]
-            [ src1>> vreg>expr [ src1>> vn>vreg ] [ src2>> vn>constant ] bi ]
-            [ src2>> ]
-            [ ]
-        } cleave constant-fold*
-    ] dip
-    2dup immediate? [ new-insn ] [ 2drop 2drop f ] if ; inline
-
-M: ##add-imm rewrite
-    {
-        { [ dup constant-fold? ] [ constant-fold ] }
-        { [ dup src1>> vreg>expr add-imm-expr? ] [ \ ##add-imm reassociate ] }
-        [ drop f ]
-    } cond ;
-
-: sub-imm>add-imm ( insn -- insn' )
-    [ dst>> ] [ src1>> ] [ src2>> neg ] tri dup immediate-arithmetic?
-    [ \ ##add-imm new-insn ] [ 3drop f ] if ;
-
-M: ##sub-imm rewrite
-    {
-        { [ dup constant-fold? ] [ constant-fold ] }
-        [ sub-imm>add-imm ]
-    } cond ;
-
-: mul-to-neg? ( insn -- ? )
-    src2>> -1 = ;
-
-: mul-to-neg ( insn -- insn' )
-    [ dst>> ] [ src1>> ] bi \ ##neg new-insn ;
-
-: mul-to-shl? ( insn -- ? )
-    src2>> power-of-2? ;
+: vreg-immediate-arithmetic? ( vreg -- ? )
+    vreg>insn {
+        [ ##load-integer? ]
+        [ val>> immediate-arithmetic? ]
+    } 1&& ;
 
-: mul-to-shl ( insn -- insn' )
-    [ [ dst>> ] [ src1>> ] bi ] [ src2>> log2 ] bi \ ##shl-imm new-insn ;
+: vreg-immediate-bitwise? ( vreg -- ? )
+    vreg>insn {
+        [ ##load-integer? ]
+        [ val>> immediate-bitwise? ]
+    } 1&& ;
 
-M: ##mul-imm rewrite
-    {
-        { [ dup constant-fold? ] [ constant-fold ] }
-        { [ dup mul-to-neg? ] [ mul-to-neg ] }
-        { [ dup mul-to-shl? ] [ mul-to-shl ] }
-        { [ dup src1>> vreg>expr mul-imm-expr? ] [ \ ##mul-imm reassociate ] }
-        [ drop f ]
-    } cond ;
+UNION: literal-insn ##load-integer ##load-reference ;
 
-M: ##and-imm rewrite
-    {
-        { [ dup constant-fold? ] [ constant-fold ] }
-        { [ dup src1>> vreg>expr and-imm-expr? ] [ \ ##and-imm reassociate ] }
-        [ drop f ]
-    } cond ;
+GENERIC: insn>literal ( insn -- n )
 
-M: ##or-imm rewrite
-    {
-        { [ dup constant-fold? ] [ constant-fold ] }
-        { [ dup src1>> vreg>expr or-imm-expr? ] [ \ ##or-imm reassociate ] }
-        [ drop f ]
-    } cond ;
+M: ##load-integer insn>literal val>> >fixnum ;
 
-M: ##xor-imm rewrite
-    {
-        { [ dup constant-fold? ] [ constant-fold ] }
-        { [ dup src1>> vreg>expr xor-imm-expr? ] [ \ ##xor-imm reassociate ] }
-        [ drop f ]
-    } cond ;
+M: ##load-reference insn>literal obj>> ;
 
-M: ##shl-imm rewrite
-    {
-        { [ dup constant-fold? ] [ constant-fold ] }
-        [ drop f ]
-    } cond ;
+: vreg>literal ( vreg -- n ) vreg>insn insn>literal ; inline
 
-M: ##shr-imm rewrite
-    {
-        { [ dup constant-fold? ] [ constant-fold ] }
+: vreg-immediate-comparand? ( vreg -- ? )
+    vreg>insn {
+        { [ dup ##load-integer? ] [ val>> tag-fixnum immediate-comparand? ] }
+        { [ dup ##load-reference? ] [ obj>> immediate-comparand? ] }
         [ drop f ]
     } cond ;
-
-M: ##sar-imm rewrite
-    {
-        { [ dup constant-fold? ] [ constant-fold ] }
-        [ drop f ]
-    } cond ;
-
-: insn>imm-insn ( insn op swap? -- )
-    swap [
-        [ [ dst>> ] [ src1>> ] [ src2>> ] tri ] dip
-        [ swap ] when vreg>constant
-    ] dip new-insn ; inline
-
-: vreg-immediate? ( vreg op -- ? )
-    arithmetic-op?
-    [ vreg-immediate-arithmetic? ] [ vreg-immediate-bitwise? ] if ;
-
-: rewrite-arithmetic ( insn op -- ? )
-    {
-        { [ over src2>> over vreg-immediate? ] [ f insn>imm-insn ] }
-        [ 2drop f ]
-    } cond ; inline
-
-: rewrite-arithmetic-commutative ( insn op -- ? )
-    {
-        { [ over src2>> over vreg-immediate? ] [ f insn>imm-insn ] }
-        { [ over src1>> over vreg-immediate? ] [ t insn>imm-insn ] }
-        [ 2drop f ]
-    } cond ; inline
-
-M: ##add rewrite \ ##add-imm rewrite-arithmetic-commutative ;
-
-: subtraction-identity? ( insn -- ? )
-    [ src1>> ] [ src2>> ] bi [ vreg>vn ] bi@ eq?  ;
-
-: rewrite-subtraction-identity ( insn -- insn' )
-    dst>> 0 \ ##load-immediate new-insn ;
-
-: sub-to-neg? ( ##sub -- ? )
-    src1>> vn>expr expr-zero? ;
-
-: sub-to-neg ( ##sub -- insn )
-    [ dst>> ] [ src2>> ] bi \ ##neg new-insn ;
-
-M: ##sub rewrite
-    {
-        { [ dup sub-to-neg? ] [ sub-to-neg ] }
-        { [ dup subtraction-identity? ] [ rewrite-subtraction-identity ] }
-        [ \ ##sub-imm rewrite-arithmetic ]
-    } cond ;
-
-M: ##mul rewrite \ ##mul-imm rewrite-arithmetic-commutative ;
-
-M: ##and rewrite \ ##and-imm rewrite-arithmetic-commutative ;
-
-M: ##or rewrite \ ##or-imm rewrite-arithmetic-commutative ;
-
-M: ##xor rewrite \ ##xor-imm rewrite-arithmetic-commutative ;
-
-M: ##shl rewrite \ ##shl-imm rewrite-arithmetic ;
-
-M: ##shr rewrite \ ##shr-imm rewrite-arithmetic ;
-
-M: ##sar rewrite \ ##sar-imm rewrite-arithmetic ;
-
-! ##box-displaced-alien f 1 2 3 <class>
-! ##unbox-c-ptr 4 1 <class>
-! =>
-! ##box-displaced-alien f 1 2 3 <class>
-! ##unbox-c-ptr 5 3 <class>
-! ##add 4 5 2
-
-:: rewrite-unbox-displaced-alien ( insn expr -- insns )
-    [
-        next-vreg :> temp
-        temp expr base>> vn>vreg expr base-class>> ##unbox-c-ptr
-        insn dst>> temp expr displacement>> vn>vreg ##add
-    ] { } make ;
-
-M: ##unbox-any-c-ptr rewrite
-    dup src>> vreg>expr dup box-displaced-alien-expr?
-    [ rewrite-unbox-displaced-alien ] [ 2drop f ] if ;
-
-! More efficient addressing for alien intrinsics
-: rewrite-alien-addressing ( insn -- insn' )
-    dup src>> vreg>expr dup add-imm-expr? [
-        [ src1>> vn>vreg ] [ src2>> vn>constant ] bi
-        [ >>src ] [ '[ _ + ] change-offset ] bi*
-    ] [ 2drop f ] if ;
-
-M: ##alien-unsigned-1 rewrite rewrite-alien-addressing ;
-M: ##alien-unsigned-2 rewrite rewrite-alien-addressing ;
-M: ##alien-unsigned-4 rewrite rewrite-alien-addressing ;
-M: ##alien-signed-1 rewrite rewrite-alien-addressing ;
-M: ##alien-signed-2 rewrite rewrite-alien-addressing ;
-M: ##alien-signed-4 rewrite rewrite-alien-addressing ;
-M: ##alien-float rewrite rewrite-alien-addressing ;
-M: ##alien-double rewrite rewrite-alien-addressing ;
-M: ##set-alien-integer-1 rewrite rewrite-alien-addressing ;
-M: ##set-alien-integer-2 rewrite rewrite-alien-addressing ;
-M: ##set-alien-integer-4 rewrite rewrite-alien-addressing ;
-M: ##set-alien-float rewrite rewrite-alien-addressing ;
-M: ##set-alien-double rewrite rewrite-alien-addressing ;
-
index 16d38bc5bb0ea75830a1372999c8353534063e54..84acc95859b76cc21452162a2f47588a6b09ab40 100644 (file)
@@ -1,29 +1,29 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors combinators combinators.short-circuit arrays
 fry kernel layouts math namespaces sequences cpu.architecture
-math.bitwise math.order classes
-vectors locals make alien.c-types io.binary grouping
+math.bitwise math.order classes generalizations
+combinators.smart locals make alien.c-types io.binary grouping
 math.vectors.simd.intrinsics
 compiler.cfg
 compiler.cfg.registers
+compiler.cfg.utilities
 compiler.cfg.comparisons
 compiler.cfg.instructions
-compiler.cfg.value-numbering.expressions
+compiler.cfg.value-numbering.math
 compiler.cfg.value-numbering.graph
-compiler.cfg.value-numbering.rewrite
-compiler.cfg.value-numbering.simplify ;
+compiler.cfg.value-numbering.rewrite ;
 IN: compiler.cfg.value-numbering.simd
 
-M: ##alien-vector rewrite rewrite-alien-addressing ;
-M: ##set-alien-vector rewrite rewrite-alien-addressing ;
-
 ! Some lame constant folding for SIMD intrinsics. Eventually this
 ! should be redone completely.
 
-: rewrite-shuffle-vector-imm ( insn expr -- insn' )
+: useless-shuffle-vector-imm? ( insn -- ? )
+    [ shuffle>> ] [ rep>> rep-length iota ] bi sequence= ;
+
+: compose-shuffle-vector-imm ( outer inner -- insn' )
     2dup [ rep>> ] bi@ eq? [
-        [ [ dst>> ] [ src>> vn>vreg ] bi* ]
+        [ [ dst>> ] [ src>> ] bi* ]
         [ [ shuffle>> ] bi@ nths ]
         [ drop rep>> ]
         2tri \ ##shuffle-vector-imm new-insn
@@ -32,65 +32,119 @@ M: ##set-alien-vector rewrite rewrite-alien-addressing ;
 : (fold-shuffle-vector-imm) ( shuffle bytes -- bytes' )
     2dup length swap length /i group nths concat ;
 
-: fold-shuffle-vector-imm ( insn expr -- insn' )
-    [ [ dst>> ] [ shuffle>> ] bi ] dip value>>
-    (fold-shuffle-vector-imm) \ ##load-constant new-insn ;
+: fold-shuffle-vector-imm ( outer inner -- insn' )
+    [ [ dst>> ] [ shuffle>> ] bi ] [ obj>> ] bi*
+    (fold-shuffle-vector-imm) \ ##load-reference new-insn ;
 
 M: ##shuffle-vector-imm rewrite
-    dup src>> vreg>expr {
-        { [ dup shuffle-vector-imm-expr? ] [ rewrite-shuffle-vector-imm ] }
-        { [ dup reference-expr? ] [ fold-shuffle-vector-imm ] }
-        { [ dup constant-expr? ] [ fold-shuffle-vector-imm ] }
+    dup src>> vreg>insn {
+        { [ over useless-shuffle-vector-imm? ] [ drop [ dst>> ] [ src>> ] bi <copy> ] }
+        { [ dup ##shuffle-vector-imm? ] [ compose-shuffle-vector-imm ] }
+        { [ dup ##load-reference? ] [ fold-shuffle-vector-imm ] }
         [ 2drop f ]
     } cond ;
 
+: scalar-value ( literal-insn rep -- byte-array )
+    {
+        { float-4-rep [ obj>> float>bits 4 >le ] }
+        { double-2-rep [ obj>> double>bits 8 >le ] }
+        [ [ val>> ] [ rep-component-type heap-size ] bi* >le ]
+    } case ;
+
 : (fold-scalar>vector) ( insn bytes -- insn' )
     [ [ dst>> ] [ rep>> rep-length ] bi ] dip <repetition> concat
-    \ ##load-constant new-insn ;
+    \ ##load-reference new-insn ;
 
-: fold-scalar>vector ( insn expr -- insn' )
-    value>> over rep>> {
-        { float-4-rep [ float>bits 4 >le (fold-scalar>vector) ] }
-        { double-2-rep [ double>bits 8 >le (fold-scalar>vector) ] }
-        [ [ untag-fixnum ] dip rep-component-type heap-size >le (fold-scalar>vector) ]
-    } case ;
+: fold-scalar>vector ( outer inner -- insn' )
+    over rep>> scalar-value (fold-scalar>vector) ;
 
 M: ##scalar>vector rewrite
-    dup src>> vreg>expr dup constant-expr?
-    [ fold-scalar>vector ] [ 2drop f ] if ;
+    dup src>> vreg>insn {
+        { [ dup literal-insn? ] [ fold-scalar>vector ] }
+        { [ dup ##vector>scalar? ] [ [ dst>> ] [ src>> ] bi* <copy> ] }
+        [ 2drop f ]
+    } cond ;
+
+:: fold-gather-vector-2 ( insn src1 src2 -- insn )
+    insn dst>>
+    src1 src2 [ insn rep>> scalar-value ] bi@ append
+    \ ##load-reference new-insn ;
+
+: rewrite-gather-vector-2 ( insn -- insn/f )
+    dup [ src1>> vreg>insn ] [ src2>> vreg>insn ] bi {
+        { [ 2dup [ literal-insn? ] both? ] [ fold-gather-vector-2 ] }
+        [ 3drop f ]
+    } cond ;
+
+M: ##gather-vector-2 rewrite rewrite-gather-vector-2 ;
+
+M: ##gather-int-vector-2 rewrite rewrite-gather-vector-2 ;
+
+:: fold-gather-vector-4 ( insn src1 src2 src3 src4 -- insn )
+    insn dst>>
+    [
+        src1 src2 src3 src4
+        [ insn rep>> scalar-value ] 4 napply
+    ] B{ } append-outputs-as
+    \ ##load-reference new-insn ;
+
+: rewrite-gather-vector-4 ( insn -- insn/f )
+    dup { [ src1>> ] [ src2>> ] [ src3>> ] [ src4>> ] } cleave [ vreg>insn ] 4 napply
+    {
+        { [ 4 ndup [ literal-insn? ] 4 napply and and and ] [ fold-gather-vector-4 ] }
+        [ 5 ndrop f ]
+    } cond ;
+
+M: ##gather-vector-4 rewrite rewrite-gather-vector-4 ;
+
+M: ##gather-int-vector-4 rewrite rewrite-gather-vector-4 ;
+
+: fold-shuffle-vector ( insn src1 src2 -- insn )
+    [ dst>> ] [ obj>> ] [ obj>> ] tri*
+    swap nths \ ##load-reference new-insn ;
+
+M: ##shuffle-vector rewrite
+    dup [ src>> vreg>insn ] [ shuffle>> vreg>insn ] bi
+    {
+        { [ 2dup [ ##load-reference? ] both? ] [ fold-shuffle-vector ] }
+        [ 3drop f ]
+    } cond ;
 
 M: ##xor-vector rewrite
-    dup [ src1>> vreg>vn ] [ src2>> vreg>vn ] bi eq?
+    dup diagonal?
     [ [ dst>> ] [ rep>> ] bi \ ##zero-vector new-insn ] [ drop f ] if ;
 
-: vector-not? ( expr -- ? )
+: vector-not? ( insn -- ? )
     {
-        [ not-vector-expr? ]
+        [ ##not-vector? ]
         [ {
-            [ xor-vector-expr? ]
-            [ [ src1>> ] [ src2>> ] bi [ vn>expr fill-vector-expr? ] either? ]
+            [ ##xor-vector? ]
+            [ [ src1>> ] [ src2>> ] bi [ vreg>insn ##fill-vector? ] either? ]
         } 1&& ]
     } 1|| ;
 
-GENERIC: vector-not-src ( expr -- vreg )
-M: not-vector-expr vector-not-src src>> vn>vreg ;
-M: xor-vector-expr vector-not-src
-    dup src1>> vn>expr fill-vector-expr? [ src2>> ] [ src1>> ] if vn>vreg ;
+GENERIC: vector-not-src ( insn -- vreg )
+
+M: ##not-vector vector-not-src
+    src>> ;
+
+M: ##xor-vector vector-not-src
+    dup src1>> vreg>insn ##fill-vector? [ src2>> ] [ src1>> ] if ;
 
 M: ##and-vector rewrite 
     {
-        { [ dup src1>> vreg>expr vector-not? ] [
+        { [ dup src1>> vreg>insn vector-not? ] [
             {
                 [ dst>> ]
-                [ src1>> vreg>expr vector-not-src ]
+                [ src1>> vreg>insn vector-not-src ]
                 [ src2>> ]
                 [ rep>> ]
             } cleave \ ##andn-vector new-insn
         ] }
-        { [ dup src2>> vreg>expr vector-not? ] [
+        { [ dup src2>> vreg>insn vector-not? ] [
             {
                 [ dst>> ]
-                [ src2>> vreg>expr vector-not-src ]
+                [ src2>> vreg>insn vector-not-src ]
                 [ src1>> ]
                 [ rep>> ]
             } cleave \ ##andn-vector new-insn
@@ -99,22 +153,11 @@ M: ##and-vector rewrite
     } cond ;
 
 M: ##andn-vector rewrite
-    dup src1>> vreg>expr vector-not? [
+    dup src1>> vreg>insn vector-not? [
         {
             [ dst>> ]
-            [ src1>> vreg>expr vector-not-src ]
+            [ src1>> vreg>insn vector-not-src ]
             [ src2>> ]
             [ rep>> ]
         } cleave \ ##and-vector new-insn
     ] [ drop f ] if ;
-
-M: scalar>vector-expr simplify*
-    src>> vn>expr {
-        { [ dup vector>scalar-expr? ] [ src>> ] }
-        [ drop f ]
-    } cond ;
-
-M: shuffle-vector-imm-expr simplify*
-    [ src>> ] [ shuffle>> ] [ rep>> rep-length iota ] tri
-    sequence= [ drop f ] unless ;
-
diff --git a/basis/compiler/cfg/value-numbering/simplify/simplify.factor b/basis/compiler/cfg/value-numbering/simplify/simplify.factor
deleted file mode 100644 (file)
index 7a95711..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel accessors combinators classes math layouts
-sequences 
-compiler.cfg.instructions
-compiler.cfg.value-numbering.graph
-compiler.cfg.value-numbering.expressions ;
-IN: compiler.cfg.value-numbering.simplify
-
-! Return value of f means we didn't simplify.
-GENERIC: simplify* ( expr -- vn/expr/f )
-
-M: copy-expr simplify* src>> ;
-
-: simplify-unbox-alien ( expr -- vn/expr/f )
-    src>> vn>expr dup box-alien-expr? [ src>> ] [ drop f ] if ;
-
-M: unbox-alien-expr simplify* simplify-unbox-alien ;
-
-M: unbox-any-c-ptr-expr simplify* simplify-unbox-alien ;
-
-: expr-zero? ( expr -- ? ) T{ constant-expr f 0 } = ; inline
-
-: expr-one? ( expr -- ? ) T{ constant-expr f 1 } = ; inline
-
-: expr-neg-one? ( expr -- ? ) T{ constant-expr f -1 } = ; inline
-
-: >unary-expr< ( expr -- in ) src>> vn>expr ; inline
-
-M: neg-expr simplify*
-    >unary-expr< {
-        { [ dup neg-expr? ] [ src>> ] }
-        [ drop f ]
-    } cond ;
-
-M: not-expr simplify*
-    >unary-expr< {
-        { [ dup not-expr? ] [ src>> ] }
-        [ drop f ]
-    } cond ;
-
-: >binary-expr< ( expr -- in1 in2 )
-    [ src1>> vn>expr ] [ src2>> vn>expr ] bi ; inline
-
-: simplify-add ( expr -- vn/expr/f )
-    >binary-expr< {
-        { [ over expr-zero? ] [ nip ] }
-        { [ dup expr-zero? ] [ drop ] }
-        [ 2drop f ]
-    } cond ; inline
-
-M: add-expr simplify* simplify-add ;
-M: add-imm-expr simplify* simplify-add ;
-
-: simplify-sub ( expr -- vn/expr/f )
-    >binary-expr< {
-        { [ dup expr-zero? ] [ drop ] }
-        [ 2drop f ]
-    } cond ; inline
-
-M: sub-expr simplify* simplify-sub ;
-M: sub-imm-expr simplify* simplify-sub ;
-
-: simplify-mul ( expr -- vn/expr/f )
-    >binary-expr< {
-        { [ over expr-one? ] [ drop ] }
-        { [ dup expr-one? ] [ drop ] }
-        [ 2drop f ]
-    } cond ; inline
-
-M: mul-expr simplify* simplify-mul ;
-M: mul-imm-expr simplify* simplify-mul ;
-
-: simplify-and ( expr -- vn/expr/f )
-    >binary-expr< {
-        { [ 2dup eq? ] [ drop ] }
-        [ 2drop f ]
-    } cond ; inline
-
-M: and-expr simplify* simplify-and ;
-M: and-imm-expr simplify* simplify-and ;
-
-: simplify-or ( expr -- vn/expr/f )
-    >binary-expr< {
-        { [ 2dup eq? ] [ drop ] }
-        { [ over expr-zero? ] [ nip ] }
-        { [ dup expr-zero? ] [ drop ] }
-        [ 2drop f ]
-    } cond ; inline
-
-M: or-expr simplify* simplify-or ;
-M: or-imm-expr simplify* simplify-or ;
-
-: simplify-xor ( expr -- vn/expr/f )
-    >binary-expr< {
-        { [ over expr-zero? ] [ nip ] }
-        { [ dup expr-zero? ] [ drop ] }
-        [ 2drop f ]
-    } cond ; inline
-
-M: xor-expr simplify* simplify-xor ;
-M: xor-imm-expr simplify* simplify-xor ;
-
-: useless-shr? ( in1 in2 -- ? )
-    over shl-imm-expr?
-    [ [ src2>> ] [ expr>vn ] bi* = ] [ 2drop f ] if ; inline
-
-: simplify-shr ( expr -- vn/expr/f )
-    >binary-expr< {
-        { [ 2dup useless-shr? ] [ drop src1>> ] }
-        { [ dup expr-zero? ] [ drop ] }
-        [ 2drop f ]
-    } cond ; inline
-
-M: shr-expr simplify* simplify-shr ;
-M: shr-imm-expr simplify* simplify-shr ;
-
-: simplify-shl ( expr -- vn/expr/f )
-    >binary-expr< {
-        { [ dup expr-zero? ] [ drop ] }
-        [ 2drop f ]
-    } cond ; inline
-
-M: shl-expr simplify* simplify-shl ;
-M: shl-imm-expr simplify* simplify-shl ;
-
-M: box-displaced-alien-expr simplify*
-    [ base>> ] [ displacement>> ] bi {
-        { [ dup vn>expr expr-zero? ] [ drop ] }
-        [ 2drop f ]
-    } cond ;
-
-M: expr simplify* drop f ;
-
-: simplify ( expr -- vn )
-    dup simplify* {
-        { [ dup not ] [ drop expr>vn ] }
-        { [ dup expr? ] [ expr>vn nip ] }
-        { [ dup integer? ] [ nip ] }
-    } cond ;
-
-: number-values ( insn -- )
-    [ >expr simplify ] [ dst>> ] bi set-vn ;
diff --git a/basis/compiler/cfg/value-numbering/simplify/summary.txt b/basis/compiler/cfg/value-numbering/simplify/summary.txt
deleted file mode 100644 (file)
index 1027c83..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Algebraic simplification of expressions
diff --git a/basis/compiler/cfg/value-numbering/slots/authors.txt b/basis/compiler/cfg/value-numbering/slots/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/compiler/cfg/value-numbering/slots/slots.factor b/basis/compiler/cfg/value-numbering/slots/slots.factor
new file mode 100644 (file)
index 0000000..7c2b562
--- /dev/null
@@ -0,0 +1,24 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors combinators.short-circuit cpu.architecture fry
+kernel math
+compiler.cfg.instructions
+compiler.cfg.value-numbering.graph
+compiler.cfg.value-numbering.rewrite ;
+IN: compiler.cfg.value-numbering.slots
+
+: simplify-slot-addressing? ( insn -- ? )
+    complex-addressing?
+    [ slot>> vreg>insn ##add-imm? ] [ drop f ] if ;
+
+: simplify-slot-addressing ( insn -- insn/f )
+    dup simplify-slot-addressing? [
+        dup slot>> vreg>insn
+        [ src1>> >>slot ]
+        [ src2>> over scale>> '[ _ _ shift - ] change-tag ]
+        bi
+    ] [ drop f ] if ;
+
+M: ##slot rewrite simplify-slot-addressing ;
+M: ##set-slot rewrite simplify-slot-addressing ;
+M: ##write-barrier rewrite simplify-slot-addressing ;
index ac992ff98d7ec0e58eb15dcc6caa08f2d159d960..015368cf98ba4aa435cfa80996b719a53666f266 100644 (file)
@@ -4,7 +4,9 @@ cpu.architecture tools.test kernel math combinators.short-circuit
 accessors sequences compiler.cfg.predecessors locals compiler.cfg.dce
 compiler.cfg.ssa.destruction compiler.cfg.loop-detection
 compiler.cfg.representations compiler.cfg assocs vectors arrays
-layouts literals namespaces alien compiler.cfg.value-numbering.simd ;
+layouts literals namespaces alien compiler.cfg.value-numbering.simd
+system ;
+QUALIFIED-WITH: alien.c-types c
 IN: compiler.cfg.value-numbering.tests
 
 : trim-temps ( insns -- insns )
@@ -12,8 +14,12 @@ IN: compiler.cfg.value-numbering.tests
         dup {
             [ ##compare? ]
             [ ##compare-imm? ]
+            [ ##compare-integer? ]
+            [ ##compare-integer-imm? ]
             [ ##compare-float-unordered? ]
             [ ##compare-float-ordered? ]
+            [ ##test? ]
+            [ ##test-imm? ]
             [ ##test-vector? ]
             [ ##test-vector-branch? ]
         } 1|| [ f >>temp ] when
@@ -22,89 +28,195 @@ IN: compiler.cfg.value-numbering.tests
 ! Folding constants together
 [
     {
-        T{ ##load-constant f 0 0.0 }
-        T{ ##load-constant f 1 -0.0 }
-        T{ ##replace f 0 D 0 }
-        T{ ##replace f 1 D 1 }
+        T{ ##load-reference f 0 0.0 }
+        T{ ##load-reference f 1 -0.0 }
     }
 ] [
     {
-        T{ ##load-constant f 0 0.0 }
-        T{ ##load-constant f 1 -0.0 }
-        T{ ##replace f 0 D 0 }
-        T{ ##replace f 1 D 1 }
+        T{ ##load-reference f 0 0.0 }
+        T{ ##load-reference f 1 -0.0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##load-constant f 0 0.0 }
+        T{ ##load-reference f 0 0.0 }
         T{ ##copy f 1 0 any-rep }
-        T{ ##replace f 0 D 0 }
-        T{ ##replace f 1 D 1 }
     }
 ] [
     {
-        T{ ##load-constant f 0 0.0 }
-        T{ ##load-constant f 1 0.0 }
-        T{ ##replace f 0 D 0 }
-        T{ ##replace f 1 D 1 }
+        T{ ##load-reference f 0 0.0 }
+        T{ ##load-reference f 1 0.0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##load-constant f 0 t }
+        T{ ##load-reference f 0 t }
         T{ ##copy f 1 0 any-rep }
-        T{ ##replace f 0 D 0 }
-        T{ ##replace f 1 D 1 }
     }
 ] [
     {
-        T{ ##load-constant f 0 t }
-        T{ ##load-constant f 1 t }
-        T{ ##replace f 0 D 0 }
-        T{ ##replace f 1 D 1 }
+        T{ ##load-reference f 0 t }
+        T{ ##load-reference f 1 t }
     } value-numbering-step
 ] unit-test
 
-! Compare propagation
+! ##load-reference/##replace fusion
+cpu x86? [
+    [
+        {
+            T{ ##load-integer f 0 10 }
+            T{ ##replace-imm f 10 D 0 }
+        }
+    ] [
+        {
+            T{ ##load-integer f 0 10 }
+            T{ ##replace f 0 D 0 }
+        } value-numbering-step
+    ] unit-test
+
+    [
+        {
+            T{ ##load-reference f 0 f }
+            T{ ##replace-imm f f D 0 }
+        }
+    ] [
+        {
+            T{ ##load-reference f 0 f }
+            T{ ##replace f 0 D 0 }
+        } value-numbering-step
+    ] unit-test
+] when
+
+cpu x86.32? [
+    [
+        {
+            T{ ##load-reference f 0 + }
+            T{ ##replace-imm f + D 0 }
+        }
+    ] [
+        {
+            T{ ##load-reference f 0 + }
+            T{ ##replace f 0 D 0 }
+        } value-numbering-step
+    ] unit-test
+] when
+
+cpu x86.64? [
+    [
+        {
+            T{ ##load-integer f 0 10,000,000,000 }
+            T{ ##replace f 0 D 0 }
+        }
+    ] [
+        {
+            T{ ##load-integer f 0 10,000,000,000 }
+            T{ ##replace f 0 D 0 }
+        } value-numbering-step
+    ] unit-test
+
+    ! Boundary case
+    [
+        {
+            T{ ##load-integer f 0 HEX: 7fffffff }
+            T{ ##replace f 0 D 0 }
+        }
+    ] [
+        {
+            T{ ##load-integer f 0 HEX: 7fffffff }
+            T{ ##replace f 0 D 0 }
+        } value-numbering-step
+    ] unit-test
+] when
+
+! Double compare elimination
+[
+    {
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##compare f 4 2 1 cc= }
+        T{ ##copy f 6 4 any-rep }
+        T{ ##replace f 6 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##compare f 4 2 1 cc= }
+        T{ ##compare-imm f 6 4 f cc/= }
+        T{ ##replace f 6 D 0 }
+    } value-numbering-step trim-temps
+] unit-test
+
+[
+    {
+        T{ ##peek f 1 D 1 }
+        T{ ##compare-imm f 2 1 16 cc= }
+        T{ ##copy f 3 2 any-rep }
+        T{ ##replace f 3 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 1 D 1 }
+        T{ ##compare-imm f 2 1 16 cc= }
+        T{ ##compare-imm f 3 2 f cc/= }
+        T{ ##replace f 3 D 0 }
+    } value-numbering-step trim-temps
+] unit-test
+
 [
     {
-        T{ ##load-reference f 1 + }
-        T{ ##peek f 2 D 0 }
-        T{ ##compare f 4 2 1 cc> }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##compare-integer f 4 2 1 cc> }
         T{ ##copy f 6 4 any-rep }
         T{ ##replace f 6 D 0 }
     }
 ] [
     {
-        T{ ##load-reference f 1 + }
-        T{ ##peek f 2 D 0 }
-        T{ ##compare f 4 2 1 cc> }
-        T{ ##compare-imm f 6 4 $[ \ f type-number ] cc/= }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##compare-integer f 4 2 1 cc> }
+        T{ ##compare-imm f 6 4 f cc/= }
         T{ ##replace f 6 D 0 }
     } value-numbering-step trim-temps
 ] unit-test
 
 [
     {
-        T{ ##load-reference f 1 + }
-        T{ ##peek f 2 D 0 }
-        T{ ##compare f 4 2 1 cc<= }
-        T{ ##compare f 6 2 1 cc/<= }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##compare-integer f 4 2 1 cc<= }
+        T{ ##compare-integer f 6 2 1 cc/<= }
         T{ ##replace f 6 D 0 }
     }
 ] [
     {
-        T{ ##load-reference f 1 + }
-        T{ ##peek f 2 D 0 }
-        T{ ##compare f 4 2 1 cc<= }
-        T{ ##compare-imm f 6 4 $[ \ f type-number ] cc= }
+        T{ ##peek f 1 D 1 }
+        T{ ##peek f 2 D 2 }
+        T{ ##compare-integer f 4 2 1 cc<= }
+        T{ ##compare-imm f 6 4 f cc= }
         T{ ##replace f 6 D 0 }
     } value-numbering-step trim-temps
 ] unit-test
 
+[
+    {
+        T{ ##peek f 1 D 1 }
+        T{ ##compare-integer-imm f 2 1 100 cc<= }
+        T{ ##compare-integer-imm f 3 1 100 cc/<= }
+        T{ ##replace f 3 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 1 D 1 }
+        T{ ##compare-integer-imm f 2 1 100 cc<= }
+        T{ ##compare-imm f 3 2 f cc= }
+        T{ ##replace f 3 D 0 }
+    } value-numbering-step trim-temps
+] unit-test
+
 [
     {
         T{ ##peek f 8 D 0 }
@@ -118,7 +230,7 @@ IN: compiler.cfg.value-numbering.tests
         T{ ##peek f 8 D 0 }
         T{ ##peek f 9 D -1 }
         T{ ##compare-float-unordered f 12 8 9 cc< }
-        T{ ##compare-imm f 14 12 $[ \ f type-number ] cc= }
+        T{ ##compare-imm f 14 12 f cc= }
         T{ ##replace f 14 D 0 }
     } value-numbering-step trim-temps
 ] unit-test
@@ -127,15 +239,61 @@ IN: compiler.cfg.value-numbering.tests
     {
         T{ ##peek f 29 D -1 }
         T{ ##peek f 30 D -2 }
-        T{ ##compare f 33 29 30 cc<= }
-        T{ ##compare-branch f 29 30 cc<= }
+        T{ ##compare f 33 29 30 cc= }
+        T{ ##compare-branch f 29 30 cc= }
+    }
+] [
+    {
+        T{ ##peek f 29 D -1 }
+        T{ ##peek f 30 D -2 }
+        T{ ##compare f 33 29 30 cc= }
+        T{ ##compare-imm-branch f 33 f cc/= }
+    } value-numbering-step trim-temps
+] unit-test
+
+[
+    {
+        T{ ##peek f 29 D -1 }
+        T{ ##peek f 30 D -2 }
+        T{ ##compare-integer f 33 29 30 cc<= }
+        T{ ##compare-integer-branch f 29 30 cc<= }
     }
 ] [
     {
         T{ ##peek f 29 D -1 }
         T{ ##peek f 30 D -2 }
-        T{ ##compare f 33 29 30 cc<= }
-        T{ ##compare-imm-branch f 33 $[ \ f type-number ] cc/= }
+        T{ ##compare-integer f 33 29 30 cc<= }
+        T{ ##compare-imm-branch f 33 f cc/= }
+    } value-numbering-step trim-temps
+] unit-test
+
+[
+    {
+        T{ ##peek f 29 D -1 }
+        T{ ##peek f 30 D -2 }
+        T{ ##test f 33 29 30 cc= }
+        T{ ##test-branch f 29 30 cc= }
+    }
+] [
+    {
+        T{ ##peek f 29 D -1 }
+        T{ ##peek f 30 D -2 }
+        T{ ##test f 33 29 30 cc= }
+        T{ ##compare-imm-branch f 33 f cc/= }
+    } value-numbering-step trim-temps
+] unit-test
+
+[
+    {
+        T{ ##peek f 29 D -1 }
+        T{ ##test-imm f 33 29 30 cc= }
+        T{ ##test-imm-branch f 29 30 cc= }
+    }
+] [
+    {
+        T{ ##peek f 29 D -1 }
+        T{ ##test-imm f 33 29 30 cc= }
+        T{ ##compare-imm-branch f 33 f cc/= }
     } value-numbering-step trim-temps
 ] unit-test
 
@@ -149,21 +307,37 @@ IN: compiler.cfg.value-numbering.tests
     {
         T{ ##peek f 1 D -1 }
         T{ ##test-vector f 2 1 f float-4-rep vcc-any }
-        T{ ##compare-imm-branch f 2 $[ \ f type-number ] cc/= }
+        T{ ##compare-imm-branch f 2 f cc/= }
     } value-numbering-step trim-temps
 ] unit-test
 
-! Immediate operand conversion
+cpu x86.32? [
+    [
+        {
+            T{ ##peek f 1 D 0 }
+            T{ ##compare-imm f 2 1 + cc= }
+            T{ ##compare-imm-branch f 1 + cc= }
+        }
+    ] [
+        {
+            T{ ##peek f 1 D 0 }
+            T{ ##compare-imm f 2 1 + cc= }
+            T{ ##compare-imm-branch f 2 f cc/= }
+        } value-numbering-step trim-temps
+    ] unit-test
+] when
+
+! Immediate operand fusion
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##add-imm f 2 0 100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##add f 2 0 1 }
     } value-numbering-step
 ] unit-test
@@ -171,13 +345,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##add-imm f 2 0 100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##add f 2 1 0 }
     } value-numbering-step
 ] unit-test
@@ -185,13 +359,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##add-imm f 2 0 -100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##sub f 2 0 1 }
     } value-numbering-step
 ] unit-test
@@ -199,7 +373,7 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 0 }
+        T{ ##load-integer f 1 0 }
     }
 ] [
     {
@@ -211,13 +385,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##mul-imm f 2 0 100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##mul f 2 0 1 }
     } value-numbering-step
 ] unit-test
@@ -225,13 +399,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##mul-imm f 2 0 100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##mul f 2 1 0 }
     } value-numbering-step
 ] unit-test
@@ -251,13 +425,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 -1 }
+        T{ ##load-integer f 1 -1 }
         T{ ##neg f 2 0 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 -1 }
+        T{ ##load-integer f 1 -1 }
         T{ ##mul f 2 0 1 }
     } value-numbering-step
 ] unit-test
@@ -265,13 +439,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 -1 }
+        T{ ##load-integer f 1 -1 }
         T{ ##neg f 2 0 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 -1 }
+        T{ ##load-integer f 1 -1 }
         T{ ##mul f 2 1 0 }
     } value-numbering-step
 ] unit-test
@@ -279,13 +453,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 0 }
+        T{ ##load-integer f 1 0 }
         T{ ##neg f 2 0 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 0 }
+        T{ ##load-integer f 1 0 }
         T{ ##sub f 2 1 0 }
     } value-numbering-step
 ] unit-test
@@ -293,19 +467,33 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 0 }
+        T{ ##load-integer f 1 0 }
         T{ ##neg f 2 0 }
         T{ ##copy f 3 0 any-rep }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 0 }
+        T{ ##load-integer f 1 0 }
         T{ ##sub f 2 1 0 }
         T{ ##sub f 3 1 2 }
     } value-numbering-step
 ] unit-test
 
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##neg f 1 0 }
+        T{ ##copy f 2 0 any-rep }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##neg f 1 0 }
+        T{ ##neg f 2 1 }
+    } value-numbering-step
+] unit-test
+
 [
     {
         T{ ##peek f 0 D 0 }
@@ -323,13 +511,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##and-imm f 2 0 100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##and f 2 0 1 }
     } value-numbering-step
 ] unit-test
@@ -337,13 +525,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##and-imm f 2 0 100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##and f 2 1 0 }
     } value-numbering-step
 ] unit-test
@@ -351,13 +539,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##or-imm f 2 0 100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##or f 2 0 1 }
     } value-numbering-step
 ] unit-test
@@ -365,13 +553,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##or-imm f 2 0 100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##or f 2 1 0 }
     } value-numbering-step
 ] unit-test
@@ -379,13 +567,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##xor-imm f 2 0 100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##xor f 2 0 1 }
     } value-numbering-step
 ] unit-test
@@ -393,13 +581,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##xor-imm f 2 0 100 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
+        T{ ##load-integer f 1 100 }
         T{ ##xor f 2 1 0 }
     } value-numbering-step
 ] unit-test
@@ -407,389 +595,1315 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##compare-imm f 2 0 100 cc<= }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare-imm f 2 0 100 cc= }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##compare f 2 0 1 cc<= }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare f 2 0 1 cc= }
     } value-numbering-step trim-temps
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-constant f 1 3.5 }
-        T{ ##compare f 2 0 1 cc= }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare-integer-imm f 2 0 100 cc<= }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-constant f 1 3.5 }
-        T{ ##compare f 2 0 1 cc= }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare-integer f 2 0 1 cc<= }
     } value-numbering-step trim-temps
 ] unit-test
 
+cpu x86.32? [
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-reference f 1 + }
+            T{ ##compare-imm f 2 0 + cc= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-reference f 1 + }
+            T{ ##compare f 2 0 1 cc= }
+        } value-numbering-step trim-temps
+    ] unit-test
+
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-reference f 1 + }
+            T{ ##compare-imm-branch f 0 + cc= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-reference f 1 + }
+            T{ ##compare-branch f 0 1 cc= }
+        } value-numbering-step trim-temps
+    ] unit-test
+] when
+
+cpu x86.32? [
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-reference f 1 3.5 }
+            T{ ##compare f 2 0 1 cc= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-reference f 1 3.5 }
+            T{ ##compare f 2 0 1 cc= }
+        } value-numbering-step trim-temps
+    ] unit-test
+
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-reference f 1 3.5 }
+            T{ ##compare-branch f 0 1 cc= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-reference f 1 3.5 }
+            T{ ##compare-branch f 0 1 cc= }
+        } value-numbering-step trim-temps
+    ] unit-test
+] unless
+
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##compare-imm f 2 0 100 cc>= }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare-integer-imm f 2 0 100 cc>= }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##compare f 2 1 0 cc<= }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare-integer f 2 1 0 cc<= }
     } value-numbering-step trim-temps
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##compare-imm-branch f 0 100 cc<= }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare-integer-imm-branch f 0 100 cc<= }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##compare-branch f 0 1 cc<= }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare-integer-branch f 0 1 cc<= }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-constant f 1 3.5 }
-        T{ ##compare-branch f 0 1 cc= }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare-integer-imm-branch f 0 100 cc>= }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-constant f 1 3.5 }
-        T{ ##compare-branch f 0 1 cc= }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare-integer-branch f 1 0 cc<= }
     } value-numbering-step trim-temps
 ] unit-test
 
+! Compare folding
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##compare-imm-branch f 0 100 cc>= }
+        T{ ##load-integer f 1 100 }
+        T{ ##load-integer f 2 200 }
+        T{ ##load-reference f 3 t }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##compare-branch f 1 0 cc<= }
+        T{ ##load-integer f 1 100 }
+        T{ ##load-integer f 2 200 }
+        T{ ##compare-integer f 3 1 2 cc<= }
     } value-numbering-step trim-temps
 ] unit-test
 
-! Reassociation
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##add-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##add-imm f 4 0 150 }
+        T{ ##load-integer f 1 100 }
+        T{ ##load-integer f 2 200 }
+        T{ ##load-reference f 3 f }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##add f 2 0 1 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##add f 4 2 3 }
-    } value-numbering-step
+        T{ ##load-integer f 1 100 }
+        T{ ##load-integer f 2 200 }
+        T{ ##compare-integer f 3 1 2 cc= }
+    } value-numbering-step trim-temps
 ] unit-test
 
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##add-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##add-imm f 4 0 150 }
+        T{ ##load-integer f 1 100 }
+        T{ ##load-reference f 2 f }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##add f 2 1 0 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##add f 4 3 2 }
+        T{ ##load-integer f 1 100 }
+        T{ ##compare-integer-imm f 2 1 123 cc= }
+    } value-numbering-step trim-temps
+] unit-test
+
+[
+    {
+        T{ ##load-integer f 1 10 }
+        T{ ##load-integer f 2 20 }
+        T{ ##load-reference f 3 f }
+    }
+] [
+    {
+        T{ ##load-integer f 1 10 }
+        T{ ##load-integer f 2 20 }
+        T{ ##compare-integer f 3 1 2 cc= }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##add-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##add-imm f 4 0 50 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
+        T{ ##load-reference f 3 t }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##add f 2 0 1 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##sub f 4 2 3 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
+        T{ ##compare-integer f 3 1 2 cc/= }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##add-imm f 2 0 -100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##add-imm f 4 0 -150 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
+        T{ ##load-reference f 3 t }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##sub f 2 0 1 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##sub f 4 2 3 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
+        T{ ##compare-integer f 3 1 2 cc< }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##mul-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##mul-imm f 4 0 5000 }
+        T{ ##load-integer f 1 10 }
+        T{ ##load-integer f 2 20 }
+        T{ ##load-reference f 3 f }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##mul f 2 0 1 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##mul f 4 2 3 }
+        T{ ##load-integer f 1 10 }
+        T{ ##load-integer f 2 20 }
+        T{ ##compare-integer f 3 2 1 cc< }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##mul-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##mul-imm f 4 0 5000 }
+        T{ ##load-reference f 1 f }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##mul f 2 1 0 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##mul f 4 3 2 }
+        T{ ##compare-integer f 1 0 0 cc< }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##and-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##and-imm f 4 0 32 }
+        T{ ##copy f 1 0 any-rep }
+        T{ ##load-reference f 2 f }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##and f 2 0 1 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##and f 4 2 3 }
+        T{ ##copy f 1 0 any-rep }
+        T{ ##compare-integer f 2 0 1 cc< }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##and-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##and-imm f 4 0 32 }
+        T{ ##load-reference f 1 t }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##and f 2 1 0 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##and f 4 3 2 }
+        T{ ##compare-integer f 1 0 0 cc<= }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##or-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##or-imm f 4 0 118 }
+        T{ ##load-reference f 1 f }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##or f 2 0 1 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##or f 4 2 3 }
+        T{ ##compare-integer f 1 0 0 cc> }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##or-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##or-imm f 4 0 118 }
+        T{ ##load-reference f 1 t }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##or f 2 1 0 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##or f 4 3 2 }
+        T{ ##compare-integer f 1 0 0 cc>= }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##xor-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##xor-imm f 4 0 86 }
+        T{ ##load-reference f 1 f }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##xor f 2 0 1 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##xor f 4 2 3 }
+        T{ ##compare-integer f 1 0 0 cc/= }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##xor-imm f 2 0 100 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##xor-imm f 4 0 86 }
+        T{ ##load-reference f 1 t }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 100 }
-        T{ ##xor f 2 1 0 }
-        T{ ##load-immediate f 3 50 }
-        T{ ##xor f 4 3 2 }
+        T{ ##compare-integer f 1 0 0 cc= }
     } value-numbering-step
 ] unit-test
 
-! Simplification
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##peek f 1 D 1 }
-        T{ ##load-immediate f 2 0 }
-        T{ ##copy f 3 0 any-rep }
-        T{ ##replace f 3 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##load-reference f 2 t }
+    }
+] [
+    {
+        T{ ##load-integer f 1 10 }
+        T{ ##compare-imm f 2 1 10 cc= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##load-integer f 1 10 }
+        T{ ##load-reference f 2 f }
+    }
+] [
+    {
+        T{ ##load-integer f 1 10 }
+        T{ ##compare-imm f 2 1 20 cc= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##load-integer f 1 10 }
+        T{ ##load-reference f 2 t }
+    }
+] [
+    {
+        T{ ##load-integer f 1 10 }
+        T{ ##compare-imm f 2 1 100 cc/= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##load-integer f 1 10 }
+        T{ ##load-reference f 2 f }
+    }
+] [
+    {
+        T{ ##load-integer f 1 10 }
+        T{ ##compare-imm f 2 1 10 cc/= }
+    } value-numbering-step
+] unit-test
+
+cpu x86.32? [
+    [
+        {
+            T{ ##load-reference f 1 + }
+            T{ ##load-reference f 2 f }
+        }
+    ] [
+        {
+            T{ ##load-reference f 1 + }
+            T{ ##compare-imm f 2 1 + cc/= }
+        } value-numbering-step
+    ] unit-test
+
+    [
+        {
+            T{ ##load-reference f 1 + }
+            T{ ##load-reference f 2 t }
+        }
+    ] [
+        {
+            T{ ##load-reference f 1 + }
+            T{ ##compare-imm f 2 1 * cc/= }
+        } value-numbering-step
+    ] unit-test
+
+    [
+        {
+            T{ ##load-reference f 1 + }
+            T{ ##load-reference f 2 t }
+        }
+    ] [
+        {
+            T{ ##load-reference f 1 + }
+            T{ ##compare-imm f 2 1 + cc= }
+        } value-numbering-step
+    ] unit-test
+
+    [
+        {
+            T{ ##load-reference f 1 + }
+            T{ ##load-reference f 2 f }
+        }
+    ] [
+        {
+            T{ ##load-reference f 1 + }
+            T{ ##compare-imm f 2 1 * cc= }
+        } value-numbering-step
+    ] unit-test
+] when
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-reference f 1 t }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##compare f 1 0 0 cc= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-reference f 1 f }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##compare f 1 0 0 cc/= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##load-integer f 1 12 }
+        T{ ##load-reference f 3 t }
+    }
+] [
+    {
+        T{ ##load-integer f 1 12 }
+        T{ ##test-imm f 3 1 13 cc/= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##load-integer f 1 15 }
+        T{ ##load-reference f 3 f }
+    }
+] [
+    {
+        T{ ##load-integer f 1 15 }
+        T{ ##test-imm f 3 1 16 cc/= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##load-integer f 1 12 }
+        T{ ##load-reference f 3 f }
+    }
+] [
+    {
+        T{ ##load-integer f 1 12 }
+        T{ ##test-imm f 3 1 13 cc= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##load-integer f 1 15 }
+        T{ ##load-reference f 3 t }
+    }
+] [
+    {
+        T{ ##load-integer f 1 15 }
+        T{ ##test-imm f 3 1 16 cc= }
+    } value-numbering-step
+] unit-test
+
+! Rewriting a ##test of an ##and into a ##test
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##and f 2 0 1 }
+        T{ ##test f 3 0 1 cc= }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##and f 2 0 1 }
+        T{ ##test f 3 2 2 cc= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##and-imm f 2 0 12 }
+        T{ ##test-imm f 3 0 12 cc= }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##and-imm f 2 0 12 }
+        T{ ##test f 3 2 2 cc= }
+    } value-numbering-step
+] unit-test
+
+! Rewriting ##test into ##test-imm
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##test-imm f 2 0 10 cc= }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##test f 2 0 1 cc= }
+    } value-numbering-step trim-temps
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##test-imm f 2 0 10 cc= }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##test f 2 1 0 cc= }
+    } value-numbering-step trim-temps
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##test-imm-branch f 0 10 cc= }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##test-branch f 0 1 cc= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##test-imm-branch f 0 10 cc= }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##test-branch f 1 0 cc= }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##test-imm-branch f 0 10 cc= }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 10 }
+        T{ ##test-branch f 1 0 cc= }
+    } value-numbering-step
+] unit-test
+
+! Make sure the immediate fits
+cpu x86.64? [
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-integer f 1 100000000000 }
+            T{ ##test f 2 1 0 cc= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-integer f 1 100000000000 }
+            T{ ##test f 2 1 0 cc= }
+        } value-numbering-step
+    ] unit-test
+
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-integer f 1 100000000000 }
+            T{ ##test-branch f 1 0 cc= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##load-integer f 1 100000000000 }
+            T{ ##test-branch f 1 0 cc= }
+        } value-numbering-step
+    ] unit-test
+] when
+
+! Rewriting ##compare into ##test
+cpu x86? [
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##test f 1 0 0 cc= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##compare-integer-imm f 1 0 0 cc= }
+        } value-numbering-step
+    ] unit-test
+
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##test f 1 0 0 cc/= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##compare-integer-imm f 1 0 0 cc/= }
+        } value-numbering-step
+    ] unit-test
+
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##compare-integer-imm f 1 0 0 cc<= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##compare-integer-imm f 1 0 0 cc<= }
+        } value-numbering-step
+    ] unit-test
+    
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##test-branch f 0 0 cc= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##compare-integer-imm-branch f 0 0 cc= }
+        } value-numbering-step
+    ] unit-test
+
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##test-branch f 0 0 cc/= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##compare-integer-imm-branch f 0 0 cc/= }
+        } value-numbering-step
+    ] unit-test
+
+    [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##compare-integer-imm-branch f 0 0 cc<= }
+        }
+    ] [
+        {
+            T{ ##peek f 0 D 0 }
+            T{ ##compare-integer-imm-branch f 0 0 cc<= }
+        } value-numbering-step
+    ] unit-test
+] when
+
+! Reassociation
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##add-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##add-imm f 4 0 150 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##add f 2 0 1 }
+        T{ ##load-integer f 3 50 }
+        T{ ##add f 4 2 3 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##add-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##add-imm f 4 0 150 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##add f 2 1 0 }
+        T{ ##load-integer f 3 50 }
+        T{ ##add f 4 3 2 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##add-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##add-imm f 4 0 50 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##add f 2 0 1 }
+        T{ ##load-integer f 3 50 }
+        T{ ##sub f 4 2 3 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##add-imm f 2 0 -100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##add-imm f 4 0 -150 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##sub f 2 0 1 }
+        T{ ##load-integer f 3 50 }
+        T{ ##sub f 4 2 3 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##mul-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##mul-imm f 4 0 5000 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##mul f 2 0 1 }
+        T{ ##load-integer f 3 50 }
+        T{ ##mul f 4 2 3 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##mul-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##mul-imm f 4 0 5000 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##mul f 2 1 0 }
+        T{ ##load-integer f 3 50 }
+        T{ ##mul f 4 3 2 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##and-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##and-imm f 4 0 32 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##and f 2 0 1 }
+        T{ ##load-integer f 3 50 }
+        T{ ##and f 4 2 3 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##and-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##and-imm f 4 0 32 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##and f 2 1 0 }
+        T{ ##load-integer f 3 50 }
+        T{ ##and f 4 3 2 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##or-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##or-imm f 4 0 118 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##or f 2 0 1 }
+        T{ ##load-integer f 3 50 }
+        T{ ##or f 4 2 3 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##or-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##or-imm f 4 0 118 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##or f 2 1 0 }
+        T{ ##load-integer f 3 50 }
+        T{ ##or f 4 3 2 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##xor-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##xor-imm f 4 0 86 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##xor f 2 0 1 }
+        T{ ##load-integer f 3 50 }
+        T{ ##xor f 4 2 3 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##xor-imm f 2 0 100 }
+        T{ ##load-integer f 3 50 }
+        T{ ##xor-imm f 4 0 86 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 100 }
+        T{ ##xor f 2 1 0 }
+        T{ ##load-integer f 3 50 }
+        T{ ##xor f 4 3 2 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##shl-imm f 1 0 10 }
+        T{ ##shl-imm f 2 0 21 }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##shl-imm f 1 0 10 }
+        T{ ##shl-imm f 2 1 11 }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##shl-imm f 1 0 10 }
+        T{ ##shl-imm f 2 1 $[ cell-bits 1 - ] }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##shl-imm f 1 0 10 }
+        T{ ##shl-imm f 2 1 $[ cell-bits 1 - ] }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##sar-imm f 1 0 10 }
+        T{ ##sar-imm f 2 0 21 }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##sar-imm f 1 0 10 }
+        T{ ##sar-imm f 2 1 11 }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##sar-imm f 1 0 10 }
+        T{ ##sar-imm f 2 1 $[ cell-bits 1 - ] }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##sar-imm f 1 0 10 }
+        T{ ##sar-imm f 2 1 $[ cell-bits 1 - ] }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##shr-imm f 1 0 10 }
+        T{ ##shr-imm f 2 0 21 }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##shr-imm f 1 0 10 }
+        T{ ##shr-imm f 2 1 11 }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##shr-imm f 1 0 10 }
+        T{ ##shr-imm f 2 1 $[ cell-bits 1 - ] }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##shr-imm f 1 0 10 }
+        T{ ##shr-imm f 2 1 $[ cell-bits 1 - ] }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##shr-imm f 1 0 10 }
+        T{ ##sar-imm f 2 1 11 }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##shr-imm f 1 0 10 }
+        T{ ##sar-imm f 2 1 11 }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+! Distributive law
+2 \ vreg-counter set-global
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##add-imm f 1 0 10 }
+        T{ ##shl-imm f 3 0 2 }
+        T{ ##add-imm f 2 3 40 }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##add-imm f 1 0 10 }
+        T{ ##shl-imm f 2 1 2 }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##add-imm f 1 0 10 }
+        T{ ##mul-imm f 4 0 3 }
+        T{ ##add-imm f 2 4 30 }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##add-imm f 1 0 10 }
+        T{ ##mul-imm f 2 1 3 }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##add-imm f 1 0 -10 }
+        T{ ##shl-imm f 5 0 2 }
+        T{ ##add-imm f 2 5 -40 }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##sub-imm f 1 0 10 }
+        T{ ##shl-imm f 2 1 2 }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##add-imm f 1 0 -10 }
+        T{ ##mul-imm f 6 0 3 }
+        T{ ##add-imm f 2 6 -30 }
+        T{ ##replace f 2 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##sub-imm f 1 0 10 }
+        T{ ##mul-imm f 2 1 3 }
+        T{ ##replace f 2 D 0 }
+    } value-numbering-step
+] unit-test
+
+! Simplification
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##copy f 3 0 any-rep }
+        T{ ##replace f 3 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##add-imm f 3 0 0 }
+        T{ ##replace f 3 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##copy f 3 0 any-rep }
+        T{ ##replace f 3 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##or-imm f 3 0 0 }
+        T{ ##replace f 3 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##copy f 3 0 any-rep }
+        T{ ##replace f 3 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##xor-imm f 3 0 0 }
+        T{ ##replace f 3 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##and-imm f 1 0 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##copy f 1 0 any-rep }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##and-imm f 1 0 -1 }
+        T{ ##replace f 1 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##copy f 1 0 any-rep }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##and f 1 0 0 }
+        T{ ##replace f 1 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##copy f 1 0 any-rep }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##or-imm f 1 0 0 }
+        T{ ##replace f 1 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 -1 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##or-imm f 1 0 -1 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##copy f 1 0 any-rep }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##or f 1 0 0 }
+        T{ ##replace f 1 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##copy f 1 0 any-rep }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##xor-imm f 1 0 0 }
+        T{ ##replace f 1 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##not f 1 0 }
+        T{ ##replace f 1 D 0 }
+    }
+] [
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##xor-imm f 1 0 -1 }
+        T{ ##replace f 1 D 0 }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 1 0 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##peek f 1 D 1 }
-        T{ ##sub f 2 1 1 }
-        T{ ##add f 3 0 2 }
-        T{ ##replace f 3 D 0 }
+        T{ ##xor f 1 0 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##peek f 1 D 1 }
-        T{ ##load-immediate f 2 0 }
-        T{ ##copy f 3 0 any-rep }
-        T{ ##replace f 3 D 0 }
+        T{ ##copy f 2 0 any-rep }
+        T{ ##replace f 2 D 0 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##peek f 1 D 1 }
-        T{ ##sub f 2 1 1 }
-        T{ ##sub f 3 0 2 }
-        T{ ##replace f 3 D 0 }
+        T{ ##mul-imm f 2 0 1 }
+        T{ ##replace f 2 D 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##peek f 1 D 1 }
-        T{ ##load-immediate f 2 0 }
-        T{ ##copy f 3 0 any-rep }
-        T{ ##replace f 3 D 0 }
+        T{ ##copy f 2 0 any-rep }
+        T{ ##replace f 2 D 0 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##peek f 1 D 1 }
-        T{ ##sub f 2 1 1 }
-        T{ ##or f 3 0 2 }
-        T{ ##replace f 3 D 0 }
+        T{ ##shl-imm f 2 0 0 }
+        T{ ##replace f 2 D 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##peek f 1 D 1 }
-        T{ ##load-immediate f 2 0 }
-        T{ ##copy f 3 0 any-rep }
-        T{ ##replace f 3 D 0 }
+        T{ ##copy f 2 0 any-rep }
+        T{ ##replace f 2 D 0 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##peek f 1 D 1 }
-        T{ ##sub f 2 1 1 }
-        T{ ##xor f 3 0 2 }
-        T{ ##replace f 3 D 0 }
+        T{ ##shr-imm f 2 0 0 }
+        T{ ##replace f 2 D 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
         T{ ##copy f 2 0 any-rep }
         T{ ##replace f 2 D 0 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
-        T{ ##mul f 2 0 1 }
+        T{ ##sar-imm f 2 0 0 }
         T{ ##replace f 2 D 0 }
     } value-numbering-step
 ] unit-test
@@ -798,15 +1912,15 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 3 }
-        T{ ##load-immediate f 3 4 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 3 }
+        T{ ##load-integer f 3 4 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 3 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 3 }
         T{ ##add f 3 1 2 }
     } value-numbering-step
 ] unit-test
@@ -814,15 +1928,15 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 3 }
-        T{ ##load-immediate f 3 -2 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 3 }
+        T{ ##load-integer f 3 -2 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 3 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 3 }
         T{ ##sub f 3 1 2 }
     } value-numbering-step
 ] unit-test
@@ -830,15 +1944,15 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 2 }
-        T{ ##load-immediate f 2 3 }
-        T{ ##load-immediate f 3 6 }
+        T{ ##load-integer f 1 2 }
+        T{ ##load-integer f 2 3 }
+        T{ ##load-integer f 3 6 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 2 }
-        T{ ##load-immediate f 2 3 }
+        T{ ##load-integer f 1 2 }
+        T{ ##load-integer f 2 3 }
         T{ ##mul f 3 1 2 }
     } value-numbering-step
 ] unit-test
@@ -846,15 +1960,15 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 2 }
-        T{ ##load-immediate f 2 1 }
-        T{ ##load-immediate f 3 0 }
+        T{ ##load-integer f 1 2 }
+        T{ ##load-integer f 2 1 }
+        T{ ##load-integer f 3 0 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 2 }
-        T{ ##load-immediate f 2 1 }
+        T{ ##load-integer f 1 2 }
+        T{ ##load-integer f 2 1 }
         T{ ##and f 3 1 2 }
     } value-numbering-step
 ] unit-test
@@ -862,15 +1976,15 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 2 }
-        T{ ##load-immediate f 2 1 }
-        T{ ##load-immediate f 3 3 }
+        T{ ##load-integer f 1 2 }
+        T{ ##load-integer f 2 1 }
+        T{ ##load-integer f 3 3 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 2 }
-        T{ ##load-immediate f 2 1 }
+        T{ ##load-integer f 1 2 }
+        T{ ##load-integer f 2 1 }
         T{ ##or f 3 1 2 }
     } value-numbering-step
 ] unit-test
@@ -878,15 +1992,15 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 2 }
-        T{ ##load-immediate f 2 3 }
-        T{ ##load-immediate f 3 1 }
+        T{ ##load-integer f 1 2 }
+        T{ ##load-integer f 2 3 }
+        T{ ##load-integer f 3 1 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 2 }
-        T{ ##load-immediate f 2 3 }
+        T{ ##load-integer f 1 2 }
+        T{ ##load-integer f 2 3 }
         T{ ##xor f 3 1 2 }
     } value-numbering-step
 ] unit-test
@@ -894,13 +2008,13 @@ IN: compiler.cfg.value-numbering.tests
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 3 8 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 3 8 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
+        T{ ##load-integer f 1 1 }
         T{ ##shl-imm f 3 1 3 }
     } value-numbering-step
 ] unit-test
@@ -909,13 +2023,13 @@ cell 8 = [
     [
         {
             T{ ##peek f 0 D 0 }
-            T{ ##load-immediate f 1 -1 }
-            T{ ##load-immediate f 3 HEX: ffffffffffff }
+            T{ ##load-integer f 1 -1 }
+            T{ ##load-integer f 3 HEX: ffffffffffff }
         }
     ] [
         {
             T{ ##peek f 0 D 0 }
-            T{ ##load-immediate f 1 -1 }
+            T{ ##load-integer f 1 -1 }
             T{ ##shr-imm f 3 1 16 }
         } value-numbering-step
     ] unit-test
@@ -924,13 +2038,13 @@ cell 8 = [
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 -8 }
-        T{ ##load-immediate f 3 -4 }
+        T{ ##load-integer f 1 -8 }
+        T{ ##load-integer f 3 -4 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 -8 }
+        T{ ##load-integer f 1 -8 }
         T{ ##sar-imm f 3 1 1 }
     } value-numbering-step
 ] unit-test
@@ -939,14 +2053,14 @@ cell 8 = [
     [
         {
             T{ ##peek f 0 D 0 }
-            T{ ##load-immediate f 1 65536 }
-            T{ ##load-immediate f 2 140737488355328 }
+            T{ ##load-integer f 1 65536 }
+            T{ ##load-integer f 2 140737488355328 }
             T{ ##add f 3 0 2 }
         }
     ] [
         {
             T{ ##peek f 0 D 0 }
-            T{ ##load-immediate f 1 65536 }
+            T{ ##load-integer f 1 65536 }
             T{ ##shl-imm f 2 1 31 }
             T{ ##add f 3 0 2 }
         } value-numbering-step
@@ -955,13 +2069,13 @@ cell 8 = [
     [
         {
             T{ ##peek f 0 D 0 }
-            T{ ##load-immediate f 2 140737488355328 }
+            T{ ##load-integer f 2 140737488355328 }
             T{ ##add f 3 0 2 }
         }
     ] [
         {
             T{ ##peek f 0 D 0 }
-            T{ ##load-immediate f 2 140737488355328 }
+            T{ ##load-integer f 2 140737488355328 }
             T{ ##add f 3 0 2 }
         } value-numbering-step
     ] unit-test
@@ -969,14 +2083,14 @@ cell 8 = [
     [
         {
             T{ ##peek f 0 D 0 }
-            T{ ##load-immediate f 2 2147483647 }
+            T{ ##load-integer f 2 2147483647 }
             T{ ##add-imm f 3 0 2147483647 }
             T{ ##add-imm f 4 3 2147483647 }
         }
     ] [
         {
             T{ ##peek f 0 D 0 }
-            T{ ##load-immediate f 2 2147483647 }
+            T{ ##load-integer f 2 2147483647 }
             T{ ##add f 3 0 2 }
             T{ ##add f 4 3 2 }
         } value-numbering-step
@@ -986,13 +2100,13 @@ cell 8 = [
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 -1 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 -1 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
+        T{ ##load-integer f 1 1 }
         T{ ##neg f 2 1 }
     } value-numbering-step
 ] unit-test
@@ -1000,274 +2114,317 @@ cell 8 = [
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 -2 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 -2 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 1 }
+        T{ ##load-integer f 1 1 }
         T{ ##not f 2 1 }
     } value-numbering-step
 ] unit-test
 
-! Displaced alien optimizations
-3 vreg-counter set-global
-
+! ##tagged>integer constant folding
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 2 16 }
-        T{ ##box-displaced-alien f 1 2 0 c-ptr }
-        T{ ##unbox-any-c-ptr f 4 0 }
-        T{ ##add-imm f 3 4 16 }
+        T{ ##load-reference f 1 f }
+        T{ ##load-integer f 2 $[ \ f type-number ] }
+        T{ ##copy f 3 2 any-rep }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 2 16 }
-        T{ ##box-displaced-alien f 1 2 0 c-ptr }
-        T{ ##unbox-any-c-ptr f 3 1 }
+        T{ ##load-reference f 1 f }
+        T{ ##tagged>integer f 2 1 }
+        T{ ##and-imm f 3 2 15 }
     } value-numbering-step
 ] unit-test
 
-4 vreg-counter set-global
-
 [
     {
-        T{ ##box-alien f 0 1 }
-        T{ ##load-immediate f 2 16 }
-        T{ ##box-displaced-alien f 3 2 0 c-ptr }
-        T{ ##copy f 5 1 any-rep }
-        T{ ##add-imm f 4 5 16 }
+        T{ ##load-integer f 1 100 }
+        T{ ##load-integer f 2 $[ 100 tag-fixnum ] }
+        T{ ##load-integer f 3 $[ 100 tag-fixnum 1 + ] }
     }
 ] [
     {
-        T{ ##box-alien f 0 1 }
-        T{ ##load-immediate f 2 16 }
-        T{ ##box-displaced-alien f 3 2 0 c-ptr }
-        T{ ##unbox-any-c-ptr f 4 3 }
+        T{ ##load-integer f 1 100 }
+        T{ ##tagged>integer f 2 1 }
+        T{ ##add-imm f 3 2 1 }
     } value-numbering-step
 ] unit-test
 
-3 vreg-counter set-global
-
+! Alien boxing and unboxing
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 2 0 }
-        T{ ##copy f 3 0 any-rep }
-        T{ ##replace f 3 D 1 }
+        T{ ##box-alien f 1 0 }
+        T{ ##copy f 2 0 any-rep }
+        T{ ##replace f 2 D 0 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 2 0 }
-        T{ ##box-displaced-alien f 3 2 0 c-ptr }
-        T{ ##replace f 3 D 1 }
+        T{ ##box-alien f 1 0 }
+        T{ ##unbox-alien f 2 1 }
+        T{ ##replace f 2 D 0 }
     } value-numbering-step
 ] unit-test
 
-! Branch folding
 [
     {
-        T{ ##load-immediate f 1 10 }
-        T{ ##load-immediate f 2 20 }
-        T{ ##load-immediate f 3 $[ \ f type-number ] }
+        T{ ##peek f 0 D 0 }
+        T{ ##box-alien f 1 0 }
+        T{ ##copy f 2 0 any-rep }
+        T{ ##replace f 2 D 0 }
     }
 ] [
     {
-        T{ ##load-immediate f 1 10 }
-        T{ ##load-immediate f 2 20 }
-        T{ ##compare f 3 1 2 cc= }
+        T{ ##peek f 0 D 0 }
+        T{ ##box-alien f 1 0 }
+        T{ ##unbox-any-c-ptr f 2 1 }
+        T{ ##replace f 2 D 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
-        T{ ##load-constant f 3 t }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 2 0 }
+        T{ ##copy f 1 0 any-rep }
+        T{ ##replace f 1 D 0 }
     }
 ] [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
-        T{ ##compare f 3 1 2 cc/= }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 2 0 }
+        T{ ##box-displaced-alien f 1 2 0 c-ptr }
+        T{ ##replace f 1 D 0 }
     } value-numbering-step
 ] unit-test
 
+3 vreg-counter set-global
+
 [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
-        T{ ##load-constant f 3 t }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 2 16 }
+        T{ ##box-displaced-alien f 1 2 0 c-ptr }
+        T{ ##unbox-any-c-ptr f 4 0 }
+        T{ ##add-imm f 3 4 16 }
     }
 ] [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
-        T{ ##compare f 3 1 2 cc< }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-integer f 2 16 }
+        T{ ##box-displaced-alien f 1 2 0 c-ptr }
+        T{ ##unbox-any-c-ptr f 3 1 }
     } value-numbering-step
 ] unit-test
 
+4 vreg-counter set-global
+
 [
     {
-        T{ ##load-immediate f 1 10 }
-        T{ ##load-immediate f 2 20 }
-        T{ ##load-immediate f 3 $[ \ f type-number ] }
+        T{ ##box-alien f 0 1 }
+        T{ ##load-integer f 2 16 }
+        T{ ##box-displaced-alien f 3 2 0 c-ptr }
+        T{ ##copy f 5 1 any-rep }
+        T{ ##add-imm f 4 5 16 }
     }
 ] [
     {
-        T{ ##load-immediate f 1 10 }
-        T{ ##load-immediate f 2 20 }
-        T{ ##compare f 3 2 1 cc< }
+        T{ ##box-alien f 0 1 }
+        T{ ##load-integer f 2 16 }
+        T{ ##box-displaced-alien f 3 2 0 c-ptr }
+        T{ ##unbox-any-c-ptr f 4 3 }
     } value-numbering-step
 ] unit-test
 
+3 vreg-counter set-global
+
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 $[ \ f type-number ] }
+        T{ ##load-integer f 2 0 }
+        T{ ##copy f 3 0 any-rep }
+        T{ ##replace f 3 D 1 }
     }
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##compare f 1 0 0 cc< }
+        T{ ##load-integer f 2 0 }
+        T{ ##box-displaced-alien f 3 2 0 c-ptr }
+        T{ ##replace f 3 D 1 }
     } value-numbering-step
 ] unit-test
 
+! Various SIMD simplifications
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-constant f 1 t }
+        T{ ##vector>scalar f 1 0 float-4-rep }
+        T{ ##copy f 2 0 any-rep }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##compare f 1 0 0 cc<= }
+        T{ ##vector>scalar f 1 0 float-4-rep }
+        T{ ##scalar>vector f 2 1 float-4-rep }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 $[ \ f type-number ] }
+        T{ ##copy f 1 0 any-rep }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##compare f 1 0 0 cc> }
+        T{ ##shuffle-vector-imm f 1 0 { 0 1 2 3 } float-4-rep }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-constant f 1 t }
+        T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
+        T{ ##shuffle-vector-imm f 2 0 { 0 2 3 1 } float-4-rep }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##compare f 1 0 0 cc>= }
+        T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
+        T{ ##shuffle-vector-imm f 2 1 { 3 1 2 0 } float-4-rep }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-immediate f 1 $[ \ f type-number ] }
+        T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
+        T{ ##shuffle-vector-imm f 2 1 { 1 0 } double-2-rep }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##compare f 1 0 0 cc/= }
+        T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
+        T{ ##shuffle-vector-imm f 2 1 { 1 0 } double-2-rep }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##load-constant f 1 t }
+        T{ ##load-integer f 0 55 }
+        T{ ##load-reference f 1 B{ 55 0 0 0  55 0 0 0  55 0 0 0  55 0 0 0 } }
+        T{ ##load-reference f 2 B{ 55 0 0 0  55 0 0 0  55 0 0 0  55 0 0 0 } }
     }
 ] [
     {
-        T{ ##peek f 0 D 0 }
-        T{ ##compare f 1 0 0 cc= }
+        T{ ##load-integer f 0 55 }
+        T{ ##scalar>vector f 1 0 int-4-rep }
+        T{ ##shuffle-vector-imm f 2 1 { 0 0 0 0 } float-4-rep }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##vector>scalar f 1 0 float-4-rep }
-        T{ ##copy f 2 0 any-rep }
+        T{ ##load-reference f 0 1.25 }
+        T{ ##load-reference f 1 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
+        T{ ##load-reference f 2 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
     }
 ] [
     {
-        T{ ##vector>scalar f 1 0 float-4-rep }
-        T{ ##scalar>vector f 2 1 float-4-rep }
+        T{ ##load-reference f 0 1.25 }
+        T{ ##scalar>vector f 1 0 float-4-rep }
+        T{ ##shuffle-vector-imm f 2 1 { 0 0 0 0 } float-4-rep }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##copy f 1 0 any-rep }
+        T{ ##load-reference f 0 1.25 }
+        T{ ##load-reference f 1 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
+        T{ ##load-reference f 2 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
     }
 ] [
     {
-        T{ ##shuffle-vector-imm f 1 0 { 0 1 2 3 } float-4-rep }
+        T{ ##load-reference f 0 1.25 }
+        T{ ##scalar>vector f 1 0 float-4-rep }
+        T{ ##shuffle-vector-imm f 2 1 { 0 0 0 0 } float-4-rep }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
-        T{ ##shuffle-vector-imm f 2 0 { 0 2 3 1 } float-4-rep }
+        T{ ##load-integer f 0 55 }
+        T{ ##load-reference f 1 B{ 55 0 55 0 55 0 55 0 55 0 55 0 55 0 55 0 } }
+        T{ ##load-reference f 2 B{ 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 } }
+        T{ ##load-reference f 3 B{ 0 55 0 55 0 55 0 55 0 55 0 55 0 55 0 55 } }
     }
 ] [
     {
-        T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
-        T{ ##shuffle-vector-imm f 2 1 { 3 1 2 0 } float-4-rep }
+        T{ ##load-integer f 0 55 }
+        T{ ##scalar>vector f 1 0 short-8-rep }
+        T{ ##load-reference f 2 B{ 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 } }
+        T{ ##shuffle-vector f 3 1 2 float-4-rep }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
-        T{ ##shuffle-vector-imm f 2 1 { 1 0 } double-2-rep }
+        T{ ##load-reference f 0 1.25 }
+        T{ ##load-reference f 2 3.75 }
+        T{ ##load-reference f 4 B{ 0 0 0 0 0 0 244 63 0 0 0 0 0 0 14 64 } }
     }
 ] [
     {
-        T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
-        T{ ##shuffle-vector-imm f 2 1 { 1 0 } double-2-rep }
+        T{ ##load-reference f 0 1.25 }
+        T{ ##load-reference f 2 3.75 }
+        T{ ##gather-vector-2 f 4 0 2 double-2-rep }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##load-constant f 0 $[ 55 tag-fixnum ] }
-        T{ ##load-constant f 1 B{ 55 0 0 0  55 0 0 0  55 0 0 0  55 0 0 0 } }
-        T{ ##copy f 2 1 any-rep }
+        T{ ##load-integer f 0 125 }
+        T{ ##load-integer f 2 375 }
+        T{ ##load-reference f 4 B{ 125 0 0 0 0 0 0 0 119 1 0 0 0 0 0 0 } }
     }
 ] [
     {
-        T{ ##load-constant f 0 $[ 55 tag-fixnum ] }
-        T{ ##scalar>vector f 1 0 int-4-rep }
-        T{ ##shuffle-vector-imm f 2 1 { 0 0 0 0 } float-4-rep }
+        T{ ##load-integer f 0 125 }
+        T{ ##load-integer f 2 375 }
+        T{ ##gather-vector-2 f 4 0 2 longlong-2-rep }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##load-constant f 0 1.25 }
-        T{ ##load-constant f 1 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
-        T{ ##copy f 2 1 any-rep }
+        T{ ##load-reference f 0 1.25 }
+        T{ ##load-reference f 1 2.50 }
+        T{ ##load-reference f 2 3.75 }
+        T{ ##load-reference f 3 5.00 }
+        T{ ##load-reference f 4 B{ 0 0 160 63 0 0 32 64 0 0 112 64 0 0 160 64 } }
     }
 ] [
     {
-        T{ ##load-constant f 0 1.25 }
-        T{ ##scalar>vector f 1 0 float-4-rep }
-        T{ ##shuffle-vector-imm f 2 1 { 0 0 0 0 } float-4-rep }
+        T{ ##load-reference f 0 1.25 }
+        T{ ##load-reference f 1 2.50 }
+        T{ ##load-reference f 2 3.75 }
+        T{ ##load-reference f 3 5.00 }
+        T{ ##gather-vector-4 f 4 0 1 2 3 float-4-rep }
+    } value-numbering-step
+] unit-test
+
+[
+    {
+        T{ ##load-integer f 0 125 }
+        T{ ##load-integer f 1 250 }
+        T{ ##load-integer f 2 375 }
+        T{ ##load-integer f 3 500 }
+        T{ ##load-reference f 4 B{ 125 0 0 0 250 0 0 0 119 1 0 0 244 1 0 0 } }
+    }
+] [
+    {
+        T{ ##load-integer f 0 125 }
+        T{ ##load-integer f 1 250 }
+        T{ ##load-integer f 2 375 }
+        T{ ##load-integer f 3 500 }
+        T{ ##gather-vector-4 f 4 0 1 2 3 int-4-rep }
     } value-numbering-step
 ] unit-test
 
@@ -1401,8 +2558,7 @@ cell 8 = [
     } value-numbering-step
 ] unit-test
 
-! branch folding
-
+! Branch folding
 : test-branch-folding ( insns -- insns' n )
     <basic-block>
     [ V{ 0 1 } clone >>successors basic-block set value-numbering-step ] keep
@@ -1410,61 +2566,61 @@ cell 8 = [
 
 [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
         T{ ##branch }
     }
     1
 ] [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
         T{ ##compare-branch f 1 2 cc= }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
         T{ ##branch }
     }
     0
 ] [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
         T{ ##compare-branch f 1 2 cc/= }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
         T{ ##branch }
     }
     0
 ] [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
-        T{ ##compare-branch f 1 2 cc< }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
+        T{ ##compare-integer-branch f 1 2 cc< }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
         T{ ##branch }
     }
     1
 ] [
     {
-        T{ ##load-immediate f 1 1 }
-        T{ ##load-immediate f 2 2 }
-        T{ ##compare-branch f 2 1 cc< }
+        T{ ##load-integer f 1 1 }
+        T{ ##load-integer f 2 2 }
+        T{ ##compare-integer-branch f 2 1 cc< }
     } test-branch-folding
 ] unit-test
 
@@ -1477,7 +2633,7 @@ cell 8 = [
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##compare-branch f 0 0 cc< }
+        T{ ##compare-integer-branch f 0 0 cc< }
     } test-branch-folding
 ] unit-test
 
@@ -1490,7 +2646,7 @@ cell 8 = [
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##compare-branch f 0 0 cc<= }
+        T{ ##compare-integer-branch f 0 0 cc<= }
     } test-branch-folding
 ] unit-test
 
@@ -1503,7 +2659,7 @@ cell 8 = [
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##compare-branch f 0 0 cc> }
+        T{ ##compare-integer-branch f 0 0 cc> }
     } test-branch-folding
 ] unit-test
 
@@ -1516,7 +2672,7 @@ cell 8 = [
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##compare-branch f 0 0 cc>= }
+        T{ ##compare-integer-branch f 0 0 cc>= }
     } test-branch-folding
 ] unit-test
 
@@ -1529,7 +2685,7 @@ cell 8 = [
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##compare-branch f 0 0 cc= }
+        T{ ##compare-integer-branch f 0 0 cc= }
     } test-branch-folding
 ] unit-test
 
@@ -1542,14 +2698,14 @@ cell 8 = [
 ] [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##compare-branch f 0 0 cc/= }
+        T{ ##compare-integer-branch f 0 0 cc/= }
     } test-branch-folding
 ] unit-test
 
 [
     {
         T{ ##peek f 0 D 0 }
-        T{ ##load-constant f 1 t }
+        T{ ##load-reference f 1 t }
         T{ ##branch }
     }
     0
@@ -1557,7 +2713,7 @@ cell 8 = [
     {
         T{ ##peek f 0 D 0 }
         T{ ##compare f 1 0 0 cc<= }
-        T{ ##compare-imm-branch f 1 $[ \ f type-number ] cc/= }
+        T{ ##compare-imm-branch f 1 f cc/= }
     } test-branch-folding
 ] unit-test
 
@@ -1566,16 +2722,16 @@ V{ T{ ##branch } } 0 test-bb
 
 V{
     T{ ##peek f 0 D 0 }
-    T{ ##compare-branch f 0 0 cc< }
+    T{ ##compare-integer-branch f 0 0 cc< }
 } 1 test-bb
 
 V{
-    T{ ##load-immediate f 1 1 }
+    T{ ##load-integer f 1 1 }
     T{ ##branch }
 } 2 test-bb
 
 V{
-    T{ ##load-immediate f 2 2 }
+    T{ ##load-integer f 2 2 }
     T{ ##branch }
 } 3 test-bb
 
@@ -1607,7 +2763,7 @@ V{
 
 V{
     T{ ##peek f 1 D 1 }
-    T{ ##compare-branch f 1 1 cc< }
+    T{ ##compare-integer-branch f 1 1 cc< }
 } 1 test-bb
 
 V{
@@ -1616,7 +2772,7 @@ V{
 } 2 test-bb
 
 V{
-    T{ ##phi f 3 V{ } }
+    T{ ##phi f 3 H{ { 1 1 } { 2 0 } } }
     T{ ##branch }
 } 3 test-bb
 
@@ -1625,9 +2781,6 @@ V{
     T{ ##return }
 } 4 test-bb
 
-1 get 1 2array
-2 get 0 2array 2array 3 get instructions>> first (>>inputs)
-
 test-diamond
 
 [ ] [
@@ -1659,7 +2812,7 @@ V{
     T{ ##copy { dst 21 } { src 20 } { rep any-rep } }
     T{ ##compare-imm-branch
         { src1 21 }
-        { src2 $[ \ f type-number ] }
+        { src2 f }
         { cc cc/= }
     }
 } 1 test-bb
@@ -1706,3 +2859,239 @@ V{
 
 [ f ] [ 1 get instructions>> [ ##peek? ] any? ] unit-test
 
+! Slot addressing optimization
+cpu x86? [
+    [
+        V{
+            T{ ##peek f 0 D 0 }
+            T{ ##peek f 1 D 1 }
+            T{ ##add-imm f 2 1 2 }
+            T{ ##slot f 3 0 1 $[ cell log2 ] $[ 7 2 cells - ] }
+        }
+    ] [
+        V{
+            T{ ##peek f 0 D 0 }
+            T{ ##peek f 1 D 1 }
+            T{ ##add-imm f 2 1 2 }
+            T{ ##slot f 3 0 2 $[ cell log2 ] 7 }
+        } value-numbering-step
+    ] unit-test
+] when
+
+! Alien addressing optimization
+
+! Base offset fusion on ##load/store-memory-imm
+[
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##tagged>integer f 2 1 }
+        T{ ##add-imm f 3 2 10 }
+        T{ ##load-memory-imm f 4 2 10 int-rep c:uchar }
+    }
+] [
+    V{
+        T{ ##peek f 1 D 0 }
+        T{ ##tagged>integer f 2 1 }
+        T{ ##add-imm f 3 2 10 }
+        T{ ##load-memory-imm f 4 3 0 int-rep c:uchar }
+    } value-numbering-step
+] unit-test
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add-imm f 4 3 10 }
+        T{ ##store-memory-imm f 2 3 10 int-rep c:uchar }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add-imm f 4 3 10 }
+        T{ ##store-memory-imm f 2 4 0 int-rep c:uchar }
+    } value-numbering-step
+] unit-test
+
+! Displacement fusion on ##load/store-memory-imm
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add f 4 2 3 }
+        T{ ##load-memory f 5 2 3 0 0 int-rep c:uchar }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add f 4 2 3 }
+        T{ ##load-memory-imm f 5 4 0 int-rep c:uchar }
+    } value-numbering-step
+] unit-test
+
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add f 4 2 3 }
+        T{ ##store-memory f 5 2 3 0 0 int-rep c:uchar }
+    }
+] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add f 4 2 3 }
+        T{ ##store-memory-imm f 5 4 0 int-rep c:uchar }
+    } value-numbering-step
+] unit-test
+
+! Base offset fusion on ##load/store-memory -- only on x86
+cpu x86?
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add-imm f 4 2 31337 }
+        T{ ##load-memory f 5 2 3 0 31337 int-rep c:uchar }
+    }
+]
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add-imm f 4 2 31337 }
+        T{ ##load-memory f 5 4 3 0 0 int-rep c:uchar }
+    }
+] ?
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add-imm f 4 2 31337 }
+        T{ ##load-memory f 5 4 3 0 0 int-rep c:uchar }
+    } value-numbering-step
+] unit-test
+
+! Displacement offset fusion on ##load/store-memory -- only on x86
+cpu x86?
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add-imm f 4 3 31337 }
+        T{ ##load-memory f 5 2 3 0 31338 int-rep c:uchar }
+    }
+]
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add-imm f 4 3 31337 }
+        T{ ##load-memory f 5 2 4 0 1 int-rep c:uchar }
+    }
+] ?
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add-imm f 4 3 31337 }
+        T{ ##load-memory f 5 2 4 0 1 int-rep c:uchar }
+    } value-numbering-step
+] unit-test
+
+! Displacement offset fusion should not occur on
+! ##load/store-memory with non-zero scale
+[ ] [
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##add-imm f 4 3 10 }
+        T{ ##load-memory f 5 2 4 1 1 int-rep c:uchar }
+    } dup value-numbering-step assert=
+] unit-test
+
+! Scale fusion on ##load/store-memory
+cpu x86?
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##shl-imm f 4 3 2 }
+        T{ ##load-memory f 5 2 3 2 0 int-rep c:uchar }
+    }
+]
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##shl-imm f 4 3 2 }
+        T{ ##load-memory f 5 2 4 0 0 int-rep c:uchar }
+    }
+] ?
+[
+    V{
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##tagged>integer f 2 0 }
+        T{ ##tagged>integer f 3 1 }
+        T{ ##shl-imm f 4 3 2 }
+        T{ ##load-memory f 5 2 4 0 0 int-rep c:uchar }
+    } value-numbering-step
+] unit-test
+
+cpu x86? [
+    ! Don't do scale fusion if there's already a scale
+    [ ] [
+        V{
+            T{ ##peek f 0 D 0 }
+            T{ ##peek f 1 D 1 }
+            T{ ##tagged>integer f 2 0 }
+            T{ ##tagged>integer f 3 1 }
+            T{ ##shl-imm f 4 3 2 }
+            T{ ##load-memory f 5 2 4 1 0 int-rep c:uchar }
+        } dup value-numbering-step assert=
+    ] unit-test
+
+    ! Don't do scale fusion if the scale factor is out of range
+    [ ] [
+        V{
+            T{ ##peek f 0 D 0 }
+            T{ ##peek f 1 D 1 }
+            T{ ##tagged>integer f 2 0 }
+            T{ ##tagged>integer f 3 1 }
+            T{ ##shl-imm f 4 3 4 }
+            T{ ##load-memory f 5 2 4 0 0 int-rep c:uchar }
+        } dup value-numbering-step assert=
+    ] unit-test
+] when
index 96ca3efcf243ecd5d61265dce57f5d2bf3c1a00d..23fae4932e2b9d2e9c3c354ab0bdc077f4813c5e 100644 (file)
@@ -1,31 +1,47 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: namespaces assocs kernel accessors
-sorting sets sequences arrays
+USING: namespaces arrays assocs kernel accessors
+sorting sets sequences locals
 cpu.architecture
 sequences.deep
 compiler.cfg
 compiler.cfg.rpo
 compiler.cfg.def-use
+compiler.cfg.utilities
 compiler.cfg.instructions
+compiler.cfg.value-numbering.alien
+compiler.cfg.value-numbering.comparisons
 compiler.cfg.value-numbering.graph
-compiler.cfg.value-numbering.expressions
-compiler.cfg.value-numbering.simplify
-compiler.cfg.value-numbering.rewrite ;
+compiler.cfg.value-numbering.math
+compiler.cfg.value-numbering.rewrite
+compiler.cfg.value-numbering.slots
+compiler.cfg.value-numbering.misc
+compiler.cfg.value-numbering.expressions ;
 IN: compiler.cfg.value-numbering
 
-! Local value numbering.
+GENERIC: process-instruction ( insn -- insn' )
 
-: >copy ( insn -- insn/##copy )
-    dup defs-vreg dup vreg>vn vn>vreg
-    2dup eq? [ 2drop ] [ any-rep \ ##copy new-insn nip ] if ;
+: redundant-instruction ( insn vn -- insn' )
+    [ dst>> ] dip [ swap set-vn ] [ <copy> ] 2bi ;
 
-GENERIC: process-instruction ( insn -- insn' )
+:: useful-instruction ( insn expr -- insn' )
+    insn dst>> :> vn
+    vn vn vregs>vns get set-at
+    vn expr exprs>vns get set-at
+    insn vn vns>insns get set-at
+    insn ;
+
+: check-redundancy ( insn -- insn' )
+    dup >expr dup exprs>vns get at
+    [ redundant-instruction ] [ useful-instruction ] ?if ;
 
 M: insn process-instruction
     dup rewrite
     [ process-instruction ]
-    [ dup defs-vreg [ dup number-values >copy ] when ] ?if ;
+    [ dup defs-vreg [ check-redundancy ] when ] ?if ;
+
+M: ##copy process-instruction
+    dup [ src>> vreg>vn ] [ dst>> ] bi set-vn ;
 
 M: array process-instruction
     [ process-instruction ] map ;
@@ -34,7 +50,7 @@ M: array process-instruction
     init-value-graph
     [ process-instruction ] map flatten ;
 
-: value-numbering ( cfg -- cfg' )
-    [ value-numbering-step ] local-optimization
+: value-numbering ( cfg -- cfg )
+    dup [ value-numbering-step ] simple-optimization
 
     cfg-changed predecessors-changed ;
index 523f7c6d1ced65c45e05869eb5f166e049af2fd2..a34bf6c07f4e0477664add53265d2c284e67a507 100644 (file)
@@ -1,8 +1,9 @@
-! Copyright (C) 2008, 2009 Slava Pestov, Daniel Ehrenberg.
+! Copyright (C) 2008, 2010 Slava Pestov, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs combinators.short-circuit
 compiler.cfg.instructions compiler.cfg.rpo kernel namespaces
 sequences sets ;
+FROM: namespaces => set ;
 IN: compiler.cfg.write-barrier
 
 SYMBOL: fresh-allocations
@@ -34,10 +35,10 @@ M: ##copy eliminate-write-barrier
 
 M: insn eliminate-write-barrier drop t ;
 
-: write-barriers-step ( bb -- )
+: write-barriers-step ( insns -- insns' )
     H{ } clone fresh-allocations set
     H{ } clone mutated-objects set
-    instructions>> [ eliminate-write-barrier ] filter! drop ;
+    [ eliminate-write-barrier ] filter! ;
 
-: eliminate-write-barriers ( cfg -- cfg' )
-    dup [ write-barriers-step ] each-basic-block ;
+: eliminate-write-barriers ( cfg -- cfg )
+    dup [ write-barriers-step ] simple-optimization ;
index 43473ebcbb20bcf05bcc760ce63b56ae236fef26..a02462dc084a8c30ae34cf0a91f789c8460ddd53 100644 (file)
@@ -2,13 +2,13 @@ USING: compiler.codegen.fixup tools.test cpu.architecture math kernel make
 compiler.constants words ;
 IN: compiler.codegen.tests
 
-[ ] [ gensym [ ] with-fixup drop ] unit-test
-[ ] [ gensym [ \ + %call ] with-fixup drop ] unit-test
+[ ] [ [ ] with-fixup drop ] unit-test
+[ ] [ [ \ + %call ] with-fixup drop ] unit-test
 
-[ ] [ gensym [ <label> dup define-label dup resolve-label %jump-label ] with-fixup drop ] unit-test
-[ ] [ gensym [ <label> dup define-label dup resolve-label B{ 0 0 0 0 } % rc-absolute-cell label-fixup ] with-fixup drop ] unit-test
+[ ] [ [ <label> dup define-label dup resolve-label %jump-label ] with-fixup drop ] unit-test
+[ ] [ [ <label> dup define-label dup resolve-label B{ 0 0 0 0 } % rc-absolute-cell label-fixup ] with-fixup drop ] unit-test
 
 ! Error checking
-[ gensym [ <label> dup define-label %jump-label ] with-fixup ] must-fail
-[ gensym [ <label> dup define-label B{ 0 0 0 0 } % rc-relative label-fixup ] with-fixup ] must-fail
-[ gensym [ <label> dup define-label B{ 0 0 0 0 } % rc-absolute-cell label-fixup ] with-fixup ] must-fail
+[ [ <label> dup define-label %jump-label ] with-fixup ] must-fail
+[ [ <label> dup define-label B{ 0 0 0 0 } % rc-relative label-fixup ] with-fixup ] must-fail
+[ [ <label> dup define-label B{ 0 0 0 0 } % rc-absolute-cell label-fixup ] with-fixup ] must-fail
index 963ed0ab28c63967fed93efea1f7ff3d83496288..68b01beed912467b4666f5f694f11bf53b330252 100755 (executable)
@@ -1,21 +1,21 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: namespaces make math math.order math.parser sequences accessors
-kernel kernel.private layouts assocs words summary arrays
-combinators classes.algebra alien alien.c-types
-alien.strings alien.arrays alien.complex alien.libraries sets libc
-continuations.private fry cpu.architecture classes classes.struct locals
-source-files.errors slots parser generic.parser strings
-compiler.errors
-compiler.alien
+USING: namespaces make math math.order math.parser sequences
+accessors kernel layouts assocs words summary arrays combinators
+classes.algebra sets continuations.private fry cpu.architecture
+classes classes.struct locals slots parser generic.parser
+strings quotations hashtables
 compiler.constants
 compiler.cfg
+compiler.cfg.linearization
 compiler.cfg.instructions
+compiler.cfg.comparisons
 compiler.cfg.stack-frame
 compiler.cfg.registers
 compiler.cfg.builder
 compiler.codegen.fixup
 compiler.utilities ;
+FROM: namespaces => set ;
 IN: compiler.codegen
 
 SYMBOL: insn-counts
@@ -24,45 +24,90 @@ H{ } clone insn-counts set-global
 
 GENERIC: generate-insn ( insn -- )
 
-! Mapping _label IDs to label instances
+! Control flow
 SYMBOL: labels
 
-: generate ( mr -- code )
-    dup label>> [
-        H{ } clone labels set
+: lookup-label ( bb -- label )
+    labels get [ drop <label> ] cache ;
+
+: useless-branch? ( bb successor -- ? )
+    ! If our successor immediately follows us in linearization
+    ! order then we don't need to branch.
+    [ block-number ] bi@ 1 - = ; inline
+
+: emit-branch ( bb successor -- )
+    2dup useless-branch?
+    [ 2drop ] [ nip lookup-label %jump-label ] if ;
+
+M: ##branch generate-insn
+    drop basic-block get dup successors>> first emit-branch ;
+
+GENERIC: generate-conditional-insn ( label insn -- )
+
+GENERIC: negate-insn-cc ( insn -- )
+
+M: conditional-branch-insn negate-insn-cc
+    [ negate-cc ] change-cc drop ;
+
+M: ##test-vector-branch negate-insn-cc
+    [ negate-vcc ] change-vcc drop ;
+
+M:: conditional-branch-insn generate-insn ( insn -- )
+    basic-block get :> bb
+    bb successors>> first2 :> ( first second )
+    bb second useless-branch?
+    [ bb second first ]
+    [ bb first second insn negate-insn-cc ] if
+    lookup-label insn generate-conditional-insn
+    emit-branch ;
+
+: %dispatch-label ( label -- )
+    cell 0 <repetition> %
+    rc-absolute-cell label-fixup ;
+
+M: ##dispatch generate-insn
+    [ src>> ] [ temp>> ] bi %dispatch
+    basic-block get successors>>
+    [ lookup-label %dispatch-label ] each ;
+
+: generate-block ( bb -- )
+    [ basic-block set ]
+    [ lookup-label resolve-label ]
+    [
         instructions>> [
             [ class insn-counts get inc-at ]
             [ generate-insn ]
             bi
         ] each
-    ] with-fixup ;
+    ] tri ;
 
-: lookup-label ( id -- label )
-    labels get [ drop <label> ] cache ;
+: generate ( cfg -- code )
+    [
+        H{ } clone labels set
+        linearization-order
+        [ number-blocks ] [ [ generate-block ] each ] bi
+    ] with-fixup ;
 
 ! Special cases
 M: ##no-tco generate-insn drop ;
 
-M: _dispatch-label generate-insn
-    label>> lookup-label
-    cell 0 <repetition> %
-    rc-absolute-cell label-fixup ;
-
-M: _prologue generate-insn
-    stack-frame>> [ stack-frame set ] [ total-size>> %prologue ] bi ;
+M: ##stack-frame generate-insn drop ;
 
-M: _epilogue generate-insn
-    stack-frame>> total-size>> %epilogue ;
+M: ##prologue generate-insn
+    drop
+    cfg get stack-frame>>
+    [ [ stack-frame set ] [ total-size>> %prologue ] bi ] when* ;
 
-M: _spill-area-size generate-insn drop ;
+M: ##epilogue generate-insn
+    drop
+    cfg get stack-frame>> [ total-size>> %epilogue ] when* ;
 
 ! Some meta-programming to generate simple code generators, where
 ! the instruction is unpacked and then a %word is called
 <<
 
 : insn-slot-quot ( spec -- quot )
-    name>> [ reader-word ] [ "label" = ] bi
-    [ \ lookup-label [ ] 2sequence ] [ [ ] 1sequence ] if ;
+    name>> reader-word 1quotation ;
 
 : codegen-method-body ( class word -- quot )
     [
@@ -73,13 +118,18 @@ M: _spill-area-size generate-insn drop ;
 SYNTAX: CODEGEN:
     scan-word [ \ generate-insn create-method-in ] keep scan-word
     codegen-method-body define ;
+
 >>
 
-CODEGEN: ##load-immediate %load-immediate
+CODEGEN: ##load-integer %load-immediate
+CODEGEN: ##load-tagged %load-immediate
 CODEGEN: ##load-reference %load-reference
-CODEGEN: ##load-constant %load-reference
+CODEGEN: ##load-float %load-float
+CODEGEN: ##load-double %load-double
+CODEGEN: ##load-vector %load-vector
 CODEGEN: ##peek %peek
 CODEGEN: ##replace %replace
+CODEGEN: ##replace-imm %replace-imm
 CODEGEN: ##inc-d %inc-d
 CODEGEN: ##inc-r %inc-r
 CODEGEN: ##call %call
@@ -89,8 +139,6 @@ CODEGEN: ##slot %slot
 CODEGEN: ##slot-imm %slot-imm
 CODEGEN: ##set-slot %set-slot
 CODEGEN: ##set-slot-imm %set-slot-imm
-CODEGEN: ##string-nth %string-nth
-CODEGEN: ##set-string-nth-fast %set-string-nth-fast
 CODEGEN: ##add %add
 CODEGEN: ##add-imm %add-imm
 CODEGEN: ##sub %sub
@@ -114,7 +162,9 @@ CODEGEN: ##max %max
 CODEGEN: ##not %not
 CODEGEN: ##neg %neg
 CODEGEN: ##log2 %log2
+CODEGEN: ##bit-count %bit-count
 CODEGEN: ##copy %copy
+CODEGEN: ##tagged>integer %tagged>integer
 CODEGEN: ##add-float %add-float
 CODEGEN: ##sub-float %sub-float
 CODEGEN: ##mul-float %mul-float
@@ -132,11 +182,16 @@ CODEGEN: ##zero-vector %zero-vector
 CODEGEN: ##fill-vector %fill-vector
 CODEGEN: ##gather-vector-2 %gather-vector-2
 CODEGEN: ##gather-vector-4 %gather-vector-4
+CODEGEN: ##gather-int-vector-2 %gather-int-vector-2
+CODEGEN: ##gather-int-vector-4 %gather-int-vector-4
+CODEGEN: ##select-vector %select-vector
 CODEGEN: ##shuffle-vector-imm %shuffle-vector-imm
+CODEGEN: ##shuffle-vector-halves-imm %shuffle-vector-halves-imm
 CODEGEN: ##shuffle-vector %shuffle-vector
 CODEGEN: ##tail>head-vector %tail>head-vector
 CODEGEN: ##merge-vector-head %merge-vector-head
 CODEGEN: ##merge-vector-tail %merge-vector-tail
+CODEGEN: ##float-pack-vector %float-pack-vector
 CODEGEN: ##signed-pack-vector %signed-pack-vector
 CODEGEN: ##unsigned-pack-vector %unsigned-pack-vector
 CODEGEN: ##unpack-vector-head %unpack-vector-head
@@ -183,320 +238,70 @@ CODEGEN: ##box-alien %box-alien
 CODEGEN: ##box-displaced-alien %box-displaced-alien
 CODEGEN: ##unbox-alien %unbox-alien
 CODEGEN: ##unbox-any-c-ptr %unbox-any-c-ptr
-CODEGEN: ##alien-unsigned-1 %alien-unsigned-1
-CODEGEN: ##alien-unsigned-2 %alien-unsigned-2
-CODEGEN: ##alien-unsigned-4 %alien-unsigned-4
-CODEGEN: ##alien-signed-1 %alien-signed-1
-CODEGEN: ##alien-signed-2 %alien-signed-2
-CODEGEN: ##alien-signed-4 %alien-signed-4
-CODEGEN: ##alien-cell %alien-cell
-CODEGEN: ##alien-float %alien-float
-CODEGEN: ##alien-double %alien-double
-CODEGEN: ##alien-vector %alien-vector
-CODEGEN: ##set-alien-integer-1 %set-alien-integer-1
-CODEGEN: ##set-alien-integer-2 %set-alien-integer-2
-CODEGEN: ##set-alien-integer-4 %set-alien-integer-4
-CODEGEN: ##set-alien-cell %set-alien-cell
-CODEGEN: ##set-alien-float %set-alien-float
-CODEGEN: ##set-alien-double %set-alien-double
-CODEGEN: ##set-alien-vector %set-alien-vector
+CODEGEN: ##load-memory %load-memory
+CODEGEN: ##load-memory-imm %load-memory-imm
+CODEGEN: ##store-memory %store-memory
+CODEGEN: ##store-memory-imm %store-memory-imm
 CODEGEN: ##allot %allot
 CODEGEN: ##write-barrier %write-barrier
 CODEGEN: ##write-barrier-imm %write-barrier-imm
 CODEGEN: ##compare %compare
 CODEGEN: ##compare-imm %compare-imm
+CODEGEN: ##test %test
+CODEGEN: ##test-imm %test-imm
+CODEGEN: ##compare-integer %compare
+CODEGEN: ##compare-integer-imm %compare-integer-imm
 CODEGEN: ##compare-float-ordered %compare-float-ordered
 CODEGEN: ##compare-float-unordered %compare-float-unordered
 CODEGEN: ##save-context %save-context
-CODEGEN: ##vm-field-ptr %vm-field-ptr
-
-CODEGEN: _fixnum-add %fixnum-add
-CODEGEN: _fixnum-sub %fixnum-sub
-CODEGEN: _fixnum-mul %fixnum-mul
-CODEGEN: _label resolve-label
-CODEGEN: _branch %jump-label
-CODEGEN: _compare-branch %compare-branch
-CODEGEN: _compare-imm-branch %compare-imm-branch
-CODEGEN: _compare-float-ordered-branch %compare-float-ordered-branch
-CODEGEN: _compare-float-unordered-branch %compare-float-unordered-branch
-CODEGEN: _test-vector-branch %test-vector-branch
-CODEGEN: _dispatch %dispatch
-CODEGEN: _spill %spill
-CODEGEN: _reload %reload
-
-! ##gc
-: wipe-locs ( locs temp -- )
-    '[
-        _
-        [ 0 %load-immediate ]
-        [ swap [ %replace ] with each ] bi
-    ] unless-empty ;
-
-GENERIC# save-gc-root 1 ( gc-root operand temp -- )
-
-M:: spill-slot save-gc-root ( gc-root operand temp -- )
-    temp int-rep operand %reload
-    gc-root temp %save-gc-root ;
-
-M: object save-gc-root drop %save-gc-root ;
-
-: save-gc-roots ( gc-roots temp -- ) '[ _ save-gc-root ] assoc-each ;
-
-: save-data-regs ( data-regs -- ) [ first3 %spill ] each ;
-
-GENERIC# load-gc-root 1 ( gc-root operand temp -- )
-
-M:: spill-slot load-gc-root ( gc-root operand temp -- )
-    gc-root temp %load-gc-root
-    temp int-rep operand %spill ;
-
-M: object load-gc-root drop %load-gc-root ;
-
-: load-gc-roots ( gc-roots temp -- ) '[ _ load-gc-root ] assoc-each ;
-
-: load-data-regs ( data-regs -- ) [ first3 %reload ] each ;
-
-M: ##gc generate-insn
-    "no-gc" define-label
-    {
-        [ [ "no-gc" get ] dip [ size>> ] [ temp1>> ] [ temp2>> ] tri %check-nursery ]
-        [ [ uninitialized-locs>> ] [ temp1>> ] bi wipe-locs ]
-        [ data-values>> save-data-regs ]
-        [ [ tagged-values>> ] [ temp1>> ] bi save-gc-roots ]
-        [ [ temp1>> ] [ temp2>> ] bi %save-context ]
-        [ [ tagged-values>> length ] [ temp1>> ] bi %call-gc ]
-        [ [ tagged-values>> ] [ temp1>> ] bi load-gc-roots ]
-        [ data-values>> load-data-regs ]
-    } cleave
-    "no-gc" resolve-label ;
-
-M: _loop-entry generate-insn drop %loop-entry ;
-
-M: ##alien-global generate-insn
-    [ dst>> ] [ symbol>> ] [ library>> ] tri
-    %alien-global ;
-
-! ##alien-invoke
-GENERIC: next-fastcall-param ( rep -- )
-
-: ?dummy-stack-params ( rep -- )
-    dummy-stack-params? [ rep-size cell align stack-params +@ ] [ drop ] if ;
-
-: ?dummy-int-params ( rep -- )
-    dummy-int-params? [ rep-size cell /i 1 max int-regs +@ ] [ drop ] if ;
-
-: ?dummy-fp-params ( rep -- )
-    drop dummy-fp-params? [ float-regs inc ] when ;
-
-M: int-rep next-fastcall-param
-    int-regs inc [ ?dummy-stack-params ] [ ?dummy-fp-params ] bi ;
-
-M: float-rep next-fastcall-param
-    float-regs inc [ ?dummy-stack-params ] [ ?dummy-int-params ] bi ;
-
-M: double-rep next-fastcall-param
-    float-regs inc [ ?dummy-stack-params ] [ ?dummy-int-params ] bi ;
-
-GENERIC: reg-class-full? ( reg-class -- ? )
-
-M: stack-params reg-class-full? drop t ;
-
-M: reg-class reg-class-full?
-    [ get ] [ param-regs length ] bi >= ;
-
-: alloc-stack-param ( rep -- n reg-class rep )
-    stack-params get
-    [ rep-size cell align stack-params +@ ] dip
-    stack-params dup ;
-
-: alloc-fastcall-param ( rep -- n reg-class rep )
-    [ [ reg-class-of get ] [ reg-class-of ] [ next-fastcall-param ] tri ] keep ;
-
-: alloc-parameter ( parameter -- reg rep )
-    c-type-rep dup reg-class-of reg-class-full?
-    [ alloc-stack-param ] [ alloc-fastcall-param ] if
-    [ param-reg ] dip ;
-
-: (flatten-int-type) ( type -- seq )
-    stack-size cell align cell /i void* c-type <repetition> ;
+CODEGEN: ##restore-context %restore-context
+CODEGEN: ##vm-field %vm-field
+CODEGEN: ##set-vm-field %set-vm-field
+CODEGEN: ##alien-global %alien-global
+CODEGEN: ##call-gc %call-gc
+CODEGEN: ##spill %spill
+CODEGEN: ##reload %reload
+
+! Conditional branches
+<<
 
-GENERIC: flatten-value-type ( type -- types )
+SYNTAX: CONDITIONAL:
+    scan-word [ \ generate-conditional-insn create-method-in ] keep scan-word
+    codegen-method-body define ;
 
-M: object flatten-value-type 1array ;
-M: struct-c-type flatten-value-type (flatten-int-type) ;
-M: long-long-type flatten-value-type (flatten-int-type) ;
-M: c-type-name flatten-value-type c-type flatten-value-type ;
+>>
 
-: flatten-value-types ( params -- params )
-    #! Convert value type structs to consecutive void*s.
-    [
-        0 [
-            c-type
-            [ parameter-align cell /i void* c-type <repetition> % ] keep
-            [ stack-size cell align + ] keep
-            flatten-value-type %
-        ] reduce drop
-    ] { } make ;
-
-: each-parameter ( parameters quot -- )
-    [ [ parameter-offsets nip ] keep ] dip 2each ; inline
-
-: reset-fastcall-counts ( -- )
-    { int-regs float-regs stack-params } [ 0 swap set ] each ;
-
-: with-param-regs ( quot -- )
-    #! In quot you can call alloc-parameter
-    [ reset-fastcall-counts call ] with-scope ; inline
-
-: move-parameters ( node word -- )
-    #! Moves values from C stack to registers (if word is
-    #! %load-param-reg) and registers to C stack (if word is
-    #! %save-param-reg).
-    [ alien-parameters flatten-value-types ]
-    [ '[ alloc-parameter _ execute ] ]
-    bi* each-parameter ; inline
-
-: reverse-each-parameter ( parameters quot -- )
-    [ [ parameter-offsets nip ] keep ] dip 2reverse-each ; inline
-
-: prepare-unbox-parameters ( parameters -- offsets types indices )
-    [ parameter-offsets nip ] [ ] [ length iota <reversed> ] tri ;
-
-: unbox-parameters ( offset node -- )
-    parameters>> swap
-    '[ prepare-unbox-parameters [ %pop-stack [ _ + ] dip unbox-parameter ] 3each ]
-    [ length neg %inc-d ]
-    bi ;
-
-: prepare-box-struct ( node -- offset )
-    #! Return offset on C stack where to store unboxed
-    #! parameters. If the C function is returning a structure,
-    #! the first parameter is an implicit target area pointer,
-    #! so we need to use a different offset.
-    return>> large-struct?
-    [ %prepare-box-struct cell ] [ 0 ] if ;
-
-: objects>registers ( params -- )
-    #! Generate code for unboxing a list of C types, then
-    #! generate code for moving these parameters to registers on
-    #! architectures where parameters are passed in registers.
-    [
-        [ prepare-box-struct ] keep
-        [ unbox-parameters ] keep
-        \ %load-param-reg move-parameters
-    ] with-param-regs ;
-
-: box-return* ( node -- )
-    return>> [ ] [ box-return %push-stack ] if-void ;
-
-GENERIC# dlsym-valid? 1 ( symbols dll -- ? )
-
-M: string dlsym-valid? dlsym ;
-
-M: array dlsym-valid? '[ _ dlsym ] any? ;
-
-: check-dlsym ( symbols dll -- )
-    dup dll-valid? [
-        dupd dlsym-valid?
-        [ drop ] [ compiling-word get no-such-symbol ] if
-    ] [
-        dll-path compiling-word get no-such-library drop
-    ] if ;
-
-: stdcall-mangle ( params -- symbols )
-    [ function>> ] [ parameters>> parameter-offsets drop number>string ] bi
-    [ drop ] [ "@" glue ] [ "@" glue "_" prepend ] 2tri
-    3array ;
-
-: alien-invoke-dlsym ( params -- symbols dll )
-    [ dup abi>> "stdcall" = [ stdcall-mangle ] [ function>> ] if ]
-    [ library>> load-library ]
-    bi 2dup check-dlsym ;
-
-M: ##alien-invoke generate-insn
-    params>>
-    ! Unbox parameters
-    dup objects>registers
-    %prepare-var-args
-    ! Call function
-    dup alien-invoke-dlsym %alien-invoke
-    ! Box return value
-    dup %cleanup
-    box-return* ;
-
-M: ##alien-assembly generate-insn
-    params>>
-    ! Unbox parameters
-    dup objects>registers
-    %prepare-var-args
-    ! Generate assembly
-    dup quot>> call( -- )
-    ! Box return value
-    box-return* ;
-
-! ##alien-indirect
-M: ##alien-indirect generate-insn
-    params>>
-    ! Save alien at top of stack to temporary storage
-    %prepare-alien-indirect
-    ! Unbox parameters
-    dup objects>registers
-    %prepare-var-args
-    ! Call alien in temporary storage
-    %alien-indirect
-    ! Box return value
-    dup %cleanup
-    box-return* ;
-
-! ##alien-callback
-: box-parameters ( params -- )
-    alien-parameters [ box-parameter %push-context-stack ] each-parameter ;
-
-: registers>objects ( node -- )
-    ! Generate code for boxing input parameters in a callback.
-    [
-        dup \ %save-param-reg move-parameters
-        %nest-stacks
-        box-parameters
-    ] with-param-regs ;
-
-TUPLE: callback-context ;
-
-: current-callback ( -- id ) 2 special-object ;
-
-: wait-to-return ( token -- )
-    dup current-callback eq? [
-        drop
-    ] [
-        yield-hook get call( -- ) wait-to-return
-    ] if ;
-
-: do-callback ( quot token -- )
-    init-catchstack
-    [ 2 set-special-object call ] keep
-    wait-to-return ; inline
-
-: callback-return-quot ( ctype -- quot )
-    return>> {
-        { [ dup void? ] [ drop [ ] ] }
-        { [ dup large-struct? ] [ heap-size '[ _ memcpy ] ] }
-        [ c-type c-type-unboxer-quot ]
-    } cond ;
-
-: callback-prep-quot ( params -- quot )
-    parameters>> [ c-type c-type-boxer-quot ] map spread>quot ;
-
-: wrap-callback-quot ( params -- quot )
-    [
-        [ callback-prep-quot ]
-        [ quot>> ]
-        [ callback-return-quot ] tri 3append ,
-        [ callback-context new do-callback ] %
-    ] [ ] make ;
-
-M: ##alien-callback generate-insn
-    params>>
-    [ registers>objects ]
-    [ wrap-callback-quot %alien-callback ]
-    [ alien-return [ %unnest-stacks ] [ %callback-value ] if-void ]
-    tri ;
+CONDITIONAL: ##compare-branch %compare-branch
+CONDITIONAL: ##compare-imm-branch %compare-imm-branch
+CONDITIONAL: ##compare-integer-branch %compare-branch
+CONDITIONAL: ##compare-integer-imm-branch %compare-integer-imm-branch
+CONDITIONAL: ##test-branch %test-branch
+CONDITIONAL: ##test-imm-branch %test-imm-branch
+CONDITIONAL: ##compare-float-ordered-branch %compare-float-ordered-branch
+CONDITIONAL: ##compare-float-unordered-branch %compare-float-unordered-branch
+CONDITIONAL: ##test-vector-branch %test-vector-branch
+CONDITIONAL: ##check-nursery-branch %check-nursery-branch
+CONDITIONAL: ##fixnum-add %fixnum-add
+CONDITIONAL: ##fixnum-sub %fixnum-sub
+CONDITIONAL: ##fixnum-mul %fixnum-mul
+
+! FFI
+CODEGEN: ##unbox %unbox
+CODEGEN: ##unbox-long-long %unbox-long-long
+CODEGEN: ##store-reg-param %store-reg-param
+CODEGEN: ##store-stack-param %store-stack-param
+CODEGEN: ##load-reg-param %load-reg-param
+CODEGEN: ##load-stack-param %load-stack-param
+CODEGEN: ##local-allot %local-allot
+CODEGEN: ##box %box
+CODEGEN: ##box-long-long %box-long-long
+CODEGEN: ##allot-byte-array %allot-byte-array
+CODEGEN: ##prepare-var-args %prepare-var-args
+CODEGEN: ##alien-invoke %alien-invoke
+CODEGEN: ##cleanup %cleanup
+CODEGEN: ##alien-indirect %alien-indirect
+CODEGEN: ##begin-callback %begin-callback
+CODEGEN: ##alien-callback %alien-callback
+CODEGEN: ##end-callback %end-callback
+
+M: ##alien-assembly generate-insn quot>> call( -- ) ;
index eef517a2bb54c51f34efd7881f1c2425a7e0c72f..9e366cd40833c0f8cd220da8c0d58f820e79d9dd 100644 (file)
@@ -3,12 +3,14 @@
 USING: arrays byte-arrays byte-vectors generic assocs hashtables
 io.binary kernel kernel.private math namespaces make sequences
 words quotations strings alien.accessors alien.strings layouts
-system combinators math.bitwise math.order generalizations
+system combinators math.bitwise math.order combinators.smart
 accessors growable fry compiler.constants memoize ;
 IN: compiler.codegen.fixup
 
-! Owner
-SYMBOL: compiling-word
+! Utilities
+: push-uint ( value vector -- )
+    [ length ] [ B{ 0 0 0 0 } swap push-all ] [ underlying>> ] tri
+    swap set-alien-unsigned-4 ;
 
 ! Parameter table
 SYMBOL: parameter-table
@@ -42,16 +44,18 @@ TUPLE: label-fixup { label label } { class integer } { offset integer } ;
 ! Relocation table
 SYMBOL: relocation-table
 
-: push-4 ( value vector -- )
-    [ length ] [ B{ 0 0 0 0 } swap push-all ] [ underlying>> ] tri
-    swap set-alien-unsigned-4 ;
-
 : add-relocation-entry ( type class offset -- )
-    { 0 24 28 } bitfield relocation-table get push-4 ;
+    { 0 24 28 } bitfield relocation-table get push-uint ;
 
 : rel-fixup ( class type -- )
     swap compiled-offset add-relocation-entry ;
 
+! Binary literal table
+SYMBOL: binary-literal-table
+
+: add-binary-literal ( obj -- label )
+    <label> [ 2array binary-literal-table get push ] keep ;
+
 ! Caching common symbol names reduces image size a bit
 MEMO: cached-string>symbol ( symbol -- obj ) string>symbol ;
 
@@ -70,9 +74,12 @@ MEMO: cached-string>symbol ( symbol -- obj ) string>symbol ;
 : rel-word-pic-tail ( word class -- )
     [ add-literal ] dip rt-entry-point-pic-tail rel-fixup ;
 
-: rel-immediate ( literal class -- )
+: rel-literal ( literal class -- )
     [ add-literal ] dip rt-literal rel-fixup ;
 
+: rel-binary-literal ( literal class -- )
+    [ add-binary-literal ] dip label-fixup ;
+
 : rel-this ( class -- )
     rt-this rel-fixup ;
 
@@ -89,36 +96,56 @@ MEMO: cached-string>symbol ( symbol -- obj ) string>symbol ;
     rt-decks-offset rel-fixup ;
 
 ! And the rest
-: resolve-offset ( label-fixup -- offset )
+: compute-target ( label-fixup -- offset )
     label>> offset>> [ "Unresolved label" throw ] unless* ;
 
-: resolve-absolute-label ( label-fixup -- )
-    dup resolve-offset neg add-literal
-    [ rt-here ] dip [ class>> ] [ offset>> ] bi add-relocation-entry ;
+: compute-relative-label ( label-fixup -- label )
+    [ class>> ] [ offset>> ] [ compute-target ] tri 3array ;
 
-: resolve-relative-label ( label-fixup -- label )
-    [ class>> ] [ offset>> ] [ resolve-offset ] tri 3array ;
+: compute-absolute-label ( label-fixup -- )
+    [ compute-target neg add-literal ]
+    [ [ rt-here ] dip [ class>> ] [ offset>> ] bi add-relocation-entry ] bi ;
 
-: resolve-labels ( label-fixups -- labels' )
+: compute-labels ( label-fixups -- labels' )
     [ class>> rc-absolute? ] partition
-    [ [ resolve-absolute-label ] each ]
-    [ [ resolve-relative-label ] map concat ]
+    [ [ compute-absolute-label ] each ]
+    [ [ compute-relative-label ] map concat ]
     bi* ;
 
-: init-fixup ( word -- )
-    compiling-word set
+: init-fixup ( -- )
     V{ } clone parameter-table set
     V{ } clone literal-table set
     V{ } clone label-table set
-    BV{ } clone relocation-table set ;
+    BV{ } clone relocation-table set
+    V{ } clone binary-literal-table set ;
+
+: alignment ( align -- n )
+    [ compiled-offset dup ] dip align swap - ;
+
+: (align-code) ( n -- )
+    0 <repetition> % ;
+
+: align-code ( n -- )
+    alignment (align-code) ;
+
+: emit-data ( obj label -- )
+    over length align-code
+    resolve-label
+    building get push-all ;
+
+: emit-binary-literals ( -- )
+    binary-literal-table get [ emit-data ] assoc-each ;
 
-: with-fixup ( word quot -- code )
+: with-fixup ( quot -- code )
     '[
-        init-fixup
-        @
-        label-table [ resolve-labels ] change
-        parameter-table get >array
-        literal-table get >array
-        relocation-table get >byte-array
-        label-table get
-    ] B{ } make 5 narray ; inline
+        [
+            init-fixup
+            @
+            emit-binary-literals
+            label-table [ compute-labels ] change
+            parameter-table get >array
+            literal-table get >array
+            relocation-table get >byte-array
+            label-table get
+        ] B{ } make
+    ] output>array ; inline
index 71fdd6cbaf7aff1adba54e13c8283d3566ee3707..e4fd64505e36cee763218e7e170f58ac17c92797 100644 (file)
@@ -15,8 +15,9 @@ compiler.tree.optimizer
 
 compiler.cfg
 compiler.cfg.builder
+compiler.cfg.builder.alien
 compiler.cfg.optimizer
-compiler.cfg.mr
+compiler.cfg.finalization
 
 compiler.codegen ;
 IN: compiler
@@ -125,8 +126,10 @@ M: word combinator? inline? ;
 
 : backend ( tree word -- )
     build-cfg [
-        [ optimize-cfg build-mr ] with-cfg
-        [ generate ] [ label>> ] bi compiled get set-at
+        [
+            optimize-cfg finalize-cfg
+            [ generate ] [ label>> ] bi compiled get set-at
+        ] with-cfg
     ] each ;
 
 : compile-word ( word -- )
index 73e77cca4dd94f074b5f66acb75f9c2ee90d5794..f72a2c4ec57cd2749fecf5fe0f013cf190f33d69 100644 (file)
@@ -28,10 +28,16 @@ CONSTANT: deck-bits 18
 : callstack-length-offset ( -- n ) 1 \ callstack type-number slot-offset ; inline
 : callstack-top-offset ( -- n ) 2 \ callstack type-number slot-offset ; inline
 : vm-context-offset ( -- n ) 0 bootstrap-cells ; inline
+: vm-spare-context-offset ( -- n ) 1 bootstrap-cells ; inline
 : context-callstack-top-offset ( -- n ) 0 bootstrap-cells ; inline
 : context-callstack-bottom-offset ( -- n ) 1 bootstrap-cells ; inline
 : context-datastack-offset ( -- n ) 2 bootstrap-cells ; inline
 : context-retainstack-offset ( -- n ) 3 bootstrap-cells ; inline
+: context-callstack-save-offset ( -- n ) 4 bootstrap-cells ; inline
+: context-callstack-seg-offset ( -- n ) 7 bootstrap-cells ; inline
+: segment-start-offset ( -- n ) 0 bootstrap-cells ; inline
+: segment-size-offset ( -- n ) 1 bootstrap-cells ; inline
+: segment-end-offset ( -- n ) 2 bootstrap-cells ; inline
 
 ! Relocation classes
 CONSTANT: rc-absolute-cell 0
@@ -45,6 +51,7 @@ CONSTANT: rc-relative-arm-3 7
 CONSTANT: rc-indirect-arm 8
 CONSTANT: rc-indirect-arm-pc 9
 CONSTANT: rc-absolute-2 10
+CONSTANT: rc-absolute-1 11
 
 ! Relocation types
 CONSTANT: rt-dlsym 0
@@ -59,6 +66,13 @@ CONSTANT: rt-megamorphic-cache-hits 8
 CONSTANT: rt-vm 9
 CONSTANT: rt-cards-offset 10
 CONSTANT: rt-decks-offset 11
+CONSTANT: rt-exception-handler 12
 
 : rc-absolute? ( n -- ? )
-    ${ rc-absolute-ppc-2/2 rc-absolute-cell rc-absolute } member? ;
+    ${
+        $ rc-absolute-ppc-2/2
+        $ rc-absolute-cell
+        $ rc-absolute
+        $ rc-absolute-2
+        $ rc-absolute-1
+    } member? ;
index aba73d1a2205bf4ee0682d11ab40e496a4aaafd2..476e6da39e0757da0043ef66da344d4dfd4a3a29 100755 (executable)
@@ -1,15 +1,24 @@
 USING: accessors alien alien.c-types alien.libraries
 alien.syntax arrays classes.struct combinators
-compiler continuations effects io io.backend io.pathnames
-io.streams.string kernel math memory namespaces
-namespaces.private parser quotations sequences
-specialized-arrays stack-checker stack-checker.errors
-system threads tools.test words alien.complex ;
+compiler continuations effects generalizations io
+io.backend io.pathnames io.streams.string kernel
+math memory namespaces namespaces.private parser
+quotations sequences specialized-arrays stack-checker
+stack-checker.errors system threads tools.test words
+alien.complex concurrency.promises alien.data
+byte-arrays classes ;
 FROM: alien.c-types => float short ;
 SPECIALIZED-ARRAY: float
 SPECIALIZED-ARRAY: char
 IN: compiler.tests.alien
 
+! Make sure that invalid inputs don't pass the stack checker
+[ [ void { } "cdecl" alien-indirect ] infer ] must-fail
+[ [ "void" { } cdecl alien-indirect ] infer ] must-fail
+[ [ void* 3 cdecl alien-indirect ] infer ] must-fail
+[ [ void* { "int" } cdecl alien-indirect ] infer ] must-fail
+[ [ void* { int } cdecl { } alien-callback ] infer ] must-fail
+
 <<
 : libfactor-ffi-tests-path ( -- string )
     "resource:" absolute-path
@@ -19,9 +28,13 @@ IN: compiler.tests.alien
         { [ os unix?  ]  [ "libfactor-ffi-test.so" ] }
     } cond append-path ;
 
-"f-cdecl" libfactor-ffi-tests-path "cdecl" add-library
+: mingw? ( -- ? ) os windows? vm-compiler "GCC" head? and ;
+
+"f-cdecl" libfactor-ffi-tests-path mingw? mingw cdecl ? add-library
+
+"f-stdcall" libfactor-ffi-tests-path stdcall add-library
 
-"f-stdcall" libfactor-ffi-tests-path "stdcall" add-library
+"f-fastcall" libfactor-ffi-tests-path fastcall add-library
 >>
 
 LIBRARY: f-cdecl
@@ -67,7 +80,7 @@ FUNCTION: FOO ffi_test_14 int x int y ;
 
 [ 11 6 ] [ 11 6 ffi_test_14 [ x>> ] [ y>> ] bi ] unit-test
 
-FUNCTION: char* ffi_test_15 char* x char* y ;
+FUNCTION: c-string ffi_test_15 c-string x c-string y ;
 
 [ "foo" ] [ "xy" "zt" ffi_test_15 ] unit-test
 [ "bar" ] [ "xy" "xy" ffi_test_15 ] unit-test
@@ -90,16 +103,14 @@ FUNCTION: TINY ffi_test_17 int x ;
 [ [ alien-indirect ] infer ] [ inference-error? ] must-fail-with
 
 : indirect-test-1 ( ptr -- result )
-    int { } "cdecl" alien-indirect ;
+    int { } cdecl alien-indirect ;
 
 { 1 1 } [ indirect-test-1 ] must-infer-as
 
-[ B{ } indirect-test-1 ] [ { "kernel-error" 3 6 B{ } } = ] must-fail-with
-
 [ 3 ] [ &: ffi_test_1 indirect-test-1 ] unit-test
 
 : indirect-test-1' ( ptr -- )
-    int { } "cdecl" alien-indirect drop ;
+    int { } cdecl alien-indirect drop ;
 
 { 1 0 } [ indirect-test-1' ] must-infer-as
 
@@ -108,7 +119,7 @@ FUNCTION: TINY ffi_test_17 int x ;
 [ -1 indirect-test-1 ] must-fail
 
 : indirect-test-2 ( x y ptr -- result )
-    int { int int } "cdecl" alien-indirect gc ;
+    int { int int } cdecl alien-indirect gc ;
 
 { 3 1 } [ indirect-test-2 ] must-infer-as
 
@@ -117,11 +128,11 @@ FUNCTION: TINY ffi_test_17 int x ;
 unit-test
 
 : indirect-test-3 ( a b c d ptr -- result )
-    int { int int int int } "stdcall" alien-indirect
+    int { int int int int } stdcall alien-indirect
     gc ;
 
 [ f ] [ "f-stdcall" load-library f = ] unit-test
-[ "stdcall" ] [ "f-stdcall" library abi>> ] unit-test
+[ stdcall ] [ "f-stdcall" library abi>> ] unit-test
 
 : ffi_test_18 ( w x y z -- int )
     int "f-stdcall" "ffi_test_18" { int int int int }
@@ -137,6 +148,14 @@ unit-test
     11 6 -7 ffi_test_19 [ x>> ] [ y>> ] [ z>> ] tri
 ] unit-test
 
+: multi_ffi_test_18 ( w x y z w' x' y' z' -- int int )
+    [ int "f-stdcall" "ffi_test_18" { int int int int } alien-invoke ]
+    4 ndip
+    int "f-stdcall" "ffi_test_18" { int int int int } alien-invoke
+    gc ;
+
+[ 25 85 ] [ 2 3 4 5 6 7 8 9 multi_ffi_test_18 ] unit-test
+
 FUNCTION: double ffi_test_6 float x float y ;
 [ 6.0 ] [ 3.0 2.0 ffi_test_6 ] unit-test
 [ "a" "b" ffi_test_6 ] must-fail
@@ -314,75 +333,64 @@ FUNCTION: ulonglong ffi_test_38 ( ulonglong x, ulonglong y ) ;
 
 ! Test callbacks
 
-: callback-1 ( -- callback ) void { } "cdecl" [ ] alien-callback ;
+: callback-1 ( -- callback ) void { } cdecl [ ] alien-callback ;
 
 [ 0 1 ] [ [ callback-1 ] infer [ in>> length ] [ out>> length ] bi ] unit-test
 
 [ t ] [ callback-1 alien? ] unit-test
 
-: callback_test_1 ( ptr -- ) void { } "cdecl" alien-indirect ;
+: callback_test_1 ( ptr -- ) void { } cdecl alien-indirect ;
 
 [ ] [ callback-1 callback_test_1 ] unit-test
 
-: callback-2 ( -- callback ) void { } "cdecl" [ [ 5 throw ] ignore-errors ] alien-callback ;
+: callback-2 ( -- callback ) void { } cdecl [ [ 5 throw ] ignore-errors ] alien-callback ;
 
 [ ] [ callback-2 callback_test_1 ] unit-test
 
-: callback-3 ( -- callback ) void { } "cdecl" [ 5 "x" set ] alien-callback ;
-
-[ t ] [
-    namestack*
-    3 "x" set callback-3 callback_test_1
-    namestack* eq?
-] unit-test
+: callback-3 ( -- callback ) void { } cdecl [ 5 "x" set ] alien-callback ;
 
-[ 5 ] [
+[ t 3 5 ] [
     [
-        3 "x" set callback-3 callback_test_1 "x" get
+        namestack*
+        3 "x" set callback-3 callback_test_1
+        namestack* eq?
+        "x" get "x" get-global
     ] with-scope
 ] unit-test
 
-: callback-4 ( -- callback )
-    void { } "cdecl" [ "Hello world" write ] alien-callback
-    gc ;
-
-[ "Hello world" ] [
-    [ callback-4 callback_test_1 ] with-string-writer
-] unit-test
-
 : callback-5 ( -- callback )
-    void { } "cdecl" [ gc ] alien-callback ;
+    void { } cdecl [ gc ] alien-callback ;
 
 [ "testing" ] [
     "testing" callback-5 callback_test_1
 ] unit-test
 
 : callback-5b ( -- callback )
-    void { } "cdecl" [ compact-gc ] alien-callback ;
+    void { } cdecl [ compact-gc ] alien-callback ;
 
 [ "testing" ] [
     "testing" callback-5b callback_test_1
 ] unit-test
 
 : callback-6 ( -- callback )
-    void { } "cdecl" [ [ continue ] callcc0 ] alien-callback ;
+    void { } cdecl [ [ continue ] callcc0 ] alien-callback ;
 
 [ 1 2 3 ] [ callback-6 callback_test_1 1 2 3 ] unit-test
 
 : callback-7 ( -- callback )
-    void { } "cdecl" [ 1000000 sleep ] alien-callback ;
+    void { } cdecl [ 1000000 sleep ] alien-callback ;
 
 [ 1 2 3 ] [ callback-7 callback_test_1 1 2 3 ] unit-test
 
 [ f ] [ namespace global eq? ] unit-test
 
 : callback-8 ( -- callback )
-    void { } "cdecl" [ [ ] in-thread yield ] alien-callback ;
+    void { } cdecl [ [ ] in-thread yield ] alien-callback ;
 
 [ ] [ callback-8 callback_test_1 ] unit-test
 
 : callback-9 ( -- callback )
-    int { int int int } "cdecl" [
+    int { int int int } cdecl [
         + + 1 +
     ] alien-callback ;
 
@@ -440,17 +448,20 @@ STRUCT: double-rect
     } cleave ;
 
 : double-rect-callback ( -- alien )
-    void { void* void* double-rect } "cdecl"
+    void { void* void* double-rect } cdecl
     [ "example" set-global 2drop ] alien-callback ;
 
-: double-rect-test ( arg -- arg' )
-    f f rot
-    double-rect-callback
-    void { void* void* double-rect } "cdecl" alien-indirect
+: double-rect-test ( arg callback -- arg' )
+    [ f f ] 2dip
+    void { void* void* double-rect } cdecl alien-indirect
     "example" get-global ;
 
-[ 1.0 2.0 3.0 4.0 ]
-[ 1.0 2.0 3.0 4.0 <double-rect> double-rect-test >double-rect< ] unit-test
+[ byte-array 1.0 2.0 3.0 4.0 ]
+[
+    1.0 2.0 3.0 4.0 <double-rect>
+    double-rect-callback double-rect-test
+    [ >c-ptr class ] [ >double-rect< ] bi
+] unit-test
 
 STRUCT: test_struct_14
     { x1 double }
@@ -463,7 +474,7 @@ FUNCTION: test_struct_14 ffi_test_40 ( double x1, double x2 ) ;
 ] unit-test
 
 : callback-10 ( -- callback )
-    test_struct_14 { double double } "cdecl"
+    test_struct_14 { double double } cdecl
     [
         test_struct_14 <struct>
             swap >>x2
@@ -471,7 +482,7 @@ FUNCTION: test_struct_14 ffi_test_40 ( double x1, double x2 ) ;
     ] alien-callback ;
 
 : callback-10-test ( x1 x2 callback -- result )
-    test_struct_14 { double double } "cdecl" alien-indirect ;
+    test_struct_14 { double double } cdecl alien-indirect ;
 
 [ 1.0 2.0 ] [
     1.0 2.0 callback-10 callback-10-test
@@ -486,7 +497,7 @@ FUNCTION: test-struct-12 ffi_test_41 ( int a, double x ) ;
 ] unit-test
 
 : callback-11 ( -- callback )
-    test-struct-12 { int double } "cdecl"
+    test-struct-12 { int double } cdecl
     [
         test-struct-12 <struct>
             swap >>x
@@ -494,7 +505,7 @@ FUNCTION: test-struct-12 ffi_test_41 ( int a, double x ) ;
     ] alien-callback ;
 
 : callback-11-test ( x1 x2 callback -- result )
-    test-struct-12 { int double } "cdecl" alien-indirect ;
+    test-struct-12 { int double } cdecl alien-indirect ;
 
 [ 1 2.0 ] [
     1 2.0 callback-11 callback-11-test
@@ -510,7 +521,7 @@ FUNCTION: test_struct_15 ffi_test_42 ( float x, float y ) ;
 [ 1.0 2.0 ] [ 1.0 2.0 ffi_test_42 [ x>> ] [ y>> ] bi ] unit-test
 
 : callback-12 ( -- callback )
-    test_struct_15 { float float } "cdecl"
+    test_struct_15 { float float } cdecl
     [
         test_struct_15 <struct>
             swap >>y
@@ -518,7 +529,7 @@ FUNCTION: test_struct_15 ffi_test_42 ( float x, float y ) ;
     ] alien-callback ;
 
 : callback-12-test ( x1 x2 callback -- result )
-    test_struct_15 { float float } "cdecl" alien-indirect ;
+    test_struct_15 { float float } cdecl alien-indirect ;
 
 [ 1.0 2.0 ] [
     1.0 2.0 callback-12 callback-12-test [ x>> ] [ y>> ] bi
@@ -533,7 +544,7 @@ FUNCTION: test_struct_16 ffi_test_43 ( float x, int a ) ;
 [ 1.0 2 ] [ 1.0 2 ffi_test_43 [ x>> ] [ a>> ] bi ] unit-test
 
 : callback-13 ( -- callback )
-    test_struct_16 { float int } "cdecl"
+    test_struct_16 { float int } cdecl
     [
         test_struct_16 <struct>
             swap >>a
@@ -541,7 +552,7 @@ FUNCTION: test_struct_16 ffi_test_43 ( float x, int a ) ;
     ] alien-callback ;
 
 : callback-13-test ( x1 x2 callback -- result )
-    test_struct_16 { float int } "cdecl" alien-indirect ;
+    test_struct_16 { float int } cdecl alien-indirect ;
 
 [ 1.0 2 ] [
     1.0 2 callback-13 callback-13-test
@@ -576,7 +587,7 @@ FUNCTION: complex-float ffi_test_47 ( complex-float x, complex-double y ) ;
 
 ! Reported by jedahu
 STRUCT: bool-field-test
-    { name char* }
+    { name c-string }
     { on bool }
     { parents short } ;
 
@@ -590,12 +601,194 @@ FUNCTION: short ffi_test_48 ( bool-field-test x ) ;
 
 ] unless
 
-! Regression: calling an undefined function would raise a protection fault
-FUNCTION: void this_does_not_exist ( ) ;
+! Test interaction between threads and callbacks
+: thread-callback-1 ( -- callback )
+    int { } cdecl [ yield 100 ] alien-callback ;
 
-[ this_does_not_exist ] [ { "kernel-error" 9 f f } = ] must-fail-with
+: thread-callback-2 ( -- callback )
+    int { } cdecl [ yield 200 ] alien-callback ;
+
+: thread-callback-invoker ( callback -- n )
+    int { } cdecl alien-indirect ;
+
+<promise> "p" set
+[ thread-callback-1 thread-callback-invoker "p" get fulfill ] in-thread
+[ 200 ] [ thread-callback-2 thread-callback-invoker ] unit-test
+[ 100 ] [ "p" get ?promise ] unit-test
 
 ! More alien-assembly tests are in cpu.* vocabs
-: assembly-test-1 ( -- ) void { } "cdecl" [ ] alien-assembly ;
+: assembly-test-1 ( -- ) void { } cdecl [ ] alien-assembly ;
 
 [ ] [ assembly-test-1 ] unit-test
+
+[ f ] [ "f-fastcall" load-library f = ] unit-test
+[ fastcall ] [ "f-fastcall" library abi>> ] unit-test
+
+: ffi_test_49 ( x -- int )
+    int "f-fastcall" "ffi_test_49" { int }
+    alien-invoke gc ;
+: ffi_test_50 ( x y -- int )
+    int "f-fastcall" "ffi_test_50" { int int }
+    alien-invoke gc ;
+: ffi_test_51 ( x y z -- int )
+    int "f-fastcall" "ffi_test_51" { int int int }
+    alien-invoke gc ;
+: multi_ffi_test_51 ( x y z x' y' z' -- int int )
+    [ int "f-fastcall" "ffi_test_51" { int int int } alien-invoke ]
+    3dip
+    int "f-fastcall" "ffi_test_51" { int int int } alien-invoke gc ;
+    
+[ 4 ] [ 3 ffi_test_49 ] unit-test
+[ 8 ] [ 3 4 ffi_test_50 ] unit-test
+[ 13 ] [ 3 4 5 ffi_test_51 ] unit-test
+[ 13 22 ] [ 3 4 5 6 7 8 multi_ffi_test_51 ] unit-test
+
+: ffi_test_52 ( x y z -- int )
+    int "f-fastcall" "ffi_test_52" { int float int }
+    alien-invoke gc ;
+: ffi_test_53 ( x y z w -- int )
+    int "f-fastcall" "ffi_test_53" { int float int int }
+    alien-invoke gc ;
+: ffi_test_57 ( x y -- test-struct-11 )
+    test-struct-11 "f-fastcall" "ffi_test_57" { int int }
+    alien-invoke gc ;
+: ffi_test_58 ( x y z -- test-struct-11 )
+    test-struct-11 "f-fastcall" "ffi_test_58" { int int int }
+    alien-invoke gc ;
+
+! GCC bugs
+mingw? [
+    [ 13 ] [ 3 4.0 5 ffi_test_52 ] unit-test
+
+    [ 19 ] [ 3 4.0 5 6 ffi_test_53 ] unit-test
+] unless
+
+[ S{ test-struct-11 f 7 -1 } ] [ 3 4 ffi_test_57 ] unit-test
+
+[ S{ test-struct-11 f 7 -3 } ] [ 3 4 7 ffi_test_58 ] unit-test
+
+: fastcall-ii-indirect ( x y ptr -- result )
+    int { int int } fastcall alien-indirect ;
+
+: fastcall-iii-indirect ( x y z ptr -- result )
+    int { int int int } fastcall alien-indirect ;
+
+: fastcall-ifi-indirect ( x y z ptr -- result )
+    int { int float int } fastcall alien-indirect ;
+
+: fastcall-ifii-indirect ( x y z w ptr -- result )
+    int { int float int int } fastcall alien-indirect ;
+
+: fastcall-struct-return-ii-indirect ( x y ptr -- result )
+    test-struct-11 { int int } fastcall alien-indirect ;
+
+: fastcall-struct-return-iii-indirect ( x y z ptr -- result )
+    test-struct-11 { int int int } fastcall alien-indirect ;
+
+: win32? ( -- ? ) os windows? cpu x86.32? and ;
+
+[ 8 ] [
+    3 4
+    win32? [ &: @ffi_test_50@8 ] [ &: ffi_test_50 ] if
+    fastcall-ii-indirect
+] unit-test
+
+[ 13 ] [
+    3 4 5
+    win32? [ &: @ffi_test_51@12 ] [ &: ffi_test_51 ] if
+    fastcall-iii-indirect
+] unit-test
+
+mingw? [
+    [ 13 ] [
+        3 4.0 5
+        win32? [ &: @ffi_test_52@12 ] [ &: ffi_test_52 ] if
+        fastcall-ifi-indirect
+    ] unit-test
+
+    [ 19 ] [
+        3 4.0 5 6
+        win32? [ &: @ffi_test_53@16 ] [ &: ffi_test_53 ] if
+        fastcall-ifii-indirect
+    ] unit-test
+] unless
+
+[ S{ test-struct-11 f 7 -1 } ]
+[
+    3 4
+    win32? [ &: @ffi_test_57@8 ] [ &: ffi_test_57 ] if
+    fastcall-struct-return-ii-indirect
+] unit-test
+
+[ S{ test-struct-11 f 7 -3 } ]
+[
+    3 4 7
+    win32? [ &: @ffi_test_58@12 ] [ &: ffi_test_58 ] if
+    fastcall-struct-return-iii-indirect
+] unit-test
+
+: fastcall-ii-callback ( -- ptr )
+    int { int int } fastcall [ + 1 + ] alien-callback ;
+
+: fastcall-iii-callback ( -- ptr )
+    int { int int int } fastcall [ + + 1 + ] alien-callback ;
+
+: fastcall-ifi-callback ( -- ptr )
+    int { int float int } fastcall
+    [ [ >integer ] dip + + 1 + ] alien-callback ;
+
+: fastcall-ifii-callback ( -- ptr )
+    int { int float int int } fastcall
+    [ [ >integer ] 2dip + + + 1 + ] alien-callback ;
+
+: fastcall-struct-return-ii-callback ( -- ptr )
+    test-struct-11 { int int } fastcall
+    [ [ + ] [ - ] 2bi test-struct-11 <struct-boa> ] alien-callback ;
+
+: fastcall-struct-return-iii-callback ( -- ptr )
+    test-struct-11 { int int int } fastcall
+    [ [ drop + ] [ - nip ] 3bi test-struct-11 <struct-boa> ] alien-callback ;
+
+[ 8 ] [ 3 4 fastcall-ii-callback fastcall-ii-indirect ] unit-test
+
+[ 13 ] [ 3 4 5 fastcall-iii-callback fastcall-iii-indirect ] unit-test
+
+[ 13 ] [ 3 4.0 5 fastcall-ifi-callback fastcall-ifi-indirect ] unit-test
+
+[ 19 ] [ 3 4.0 5 6 fastcall-ifii-callback fastcall-ifii-indirect ] unit-test
+
+[ S{ test-struct-11 f 7 -1 } ]
+[ 3 4 fastcall-struct-return-ii-callback fastcall-struct-return-ii-indirect ] unit-test
+
+[ S{ test-struct-11 f 7 -3 } ]
+[ 3 4 7 fastcall-struct-return-iii-callback fastcall-struct-return-iii-indirect ] unit-test
+
+: x64-regression-1 ( -- c )
+    int { int int int int int } cdecl [ + + + + ] alien-callback ;
+
+: x64-regression-2 ( x x x x x c -- y )
+    int { int int int int int } cdecl alien-indirect ; inline
+
+[ 661 ] [ 100 500 50 10 1 x64-regression-1 x64-regression-2 ] unit-test
+
+! Stack allocation
+: blah ( -- x ) { RECT } [ 1.5 >>x 2.0 >>y [ x>> ] [ y>> ] bi * >fixnum ] with-scoped-allocation ;
+
+[ 3 ] [ blah ] unit-test
+
+: out-param-test ( -- b )
+    { int } [ [ 12 ] dip 0 int set-alien-value ] [ ] with-out-parameters ;
+
+[ 12 ] [ out-param-test ] unit-test
+
+: out-param-callback ( -- a )
+    void { int pointer: int } cdecl
+    [ [ 2 * ] dip 0 int set-alien-value ] alien-callback ;
+
+: out-param-indirect ( a a -- b )
+    { int } [
+        swap void { int pointer: int } cdecl
+        alien-indirect
+    ] [ ] with-out-parameters ;
+
+[ 12 ] [ 6 out-param-callback out-param-indirect ] unit-test
index 288940e660e82a747dfaf32fee49a88de95d207e..e9127f71e4b0679e112277b866200bbbc48f7809 100644 (file)
@@ -462,3 +462,20 @@ TUPLE: myseq { underlying1 byte-array read-only } { underlying2 byte-array read-
     1 1
     [ [ HEX: f bitand ] bi@ [ shift ] [ drop -3 shift ] 2bi ] compile-call
 ] unit-test
+
+! GC root offsets were computed wrong on x86
+: gc-root-messup ( a -- b )
+    dup [
+        1024 (byte-array) 2array
+        10 void* "libc" "malloc" { ulong } alien-invoke
+        void "libc" "free" { void* } alien-invoke
+    ] when ;
+
+[ ] [ 2000 [ "hello" clone dup gc-root-messup first eq? t assert= ] times ] unit-test
+
+! Alias analysis bug
+[ t ] [
+    [
+        10 10 <byte-array> [ <displaced-alien> underlying>> ] keep eq?
+    ] compile-call
+] unit-test
index ddbd9ba6463fefb49bcb5874660e89d9254b6744..4f38cd8290258510e1f0e47ff7a14662d3079e26 100644 (file)
@@ -32,7 +32,7 @@ IN: compiler.tests.curry
     compile-call
 ] unit-test
 
-: foobar ( quot: ( -- ) -- )
+: foobar ( quot: ( ..a -- ..b ) -- )
     [ call ] keep swap [ foobar ] [ drop ] if ; inline recursive
 
 [ ] [ [ [ f ] foobar ] compile-call ] unit-test
index 0d4e30279e3d65fe656c58d8045e79794bea5e94..6689ef8a586dac421603bf78fb2bc9b972865a66 100644 (file)
@@ -1,16 +1,14 @@
 USING: compiler.units compiler.test kernel kernel.private memory
 math math.private tools.test math.floats.private math.order fry
-;
+specialized-arrays sequences math.functions layouts literals ;
+QUALIFIED-WITH: alien.c-types c
+SPECIALIZED-ARRAY: c:float
+SPECIALIZED-ARRAY: c:double
 IN: compiler.tests.float
 
-[ 5.0 ] [ [ 5.0 ] compile-call gc gc gc ] unit-test
-[ 2.0 3.0 ] [ 3.0 [ 2.0 swap ] compile-call ] unit-test
-
-[ 1 2 3 4.0 ] [ [ 1 2 3 4.0 ] compile-call ] unit-test
-
 [ 3.0 1 2 3 ] [ 1.0 2.0 [ float+ 1 2 3 ] compile-call ] unit-test
 
-[ 3 ] [ 1.0 [ 2.0 float+ tag ] compile-call ] unit-test
+[ $[ float type-number ] ] [ 1.0 [ 2.0 float+ tag ] compile-call ] unit-test
 
 [ 3.0 ] [ 1.0 [ 2.0 float+ ] compile-call ] unit-test
 [ 3.0 ] [ 1.0 [ 2.0 swap float+ ] compile-call ] unit-test
@@ -83,6 +81,9 @@ IN: compiler.tests.float
 [ t ] [ -0.0 [ dup 0.0 float= swap -0.0 float= or ] compile-call ] unit-test
 [ f ] [ 3.0 [ dup 0.0 float= swap -0.0 float= or ] compile-call ] unit-test
 
+[ 313.0 ] [ 313 [ fixnum>float ] compile-call ] unit-test
+[ -313 ] [ -313.5 [ float>fixnum ] compile-call ] unit-test
+[ 313 ] [ 313.5 [ float>fixnum ] compile-call ] unit-test
 [ 315 315.0 ] [ 313 [ 2 fixnum+fast dup fixnum>float ] compile-call ] unit-test
 
 [ t ] [ 0/0. 0/0. [ float-unordered? ] compile-call ] unit-test
@@ -97,9 +98,6 @@ IN: compiler.tests.float
 [ 2 ] [ 3.0 1.0 [ float-unordered? [ 1 ] [ 2 ] if ] compile-call ] unit-test
 [ 2 ] [ 1.0 3.0 [ float-unordered? [ 1 ] [ 2 ] if ] compile-call ] unit-test
 
-! Ensure that float-min and min, and float-max and max, have
-! consistent behavior with respect to NaNs
-
 : two-floats ( a b -- a b ) { float float } declare ; inline
 
 [ -11.3 ] [ -11.3 17.5 [ two-floats min ] compile-call ] unit-test
@@ -107,12 +105,40 @@ IN: compiler.tests.float
 [ 17.5 ] [ -11.3 17.5 [ two-floats max ] compile-call ] unit-test
 [ 17.5 ] [ 17.5 -11.3 [ two-floats max ] compile-call ] unit-test
 
-: check-compiled-binary-op ( a b word -- )
-    [ '[ [ [ two-floats _ execute ] compile-call ] call( a b -- c ) ] ]
-    [ '[ _ execute ] ]
-    bi 2bi fp-bitwise= ; inline
-
-[ t ] [ 0/0. 3.0 \ min check-compiled-binary-op ] unit-test
-[ t ] [ 3.0 0/0. \ min check-compiled-binary-op ] unit-test
-[ t ] [ 0/0. 3.0 \ max check-compiled-binary-op ] unit-test
-[ t ] [ 3.0 0/0. \ max check-compiled-binary-op ] unit-test
+! Test loops
+[ 30.0 ] [
+    float-array{ 1 2 3 4 } float-array{ 1 2 3 4 }
+    [ { float-array float-array } declare [ * ] [ + ] 2map-reduce ] compile-call
+] unit-test
+
+[ 30.0 ] [
+    float-array{ 1 2 3 4 }
+    [ { float-array } declare dup [ * ] [ + ] 2map-reduce ] compile-call
+] unit-test
+
+[ 30.0 ] [
+    float-array{ 1 2 3 4 }
+    [ { float-array } declare [ dup * ] [ + ] map-reduce ] compile-call
+] unit-test
+
+[ 4.5 ] [
+    float-array{ 1.0 3.5 }
+    [ { float-array } declare 0.0 [ + ] reduce ] compile-call
+] unit-test
+
+[ float-array{ 2.0 4.5 } ] [
+    float-array{ 1.0 3.5 }
+    [ { float-array } declare [ 1 + ] map ] compile-call
+] unit-test
+
+[ t ] [
+    [ double-array{ 1.0 2.0 3.0 } 0.0 [ + ] reduce sqrt ] compile-call
+    2.44948 0.0001 ~
+] unit-test
+
+[ 7.5 3 ] [
+    [
+        double-array{ 1.0 2.0 3.0 }
+        1.5 [ + ] reduce dup 0.0 < [ 2 ] [ 3 ] if
+    ] compile-call
+] unit-test
diff --git a/basis/compiler/tests/linkage-errors.factor b/basis/compiler/tests/linkage-errors.factor
new file mode 100644 (file)
index 0000000..fc59f65
--- /dev/null
@@ -0,0 +1,21 @@
+USING: tools.test namespaces assocs alien.syntax kernel\r
+compiler.errors accessors alien ;\r
+FROM: alien.libraries => add-library ;\r
+IN: compiler.tests.linkage-errors\r
+\r
+! Regression: calling an undefined function would raise a protection fault\r
+FUNCTION: void this_does_not_exist ( ) ;\r
+\r
+[ this_does_not_exist ] [ { "kernel-error" 9 f f } = ] must-fail-with\r
+\r
+[ T{ no-such-symbol { name "this_does_not_exist" } } ]\r
+[ \ this_does_not_exist linkage-errors get at error>> ] unit-test\r
+\r
+<< "no_such_library" "no_such_library" cdecl add-library >>\r
+\r
+LIBRARY: no_such_library\r
+\r
+FUNCTION: void no_such_function ( ) ;\r
+\r
+[ T{ no-such-library { name "no_such_library" } } ]\r
+[ \ no_such_function linkage-errors get at error>> ] unit-test\r
index bc7f3fa2f2d313fc2ba93a0387ed7525b75e2589..6ec8791ad3bec0abf08c8186192adf1b74dd1b6f 100644 (file)
@@ -1,20 +1,22 @@
 USING: accessors assocs compiler compiler.cfg
-compiler.cfg.debugger compiler.cfg.instructions compiler.cfg.mr
-compiler.cfg.registers compiler.codegen compiler.units
-cpu.architecture hashtables kernel namespaces sequences
-tools.test vectors words layouts literals math arrays
-alien.syntax math.private ;
+compiler.cfg.debugger compiler.cfg.instructions
+compiler.cfg.registers compiler.cfg.linear-scan
+compiler.cfg.ssa.destruction compiler.cfg.build-stack-frame
+compiler.codegen compiler.units cpu.architecture hashtables
+kernel namespaces sequences tools.test vectors words layouts
+literals math arrays alien.c-types alien.syntax math.private ;
 IN: compiler.tests.low-level-ir
 
 : compile-cfg ( cfg -- word )
     gensym
-    [ build-mr generate ] dip
+    [ linear-scan build-stack-frame generate ] dip
     [ associate >alist t t modify-code-heap ] keep ;
 
 : compile-test-cfg ( -- word )
     cfg new 0 get >>entry
     dup cfg set
-    dup fake-representations representations get >>reps
+    dup fake-representations
+    destruct-ssa
     compile-cfg ;
 
 : compile-test-bb ( insns -- result )
@@ -33,13 +35,7 @@ IN: compiler.tests.low-level-ir
     compile-test-cfg
     execute( -- result ) ;
 
-! loading immediates
-[ f ] [
-    V{
-        T{ ##load-immediate f 0 $[ \ f type-number ] }
-    } compile-test-bb
-] unit-test
-
+! loading constants
 [ "hello" ] [
     V{
         T{ ##load-reference f 0 "hello" }
@@ -50,9 +46,9 @@ IN: compiler.tests.low-level-ir
 ! one of the sources
 [ t ] [
     V{
-        T{ ##load-immediate f 1 $[ 2 cell log2 shift array type-number - ] }
+        T{ ##load-tagged f 1 $[ 2 cell log2 shift array type-number - ] }
         T{ ##load-reference f 0 { t f t } }
-        T{ ##slot f 0 0 1 }
+        T{ ##slot f 0 0 1 0 0 }
     } compile-test-bb
 ] unit-test
 
@@ -65,9 +61,9 @@ IN: compiler.tests.low-level-ir
 
 [ t ] [
     V{
-        T{ ##load-immediate f 1 $[ 2 cell log2 shift array type-number - ] }
+        T{ ##load-tagged f 1 $[ 2 cell log2 shift array type-number - ] }
         T{ ##load-reference f 0 { t f t } }
-        T{ ##set-slot f 0 0 1 }
+        T{ ##set-slot f 0 0 1 0 0 }
     } compile-test-bb
     dup first eq?
 ] unit-test
@@ -82,14 +78,14 @@ IN: compiler.tests.low-level-ir
 
 [ 4 ] [
     V{
-        T{ ##load-immediate f 0 4 }
+        T{ ##load-tagged f 0 4 }
         T{ ##shl f 0 0 0 }
     } compile-test-bb
 ] unit-test
 
 [ 4 ] [
     V{
-        T{ ##load-immediate f 0 4 }
+        T{ ##load-tagged f 0 4 }
         T{ ##shl-imm f 0 0 4 }
     } compile-test-bb
 ] unit-test
@@ -97,24 +93,15 @@ IN: compiler.tests.low-level-ir
 [ 31 ] [
     V{
         T{ ##load-reference f 1 B{ 31 67 52 } }
-        T{ ##unbox-any-c-ptr f 0 1 }
-        T{ ##alien-unsigned-1 f 0 0 0 }
-        T{ ##shl-imm f 0 0 4 }
-    } compile-test-bb
-] unit-test
-
-[ CHAR: l ] [
-    V{
-        T{ ##load-reference f 0 "hello world" }
-        T{ ##load-immediate f 1 3 }
-        T{ ##string-nth f 0 0 1 2 }
-        T{ ##shl-imm f 0 0 4 }
+        T{ ##unbox-any-c-ptr f 2 1 }
+        T{ ##load-memory-imm f 3 2 0 int-rep uchar }
+        T{ ##shl-imm f 0 3 4 }
     } compile-test-bb
 ] unit-test
 
 [ 1 ] [
     V{
-        T{ ##load-immediate f 0 32 }
+        T{ ##load-tagged f 0 32 }
         T{ ##add-imm f 0 0 -16 }
     } compile-test-bb
 ] unit-test
index fe67cbbc37bb33a9d60aade18bdfd3a074ba9e29..13917fd6bfd1be3cdf8fd8926bac9c41239f57a1 100644 (file)
@@ -193,25 +193,6 @@ M: number detect-number ;
 ! Regression
 [ 4 [ + ] ] [ 2 2 [ [ + ] [ call ] keep ] compile-call ] unit-test
 
-! Regression
-USE: sorting
-USE: binary-search
-USE: binary-search.private
-
-: old-binsearch ( elt quot: ( -- ) seq -- elt quot i )
-    dup length 1 <= [
-        from>>
-    ] [
-        [ midpoint swap call ] 3keep [ rot ] dip swap dup zero?
-        [ drop dup from>> swap midpoint@ + ]
-        [ drop dup midpoint@ head-slice old-binsearch ] if
-    ] if ; inline recursive
-
-[ 10 ] [
-    10 20 iota <flat-slice>
-    [ [ - ] swap old-binsearch ] compile-call 2nip
-] unit-test
-
 ! Regression
 : empty-compound ( -- ) ;
 
index e6061937b6c1bc18756f504b99cbdbb4c87b982e..dafdc2d1af091df7460fc9f0c63cfef65e9fdb0b 100644 (file)
@@ -1,6 +1,7 @@
 IN: compiler.tests.redefine23
 USING: classes.struct specialized-arrays alien.c-types sequences
 compiler.units vocabs tools.test ;
+FROM: specialized-arrays.private => specialized-array-vocab ;
 
 STRUCT: my-struct { x int } ;
 SPECIALIZED-ARRAY: my-struct
@@ -8,6 +9,6 @@ SPECIALIZED-ARRAY: my-struct
 
 [ ] [
     [
-        "specialized-arrays.instances.compiler.tests.redefine23" forget-vocab
+        my-struct specialized-array-vocab forget-vocab
     ] with-compilation-unit
 ] unit-test
index 391102102edebc18e11981304dcf718a574f345c..90c4e9943d9966d197b2c0b932dfe72bbd260d40 100644 (file)
@@ -7,12 +7,12 @@ TYPEDEF: alien.c-types:int type-1
 TYPEDEF: alien.c-types:int type-3
 
 : callback ( -- ptr )
-    type-3 { type-1 type-1 } "cdecl" [ + >integer ] alien-callback ;
+    type-3 { type-1 type-1 } cdecl [ + >integer ] alien-callback ;
 
 TYPEDEF: alien.c-types:float type-2
 
 : indirect ( x y ptr -- z  )
-    type-3 { type-2 type-2 } "cdecl" alien-indirect ;
+    type-3 { type-2 type-2 } cdecl alien-indirect ;
 
 [ ] [
     "USING: alien.c-types alien.syntax ;
index e518ff8df2fa73051db4abf15c7bc9f0cff6fc5c..2e4c48f930eecb3b88b9c6f15d35c3059abe6db7 100644 (file)
@@ -1,7 +1,9 @@
 USING: math.private kernel combinators accessors arrays
-generalizations tools.test words ;
+generalizations sequences.generalizations tools.test words ;
 IN: compiler.tests.spilling
 
+! These tests are stupid and don't trigger spilling anymore
+
 : float-spill-bug ( a -- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b )
     {
         [ dup float+ ]
@@ -163,7 +165,6 @@ IN: compiler.tests.spilling
 
 [ 4 ] [ 1 1 resolve-spill-bug ] unit-test
 
-! The above don't really test spilling...
 : spill-test-1 ( a -- b )
     dup 1 fixnum+fast
     dup 1 fixnum+fast
index b3f01c8c01b02f1764071695a791dc3a1c3bf0de..a3a19b8f4d6bf86c614d8dd0d06144968b6ede3b 100644 (file)
@@ -7,6 +7,7 @@ compiler.tree
 compiler.tree.def-use
 compiler.tree.recursive
 compiler.tree.combinators ;
+FROM: namespaces => set ;
 IN: compiler.tree.checker
 
 ! Check some invariants; this can help catch compiler bugs.
index 1fffa06336e6769c02091750022c32d6741d8395..69c48c5f94f83147f06692ab3f695f14a346ab9c 100644 (file)
@@ -5,7 +5,7 @@ arrays stack-checker.inlining namespaces compiler.tree
 math.order ;
 IN: compiler.tree.combinators
 
-: each-node ( nodes quot: ( node -- ) -- )
+: each-node ( ... nodes quot: ( ... node -- ... ) -- ... )
     dup dup '[
         _ [
             dup #branch? [
@@ -18,7 +18,7 @@ IN: compiler.tree.combinators
         ] bi
     ] each ; inline recursive
 
-: map-nodes ( nodes quot: ( node -- node' ) -- nodes )
+: map-nodes ( ... nodes quot: ( ... node -- ... node' ) -- ... nodes )
     dup dup '[
         @
         dup #branch? [
@@ -30,7 +30,7 @@ IN: compiler.tree.combinators
         ] if
     ] map-flat ; inline recursive
 
-: contains-node? ( nodes quot: ( node -- ? ) -- ? )
+: contains-node? ( ... nodes quot: ( ... node -- ... ? ) -- ... ? )
     dup dup '[
         _ keep swap [ drop t ] [
             dup #branch? [
@@ -49,7 +49,7 @@ IN: compiler.tree.combinators
 : sift-children ( seq flags -- seq' )
     zip [ nip ] assoc-filter keys ;
 
-: until-fixed-point ( #recursive quot: ( node -- ) -- )
+: until-fixed-point ( ... #recursive quot: ( ... node -- ... ) -- ... )
     over label>> t >>fixed-point drop
     [ with-scope ] 2keep
     over label>> fixed-point>> [ 2drop ] [ until-fixed-point ] if ;
index d1fdf6359a19322c472b5422b4c7365105487a2c..5b5249f8e44d6b8c751d5c6089f41875c13ba54a 100644 (file)
@@ -4,6 +4,7 @@ USING: sequences namespaces kernel accessors assocs sets fry
 arrays combinators columns stack-checker.backend
 stack-checker.branches compiler.tree compiler.tree.combinators
 compiler.tree.dead-code.liveness compiler.tree.dead-code.simple ;
+FROM: namespaces => set ;
 IN: compiler.tree.dead-code.branches
 
 M: #if mark-live-values* look-at-inputs ;
index d859096e1db7c90793c4930e63cbc454b7769377..afdd8fed4e61bf74e4f6077f2073a1015eb9ea2c 100644 (file)
@@ -168,7 +168,7 @@ IN: compiler.tree.dead-code.tests
 
 [ ] [ [ [ 0 -rot set-nth-unsafe ] curry (each-integer) ] optimize-quot drop ] unit-test
 
-: call-recursive-dce-6 ( i quot: ( i -- ? ) -- i )
+: call-recursive-dce-6 ( i quot: ( ..a -- ..b ) -- i )
     dup call [ drop ] [ call-recursive-dce-6 ] if ; inline recursive
 
 [ ] [ [ [ ] curry [ ] swap compose call-recursive-dce-6 ] optimize-quot drop ] unit-test
index 9ece5d340b60d497c1ee91b65483d48f6e3b277e..7e437cbc4e859d5926dfd7b8dfc5cf72f1a63391 100644 (file)
@@ -4,6 +4,7 @@ USING: fry accessors namespaces assocs deques search-deques
 dlists kernel sequences compiler.utilities words sets
 stack-checker.branches compiler.tree compiler.tree.def-use
 compiler.tree.combinators ;
+FROM: namespaces => set ;
 IN: compiler.tree.dead-code.liveness
 
 SYMBOL: work-list
index 872b6131c9bd453a9efa315aef58726f288adb7b..4af54d0319ce9275557198d4d247c040c01ae707 100644 (file)
@@ -6,6 +6,8 @@ stack-checker.state
 stack-checker.branches
 compiler.tree
 compiler.tree.combinators ;
+FROM: namespaces => set ;
+FROM: sets => members ;
 IN: compiler.tree.def-use
 
 SYMBOL: def-use
@@ -42,7 +44,7 @@ GENERIC: node-uses-values ( node -- values )
 
 M: #introduce node-uses-values drop f ;
 M: #push node-uses-values drop f ;
-M: #phi node-uses-values phi-in-d>> concat remove-bottom prune ;
+M: #phi node-uses-values phi-in-d>> concat remove-bottom members ;
 M: #declare node-uses-values drop f ;
 M: #terminate node-uses-values [ in-d>> ] [ in-r>> ] bi append ;
 M: #shuffle node-uses-values [ in-d>> ] [ in-r>> ] bi append ;
index c2fb74c97e285d2616414e67740fb082c23a85ee..0061e8cffb471b1d74a54a1f96db697907ed7784 100644 (file)
@@ -2,6 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: sequences kernel fry vectors accessors namespaces assocs sets
 stack-checker.branches compiler.tree compiler.tree.def-use ;
+FROM: namespaces => set ;
 IN: compiler.tree.def-use.simplified
 
 ! Simplified def-use follows chains of copies.
index 5291c5e81f69195f3a93ff0c79ce366e6ab92a76..015b6ad626ac3d0cc70c6287814b769c76ecf65f 100644 (file)
@@ -2,6 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs namespaces sequences kernel math
 combinators sets disjoint-sets fry stack-checker.values ;
+FROM: namespaces => set ;
 IN: compiler.tree.escape-analysis.allocations
 
 ! A map from values to classes. Only for #introduce outputs
index 3451750a344ef656584f8c0bb32a44a5610ee744..4c9dc1ade7cfb0623d19a967a3ea3d899fe59d1c 100644 (file)
@@ -10,7 +10,7 @@ GENERIC: escape-analysis* ( node -- )
 
 SYMBOL: next-node
 
-: each-with-next ( seq quot: ( elt -- ) -- )
+: each-with-next ( ... seq quot: ( ... elt -- ... ) -- ... )
     dupd '[ 1 + _ ?nth next-node set @ ] each-index ; inline
 
 : (escape-analysis) ( node -- )
index ece2ed80f3d4af7c1622f04d0803e28d2e243482..961ce1ecd715fd2822003729540287452b3f33d4 100644 (file)
@@ -9,6 +9,7 @@ compiler.tree.propagation.info
 compiler.tree.def-use
 compiler.tree.def-use.simplified
 compiler.tree.late-optimizations ;
+FROM: namespaces => set ;
 IN: compiler.tree.modular-arithmetic
 
 ! This is a late-stage optimization.
index 19669c22399e4493081616ff771674301b8d78bb..2f250fcf0867612ff518cb1d8428d51983809025 100644 (file)
@@ -14,7 +14,7 @@ IN: compiler.tree.normalization.tests
 
 [ 2 ] [ [ 3 [ drop ] [ 2drop 3 ] if ] build-tree count-introductions ] unit-test
 
-: foo ( quot: ( -- ) -- ) call ; inline recursive
+: foo ( ..a quot: ( ..a -- ..b ) -- ..b ) call ; inline recursive
 
 : recursive-inputs ( nodes -- n )
     [ #recursive? ] find nip child>> first in-d>> length ;
index 28f34cb425c5ccc9118832b01a7a984900876b0b..ef9e4e8f0b0740e26fd432325f435dd6eb126cd5 100644 (file)
@@ -1,8 +1,8 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: fry kernel sequences assocs accessors namespaces
+USING: fry kernel sequences assocs accessors
 math.intervals arrays classes.algebra combinators columns
-stack-checker.branches locals math
+stack-checker.branches locals math namespaces
 compiler.utilities
 compiler.tree
 compiler.tree.combinators
@@ -10,6 +10,8 @@ compiler.tree.propagation.info
 compiler.tree.propagation.nodes
 compiler.tree.propagation.simple
 compiler.tree.propagation.constraints ;
+FROM: sets => union ;
+FROM: assocs => change-at ;
 IN: compiler.tree.propagation.branches
 
 ! For conditionals, an assoc of child node # --> constraint
@@ -90,7 +92,7 @@ M: #phi propagate-before ( #phi -- )
     bi ;
 
 :: update-constraints ( new old -- )
-    new [| key value | key old [ value append ] change-at ] assoc-each ;
+    new [| key value | key old [ value union ] change-at ] assoc-each ;
 
 : include-child-constraints ( i -- )
     infer-children-data get nth constraints swap at last
index eba11de26c5404cc8b682c7dece16ac4168d216e..d55769c17bc326f5c6c52189cd0ae6513637ad1d 100644 (file)
@@ -33,7 +33,7 @@ TUPLE: inline-cache value counter ;
 
 : update-inline-cache ( word/quot ic -- )
     [ effect-counter ] dip
-    [ (>>value) ] [ (>>counter) ] bi-curry bi* ; inline
+    [ value<< ] [ counter<< ] bi-curry bi* ; inline
 
 SINGLETON: +unknown+
 
@@ -48,7 +48,7 @@ M: +unknown+ curry-effect ;
 M: effect curry-effect
     [ in>> length ] [ out>> length ] [ terminated?>> ] tri
     pick 0 = [ [ 1 + ] dip ] [ [ 1 - ] 2dip ] if
-    [ [ "x" <array> ] bi@ ] dip effect boa ;
+    [ [ "x" <array> ] bi@ ] dip <terminated-effect> ;
 
 M: curry cached-effect
     quot>> cached-effect curry-effect ;
@@ -74,7 +74,7 @@ M: compose cached-effect
 
 : save-effect ( effect quot -- )
     [ effect-counter ] dip
-    [ (>>cached-effect) ] [ (>>cache-counter) ] bi-curry bi* ;
+    [ cached-effect<< ] [ cache-counter<< ] bi-curry bi* ;
 
 M: quotation cached-effect
     dup cached-effect-valid?
index 617352d6998fcc8fbd7e627725e7451ec166f052..f9988ba22061f465b866e3388156e4b32375489b 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays assocs math math.intervals kernel accessors
 sequences namespaces classes classes.algebra
@@ -87,8 +87,11 @@ TUPLE: implication p q ;
 
 C: --> implication
 
+: maybe-add ( elt seq -- seq' )
+    2dup member? [ nip ] [ swap suffix ] if ;
+
 : assume-implication ( q p -- )
-    [ constraints get [ assoc-stack swap suffix ] 2keep last set-at ]
+    [ constraints get [ assoc-stack maybe-add ] 2keep last set-at ]
     [ satisfied? [ assume ] [ drop ] if ] 2bi ;
 
 M: implication assume*
index 7f5b9f6fcdf68a73907a7be57de27d6f4f662880..22ea1306d67bf2393ff7db5fb372c2bb011eae23 100644 (file)
@@ -31,7 +31,6 @@ class
 interval
 literal
 literal?
-length
 slots ;
 
 CONSTANT: null-info T{ value-info f null empty-interval }
@@ -48,9 +47,7 @@ CONSTANT: object-info T{ value-info f object full-interval }
             { [ over interval-length 0 > ] [ 3drop f f ] }
             { [ pick bignum class<= ] [ 2nip >bignum t ] }
             { [ pick integer class<= ] [ 2nip >fixnum t ] }
-            { [ pick float class<= ] [
-                2nip dup zero? [ drop f f ] [ >float t ] if
-            ] }
+            { [ pick float class<= ] [ 2nip dup zero? [ drop f f ] [ >float t ] if ] }
             [ 3drop f f ]
         } cond
     ] if ;
@@ -74,13 +71,19 @@ UNION: fixed-length array byte-array string ;
         ] unless
     ] unless ;
 
+: (slots-with-length) ( length class -- slots )
+    "slots" word-prop length 1 - f <array> swap prefix ;
+
+: slots-with-length ( seq -- slots )
+    [ length <literal-info> ] [ class ] bi (slots-with-length) ;
+
 : init-literal-info ( info -- info )
     empty-interval >>interval
     dup literal>> literal-class >>class
     dup literal>> {
         { [ dup real? ] [ [a,a] >>interval ] }
         { [ dup tuple? ] [ tuple-slot-infos >>slots ] }
-        { [ dup fixed-length? ] [ length <literal-info> >>length ] }
+        { [ dup fixed-length? ] [ slots-with-length >>slots ] }
         [ drop ]
     } cond ; inline
 
@@ -158,11 +161,11 @@ UNION: fixed-length array byte-array string ;
         t >>literal?
     init-value-info ; foldable
 
-: <sequence-info> ( value -- info )
+: <sequence-info> ( length class -- info )
     <value-info>
-        object >>class
-        swap value-info >>length
-    init-value-info ; foldable
+        over >>class
+        [ (slots-with-length) ] dip swap >>slots
+    init-value-info ;
 
 : <tuple-info> ( slots class -- info )
     <value-info>
@@ -185,13 +188,6 @@ DEFER: value-info-intersect
 
 DEFER: (value-info-intersect)
 
-: intersect-lengths ( info1 info2 -- length )
-    [ length>> ] bi@ {
-        { [ dup not ] [ drop ] }
-        { [ over not ] [ nip ] }
-        [ value-info-intersect ]
-    } cond ;
-
 : intersect-slot ( info1 info2 -- info )
     {
         { [ dup not ] [ nip ] }
@@ -215,7 +211,6 @@ DEFER: (value-info-intersect)
         [ [ class>> ] bi@ class-and >>class ]
         [ [ interval>> ] bi@ interval-intersect >>interval ]
         [ intersect-literals [ >>literal ] [ >>literal? ] bi* ]
-        [ intersect-lengths >>length ]
         [ intersect-slots >>slots ]
     } 2cleave
     init-value-info ;
@@ -236,13 +231,6 @@ DEFER: value-info-union
 
 DEFER: (value-info-union)
 
-: union-lengths ( info1 info2 -- length )
-    [ length>> ] bi@ {
-        { [ dup not ] [ nip ] }
-        { [ over not ] [ drop ] }
-        [ value-info-union ]
-    } cond ;
-
 : union-slot ( info1 info2 -- info )
     {
         { [ dup not ] [ nip ] }
@@ -261,7 +249,6 @@ DEFER: (value-info-union)
         [ [ class>> ] bi@ class-or >>class ]
         [ [ interval>> ] bi@ interval-union >>interval ]
         [ union-literals [ >>literal ] [ >>literal? ] bi* ]
-        [ union-lengths >>length ]
         [ union-slots >>slots ]
     } 2cleave
     init-value-info ;
@@ -293,7 +280,6 @@ DEFER: (value-info-union)
                 { [ 2dup [ class>> ] bi@ class<= not ] [ f ] }
                 { [ 2dup [ interval>> ] bi@ interval-subset? not ] [ f ] }
                 { [ 2dup literals<= not ] [ f ] }
-                { [ 2dup [ length>> ] bi@ value-info<= not ] [ f ] }
                 { [ 2dup [ slots>> ] bi@ [ value-info<= ] 2all? not ] [ f ] }
                 [ t ]
             } cond 2nip
index 4a227cfa7717b003377e7e2f4f58c25c4533535d..5375ff68819b246ebc1ec373aaee31cfd019f940 100644 (file)
@@ -90,7 +90,7 @@ SYMBOL: history
     word already-inlined? [ f ] [
         #call word splicing-body [
             word add-to-history
-            #call (>>body)
+            #call body<<
             #call propagate-body
         ] [ f ] if*
     ] if ;
index 55629507ab6f48ea3414d641fc55bb245dffc11e..6d2dec1c0d3d89d0c1e0a5dec03c136d44a46f26 100644 (file)
@@ -7,7 +7,7 @@ layouts words sequences sequences.private arrays assocs classes
 classes.algebra combinators generic.math splitting fry locals
 classes.tuple alien.accessors classes.tuple.private
 slots.private definitions strings.private vectors hashtables
-generic quotations alien
+generic quotations alien alien.data alien.data.private
 stack-checker.dependencies
 compiler.tree.comparisons
 compiler.tree.propagation.info
@@ -220,14 +220,6 @@ generic-comparison-ops [
     2bi and maybe-or-never
 ] "outputs" set-word-prop
 
-\ both-fixnums? [
-    [ class>> ] bi@ {
-        { [ 2dup [ fixnum classes-intersect? not ] either? ] [ f <literal-info> ] }
-        { [ 2dup [ fixnum class<= ] both? ] [ t <literal-info> ] }
-        [ object-info ]
-    } cond 2nip
-] "outputs" set-word-prop
-
 {
     { >fixnum fixnum }
     { bignum>fixnum fixnum }
@@ -254,8 +246,8 @@ generic-comparison-ops [
     ] "outputs" set-word-prop
 ] each
 
-\ string-nth [
-    2drop fixnum 0 23 2^ [a,b] <class/interval-info>
+\ string-nth-fast [
+    2drop fixnum 0 255 [a,b] <class/interval-info>
 ] "outputs" set-word-prop
 
 {
@@ -280,6 +272,11 @@ generic-comparison-ops [
     2drop alien \ f class-or <class-info>
 ] "outputs" set-word-prop
 
+\ <displaced-alien> [
+    [ interval>> 0 swap interval-contains? ] dip
+    class>> alien class-or alien ? <class-info>
+] "outputs" set-word-prop
+
 { <tuple> <tuple-boa> } [
     [
         literal>> dup array? [ first ] [ drop tuple ] if <class-info>
@@ -341,3 +338,5 @@ flog fpow fsqrt facosh fasinh fatanh } [
 
 \ fixnum-max { fixnum fixnum } "input-classes" set-word-prop
 \ fixnum-max [ interval-max ] [ fixnum-valued ] binary-op
+
+\ (local-allot) { alien } "default-output-classes" set-word-prop
index 444a4247660fe2dc20ead127694e161e12226fda..e738a70fc3377f604aed521ca1ac6486cf542270 100644 (file)
@@ -8,7 +8,8 @@ layouts compiler.tree.propagation.info compiler.tree.def-use
 compiler.tree.debugger compiler.tree.checker slots.private words
 hashtables classes assocs locals specialized-arrays system
 sorting math.libm math.floats.private math.integers.private
-math.intervals quotations effects alien alien.data sets ;
+math.intervals quotations effects alien alien.data sets
+strings.private ;
 FROM: math => float ;
 SPECIALIZED-ARRAY: double
 SPECIALIZED-ARRAY: void*
@@ -467,6 +468,12 @@ TUPLE: fold-boa-test-tuple { x read-only } { y read-only } { z read-only } ;
 [ [ 1 2 3 fold-boa-test-tuple boa ] final-literals ]
 unit-test
 
+TUPLE: don't-fold-boa-test-tuple < identity-tuple ;
+
+[ V{ f } ]
+[ [ don't-fold-boa-test-tuple boa ] final-literals ]
+unit-test
+
 TUPLE: immutable-prop-test-tuple { x sequence read-only } ;
 
 [ V{ T{ immutable-prop-test-tuple f "hey" } } ] [
@@ -962,3 +969,29 @@ M: tuple-with-read-only-slot clone
 
 [ t ] [ [ { 1 } diff ] { diff } inlined? ] unit-test
 [ f ] [ [ { 1 } swap diff ] { diff } inlined? ] unit-test ! We could do this
+
+! Output range for string-nth now that string-nth is a library word and
+! not a primitive
+[ t ] [
+    ! Should actually be 0 23 2^ 1 - [a,b]
+    [ string-nth ] final-info first interval>> 0 23 2^ [a,b] =
+] unit-test
+
+! Non-zero displacement for <displaced-alien> restricts the output type
+[ t ] [
+    [ { byte-array } declare <displaced-alien> ] final-classes
+    first byte-array alien class-or class=
+] unit-test
+
+[ V{ alien } ] [
+    [ { alien } declare <displaced-alien> ] final-classes
+] unit-test
+
+[ t ] [
+    [ { POSTPONE: f } declare <displaced-alien> ] final-classes
+    first \ f alien class-or class=
+] unit-test
+
+[ V{ alien } ] [
+    [ { byte-array } declare [ 10 bitand 2 + ] dip <displaced-alien> ] final-classes
+] unit-test
index 42325d97ca8ee132d59f2c86a2630a9aa19210a5..af2bdbda601215c3d67243212ce1807e84c72939 100644 (file)
@@ -8,7 +8,7 @@ IN: compiler.tree.propagation.recursive.tests
     integer generalize-counter-interval
 ] unit-test
 
-[ T{ interval f { 0 t } { $[ most-positive-fixnum ] t } } ] [
+[ T{ interval f { 0 t } { $[ max-array-capacity ] t } } ] [
     T{ interval f { 1 t } { 1 t } }
     T{ interval f { 0 t } { 0 t } }
     fixnum generalize-counter-interval
index eb4158e7563ec7487460a3aff2958a8afd8dff2c..854e73066244d653e00bb2cd1166d4b3cb1c7cf4 100644 (file)
@@ -1,7 +1,7 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences accessors arrays fry math math.intervals
-layouts combinators namespaces locals
+USING: kernel classes.algebra sequences accessors arrays fry
+math math.intervals layouts combinators namespaces locals
 stack-checker.inlining
 compiler.tree
 compiler.tree.combinators
@@ -11,6 +11,7 @@ compiler.tree.propagation.nodes
 compiler.tree.propagation.simple
 compiler.tree.propagation.branches
 compiler.tree.propagation.constraints ;
+FROM: sequences.private => array-capacity ;
 IN: compiler.tree.propagation.recursive
 
 : check-fixed-point ( node infos1 infos2 -- )
@@ -24,7 +25,14 @@ IN: compiler.tree.propagation.recursive
     [ label>> calls>> [ node>> node-input-infos ] map flip ]
     [ latest-input-infos ] bi ;
 
+: counter-class ( interval class -- class' )
+    dup fixnum class<= [
+        swap array-capacity-interval interval-subset?
+        [ drop array-capacity ] when
+    ] [ nip ] if ;
+
 :: generalize-counter-interval ( interval initial-interval class -- interval' )
+    interval class counter-class :> class
     {
         { [ interval initial-interval interval-subset? ] [ initial-interval ] }
         { [ interval empty-interval eq? ] [ initial-interval ] }
@@ -45,8 +53,7 @@ IN: compiler.tree.propagation.recursive
             [ clone ] dip
             [ [ drop ] [ [ [ interval>> ] bi@ ] [ drop class>> ] 2bi generalize-counter-interval ] 2bi >>interval ]
             [ [ drop ] [ [ slots>> ] bi@ [ generalize-counter ] 2map ] 2bi >>slots ]
-            [ [ drop ] [ [ length>> ] bi@ generalize-counter ] 2bi >>length ]
-            tri
+            bi
         ] if
     ] if ;
 
index 250a9379e87b299e17a44676feccaa68c30bb304..909ab931da033b22407d64f52f0e87a3960655c3 100644 (file)
@@ -39,6 +39,7 @@ CONSTANT: vector>vector-intrinsics
         (simd-hlshift)
         (simd-hrshift)
         (simd-vshuffle-elements)
+        (simd-vshuffle2-elements)
         (simd-vshuffle-bytes)
         (simd-vmerge-head)
         (simd-vmerge-tail)
index ed417ef9d76102668d1c60b1294698dfbfd98693..ce169233c1a68c93137691b020a55b16e1ff14b5 100644 (file)
@@ -72,7 +72,7 @@ M: #declare propagate-before
 
 : foldable-call? ( #call word -- ? )
     {
-        [ nip "foldable" word-prop ]
+        [ nip foldable? ]
         [ drop literal-inputs? ]
         [ input-classes-match? ]
     } 2&& ;
index 18d31985d6579fd9a279ab74bbfd76963ca39850..14546f0237dca9926e8f175536847086cd47ca6c 100644 (file)
@@ -9,8 +9,6 @@ IN: compiler.tree.propagation.slots
 
 ! Propagation of immutable slots and array lengths
 
-UNION: fixed-length-sequence array byte-array string ;
-
 : sequence-constructor? ( word -- ? )
     { <array> <byte-array> (byte-array) <string> } member-eq? ;
 
@@ -23,9 +21,9 @@ UNION: fixed-length-sequence array byte-array string ;
     } at ;
 
 : propagate-sequence-constructor ( #call word -- infos )
-    [ in-d>> first <sequence-info> ]
-    [ constructor-output-class <class-info> ]
-    bi* value-info-intersect 1array ;
+    [ in-d>> first value-info ]
+    [ constructor-output-class ] bi*
+    <sequence-info> 1array ;
 
 : fold-<tuple-boa> ( values class -- info )
     [ [ literal>> ] map ] dip prefix >tuple
@@ -36,17 +34,18 @@ UNION: fixed-length-sequence array byte-array string ;
     [ read-only>> [ value-info ] [ drop f ] if ] 2map
     f prefix ;
 
-: (propagate-tuple-constructor) ( values class -- info )
-    [ read-only-slots ] keep
-    over rest-slice [ dup [ literal?>> ] when ] all? [
-        [ rest-slice ] dip fold-<tuple-boa>
-    ] [
-        <tuple-info>
-    ] if ;
+: fold-<tuple-boa>? ( values class -- ? )
+    [ rest-slice [ dup [ literal?>> ] when ] all? ]
+    [ identity-tuple class<= not ]
+    bi* and ;
+
+: (propagate-<tuple-boa>) ( values class -- info )
+    [ read-only-slots ] keep 2dup fold-<tuple-boa>?
+    [ [ rest-slice ] dip fold-<tuple-boa> ] [ <tuple-info> ] if ;
 
 : propagate-<tuple-boa> ( #call -- infos )
     in-d>> unclip-last
-    value-info literal>> first (propagate-tuple-constructor) 1array ;
+    value-info literal>> first (propagate-<tuple-boa>) 1array ;
 
 : read-only-slot? ( n class -- ? )
     all-slots [ offset>> = ] with find nip
@@ -72,7 +71,6 @@ UNION: fixed-length-sequence array byte-array string ;
 : value-info-slot ( slot info -- info' )
     {
         { [ over 0 = ] [ 2drop fixnum <class-info> ] }
-        { [ 2dup length-accessor? ] [ nip length>> ] }
         { [ dup literal?>> ] [ literal>> literal-info-slot ] }
         [ [ 1 - ] [ slots>> ] bi* ?nth ]
     } cond [ object-info ] unless* ;
index 0077d0f1231b90af01b9da143d701d4b4e0a6841..28de7abd4bfc93fc0d84f91f266b02732a707444 100644 (file)
@@ -1,14 +1,17 @@
 ! Copyright (C) 2008, 2010 Slava Pestov, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types kernel sequences words fry generic accessors
-classes.tuple classes classes.algebra definitions
-stack-checker.dependencies quotations classes.tuple.private math
-math.partial-dispatch math.private math.intervals sets.private
-math.floats.private math.integers.private layouts math.order
-vectors hashtables combinators effects generalizations assocs
-sets combinators.short-circuit sequences.private locals growable
-stack-checker namespaces compiler.tree.propagation.info ;
+USING: alien.c-types kernel sequences words fry generic
+generic.single accessors classes.tuple classes classes.algebra
+definitions stack-checker.dependencies quotations
+classes.tuple.private math math.partial-dispatch math.private
+math.intervals sets.private math.floats.private
+math.integers.private layouts math.order vectors hashtables
+combinators effects generalizations sequences.generalizations
+assocs sets combinators.short-circuit sequences.private locals
+growable stack-checker namespaces compiler.tree.propagation.info
+;
 FROM: math => float ;
+FROM: sets => set ;
 IN: compiler.tree.propagation.transforms
 
 \ equal? [
@@ -134,6 +137,7 @@ IN: compiler.tree.propagation.transforms
     in-d>> first value-info literal>> {
         { V{ } [ [ drop { } 0 vector boa ] ] }
         { H{ } [ [ drop 0 <hashtable> ] ] }
+        { HS{ } [ [ drop f fast-set ] ] }
         [ drop f ]
     } case
 ] "custom-inlining" set-word-prop
@@ -207,7 +211,7 @@ ERROR: bad-partial-eval quot word ;
         [ drop f ] swap
         [ literalize [ t ] ] { } map>assoc linear-case-quot
     ] [
-        unique [ key? ] curry
+        tester
     ] if ;
 
 \ member? [
@@ -272,14 +276,14 @@ CONSTANT: lookup-table-at-max 256
 \ at* [ at-quot ] 1 define-partial-eval
 
 : diff-quot ( seq -- quot: ( seq' -- seq'' ) )
-    tester '[ [ @ not ] filter ] ;
+    tester '[ [ [ @ not ] filter ] keep set-like ] ;
 
-\ diff [ diff-quot ] 1 define-partial-eval
+M\ set diff [ diff-quot ] 1 define-partial-eval
 
 : intersect-quot ( seq -- quot: ( seq' -- seq'' ) )
-    tester '[ _ filter ] ;
+    tester '[ [ _ filter ] keep set-like ] ;
 
-\ intersect [ intersect-quot ] 1 define-partial-eval
+M\ set intersect [ intersect-quot ] 1 define-partial-eval
 
 : fixnum-bits ( -- n )
     cell-bits tag-bits get - ;
@@ -297,10 +301,25 @@ CONSTANT: lookup-table-at-max 256
     [ \ push def>> ] [ f ] if
 ] "custom-inlining" set-word-prop
 
+! Speeds up fasta benchmark
+\ >fixnum [
+    in-d>> first value-info class>> fixnum \ f class-or class<=
+    [ [ dup [ \ >fixnum no-method ] unless ] ] [ f ] if
+] "custom-inlining" set-word-prop
+
 ! We want to constant-fold calls to heap-size, and recompile those
 ! calls when a C type is redefined
 \ heap-size [
-    dup word? [
-        [ depends-on-definition ] [ heap-size '[ _ ] ] bi
-    ] [ drop f ] if
+    [ depends-on-c-type ] [ heap-size '[ _ ] ] bi
 ] 1 define-partial-eval
+
+! Eliminates a few redundant checks here and there
+\ both-fixnums? [
+    in-d>> first2 [ value-info class>> ] bi@ {
+        { [ 2dup [ fixnum classes-intersect? not ] either? ] [ [ 2drop f ] ] }
+        { [ 2dup [ fixnum class<= ] both? ] [ [ 2drop t ] ] }
+        { [ dup fixnum class<= ] [ [ drop fixnum? ] ] }
+        { [ over fixnum class<= ] [ [ nip fixnum? ] ] }
+        [ f ]
+    } cond 2nip
+] "custom-inlining" set-word-prop
index bc6243e1381d795b2a937324d12231bd824c55dd..70c4fb44d9a621183a568d5aa6d2be34078f3f79 100644 (file)
@@ -2,6 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel assocs arrays namespaces accessors sequences deques fry
 search-deques dlists combinators.short-circuit make sets compiler.tree ;
+FROM: namespaces => set ;
 IN: compiler.tree.recursive
 
 TUPLE: call-site tail? node label ;
@@ -43,7 +44,7 @@ GENERIC: node-call-graph ( tail? node -- )
     ] with-scope ;
 
 M: #return-recursive node-call-graph
-    nip dup label>> (>>return) ;
+    nip dup label>> return<< ;
 
 M: #call-recursive node-call-graph
     [ dup label>> call-site boa ] keep
@@ -102,7 +103,7 @@ SYMBOL: changed?
         recursive-nesting get pop*
     ] each ;
 
-: while-changing ( quot: ( -- ) -- )
+: while-changing ( ... quot: ( ... -- ... ) -- ... )
     changed? off
     [ call ] [ changed? get [ while-changing ] [ drop ] if ] bi ;
     inline recursive
index d73368867d0a25706ab5e3813dd99b85db7a176c..e6d42f0289ed93fd0b33a21b3280a11bc4e1a8ee 100644 (file)
@@ -38,10 +38,10 @@ TUPLE: empty-tuple ;
 } [ [ ] swap [ test-unboxing ] curry unit-test ] each
 
 ! A more complicated example
-: impeach-node ( quot: ( node -- ) -- )
+: impeach-node ( quot: ( ..a -- ..b ) -- )
     [ call ] keep impeach-node ; inline recursive
 
-: bleach-node ( quot: ( node -- ) -- )
+: bleach-node ( quot: ( ..a -- ..b ) -- )
     [ bleach-node ] curry [ ] compose impeach-node ; inline recursive
 
 [ ] [ [ [ ] bleach-node ] test-unboxing ] unit-test
index 9922048009a0ce77f617e6f8c34c9016b36b151f..7b5582a0b6fd770d853f7b293f9aa80956e004b5 100644 (file)
@@ -30,12 +30,12 @@ TUPLE: huffman-code
     [ free-bits 2^ iota [ huffman-code code>> free-bits 2^ * + ] map ]\r
     [ huffman-code code>> free-bits neg 2^ /i 1array ] if ;\r
 \r
-:: huffman-each ( tdesc quot: ( huffman-code -- ) -- )\r
+:: huffman-each ( ... tdesc quot: ( ... huffman-code -- ... ) -- ... )\r
     <huffman-code> :> code\r
     tdesc\r
     [\r
         code next-size\r
-        [ code (>>value) code clone quot call code next-code ] each\r
+        [ code value<< code clone quot call code next-code ] each\r
     ] each ; inline\r
 \r
 : update-reverse-table ( huffman-code n table -- )\r
old mode 100644 (file)
new mode 100755 (executable)
index 340e455..f61a02c
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors combinators io kernel math namespaces
-prettyprint sequences vectors ;
+sequences vectors ;
 QUALIFIED-WITH: bitstreams bs
 IN: compression.lzw
 
index 553b55cf6e94ed664da1b6afe73787d220d714e3..aede6d562113ce5221ef85b62a5c8deb109ccfa3 100644 (file)
@@ -8,7 +8,7 @@ IN: compression.zlib.ffi
     { [ os winnt? ] [ "zlib1.dll" ] }
     { [ os macosx? ] [ "libz.dylib" ] }
     { [ os unix? ] [ "libz.so" ] }
-} cond "cdecl" add-library >>
+} cond cdecl add-library >>
 
 LIBRARY: zlib
 
index ad00bbdfa9ff262ca7f36af3248efc478c81f4c5..9353317f0bc758d9ed10c1e4c6162781282b9472 100644 (file)
@@ -1,13 +1,13 @@
-! Copyright (C) 2008 Slava Pestov.\r
+! Copyright (C) 2008, 2010 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: deques threads kernel arrays sequences alarms fry ;\r
 IN: concurrency.conditions\r
 \r
 : notify-1 ( deque -- )\r
-    dup deque-empty? [ drop ] [ pop-back resume-now ] if ;\r
+    dup deque-empty? [ drop ] [ pop-back resume-now ] if ; inline\r
 \r
 : notify-all ( deque -- )\r
-    [ resume-now ] slurp-deque ;\r
+    [ resume-now ] slurp-deque ; inline\r
 \r
 : queue-timeout ( queue timeout -- alarm )\r
     #! Add an alarm which removes the current thread from the\r
@@ -22,10 +22,13 @@ IN: concurrency.conditions
 \r
 ERROR: wait-timeout ;\r
 \r
+: queue ( queue -- )\r
+    [ self ] dip push-front ; inline\r
+\r
 : wait ( queue timeout status -- )\r
     over [\r
-        [ queue-timeout [ drop ] ] dip suspend\r
-        [ wait-timeout ] [ cancel-alarm ] if\r
+        [ queue-timeout ] dip suspend\r
+        [ wait-timeout ] [ stop-alarm ] if\r
     ] [\r
-        [ drop '[ _ push-front ] ] dip suspend drop\r
-    ] if ;\r
+        [ drop queue ] dip suspend drop\r
+    ] if ; inline\r
index 0015b10cef444c70b0903a24545f177a7acc6981..229cea85480fa5a223eab0fe49b7e826604905bc 100644 (file)
@@ -20,7 +20,7 @@ PRIVATE>
     registered-remote-threads delete-at ;
 
 : get-remote-thread ( name -- thread )
-    dup registered-remote-threads at [ ] [ thread ] ?if ;
+    dup registered-remote-threads at [ ] [ threads at ] ?if ;
 
 SYMBOL: local-node
 
index 97b3c14fe41cd29c4ac1185119b10463fcece045..7cfe01608529082aa7055e4b9c81ae7749697dfe 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Slava Pestov.\r
+! Copyright (C) 2008, 2010 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: kernel threads boxes accessors fry ;\r
 IN: concurrency.exchangers\r
@@ -17,5 +17,6 @@ TUPLE: exchanger thread object ;
         [ thread>> box> resume-with ] dip\r
     ] [\r
         [ object>> >box ] keep\r
-        '[ _ thread>> >box ] "exchange" suspend\r
+        [ self ] dip thread>> >box\r
+        "exchange" suspend\r
     ] if ;\r
index 727efd45d0e6df8dce387419b09c0b8d3a0d5eaa..461650738ec96099a1038d35645c2156abd57a1e 100644 (file)
@@ -21,7 +21,7 @@ HELP: block-unless-pred
 { $values\r
     { "mailbox" mailbox }\r
     { "timeout" "a " { $link duration } " or " { $link f } }\r
-    { "pred" { $quotation "( obj -- ? )" } } \r
+    { "pred" { $quotation "( ... message -- ... ? )" } } \r
 }\r
 { $description "Block the thread if there are no items in the mailbox that return true when the predicate is called with the item on the stack." } ;\r
 \r
index 221a5a1fa3457c741d34916826563153e9b47285..163873575c9f4b11f7069bf99a290aef6b46aee9 100644 (file)
@@ -6,24 +6,26 @@ concurrency.conditions accessors debugger debugger.threads
 locals fry ;
 IN: concurrency.mailboxes
 
-TUPLE: mailbox threads data ;
+TUPLE: mailbox { threads dlist } { data dlist } ;
 
 : <mailbox> ( -- mailbox )
     mailbox new
         <dlist> >>threads
-        <dlist> >>data ;
+        <dlist> >>data ; inline
 
 : mailbox-empty? ( mailbox -- bool )
-    data>> deque-empty? ;
+    data>> deque-empty? ; inline
 
-: mailbox-put ( obj mailbox -- )
+GENERIC: mailbox-put ( obj mailbox -- )
+
+M: mailbox mailbox-put
     [ data>> push-front ]
     [ threads>> notify-all ] bi yield ;
 
 : wait-for-mailbox ( mailbox timeout -- )
-    [ threads>> ] dip "mailbox" wait ;
+    [ threads>> ] dip "mailbox" wait ; inline
 
-:: block-unless-pred ( mailbox timeout pred: ( message -- ? ) -- )
+:: block-unless-pred ( ... mailbox timeout pred: ( ... message -- ... ? ) -- ... )
     mailbox data>> pred dlist-any? [
         mailbox timeout wait-for-mailbox
         mailbox timeout pred block-unless-pred
@@ -34,16 +36,17 @@ TUPLE: mailbox threads data ;
         2dup wait-for-mailbox block-if-empty
     ] [
         drop
-    ] if ;
+    ] if ; inline recursive
 
 : mailbox-peek ( mailbox -- obj )
     data>> peek-back ;
 
-: mailbox-get-timeout ( mailbox timeout -- obj )
-    block-if-empty data>> pop-back ;
+GENERIC# mailbox-get-timeout 1 ( mailbox timeout -- obj )
+
+M: mailbox mailbox-get-timeout block-if-empty data>> pop-back ;
 
 : mailbox-get ( mailbox -- obj )
-    f mailbox-get-timeout ;
+    f mailbox-get-timeout ; inline
 
 : mailbox-get-all-timeout ( mailbox timeout -- array )
     block-if-empty
index 37965309e8b4f1a41fbf966bea242eb81ae4a2db..3f55b0969b2705d97ed8edbb1caead9c942423f4 100644 (file)
@@ -1,20 +1,22 @@
-! Copyright (C) 2005, 2008 Chris Double, Slava Pestov.\r
+! Copyright (C) 2005, 2010 Chris Double, Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
-USING: kernel threads concurrency.mailboxes continuations\r
-namespaces assocs accessors summary fry ;\r
+USING: kernel kernel.private threads concurrency.mailboxes\r
+continuations namespaces assocs accessors summary fry ;\r
 IN: concurrency.messaging\r
 \r
 GENERIC: send ( message thread -- )\r
 \r
-: mailbox-of ( thread -- mailbox )\r
-    dup mailbox>> [ ] [\r
-        <mailbox> [ >>mailbox drop ] keep\r
-    ] ?if ;\r
+GENERIC: mailbox-of ( thread -- mailbox )\r
+\r
+M: thread mailbox-of\r
+    dup mailbox>>\r
+    [ { mailbox } declare ]\r
+    [ <mailbox> [ >>mailbox drop ] keep ] ?if ; inline\r
 \r
 M: thread send ( message thread -- )\r
-    check-registered mailbox-of mailbox-put ;\r
+    mailbox-of mailbox-put ;\r
 \r
-: my-mailbox ( -- mailbox ) self mailbox-of ;\r
+: my-mailbox ( -- mailbox ) self mailbox-of ; inline\r
 \r
 : receive ( -- message )\r
     my-mailbox mailbox-get ?linked ;\r
index 2ef388563e06990f2ae00bb89978260d00c18b59..0185387597bb11fb2954b2e66ac0cebd899bc5a5 100644 (file)
@@ -8,23 +8,20 @@ TYPEDEF: void* CFTypeRef
 TYPEDEF: void* CFAllocatorRef
 CONSTANT: kCFAllocatorDefault f
 
-TYPEDEF: bool      Boolean
-TYPEDEF: long      CFIndex
-TYPEDEF: uchar     UInt8
-TYPEDEF: ushort    UInt16
-TYPEDEF: uint      UInt32
+TYPEDEF: bool Boolean
+TYPEDEF: long CFIndex
+TYPEDEF: uchar UInt8
+TYPEDEF: ushort UInt16
+TYPEDEF: uint UInt32
 TYPEDEF: ulonglong UInt64
-TYPEDEF: char      SInt8
-TYPEDEF: short     SInt16
-TYPEDEF: int       SInt32
-TYPEDEF: longlong  SInt64
+TYPEDEF: char SInt8
+TYPEDEF: short SInt16
+TYPEDEF: int SInt32
+TYPEDEF: longlong SInt64
 TYPEDEF: ulong CFTypeID
 TYPEDEF: UInt32 CFOptionFlags
 TYPEDEF: void* CFUUIDRef
 
-ALIAS: <CFIndex> <long>
-ALIAS: *CFIndex *long
-
 STRUCT: CFRange
     { location CFIndex }
     { length CFIndex } ;
index c4c09d0cc5042d9bb256f6abf382ad4d75eecb0a..bb04431a0e03270a4aa7af2a28196111b862e908 100644 (file)
@@ -12,7 +12,7 @@ CONSTANT: kCFPropertyListImmutable 0
 CONSTANT: kCFPropertyListMutableContainers 1
 CONSTANT: kCFPropertyListMutableContainersAndLeaves 2
 
-FUNCTION: CFDataRef CFDataCreate ( CFAllocatorRef allocator, uchar* bytes, CFIndex length ) ;
+FUNCTION: CFDataRef CFDataCreate ( CFAllocatorRef allocator, UInt8* bytes, CFIndex length ) ;
 
 FUNCTION: CFTypeID CFGetTypeID ( CFTypeRef cf ) ;
 
index ec5581d4633237cd40d36912344401ae4e90b303..4ec362f0fcec48e7443f9334d5b4e8eb7cef36d7 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax kernel math.bitwise core-foundation ;
+USING: alien.c-types alien.syntax kernel math.bitwise core-foundation
+literals ;
 IN: core-foundation.file-descriptors
 
 TYPEDEF: void* CFFileDescriptorRef
@@ -25,7 +26,7 @@ FUNCTION: void CFFileDescriptorEnableCallBacks (
 ) ;
 
 : enable-all-callbacks ( fd -- )
-    { kCFFileDescriptorReadCallBack kCFFileDescriptorWriteCallBack } flags
+    flags{ kCFFileDescriptorReadCallBack kCFFileDescriptorWriteCallBack }
     CFFileDescriptorEnableCallBacks ;
 
 : <CFFileDescriptor> ( fd callback -- handle )
index ef1a3ff7f195c4fe09d3b7c7f0b3f11479fbe3fb..fd17843bf3dceb3c2eff158edb50b4394d1c30bd 100644 (file)
@@ -119,8 +119,7 @@ FUNCTION: CFStringRef FSEventStreamCopyDescription ( FSEventStreamRef streamRef
     flags
     FSEventStreamCreate ;
 
-: kCFRunLoopCommonModes ( -- string )
-    &: kCFRunLoopCommonModes *void* ;
+C-GLOBAL: void* kCFRunLoopCommonModes
 
 : schedule-event-stream ( event-stream -- )
     CFRunLoopGetMain
index 2370dd45628dd47005409f8a897c8c6416033685..793efefbe869b81e663fa2514d737af9a039ed30 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Slava Pestov
+! Copyright (C) 2008, 2010 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.c-types alien.syntax kernel math
 namespaces sequences destructors combinators threads heaps
@@ -91,24 +91,26 @@ TUPLE: run-loop fds sources timers ;
         CFRunLoopAddTimer
     ] bi ;
 
-<PRIVATE
+: invalidate-run-loop-timers ( -- )
+    run-loop [
+        [ [ CFRunLoopTimerInvalidate ] [ CFRelease ] bi ] each
+        V{ } clone
+    ] change-timers drop ;
 
-: ((reset-timer)) ( timer counter timestamp -- )
-    nip >CFAbsoluteTime CFRunLoopTimerSetNextFireDate ;
+<PRIVATE
 
-: nano-count>timestamp ( x -- timestamp )
-    nano-count - nanoseconds now time+ ;
+: (reset-timer) ( timer timestamp -- )
+    >CFAbsoluteTime CFRunLoopTimerSetNextFireDate ;
 
-: (reset-timer) ( timer counter -- )
-    yield {
-        { [ dup 0 = ] [ now ((reset-timer)) ] }
-        { [ run-queue deque-empty? not ] [ 1 - (reset-timer) ] }
-        { [ sleep-queue heap-empty? ] [ 5 minutes hence ((reset-timer)) ] }
-        [ sleep-queue heap-peek nip nano-count>timestamp ((reset-timer)) ]
-    } cond ;
+: nano-count>micros ( x -- n )
+    nano-count - 1,000 /f system-micros + ;
 
 : reset-timer ( timer -- )
-    10 (reset-timer) ;
+    {
+        { [ run-queue deque-empty? not ] [ system-micros ] }
+        { [ sleep-queue heap-empty? not ] [ sleep-queue heap-peek nip nano-count>micros ] }
+        [ system-micros 1,000,000 + ]
+    } cond (reset-timer) ;
 
 PRIVATE>
 
@@ -118,7 +120,7 @@ PRIVATE>
     [ fds>> [ enable-all-callbacks ] each ] bi ;
 
 : timer-callback ( -- callback )
-    void { CFRunLoopTimerRef void* } "cdecl"
+    void { CFRunLoopTimerRef void* } cdecl
     [ 2drop reset-run-loop yield ] alien-callback ;
 
 : init-thread-timer ( -- )
index cbabb083aa23444f272f8e5592128330cea8802f..b78e1046fee3822c33447aeb584e6ae9ed54a6ed 100644 (file)
@@ -1,8 +1,9 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax alien.strings io.encodings.string
-kernel sequences byte-arrays io.encodings.utf8 math core-foundation
-core-foundation.arrays destructors parser fry alien words ;
+USING: alien.c-types alien.data alien.syntax alien.strings
+io.encodings.string kernel sequences byte-arrays
+io.encodings.utf8 math core-foundation core-foundation.arrays
+destructors parser fry alien words ;
 IN: core-foundation.strings
 
 TYPEDEF: void* CFStringRef
@@ -37,7 +38,7 @@ FUNCTION: void CFStringGetCharacters ( void* theString, CFIndex start, CFIndex l
 
 FUNCTION: Boolean CFStringGetCString (
     CFStringRef theString,
-    char* buffer,
+    UInt8* buffer,
     CFIndex bufferSize,
     CFStringEncoding encoding
 ) ;
@@ -55,7 +56,7 @@ FUNCTION: CFIndex CFStringGetBytes (
 
 FUNCTION: CFStringRef CFStringCreateWithCString (
     CFAllocatorRef alloc,
-    char* cStr,
+    UInt8* cStr,
     CFStringEncoding encoding
 ) ;
 
@@ -75,8 +76,12 @@ FUNCTION: CFStringRef CFStringCreateWithCString (
 : CF>string ( alien -- string )
     dup CFStringGetLength
     [ 0 swap <CFRange> kCFStringEncodingUTF8 0 f ] keep
-    4 * 1 + <byte-array> [ dup length 0 <CFIndex> [ CFStringGetBytes drop ] keep ] keep
-    swap *CFIndex head-slice utf8 decode ;
+    4 * 1 + <byte-array> [
+        dup length
+        { CFIndex } [ CFStringGetBytes drop ] [ ]
+        with-out-parameters
+    ] keep
+    swap head-slice utf8 decode ;
 
 : CF>string-array ( alien -- seq )
     CF>array [ CF>string ] map ;
index 8f0965246250f1e894919373a39ef7d4e97a12e8..59dd8098b484070af859441d5a191d513af1a1b8 100644 (file)
@@ -1,6 +1,6 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: calendar alien.c-types alien.syntax ;
+USING: calendar math alien.c-types alien.syntax memoize system ;
 IN: core-foundation.time
 
 TYPEDEF: double CFTimeInterval
@@ -9,6 +9,8 @@ TYPEDEF: double CFAbsoluteTime
 : >CFTimeInterval ( duration -- interval )
     duration>seconds ; inline
 
-: >CFAbsoluteTime ( timestamp -- time )
-    T{ timestamp { year 2001 } { month 1 } { day 1 } } time-
-    duration>seconds ; inline
+MEMO: epoch ( -- micros )
+    T{ timestamp { year 2001 } { month 1 } { day 1 } } timestamp>micros ;
+
+: >CFAbsoluteTime ( micros -- time )
+    epoch - 1,000,000 /f ; inline
index cf17cb41d9e9a9bb9ffdb2dfe714c1448f17ae69..343753385a205f248d39e8bdc403c9da5419571e 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien.c-types alien.syntax system math kernel calendar
 core-foundation core-foundation.time ;
@@ -19,7 +19,7 @@ FUNCTION: CFRunLoopTimerRef CFRunLoopTimerCreate (
 ) ;
 
 : <CFTimer> ( callback -- timer )
-    [ f now >CFAbsoluteTime 60 0 0 ] dip f CFRunLoopTimerCreate ;
+    [ f system-micros >CFAbsoluteTime 60 0 0 ] dip f CFRunLoopTimerCreate ;
 
 FUNCTION: void CFRunLoopTimerInvalidate (
    CFRunLoopTimerRef timer
index f3f759115cc2204ccab25a097ffaf23f35e27f9d..d921789cb053031773962c217343517f8dbd42d6 100644 (file)
@@ -3,28 +3,27 @@
 USING: alien alien.c-types alien.destructors alien.syntax accessors
 destructors fry kernel math math.bitwise sequences libc colors
 images images.memory core-graphics.types core-foundation.utilities
-opengl.gl ;
+opengl.gl literals ;
 IN: core-graphics
 
-! CGImageAlphaInfo
-C-ENUM:
-kCGImageAlphaNone
-kCGImageAlphaPremultipliedLast
-kCGImageAlphaPremultipliedFirst
-kCGImageAlphaLast
-kCGImageAlphaFirst
-kCGImageAlphaNoneSkipLast
-kCGImageAlphaNoneSkipFirst ;
-
-: kCGBitmapAlphaInfoMask ( -- n ) HEX: 1f ; inline
-: kCGBitmapFloatComponents ( -- n ) 1 8 shift ; inline
-
-: kCGBitmapByteOrderMask ( -- n ) HEX: 7000 ; inline
-: kCGBitmapByteOrderDefault ( -- n ) 0 12 shift ; inline
-: kCGBitmapByteOrder16Little ( -- n ) 1 12 shift ; inline
-: kCGBitmapByteOrder32Little ( -- n ) 2 12 shift ; inline
-: kCGBitmapByteOrder16Big ( -- n ) 3 12 shift ; inline
-: kCGBitmapByteOrder32Big ( -- n ) 4 12 shift ; inline
+TYPEDEF: int CGImageAlphaInfo
+CONSTANT: kCGImageAlphaNone 0
+CONSTANT: kCGImageAlphaPremultipliedLast 1
+CONSTANT: kCGImageAlphaPremultipliedFirst 2
+CONSTANT: kCGImageAlphaLast 3
+CONSTANT: kCGImageAlphaFirst 4
+CONSTANT: kCGImageAlphaNoneSkipLast 5
+CONSTANT: kCGImageAlphaNoneSkipFirst 6
+
+CONSTANT: kCGBitmapAlphaInfoMask HEX: 1f
+CONSTANT: kCGBitmapFloatComponents 256
+
+CONSTANT: kCGBitmapByteOrderMask HEX: 7000
+CONSTANT: kCGBitmapByteOrderDefault 0
+CONSTANT: kCGBitmapByteOrder16Little 4096
+CONSTANT: kCGBitmapByteOrder32Little 8192
+CONSTANT: kCGBitmapByteOrder16Big 12288
+CONSTANT: kCGBitmapByteOrder32Big 16384
 
 : kCGBitmapByteOrder16Host ( -- n )
     little-endian?
@@ -121,8 +120,8 @@ FUNCTION: uint GetCurrentButtonState ( ) ;
 
 <PRIVATE
 
-: bitmap-flags ( -- flags )
-    { kCGImageAlphaPremultipliedFirst kCGBitmapByteOrder32Host } flags ;
+: bitmap-flags ( -- n )
+    kCGImageAlphaPremultipliedFirst kCGBitmapByteOrder32Host bitor ;
 
 : bitmap-color-space ( -- color-space )
     CGColorSpaceCreateDeviceRGB &CGColorSpaceRelease ;
index a1e9b1dc9a1655f7d0e98cee3ee8c70e65de566a..ac0ba31270525e829cf8b6dcc9d18d49fe377d8e 100644 (file)
@@ -8,12 +8,6 @@ IN: core-graphics.types
 SYMBOL: CGFloat
 << cell 4 = float double ? \ CGFloat typedef >>
 
-: <CGFloat> ( x -- alien )
-    cell 4 = [ <float> ] [ <double> ] if ; inline
-
-: *CGFloat ( alien -- x )
-    cell 4 = [ *float ] [ *double ] if ; inline
-
 STRUCT: CGPoint
     { x CGFloat }
     { y CGFloat } ;
@@ -30,7 +24,7 @@ STRUCT: CGSize
 
 STRUCT: CGRect
     { origin CGPoint }
-    { size   CGSize  } ;
+    { size CGSize } ;
 
 : CGPoint>loc ( CGPoint -- loc )
     [ x>> ] [ y>> ] bi 2array ;
@@ -40,7 +34,7 @@ STRUCT: CGRect
 
 : CGRect>rect ( CGRect -- rect )
     [ origin>> CGPoint>loc ]
-    [ size>>   CGSize>dim ]
+    [ size>> CGSize>dim ]
     bi <rect> ; inline
 
 : CGRect-x ( CGRect -- x )
@@ -53,13 +47,13 @@ STRUCT: CGRect
     size>> h>> ; inline
 
 : set-CGRect-x ( x CGRect -- )
-    origin>> (>>x) ; inline
+    origin>> x<< ; inline
 : set-CGRect-y ( y CGRect -- )
-    origin>> (>>y) ; inline
+    origin>> y<< ; inline
 : set-CGRect-w ( w CGRect -- )
-    size>> (>>w) ; inline
+    size>> w<< ; inline
 : set-CGRect-h ( h CGRect -- )
-    size>> (>>h) ; inline
+    size>> h<< ; inline
 
 : <CGRect> ( x y w h -- rect )
     [ CGPoint <struct-boa> ] [ CGSize <struct-boa> ] 2bi*
index 7af6792e79845d8d14517139ba4d86f0b66513b7..4de8b2c06a4fd3ef0df9b1dd5473420134e5b93d 100644 (file)
@@ -1,12 +1,12 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays alien alien.c-types alien.syntax kernel destructors
-accessors fry words hashtables strings sequences memoize assocs math
-math.order math.vectors math.rectangles math.functions locals init
-namespaces combinators fonts colors cache core-foundation
-core-foundation.strings core-foundation.attributed-strings
-core-foundation.utilities core-graphics core-graphics.types
-core-text.fonts ;
+USING: arrays alien alien.c-types alien.data alien.syntax kernel
+destructors accessors fry words hashtables strings sequences
+memoize assocs math math.order math.vectors math.rectangles
+math.functions locals init namespaces combinators fonts colors
+cache core-foundation core-foundation.strings
+core-foundation.attributed-strings core-foundation.utilities
+core-graphics core-graphics.types core-text.fonts ;
 IN: core-text
 
 TYPEDEF: void* CTLineRef
@@ -50,8 +50,8 @@ ERROR: not-a-string object ;
 TUPLE: line < disposable line metrics image loc dim ;
 
 : typographic-bounds ( line -- width ascent descent leading )
-    0 <CGFloat> 0 <CGFloat> 0 <CGFloat>
-    [ CTLineGetTypographicBounds ] 3keep [ *CGFloat ] tri@ ; inline
+    { CGFloat CGFloat CGFloat }
+    [ CTLineGetTypographicBounds ] [ ] with-out-parameters ; inline
 
 : store-typographic-bounds ( metrics width ascent descent leading -- metrics )
     {
index 4d99b5a0edcea0591f32f60cd6cba923f2c359b5..e2a7bdab10cb7ae9ec30fdd1b964397d0c5227a9 100644 (file)
@@ -1,8 +1,9 @@
 ! Copyright (C) 2006, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs generic kernel kernel.private
-math memory namespaces make sequences layouts system hashtables
-classes alien byte-arrays combinators words sets fry ;
+math math.order memory namespaces make sequences layouts system
+hashtables classes alien byte-arrays combinators words sets fry
+;
 IN: cpu.architecture
 
 ! Representations -- these are like low-level types
@@ -86,6 +87,20 @@ UNION: vector-rep
 int-vector-rep
 float-vector-rep ;
 
+CONSTANT: vector-reps
+    {
+        char-16-rep
+        uchar-16-rep
+        short-8-rep
+        ushort-8-rep
+        int-4-rep
+        uint-4-rep
+        longlong-2-rep
+        ulonglong-2-rep
+        float-4-rep
+        double-2-rep
+    }
+
 UNION: representation
 any-rep
 tagged-rep
@@ -135,9 +150,6 @@ SINGLETONS: int-regs float-regs ;
 UNION: reg-class int-regs float-regs ;
 CONSTANT: reg-classes { int-regs float-regs }
 
-! A pseudo-register class for parameters spilled on the stack
-SINGLETON: stack-params
-
 ! On x86, vectors and floats are stored in the same register bank
 ! On PowerPC they are distinct
 HOOK: vector-regs cpu ( -- reg-class )
@@ -150,7 +162,6 @@ M: float-rep reg-class-of drop float-regs ;
 M: double-rep reg-class-of drop float-regs ;
 M: vector-rep reg-class-of drop vector-regs ;
 M: scalar-rep reg-class-of drop vector-regs ;
-M: stack-params reg-class-of drop stack-params ;
 
 GENERIC: rep-size ( rep -- n ) foldable
 
@@ -158,7 +169,6 @@ M: tagged-rep rep-size drop cell ;
 M: int-rep rep-size drop cell ;
 M: float-rep rep-size drop 4 ;
 M: double-rep rep-size drop 8 ;
-M: stack-params rep-size drop cell ;
 M: vector-rep rep-size drop 16 ;
 M: char-scalar-rep rep-size drop 1 ;
 M: uchar-scalar-rep rep-size drop 1 ;
@@ -202,11 +212,28 @@ M: ulonglong-2-rep scalar-rep-of drop ulonglong-scalar-rep ;
 ! Mapping from register class to machine registers
 HOOK: machine-registers cpu ( -- assoc )
 
-HOOK: %load-immediate cpu ( reg obj -- )
+! Callbacks are not allowed to clobber this
+HOOK: frame-reg cpu ( -- reg )
+
+! Parameter space to reserve in anything making VM calls
+HOOK: vm-stack-space cpu ( -- n )
+
+M: object vm-stack-space 0 ;
+
+! Specifies if %slot, %set-slot and %write-barrier accept the
+! 'scale' and 'tag' parameters, and if %load-memory and
+! %store-memory work
+HOOK: complex-addressing? cpu ( -- ? )
+
+HOOK: %load-immediate cpu ( reg val -- )
 HOOK: %load-reference cpu ( reg obj -- )
+HOOK: %load-float cpu ( reg val -- )
+HOOK: %load-double cpu ( reg val -- )
+HOOK: %load-vector cpu ( reg val rep -- )
 
 HOOK: %peek cpu ( vreg loc -- )
 HOOK: %replace cpu ( vreg loc -- )
+HOOK: %replace-imm cpu ( src loc -- )
 HOOK: %inc-d cpu ( n -- )
 HOOK: %inc-r cpu ( n -- )
 
@@ -218,14 +245,11 @@ HOOK: %return cpu ( -- )
 
 HOOK: %dispatch cpu ( src temp -- )
 
-HOOK: %slot cpu ( dst obj slot -- )
+HOOK: %slot cpu ( dst obj slot scale tag -- )
 HOOK: %slot-imm cpu ( dst obj slot tag -- )
-HOOK: %set-slot cpu ( src obj slot -- )
+HOOK: %set-slot cpu ( src obj slot scale tag -- )
 HOOK: %set-slot-imm cpu ( src obj slot tag -- )
 
-HOOK: %string-nth cpu ( dst obj index temp -- )
-HOOK: %set-string-nth-fast cpu ( ch obj index temp -- )
-
 HOOK: %add     cpu ( dst src1 src2 -- )
 HOOK: %add-imm cpu ( dst src1 src2 -- )
 HOOK: %sub     cpu ( dst src1 src2 -- )
@@ -249,12 +273,15 @@ HOOK: %max     cpu ( dst src1 src2 -- )
 HOOK: %not     cpu ( dst src -- )
 HOOK: %neg     cpu ( dst src -- )
 HOOK: %log2    cpu ( dst src -- )
+HOOK: %bit-count cpu ( dst src -- )
 
 HOOK: %copy cpu ( dst src rep -- )
 
-HOOK: %fixnum-add cpu ( label dst src1 src2 -- )
-HOOK: %fixnum-sub cpu ( label dst src1 src2 -- )
-HOOK: %fixnum-mul cpu ( label dst src1 src2 -- )
+: %tagged>integer ( dst src -- ) int-rep %copy ;
+
+HOOK: %fixnum-add cpu ( label dst src1 src2 cc -- )
+HOOK: %fixnum-sub cpu ( label dst src1 src2 cc -- )
+HOOK: %fixnum-mul cpu ( label dst src1 src2 cc -- )
 
 HOOK: %add-float cpu ( dst src1 src2 -- )
 HOOK: %sub-float cpu ( dst src1 src2 -- )
@@ -269,18 +296,25 @@ HOOK: %binary-float-function cpu ( dst src1 src2 func -- )
 HOOK: %single>double-float cpu ( dst src -- )
 HOOK: %double>single-float cpu ( dst src -- )
 
+HOOK: integer-float-needs-stack-frame? cpu ( -- ? )
+
 HOOK: %integer>float cpu ( dst src -- )
 HOOK: %float>integer cpu ( dst src -- )
 
 HOOK: %zero-vector cpu ( dst rep -- )
 HOOK: %fill-vector cpu ( dst rep -- )
 HOOK: %gather-vector-2 cpu ( dst src1 src2 rep -- )
+HOOK: %gather-int-vector-2 cpu ( dst src1 src2 rep -- )
 HOOK: %gather-vector-4 cpu ( dst src1 src2 src3 src4 rep -- )
+HOOK: %gather-int-vector-4 cpu ( dst src1 src2 src3 src4 rep -- )
+HOOK: %select-vector cpu ( dst src n rep -- )
 HOOK: %shuffle-vector cpu ( dst src shuffle rep -- )
 HOOK: %shuffle-vector-imm cpu ( dst src shuffle rep -- )
+HOOK: %shuffle-vector-halves-imm cpu ( dst src1 src2 shuffle rep -- )
 HOOK: %tail>head-vector cpu ( dst src rep -- )
 HOOK: %merge-vector-head cpu ( dst src1 src2 rep -- )
 HOOK: %merge-vector-tail cpu ( dst src1 src2 rep -- )
+HOOK: %float-pack-vector cpu ( dst src rep -- )
 HOOK: %signed-pack-vector cpu ( dst src1 src2 rep -- )
 HOOK: %unsigned-pack-vector cpu ( dst src1 src2 rep -- )
 HOOK: %unpack-vector-head cpu ( dst src rep -- )
@@ -329,11 +363,16 @@ HOOK: %scalar>vector cpu ( dst src rep -- )
 HOOK: %zero-vector-reps cpu ( -- reps )
 HOOK: %fill-vector-reps cpu ( -- reps )
 HOOK: %gather-vector-2-reps cpu ( -- reps )
+HOOK: %gather-int-vector-2-reps cpu ( -- reps )
 HOOK: %gather-vector-4-reps cpu ( -- reps )
+HOOK: %gather-int-vector-4-reps cpu ( -- reps )
+HOOK: %select-vector-reps cpu ( -- reps )
 HOOK: %alien-vector-reps cpu ( -- reps )
 HOOK: %shuffle-vector-reps cpu ( -- reps )
 HOOK: %shuffle-vector-imm-reps cpu ( -- reps )
+HOOK: %shuffle-vector-halves-imm-reps cpu ( -- reps )
 HOOK: %merge-vector-reps cpu ( -- reps )
+HOOK: %float-pack-vector-reps cpu ( -- reps )
 HOOK: %signed-pack-vector-reps cpu ( -- reps )
 HOOK: %unsigned-pack-vector-reps cpu ( -- reps )
 HOOK: %unpack-vector-head-reps cpu ( -- reps )
@@ -377,11 +416,16 @@ HOOK: %horizontal-shr-vector-imm-reps cpu ( -- reps )
 M: object %zero-vector-reps { } ;
 M: object %fill-vector-reps { } ;
 M: object %gather-vector-2-reps { } ;
+M: object %gather-int-vector-2-reps { } ;
 M: object %gather-vector-4-reps { } ;
+M: object %gather-int-vector-4-reps { } ;
+M: object %select-vector-reps { } ;
 M: object %alien-vector-reps { } ;
 M: object %shuffle-vector-reps { } ;
 M: object %shuffle-vector-imm-reps { } ;
+M: object %shuffle-vector-halves-imm-reps { } ;
 M: object %merge-vector-reps { } ;
+M: object %float-pack-vector-reps { } ;
 M: object %signed-pack-vector-reps { } ;
 M: object %unsigned-pack-vector-reps { } ;
 M: object %unpack-vector-head-reps { } ;
@@ -427,49 +471,45 @@ HOOK: %unbox-any-c-ptr cpu ( dst src -- )
 HOOK: %box-alien cpu ( dst src temp -- )
 HOOK: %box-displaced-alien cpu ( dst displacement base temp base-class -- )
 
-HOOK: %alien-unsigned-1 cpu ( dst src offset -- )
-HOOK: %alien-unsigned-2 cpu ( dst src offset -- )
-HOOK: %alien-unsigned-4 cpu ( dst src offset -- )
-HOOK: %alien-signed-1   cpu ( dst src offset -- )
-HOOK: %alien-signed-2   cpu ( dst src offset -- )
-HOOK: %alien-signed-4   cpu ( dst src offset -- )
-HOOK: %alien-cell       cpu ( dst src offset -- )
-HOOK: %alien-float      cpu ( dst src offset -- )
-HOOK: %alien-double     cpu ( dst src offset -- )
-HOOK: %alien-vector     cpu ( dst src offset rep -- )
-
-HOOK: %set-alien-integer-1 cpu ( ptr offset value -- )
-HOOK: %set-alien-integer-2 cpu ( ptr offset value -- )
-HOOK: %set-alien-integer-4 cpu ( ptr offset value -- )
-HOOK: %set-alien-cell      cpu ( ptr offset value -- )
-HOOK: %set-alien-float     cpu ( ptr offset value -- )
-HOOK: %set-alien-double    cpu ( ptr offset value -- )
-HOOK: %set-alien-vector    cpu ( ptr offset value rep -- )
+HOOK: %load-memory cpu ( dst base displacement scale offset rep c-type -- )
+HOOK: %load-memory-imm cpu ( dst base offset rep c-type -- )
+HOOK: %store-memory cpu ( value base displacement scale offset rep c-type -- )
+HOOK: %store-memory-imm cpu ( value base offset rep c-type -- )
 
 HOOK: %alien-global cpu ( dst symbol library -- )
-HOOK: %vm-field cpu ( dst fieldname -- )
-HOOK: %vm-field-ptr cpu ( dst fieldname -- )
+HOOK: %vm-field cpu ( dst offset -- )
+HOOK: %set-vm-field cpu ( src offset -- )
+
+: %context ( dst -- ) 0 %vm-field ;
 
 HOOK: %allot cpu ( dst size class temp -- )
-HOOK: %write-barrier cpu ( src slot temp1 temp2 -- )
-HOOK: %write-barrier-imm cpu ( src slot temp1 temp2 -- )
+HOOK: %write-barrier cpu ( src slot scale tag temp1 temp2 -- )
+HOOK: %write-barrier-imm cpu ( src slot tag temp1 temp2 -- )
 
 ! GC checks
-HOOK: %check-nursery cpu ( label size temp1 temp2 -- )
-HOOK: %save-gc-root cpu ( gc-root register -- )
-HOOK: %load-gc-root cpu ( gc-root register -- )
-HOOK: %call-gc cpu ( gc-root-count temp1 -- )
+HOOK: %check-nursery-branch cpu ( label size cc temp1 temp2 -- )
+HOOK: %call-gc cpu ( gc-roots -- )
 
 HOOK: %prologue cpu ( n -- )
 HOOK: %epilogue cpu ( n -- )
 
-HOOK: %compare cpu ( dst temp cc src1 src2 -- )
-HOOK: %compare-imm cpu ( dst temp cc src1 src2 -- )
-HOOK: %compare-float-ordered cpu ( dst temp cc src1 src2 -- )
-HOOK: %compare-float-unordered cpu ( dst temp cc src1 src2 -- )
+HOOK: test-instruction? cpu ( -- ? )
+
+M: object test-instruction? f ;
+
+HOOK: %compare cpu ( dst src1 src2 cc temp -- )
+HOOK: %compare-imm cpu ( dst src1 src2 cc temp -- )
+HOOK: %compare-integer-imm cpu ( dst src1 src2 cc temp -- )
+HOOK: %test cpu ( dst src1 src2 cc temp -- )
+HOOK: %test-imm cpu ( dst src1 src2 cc temp -- )
+HOOK: %compare-float-ordered cpu ( dst src1 src2 cc temp -- )
+HOOK: %compare-float-unordered cpu ( dst src1 src2 cc temp -- )
 
 HOOK: %compare-branch cpu ( label cc src1 src2 -- )
 HOOK: %compare-imm-branch cpu ( label cc src1 src2 -- )
+HOOK: %compare-integer-imm-branch cpu ( label cc src1 src2 -- )
+HOOK: %test-branch cpu ( label cc src1 src2 -- )
+HOOK: %test-imm-branch cpu ( label cc src1 src2 -- )
 HOOK: %compare-float-ordered-branch cpu ( label cc src1 src2 -- )
 HOOK: %compare-float-unordered-branch cpu ( label cc src1 src2 -- )
 
@@ -478,29 +518,42 @@ HOOK: %reload cpu ( dst rep src -- )
 
 HOOK: %loop-entry cpu ( -- )
 
-! FFI stuff
+! Does this architecture support %load-float, %load-double,
+! and %load-vector?
+HOOK: fused-unboxing? cpu ( -- ? )
 
-! Return values of this class go here
-GENERIC: return-reg ( reg-class -- reg )
+! Can this value be an immediate operand for %add-imm, %sub-imm,
+! or %mul-imm?
+HOOK: immediate-arithmetic? cpu ( n -- ? )
 
-! Sequence of registers used for parameter passing in class
-GENERIC: param-regs ( reg-class -- regs )
+! Can this value be an immediate operand for %and-imm, %or-imm,
+! or %xor-imm?
+HOOK: immediate-bitwise? cpu ( n -- ? )
 
-M: stack-params param-regs drop f ;
+! Can this value be an immediate operand for %compare-imm or
+! %compare-imm-branch?
+HOOK: immediate-comparand? cpu ( n -- ? )
 
-GENERIC: param-reg ( n reg-class -- reg )
+! Can this value be an immediate operand for %replace-imm?
+HOOK: immediate-store? cpu ( obj -- ? )
 
-M: reg-class param-reg param-regs nth ;
+M: object immediate-comparand? ( n -- ? )
+    {
+        { [ dup fixnum? ] [ tag-fixnum immediate-arithmetic? ] }
+        { [ dup not ] [ drop t ] }
+        [ drop f ]
+    } cond ;
 
-M: stack-params param-reg drop ;
+: immediate-shift-count? ( n -- ? )
+    0 cell-bits 1 - between? ;
 
-! Is this integer small enough to be an immediate operand for
-! %add-imm, %sub-imm, and %mul-imm?
-HOOK: immediate-arithmetic? cpu ( n -- ? )
+! FFI stuff
 
-! Is this integer small enough to be an immediate operand for
-! %and-imm, %or-imm, and %xor-imm?
-HOOK: immediate-bitwise? cpu ( n -- ? )
+! Return values of this class go here
+HOOK: return-regs cpu ( -- regs )
+
+! Registers used for parameter passing
+HOOK: param-regs cpu ( abi -- regs )
 
 ! Is this structure small enough to be returned in registers?
 HOOK: return-struct-in-registers? cpu ( c-type -- ? )
@@ -517,52 +570,35 @@ HOOK: dummy-int-params? cpu ( -- ? )
 ! If t, all int parameters are shadowed by dummy FP parameters
 HOOK: dummy-fp-params? cpu ( -- ? )
 
-! Load a value (from the data stack in the ds register).
-! The value is then passed as a parameter to a VM to_*() function
-HOOK: %pop-stack cpu ( n -- )
+! If t, long longs are never passed in param regs
+HOOK: long-long-on-stack? cpu ( -- ? )
 
-! Store a value (to the data stack in the VM's current context)
-! The value is passed to a VM to_*() function -- used for
-! callback returns
-HOOK: %pop-context-stack cpu ( -- )
+! If t, floats are never passed in param regs
+HOOK: float-on-stack? cpu ( -- ? )
 
-! Store a value (to the data stack in the ds register).
-! The value was returned from a VM from_*() function
-HOOK: %push-stack cpu ( -- )
+! If t, the struct return pointer is never passed in a param reg
+HOOK: struct-return-on-stack? cpu ( -- ? )
 
-! Store a value (to the data stack in the VM's current context)
-! The value is returned from a VM from_*() function -- used for
-! callback parameters
-HOOK: %push-context-stack cpu ( -- )
+! Call a function to convert a tagged pointer into a value that
+! can be passed to a C function, or returned from a callback
+HOOK: %unbox cpu ( dst src func rep -- )
 
-! Call a function to convert a tagged pointer returned by
-! %pop-stack or %pop-context-stack into a value that can be
-! passed to a C function, or returned from a callback
-HOOK: %unbox cpu ( n rep func -- )
+HOOK: %unbox-long-long cpu ( src out func -- )
 
-HOOK: %unbox-long-long cpu ( n func -- )
+HOOK: %store-reg-param cpu ( src reg rep -- )
 
-HOOK: %unbox-small-struct cpu ( c-type -- )
+HOOK: %store-stack-param cpu ( src n rep -- )
 
-HOOK: %unbox-large-struct cpu ( n c-type -- )
+HOOK: %local-allot cpu ( dst size align offset -- )
 
 ! Call a function to convert a value into a tagged pointer,
 ! possibly allocating a bignum, float, or alien instance,
-! which is then pushed on the data stack by %push-stack or
-! %push-context-stack
-HOOK: %box cpu ( n rep func -- )
-
-HOOK: %box-long-long cpu ( n func -- )
-
-HOOK: %prepare-box-struct cpu ( -- )
-
-HOOK: %box-small-struct cpu ( c-type -- )
+! which is then pushed on the data stack
+HOOK: %box cpu ( dst src func rep -- )
 
-HOOK: %box-large-struct cpu ( n c-type -- )
+HOOK: %box-long-long cpu ( dst src1 src2 func -- )
 
-HOOK: %save-param-reg cpu ( stack reg rep -- )
-
-HOOK: %load-param-reg cpu ( stack reg rep -- )
+HOOK: %allot-byte-array cpu ( dst size -- )
 
 HOOK: %restore-context cpu ( temp1 temp2 -- )
 
@@ -574,22 +610,22 @@ M: object %prepare-var-args ;
 
 HOOK: %alien-invoke cpu ( function library -- )
 
-HOOK: %cleanup cpu ( params -- )
+HOOK: %cleanup cpu ( n -- )
 
-M: object %cleanup ( params -- ) drop ;
+M: object %cleanup ( n -- ) drop ;
 
-HOOK: %prepare-alien-indirect cpu ( -- )
+HOOK: %alien-indirect cpu ( src -- )
 
-HOOK: %alien-indirect cpu ( -- )
+HOOK: %load-reg-param cpu ( dst reg rep -- )
 
-HOOK: %alien-callback cpu ( quot -- )
+HOOK: %load-stack-param cpu ( dst n rep -- )
 
-HOOK: %callback-value cpu ( ctype -- )
+HOOK: %begin-callback cpu ( -- )
 
-HOOK: %nest-stacks cpu ( -- )
+HOOK: %alien-callback cpu ( quot -- )
 
-HOOK: %unnest-stacks cpu ( -- )
+HOOK: %end-callback cpu ( -- )
 
-HOOK: callback-return-rewind cpu ( params -- n )
+HOOK: stack-cleanup cpu ( stack-size return abi -- n )
 
-M: object callback-return-rewind drop 0 ;
+M: object stack-cleanup 3drop 0 ;
index 8e412c4c832cbeeedf74392ee0c39de1fda89ff9..a30556444e80e473fafbbed4b8150f82ab3649ff 100644 (file)
@@ -72,6 +72,14 @@ HEX{ 7c 41 1a 2e } [ 1 2 3 LHZX ] test-assembler
 HEX{ 7c 41 1a 6e } [ 1 2 3 LHZUX ] test-assembler
 HEX{ 7c 41 18 2e } [ 1 2 3 LWZX ] test-assembler
 HEX{ 7c 41 18 6e } [ 1 2 3 LWZUX ] test-assembler
+HEX{ 7c 41 1c 2e } [ 1 2 3 LFSX ] test-assembler
+HEX{ 7c 41 1c 6e } [ 1 2 3 LFSUX ] test-assembler
+HEX{ 7c 41 1c ae } [ 1 2 3 LFDX ] test-assembler
+HEX{ 7c 41 1c ee } [ 1 2 3 LFDUX ] test-assembler
+HEX{ 7c 41 1d 2e } [ 1 2 3 STFSX ] test-assembler
+HEX{ 7c 41 1d 6e } [ 1 2 3 STFSUX ] test-assembler
+HEX{ 7c 41 1d ae } [ 1 2 3 STFDX ] test-assembler
+HEX{ 7c 41 1d ee } [ 1 2 3 STFDUX ] test-assembler
 HEX{ 48 00 00 01 } [ 1 B ] test-assembler
 HEX{ 48 00 00 01 } [ 1 BL ] test-assembler
 HEX{ 41 80 00 04 } [ 1 BLT ] test-assembler
index ca626a638eec8041590dacb4612a9f5b40646edc..30beabc09c30c31de1944bec4050f3847c0eaf4c 100644 (file)
@@ -66,6 +66,10 @@ X: FCMPO 0 32 63
 X: FCMPU 0 0 63
 X: LBZUX 0 119 31
 X: LBZX 0 87 31
+X: LFDUX 0 631 31
+X: LFDX 0 599 31
+X: LFSUX 0 567 31
+X: LFSX 0 535 31
 X: LHAUX 0 375 31
 X: LHAX 0 343 31
 X: LHZUX 0 311 31
@@ -89,6 +93,10 @@ X: SRW 0 536 31
 X: SRW. 1 536 31
 X: STBUX 0 247 31
 X: STBX 0 215 31
+X: STFDUX 0 759 31
+X: STFDX 0 727 31
+X: STFSUX 0 695 31
+X: STFSX 0 663 31
 X: STHUX 0 439 31
 X: STHX 0 407 31
 X: STWUX 0 183 31
index b2ae9c4e73afd6d2d54b48d5ecdd2cee265ab58f..68ebbf9f4f6d5e1dce357a15528dcb98a0227f38 100644 (file)
@@ -3,7 +3,8 @@
 USING: bootstrap.image.private kernel kernel.private namespaces\r
 system cpu.ppc.assembler compiler.units compiler.constants math\r
 math.private math.ranges layouts words vocabs slots.private\r
-locals locals.backend generic.single.private fry sequences ;\r
+locals locals.backend generic.single.private fry sequences\r
+threads.private strings.private ;\r
 FROM: cpu.ppc.assembler => B ;\r
 IN: bootstrap.ppc\r
 \r
@@ -14,6 +15,22 @@ CONSTANT: ds-reg 13
 CONSTANT: rs-reg 14\r
 CONSTANT: vm-reg 15\r
 CONSTANT: ctx-reg 16\r
+CONSTANT: nv-reg 17\r
+\r
+: jit-call ( string -- )\r
+    0 2 LOAD32 rc-absolute-ppc-2/2 jit-dlsym\r
+    2 MTLR\r
+    BLRL ;\r
+\r
+: jit-call-quot ( -- )\r
+    4 3 quot-entry-point-offset LWZ\r
+    4 MTLR\r
+    BLRL ;\r
+\r
+: jit-jump-quot ( -- )\r
+    4 3 quot-entry-point-offset LWZ\r
+    4 MTCTR\r
+    BCTR ;\r
 \r
 : factor-area-size ( -- n ) 16 ;\r
 \r
@@ -52,29 +69,71 @@ CONSTANT: ctx-reg 16
     saved-int-regs-size +\r
     saved-fp-regs-size +\r
     saved-vec-regs-size +\r
+    4 +\r
     16 align ;\r
 \r
+: old-context-save-offset ( -- n )\r
+    432 save-at ;\r
+\r
 [\r
+    ! Save old stack pointer\r
+    11 1 MR\r
+\r
+    ! Create stack frame\r
     0 MFLR\r
-    1 1 callback-frame-size neg STWU\r
+    1 1 callback-frame-size SUBI\r
     0 1 callback-frame-size lr-save + STW\r
 \r
+    ! Save all non-volatile registers\r
     nv-int-regs [ 4 * save-int ] each-index\r
     nv-fp-regs [ 8 * 80 + save-fp ] each-index\r
     nv-vec-regs [ 16 * 224 + save-vec ] each-index\r
 \r
+    ! Stick old stack pointer in a non-volatile register so that\r
+    ! callbacks can access their arguments\r
+    nv-reg 11 MR\r
+\r
+    ! Load VM into vm-reg\r
     0 vm-reg LOAD32 rc-absolute-ppc-2/2 rt-vm jit-rel\r
 \r
+    ! Save old context\r
+    2 vm-reg vm-context-offset LWZ\r
+    2 1 old-context-save-offset STW\r
+\r
+    ! Switch over to the spare context\r
+    2 vm-reg vm-spare-context-offset LWZ\r
+    2 vm-reg vm-context-offset STW\r
+\r
+    ! Save C callstack pointer\r
+    1 2 context-callstack-save-offset STW\r
+\r
+    ! Load Factor callstack pointer\r
+    1 2 context-callstack-bottom-offset LWZ\r
+\r
+    ! Call into Factor code\r
     0 2 LOAD32 rc-absolute-ppc-2/2 rt-entry-point jit-rel\r
     2 MTLR\r
     BLRL\r
 \r
+    ! Load VM again, pointlessly\r
+    0 vm-reg LOAD32 rc-absolute-ppc-2/2 rt-vm jit-rel\r
+\r
+    ! Load C callstack pointer\r
+    2 vm-reg vm-context-offset LWZ\r
+    1 2 context-callstack-save-offset LWZ\r
+\r
+    ! Load old context\r
+    2 1 old-context-save-offset LWZ\r
+    2 vm-reg vm-context-offset STW\r
+\r
+    ! Restore non-volatile registers\r
     nv-vec-regs [ 16 * 224 + restore-vec ] each-index\r
     nv-fp-regs [ 8 * 80 + restore-fp ] each-index\r
     nv-int-regs [ 4 * restore-int ] each-index\r
 \r
+    ! Tear down stack frame and return\r
     0 1 callback-frame-size lr-save + LWZ\r
-    1 1 0 LWZ\r
+    1 1 callback-frame-size ADDI\r
     0 MTLR\r
     BLR\r
 ] callback-stub jit-define\r
@@ -92,7 +151,6 @@ CONSTANT: ctx-reg 16
     rs-reg ctx-reg context-retainstack-offset STW ;\r
 \r
 : jit-restore-context ( -- )\r
-    jit-load-context\r
     ds-reg ctx-reg context-datastack-offset LWZ\r
     rs-reg ctx-reg context-retainstack-offset LWZ ;\r
 \r
@@ -228,25 +286,19 @@ CONSTANT: ctx-reg 16
     4 ds-reg 0 LWZ rc-absolute-ppc-2 rt-untagged jit-rel\r
 ] pic-load jit-define\r
 \r
-! Tag\r
-: load-tag ( -- )\r
-    4 4 tag-mask get ANDI\r
-    4 4 tag-bits get SLWI ;\r
+[ 4 4 tag-mask get ANDI ] pic-tag jit-define\r
 \r
-[ load-tag ] pic-tag jit-define\r
-\r
-! Tuple\r
 [\r
     3 4 MR\r
-    load-tag\r
-    0 4 tuple type-number tag-fixnum CMPI\r
+    4 4 tag-mask get ANDI\r
+    0 4 tuple type-number CMPI\r
     [ BNE ]\r
-    [ 4 3 tuple type-number neg 4 + LWZ ]\r
+    [ 4 3 tuple-class-offset LWZ ]\r
     jit-conditional*\r
 ] pic-tuple jit-define\r
 \r
 [\r
-    0 4 0 CMPI rc-absolute-ppc-2 rt-literal jit-rel\r
+    0 4 0 CMPI rc-absolute-ppc-2 rt-untagged jit-rel\r
 ] pic-check-tag jit-define\r
 \r
 [\r
@@ -267,9 +319,8 @@ CONSTANT: ctx-reg 16
     jit-save-context\r
     3 6 MR\r
     4 vm-reg MR\r
-    0 5 LOAD32 "inline_cache_miss" f rc-absolute-ppc-2/2 jit-dlsym\r
-    5 MTLR\r
-    BLRL\r
+    "inline_cache_miss" jit-call\r
+    jit-load-context\r
     jit-restore-context ;\r
 \r
 [ jit-load-return-address jit-inline-cache-miss ]\r
@@ -285,6 +336,14 @@ CONSTANT: ctx-reg 16
 ! ! ! Megamorphic caches\r
 \r
 [\r
+    ! class = ...\r
+    3 4 MR\r
+    4 4 tag-mask get ANDI\r
+    4 4 tag-bits get SLWI\r
+    0 4 tuple type-number tag-fixnum CMPI\r
+    [ BNE ]\r
+    [ 4 3 tuple-class-offset LWZ ]\r
+    jit-conditional*\r
     ! cache = ...\r
     0 3 LOAD32 rc-absolute-ppc-2/2 rt-literal jit-rel\r
     ! key = hashcode(class)\r
@@ -321,10 +380,9 @@ CONSTANT: ctx-reg 16
 [\r
     3 ds-reg 0 LWZ\r
     ds-reg dup 4 SUBI\r
-    5 3 quot-entry-point-offset LWZ\r
 ]\r
-[ 5 MTLR BLRL ]\r
-[ 5 MTCTR BCTR ] \ (call) define-combinator-primitive\r
+[ jit-call-quot ]\r
+[ jit-jump-quot ] \ (call) define-combinator-primitive\r
 \r
 [\r
     3 ds-reg 0 LWZ\r
@@ -343,14 +401,22 @@ CONSTANT: ctx-reg 16
 \r
 ! Special primitives\r
 [\r
+    nv-reg 3 MR\r
+\r
+    3 vm-reg MR\r
+    "begin_callback" jit-call\r
+\r
+    jit-load-context\r
     jit-restore-context\r
-    ! Save ctx->callstack_bottom\r
-    1 ctx-reg context-callstack-bottom-offset STW\r
+\r
     ! Call quotation\r
-    5 3 quot-entry-point-offset LWZ\r
-    5 MTLR\r
-    BLRL\r
+    3 nv-reg MR\r
+    jit-call-quot\r
+\r
     jit-save-context\r
+\r
+    3 vm-reg MR\r
+    "end_callback" jit-call\r
 ] \ c-to-factor define-sub-primitive\r
 \r
 [\r
@@ -362,6 +428,7 @@ CONSTANT: ctx-reg 16
     0 vm-reg LOAD32 0 rc-absolute-ppc-2/2 jit-vm\r
 \r
     ! Load ds and rs registers\r
+    jit-load-context\r
     jit-restore-context\r
 \r
     ! We have changed the stack; load return address again\r
@@ -369,9 +436,7 @@ CONSTANT: ctx-reg 16
     0 MTLR\r
 \r
     ! Call quotation\r
-    4 3 quot-entry-point-offset LWZ\r
-    4 MTCTR\r
-    BCTR\r
+    jit-call-quot\r
 ] \ unwind-native-frames define-sub-primitive\r
 \r
 [\r
@@ -392,9 +457,7 @@ CONSTANT: ctx-reg 16
     1 3 MR\r
     ! Call memcpy; arguments are now in the correct registers\r
     1 1 -64 STWU\r
-    0 2 LOAD32 "factor_memcpy" f rc-absolute-ppc-2/2 jit-dlsym\r
-    2 MTLR\r
-    BLRL\r
+    "factor_memcpy" jit-call\r
     1 1 0 LWZ\r
     ! Return with new callstack\r
     0 1 lr-save LWZ\r
@@ -405,13 +468,10 @@ CONSTANT: ctx-reg 16
 [\r
     jit-save-context\r
     4 vm-reg MR\r
-    0 2 LOAD32 "lazy_jit_compile" f rc-absolute-ppc-2/2 jit-dlsym\r
-    2 MTLR\r
-    BLRL\r
-    5 3 quot-entry-point-offset LWZ\r
+    "lazy_jit_compile" jit-call\r
 ]\r
-[ 5 MTLR BLRL ]\r
-[ 5 MTCTR BCTR ]\r
+[ jit-call-quot ]\r
+[ jit-jump-quot ]\r
 \ lazy-jit-compile define-combinator-primitive\r
 \r
 ! Objects\r
@@ -431,6 +491,21 @@ CONSTANT: ctx-reg 16
     3 ds-reg 0 STW\r
 ] \ slot define-sub-primitive\r
 \r
+[\r
+    ! load string index from stack\r
+    3 ds-reg -4 LWZ\r
+    3 3 tag-bits get SRAWI\r
+    ! load string from stack\r
+    4 ds-reg 0 LWZ\r
+    ! load character\r
+    4 4 string-offset ADDI\r
+    3 3 4 LBZX\r
+    3 3 tag-bits get SLWI\r
+    ! store character to stack\r
+    ds-reg ds-reg 4 SUBI\r
+    3 ds-reg 0 STW\r
+] \ string-nth-fast define-sub-primitive\r
+\r
 ! Shufflers\r
 [\r
     ds-reg dup 4 SUBI\r
@@ -665,9 +740,7 @@ CONSTANT: ctx-reg 16
     [ BNO ]\r
     [\r
         5 vm-reg MR\r
-        0 6 LOAD32 func f rc-absolute-ppc-2/2 jit-dlsym\r
-        6 MTLR\r
-        BLRL\r
+        func jit-call\r
     ]\r
     jit-conditional* ;\r
 \r
@@ -689,11 +762,78 @@ CONSTANT: ctx-reg 16
     [\r
         4 4 tag-bits get SRAWI\r
         5 vm-reg MR\r
-        0 6 LOAD32 "overflow_fixnum_multiply" f rc-absolute-ppc-2/2 jit-dlsym\r
-        6 MTLR\r
-        BLRL\r
+        "overflow_fixnum_multiply" jit-call\r
     ]\r
     jit-conditional*\r
 ] \ fixnum* define-sub-primitive\r
 \r
+! Contexts\r
+: jit-switch-context ( reg -- )\r
+    ! Save ds, rs registers\r
+    jit-save-context\r
+\r
+    ! Make the new context the current one\r
+    ctx-reg swap MR\r
+    ctx-reg vm-reg vm-context-offset STW\r
+\r
+    ! Load new stack pointer\r
+    1 ctx-reg context-callstack-top-offset LWZ\r
+\r
+    ! Load new ds, rs registers\r
+    jit-restore-context ;\r
+\r
+: jit-pop-context-and-param ( -- )\r
+    3 ds-reg 0 LWZ\r
+    3 3 alien-offset LWZ\r
+    4 ds-reg -4 LWZ\r
+    ds-reg ds-reg 8 SUBI ;\r
+\r
+: jit-push-param ( -- )\r
+    ds-reg ds-reg 4 ADDI\r
+    4 ds-reg 0 STW ;\r
+\r
+: jit-set-context ( -- )\r
+    jit-pop-context-and-param\r
+    3 jit-switch-context\r
+    jit-push-param ;\r
+\r
+[ jit-set-context ] \ (set-context) define-sub-primitive\r
+\r
+: jit-pop-quot-and-param ( -- )\r
+    3 ds-reg 0 LWZ\r
+    4 ds-reg -4 LWZ\r
+    ds-reg ds-reg 8 SUBI ;\r
+\r
+: jit-start-context ( -- )\r
+    ! Create the new context in return-reg\r
+    3 vm-reg MR\r
+    "new_context" jit-call\r
+    6 3 MR\r
+\r
+    jit-pop-quot-and-param\r
+\r
+    6 jit-switch-context\r
+\r
+    jit-push-param\r
+\r
+    jit-jump-quot ;\r
+\r
+[ jit-start-context ] \ (start-context) define-sub-primitive\r
+\r
+: jit-delete-current-context ( -- )\r
+    jit-load-context\r
+    3 vm-reg MR\r
+    4 ctx-reg MR\r
+    "delete_context" jit-call ;\r
+\r
+[\r
+    jit-delete-current-context\r
+    jit-set-context\r
+] \ (set-context-and-delete) define-sub-primitive\r
+\r
+[\r
+    jit-delete-current-context\r
+    jit-start-context\r
+] \ (start-context-and-delete) define-sub-primitive\r
+\r
 [ "bootstrap.ppc" forget-vocab ] with-compilation-unit\r
index 5cfa1391c47dc98f8907d66c68efe2404e636c03..9191b6c202f4786e030bff0e9cd5662f3b5dc92f 100644 (file)
@@ -5,15 +5,19 @@ alien.c-types cpu.architecture cpu.ppc ;
 IN: cpu.ppc.linux
 
 <<
-t "longlong" c-type (>>stack-align?)
-t "ulonglong" c-type (>>stack-align?)
+t "longlong" c-type stack-align?<<
+t "ulonglong" c-type stack-align?<<
 >>
 
 M: linux reserved-area-size 2 cells ;
 
 M: linux lr-save 1 cells ;
 
-M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 } ;
+M: ppc param-regs
+    drop {
+        { int-regs { 3 4 5 6 7 8 9 10 } }
+        { float-regs { 1 2 3 4 5 6 7 8 } }
+    } ;
 
 M: ppc value-struct? drop f ;
 
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 152a3aa7209e81f1c2f982802c27b5a4fb66ca48..989426b8d2f0f747172a8083602e79bf8455f01c 100644 (file)
@@ -8,7 +8,11 @@ M: macosx reserved-area-size 6 cells ;
 
 M: macosx lr-save 2 cells ;
 
-M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 9 10 11 12 13 } ;
+M: ppc param-regs
+    drop {
+        { int-regs { 3 4 5 6 7 8 9 10 } }
+        { float-regs { 1 2 3 4 5 6 7 8 9 10 11 12 13 } }
+    } ;
 
 M: ppc value-struct? drop t ;
 
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 6d84aad8d50bd2a422e722ad3a71dc0aee555589..56ec02d851727adc203194ab5b767f3a5f78ca0d 100644 (file)
@@ -1,14 +1,16 @@
 ! Copyright (C) 2005, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs sequences kernel combinators make math
-math.order math.ranges system namespaces locals layouts words
-alien alien.accessors alien.c-types alien.complex alien.data
-literals cpu.architecture cpu.ppc.assembler
-cpu.ppc.assembler.backend compiler.cfg.registers
-compiler.cfg.instructions compiler.cfg.comparisons
-compiler.codegen.fixup compiler.cfg.intrinsics
-compiler.cfg.stack-frame compiler.cfg.build-stack-frame
-compiler.units compiler.constants compiler.codegen vm ;
+USING: accessors assocs sequences kernel combinators
+classes.algebra byte-arrays make math math.order math.ranges
+system namespaces locals layouts words alien alien.accessors
+alien.c-types alien.complex alien.data alien.libraries
+literals cpu.architecture cpu.ppc.assembler cpu.ppc.assembler.backend
+compiler.cfg.registers compiler.cfg.instructions
+compiler.cfg.comparisons compiler.codegen.fixup
+compiler.cfg.intrinsics compiler.cfg.stack-frame
+compiler.cfg.build-stack-frame compiler.units compiler.constants
+compiler.codegen vm ;
+QUALIFIED-WITH: alien.c-types c
 FROM: cpu.ppc.assembler => B ;
 FROM: layouts => cell ;
 FROM: math => float ;
@@ -30,11 +32,6 @@ M: label BC [ 0 BC ] dip rc-relative-ppc-2 label-fixup ;
 
 enable-float-intrinsics
 
-<<
-\ ##integer>float t frame-required? set-word-prop
-\ ##float>integer t frame-required? set-word-prop
->>
-
 M: ppc machine-registers
     {
         { int-regs $[ 2 12 [a,b] 16 29 [a,b] append ] }
@@ -44,10 +41,16 @@ M: ppc machine-registers
 CONSTANT: scratch-reg 30
 CONSTANT: fp-scratch-reg 30
 
+M: ppc complex-addressing? f ;
+
+M: ppc fused-unboxing? f ;
+
 M: ppc %load-immediate ( reg n -- ) swap LOAD ;
 
 M: ppc %load-reference ( reg obj -- )
-    [ 0 swap LOAD32 ] [ rc-absolute-ppc-2/2 rel-immediate ] bi* ;
+    [ [ 0 swap LOAD32 ] [ rc-absolute-ppc-2/2 rel-literal ] bi* ]
+    [ \ f type-number swap LI ]
+    if* ;
 
 M: ppc %alien-global ( register symbol dll -- )
     [ 0 swap LOAD32 ] 2dip rc-absolute-ppc-2/2 rel-dlsym ;
@@ -58,11 +61,9 @@ CONSTANT: vm-reg 15
 
 : %load-vm-addr ( reg -- ) vm-reg MR ;
 
-M: ppc %vm-field ( dst field -- )
-    [ vm-reg ] dip vm-field-offset LWZ ;
+M: ppc %vm-field ( dst field -- ) [ vm-reg ] dip LWZ ;
 
-M: ppc %vm-field-ptr ( dst field -- )
-    [ vm-reg ] dip vm-field-offset ADDI ;
+M: ppc %set-vm-field ( src field -- ) [ vm-reg ] dip STW ;
 
 GENERIC: loc-reg ( loc -- reg )
 
@@ -111,10 +112,6 @@ HOOK: reserved-area-size os ( -- n )
 : scratch@ ( n -- offset )
     factor-area-size + ;
 
-! GC root area
-: gc-root@ ( n -- offset )
-    gc-root-offset local@ ;
-
 ! Finally we have the linkage area
 HOOK: lr-save os ( -- n )
 
@@ -141,31 +138,14 @@ M:: ppc %dispatch ( src temp -- )
     temp MTCTR
     BCTR ;
 
-M: ppc %slot ( dst obj slot -- ) swapd LWZX ;
+: (%slot) ( dst obj slot scale tag -- obj dst slot )
+    [ 0 assert= ] bi@ swapd ;
+
+M: ppc %slot ( dst obj slot scale tag -- ) (%slot) LWZX ;
 M: ppc %slot-imm ( dst obj slot tag -- ) slot-offset LWZ ;
-M: ppc %set-slot ( src obj slot -- ) swapd STWX ;
+M: ppc %set-slot ( src obj slot scale tag -- ) (%slot) STWX ;
 M: ppc %set-slot-imm ( src obj slot tag -- ) slot-offset STW ;
 
-M:: ppc %string-nth ( dst src index temp -- )
-    [
-        "end" define-label
-        temp src index ADD
-        dst temp string-offset LBZ
-        0 dst HEX: 80 CMPI
-        "end" get BLT
-        temp src string-aux-offset LWZ
-        temp temp index ADD
-        temp temp index ADD
-        temp temp byte-array-offset LHZ
-        temp temp 7 SLWI
-        dst dst temp XOR
-        "end" resolve-label
-    ] with-scope ;
-
-M:: ppc %set-string-nth-fast ( ch obj index temp -- )
-    temp obj index ADD
-    ch temp string-offset STB ;
-
 M: ppc %add     ADD ;
 M: ppc %add-imm ADDI ;
 M: ppc %sub     swap SUBF ;
@@ -187,19 +167,22 @@ M: ppc %sar-imm SRAWI ;
 M: ppc %not     NOT ;
 M: ppc %neg     NEG ;
 
-:: overflow-template ( label dst src1 src2 insn -- )
+:: overflow-template ( label dst src1 src2 cc insn -- )
     0 0 LI
     0 MTXER
     dst src2 src1 insn call
-    label BO ; inline
+    cc {
+        { cc-o [ label BO ] }
+        { cc/o [ label BNO ] }
+    } case ; inline
 
-M: ppc %fixnum-add ( label dst src1 src2 -- )
+M: ppc %fixnum-add ( label dst src1 src2 cc -- )
     [ ADDO. ] overflow-template ;
 
-M: ppc %fixnum-sub ( label dst src1 src2 -- )
+M: ppc %fixnum-sub ( label dst src1 src2 cc -- )
     [ SUBFO. ] overflow-template ;
 
-M: ppc %fixnum-mul ( label dst src1 src2 -- )
+M: ppc %fixnum-mul ( label dst src1 src2 cc -- )
     [ MULLWO. ] overflow-template ;
 
 M: ppc %add-float FADD ;
@@ -207,6 +190,8 @@ M: ppc %sub-float FSUB ;
 M: ppc %mul-float FMUL ;
 M: ppc %div-float FDIV ;
 
+M: ppc integer-float-needs-stack-frame? t ;
+
 M:: ppc %integer>float ( dst src -- )
     HEX: 4330 scratch-reg LIS
     scratch-reg 1 0 scratch@ STW
@@ -226,6 +211,7 @@ M:: ppc %float>integer ( dst src -- )
 M: ppc %copy ( dst src rep -- )
     2over eq? [ 3drop ] [
         {
+            { tagged-rep [ MR ] }
             { int-rep [ MR ] }
             { double-rep [ FMR ] }
         } case
@@ -237,10 +223,10 @@ M: spill-slot float-function-param* [ 1 ] dip n>> spill@ LFD ;
 M: integer float-function-param* FMR ;
 
 : float-function-param ( i src -- )
-    [ float-regs param-regs nth ] dip float-function-param* ;
+    [ float-regs cdecl param-regs at nth ] dip float-function-param* ;
 
 : float-function-return ( reg -- )
-    float-regs return-reg double-rep %copy ;
+    float-regs return-regs at first double-rep %copy ;
 
 M:: ppc %unary-float-function ( dst src func -- )
     0 src float-function-param
@@ -296,12 +282,69 @@ M:: ppc %box-alien ( dst src temp -- )
         "f" resolve-label
     ] with-scope ;
 
+:: %box-displaced-alien/f ( dst displacement base -- )
+    base dst 1 alien@ STW
+    displacement dst 3 alien@ STW
+    displacement dst 4 alien@ STW ;
+
+:: %box-displaced-alien/alien ( dst displacement base temp -- )
+    ! Set new alien's base to base.base
+    temp base 1 alien@ LWZ
+    temp dst 1 alien@ STW
+
+    ! Compute displacement
+    temp base 3 alien@ LWZ
+    temp temp displacement ADD
+    temp dst 3 alien@ STW
+
+    ! Compute address
+    temp base 4 alien@ LWZ
+    temp temp displacement ADD
+    temp dst 4 alien@ STW ;
+
+:: %box-displaced-alien/byte-array ( dst displacement base temp -- )
+    base dst 1 alien@ STW
+    displacement dst 3 alien@ STW
+    temp base byte-array-offset ADDI
+    temp temp displacement ADD
+    temp dst 4 alien@ STW ;
+
+:: %box-displaced-alien/dynamic ( dst displacement base temp -- )
+    "not-f" define-label
+    "not-alien" define-label
+
+    ! Is base f?
+    0 base \ f type-number CMPI
+    "not-f" get BNE
+
+    ! Yes, it is f. Fill in new object
+    dst displacement base %box-displaced-alien/f
+
+    "end" get B
+
+    "not-f" resolve-label
+
+    ! Check base type
+    temp base tag-mask get ANDI
+
+    ! Is base an alien?
+    0 temp alien type-number CMPI
+    "not-alien" get BNE
+
+    dst displacement base temp %box-displaced-alien/alien
+
+    ! We are done
+    "end" get B
+
+    ! Is base a byte array? It has to be, by now...
+    "not-alien" resolve-label
+
+    dst displacement base temp %box-displaced-alien/byte-array ;
+
 M:: ppc %box-displaced-alien ( dst displacement base temp base-class -- )
     ! This is ridiculous
     [
         "end" define-label
-        "not-f" define-label
-        "not-alien" define-label
 
         ! If displacement is zero, return the base
         dst base MR
@@ -316,76 +359,94 @@ M:: ppc %box-displaced-alien ( dst displacement base temp base-class -- )
         temp \ f type-number %load-immediate
         temp dst 2 alien@ STW
 
-        ! Is base f?
-        0 base \ f type-number CMPI
-        "not-f" get BNE
-
-        ! Yes, it is f. Fill in new object
-        base dst 1 alien@ STW
-        displacement dst 3 alien@ STW
-        displacement dst 4 alien@ STW
-
-        "end" get B
-
-        "not-f" resolve-label
-
-        ! Check base type
-        temp base tag-mask get ANDI
-
-        ! Is base an alien?
-        0 temp alien type-number CMPI
-        "not-alien" get BNE
-
-        ! Yes, it is an alien. Set new alien's base to base.base
-        temp base 1 alien@ LWZ
-        temp dst 1 alien@ STW
-
-        ! Compute displacement
-        temp base 3 alien@ LWZ
-        temp temp displacement ADD
-        temp dst 3 alien@ STW
-
-        ! Compute address
-        temp base 4 alien@ LWZ
-        temp temp displacement ADD
-        temp dst 4 alien@ STW
-
-        ! We are done
-        "end" get B
-
-        ! Is base a byte array? It has to be, by now...
-        "not-alien" resolve-label
-
-        base dst 1 alien@ STW
-        displacement dst 3 alien@ STW
-        temp base byte-array-offset ADDI
-        temp temp displacement ADD
-        temp dst 4 alien@ STW
+        dst displacement base temp
+        {
+            { [ base-class \ f class<= ] [ drop %box-displaced-alien/f ] }
+            { [ base-class \ alien class<= ] [ %box-displaced-alien/alien ] }
+            { [ base-class \ byte-array class<= ] [ %box-displaced-alien/byte-array ] }
+            [ %box-displaced-alien/dynamic ]
+        } cond
 
         "end" resolve-label
     ] with-scope ;
 
-M: ppc %alien-unsigned-1 LBZ ;
-M: ppc %alien-unsigned-2 LHZ ;
-
-M: ppc %alien-signed-1 [ dup ] 2dip LBZ dup EXTSB ;
-M: ppc %alien-signed-2 LHA ;
-
-M: ppc %alien-cell LWZ ;
+: (%memory) ( val base displacement scale offset rep c-type -- base val displacement rep c-type )
+    [ [ 0 assert= ] bi@ swapd ] 2dip ; inline
 
-M: ppc %alien-float LFS ;
-M: ppc %alien-double LFD ;
+M: ppc %load-memory-imm ( dst base offset rep c-type -- )
+    [
+        {
+            { c:char   [ [ dup ] 2dip LBZ dup EXTSB ] }
+            { c:uchar  [ LBZ ] }
+            { c:short  [ LHA ] }
+            { c:ushort [ LHZ ] }
+            { c:int    [ LWZ ] }
+            { c:uint   [ LWZ ] }
+        } case
+    ] [
+        {
+            { int-rep [ LWZ ] }
+            { float-rep [ LFS ] }
+            { double-rep [ LFD ] }
+        } case
+    ] ?if ;
 
-M: ppc %set-alien-integer-1 -rot STB ;
-M: ppc %set-alien-integer-2 -rot STH ;
+M: ppc %load-memory ( dst base displacement scale offset rep c-type -- )
+    (%memory) [
+        {
+            { c:char   [ [ LBZX ] [ drop dup EXTSB ] 2bi ] }
+            { c:uchar  [ LBZX ] }
+            { c:short  [ LHAX ] }
+            { c:ushort [ LHZX ] }
+            { c:int    [ LWZX ] }
+            { c:uint   [ LWZX ] }
+        } case
+    ] [
+        {
+            { int-rep [ LWZX ] }
+            { float-rep [ LFSX ] }
+            { double-rep [ LFDX ] }
+        } case
+    ] ?if ;
 
-M: ppc %set-alien-cell -rot STW ;
+M: ppc %store-memory-imm ( src base offset rep c-type -- )
+    [
+        {
+            { c:char   [ STB ] }
+            { c:uchar  [ STB ] }
+            { c:short  [ STH ] }
+            { c:ushort [ STH ] }
+            { c:int    [ STW ] }
+            { c:uint   [ STW ] }
+        } case
+    ] [
+        {
+            { int-rep [ STW ] }
+            { float-rep [ STFS ] }
+            { double-rep [ STFD ] }
+        } case
+    ] ?if ;
 
-M: ppc %set-alien-float -rot STFS ;
-M: ppc %set-alien-double -rot STFD ;
+M: ppc %store-memory ( src base displacement scale offset rep c-type -- )
+    (%memory) [
+        {
+            { c:char   [ STBX ] }
+            { c:uchar  [ STBX ] }
+            { c:short  [ STHX ] }
+            { c:ushort [ STHX ] }
+            { c:int    [ STWX ] }
+            { c:uint   [ STWX ] }
+        } case
+    ] [
+        {
+            { int-rep [ STWX ] }
+            { float-rep [ STFSX ] }
+            { double-rep [ STFDX ] }
+        } case
+    ] ?if ;
 
 : load-zone-ptr ( reg -- )
-    "nursery" %vm-field-ptr ;
+    vm-reg "nursery" vm-field-offset ADDI ;
 
 : load-allot-ptr ( nursery-ptr allot-ptr -- )
     [ drop load-zone-ptr ] [ swap 0 LWZ ] 2bi ;
@@ -426,33 +487,32 @@ M:: ppc %allot ( dst size class nursery-ptr -- )
     temp2 load-decks-offset
     temp1 scratch-reg temp2 STBX ;
 
-M:: ppc %write-barrier ( src slot temp1 temp2 -- )
+M:: ppc %write-barrier ( src slot scale tag temp1 temp2 -- )
+    scale 0 assert= tag 0 assert=
     temp1 src slot ADD
     temp1 temp2 (%write-barrier) ;
 
-M:: ppc %write-barrier-imm ( src slot temp1 temp2 -- )
-    temp1 src slot ADDI
+M:: ppc %write-barrier-imm ( src slot tag temp1 temp2 -- )
+    temp1 src slot tag slot-offset ADDI
     temp1 temp2 (%write-barrier) ;
 
-M:: ppc %check-nursery ( label size temp1 temp2 -- )
-    temp2 load-zone-ptr
-    temp1 temp2 0 LWZ
-    temp2 temp2 2 cells LWZ
+M:: ppc %check-nursery-branch ( label size cc temp1 temp2 -- )
+    temp1 vm-reg "nursery" vm-field-offset LWZ
+    temp2 vm-reg "nursery" vm-field-offset 2 cells + LWZ
     temp1 temp1 size ADDI
     ! is here >= end?
     temp1 0 temp2 CMP
-    label BLE ;
-
-M:: ppc %save-gc-root ( gc-root register -- )
-    register 1 gc-root gc-root@ STW ;
+    cc {
+        { cc<= [ label BLE ] }
+        { cc/<= [ label BGT ] }
+    } case ;
 
-M:: ppc %load-gc-root ( gc-root register -- )
-    register 1 gc-root gc-root@ LWZ ;
+: gc-root-offsets ( seq -- seq' )
+    [ n>> spill@ ] map f like ;
 
-M:: ppc %call-gc ( gc-root-count temp -- )
-    3 1 gc-root-base local@ ADDI
-    gc-root-count 4 LI
-    5 %load-vm-addr
+M: ppc %call-gc ( gc-roots -- )
+    3 swap gc-root-offsets %load-reference
+    4 %load-vm-addr
     "inline_gc" f %alien-invoke ;
 
 M: ppc %prologue ( n -- )
@@ -494,9 +554,18 @@ M: ppc %epilogue ( n -- )
     } case ;
 
 : (%compare) ( src1 src2 -- ) [ 0 ] dip CMP ; inline
-: (%compare-imm) ( src1 src2 -- ) [ 0 ] 2dip CMPI ; inline
-: (%compare-float-unordered) ( src1 src2 -- ) [ 0 ] dip FCMPU ; inline
-: (%compare-float-ordered) ( src1 src2 -- ) [ 0 ] dip FCMPO ; inline
+
+: (%compare-integer-imm) ( src1 src2 -- )
+    [ 0 ] 2dip CMPI ; inline
+
+: (%compare-imm) ( src1 src2 -- )
+    [ tag-fixnum ] [ \ f type-number ] if* (%compare-integer-imm) ; inline
+
+: (%compare-float-unordered) ( src1 src2 -- )
+    [ 0 ] dip FCMPU ; inline
+
+: (%compare-float-ordered) ( src1 src2 -- )
+    [ 0 ] dip FCMPO ; inline
 
 :: (%compare-float) ( src1 src2 cc compare -- branch1 branch2 )
     cc {
@@ -520,6 +589,8 @@ M: ppc %compare [ (%compare) ] 2dip %boolean ;
 
 M: ppc %compare-imm [ (%compare-imm) ] 2dip %boolean ;
 
+M: ppc %compare-integer-imm [ (%compare-integer-imm) ] 2dip %boolean ;
+
 M:: ppc %compare-float-ordered ( dst src1 src2 cc temp -- )
     src1 src2 cc negate-cc \ (%compare-float-ordered) (%compare-float) :> ( branch1 branch2 )
     dst temp branch1 branch2 (%boolean) ;
@@ -546,6 +617,10 @@ M:: ppc %compare-imm-branch ( label src1 src2 cc -- )
     src1 src2 (%compare-imm)
     label cc %branch ;
 
+M:: ppc %compare-integer-imm-branch ( label src1 src2 cc -- )
+    src1 src2 (%compare-integer-imm)
+    label cc %branch ;
+
 :: (%branch) ( label branch1 branch2 -- )
     label branch1 execute( label -- )
     branch2 [ label branch2 execute( label -- ) ] when ; inline
@@ -561,18 +636,19 @@ M:: ppc %compare-float-unordered-branch ( label src1 src2 cc -- )
 : load-from-frame ( dst n rep -- )
     {
         { int-rep [ [ 1 ] dip LWZ ] }
+        { tagged-rep [ [ 1 ] dip LWZ ] }
         { float-rep [ [ 1 ] dip LFS ] }
         { double-rep [ [ 1 ] dip LFD ] }
         { stack-params [ [ 0 1 ] dip LWZ [ 0 1 ] dip param@ STW ] }
     } case ;
 
 : next-param@ ( n -- reg x )
-    2 1 stack-frame get total-size>> LWZ
-    [ 2 ] dip param@ ;
+    [ 17 ] dip param@ ;
 
 : store-to-frame ( src n rep -- )
     {
         { int-rep [ [ 1 ] dip STW ] }
+        { tagged-rep [ [ 1 ] dip STW ] }
         { float-rep [ [ 1 ] dip STFS ] }
         { double-rep [ [ 1 ] dip STFD ] }
         { stack-params [ [ [ 0 ] dip next-param@ LWZ 0 1 ] dip STW ] }
@@ -586,9 +662,11 @@ M: ppc %reload ( dst rep src -- )
 
 M: ppc %loop-entry ;
 
-M: int-regs return-reg drop 3 ;
-M: int-regs param-regs drop { 3 4 5 6 7 8 9 10 } ;
-M: float-regs return-reg drop 1 ;
+M: ppc return-regs
+    {
+        { int-regs { 3 4 5 6 } }
+        { float-regs { 1 } }
+    } ;
 
 M:: ppc %save-param-reg ( stack reg rep -- )
     reg stack local@ rep store-to-frame ;
@@ -596,69 +674,56 @@ M:: ppc %save-param-reg ( stack reg rep -- )
 M:: ppc %load-param-reg ( stack reg rep -- )
     reg stack local@ rep load-from-frame ;
 
-M: ppc %pop-stack ( n -- )
-    [ 3 ] dip <ds-loc> loc>operand LWZ ;
-
-M: ppc %push-stack ( -- )
-    ds-reg ds-reg 4 ADDI
-    int-regs return-reg ds-reg 0 STW ;
-
-M: ppc %push-context-stack ( -- )
-    11 "ctx" %vm-field
-    12 11 "datastack" context-field-offset LWZ
-    12 12 4 ADDI
-    12 11 "datastack" context-field-offset STW
-    int-regs return-reg 12 0 STW ;
-
-M: ppc %pop-context-stack ( -- )
-    11 "ctx" %vm-field
-    12 11 "datastack" context-field-offset LWZ
-    int-regs return-reg 12 0 LWZ
-    12 12 4 SUBI
-    12 11 "datastack" context-field-offset STW ;
-
-M: ppc %unbox ( n rep func -- )
-    ! Value must be in r3
-    4 %load-vm-addr
-    ! Call the unboxer
-    f %alien-invoke
-    ! Store the return value on the C stack
-    over [ [ reg-class-of return-reg ] keep %save-param-reg ] [ 2drop ] if ;
+GENERIC: load-param ( reg src -- )
+
+M: integer load-param int-rep %copy ;
+
+M: spill-slot load-param [ 1 ] dip n>> spill@ LWZ ;
 
-M: ppc %unbox-long-long ( n func -- )
+GENERIC: store-param ( reg dst -- )
+
+M: integer store-param swap int-rep %copy ;
+
+M: spill-slot store-param [ 1 ] dip n>> spill@ STW ;
+
+:: call-unbox-func ( src func -- )
+    3 src load-param
     4 %load-vm-addr
-    ! Call the unboxer
-    f %alien-invoke
-    ! Store the return value on the C stack
-    [
-        [ [ 3 1 ] dip local@ STW ]
-        [ [ 4 1 ] dip cell + local@ STW ] bi
-    ] when* ;
+    func f %alien-invoke ;
 
-M: ppc %unbox-large-struct ( n c-type -- )
-    ! Value must be in r3
-    ! Compute destination address and load struct size
-    [ [ 4 1 ] dip local@ ADDI ] [ heap-size 5 LI ] bi*
-    6 %load-vm-addr
-    ! Call the function
-    "to_value_struct" f %alien-invoke ;
+M:: ppc %unbox ( src n rep func -- )
+    src func call-unbox-func
+    ! Store the return value on the C stack
+    n [ rep reg-class-of return-regs at first rep %save-param-reg ] when* ;
 
-M:: ppc %box ( n rep func -- )
-    ! If the source is a stack location, load it into freg #0.
-    ! If the source is f, then we assume the value is already in
-    ! freg #0.
-    n [ 0 rep reg-class-of param-reg rep %load-param-reg ] when*
+M:: ppc %unbox-long-long ( src n func -- )
+    src func call-unbox-func
+    ! Store the return value on the C stack
+    n [
+        3 1 n local@ STW
+        4 1 n cell + local@ STW
+    ] when ;
+
+M:: ppc %unbox-large-struct ( src n c-type -- )
+    4 src load-param
+    3 1 n local@ ADDI
+    c-type heap-size 5 LI
+    "memcpy" "libc" load-library %alien-invoke ;
+
+M:: ppc %box ( dst n rep func -- )
+    n [ 0 rep reg-class-of cdecl param-reg rep %load-param-reg ] when*
     rep double-rep? 5 4 ? %load-vm-addr
-    func f %alien-invoke ;
+    func f %alien-invoke
+    3 dst store-param ;
 
-M: ppc %box-long-long ( n func -- )
-    [
-        [
-            [ [ 3 1 ] dip local@ LWZ ]
-            [ [ 4 1 ] dip cell + local@ LWZ ] bi
-        ] when*
-        5 %load-vm-addr
-    ] dip f %alien-invoke ;
+M:: ppc %box-long-long ( dst n func -- )
+    [
+        3 1 n local@ LWZ
+        4 1 n cell + local@ LWZ
+    ] when
+    5 %load-vm-addr
+    func f %alien-invoke
+    3 dst store-param ;
 
 : struct-return@ ( n -- n )
     [ stack-frame get params>> ] unless* local@ ;
@@ -668,23 +733,23 @@ M: ppc %prepare-box-struct ( -- )
     3 1 f struct-return@ ADDI
     3 1 0 local@ STW ;
 
-M: ppc %box-large-struct ( n c-type -- )
+M:: ppc %box-large-struct ( dst n c-type -- )
     ! If n = f, then we're boxing a returned struct
     ! Compute destination address and load struct size
-    [ [ 3 1 ] dip struct-return@ ADDI ] [ heap-size 4 LI ] bi*
+    3 1 n struct-return@ ADDI
+    c-type heap-size 4 LI
     5 %load-vm-addr
     ! Call the function
-    "from_value_struct" f %alien-invoke ;
+    "from_value_struct" f %alien-invoke
+    3 dst store-param ;
 
 M:: ppc %restore-context ( temp1 temp2 -- )
-    temp1 "ctx" %vm-field
-    temp2 1 stack-frame get total-size>> ADDI
-    temp2 temp1 "callstack-bottom" context-field-offset STW
+    temp1 %context
     ds-reg temp1 "datastack" context-field-offset LWZ
     rs-reg temp1 "retainstack" context-field-offset LWZ ;
 
 M:: ppc %save-context ( temp1 temp2 -- )
-    temp1 "ctx" %vm-field
+    temp1 %context
     1 temp1 "callstack-top" context-field-offset STW
     ds-reg temp1 "datastack" context-field-offset STW
     rs-reg temp1 "retainstack" context-field-offset STW ;
@@ -692,85 +757,62 @@ M:: ppc %save-context ( temp1 temp2 -- )
 M: ppc %alien-invoke ( symbol dll -- )
     [ 11 ] 2dip %alien-global 11 MTLR BLRL ;
 
-M: ppc %alien-callback ( quot -- )
-    3 4 %restore-context
-    3 swap %load-reference
-    4 3 quot-entry-point-offset LWZ
-    4 MTLR
-    BLRL
-    3 4 %save-context ;
-
-M: ppc %prepare-alien-indirect ( -- )
-    3 ds-reg 0 LWZ
-    ds-reg ds-reg 4 SUBI
-    4 %load-vm-addr
-    "pinned_alien_offset" f %alien-invoke
-    16 3 MR ;
-
-M: ppc %alien-indirect ( -- )
-    16 MTLR BLRL ;
-
-M: ppc %callback-value ( ctype -- )
-    ! Save top of data stack
-    3 ds-reg 0 LWZ
-    3 1 0 local@ STW
-    3 %load-vm-addr
-    ! Restore data/call/retain stacks
-    "unnest_stacks" f %alien-invoke
-    ! Restore top of data stack
-    3 1 0 local@ LWZ
-    ! Unbox former top of data stack to return registers
-    unbox-return ;
+M: ppc %alien-indirect ( src -- )
+    [ 11 ] dip load-param 11 MTLR BLRL ;
 
 M: ppc immediate-arithmetic? ( n -- ? ) -32768 32767 between? ;
 
 M: ppc immediate-bitwise? ( n -- ? ) 0 65535 between? ;
 
+M: ppc immediate-store? drop f ;
+
 M: ppc return-struct-in-registers? ( c-type -- ? )
     c-type return-in-registers?>> ;
 
-M: ppc %box-small-struct ( c-type -- )
+M:: ppc %box-small-struct ( dst c-type -- )
     #! Box a <= 16-byte struct returned in r3:r4:r5:r6
-    heap-size 7 LI
+    c-type heap-size 7 LI
     8 %load-vm-addr
-    "from_medium_struct" f %alien-invoke ;
+    "from_medium_struct" f %alien-invoke
+    3 dst store-param ;
 
 : %unbox-struct-1 ( -- )
     ! Alien must be in r3.
-    4 %load-vm-addr
-    "alien_offset" f %alien-invoke
     3 3 0 LWZ ;
 
 : %unbox-struct-2 ( -- )
     ! Alien must be in r3.
-    4 %load-vm-addr
-    "alien_offset" f %alien-invoke
     4 3 4 LWZ
     3 3 0 LWZ ;
 
 : %unbox-struct-4 ( -- )
     ! Alien must be in r3.
-    4 %load-vm-addr
-    "alien_offset" f %alien-invoke
     6 3 12 LWZ
     5 3 8 LWZ
     4 3 4 LWZ
     3 3 0 LWZ ;
 
-M: ppc %nest-stacks ( -- )
-    3 %load-vm-addr
-    "nest_stacks" f %alien-invoke ;
+M:: ppc %unbox-small-struct ( src c-type -- )
+    src 3 load-param
+    c-type heap-size {
+        { [ dup 4 <= ] [ drop %unbox-struct-1 ] }
+        { [ dup 8 <= ] [ drop %unbox-struct-2 ] }
+        { [ dup 16 <= ] [ drop %unbox-struct-4 ] }
+    } cond ;
 
-M: ppc %unnest-stacks ( -- )
+M: ppc %begin-callback ( -- )
     3 %load-vm-addr
-    "unnest_stacks" f %alien-invoke ;
+    "begin_callback" f %alien-invoke ;
 
-M: ppc %unbox-small-struct ( size -- )
-    heap-size cell align cell /i {
-        { 1 [ %unbox-struct-1 ] }
-        { 2 [ %unbox-struct-2 ] }
-        { 4 [ %unbox-struct-4 ] }
-    } case ;
+M: ppc %alien-callback ( quot -- )
+    3 swap %load-reference
+    4 3 quot-entry-point-offset LWZ
+    4 MTLR
+    BLRL ;
+
+M: ppc %end-callback ( -- )
+    3 %load-vm-addr
+    "end_callback" f %alien-invoke ;
 
 enable-float-functions
 
index 6c8f59c757453ea3c27b684163949b99832c84f3..f5bb856b538e8f9c03a89961df7cd59365313e8c 100644 (file)
@@ -1,2 +1,2 @@
 compiler
-untested
+not loaded
index bc07e3a25bfa4e9f2132db3fcb5baf477b63504c..375374806fbe72ce01b19f3a8aa0a15944616262 100644 (file)
@@ -2,6 +2,6 @@ IN: cpu.x86.32.tests
 USING: alien alien.c-types tools.test cpu.x86.assembler
 cpu.x86.assembler.operands ;
 
-: assembly-test-1 ( -- x ) int { } "cdecl" [ EAX 3 MOV ] alien-assembly ;
+: assembly-test-1 ( -- x ) int { } cdecl [ EAX 3 MOV ] alien-assembly ;
 
 [ 3 ] [ assembly-test-1 ] unit-test
index b8b621ee11eee419c3d21bad2a8a9c218ada3a16..481293759701a565c89a8a5d1fc8e9a73a734c9c 100755 (executable)
@@ -1,42 +1,48 @@
 ! Copyright (C) 2005, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: locals alien.c-types alien.libraries alien.syntax arrays
-kernel fry math namespaces sequences system layouts io
-vocabs.loader accessors init combinators command-line make
-compiler compiler.units compiler.constants compiler.alien
-compiler.codegen compiler.codegen.fixup
+USING: locals alien alien.c-types alien.libraries alien.syntax
+arrays kernel fry math namespaces sequences system layouts io
+vocabs.loader accessors init classes.struct combinators make
+words compiler.constants compiler.codegen.fixup
 compiler.cfg.instructions compiler.cfg.builder
-compiler.cfg.intrinsics compiler.cfg.stack-frame
-cpu.x86.assembler cpu.x86.assembler.operands cpu.x86
-cpu.architecture vm ;
+compiler.cfg.builder.alien.boxing compiler.cfg.intrinsics
+compiler.cfg.stack-frame cpu.x86.assembler
+cpu.x86.assembler.operands cpu.x86 cpu.architecture vm vocabs ;
 FROM: layouts => cell ;
 IN: cpu.x86.32
 
+: x86-float-regs ( -- seq )
+    "cpu.x86.sse" vocab
+    { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 }
+    { ST0 ST1 ST2 ST3 ST4 ST5 ST6 }
+    ? ;
+
 M: x86.32 machine-registers
-    {
-        { int-regs { EAX ECX EDX EBP EBX } }
-        { float-regs { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } }
-    } ;
+    { int-regs { EAX ECX EDX EBP EBX } }
+    float-regs x86-float-regs 2array
+    2array ;
 
 M: x86.32 ds-reg ESI ;
 M: x86.32 rs-reg EDI ;
 M: x86.32 stack-reg ESP ;
 M: x86.32 frame-reg EBP ;
-M: x86.32 temp-reg ECX ;
+
+M: x86.32 immediate-comparand? ( obj -- ? ) drop t ;
+
+M:: x86.32 %load-vector ( dst val rep -- )
+    dst 0 [] rep copy-memory* val rc-absolute rel-binary-literal ;
 
 M: x86.32 %mov-vm-ptr ( reg -- )
     0 MOV 0 rc-absolute-cell rel-vm ;
 
 M: x86.32 %vm-field ( dst field -- )
-    [ 0 [] MOV ] dip vm-field-offset rc-absolute-cell rel-vm ;
-
-M: x86.32 %vm-field-ptr ( dst field -- )
-    [ 0 MOV ] dip vm-field-offset rc-absolute-cell rel-vm ;
+    [ 0 [] MOV ] dip rc-absolute-cell rel-vm ;
 
-: local@ ( n -- op )
-    stack-frame get extra-stack-space dup 16 assert= + stack@ ;
+M: x86.32 %set-vm-field ( dst field -- )
+    [ 0 [] swap MOV ] dip rc-absolute-cell rel-vm ;
 
-M: x86.32 extra-stack-space calls-vm?>> 16 0 ? ;
+M: x86.32 %vm-field-ptr ( dst field -- )
+    [ 0 MOV ] dip rc-absolute-cell rel-vm ;
 
 M: x86.32 %mark-card
     drop HEX: ffffffff [+] card-mark <byte> MOV
@@ -59,16 +65,16 @@ M:: x86.32 %dispatch ( src temp -- )
     temp HEX: 7f [+] JMP
     building get length :> end
     ! Fix up the displacement above
-    cell code-alignment
+    cell alignment
     [ end start - + building get dup pop* push ]
-    [ align-code ]
+    [ (align-code) ]
     bi ;
 
-M: x86.32 pic-tail-reg EBX ;
+M: x86.32 pic-tail-reg EDX ;
 
-M: x86.32 reserved-stack-space 4 cells ;
+M: x86.32 reserved-stack-space 0 ;
 
-M: x86.32 %alien-invoke 0 CALL rc-relative rel-dlsym ;
+M: x86.32 vm-stack-space 16 ;
 
 : save-vm-ptr ( n -- )
     stack@ 0 MOV 0 rc-absolute-cell rel-vm ;
@@ -80,25 +86,21 @@ M: x86.32 return-struct-in-registers? ( c-type -- ? )
     os { linux netbsd solaris } member? not
     and or ;
 
-: struct-return@ ( n -- operand )
-    [ next-stack@ ] [ stack-frame get params>> local@ ] if* ;
-
-! On x86, parameters are never passed in registers.
-M: int-regs return-reg drop EAX ;
-M: int-regs param-regs drop { } ;
-M: float-regs param-regs drop { } ;
-
-GENERIC: load-return-reg ( src rep -- )
-GENERIC: store-return-reg ( dst rep -- )
-
-M: int-rep load-return-reg drop EAX swap MOV ;
-M: int-rep store-return-reg drop EAX MOV ;
-
-M: float-rep load-return-reg drop FLDS ;
-M: float-rep store-return-reg drop FSTPS ;
+! On x86, parameters are usually never passed in registers,
+! except with Microsoft's "thiscall" and "fastcall" abis
+M: x86.32 param-regs
+    {
+        { thiscall [ { { int-regs { ECX } } { float-regs { } } } ] }
+        { fastcall [ { { int-regs { ECX EDX } } { float-regs { } } } ] }
+        [ drop { { int-regs { } } { float-regs { } } } ]
+    } case ;
 
-M: double-rep load-return-reg drop FLDL ;
-M: double-rep store-return-reg drop FSTPL ;
+! Need a fake return-reg for floats
+M: x86.32 return-regs
+    {
+        { int-regs { EAX EDX } }
+        { float-regs { ST0 } }
+    } ;
 
 M: x86.32 %prologue ( n -- )
     dup PUSH
@@ -108,217 +110,138 @@ M: x86.32 %prologue ( n -- )
 M: x86.32 %prepare-jump
     pic-tail-reg 0 MOV xt-tail-pic-offset rc-absolute-cell rel-here ;
 
-M: x86.32 %load-param-reg
-    stack-params assert=
-    [ [ EAX ] dip local@ MOV ] dip
-    stack@ EAX MOV ;
-
-M: x86.32 %save-param-reg 3drop ;
+:: load-float-return ( dst x87-insn rep -- )
+    dst register? [
+        ESP 4 SUB
+        ESP [] x87-insn execute
+        dst ESP [] rep %copy
+        ESP 4 ADD
+    ] [
+        dst ?spill-slot x87-insn execute
+    ] if ; inline
+
+M: x86.32 %load-reg-param ( dst reg rep -- )
+    {
+        { int-rep [ int-rep %copy ] }
+        { float-rep [ drop \ FSTPS float-rep load-float-return ] }
+        { double-rep [ drop \ FSTPL double-rep load-float-return ] }
+    } case ;
 
-: (%box) ( n rep -- )
-    #! If n is f, push the return register onto the stack; we
-    #! are boxing a return value of a C function. If n is an
-    #! integer, push [ESP+n] on the stack; we are boxing a
-    #! parameter being passed to a callback from C.
-    over [ [ next-stack@ ] dip load-return-reg ] [ 2drop ] if ;
+:: store-float-return ( src x87-insn rep -- )
+    src register? [
+        ESP 4 SUB
+        ESP [] src rep %copy
+        ESP [] x87-insn execute
+        ESP 4 ADD
+    ] [
+        src ?spill-slot x87-insn execute
+    ] if ; inline
+
+M: x86.32 %store-reg-param ( src reg rep -- )
+    {
+        { int-rep [ swap int-rep %copy ] }
+        { float-rep [ drop \ FLDS float-rep store-float-return ] }
+        { double-rep [ drop \ FLDL double-rep store-float-return ] }
+    } case ;
 
-M:: x86.32 %box ( n rep func -- )
-    n rep (%box)
-    rep rep-size save-vm-ptr
-    0 stack@ rep store-return-reg
+:: call-unbox-func ( src func -- )
+    EAX src tagged-rep %copy
+    4 save-vm-ptr
+    0 stack@ EAX MOV
     func f %alien-invoke ;
 
-: (%box-long-long) ( n -- )
-    [
-        EDX over next-stack@ MOV
-        EAX swap cell - next-stack@ MOV 
-    ] when* ;
+M:: x86.32 %unbox ( dst src func rep -- )
+    src func call-unbox-func
+    dst rep %load-return ;
 
-M: x86.32 %box-long-long ( n func -- )
-    [ (%box-long-long) ] dip
-    8 save-vm-ptr
-    4 stack@ EDX MOV
+M:: x86.32 %unbox-long-long ( src out func -- )
+    EAX src int-rep %copy
     0 stack@ EAX MOV
-    f %alien-invoke ;
-
-M:: x86.32 %box-large-struct ( n c-type -- )
-    EDX n struct-return@ LEA
+    EAX out int-rep %copy
+    4 stack@ EAX MOV
     8 save-vm-ptr
-    4 stack@ c-type heap-size MOV
-    0 stack@ EDX MOV
-    "from_value_struct" f %alien-invoke ;
-
-M: x86.32 %prepare-box-struct ( -- )
-    ! Compute target address for value struct return
-    EAX f struct-return@ LEA
-    ! Store it as the first parameter
-    0 local@ EAX MOV ;
-
-M: x86.32 %box-small-struct ( c-type -- )
-    #! Box a <= 8-byte struct returned in EAX:EDX. OS X only.
-    12 save-vm-ptr
-    8 stack@ swap heap-size MOV
-    4 stack@ EDX MOV
-    0 stack@ EAX MOV
-    "from_small_struct" f %alien-invoke ;
-
-M: x86.32 %pop-stack ( n -- )
-    EAX swap ds-reg reg-stack MOV ;
+    func f %alien-invoke ;
 
-M: x86.32 %pop-context-stack ( -- )
-    temp-reg "ctx" %vm-field
-    EAX temp-reg "datastack" context-field-offset [+] MOV
-    EAX EAX [] MOV
-    temp-reg "datastack" context-field-offset [+] bootstrap-cell SUB ;
+M:: x86.32 %box ( dst src func rep -- )
+    rep rep-size save-vm-ptr
+    src rep %store-return
+    0 stack@ rep %load-return
+    func f %alien-invoke
+    dst EAX tagged-rep %copy ;
 
-: call-unbox-func ( func -- )
-    4 save-vm-ptr
-    0 stack@ EAX MOV
-    f %alien-invoke ;
-
-M: x86.32 %unbox ( n rep func -- )
-    #! The value being unboxed must already be in EAX.
-    #! If n is f, we're unboxing a return value about to be
-    #! returned by the callback. Otherwise, we're unboxing
-    #! a parameter to a C function about to be called.
-    call-unbox-func
-    ! Store the return value on the C stack
-    over [ [ local@ ] dip store-return-reg ] [ 2drop ] if ;
-
-M: x86.32 %unbox-long-long ( n func -- )
-    call-unbox-func
-    ! Store the return value on the C stack
-    [
-        [ local@ EAX MOV ]
-        [ 4 + local@ EDX MOV ] bi
-    ] when* ;
-
-: %unbox-struct-1 ( -- )
-    #! Alien must be in EAX.
+M:: x86.32 %box-long-long ( dst src1 src2 func -- )
+    8 save-vm-ptr
+    EAX src1 int-rep %copy
+    0 stack@ EAX int-rep %copy
+    EAX src2 int-rep %copy
+    4 stack@ EAX int-rep %copy
+    func f %alien-invoke
+    dst EAX tagged-rep %copy ;
+
+M:: x86.32 %allot-byte-array ( dst size -- )
     4 save-vm-ptr
-    0 stack@ EAX MOV
-    "alien_offset" f %alien-invoke
-    ! Load first cell
-    EAX EAX [] MOV ;
+    0 stack@ size MOV
+    "allot_byte_array" f %alien-invoke
+    dst EAX tagged-rep %copy ;
 
-: %unbox-struct-2 ( -- )
-    #! Alien must be in EAX.
-    4 save-vm-ptr
-    0 stack@ EAX MOV
-    "alien_offset" f %alien-invoke
-    ! Load second cell
-    EDX EAX 4 [+] MOV
-    ! Load first cell
-    EAX EAX [] MOV ;
-
-M: x86 %unbox-small-struct ( size -- )
-    #! Alien must be in EAX.
-    heap-size cell align cell /i {
-        { 1 [ %unbox-struct-1 ] }
-        { 2 [ %unbox-struct-2 ] }
-    } case ;
-
-M:: x86.32 %unbox-large-struct ( n c-type -- )
-    ! Alien must be in EAX.
-    ! Compute destination address
-    EDX n local@ LEA
-    12 save-vm-ptr
-    8 stack@ c-type heap-size MOV
-    4 stack@ EDX MOV
-    0 stack@ EAX MOV
-    "to_value_struct" f %alien-invoke ;
-
-M: x86.32 %nest-stacks ( -- )
-    0 save-vm-ptr
-    "nest_stacks" f %alien-invoke ;
+M: x86.32 %alien-invoke 0 CALL rc-relative rel-dlsym ;
 
-M: x86.32 %unnest-stacks ( -- )
+M: x86.32 %begin-callback ( -- )
     0 save-vm-ptr
-    "unnest_stacks" f %alien-invoke ;
-
-M: x86.32 %prepare-alien-indirect ( -- )
-    EAX ds-reg [] MOV
-    ds-reg 4 SUB
-    4 save-vm-ptr
-    0 stack@ EAX MOV
-    "pinned_alien_offset" f %alien-invoke
-    EBP EAX MOV ;
-
-M: x86.32 %alien-indirect ( -- )
-    EBP CALL ;
+    4 stack@ 0 MOV
+    "begin_callback" f %alien-invoke ;
 
 M: x86.32 %alien-callback ( quot -- )
-    EAX EDX %restore-context
-    EAX swap %load-reference
-    EAX quot-entry-point-offset [+] CALL
-    EAX EDX %save-context ;
+    [ EAX ] dip %load-reference
+    EAX quot-entry-point-offset [+] CALL ;
 
-M: x86.32 %callback-value ( ctype -- )
-    %pop-context-stack
-    4 stack@ EAX MOV
+M: x86.32 %end-callback ( -- )
     0 save-vm-ptr
-    ! Restore data/call/retain stacks
-    "unnest_stacks" f %alien-invoke
-    ! Place former top of data stack back in EAX
-    EAX 4 stack@ MOV
-    ! Unbox EAX
-    unbox-return ;
+    "end_callback" f %alien-invoke ;
 
-GENERIC: float-function-param ( stack-slot dst src -- )
+GENERIC: float-function-param ( n dst src -- )
 
-M:: spill-slot float-function-param ( stack-slot dst src -- )
+M:: spill-slot float-function-param ( n dst src -- )
     ! We can clobber dst here since its going to contain the
     ! final result
     dst src double-rep %copy
-    stack-slot dst double-rep %copy ;
+    dst n double-rep %store-stack-param ;
 
-M: register float-function-param
-    nip double-rep %copy ;
-
-: float-function-return ( reg -- )
-    ESP [] FSTPL
-    ESP [] MOVSD
-    ESP 16 ADD ;
+M:: register float-function-param ( n dst src -- )
+    src n double-rep %store-stack-param ;
 
 M:: x86.32 %unary-float-function ( dst src func -- )
-    ESP -16 [+] dst src float-function-param
-    ESP 16 SUB
+    0 dst src float-function-param
     func "libm" load-library %alien-invoke
-    dst float-function-return ;
+    dst double-rep %load-return ;
 
 M:: x86.32 %binary-float-function ( dst src1 src2 func -- )
-    ESP -16 [+] dst src1 float-function-param
-    ESP  -8 [+] dst src2 float-function-param
-    ESP 16 SUB
+    0 dst src1 float-function-param
+    8 dst src2 float-function-param
     func "libm" load-library %alien-invoke
-    dst float-function-return ;
-
-: stdcall? ( params -- ? )
-    abi>> "stdcall" = ;
+    dst double-rep %load-return ;
 
-: funny-large-struct-return? ( params -- ? )
+: funny-large-struct-return? ( return abi -- ? )
     #! MINGW ABI incompatibility disaster
-    [ return>> large-struct? ]
-    [ abi>> "mingw" = os windows? not or ]
-    bi and ;
-
-M: x86.32 %cleanup ( params -- )
-    #! a) If we just called an stdcall function in Windows, it
-    #! cleaned up the stack frame for us. But we don't want that
-    #! so we 'undo' the cleanup since we do that in %epilogue.
-    #! b) If we just called a function returning a struct, we
-    #! have to fix ESP.
+    [ large-struct? ] [ mingw eq? os windows? not or ] bi* and ;
+
+M:: x86.32 stack-cleanup ( stack-size return abi -- n )
+    #! a) Functions which are stdcall/fastcall/thiscall have to
+    #! clean up the caller's stack frame.
+    #! b) Functions returning large structs on MINGW have to
+    #! fix ESP.
     {
-        { [ dup stdcall? ] [ drop ESP stack-frame get params>> SUB ] }
-        { [ dup funny-large-struct-return? ] [ drop EAX PUSH ] }
-        [ drop ]
+        { [ abi callee-cleanup? ] [ stack-size ] }
+        { [ return abi funny-large-struct-return? ] [ 4 ] }
+        [ 0 ]
     } cond ;
 
-M:: x86.32 %call-gc ( gc-root-count temp -- )
-    temp gc-root-base special@ LEA
-    8 save-vm-ptr
-    4 stack@ gc-root-count MOV
-    0 stack@ temp MOV
+M: x86.32 %cleanup ( n -- )
+    [ ESP swap SUB ] unless-zero ;
+
+M:: x86.32 %call-gc ( gc-roots -- )
+    4 save-vm-ptr
+    0 stack@ gc-roots gc-root-offsets %load-reference
     "inline_gc" f %alien-invoke ;
 
 M: x86.32 dummy-stack-params? f ;
@@ -327,18 +250,13 @@ M: x86.32 dummy-int-params? f ;
 
 M: x86.32 dummy-fp-params? f ;
 
-M: x86.32 callback-return-rewind ( params -- n )
-    #! a) If the callback is stdcall, we have to clean up the
-    #! caller's stack frame.
-    #! b) If the callback is returning a large struct, we have
-    #! to fix ESP.
-    {
-        { [ dup stdcall? ] [ <alien-stack-frame> [ params>> ] [ return>> ] bi + ] }
-        { [ dup funny-large-struct-return? ] [ drop 4 ] }
-        [ drop 0 ]
-    } cond ;
+M: x86.32 long-long-on-stack? t ;
+
+M: x86.32 float-on-stack? t ;
+
+M: x86.32 flatten-struct-type
+    call-next-method [ first t 2array ] map ;
 
-! Dreadful
-M: object flatten-value-type (flatten-int-type) ;
+M: x86.32 struct-return-on-stack? os linux? not ;
 
 check-sse
index cf2d09501ccd1524010e520bdf56b5cb46978fdf..a52a3390acd150f9f999855e6b819004abafd2f1 100644 (file)
@@ -3,7 +3,7 @@
 USING: bootstrap.image.private kernel kernel.private namespaces
 system cpu.x86.assembler cpu.x86.assembler.operands layouts
 vocabs parser compiler.constants sequences math math.private
-generic.single.private ;
+generic.single.private threads.private ;
 IN: bootstrap.x86
 
 4 \ cell set
@@ -13,20 +13,24 @@ IN: bootstrap.x86
 : div-arg ( -- reg ) EAX ;
 : mod-arg ( -- reg ) EDX ;
 : temp0 ( -- reg ) EAX ;
-: temp1 ( -- reg ) EDX ;
-: temp2 ( -- reg ) ECX ;
-: temp3 ( -- reg ) EBX ;
-: safe-reg ( -- reg ) EAX ;
+: temp1 ( -- reg ) ECX ;
+: temp2 ( -- reg ) EBX ;
+: temp3 ( -- reg ) EDX ;
+: pic-tail-reg ( -- reg ) EDX ;
 : stack-reg ( -- reg ) ESP ;
 : frame-reg ( -- reg ) EBP ;
-: vm-reg ( -- reg ) ECX ;
+: vm-reg ( -- reg ) EBX ;
 : ctx-reg ( -- reg ) EBP ;
 : nv-regs ( -- seq ) { ESI EDI EBX } ;
+: nv-reg ( -- reg ) ESI ;
 : ds-reg ( -- reg ) ESI ;
 : rs-reg ( -- reg ) EDI ;
 : fixnum>slot@ ( -- ) temp0 2 SAR ;
 : rex-length ( -- n ) 0 ;
 
+: jit-call ( name -- )
+    0 CALL rc-relative jit-dlsym ;
+
 [
     ! save stack frame size
     stack-frame-size PUSH
@@ -37,7 +41,7 @@ IN: bootstrap.x86
 ] jit-prolog jit-define
 
 [
-    temp3 0 MOV rc-absolute-cell rt-here jit-rel
+    pic-tail-reg 0 MOV rc-absolute-cell rt-here jit-rel
     0 JMP rc-relative rt-entry-point-pic-tail jit-rel
 ] jit-word-jump jit-define
 
@@ -49,8 +53,9 @@ IN: bootstrap.x86
     ctx-reg vm-reg vm-context-offset [+] MOV ;
 
 : jit-save-context ( -- )
-    EDX RSP -4 [+] LEA
-    ctx-reg context-callstack-top-offset [+] EDX MOV
+    jit-load-context
+    ECX ESP -4 [+] LEA
+    ctx-reg context-callstack-top-offset [+] ECX MOV
     ctx-reg context-datastack-offset [+] ds-reg MOV
     ctx-reg context-retainstack-offset [+] rs-reg MOV ;
 
@@ -59,40 +64,59 @@ IN: bootstrap.x86
     rs-reg ctx-reg context-retainstack-offset [+] MOV ;
 
 [
+    ! ctx-reg is preserved across the call because it is non-volatile
+    ! in the C ABI
     jit-load-vm
-    jit-load-context
     jit-save-context
     ! call the primitive
     ESP [] vm-reg MOV
     0 CALL rc-relative rt-dlsym jit-rel
-    ! restore ds, rs registers
     jit-restore-context
 ] jit-primitive jit-define
 
+: jit-jump-quot ( -- )
+    EAX quot-entry-point-offset [+] JMP ;
+
+: jit-call-quot ( -- )
+    EAX quot-entry-point-offset [+] CALL ;
+
 [
-    ! Load quotation
+    jit-load-vm
+    ESP [] vm-reg MOV
     EAX EBP 8 [+] MOV
-    ! save ctx->callstack_bottom, load ds, rs registers
+    ESP 4 [+] EAX MOV
+    "begin_callback" jit-call
+
     jit-load-vm
     jit-load-context
     jit-restore-context
-    EDX stack-reg stack-frame-size 4 - [+] LEA
-    ctx-reg context-callstack-bottom-offset [+] EDX MOV
-    ! call the quotation
-    EAX quot-entry-point-offset [+] CALL
-    ! save ds, rs registers
+
+    jit-call-quot
+
+    jit-load-vm
     jit-save-context
+
+    ESP [] vm-reg MOV
+    "end_callback" jit-call
 ] \ c-to-factor define-sub-primitive
 
 [
     EAX ds-reg [] MOV
     ds-reg bootstrap-cell SUB
 ]
-[ EAX quot-entry-point-offset [+] CALL ]
-[ EAX quot-entry-point-offset [+] JMP ]
+[ jit-call-quot ]
+[ jit-jump-quot ]
 \ (call) define-combinator-primitive
 
 [
+    ! Load ds and rs registers
+    jit-load-vm
+    jit-load-context
+    jit-restore-context
+
+    ! Windows-specific setup
+    ctx-reg jit-update-seh
+
     ! Clear x87 stack, but preserve rounding mode and exception flags
     ESP 2 SUB
     ESP [] FNSTCW
@@ -107,37 +131,31 @@ IN: bootstrap.x86
     ! Unwind stack frames
     ESP EDX MOV
 
-    ! Load ds and rs registers
-    jit-load-vm
-    jit-load-context
-    jit-restore-context
-
-    ! Call quotation
-    EAX quot-entry-point-offset [+] JMP
+    jit-jump-quot
 ] \ unwind-native-frames define-sub-primitive
 
 [
     ! Load callstack object
-    EBX ds-reg [] MOV
+    temp3 ds-reg [] MOV
     ds-reg bootstrap-cell SUB
     ! Get ctx->callstack_bottom
     jit-load-vm
     jit-load-context
-    EAX ctx-reg context-callstack-bottom-offset [+] MOV
+    temp0 ctx-reg context-callstack-bottom-offset [+] MOV
     ! Get top of callstack object -- 'src' for memcpy
-    EBP EBX callstack-top-offset [+] LEA
+    temp1 temp3 callstack-top-offset [+] LEA
     ! Get callstack length, in bytes --- 'len' for memcpy
-    EDX EBX callstack-length-offset [+] MOV
-    EDX tag-bits get SHR
+    temp2 temp3 callstack-length-offset [+] MOV
+    temp2 tag-bits get SHR
     ! Compute new stack pointer -- 'dst' for memcpy
-    EAX EDX SUB
+    temp0 temp2 SUB
     ! Install new stack pointer
-    ESP EAX MOV
+    ESP temp0 MOV
     ! Call memcpy
-    EDX PUSH
-    EBP PUSH
-    EAX PUSH
-    0 CALL "factor_memcpy" f rc-relative jit-dlsym
+    temp2 PUSH
+    temp1 PUSH
+    temp0 PUSH
+    "factor_memcpy" jit-call
     ESP 12 ADD
     ! Return with new callstack
     0 RET
@@ -145,7 +163,6 @@ IN: bootstrap.x86
 
 [
     jit-load-vm
-    jit-load-context
     jit-save-context
 
     ! Store arguments
@@ -153,25 +170,28 @@ IN: bootstrap.x86
     ESP 4 [+] vm-reg MOV
 
     ! Call VM
-    0 CALL "lazy_jit_compile" f rc-relative jit-dlsym
+    "lazy_jit_compile" jit-call
 ]
-[ EAX quot-entry-point-offset [+] CALL ]
-[ EAX quot-entry-point-offset [+] JMP ]
+[ jit-call-quot ]
+[ jit-jump-quot ]
 \ lazy-jit-compile define-combinator-primitive
 
+[
+    temp1 HEX: ffffffff CMP rc-absolute-cell rt-literal jit-rel
+] pic-check-tuple jit-define
+
 ! Inline cache miss entry points
 : jit-load-return-address ( -- )
-    EBX ESP stack-frame-size bootstrap-cell - [+] MOV ;
+    pic-tail-reg ESP stack-frame-size bootstrap-cell - [+] MOV ;
 
 ! These are always in tail position with an existing stack
 ! frame, and the stack. The frame setup takes this into account.
 : jit-inline-cache-miss ( -- )
     jit-load-vm
-    jit-load-context
     jit-save-context
     ESP 4 [+] vm-reg MOV
-    ESP [] EBX MOV
-    0 CALL "inline_cache_miss" f rc-relative jit-dlsym
+    ESP [] pic-tail-reg MOV
+    "inline_cache_miss" jit-call
     jit-restore-context ;
 
 [ jit-load-return-address jit-inline-cache-miss ]
@@ -188,7 +208,6 @@ IN: bootstrap.x86
 : jit-overflow ( insn func -- )
     ds-reg 4 SUB
     jit-load-vm
-    jit-load-context
     jit-save-context
     EAX ds-reg [] MOV
     EDX ds-reg 4 [+] MOV
@@ -199,8 +218,9 @@ IN: bootstrap.x86
     [
         ESP [] EAX MOV
         ESP 4 [+] EDX MOV
+        jit-load-vm
         ESP 8 [+] vm-reg MOV
-        [ 0 CALL ] dip f rc-relative jit-dlsym
+        jit-call
     ]
     jit-conditional ;
 
@@ -211,7 +231,6 @@ IN: bootstrap.x86
 [
     ds-reg 4 SUB
     jit-load-vm
-    jit-load-context
     jit-save-context
     EBX ds-reg [] MOV
     EAX EBX MOV
@@ -224,11 +243,97 @@ IN: bootstrap.x86
         EBX tag-bits get SAR
         ESP [] EBX MOV
         ESP 4 [+] EBP MOV
+        jit-load-vm
         ESP 8 [+] vm-reg MOV
-        0 CALL "overflow_fixnum_multiply" f rc-relative jit-dlsym
+        "overflow_fixnum_multiply" jit-call
     ]
     jit-conditional
 ] \ fixnum* define-sub-primitive
 
-<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >>
-call
+! Contexts
+: jit-switch-context ( reg -- )
+    ! Save ds, rs registers
+    jit-load-vm
+    jit-save-context
+
+    ! Make the new context the current one
+    ctx-reg swap MOV
+    vm-reg vm-context-offset [+] ctx-reg MOV
+
+    ! Load new stack pointer
+    ESP ctx-reg context-callstack-top-offset [+] MOV
+
+    ! Windows-specific setup
+    ctx-reg jit-update-tib
+
+    ! Load new ds, rs registers
+    jit-restore-context ;
+
+: jit-set-context ( -- )
+    ! Load context and parameter from datastack
+    EAX ds-reg [] MOV
+    EAX EAX alien-offset [+] MOV
+    EDX ds-reg -4 [+] MOV
+    ds-reg 8 SUB
+
+    ! Make the new context active
+    EAX jit-switch-context
+
+    ! Windows-specific setup
+    ctx-reg jit-update-seh
+
+    ! Twiddle stack for return
+    ESP 4 ADD
+
+    ! Store parameter to datastack
+    ds-reg 4 ADD
+    ds-reg [] EDX MOV ;
+
+[ jit-set-context ] \ (set-context) define-sub-primitive
+
+: jit-start-context ( -- )
+    ! Create the new context in return-reg
+    jit-load-vm
+    ESP [] vm-reg MOV
+    "new_context" jit-call
+
+    ! Save pointer to quotation and parameter
+    EDX ds-reg MOV
+    ds-reg 8 SUB
+
+    ! Make the new context active
+    EAX jit-switch-context
+
+    ! Push parameter
+    EAX EDX -4 [+] MOV
+    ds-reg 4 ADD
+    ds-reg [] EAX MOV
+
+    ! Windows-specific setup
+    jit-install-seh
+
+    ! Push a fake return address
+    0 PUSH
+
+    ! Jump to initial quotation
+    EAX EDX [] MOV
+    jit-jump-quot ;
+
+[ jit-start-context ] \ (start-context) define-sub-primitive
+
+: jit-delete-current-context ( -- )
+    jit-load-vm
+    jit-load-context
+    ESP [] vm-reg MOV
+    ESP 4 [+] ctx-reg MOV
+    "delete_context" jit-call ;
+
+[
+    jit-delete-current-context
+    jit-set-context
+] \ (set-context-and-delete) define-sub-primitive
+
+[
+    jit-delete-current-context
+    jit-start-context
+] \ (start-context-and-delete) define-sub-primitive
index 50dfc5156eaf27de98ef174f5412cee2e92b37a0..44629a587600e5c756a09a445297a40dbfdbbf09 100644 (file)
@@ -1,2 +1,2 @@
-untested
+not loaded
 compiler
diff --git a/basis/cpu/x86/32/unix/bootstrap.factor b/basis/cpu/x86/32/unix/bootstrap.factor
new file mode 100644 (file)
index 0000000..56d1851
--- /dev/null
@@ -0,0 +1,8 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel parser sequences ;
+IN: bootstrap.x86
+
+<< "vocab:cpu/x86/unix/bootstrap.factor" parse-file suffix! >> call
+<< "vocab:cpu/x86/32/bootstrap.factor" parse-file suffix! >> call
+<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call
diff --git a/basis/cpu/x86/32/winnt/bootstrap.factor b/basis/cpu/x86/32/winnt/bootstrap.factor
new file mode 100644 (file)
index 0000000..5628632
--- /dev/null
@@ -0,0 +1,36 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: bootstrap.image.private compiler.constants
+cpu.x86.assembler cpu.x86.assembler.operands kernel layouts
+locals parser sequences ;
+IN: bootstrap.x86
+
+: tib-segment ( -- ) FS ;
+: tib-temp ( -- reg ) EAX ;
+
+<< "vocab:cpu/x86/winnt/bootstrap.factor" parse-file suffix! >> call
+
+: jit-install-seh ( -- )
+    ! Create a new exception record and store it in the TIB.
+    ! Clobbers tib-temp.
+    ! Align stack
+    ESP 3 bootstrap-cells ADD
+    ! Exception handler address filled in by callback.cpp
+    tib-temp 0 MOV rc-absolute-cell rt-exception-handler jit-rel
+    tib-temp PUSH
+    ! No next handler
+    0 PUSH
+    ! This is the new exception handler
+    tib-exception-list-offset [] ESP tib-segment MOV ;
+
+:: jit-update-seh ( ctx-reg -- )
+    ! Load exception record structure that jit-install-seh
+    ! created from the bottom of the callstack.
+    ! Clobbers tib-temp.
+    tib-temp ctx-reg context-callstack-bottom-offset [+] MOV
+    tib-temp bootstrap-cell ADD
+    ! Store exception record in TIB.
+    tib-exception-list-offset [] tib-temp tib-segment MOV ;
+
+<< "vocab:cpu/x86/32/bootstrap.factor" parse-file suffix! >> call
+<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call
index 6d171af7eaf6a58b4f9bb0dc2beb8679e2ebb4b2..3ade9e9e7f4805b6bbe10a57a3a6513484959e03 100644 (file)
@@ -1,15 +1,16 @@
 USING: alien alien.c-types cpu.architecture cpu.x86.64
-cpu.x86.assembler cpu.x86.assembler.operands tools.test ;
+cpu.x86.assembler cpu.x86.assembler.operands tools.test
+assocs sequences ;
 IN: cpu.x86.64.tests
 
-: assembly-test-1 ( -- x ) int { } "cdecl" [ RAX 3 MOV ] alien-assembly ;
+: assembly-test-1 ( -- x ) int { } cdecl [ RAX 3 MOV ] alien-assembly ;
 
 [ 3 ] [ assembly-test-1 ] unit-test
 
 : assembly-test-2 ( a b -- x )
-    int { int int } "cdecl" [
+    int { int int } cdecl [
         param-reg-0 param-reg-1 ADD
-        int-regs return-reg param-reg-0 MOV
+        int-regs return-regs at first param-reg-0 MOV
     ] alien-assembly ;
 
 [ 23 ] [ 17 6 assembly-test-2 ] unit-test
index 856127aedf49424acccf7ea34fad213cfc052ab4..bde0507af971b746dde6b9139788e889641c0250 100644 (file)
@@ -2,8 +2,8 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays kernel math namespaces make sequences
 system layouts alien alien.c-types alien.accessors alien.libraries
-slots splitting assocs combinators locals compiler.constants
-compiler.codegen compiler.codegen.fixup
+slots splitting assocs combinators fry locals compiler.constants
+classes.struct compiler.codegen compiler.codegen.fixup
 compiler.cfg.instructions compiler.cfg.builder
 compiler.cfg.intrinsics compiler.cfg.stack-frame
 cpu.x86.assembler cpu.x86.assembler.operands cpu.x86
@@ -11,23 +11,26 @@ cpu.architecture vm ;
 FROM: layouts => cell cells ;
 IN: cpu.x86.64
 
-: param-reg-0 ( -- reg ) 0 int-regs param-reg ; inline
-: param-reg-1 ( -- reg ) 1 int-regs param-reg ; inline
-: param-reg-2 ( -- reg ) 2 int-regs param-reg ; inline
-: param-reg-3 ( -- reg ) 3 int-regs param-reg ; inline
+: param-reg ( n -- reg ) int-regs cdecl param-regs at nth ;
+
+: param-reg-0 ( -- reg ) 0 param-reg ; inline
+: param-reg-1 ( -- reg ) 1 param-reg ; inline
+: param-reg-2 ( -- reg ) 2 param-reg ; inline
+: param-reg-3 ( -- reg ) 3 param-reg ; inline
 
 M: x86.64 pic-tail-reg RBX ;
 
-M: int-regs return-reg drop RAX ;
-M: float-regs return-reg drop XMM0 ;
+M: x86.64 return-regs
+    {
+        { int-regs { RAX EDX } }
+        { float-regs { XMM0 XMM1 } }
+    } ;
 
 M: x86.64 ds-reg R14 ;
 M: x86.64 rs-reg R15 ;
 M: x86.64 stack-reg RSP ;
 M: x86.64 frame-reg RBP ;
 
-M: x86.64 extra-stack-space drop 0 ;
-
 M: x86.64 machine-registers
     {
         { int-regs { RAX RCX RDX RBX RBP RSI RDI R8 R9 R10 R11 R12 } }
@@ -38,26 +41,31 @@ M: x86.64 machine-registers
     } ;
 
 : vm-reg ( -- reg ) R13 ; inline
+: nv-reg ( -- reg ) RBX ; inline
 
 M: x86.64 %mov-vm-ptr ( reg -- )
     vm-reg MOV ;
 
-M: x86.64 %vm-field ( dst field -- )
-    [ vm-reg ] dip vm-field-offset [+] MOV ;
+M: x86.64 %vm-field ( dst offset -- )
+    [ vm-reg ] dip [+] MOV ;
 
-M: x86.64 %vm-field-ptr ( dst field -- )
-    [ vm-reg ] dip vm-field-offset [+] LEA ;
+M:: x86.64 %load-vector ( dst val rep -- )
+    dst 0 [RIP+] rep copy-memory* val rc-relative rel-binary-literal ;
 
-: param@ ( n -- op ) reserved-stack-space + stack@ ;
+M: x86.64 %set-vm-field ( src offset -- )
+    [ vm-reg ] dip [+] swap MOV ;
+
+M: x86.64 %vm-field-ptr ( dst offset -- )
+    [ vm-reg ] dip [+] LEA ;
 
 M: x86.64 %prologue ( n -- )
-    temp-reg -7 [] LEA
+    R11 -7 [RIP+] LEA
     dup PUSH
-    temp-reg PUSH
+    R11 PUSH
     stack-reg swap 3 cells - SUB ;
 
 M: x86.64 %prepare-jump
-    pic-tail-reg xt-tail-pic-offset [] LEA ;
+    pic-tail-reg xt-tail-pic-offset [RIP+] LEA ;
 
 : load-cards-offset ( dst -- )
     0 MOV rc-absolute-cell rel-cards-offset ;
@@ -83,185 +91,60 @@ M:: x86.64 %dispatch ( src temp -- )
     temp HEX: 7f [+] JMP
     building get length :> end
     ! Fix up the displacement above
-    cell code-alignment
+    cell alignment
     [ end start - + building get dup pop* push ]
-    [ align-code ]
+    [ (align-code) ]
     bi ;
 
-M: stack-params copy-register*
-    drop
-    {
-        { [ dup  integer? ] [ R11 swap next-stack@ MOV  R11 MOV ] }
-        { [ over integer? ] [ R11 swap MOV              param@ R11 MOV ] }
-    } cond ;
-
-M: x86.64 %save-param-reg [ param@ ] 2dip %copy ;
+M:: x86.64 %load-reg-param ( dst reg rep -- )
+    dst reg rep %copy ;
 
-M: x86.64 %load-param-reg [ swap param@ ] dip %copy ;
+M:: x86.64 %store-reg-param ( src reg rep -- )
+    reg src rep %copy ;
 
-: with-return-regs ( quot -- )
-    [
-        V{ RDX RAX } clone int-regs set
-        V{ XMM1 XMM0 } clone float-regs set
-        call
-    ] with-scope ; inline
-
-M: x86.64 %pop-stack ( n -- )
-    param-reg-0 swap ds-reg reg-stack MOV ;
-
-M: x86.64 %pop-context-stack ( -- )
-    temp-reg "ctx" %vm-field
-    param-reg-0 temp-reg "datastack" context-field-offset [+] MOV
-    param-reg-0 param-reg-0 [] MOV
-    temp-reg "datastack" context-field-offset [+] bootstrap-cell SUB ;
-
-M:: x86.64 %unbox ( n rep func -- )
+M:: x86.64 %unbox ( dst src func rep -- )
+    param-reg-0 src tagged-rep %copy
     param-reg-1 %mov-vm-ptr
-    ! Call the unboxer
     func f %alien-invoke
-    ! Store the return value on the C stack if this is an
-    ! alien-invoke, otherwise leave it the return register if
-    ! this is the end of alien-callback
-    n [ n rep reg-class-of return-reg rep %save-param-reg ] when ;
-
-: %unbox-struct-field ( c-type i -- )
-    ! Alien must be in param-reg-0.
-    R11 swap cells [+] swap rep>> reg-class-of {
-        { int-regs [ int-regs get pop swap MOV ] }
-        { float-regs [ float-regs get pop swap MOVSD ] }
-    } case ;
-
-M: x86.64 %unbox-small-struct ( c-type -- )
-    ! Alien must be in param-reg-0.
+    dst rep %load-return ;
+
+M:: x86.64 %box ( dst src func rep -- )
+    0 rep reg-class-of cdecl param-regs at nth src rep %copy
+    rep int-rep? os windows? or param-reg-1 param-reg-0 ? %mov-vm-ptr
+    func f %alien-invoke
+    dst int-rep %load-return ;
+
+M:: x86.64 %allot-byte-array ( dst size -- )
+    param-reg-0 size MOV
     param-reg-1 %mov-vm-ptr
-    "alien_offset" f %alien-invoke
-    ! Move alien_offset() return value to R11 so that we don't
-    ! clobber it.
-    R11 RAX MOV
-    [
-        flatten-value-type [ %unbox-struct-field ] each-index
-    ] with-return-regs ;
-
-M:: x86.64 %unbox-large-struct ( n c-type -- )
-    ! Source is in param-reg-0
-    ! Load destination address into param-reg-1
-    param-reg-1 n param@ LEA
-    ! Load structure size into param-reg-2
-    param-reg-2 c-type heap-size MOV
-    param-reg-3 %mov-vm-ptr
-    ! Copy the struct to the C stack
-    "to_value_struct" f %alien-invoke ;
-
-: load-return-value ( rep -- )
-    [ [ 0 ] dip reg-class-of param-reg ]
-    [ reg-class-of return-reg ]
-    [ ]
-    tri %copy ;
-
-M:: x86.64 %box ( n rep func -- )
-    n [
-        n
-        0 rep reg-class-of param-reg
-        rep %load-param-reg
-    ] [
-        rep load-return-value
-    ] if
-    rep int-rep?
-    cpu x86.64? os windows? and or
-    param-reg-1 param-reg-0 ? %mov-vm-ptr
-    func f %alien-invoke ;
-
-: box-struct-field@ ( i -- operand ) 1 + cells param@ ;
-
-: %box-struct-field ( c-type i -- )
-    box-struct-field@ swap c-type-rep reg-class-of {
-        { int-regs [ int-regs get pop MOV ] }
-        { float-regs [ float-regs get pop MOVSD ] }
-    } case ;
-
-M: x86.64 %box-small-struct ( c-type -- )
-    #! Box a <= 16-byte struct.
-    [
-        [ flatten-value-type [ %box-struct-field ] each-index ]
-        [ param-reg-2 swap heap-size MOV ] bi
-        param-reg-0 0 box-struct-field@ MOV
-        param-reg-1 1 box-struct-field@ MOV
-        param-reg-3 %mov-vm-ptr
-        "from_small_struct" f %alien-invoke
-    ] with-return-regs ;
-
-: struct-return@ ( n -- operand )
-    [ stack-frame get params>> ] unless* param@ ;
-
-M: x86.64 %box-large-struct ( n c-type -- )
-    ! Struct size is parameter 2
-    param-reg-1 swap heap-size MOV
-    ! Compute destination address
-    param-reg-0 swap struct-return@ LEA
-    param-reg-2 %mov-vm-ptr
-    ! Copy the struct from the C stack
-    "from_value_struct" f %alien-invoke ;
-
-M: x86.64 %prepare-box-struct ( -- )
-    ! Compute target address for value struct return
-    RAX f struct-return@ LEA
-    ! Store it as the first parameter
-    0 param@ RAX MOV ;
-
-M: x86.64 %prepare-var-args RAX RAX XOR ;
+    "allot_byte_array" f %alien-invoke
+    dst int-rep %load-return ;
 
 M: x86.64 %alien-invoke
     R11 0 MOV
     rc-absolute-cell rel-dlsym
     R11 CALL ;
 
-M: x86.64 %nest-stacks ( -- )
+M: x86.64 %begin-callback ( -- )
     param-reg-0 %mov-vm-ptr
-    "nest_stacks" f %alien-invoke ;
-
-M: x86.64 %unnest-stacks ( -- )
-    param-reg-0 %mov-vm-ptr
-    "unnest_stacks" f %alien-invoke ;
-
-M: x86.64 %prepare-alien-indirect ( -- )
-    param-reg-0 ds-reg [] MOV
-    ds-reg 8 SUB
-    param-reg-1 %mov-vm-ptr
-    "pinned_alien_offset" f %alien-invoke
-    RBP RAX MOV ;
-
-M: x86.64 %alien-indirect ( -- )
-    RBP CALL ;
+    param-reg-1 0 MOV
+    "begin_callback" f %alien-invoke ;
 
 M: x86.64 %alien-callback ( quot -- )
-    param-reg-0 param-reg-1 %restore-context
-    param-reg-0 swap %load-reference
-    param-reg-0 quot-entry-point-offset [+] CALL
-    param-reg-0 param-reg-1 %save-context ;
-
-M: x86.64 %callback-value ( ctype -- )
-    %pop-context-stack
-    RSP 8 SUB
-    param-reg-0 PUSH
+    [ param-reg-0 ] dip %load-reference
+    param-reg-0 quot-entry-point-offset [+] CALL ;
+
+M: x86.64 %end-callback ( -- )
     param-reg-0 %mov-vm-ptr
-    ! Restore data/call/retain stacks
-    "unnest_stacks" f %alien-invoke
-    ! Put former top of data stack in param-reg-0
-    param-reg-0 POP
-    RSP 8 ADD
-    ! Unbox former top of data stack to return registers
-    unbox-return ;
+    "end_callback" f %alien-invoke ;
 
 : float-function-param ( i src -- )
-    [ float-regs param-regs nth ] dip double-rep %copy ;
-
-: float-function-return ( reg -- )
-    float-regs return-reg double-rep %copy ;
+    [ float-regs cdecl param-regs at nth ] dip double-rep %copy ;
 
 M:: x86.64 %unary-float-function ( dst src func -- )
     0 src float-function-param
     func "libm" load-library %alien-invoke
-    dst float-function-return ;
+    dst double-rep %load-return ;
 
 M:: x86.64 %binary-float-function ( dst src1 src2 func -- )
     ! src1 might equal dst; otherwise it will be a spill slot
@@ -269,18 +152,19 @@ M:: x86.64 %binary-float-function ( dst src1 src2 func -- )
     0 src1 float-function-param
     1 src2 float-function-param
     func "libm" load-library %alien-invoke
-    dst float-function-return ;
-
-M:: x86.64 %call-gc ( gc-root-count temp -- )
-    ! Pass pointer to start of GC roots as first parameter
-    param-reg-0 gc-root-base param@ LEA
-    ! Pass number of roots as second parameter
-    param-reg-1 gc-root-count MOV
-    ! Pass VM ptr as third parameter
-    param-reg-2 %mov-vm-ptr
-    ! Call GC
+    dst double-rep %load-return ;
+
+M:: x86.64 %call-gc ( gc-roots -- )
+    param-reg-0 gc-roots gc-root-offsets %load-reference
+    param-reg-1 %mov-vm-ptr
     "inline_gc" f %alien-invoke ;
 
+M: x86.64 long-long-on-stack? f ;
+
+M: x86.64 float-on-stack? f ;
+
+M: x86.64 struct-return-on-stack? f ;
+
 ! The result of reading 4 bytes from memory is a fixnum on
 ! x86-64.
 enable-alien-4-intrinsics
index bc560580fac3dbae0965669c8b9c4e6ba349fabc..393d1c9b8bf1e5afe74e530ce63643eeabb149a5 100644 (file)
@@ -3,7 +3,7 @@
 USING: bootstrap.image.private kernel kernel.private namespaces
 system layouts vocabs parser compiler.constants math
 math.private cpu.x86.assembler cpu.x86.assembler.operands
-sequences generic.single.private ;
+sequences generic.single.private threads.private ;
 IN: bootstrap.x86
 
 8 \ cell set
@@ -11,12 +11,13 @@ IN: bootstrap.x86
 : shift-arg ( -- reg ) RCX ;
 : div-arg ( -- reg ) RAX ;
 : mod-arg ( -- reg ) RDX ;
-: temp0 ( -- reg ) RDI ;
-: temp1 ( -- reg ) RSI ;
+: temp0 ( -- reg ) RAX ;
+: temp1 ( -- reg ) RCX ;
 : temp2 ( -- reg ) RDX ;
 : temp3 ( -- reg ) RBX ;
+: pic-tail-reg ( -- reg ) RBX ;
 : return-reg ( -- reg ) RAX ;
-: safe-reg ( -- reg ) RAX ;
+: nv-reg ( -- reg ) RBX ;
 : stack-reg ( -- reg ) RSP ;
 : frame-reg ( -- reg ) RBP ;
 : ctx-reg ( -- reg ) R12 ;
@@ -26,19 +27,23 @@ IN: bootstrap.x86
 : fixnum>slot@ ( -- ) temp0 1 SAR ;
 : rex-length ( -- n ) 1 ;
 
+: jit-call ( name -- )
+    RAX 0 MOV rc-absolute-cell jit-dlsym
+    RAX CALL ;
+
 [
     ! load entry point
-    safe-reg 0 MOV rc-absolute-cell rt-this jit-rel
+    RAX 0 MOV rc-absolute-cell rt-this jit-rel
     ! save stack frame size
     stack-frame-size PUSH
     ! push entry point
-    safe-reg PUSH
+    RAX PUSH
     ! alignment
     RSP stack-frame-size 3 bootstrap-cells - SUB
 ] jit-prolog jit-define
 
 [
-    temp3 5 [] LEA
+    pic-tail-reg 5 [RIP+] LEA
     0 JMP rc-relative rt-entry-point-pic-tail jit-rel
 ] jit-word-jump jit-define
 
@@ -47,17 +52,18 @@ IN: bootstrap.x86
 
 : jit-save-context ( -- )
     jit-load-context
-    safe-reg RSP -8 [+] LEA
-    ctx-reg context-callstack-top-offset [+] safe-reg MOV
+    R11 RSP -8 [+] LEA
+    ctx-reg context-callstack-top-offset [+] R11 MOV
     ctx-reg context-datastack-offset [+] ds-reg MOV
     ctx-reg context-retainstack-offset [+] rs-reg MOV ;
 
 : jit-restore-context ( -- )
-    jit-load-context
     ds-reg ctx-reg context-datastack-offset [+] MOV
     rs-reg ctx-reg context-retainstack-offset [+] MOV ;
 
 [
+    ! ctx-reg is preserved across the call because it is non-volatile
+    ! in the C ABI
     jit-save-context
     ! call the primitive
     arg1 vm-reg MOV
@@ -66,22 +72,34 @@ IN: bootstrap.x86
     jit-restore-context
 ] jit-primitive jit-define
 
+: jit-jump-quot ( -- ) arg1 quot-entry-point-offset [+] JMP ;
+
+: jit-call-quot ( -- ) arg1 quot-entry-point-offset [+] CALL ;
+
 [
+    arg2 arg1 MOV
+    arg1 vm-reg MOV
+    "begin_callback" jit-call
+
+    jit-load-context
     jit-restore-context
-    ! save ctx->callstack_bottom
-    safe-reg stack-reg stack-frame-size 8 - [+] LEA
-    ctx-reg context-callstack-bottom-offset [+] safe-reg MOV
+
     ! call the quotation
-    arg1 quot-entry-point-offset [+] CALL
+    arg1 return-reg MOV
+    jit-call-quot
+
     jit-save-context
+
+    arg1 vm-reg MOV
+    "end_callback" jit-call
 ] \ c-to-factor define-sub-primitive
 
 [
     arg1 ds-reg [] MOV
     ds-reg bootstrap-cell SUB
 ]
-[ arg1 quot-entry-point-offset [+] CALL ]
-[ arg1 quot-entry-point-offset [+] JMP ]
+[ jit-call-quot ]
+[ jit-jump-quot ]
 \ (call) define-combinator-primitive
 
 [
@@ -99,10 +117,11 @@ IN: bootstrap.x86
     vm-reg 0 MOV 0 rc-absolute-cell jit-vm
 
     ! Load ds and rs registers
+    jit-load-context
     jit-restore-context
 
     ! Call quotation
-    arg1 quot-entry-point-offset [+] JMP
+    jit-jump-quot
 ] \ unwind-native-frames define-sub-primitive
 
 [
@@ -124,8 +143,7 @@ IN: bootstrap.x86
     ! Call memcpy; arguments are now in the correct registers
     ! Create register shadow area for Win64
     RSP 32 SUB
-    safe-reg 0 MOV "factor_memcpy" f rc-absolute-cell jit-dlsym
-    safe-reg CALL
+    "factor_memcpy" jit-call
     ! Tear down register shadow area
     RSP 32 ADD
     ! Return with new callstack
@@ -135,13 +153,18 @@ IN: bootstrap.x86
 [
     jit-save-context
     arg2 vm-reg MOV
-    safe-reg 0 MOV "lazy_jit_compile" f rc-absolute-cell jit-dlsym
-    safe-reg CALL
+    "lazy_jit_compile" jit-call
+    arg1 return-reg MOV
 ]
 [ return-reg quot-entry-point-offset [+] CALL ]
-[ return-reg quot-entry-point-offset [+] JMP ]
+[ jit-jump-quot ]
 \ lazy-jit-compile define-combinator-primitive
 
+[
+    temp2 HEX: ffffffff MOV rc-absolute-cell rt-literal jit-rel
+    temp1 temp2 CMP
+] pic-check-tuple jit-define
+
 ! Inline cache miss entry points
 : jit-load-return-address ( -- )
     RBX RSP stack-frame-size bootstrap-cell - [+] MOV ;
@@ -152,8 +175,8 @@ IN: bootstrap.x86
     jit-save-context
     arg1 RBX MOV
     arg2 vm-reg MOV
-    RAX 0 MOV "inline_cache_miss" f rc-absolute-cell jit-dlsym
-    RAX CALL
+    "inline_cache_miss" jit-call
+    jit-load-context
     jit-restore-context ;
 
 [ jit-load-return-address jit-inline-cache-miss ]
@@ -176,11 +199,7 @@ IN: bootstrap.x86
     [ [ arg3 arg2 ] dip call ] dip
     ds-reg [] arg3 MOV
     [ JNO ]
-    [
-        arg3 vm-reg MOV
-        RAX 0 MOV f rc-absolute-cell jit-dlsym
-        RAX CALL
-    ]
+    [ arg3 vm-reg MOV jit-call ]
     jit-conditional ; inline
 
 [ [ ADD ] "overflow_fixnum_add" jit-overflow ] \ fixnum+ define-sub-primitive
@@ -202,11 +221,78 @@ IN: bootstrap.x86
         arg1 tag-bits get SAR
         arg2 RBX MOV
         arg3 vm-reg MOV
-        RAX 0 MOV "overflow_fixnum_multiply" f rc-absolute-cell jit-dlsym
-        RAX CALL
+        "overflow_fixnum_multiply" jit-call
     ]
     jit-conditional
 ] \ fixnum* define-sub-primitive
 
-<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >>
-call
+! Contexts
+: jit-switch-context ( reg -- )
+    ! Save ds, rs registers
+    jit-save-context
+
+    ! Make the new context the current one
+    ctx-reg swap MOV
+    vm-reg vm-context-offset [+] ctx-reg MOV
+
+    ! Load new stack pointer
+    RSP ctx-reg context-callstack-top-offset [+] MOV
+
+    ! Load new ds, rs registers
+    jit-restore-context
+
+    ctx-reg jit-update-tib ;
+
+: jit-pop-context-and-param ( -- )
+    arg1 ds-reg [] MOV
+    arg1 arg1 alien-offset [+] MOV
+    arg2 ds-reg -8 [+] MOV
+    ds-reg 16 SUB ;
+
+: jit-push-param ( -- )
+    ds-reg 8 ADD
+    ds-reg [] arg2 MOV ;
+
+: jit-set-context ( -- )
+    jit-pop-context-and-param
+    arg1 jit-switch-context
+    RSP 8 ADD
+    jit-push-param ;
+
+[ jit-set-context ] \ (set-context) define-sub-primitive
+
+: jit-pop-quot-and-param ( -- )
+    arg1 ds-reg [] MOV
+    arg2 ds-reg -8 [+] MOV
+    ds-reg 16 SUB ;
+
+: jit-start-context ( -- )
+    ! Create the new context in return-reg
+    arg1 vm-reg MOV
+    "new_context" jit-call
+
+    jit-pop-quot-and-param
+
+    return-reg jit-switch-context
+
+    jit-push-param
+
+    jit-jump-quot ;
+
+[ jit-start-context ] \ (start-context) define-sub-primitive
+
+: jit-delete-current-context ( -- )
+    jit-load-context
+    arg1 vm-reg MOV
+    arg2 ctx-reg MOV
+    "delete_context" jit-call ;
+
+[
+    jit-delete-current-context
+    jit-set-context
+] \ (set-context-and-delete) define-sub-primitive
+
+[
+    jit-delete-current-context
+    jit-start-context
+] \ (start-context-and-delete) define-sub-primitive
index 50dfc5156eaf27de98ef174f5412cee2e92b37a0..44629a587600e5c756a09a445297a40dbfdbbf09 100644 (file)
@@ -1,2 +1,2 @@
-untested
+not loaded
 compiler
index d19b5306a0ea8bf2514609148fec95b72b821653..cffb12902c3088ae05dbbd0461d25bb9c3d18379 100644 (file)
@@ -12,5 +12,6 @@ IN: bootstrap.x86
 : arg3 ( -- reg ) RDX ;
 : arg4 ( -- reg ) RCX ;
 
-<< "vocab:cpu/x86/64/bootstrap.factor" parse-file suffix! >>
-call
+<< "vocab:cpu/x86/unix/bootstrap.factor" parse-file suffix! >> call
+<< "vocab:cpu/x86/64/bootstrap.factor" parse-file suffix! >> call
+<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 2fb32ce733cfa8086d46bd77f37afe018dffabdc..2ce959d29a85c2de7bb4d41e6fd0e8fd91709974 100644 (file)
@@ -1,24 +1,20 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays sequences math splitting make assocs kernel
-layouts system alien.c-types classes.struct cpu.architecture 
-cpu.x86.assembler cpu.x86.assembler.operands cpu.x86 compiler.codegen
-compiler.cfg.registers ;
+USING: accessors arrays sequences math splitting make assocs
+kernel layouts system alien.c-types classes.struct
+cpu.architecture cpu.x86.assembler cpu.x86.assembler.operands
+cpu.x86 cpu.x86.64 compiler.cfg.builder.alien
+compiler.cfg.builder.alien.boxing compiler.cfg.registers ;
 IN: cpu.x86.64.unix
 
-M: int-regs param-regs
-    drop { RDI RSI RDX RCX R8 R9 } ;
-
-M: float-regs param-regs
-    drop { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } ;
+M: x86.64 param-regs
+    drop {
+        { int-regs { RDI RSI RDX RCX R8 R9 } }
+        { float-regs { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } }
+    } ;
 
 M: x86.64 reserved-stack-space 0 ;
 
-SYMBOL: (stack-value)
-! The ABI for passing structs by value is pretty great
-<< void* c-type clone \ (stack-value) define-primitive-type
-stack-params \ (stack-value) c-type (>>rep) >>
-
 : struct-types&offset ( struct-type -- pairs )
     fields>> [
         [ type>> ] [ offset>> ] bi 2array
@@ -32,22 +28,13 @@ stack-params \ (stack-value) c-type (>>rep) >>
 : flatten-small-struct ( c-type -- seq )
     struct-types&offset split-struct [
         [ c-type c-type-rep reg-class-of ] map
-        int-regs swap member? void* double ? c-type
+        int-regs swap member? int-rep double-rep ?
+        f 2array
     ] map ;
 
-: flatten-large-struct ( c-type -- seq )
-    heap-size cell align
-    cell /i \ (stack-value) c-type <repetition> ;
-
-: flatten-struct ( c-type -- seq )
-    dup heap-size 16 > [
-        flatten-large-struct
-    ] [
-        flatten-small-struct
-    ] if ;
-
-M: struct-c-type flatten-value-type ( type -- seq )
-    flatten-struct ;
+M: x86.64 flatten-struct-type ( c-type -- seq )
+    dup heap-size 16 <=
+    [ flatten-small-struct ] [ call-next-method [ first t 2array ] map ] if ;
 
 M: x86.64 return-struct-in-registers? ( c-type -- ? )
     heap-size 2 cells <= ;
@@ -58,4 +45,4 @@ M: x86.64 dummy-int-params? f ;
 
 M: x86.64 dummy-fp-params? f ;
 
-M: x86.64 temp-reg R8 ;
+M: x86.64 %prepare-var-args RAX RAX XOR ;
index 113a13918f1f84bd04c4cfda4e6372624acf8768..f816980e57121fa207fd91a92bb9a6b2f78a10b9 100644 (file)
@@ -5,6 +5,8 @@ vocabs sequences cpu.x86.assembler parser
 cpu.x86.assembler.operands ;
 IN: bootstrap.x86
 
+DEFER: stack-reg
+
 : stack-frame-size ( -- n ) 8 bootstrap-cells ;
 : nv-regs ( -- seq ) { RBX RSI RDI R12 R13 R14 R15 } ;
 : arg1 ( -- reg ) RCX ;
@@ -12,5 +14,12 @@ IN: bootstrap.x86
 : arg3 ( -- reg ) R8 ;
 : arg4 ( -- reg ) R9 ;
 
-<< "vocab:cpu/x86/64/bootstrap.factor" parse-file suffix! >>
-call
+: tib-segment ( -- ) GS ;
+: tib-temp ( -- reg ) R11 ;
+
+: jit-install-seh ( -- ) stack-reg bootstrap-cell ADD ;
+: jit-update-seh ( ctx-reg -- ) drop ;
+
+<< "vocab:cpu/x86/winnt/bootstrap.factor" parse-file suffix! >> call
+<< "vocab:cpu/x86/64/bootstrap.factor" parse-file suffix! >> call
+<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index c75bb5a1b93ba9e80a4499bda6d90bcf3c86af73..7f1f29a6037b19ca463b82aee34df87b1d535730 100644 (file)
@@ -1,13 +1,15 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel layouts system math alien.c-types sequences
-compiler.cfg.registers cpu.architecture cpu.x86.assembler cpu.x86
-cpu.x86.assembler.operands ;
+compiler.cfg.registers cpu.architecture cpu.x86.assembler
+cpu.x86 cpu.x86.64 cpu.x86.assembler.operands ;
 IN: cpu.x86.64.winnt
 
-M: int-regs param-regs drop { RCX RDX R8 R9 } ;
-
-M: float-regs param-regs drop { XMM0 XMM1 XMM2 XMM3 } ;
+M: x86.64 param-regs
+    drop {
+        { int-regs { RCX RDX R8 R9 } }
+        { float-regs { XMM0 XMM1 XMM2 XMM3 } }
+    } ;
 
 M: x86.64 reserved-stack-space 4 cells ;
 
@@ -21,6 +23,3 @@ M: x86.64 dummy-stack-params? f ;
 M: x86.64 dummy-int-params? t ;
 
 M: x86.64 dummy-fp-params? t ;
-
-M: x86.64 temp-reg R11 ;
-
index 531110da7bf2a36cc0ce568c39a0ca140bd71fee..83694cae94f836fec2c14d87b786608766c2996a 100644 (file)
@@ -1,7 +1,28 @@
 USING: cpu.x86.assembler cpu.x86.assembler.operands
-kernel tools.test namespaces make ;
+kernel tools.test namespaces make layouts ;
 IN: cpu.x86.assembler.tests
 
+! small registers
+[ { 128 192 12 } ] [ [ AL 12 <byte> ADD ] { } make ] unit-test
+[ { 128 196 12 } ] [ [ AH 12 <byte> ADD ] { } make ] unit-test
+[ { 176 12 } ] [ [ AL 12 <byte> MOV ] { } make ] unit-test
+[ { 180 12 } ] [ [ AH 12 <byte> MOV ] { } make ] unit-test
+[ { 198 0 12 } ] [ [ EAX [] 12 <byte> MOV ] { } make ] unit-test
+[ { 0 235 } ] [ [ BL CH ADD ] { } make ] unit-test
+[ { 136 235 } ] [ [ BL CH MOV ] { } make ] unit-test
+
+! immediate operands
+cell 4 = [
+    [ { HEX: b9 HEX: 01 HEX: 00 HEX: 00 HEX: 00 } ] [ [ ECX 1 MOV ] { } make ] unit-test
+] [
+    [ { HEX: b9 HEX: 01 HEX: 00 HEX: 00 HEX: 00 HEX: 00 HEX: 00 HEX: 00 HEX: 00 } ] [ [ ECX 1 MOV ] { } make ] unit-test
+] if
+
+[ { HEX: 83 HEX: c1 HEX: 01 } ] [ [ ECX 1 ADD ] { } make ] unit-test
+[ { HEX: 81 HEX: c1 HEX: 96 HEX: 00 HEX: 00 HEX: 00 } ] [ [ ECX 150 ADD ] { } make ] unit-test
+[ { HEX: f7 HEX: c1 HEX: d2 HEX: 04 HEX: 00 HEX: 00 } ] [ [ ECX 1234 TEST ] { } make ] unit-test
+
+! 64-bit registers
 [ { HEX: 40 HEX: 8a HEX: 2a } ] [ [ BPL RDX [] MOV ] { } make ] unit-test
 
 [ { HEX: 49 HEX: 89 HEX: 04 HEX: 24 } ] [ [ R12 [] RAX MOV ] { } make ] unit-test
@@ -11,6 +32,58 @@ IN: cpu.x86.assembler.tests
 [ { HEX: 4c HEX: 89 HEX: e2 } ] [ [ RDX R12 MOV ] { } make ] unit-test
 [ { HEX: 49 HEX: 89 HEX: d4 } ] [ [ R12 RDX MOV ] { } make ] unit-test
 
+! memory address modes
+[ { HEX: 8a HEX: 18         } ] [ [ BL RAX [] MOV ] { } make ] unit-test
+[ { HEX: 66 HEX: 8b HEX: 18 } ] [ [ BX RAX [] MOV ] { } make ] unit-test
+[ { HEX: 8b HEX: 18         } ] [ [ EBX RAX [] MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 8b HEX: 18 } ] [ [ RBX RAX [] MOV ] { } make ] unit-test
+[ { HEX: 88 HEX: 18         } ] [ [ RAX [] BL MOV ] { } make ] unit-test
+[ { HEX: 66 HEX: 89 HEX: 18 } ] [ [ RAX [] BX MOV ] { } make ] unit-test
+[ { HEX: 89 HEX: 18         } ] [ [ RAX [] EBX MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 89 HEX: 18 } ] [ [ RAX [] RBX MOV ] { } make ] unit-test
+
+[ { HEX: 0f HEX: be HEX: c3 } ] [ [ EAX BL MOVSX ] { } make ] unit-test
+[ { HEX: 0f HEX: bf HEX: c3 } ] [ [ EAX BX MOVSX ] { } make ] unit-test
+
+[ { HEX: 80 HEX: 08 HEX: 05 } ] [ [ EAX [] 5 <byte> OR ] { } make ] unit-test
+[ { HEX: c6 HEX: 00 HEX: 05 } ] [ [ EAX [] 5 <byte> MOV ] { } make ] unit-test
+
+[ { HEX: 49 HEX: 89 HEX: 04 HEX: 1a } ] [ [ R10 RBX [+] RAX MOV ] { } make ] unit-test
+[ { HEX: 49 HEX: 89 HEX: 04 HEX: 1b } ] [ [ R11 RBX [+] RAX MOV ] { } make ] unit-test
+
+[ { HEX: 49 HEX: 89 HEX: 04 HEX: 1c } ] [ [ R12 RBX [+] RAX MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 89 HEX: 04 HEX: 1c } ] [ [ RSP RBX [+] RAX MOV ] { } make ] unit-test
+
+[ { HEX: 49 HEX: 89 HEX: 44 HEX: 1d HEX: 00 } ] [ [ R13 RBX [+] RAX MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 89 HEX: 44 HEX: 1d HEX: 00 } ] [ [ RBP RBX [+] RAX MOV ] { } make ] unit-test
+
+[ { HEX: 4a HEX: 89 HEX: 04 HEX: 23 } ] [ [ RBX R12 [+] RAX MOV ] { } make ] unit-test
+[ { HEX: 4a HEX: 89 HEX: 04 HEX: 2b } ] [ [ RBX R13 [+] RAX MOV ] { } make ] unit-test
+
+[ { HEX: 4b HEX: 89 HEX: 44 HEX: 25 HEX: 00 } ] [ [ R13 R12 [+] RAX MOV ] { } make ] unit-test
+[ { HEX: 4b HEX: 89 HEX: 04 HEX: 2c } ] [ [ R12 R13 [+] RAX MOV ] { } make ] unit-test
+
+[ { HEX: 49 HEX: 89 HEX: 04 HEX: 2c } ] [ [ R12 RBP [+] RAX MOV ] { } make ] unit-test
+[ [ R12 RSP [+] RAX MOV ] { } make ] must-fail
+
+[ { HEX: 89 HEX: 1c HEX: 11 } ] [ [ ECX EDX [+] EBX MOV ] { } make ] unit-test
+[ { HEX: 89 HEX: 1c HEX: 51 } ] [ [ ECX EDX 1 0 <indirect> EBX MOV ] { } make ] unit-test
+[ { HEX: 89 HEX: 1c HEX: 91 } ] [ [ ECX EDX 2 0 <indirect> EBX MOV ] { } make ] unit-test
+[ { HEX: 89 HEX: 1c HEX: d1 } ] [ [ ECX EDX 3 0 <indirect> EBX MOV ] { } make ] unit-test
+[ { HEX: 89 HEX: 5c HEX: 11 HEX: 64 } ] [ [ ECX EDX 0 100 <indirect> EBX MOV ] { } make ] unit-test
+[ { HEX: 89 HEX: 5c HEX: 51 HEX: 64 } ] [ [ ECX EDX 1 100 <indirect> EBX MOV ] { } make ] unit-test
+[ { HEX: 89 HEX: 5c HEX: 91 HEX: 64 } ] [ [ ECX EDX 2 100 <indirect> EBX MOV ] { } make ] unit-test
+[ { HEX: 89 HEX: 5c HEX: d1 HEX: 64 } ] [ [ ECX EDX 3 100 <indirect> EBX MOV ] { } make ] unit-test
+
+[ { HEX: 48 HEX: 89 HEX: 1c HEX: 11 } ] [ [ RCX RDX [+] RBX MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 89 HEX: 1c HEX: 51 } ] [ [ RCX RDX 1 0 <indirect> RBX MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 89 HEX: 1c HEX: 91 } ] [ [ RCX RDX 2 0 <indirect> RBX MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 89 HEX: 1c HEX: d1 } ] [ [ RCX RDX 3 0 <indirect> RBX MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 89 HEX: 5c HEX: 11 HEX: 64 } ] [ [ RCX RDX 0 100 <indirect> RBX MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 89 HEX: 5c HEX: 51 HEX: 64 } ] [ [ RCX RDX 1 100 <indirect> RBX MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 89 HEX: 5c HEX: 91 HEX: 64 } ] [ [ RCX RDX 2 100 <indirect> RBX MOV ] { } make ] unit-test
+[ { HEX: 48 HEX: 89 HEX: 5c HEX: d1 HEX: 64 } ] [ [ RCX RDX 3 100 <indirect> RBX MOV ] { } make ] unit-test
+
 ! r-rm / m-r sse instruction
 [ { HEX: 0f HEX: 10 HEX: c1 } ] [ [ XMM0 XMM1 MOVUPS ] { } make ] unit-test
 [ { HEX: 0f HEX: 10 HEX: 01 } ] [ [ XMM0 ECX [] MOVUPS ] { } make ] unit-test
@@ -48,13 +121,6 @@ IN: cpu.x86.assembler.tests
 [ { HEX: f2 HEX: 48 HEX: 0f HEX: 2a HEX: c0 } ] [ [ XMM0 RAX CVTSI2SD ] { } make ] unit-test
 [ { HEX: f2 HEX: 49 HEX: 0f HEX: 2a HEX: c4 } ] [ [ XMM0 R12 CVTSI2SD ] { } make ] unit-test
 
-! [ { HEX: f2 HEX: 49 HEX: 0f HEX: 2c HEX: c1 } ] [ [ XMM9 RAX CVTSI2SD ] { } make ] unit-test
-
-! [ { HEX: f2 HEX: 0f HEX: 10 HEX: 00 } ] [ [ XMM0 RAX [] MOVSD ] { } make ] unit-test
-! [ { HEX: f2 HEX: 41 HEX: 0f HEX: 10 HEX: 04 HEX: 24 } ] [ [ XMM0 R12 [] MOVSD ] { } make ] unit-test
-! [ { HEX: f2 HEX: 0f HEX: 11 HEX: 00 } ] [ [ RAX [] XMM0 MOVSD ] { } make ] unit-test
-! [ { HEX: f2 HEX: 41 HEX: 0f HEX: 11 HEX: 04 HEX: 24 } ] [ [ R12 [] XMM0 MOVSD ] { } make ] unit-test
-
 ! 3-operand r-rm-imm sse instructions
 [ { HEX: 66 HEX: 0f HEX: 70 HEX: c1 HEX: 02 } ]
 [ [ XMM0 XMM1 2 PSHUFD ] { } make ] unit-test
@@ -115,52 +181,54 @@ IN: cpu.x86.assembler.tests
 [ { HEX: f2 HEX: 0f HEX: 38 HEX: f1 HEX: c1 } ] [ [ EAX ECX CRC32 ] { } make ] unit-test
 [ { HEX: f2 HEX: 0f HEX: 38 HEX: f1 HEX: 01 } ] [ [ EAX ECX [] CRC32 ] { } make ] unit-test
 
-! memory address modes
-[ { HEX: 8a HEX: 18         } ] [ [ BL RAX [] MOV ] { } make ] unit-test
-[ { HEX: 66 HEX: 8b HEX: 18 } ] [ [ BX RAX [] MOV ] { } make ] unit-test
-[ { HEX: 8b HEX: 18         } ] [ [ EBX RAX [] MOV ] { } make ] unit-test
-[ { HEX: 48 HEX: 8b HEX: 18 } ] [ [ RBX RAX [] MOV ] { } make ] unit-test
-[ { HEX: 88 HEX: 18         } ] [ [ RAX [] BL MOV ] { } make ] unit-test
-[ { HEX: 66 HEX: 89 HEX: 18 } ] [ [ RAX [] BX MOV ] { } make ] unit-test
-[ { HEX: 89 HEX: 18         } ] [ [ RAX [] EBX MOV ] { } make ] unit-test
-[ { HEX: 48 HEX: 89 HEX: 18 } ] [ [ RAX [] RBX MOV ] { } make ] unit-test
-
-[ { HEX: 0f HEX: be HEX: c3 } ] [ [ EAX BL MOVSX ] { } make ] unit-test
-[ { HEX: 0f HEX: bf HEX: c3 } ] [ [ EAX BX MOVSX ] { } make ] unit-test
-
-[ { HEX: 80 HEX: 08 HEX: 05 } ] [ [ EAX [] 5 <byte> OR ] { } make ] unit-test
-[ { HEX: c6 HEX: 00 HEX: 05 } ] [ [ EAX [] 5 <byte> MOV ] { } make ] unit-test
-
-[ { HEX: 49 HEX: 89 HEX: 04 HEX: 1a } ] [ [ R10 RBX [+] RAX MOV ] { } make ] unit-test
-[ { HEX: 49 HEX: 89 HEX: 04 HEX: 1b } ] [ [ R11 RBX [+] RAX MOV ] { } make ] unit-test
-
-[ { HEX: 49 HEX: 89 HEX: 04 HEX: 1c } ] [ [ R12 RBX [+] RAX MOV ] { } make ] unit-test
-[ { HEX: 48 HEX: 89 HEX: 04 HEX: 1c } ] [ [ RSP RBX [+] RAX MOV ] { } make ] unit-test
-
-[ { HEX: 49 HEX: 89 HEX: 44 HEX: 1d HEX: 00 } ] [ [ R13 RBX [+] RAX MOV ] { } make ] unit-test
-[ { HEX: 48 HEX: 89 HEX: 44 HEX: 1d HEX: 00 } ] [ [ RBP RBX [+] RAX MOV ] { } make ] unit-test
-
-[ { HEX: 4a HEX: 89 HEX: 04 HEX: 23 } ] [ [ RBX R12 [+] RAX MOV ] { } make ] unit-test
-[ { HEX: 4a HEX: 89 HEX: 04 HEX: 2b } ] [ [ RBX R13 [+] RAX MOV ] { } make ] unit-test
-
-[ { HEX: 4b HEX: 89 HEX: 44 HEX: 25 HEX: 00 } ] [ [ R13 R12 [+] RAX MOV ] { } make ] unit-test
-[ { HEX: 4b HEX: 89 HEX: 04 HEX: 2c } ] [ [ R12 R13 [+] RAX MOV ] { } make ] unit-test
-
-[ { HEX: 49 HEX: 89 HEX: 04 HEX: 2c } ] [ [ R12 RBP [+] RAX MOV ] { } make ] unit-test
-[ [ R12 RSP [+] RAX MOV ] { } make ] must-fail
-
+! shifts
 [ { HEX: 48 HEX: d3 HEX: e0 } ] [ [ RAX CL SHL ] { } make ] unit-test
 [ { HEX: 48 HEX: d3 HEX: e1 } ] [ [ RCX CL SHL ] { } make ] unit-test
 [ { HEX: 48 HEX: d3 HEX: e8 } ] [ [ RAX CL SHR ] { } make ] unit-test
 [ { HEX: 48 HEX: d3 HEX: e9 } ] [ [ RCX CL SHR ] { } make ] unit-test
 
-[ { HEX: f7 HEX: c1 HEX: d2 HEX: 04 HEX: 00 HEX: 00 } ] [ [ ECX 1234 TEST ] { } make ] unit-test
+[ { HEX: c1 HEX: e0 HEX: 05 } ] [ [ EAX 5 SHL ] { } make ] unit-test
+[ { HEX: c1 HEX: e1 HEX: 05 } ] [ [ ECX 5 SHL ] { } make ] unit-test
+[ { HEX: c1 HEX: e8 HEX: 05 } ] [ [ EAX 5 SHR ] { } make ] unit-test
+[ { HEX: c1 HEX: e9 HEX: 05 } ] [ [ ECX 5 SHR ] { } make ] unit-test
 
+! multiplication
 [ { HEX: 4d HEX: 6b HEX: c0 HEX: 03 } ] [ [ R8 R8 3 IMUL3 ] { } make ] unit-test
 [ { HEX: 49 HEX: 6b HEX: c0 HEX: 03 } ] [ [ RAX R8 3 IMUL3 ] { } make ] unit-test
 [ { HEX: 4c HEX: 6b HEX: c0 HEX: 03 } ] [ [ R8 RAX 3 IMUL3 ] { } make ] unit-test
 [ { HEX: 48 HEX: 6b HEX: c1 HEX: 03 } ] [ [ RAX RCX 3 IMUL3 ] { } make ] unit-test
 [ { HEX: 48 HEX: 69 HEX: c1 HEX: 44 HEX: 03 HEX: 00 HEX: 00 } ] [ [ RAX RCX HEX: 344 IMUL3 ] { } make ] unit-test
 
+! BT family instructions
+[ { HEX: 0f HEX: ba HEX: e0 HEX: 01 } ] [ [ EAX 1 BT ] { } make ] unit-test
+[ { HEX: 0f HEX: ba HEX: f8 HEX: 01 } ] [ [ EAX 1 BTC ] { } make ] unit-test
+[ { HEX: 0f HEX: ba HEX: e8 HEX: 01 } ] [ [ EAX 1 BTS ] { } make ] unit-test
+[ { HEX: 0f HEX: ba HEX: f0 HEX: 01 } ] [ [ EAX 1 BTR ] { } make ] unit-test
+[ { HEX: 48 HEX: 0f HEX: ba HEX: e0 HEX: 01 } ] [ [ RAX 1 BT ] { } make ] unit-test
+[ { HEX: 0f HEX: ba HEX: 20 HEX: 01 } ] [ [ EAX [] 1 BT ] { } make ] unit-test
+
+[ { HEX: 0f HEX: a3 HEX: d8 } ] [ [ EAX EBX BT ] { } make ] unit-test
+[ { HEX: 0f HEX: bb HEX: d8 } ] [ [ EAX EBX BTC ] { } make ] unit-test
+[ { HEX: 0f HEX: ab HEX: d8 } ] [ [ EAX EBX BTS ] { } make ] unit-test
+[ { HEX: 0f HEX: b3 HEX: d8 } ] [ [ EAX EBX BTR ] { } make ] unit-test
+[ { HEX: 0f HEX: a3 HEX: 18 } ] [ [ EAX [] EBX BT ] { } make ] unit-test
+
+! x87 instructions
+[ { HEX: D8 HEX: C5 } ] [ [ ST0 ST5 FADD ] { } make ] unit-test
+[ { HEX: DC HEX: C5 } ] [ [ ST5 ST0 FADD ] { } make ] unit-test
+[ { HEX: D8 HEX: 00 } ] [ [ ST0 EAX [] FADD ] { } make ] unit-test
+
+[ { HEX: D9 HEX: C2 } ] [ [ ST2 FLD  ] { } make ] unit-test
+[ { HEX: DD HEX: D2 } ] [ [ ST2 FST  ] { } make ] unit-test
+[ { HEX: DD HEX: DA } ] [ [ ST2 FSTP ] { } make ] unit-test
+
 [ { 15 183 195 } ] [ [ EAX BX MOVZX ] { } make ] unit-test
 
+bootstrap-cell 4 = [
+    [ { 100 199 5 0 0 0 0 123 0 0 0 } ] [ [ 0 [] FS 123 MOV ] { } make ] unit-test
+] when
+
+bootstrap-cell 8 = [
+    [ { 72 137 13 123 0 0 0 } ] [ [ 123 [RIP+] RCX MOV ] { } make ] unit-test
+    [ { 101 72 137 12 37 123 0 0 0 } ] [ [ 123 [] GS RCX MOV ] { } make ] unit-test
+] when
index b075b121a5c7c130f285af29ac3c3853c8ee1f31..401152325b02900fb2929b882f1433f8581d951f 100644 (file)
@@ -1,10 +1,9 @@
-! Copyright (C) 2005, 2009 Slava Pestov, Joe Groff.
+! Copyright (C) 2005, 2010 Slava Pestov, Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays io.binary kernel combinators kernel.private math
-math.bitwise locals namespaces make sequences words system
-layouts math.order accessors cpu.x86.assembler.operands
-cpu.x86.assembler.operands.private ;
-QUALIFIED: sequences
+USING: arrays io.binary kernel combinators
+combinators.short-circuit math math.bitwise locals namespaces
+make sequences words system layouts math.order accessors
+cpu.x86.assembler.operands cpu.x86.assembler.operands.private ;
 IN: cpu.x86.assembler
 
 ! A postfix assembler for x86-32 and x86-64.
@@ -22,7 +21,11 @@ IN: cpu.x86.assembler
 GENERIC: sib-present? ( op -- ? )
 
 M: indirect sib-present?
-    [ base>> { ESP RSP R12 } member? ] [ index>> ] [ scale>> ] tri or or ;
+    {
+        [ base>> { ESP RSP R12 } member? ]
+        [ index>> ]
+        [ scale>> ]
+    } 1|| ;
 
 M: register sib-present? drop f ;
 
@@ -67,10 +70,10 @@ M: byte n, [ value>> ] dip n, ;
 : 2, ( n -- ) 2 n, ; inline
 : cell, ( n -- ) bootstrap-cell n, ; inline
 
-: mod-r/m, ( reg# indirect -- )
+: mod-r/m, ( reg operand -- )
     [ 3 shift ] [ [ modifier 6 shift ] [ r/m ] bi ] bi* bitor bitor , ;
 
-: sib, ( indirect -- )
+: sib, ( operand -- )
     dup sib-present? [
         [ indirect-base* ]
         [ indirect-index* 3 shift ]
@@ -89,14 +92,14 @@ M: indirect displacement,
 
 M: register displacement, drop ;
 
-: addressing ( reg# indirect -- )
+: addressing ( reg operand -- )
     [ mod-r/m, ] [ sib, ] [ displacement, ] tri ;
 
 : rex.w? ( rex.w reg r/m -- ? )
     {
-        { [ dup register-128? ] [ drop operand-64? ] }
-        { [ dup not ] [ drop operand-64? ] }
-        [ nip operand-64? ]
+        { [ over register-128? ] [ nip operand-64? ] }
+        { [ over not ] [ nip operand-64? ] }
+        [ drop operand-64? ]
     } cond and ;
 
 : rex.r ( m op -- n )
@@ -115,16 +118,15 @@ M: register displacement, drop ;
 :: rex-prefix ( reg r/m rex.w -- )
     #! Compile an AMD64 REX prefix.
     rex.w reg r/m rex.w? BIN: 01001000 BIN: 01000000 ?
-    r/m rex.r
-    reg rex.b
+    reg rex.r
+    r/m rex.b
     dup reg r/m no-prefix? [ drop ] [ , ] if ;
 
-: 16-prefix ( reg r/m -- )
-    [ register-16? ] either? [ HEX: 66 , ] when ;
-
-: prefix ( reg r/m rex.w -- ) [ drop 16-prefix ] [ rex-prefix ] 3bi ;
+: 16-prefix ( reg -- )
+    register-16? [ HEX: 66 , ] when ;
 
-: prefix-1 ( reg rex.w -- ) f swap prefix ;
+: prefix-1 ( reg rex.w -- )
+    [ drop 16-prefix ] [ [ f ] 2dip rex-prefix ] 2bi ;
 
 : short-operand ( reg rex.w n -- )
     #! Some instructions encode their single operand as part of
@@ -134,60 +136,70 @@ M: register displacement, drop ;
 : opcode, ( opcode -- ) dup array? [ % ] [ , ] if ;
 
 : extended-opcode ( opcode -- opcode' )
-    dup array? [ OCT: 17 sequences:prefix ] [ OCT: 17 swap 2array ] if ;
+    dup array? [ OCT: 17 prefix ] [ OCT: 17 swap 2array ] if ;
 
 : extended-opcode, ( opcode -- ) extended-opcode opcode, ;
 
 : opcode-or ( opcode mask -- opcode' )
-    swap dup array?
-    [ unclip-last rot bitor suffix ] [ bitor ] if ;
+    over array?
+    [ [ unclip-last ] dip bitor suffix ] [ bitor ] if ;
 
-: 1-operand ( op reg,rex.w,opcode -- )
+: 1-operand ( operand reg,rex.w,opcode -- )
     #! The 'reg' is not really a register, but a value for the
     #! 'reg' field of the mod-r/m byte.
     first3 [ [ over ] dip prefix-1 ] dip opcode, swap addressing ;
 
-: immediate-operand-size-bit ( imm dst reg,rex.w,opcode -- imm dst reg,rex.w,opcode )
-    pick integer? [ first3 BIN: 1 opcode-or 3array ] when ;
+: immediate-operand-size-bit ( dst imm reg,rex.w,opcode -- imm dst reg,rex.w,opcode )
+    over integer? [ first3 BIN: 1 opcode-or 3array ] when ;
 
-: immediate-1 ( imm dst reg,rex.w,opcode -- )
-    immediate-operand-size-bit 1-operand 1, ;
+: immediate-1* ( dst imm reg,rex.w,opcode -- )
+    swap [ 1-operand ] dip 1, ;
 
-: immediate-4 ( imm dst reg,rex.w,opcode -- )
-    immediate-operand-size-bit 1-operand 4, ;
+: immediate-1 ( dst imm reg,rex.w,opcode -- )
+    immediate-operand-size-bit immediate-1* ;
 
-: immediate-fits-in-size-bit ( imm dst reg,rex.w,opcode -- imm dst reg,rex.w,opcode )
-    pick integer? [ first3 BIN: 10 opcode-or 3array ] when ;
+: immediate-4 ( dst imm reg,rex.w,opcode -- )
+    immediate-operand-size-bit swap [ 1-operand ] dip 4, ;
 
-: immediate-1/4 ( imm dst reg,rex.w,opcode -- )
+: immediate-fits-in-size-bit ( dst imm reg,rex.w,opcode -- imm dst reg,rex.w,opcode )
+    over integer? [ first3 BIN: 10 opcode-or 3array ] when ;
+
+: immediate-1/4 ( dst imm reg,rex.w,opcode -- )
     #! If imm is a byte, compile the opcode and the byte.
     #! Otherwise, set the 8-bit operand flag in the opcode, and
     #! compile the cell. The 'reg' is not really a register, but
     #! a value for the 'reg' field of the mod-r/m byte.
-    pick fits-in-byte? [
+    over fits-in-byte? [
         immediate-fits-in-size-bit immediate-1
     ] [
         immediate-4
     ] if ;
 
-: (2-operand) ( dst src op -- )
+: (2-operand) ( reg operand op -- )
     [ 2dup t rex-prefix ] dip opcode,
-    reg-code swap addressing ;
+    [ reg-code ] dip addressing ;
 
-: direction-bit ( dst src op -- dst' src' op' )
+: direction-bit ( dst src op -- reg operand op' )
     pick register? pick register? not and
-    [ BIN: 10 opcode-or swapd ] when ;
+    [ BIN: 10 opcode-or ] [ swapd ] if ;
 
-: operand-size-bit ( dst src op -- dst' src' op' )
-    over register-8? [ BIN: 1 opcode-or ] unless ;
+: operand-size-bit ( reg operand op -- reg operand op' )
+    pick register-8? [ BIN: 1 opcode-or ] unless ;
 
 : 2-operand ( dst src op -- )
-    #! Sets the opcode's direction bit. It is set if the
-    #! destination is a direct register operand.
-    [ drop 16-prefix ] [ direction-bit operand-size-bit (2-operand) ] 3bi ;
+    direction-bit operand-size-bit
+    pick 16-prefix
+    (2-operand) ;
 
 PRIVATE>
 
+! Segment override prefixes
+: CS ( -- ) HEX: 2e , ;
+: ES ( -- ) HEX: 26 , ;
+: SS ( -- ) HEX: 36 , ;
+: FS ( -- ) HEX: 64 , ;
+: GS ( -- ) HEX: 65 , ;
+
 ! Moving stuff
 GENERIC: PUSH ( op -- )
 M: register PUSH f HEX: 50 short-operand ;
@@ -201,16 +213,22 @@ M: operand POP { BIN: 000 f HEX: 8f } 1-operand ;
 ! MOV where the src is immediate.
 <PRIVATE
 
-GENERIC: (MOV-I) ( src dst -- )
-M: register (MOV-I) t HEX: b8 short-operand cell, ;
+GENERIC# (MOV-I) 1 ( dst src -- )
+
+M: register (MOV-I)
+    dup byte?
+    [ [ t HEX: b0 short-operand ] [ 1, ] bi* ]
+    [ [ t HEX: b8 short-operand ] [ cell, ] bi* ]
+    if ;
+
 M: operand (MOV-I)
     { BIN: 000 t HEX: c6 }
-    pick byte? [ immediate-1 ] [ immediate-4 ] if ;
+    over byte? [ immediate-1 ] [ immediate-4 ] if ;
 
 PRIVATE>
 
 GENERIC: MOV ( dst src -- )
-M: immediate MOV swap (MOV-I) ;
+M: immediate MOV (MOV-I) ;
 M: operand MOV HEX: 88 2-operand ;
 
 : LEA ( dst src -- ) swap HEX: 8d 2-operand ;
@@ -229,6 +247,9 @@ M: operand CALL { BIN: 010 t HEX: ff } 1-operand ;
 GENERIC# JUMPcc 1 ( addr opcode -- )
 M: integer JUMPcc extended-opcode, 4, ;
 
+: SETcc ( dst opcode -- )
+    { BIN: 000 t } swap suffix 1-operand ;
+
 PRIVATE>
 
 : JO  ( dst -- ) HEX: 80 JUMPcc ;
@@ -248,6 +269,23 @@ PRIVATE>
 : JLE ( dst -- ) HEX: 8e JUMPcc ;
 : JG  ( dst -- ) HEX: 8f JUMPcc ;
 
+: SETO  ( dst -- ) { HEX: 0f HEX: 90 } SETcc ;
+: SETNO ( dst -- ) { HEX: 0f HEX: 91 } SETcc ;
+: SETB  ( dst -- ) { HEX: 0f HEX: 92 } SETcc ;
+: SETAE ( dst -- ) { HEX: 0f HEX: 93 } SETcc ;
+: SETE  ( dst -- ) { HEX: 0f HEX: 94 } SETcc ;
+: SETNE ( dst -- ) { HEX: 0f HEX: 95 } SETcc ;
+: SETBE ( dst -- ) { HEX: 0f HEX: 96 } SETcc ;
+: SETA  ( dst -- ) { HEX: 0f HEX: 97 } SETcc ;
+: SETS  ( dst -- ) { HEX: 0f HEX: 98 } SETcc ;
+: SETNS ( dst -- ) { HEX: 0f HEX: 99 } SETcc ;
+: SETP  ( dst -- ) { HEX: 0f HEX: 9a } SETcc ;
+: SETNP ( dst -- ) { HEX: 0f HEX: 9b } SETcc ;
+: SETL  ( dst -- ) { HEX: 0f HEX: 9c } SETcc ;
+: SETGE ( dst -- ) { HEX: 0f HEX: 9d } SETcc ;
+: SETLE ( dst -- ) { HEX: 0f HEX: 9e } SETcc ;
+: SETG  ( dst -- ) { HEX: 0f HEX: 9f } SETcc ;
+
 : LEAVE ( -- ) HEX: c9 , ;
 
 : RET ( n -- )
@@ -256,44 +294,60 @@ PRIVATE>
 ! Arithmetic
 
 GENERIC: ADD ( dst src -- )
-M: immediate ADD swap { BIN: 000 t HEX: 80 } immediate-1/4 ;
+M: immediate ADD { BIN: 000 t HEX: 80 } immediate-1/4 ;
 M: operand ADD OCT: 000 2-operand ;
 
 GENERIC: OR ( dst src -- )
-M: immediate OR swap { BIN: 001 t HEX: 80 } immediate-1/4 ;
+M: immediate OR { BIN: 001 t HEX: 80 } immediate-1/4 ;
 M: operand OR OCT: 010 2-operand ;
 
 GENERIC: ADC ( dst src -- )
-M: immediate ADC swap { BIN: 010 t HEX: 80 } immediate-1/4 ;
+M: immediate ADC { BIN: 010 t HEX: 80 } immediate-1/4 ;
 M: operand ADC OCT: 020 2-operand ;
 
 GENERIC: SBB ( dst src -- )
-M: immediate SBB swap { BIN: 011 t HEX: 80 } immediate-1/4 ;
+M: immediate SBB { BIN: 011 t HEX: 80 } immediate-1/4 ;
 M: operand SBB OCT: 030 2-operand ;
 
 GENERIC: AND ( dst src -- )
-M: immediate AND swap { BIN: 100 t HEX: 80 } immediate-1/4 ;
+M: immediate AND { BIN: 100 t HEX: 80 } immediate-1/4 ;
 M: operand AND OCT: 040 2-operand ;
 
 GENERIC: SUB ( dst src -- )
-M: immediate SUB swap { BIN: 101 t HEX: 80 } immediate-1/4 ;
+M: immediate SUB { BIN: 101 t HEX: 80 } immediate-1/4 ;
 M: operand SUB OCT: 050 2-operand ;
 
 GENERIC: XOR ( dst src -- )
-M: immediate XOR swap { BIN: 110 t HEX: 80 } immediate-1/4 ;
+M: immediate XOR { BIN: 110 t HEX: 80 } immediate-1/4 ;
 M: operand XOR OCT: 060 2-operand ;
 
 GENERIC: CMP ( dst src -- )
-M: immediate CMP swap { BIN: 111 t HEX: 80 } immediate-1/4 ;
+M: immediate CMP { BIN: 111 t HEX: 80 } immediate-1/4 ;
 M: operand CMP OCT: 070 2-operand ;
 
 GENERIC: TEST ( dst src -- )
-M: immediate TEST swap { BIN: 0 t HEX: f7 } immediate-4 ;
+M: immediate TEST { BIN: 0 t HEX: f7 } immediate-4 ;
 M: operand TEST OCT: 204 2-operand ;
 
 : XCHG ( dst src -- ) OCT: 207 2-operand ;
 
-: BSR ( dst src -- ) swap { HEX: 0f HEX: bd } (2-operand) ;
+: BSR ( dst src -- ) { HEX: 0f HEX: bd } (2-operand) ;
+
+GENERIC: BT ( value n -- )
+M: immediate BT ( value n -- ) { BIN: 100 t { HEX: 0f HEX: ba } } immediate-1* ;
+M: operand   BT ( value n -- ) swap { HEX: 0f HEX: a3 } (2-operand) ;
+
+GENERIC: BTC ( value n -- )
+M: immediate BTC ( value n -- ) { BIN: 111 t { HEX: 0f HEX: ba } } immediate-1* ;
+M: operand   BTC ( value n -- ) swap { HEX: 0f HEX: bb } (2-operand) ;
+
+GENERIC: BTR ( value n -- )
+M: immediate BTR ( value n -- ) { BIN: 110 t { HEX: 0f HEX: ba } } immediate-1* ;
+M: operand   BTR ( value n -- ) swap { HEX: 0f HEX: b3 } (2-operand) ;
+
+GENERIC: BTS ( value n -- )
+M: immediate BTS ( value n -- ) { BIN: 101 t { HEX: 0f HEX: ba } } immediate-1* ;
+M: operand   BTS ( value n -- ) swap { HEX: 0f HEX: ab } (2-operand) ;
 
 : NOT  ( dst -- ) { BIN: 010 t HEX: f7 } 1-operand ;
 : NEG  ( dst -- ) { BIN: 011 t HEX: f7 } 1-operand ;
@@ -307,11 +361,11 @@ M: operand TEST OCT: 204 2-operand ;
 
 <PRIVATE
 
-: (SHIFT) ( dst src op -- )
-    over CL eq? [
-        nip t HEX: d3 3array 1-operand
+:: (SHIFT) ( dst src op -- )
+    src CL eq? [
+        dst { op t HEX: d3 } 1-operand
     ] [
-        swapd t HEX: c0 3array immediate-1
+        dst src { op t HEX: c0 } immediate-1
     ] if ; inline
 
 PRIVATE>
@@ -335,19 +389,17 @@ PRIVATE>
     ] if ;
 
 : MOVSX ( dst src -- )
-    swap
-    over register-32? OCT: 143 OCT: 276 extended-opcode ?
-    pick register-16? [ BIN: 1 opcode-or ] when
+    dup register-32? OCT: 143 OCT: 276 extended-opcode ?
+    over register-16? [ BIN: 1 opcode-or ] when
     (2-operand) ;
 
 : MOVZX ( dst src -- )
-    swap
     OCT: 266 extended-opcode
-    pick register-16? [ BIN: 1 opcode-or ] when
+    over register-16? [ BIN: 1 opcode-or ] when
     (2-operand) ;
 
 ! Conditional move
-: MOVcc ( dst src cc -- ) extended-opcode swapd (2-operand) ;
+: MOVcc ( dst src cc -- ) extended-opcode (2-operand) ;
 
 : CMOVO  ( dst src -- ) HEX: 40 MOVcc ;
 : CMOVNO ( dst src -- ) HEX: 41 MOVcc ;
@@ -393,39 +445,132 @@ PRIVATE>
 : FNCLEX ( -- ) HEX: db , HEX: e2 , ;
 : FNINIT ( -- ) HEX: db , HEX: e3 , ;
 
+ERROR: bad-x87-operands ;
+
+<PRIVATE
+
+:: (x87-op) ( operand opcode reg -- )
+    opcode ,
+    BIN: 1100,0000 reg
+    3 shift bitor
+    operand reg-code bitor , ;
+
+:: x87-st0-op ( src opcode reg -- )
+    src register?
+    [ src opcode reg (x87-op) ]
+    [ bad-x87-operands ] if ;
+
+:: x87-m-st0/n-op ( dst src opcode reg -- )
+    {
+        { [ dst ST0 = src indirect? and ] [
+            src { reg f opcode } 1-operand
+        ] }
+        { [ dst ST0 = src register? and ] [
+            src opcode reg (x87-op)
+        ] }
+        { [ src ST0 = dst register? and ] [
+            dst opcode 4 + reg (x87-op)
+        ] }
+        [ bad-x87-operands ]
+    } cond ;
+
+PRIVATE>
+
+: F2XM1 ( -- ) { HEX: D9 HEX: F0 } % ;
+: FABS ( -- ) { HEX: D9 HEX: E1 } % ;
+: FADD ( dst src -- ) HEX: D8 0 x87-m-st0/n-op ;
+: FCHS ( -- ) { HEX: D9 HEX: E0 } % ;
+
+: FCMOVB   ( src -- ) HEX: DA 0 x87-st0-op ;
+: FCMOVE   ( src -- ) HEX: DA 1 x87-st0-op ;
+: FCMOVBE  ( src -- ) HEX: DA 2 x87-st0-op ;
+: FCMOVU   ( src -- ) HEX: DA 3 x87-st0-op ;
+: FCMOVNB  ( src -- ) HEX: DB 0 x87-st0-op ;
+: FCMOVNE  ( src -- ) HEX: DB 1 x87-st0-op ;
+: FCMOVNBE ( src -- ) HEX: DB 2 x87-st0-op ;
+: FCMOVNU  ( src -- ) HEX: DB 3 x87-st0-op ;
+
+: FCOMI ( src -- ) HEX: DB 6 x87-st0-op ;
+: FUCOMI ( src -- ) HEX: DB 5 x87-st0-op ;
+: FCOS ( -- ) { HEX: D9 HEX: FF } % ;
+: FDECSTP ( -- ) { HEX: D9 HEX: F6 } % ;
+: FINCSTP ( -- ) { HEX: D9 HEX: F7 } % ;
+: FDIV  ( dst src -- ) HEX: D8 6 x87-m-st0/n-op ;
+: FDIVR ( dst src -- ) HEX: D8 7 x87-m-st0/n-op ;
+
+: FILDD ( src -- )  { BIN: 000 f HEX: DB } 1-operand ;
+: FILDQ ( src -- )  { BIN: 101 f HEX: DF } 1-operand ;
+: FISTPD ( dst -- ) { BIN: 011 f HEX: DB } 1-operand ;
+: FISTPQ ( dst -- ) { BIN: 111 f HEX: DF } 1-operand ;
+: FISTTPD ( dst -- ) { BIN: 001 f HEX: DB } 1-operand ;
+: FISTTPQ ( dst -- ) { BIN: 001 f HEX: DF } 1-operand ;
+
+: FLD    ( src -- ) HEX: D9 0 x87-st0-op ;
+: FLD1   ( -- ) { HEX: D9 HEX: E8 } % ;
+: FLDL2T ( -- ) { HEX: D9 HEX: E9 } % ;
+: FLDL2E ( -- ) { HEX: D9 HEX: EA } % ;
+: FLDPI  ( -- ) { HEX: D9 HEX: EB } % ;
+: FLDLG2 ( -- ) { HEX: D9 HEX: EC } % ;
+: FLDLN2 ( -- ) { HEX: D9 HEX: ED } % ;
+: FLDZ   ( -- ) { HEX: D9 HEX: EE } % ;
+
+: FMUL ( dst src -- ) HEX: D8 1 x87-m-st0/n-op ;
+: FNOP ( -- ) { HEX: D9 HEX: D0 } % ;
+: FPATAN ( -- ) { HEX: D9 HEX: F3 } % ;
+: FPREM  ( -- ) { HEX: D9 HEX: F8 } % ;
+: FPREM1 ( -- ) { HEX: D9 HEX: F5 } % ;
+: FRNDINT ( -- ) { HEX: D9 HEX: FC } % ;
+: FSCALE ( -- ) { HEX: D9 HEX: FD } % ;
+: FSIN ( -- ) { HEX: D9 HEX: FE } % ;
+: FSINCOS ( -- ) { HEX: D9 HEX: FB } % ;
+: FSQRT ( -- ) { HEX: D9 HEX: FA } % ;
+
+: FSUB  ( dst src -- ) HEX: D8 HEX: 4 x87-m-st0/n-op ;
+: FSUBR ( dst src -- ) HEX: D8 HEX: 5 x87-m-st0/n-op ;
+
+: FST  ( src -- ) HEX: DD 2 x87-st0-op ;
+: FSTP ( src -- ) HEX: DD 3 x87-st0-op ;
+
+: FXAM ( -- ) { HEX: D9 HEX: E5 } % ;
+: FXCH ( src -- ) HEX: D9 1 x87-st0-op ;
+
+: FXTRACT ( -- ) { HEX: D9 HEX: F4 } % ;
+: FYL2X ( -- ) { HEX: D9 HEX: F1 } % ;
+: FYL2XP1 ( -- ) { HEX: D9 HEX: F1 } % ;
+
 ! SSE multimedia instructions
 
 <PRIVATE
 
 : direction-bit-sse ( dst src op1 -- dst' src' op1' )
-    pick register-128? [ swapd ] [ BIN: 1 bitor ] if ;
+    pick register-128? [ swapd BIN: 1 bitor ] unless ;
 
 : 2-operand-sse ( dst src op1 op2 -- )
     [ , ] when* direction-bit-sse extended-opcode (2-operand) ;
 
 : direction-op-sse ( dst src op1s -- dst' src' op1' )
-    pick register-128? [ swapd first ] [ second ] if ;
+    pick register-128? [ first ] [ swapd second ] if ;
 
 : 2-operand-rm-mr-sse ( dst src op1{rm,mr} op2 -- )
     [ , ] when* direction-op-sse extended-opcode (2-operand) ;
 
 : 2-operand-rm-sse ( dst src op1 op2 -- )
-    [ , ] when* swapd extended-opcode (2-operand) ;
+    [ , ] when* extended-opcode (2-operand) ;
 
 : 2-operand-mr-sse ( dst src op1 op2 -- )
-    [ , ] when* extended-opcode (2-operand) ;
+    [ , ] when* extended-opcode swapd (2-operand) ;
 
 : 2-operand-int/sse ( dst src op1 op2 -- )
-    [ , ] when* swapd extended-opcode (2-operand) ;
+    [ , ] when* extended-opcode (2-operand) ;
 
-: 3-operand-rm-sse ( dst src imm op1 op2 -- )
-    rot [ 2-operand-rm-sse ] dip , ;
+:: 3-operand-rm-sse ( dst src imm op1 op2 -- )
+    dst src op1 op2 2-operand-rm-sse imm , ;
 
-: 3-operand-mr-sse ( dst src imm op1 op2 -- )
-    rot [ 2-operand-mr-sse ] dip , ;
+:: 3-operand-mr-sse ( dst src imm op1 op2 -- )
+    dst src op1 op2 2-operand-mr-sse imm , ;
 
-: 3-operand-rm-mr-sse ( dst src imm op1 op2 -- )
-    rot [ 2-operand-rm-mr-sse ] dip , ;
+:: 3-operand-rm-mr-sse ( dst src imm op1 op2 -- )
+    dst src op1 op2 2-operand-rm-mr-sse imm , ;
 
 : 2-operand-sse-cmp ( dst src cmp op1 op2 -- )
     3-operand-rm-sse ; inline
@@ -728,7 +873,7 @@ PRIVATE>
 : CMPNLESS   ( dest src -- ) 6 HEX: c2 HEX: f3 2-operand-sse-cmp ;
 : CMPORDSS   ( dest src -- ) 7 HEX: c2 HEX: f3 2-operand-sse-cmp ;
 
-: MOVNTI     ( dest src -- ) { HEX: 0f HEX: c3 } (2-operand) ;
+: MOVNTI     ( dest src -- ) swap { HEX: 0f HEX: c3 } (2-operand) ;
 
 : PINSRW     ( dest src imm -- ) HEX: c4 HEX: 66 3-operand-rm-sse ;
 : SHUFPS     ( dest src imm -- ) 4shuffler HEX: c6 f       3-operand-rm-sse ;
@@ -782,4 +927,3 @@ PRIVATE>
 
 : HWNT ( -- ) HEX: 2e , ; ! Hint branch Weakly Not Taken
 : HST  ( -- ) HEX: 3e , ; ! Hint branch Strongly Taken
-
index bd9a3f6cddff869c2b899b93f8ceca6d2a302636..2a2faa4039911995af8fbe9884a9dc9eb6838729 100644 (file)
@@ -1,31 +1,28 @@
-! Copyright (C) 2008, 2009 Slava Pestov, Joe Groff.
+! Copyright (C) 2008, 2010 Slava Pestov, Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel words math accessors sequences namespaces
 assocs layouts cpu.x86.assembler.syntax ;
 IN: cpu.x86.assembler.operands
 
-! In 32-bit mode, { 1234 } is absolute indirect addressing.
-! In 64-bit mode, { 1234 } is RIP-relative.
-! Beware!
-
 REGISTERS: 8 AL CL DL BL SPL BPL SIL DIL R8B R9B R10B R11B R12B R13B R14B R15B ;
 
-ALIAS: AH SPL
-ALIAS: CH BPL
-ALIAS: DH SIL
-ALIAS: BH DIL
+HI-REGISTERS: 8 AH CH DH BH ;
 
 REGISTERS: 16 AX CX DX BX SP BP SI DI R8W R9W R10W R11W R12W R13W R14W R15W ;
 
 REGISTERS: 32 EAX ECX EDX EBX ESP EBP ESI EDI R8D R9D R10D R11D R12D R13D R14D R15D ;
 
-REGISTERS: 64
-RAX RCX RDX RBX RSP RBP RSI RDI R8 R9 R10 R11 R12 R13 R14 R15 ;
+REGISTERS: 64 RAX RCX RDX RBX RSP RBP RSI RDI R8 R9 R10 R11 R12 R13 R14 R15 ;
 
 REGISTERS: 128
 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7
 XMM8 XMM9 XMM10 XMM11 XMM12 XMM13 XMM14 XMM15 ;
 
+REGISTERS: 80 ST0 ST1 ST2 ST3 ST4 ST5 ST6 ST7 ;
+
+: shuffle-down ( STn -- STn+1 )
+    "register" word-prop 1 + 80 registers get at nth ;
+
 PREDICATE: register < word
     "register" word-prop ;
 
@@ -57,6 +54,10 @@ TUPLE: indirect base index scale displacement ;
 
 M: indirect extended? base>> extended? ;
 
+: canonicalize-displacement ( indirect -- indirect )
+    dup [ base>> ] [ displacement>> 0 = ] bi and
+    [ f >>displacement ] when ;
+
 : canonicalize-EBP ( indirect -- indirect )
     #! { EBP } ==> { EBP 0 }
     dup [ base>> { EBP RBP R13 } member? ] [ displacement>> not ] bi and
@@ -70,10 +71,7 @@ ERROR: bad-index indirect ;
 : canonicalize ( indirect -- indirect )
     #! Modify the indirect to work around certain addressing mode
     #! quirks.
-    canonicalize-EBP check-ESP ;
-
-: <indirect> ( base index scale displacement -- indirect )
-    indirect boa canonicalize ;
+    canonicalize-displacement canonicalize-EBP check-ESP ;
 
 ! Utilities
 UNION: operand register indirect ;
@@ -89,15 +87,36 @@ M: object operand-64? drop f ;
 
 PRIVATE>
 
-: [] ( reg/displacement -- indirect )
-    dup integer? [ [ f f f ] dip ] [ f f f ] if <indirect> ;
+: <indirect> ( base index scale displacement -- indirect )
+    indirect boa canonicalize ;
+
+: [] ( base/displacement -- indirect )
+    dup integer?
+    [ [ f f bootstrap-cell 8 = 0 f ? ] dip <indirect> ]
+    [ f f f <indirect> ]
+    if ;
+
+: [RIP+] ( displacement -- indirect )
+    [ f f f ] dip <indirect> ;
 
-: [+] ( reg displacement -- indirect )
+: [+] ( base index/displacement -- indirect )
     dup integer?
-    [ dup zero? [ drop f ] when [ f f ] dip ]
+    [ [ f f ] dip ]
     [ f f ] if
     <indirect> ;
 
+: [++] ( base index displacement -- indirect )
+    [ f ] dip <indirect> ;
+
+: [+*2+] ( base index displacement -- indirect )
+    [ 1 ] dip <indirect> ;
+
+: [+*4+] ( base index displacement -- indirect )
+    [ 2 ] dip <indirect> ;
+
+: [+*8+] ( base index displacement -- indirect )
+    [ 3 ] dip <indirect> ;
+
 TUPLE: byte value ;
 
 C: <byte> byte
index 5b65c19155055aa3b9b9db9a0113fef44f168a18..185d892ce7291c2037b8cc2090f0b0437c06b6d1 100644 (file)
@@ -1,7 +1,7 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel words words.symbol sequences lexer parser fry
-namespaces combinators assocs ;
+namespaces combinators assocs math ;
 IN: cpu.x86.assembler.syntax
 
 SYMBOL: registers
@@ -9,15 +9,21 @@ SYMBOL: registers
 registers [ H{ } clone ] initialize
 
 : define-register ( name num size -- word )
-    [ "cpu.x86.assembler.operands" create ] 2dip {
+    [ create-in ] 2dip {
         [ 2drop ]
         [ 2drop define-symbol ]
         [ drop "register" set-word-prop ]
         [ nip "register-size" set-word-prop ]
     } 3cleave ;
 
-: define-registers ( size names -- )
-    [ swap '[ _ define-register ] map-index ] [ drop ] 2bi
-    registers get set-at ;
+: (define-registers) ( names start size -- seq )
+    '[ _ + _ define-register ] map-index ;
 
-SYNTAX: REGISTERS: scan-word ";" parse-tokens define-registers ;
+: define-registers ( names size -- )
+    [ [ 0 ] dip (define-registers) ] keep registers get set-at ;
+
+SYNTAX: REGISTERS:
+    scan-word [ ";" parse-tokens ] dip define-registers ;
+
+SYNTAX: HI-REGISTERS:
+    scan-word [ ";" parse-tokens 4 ] dip (define-registers) drop ;
index 8f1a4d7f498ebfbc25fd2508bb6a8b2e7f02f8db..db3a575154e6b8b79af488b4c3b97f36aa7b5834 100644 (file)
@@ -3,7 +3,8 @@
 USING: bootstrap.image.private compiler.constants
 compiler.units cpu.x86.assembler cpu.x86.assembler.operands
 kernel kernel.private layouts locals.backend make math
-math.private namespaces sequences slots.private vocabs ;
+math.private namespaces sequences slots.private strings.private
+vocabs ;
 IN: bootstrap.x86
 
 big-endian off
@@ -12,59 +13,78 @@ big-endian off
 [
     ! Optimizing compiler's side of callback accesses
     ! arguments that are on the stack via the frame pointer.
-    ! On x86-64, some arguments are passed in registers, and
-    ! so the only register that is safe for use here is safe-reg.
+    ! On x86-32 fastcall, and x86-64, some arguments are passed
+    ! in registers, and so the only registers that are safe for
+    ! use here are frame-reg, nv-reg and vm-reg.
     frame-reg PUSH
     frame-reg stack-reg MOV
 
     ! Save all non-volatile registers
     nv-regs [ PUSH ] each
 
-    ! Save old stack pointer and align
-    safe-reg stack-reg MOV
-    stack-reg bootstrap-cell SUB
-    stack-reg -16 AND
-    stack-reg [] safe-reg MOV
-
-    ! Register shadow area - only required on Win64, but doesn't
-    ! hurt on other platforms
-    stack-reg 32 SUB
+    jit-save-tib
 
     ! Load VM into vm-reg
     vm-reg 0 MOV rc-absolute-cell rt-vm jit-rel
 
+    ! Save old context
+    nv-reg vm-reg vm-context-offset [+] MOV
+    nv-reg PUSH
+
+    ! Switch over to the spare context
+    nv-reg vm-reg vm-spare-context-offset [+] MOV
+    vm-reg vm-context-offset [+] nv-reg MOV
+
+    ! Save C callstack pointer
+    nv-reg context-callstack-save-offset [+] stack-reg MOV
+
+    ! Load Factor callstack pointer
+    stack-reg nv-reg context-callstack-bottom-offset [+] MOV
+
+    nv-reg jit-update-tib
+    jit-install-seh
+
     ! Call into Factor code
-    safe-reg 0 MOV rc-absolute-cell rt-entry-point jit-rel
-    safe-reg CALL
+    nv-reg 0 MOV rc-absolute-cell rt-entry-point jit-rel
+    nv-reg CALL
+
+    ! Load VM into vm-reg; only needed on x86-32, but doesn't
+    ! hurt on x86-64
+    vm-reg 0 MOV rc-absolute-cell rt-vm jit-rel
 
-    ! Tear down register shadow area
-    stack-reg 32 ADD
+    ! Load C callstack pointer
+    nv-reg vm-reg vm-context-offset [+] MOV
+    stack-reg nv-reg context-callstack-save-offset [+] MOV
 
-    ! Undo stack alignment
-    stack-reg stack-reg [] MOV
+    ! Load old context
+    nv-reg POP
+    vm-reg vm-context-offset [+] nv-reg MOV
 
     ! Restore non-volatile registers
+    jit-restore-tib
+
     nv-regs <reversed> [ POP ] each
 
     frame-reg POP
 
-    ! Callbacks which return structs, or use stdcall, need a
-    ! parameter here. See the comment in callback-return-rewind
-    ! in cpu.x86.32
+    ! Callbacks which return structs, or use stdcall/fastcall/thiscall,
+    ! need a parameter here.
+
+    ! See the comment for M\ x86.32 stack-cleanup in cpu.x86.32
     HEX: ffff RET rc-absolute-2 rt-untagged jit-rel
 ] callback-stub jit-define
 
 [
     ! Load word
-    safe-reg 0 MOV rc-absolute-cell rt-literal jit-rel
+    temp0 0 MOV rc-absolute-cell rt-literal jit-rel
     ! Bump profiling counter
-    safe-reg profile-count-offset [+] 1 tag-fixnum ADD
+    temp0 profile-count-offset [+] 1 tag-fixnum ADD
     ! Load word->code
-    safe-reg safe-reg word-code-offset [+] MOV
+    temp0 temp0 word-code-offset [+] MOV
     ! Compute word entry point
-    safe-reg compiled-header-size ADD
+    temp0 compiled-header-size ADD
     ! Jump to entry point
-    safe-reg JMP
+    temp0 JMP
 ] jit-profiling jit-define
 
 [
@@ -183,47 +203,41 @@ big-endian off
 
 ! ! ! Polymorphic inline caches
 
-! The PIC stubs are not permitted to touch temp3.
+! The PIC stubs are not permitted to touch pic-tail-reg.
 
 ! Load a value from a stack position
 [
-    temp1 ds-reg HEX: ffffffff [+] MOV rc-absolute rt-untagged jit-rel
+    temp1 ds-reg HEX: 7f [+] MOV rc-absolute-1 rt-untagged jit-rel
 ] pic-load jit-define
 
-! Tag
-: load-tag ( -- )
-    temp1 tag-mask get AND
-    temp1 tag-bits get SHL ;
-
-[ load-tag ] pic-tag jit-define
+[ temp1 tag-mask get AND ] pic-tag jit-define
 
-! The 'make' trick lets us compute the jump distance for the
-! conditional branches there
-
-! Tuple
 [
     temp0 temp1 MOV
-    load-tag
-    temp1 tuple type-number tag-fixnum CMP
+    temp1 tag-mask get AND
+    temp1 tuple type-number CMP
     [ JNE ]
-    [ temp1 temp0 tuple type-number neg bootstrap-cell + [+] MOV ]
+    [ temp1 temp0 tuple-class-offset [+] MOV ]
     jit-conditional
 ] pic-tuple jit-define
 
 [
-    temp1 HEX: ffffffff CMP rc-absolute rt-literal jit-rel
+    temp1 HEX: 7f CMP rc-absolute-1 rt-untagged jit-rel
 ] pic-check-tag jit-define
 
-[
-    temp2 HEX: ffffffff MOV rc-absolute-cell rt-literal jit-rel
-    temp1 temp2 CMP
-] pic-check-tuple jit-define
-
 [ 0 JE rc-relative rt-entry-point jit-rel ] pic-hit jit-define
 
 ! ! ! Megamorphic caches
 
 [
+    ! class = ...
+    temp0 temp1 MOV
+    temp1 tag-mask get AND
+    temp1 tag-bits get SHL
+    temp1 tuple type-number tag-fixnum CMP
+    [ JNE ]
+    [ temp1 temp0 tuple-class-offset [+] MOV ]
+    jit-conditional
     ! cache = ...
     temp0 0 MOV rc-absolute-cell rt-literal jit-rel
     ! key = hashcode(class)
@@ -237,14 +251,16 @@ big-endian off
     temp0 temp2 ADD
     ! if(get(cache) == class)
     temp0 [] temp1 CMP
-    bootstrap-cell 4 = 14 22 ? JNE ! Yuck!
-    ! megamorphic_cache_hits++
-    temp1 0 MOV rc-absolute-cell rt-megamorphic-cache-hits jit-rel
-    temp1 [] 1 ADD
-    ! goto get(cache + bootstrap-cell)
-    temp0 temp0 bootstrap-cell [+] MOV
-    temp0 word-entry-point-offset [+] JMP
-    ! fall-through on miss
+    [ JNE ]
+    [
+        ! megamorphic_cache_hits++
+        temp1 0 MOV rc-absolute-cell rt-megamorphic-cache-hits jit-rel
+        temp1 [] 1 ADD
+        ! goto get(cache + bootstrap-cell)
+        temp0 temp0 bootstrap-cell [+] MOV
+        temp0 word-entry-point-offset [+] JMP
+        ! fall-through on miss
+    ] jit-conditional
 ] mega-lookup jit-define
 
 ! ! ! Sub-primitives
@@ -279,6 +295,21 @@ big-endian off
     ds-reg [] temp0 MOV
 ] \ slot define-sub-primitive
 
+[
+    ! load string index from stack
+    temp0 ds-reg bootstrap-cell neg [+] MOV
+    temp0 tag-bits get SHR
+    ! load string from stack
+    temp1 ds-reg [] MOV
+    ! load character
+    temp0 8-bit-version-of temp0 temp1 string-offset [++] MOV
+    temp0 temp0 8-bit-version-of MOVZX
+    temp0 tag-bits get SHL
+    ! store character to stack
+    ds-reg bootstrap-cell SUB
+    ds-reg [] temp0 MOV
+] \ string-nth-fast define-sub-primitive
+
 ! Shufflers
 [
     ds-reg bootstrap-cell SUB
@@ -434,7 +465,7 @@ big-endian off
     ! multiply
     temp0 temp1 IMUL2
     ! push result
-    ds-reg [] temp1 MOV
+    ds-reg [] temp0 MOV
 ] \ fixnum*fast define-sub-primitive
 
 [ \ AND jit-math ] \ fixnum-bitand define-sub-primitive
@@ -460,23 +491,23 @@ big-endian off
     ! load value
     temp3 ds-reg [] MOV
     ! make a copy
-    temp1 temp3 MOV
-    ! compute positive shift value in temp1
-    temp1 CL SHL
+    temp2 temp3 MOV
+    ! compute positive shift value in temp2
+    temp2 CL SHL
     shift-arg NEG
     ! compute negative shift value in temp3
     temp3 CL SAR
     temp3 tag-mask get bitnot AND
     shift-arg 0 CMP
-    ! if shift count was negative, move temp0 to temp1
-    temp1 temp3 CMOVGE
+    ! if shift count was negative, move temp0 to temp2
+    temp2 temp3 CMOVGE
     ! push to stack
-    ds-reg [] temp1 MOV
+    ds-reg [] temp2 MOV
 ] \ fixnum-shift-fast define-sub-primitive
 
 : jit-fixnum-/mod ( -- )
     ! load second parameter
-    temp3 ds-reg [] MOV
+    temp1 ds-reg [] MOV
     ! load first parameter
     div-arg ds-reg bootstrap-cell neg [+] MOV
     ! make a copy
@@ -484,7 +515,7 @@ big-endian off
     ! sign-extend
     mod-arg bootstrap-cell-bits 1 - SAR
     ! divide
-    temp3 IDIV ;
+    temp1 IDIV ;
 
 [
     jit-fixnum-/mod
@@ -517,7 +548,7 @@ big-endian off
     temp0 ds-reg [] MOV
     ds-reg bootstrap-cell SUB
     temp0 ds-reg [] OR
-    temp0 tag-mask get AND
+    temp0 tag-mask get TEST
     temp0 \ f type-number MOV
     temp1 1 tag-fixnum MOV
     temp0 temp1 CMOVE
index 30b2ce3b57accf63cd05a6aaa80bbcd16f89e275..d62429f4f05684eea58082221976b29412fd351a 100644 (file)
@@ -1,15 +1,18 @@
 ! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types combinators compiler
-compiler.codegen.fixup compiler.units cpu.architecture
-cpu.x86.assembler cpu.x86.assembler.operands init io kernel
-locals math math.order math.parser memoize namespaces system ;
+USING: accessors assocs sequences alien alien.c-types
+combinators compiler compiler.codegen.fixup compiler.units
+cpu.architecture cpu.x86.assembler cpu.x86.assembler.operands
+init io kernel locals math math.order math.parser memoize
+namespaces system ;
 IN: cpu.x86.features
 
 <PRIVATE
 
+: return-reg ( -- reg ) int-regs return-regs at first ;
+
 : (sse-version) ( -- n )
-    int { } "cdecl" [
+    int { } cdecl [
         "sse-42" define-label
         "sse-41" define-label
         "ssse-3" define-label
@@ -18,53 +21,53 @@ IN: cpu.x86.features
         "sse-1" define-label
         "end" define-label
 
-        int-regs return-reg 1 MOV
+        return-reg 1 MOV
 
         CPUID
 
-        ECX HEX: 100000 TEST
-        "sse-42" get JNE
+        ECX 20 BT
+        "sse-42" get JB
 
-        ECX HEX: 80000 TEST
-        "sse-41" get JNE
+        ECX 19 BT
+        "sse-41" get JB
 
-        ECX HEX: 200 TEST
-        "ssse-3" get JNE
+        ECX  9 BT
+        "ssse-3" get JB
 
-        ECX HEX: 1 TEST
-        "sse-3" get JNE
+        ECX  0 BT
+        "sse-3" get JB
 
-        EDX HEX: 4000000 TEST
-        "sse-2" get JNE
+        EDX 26 BT
+        "sse-2" get JB
 
-        EDX HEX: 2000000 TEST
-        "sse-1" get JNE
+        EDX 25 BT
+        "sse-1" get JB
 
-        int-regs return-reg 0 MOV
+        return-reg 0 MOV
         "end" get JMP
 
         "sse-42" resolve-label
-        int-regs return-reg 42 MOV
+        return-reg 42 MOV
         "end" get JMP
 
         "sse-41" resolve-label
-        int-regs return-reg 41 MOV
+        return-reg 41 MOV
         "end" get JMP
 
         "ssse-3" resolve-label
-        int-regs return-reg 33 MOV
+        return-reg 33 MOV
         "end" get JMP
 
         "sse-3" resolve-label
-        int-regs return-reg 30 MOV
+        return-reg 30 MOV
         "end" get JMP
 
         "sse-2" resolve-label
-        int-regs return-reg 20 MOV
+        return-reg 20 MOV
         "end" get JMP
 
         "sse-1" resolve-label
-        int-regs return-reg 10 MOV
+        return-reg 10 MOV
 
         "end" resolve-label
     ] alien-assembly ;
@@ -83,6 +86,15 @@ MEMO: sse-version ( -- n )
 : sse4.1? ( -- ? ) sse-version 41 >= ;
 : sse4.2? ( -- ? ) sse-version 42 >= ;
 
+: popcnt? ( -- ? )
+    bool { } cdecl [
+        return-reg 1 MOV
+        CPUID
+        ECX 23 BT
+        return-reg dup XOR
+        return-reg SETB
+    ] alien-assembly ;
+
 : sse-string ( version -- string )
     {
         { 00 [ "no SSE" ] }
@@ -97,12 +109,12 @@ MEMO: sse-version ( -- n )
 HOOK: instruction-count cpu ( -- n )
 
 M: x86.32 instruction-count
-    longlong { } "cdecl" [
+    longlong { } cdecl [
         RDTSC
     ] alien-assembly ;
 
 M: x86.64 instruction-count
-    longlong { } "cdecl" [
+    longlong { } cdecl [
         RAX 0 MOV
         RDTSC
         RDX 32 SHL
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
diff --git a/basis/cpu/x86/sse/authors.txt b/basis/cpu/x86/sse/authors.txt
new file mode 100644 (file)
index 0000000..580f882
--- /dev/null
@@ -0,0 +1,2 @@
+Slava Pestov
+Joe Groff
diff --git a/basis/cpu/x86/sse/sse.factor b/basis/cpu/x86/sse/sse.factor
new file mode 100644 (file)
index 0000000..4d667b8
--- /dev/null
@@ -0,0 +1,924 @@
+! Copyright (C) 2009, 2010 Joe Groff, Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types arrays assocs combinators fry kernel locals
+macros math math.vectors namespaces quotations sequences system
+compiler.cfg.comparisons compiler.cfg.intrinsics
+compiler.codegen.fixup cpu.architecture cpu.x86
+cpu.x86.assembler cpu.x86.assembler.operands cpu.x86.features ;
+IN: cpu.x86.sse
+
+! Scalar floating point with SSE2
+M: x86 %load-float <float> float-rep %load-vector ;
+M: x86 %load-double <double> double-rep %load-vector ;
+
+M: float-rep copy-register* drop MOVAPS ;
+M: double-rep copy-register* drop MOVAPS ;
+
+M: float-rep copy-memory* drop MOVSS ;
+M: double-rep copy-memory* drop MOVSD ;
+
+M: x86 %add-float double-rep two-operand ADDSD ;
+M: x86 %sub-float double-rep two-operand SUBSD ;
+M: x86 %mul-float double-rep two-operand MULSD ;
+M: x86 %div-float double-rep two-operand DIVSD ;
+M: x86 %min-float double-rep two-operand MINSD ;
+M: x86 %max-float double-rep two-operand MAXSD ;
+M: x86 %sqrt SQRTSD ;
+
+: %clear-unless-in-place ( dst src -- )
+    over = [ drop ] [ dup XORPS ] if ;
+
+M: x86 %single>double-float [ %clear-unless-in-place ] [ CVTSS2SD ] 2bi ;
+M: x86 %double>single-float [ %clear-unless-in-place ] [ CVTSD2SS ] 2bi ;
+
+M: x86 integer-float-needs-stack-frame? f ;
+M: x86 %integer>float [ drop dup XORPS ] [ CVTSI2SD ] 2bi ;
+M: x86 %float>integer CVTTSD2SI ;
+
+M: x86 %compare-float-ordered ( dst src1 src2 cc temp -- )
+    [ COMISD ] (%compare-float) ;
+
+M: x86 %compare-float-unordered ( dst src1 src2 cc temp -- )
+    [ UCOMISD ] (%compare-float) ;
+
+M: x86 %compare-float-ordered-branch ( label src1 src2 cc -- )
+    [ COMISD ] (%compare-float-branch) ;
+
+M: x86 %compare-float-unordered-branch ( label src1 src2 cc -- )
+    [ UCOMISD ] (%compare-float-branch) ;
+
+! SIMD
+M: float-4-rep copy-register* drop MOVAPS ;
+M: double-2-rep copy-register* drop MOVAPS ;
+M: vector-rep copy-register* drop MOVDQA ;
+
+MACRO: available-reps ( alist -- )
+    ! Each SSE version adds new representations and supports
+    ! all old ones
+    unzip { } [ append ] accumulate rest swap suffix
+    [ [ 1quotation ] map ] bi@ zip
+    reverse [ { } ] suffix
+    '[ _ cond ] ;
+
+M: x86 %alien-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %zero-vector
+    {
+        { double-2-rep [ dup XORPS ] }
+        { float-4-rep [ dup XORPS ] }
+        [ drop dup PXOR ]
+    } case ;
+
+M: x86 %zero-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %fill-vector
+    {
+        { double-2-rep [ dup [ XORPS ] [ CMPEQPS ] 2bi ] }
+        { float-4-rep  [ dup [ XORPS ] [ CMPEQPS ] 2bi ] }
+        [ drop dup PCMPEQB ]
+    } case ;
+
+M: x86 %fill-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M:: x86 %gather-vector-4 ( dst src1 src2 src3 src4 rep -- )
+    rep signed-rep {
+        { float-4-rep [
+            dst src1 float-4-rep %copy
+            dst src2 UNPCKLPS
+            src3 src4 UNPCKLPS
+            dst src3 MOVLHPS
+        ] }
+        { int-4-rep [
+            dst src1 int-4-rep %copy
+            dst src2 PUNPCKLDQ
+            src3 src4 PUNPCKLDQ
+            dst src3 PUNPCKLQDQ
+        ] }
+    } case ;
+
+M: x86 %gather-vector-4-reps
+    {
+        ! Can't do this with sse1 since it will want to unbox
+        ! double-precision floats and convert to single precision
+        { sse2? { float-4-rep int-4-rep uint-4-rep } }
+    } available-reps ;
+
+M:: x86 %gather-int-vector-4 ( dst src1 src2 src3 src4 rep -- )
+    dst rep %zero-vector
+    dst src1 32-bit-version-of 0 PINSRD
+    dst src2 32-bit-version-of 1 PINSRD
+    dst src3 32-bit-version-of 2 PINSRD
+    dst src4 32-bit-version-of 3 PINSRD ;
+
+M: x86 %gather-int-vector-4-reps
+    {
+        { sse4.1? { int-4-rep uint-4-rep } }
+    } available-reps ;
+
+M:: x86 %gather-vector-2 ( dst src1 src2 rep -- )
+    rep signed-rep {
+        { double-2-rep [
+            dst src1 double-2-rep %copy
+            dst src2 MOVLHPS
+        ] }
+        { longlong-2-rep [
+            dst src1 longlong-2-rep %copy
+            dst src2 PUNPCKLQDQ
+        ] }
+    } case ;
+
+M: x86 %gather-vector-2-reps
+    {
+        { sse2? { double-2-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M:: x86.64 %gather-int-vector-2 ( dst src1 src2 rep -- )
+    dst rep %zero-vector
+    dst src1 0 PINSRQ
+    dst src2 1 PINSRQ ;
+
+M: x86.64 %gather-int-vector-2-reps
+    {
+        { sse4.1? { longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+:: %select-vector-32 ( dst src n rep -- )
+    rep {
+        { char-16-rep [
+            dst 32-bit-version-of src n PEXTRB
+            dst dst 8-bit-version-of MOVSX
+        ] }
+        { uchar-16-rep [
+            dst 32-bit-version-of src n PEXTRB
+        ] }
+        { short-8-rep [
+            dst 32-bit-version-of src n PEXTRW
+            dst dst 16-bit-version-of MOVSX
+        ] }
+        { ushort-8-rep [
+            dst 32-bit-version-of src n PEXTRW
+        ] }
+        { int-4-rep [
+            dst 32-bit-version-of src n PEXTRD
+            dst dst 32-bit-version-of 2dup = [ 2drop ] [ MOVSX ] if
+        ] }
+        { uint-4-rep [
+            dst 32-bit-version-of src n PEXTRD
+        ] }
+    } case ;
+
+M: x86.32 %select-vector
+    %select-vector-32 ;
+
+M: x86.32 %select-vector-reps
+    {
+        { sse4.1? { uchar-16-rep char-16-rep ushort-8-rep short-8-rep uint-4-rep int-4-rep } }
+    } available-reps ;
+
+M: x86.64 %select-vector
+    {
+        { longlong-2-rep  [ PEXTRQ ] }
+        { ulonglong-2-rep [ PEXTRQ ] }
+        [ %select-vector-32 ]
+    } case ;
+
+M: x86.64 %select-vector-reps
+    {
+        { sse4.1? { uchar-16-rep char-16-rep ushort-8-rep short-8-rep uint-4-rep int-4-rep ulonglong-2-rep longlong-2-rep } }
+    } available-reps ;
+
+: sse1-float-4-shuffle ( dst shuffle -- )
+    {
+        { { 0 1 2 3 } [ drop ] }
+        { { 0 1 0 1 } [ dup MOVLHPS ] }
+        { { 2 3 2 3 } [ dup MOVHLPS ] }
+        { { 0 0 1 1 } [ dup UNPCKLPS ] }
+        { { 2 2 3 3 } [ dup UNPCKHPS ] }
+        [ dupd SHUFPS ]
+    } case ;
+
+: float-4-shuffle ( dst shuffle -- )
+    sse3? [
+        {
+            { { 0 0 2 2 } [ dup MOVSLDUP ] }
+            { { 1 1 3 3 } [ dup MOVSHDUP ] }
+            [ sse1-float-4-shuffle ]
+        } case
+    ] [ sse1-float-4-shuffle ] if ;
+
+: int-4-shuffle ( dst shuffle -- )
+    {
+        { { 0 1 2 3 } [ drop ] }
+        { { 0 0 1 1 } [ dup PUNPCKLDQ ] }
+        { { 2 2 3 3 } [ dup PUNPCKHDQ ] }
+        { { 0 1 0 1 } [ dup PUNPCKLQDQ ] }
+        { { 2 3 2 3 } [ dup PUNPCKHQDQ ] }
+        [ dupd PSHUFD ]
+    } case ;
+
+: longlong-2-shuffle ( dst shuffle -- )
+    first2 [ 2 * dup 1 + ] bi@ 4array int-4-shuffle ;
+
+: >float-4-shuffle ( double-2-shuffle -- float-4-shuffle )
+    [ 2 * { 0 1 } n+v ] map concat ;
+
+M:: x86 %shuffle-vector-imm ( dst src shuffle rep -- )
+    dst src rep %copy
+    dst shuffle rep signed-rep {
+        { double-2-rep [ >float-4-shuffle float-4-shuffle ] }
+        { float-4-rep [ float-4-shuffle ] }
+        { int-4-rep [ int-4-shuffle ] }
+        { longlong-2-rep [ longlong-2-shuffle ] }
+    } case ;
+
+M: x86 %shuffle-vector-imm-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M:: x86 %shuffle-vector-halves-imm ( dst src1 src2 shuffle rep -- )
+    dst src1 src2 rep two-operand
+    shuffle rep {
+        { double-2-rep [ >float-4-shuffle SHUFPS ] }
+        { float-4-rep [ SHUFPS ] }
+    } case ;
+
+M: x86 %shuffle-vector-halves-imm-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep } }
+    } available-reps ;
+
+M: x86 %shuffle-vector ( dst src shuffle rep -- )
+    two-operand PSHUFB ;
+
+M: x86 %shuffle-vector-reps
+    {
+        { ssse3? { float-4-rep double-2-rep longlong-2-rep ulonglong-2-rep int-4-rep uint-4-rep short-8-rep ushort-8-rep char-16-rep uchar-16-rep } }
+    } available-reps ;
+
+M: x86 %merge-vector-head
+    [ two-operand ] keep
+    signed-rep {
+        { double-2-rep   [ MOVLHPS ] }
+        { float-4-rep    [ UNPCKLPS ] }
+        { longlong-2-rep [ PUNPCKLQDQ ] }
+        { int-4-rep      [ PUNPCKLDQ ] }
+        { short-8-rep    [ PUNPCKLWD ] }
+        { char-16-rep    [ PUNPCKLBW ] }
+    } case ;
+
+M: x86 %merge-vector-tail
+    [ two-operand ] keep
+    signed-rep {
+        { double-2-rep   [ UNPCKHPD ] }
+        { float-4-rep    [ UNPCKHPS ] }
+        { longlong-2-rep [ PUNPCKHQDQ ] }
+        { int-4-rep      [ PUNPCKHDQ ] }
+        { short-8-rep    [ PUNPCKHWD ] }
+        { char-16-rep    [ PUNPCKHBW ] }
+    } case ;
+
+M: x86 %merge-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %float-pack-vector
+    drop CVTPD2PS ;
+
+M: x86 %float-pack-vector-reps
+    {
+        { sse2? { double-2-rep } }
+    } available-reps ;
+
+M: x86 %signed-pack-vector
+    [ two-operand ] keep
+    {
+        { int-4-rep    [ PACKSSDW ] }
+        { short-8-rep  [ PACKSSWB ] }
+    } case ;
+
+M: x86 %signed-pack-vector-reps
+    {
+        { sse2? { short-8-rep int-4-rep } }
+    } available-reps ;
+
+M: x86 %unsigned-pack-vector
+    [ two-operand ] keep
+    signed-rep {
+        { int-4-rep   [ PACKUSDW ] }
+        { short-8-rep [ PACKUSWB ] }
+    } case ;
+
+M: x86 %unsigned-pack-vector-reps
+    {
+        { sse2? { short-8-rep } }
+        { sse4.1? { int-4-rep } }
+    } available-reps ;
+
+M: x86 %tail>head-vector ( dst src rep -- )
+    dup {
+        { float-4-rep [ drop UNPCKHPD ] }
+        { double-2-rep [ drop UNPCKHPD ] }
+        [ drop [ %copy ] [ drop PUNPCKHQDQ ] 3bi ]
+    } case ;
+
+M: x86 %unpack-vector-head ( dst src rep -- )
+    {
+        { char-16-rep  [ PMOVSXBW ] }
+        { uchar-16-rep [ PMOVZXBW ] }
+        { short-8-rep  [ PMOVSXWD ] }
+        { ushort-8-rep [ PMOVZXWD ] }
+        { int-4-rep    [ PMOVSXDQ ] }
+        { uint-4-rep   [ PMOVZXDQ ] }
+        { float-4-rep  [ CVTPS2PD ] }
+    } case ;
+
+M: x86 %unpack-vector-head-reps ( -- reps )
+    {
+        { sse2? { float-4-rep } }
+        { sse4.1? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep } }
+    } available-reps ;
+
+M: x86 %integer>float-vector ( dst src rep -- )
+    {
+        { int-4-rep [ CVTDQ2PS ] }
+    } case ;
+
+M: x86 %integer>float-vector-reps
+    {
+        { sse2? { int-4-rep } }
+    } available-reps ;
+
+M: x86 %float>integer-vector ( dst src rep -- )
+    {
+        { float-4-rep [ CVTTPS2DQ ] }
+    } case ;
+
+M: x86 %float>integer-vector-reps
+    {
+        { sse2? { float-4-rep } }
+    } available-reps ;
+
+: (%compare-float-vector) ( dst src rep double single -- )
+    [ double-2-rep eq? ] 2dip if ; inline
+
+: %compare-float-vector ( dst src rep cc -- )
+    {
+        { cc<    [ [ CMPLTPD    ] [ CMPLTPS    ] (%compare-float-vector) ] }
+        { cc<=   [ [ CMPLEPD    ] [ CMPLEPS    ] (%compare-float-vector) ] }
+        { cc=    [ [ CMPEQPD    ] [ CMPEQPS    ] (%compare-float-vector) ] }
+        { cc<>=  [ [ CMPORDPD   ] [ CMPORDPS   ] (%compare-float-vector) ] }
+        { cc/<   [ [ CMPNLTPD   ] [ CMPNLTPS   ] (%compare-float-vector) ] }
+        { cc/<=  [ [ CMPNLEPD   ] [ CMPNLEPS   ] (%compare-float-vector) ] }
+        { cc/=   [ [ CMPNEQPD   ] [ CMPNEQPS   ] (%compare-float-vector) ] }
+        { cc/<>= [ [ CMPUNORDPD ] [ CMPUNORDPS ] (%compare-float-vector) ] }
+    } case ;
+
+:: (%compare-int-vector) ( dst src rep int64 int32 int16 int8 -- )
+    rep signed-rep :> rep'
+    dst src rep' {
+        { longlong-2-rep [ int64 call ] }
+        { int-4-rep      [ int32 call ] }
+        { short-8-rep    [ int16 call ] }
+        { char-16-rep    [ int8  call ] }
+    } case ; inline
+
+: %compare-int-vector ( dst src rep cc -- )
+    {
+        { cc= [ [ PCMPEQQ ] [ PCMPEQD ] [ PCMPEQW ] [ PCMPEQB ] (%compare-int-vector) ] }
+        { cc> [ [ PCMPGTQ ] [ PCMPGTD ] [ PCMPGTW ] [ PCMPGTB ] (%compare-int-vector) ] }
+    } case ;
+
+M: x86 %compare-vector ( dst src1 src2 rep cc -- )
+    [ [ two-operand ] keep ] dip
+    over float-vector-rep?
+    [ %compare-float-vector ]
+    [ %compare-int-vector ] if ;
+
+: %compare-vector-eq-reps ( -- reps )
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep } }
+        { sse4.1? { longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+: %compare-vector-ord-reps ( -- reps )
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep short-8-rep int-4-rep } }
+        { sse4.2? { longlong-2-rep } }
+    } available-reps ;
+
+M: x86 %compare-vector-reps
+    {
+        { [ dup { cc= cc/= cc/<>= cc<>= } member-eq? ] [ drop %compare-vector-eq-reps ] }
+        [ drop %compare-vector-ord-reps ]
+    } cond ;
+
+: %compare-float-vector-ccs ( cc -- ccs not? )
+    {
+        { cc<    [ { { cc<  f   }              } f ] }
+        { cc<=   [ { { cc<= f   }              } f ] }
+        { cc>    [ { { cc<  t   }              } f ] }
+        { cc>=   [ { { cc<= t   }              } f ] }
+        { cc=    [ { { cc=  f   }              } f ] }
+        { cc<>   [ { { cc<  f   } { cc<    t } } f ] }
+        { cc<>=  [ { { cc<>= f  }              } f ] }
+        { cc/<   [ { { cc/<  f  }              } f ] }
+        { cc/<=  [ { { cc/<= f  }              } f ] }
+        { cc/>   [ { { cc/<  t  }              } f ] }
+        { cc/>=  [ { { cc/<= t  }              } f ] }
+        { cc/=   [ { { cc/=  f  }              } f ] }
+        { cc/<>  [ { { cc/=  f  } { cc/<>= f } } f ] }
+        { cc/<>= [ { { cc/<>= f }              } f ] }
+    } case ;
+
+: %compare-int-vector-ccs ( cc -- ccs not? )
+    order-cc {
+        { cc<    [ { { cc> t } } f ] }
+        { cc<=   [ { { cc> f } } t ] }
+        { cc>    [ { { cc> f } } f ] }
+        { cc>=   [ { { cc> t } } t ] }
+        { cc=    [ { { cc= f } } f ] }
+        { cc/=   [ { { cc= f } } t ] }
+        { t      [ {           } t ] }
+        { f      [ {           } f ] }
+    } case ;
+
+M: x86 %compare-vector-ccs
+    swap float-vector-rep?
+    [ %compare-float-vector-ccs ]
+    [ %compare-int-vector-ccs ] if ;
+
+:: %test-vector-mask ( dst temp mask vcc -- )
+    vcc {
+        { vcc-any    [ dst dst TEST dst temp \ CMOVNE (%boolean) ] }
+        { vcc-none   [ dst dst TEST dst temp \ CMOVE  (%boolean) ] }
+        { vcc-all    [ dst mask CMP dst temp \ CMOVE  (%boolean) ] }
+        { vcc-notall [ dst mask CMP dst temp \ CMOVNE (%boolean) ] }
+    } case ;
+
+: %move-vector-mask ( dst src rep -- mask )
+    {
+        { double-2-rep [ MOVMSKPS HEX: f ] }
+        { float-4-rep  [ MOVMSKPS HEX: f ] }
+        [ drop PMOVMSKB HEX: ffff ]
+    } case ;
+
+M:: x86 %test-vector ( dst src temp rep vcc -- )
+    dst src rep %move-vector-mask :> mask
+    dst temp mask vcc %test-vector-mask ;
+
+:: %test-vector-mask-branch ( label temp mask vcc -- )
+    vcc {
+        { vcc-any    [ temp temp TEST label JNE ] }
+        { vcc-none   [ temp temp TEST label JE ] }
+        { vcc-all    [ temp mask CMP label JE ] }
+        { vcc-notall [ temp mask CMP label JNE ] }
+    } case ;
+
+M:: x86 %test-vector-branch ( label src temp rep vcc -- )
+    temp src rep %move-vector-mask :> mask
+    label temp mask vcc %test-vector-mask-branch ;
+
+M: x86 %test-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %add-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { float-4-rep [ ADDPS ] }
+        { double-2-rep [ ADDPD ] }
+        { char-16-rep [ PADDB ] }
+        { uchar-16-rep [ PADDB ] }
+        { short-8-rep [ PADDW ] }
+        { ushort-8-rep [ PADDW ] }
+        { int-4-rep [ PADDD ] }
+        { uint-4-rep [ PADDD ] }
+        { longlong-2-rep [ PADDQ ] }
+        { ulonglong-2-rep [ PADDQ ] }
+    } case ;
+
+M: x86 %add-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %saturated-add-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { char-16-rep [ PADDSB ] }
+        { uchar-16-rep [ PADDUSB ] }
+        { short-8-rep [ PADDSW ] }
+        { ushort-8-rep [ PADDUSW ] }
+    } case ;
+
+M: x86 %saturated-add-vector-reps
+    {
+        { sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep } }
+    } available-reps ;
+
+M: x86 %add-sub-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { float-4-rep [ ADDSUBPS ] }
+        { double-2-rep [ ADDSUBPD ] }
+    } case ;
+
+M: x86 %add-sub-vector-reps
+    {
+        { sse3? { float-4-rep double-2-rep } }
+    } available-reps ;
+
+M: x86 %sub-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { float-4-rep [ SUBPS ] }
+        { double-2-rep [ SUBPD ] }
+        { char-16-rep [ PSUBB ] }
+        { uchar-16-rep [ PSUBB ] }
+        { short-8-rep [ PSUBW ] }
+        { ushort-8-rep [ PSUBW ] }
+        { int-4-rep [ PSUBD ] }
+        { uint-4-rep [ PSUBD ] }
+        { longlong-2-rep [ PSUBQ ] }
+        { ulonglong-2-rep [ PSUBQ ] }
+    } case ;
+
+M: x86 %sub-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %saturated-sub-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { char-16-rep [ PSUBSB ] }
+        { uchar-16-rep [ PSUBUSB ] }
+        { short-8-rep [ PSUBSW ] }
+        { ushort-8-rep [ PSUBUSW ] }
+    } case ;
+
+M: x86 %saturated-sub-vector-reps
+    {
+        { sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep } }
+    } available-reps ;
+
+M: x86 %mul-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { float-4-rep [ MULPS ] }
+        { double-2-rep [ MULPD ] }
+        { short-8-rep [ PMULLW ] }
+        { ushort-8-rep [ PMULLW ] }
+        { int-4-rep [ PMULLD ] }
+        { uint-4-rep [ PMULLD ] }
+    } case ;
+
+M: x86 %mul-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep short-8-rep ushort-8-rep } }
+        { sse4.1? { int-4-rep uint-4-rep } }
+    } available-reps ;
+
+M: x86 %mul-high-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { short-8-rep  [ PMULHW ] }
+        { ushort-8-rep [ PMULHUW ] }
+    } case ;
+
+M: x86 %mul-high-vector-reps
+    {
+        { sse2? { short-8-rep ushort-8-rep } }
+    } available-reps ;
+
+M: x86 %mul-horizontal-add-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { char-16-rep  [ PMADDUBSW ] }
+        { uchar-16-rep [ PMADDUBSW ] }
+        { short-8-rep  [ PMADDWD ] }
+    } case ;
+
+M: x86 %mul-horizontal-add-vector-reps
+    {
+        { sse2?  { short-8-rep } }
+        { ssse3? { char-16-rep uchar-16-rep } }
+    } available-reps ;
+
+M: x86 %div-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { float-4-rep [ DIVPS ] }
+        { double-2-rep [ DIVPD ] }
+    } case ;
+
+M: x86 %div-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep } }
+    } available-reps ;
+
+M: x86 %min-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { char-16-rep [ PMINSB ] }
+        { uchar-16-rep [ PMINUB ] }
+        { short-8-rep [ PMINSW ] }
+        { ushort-8-rep [ PMINUW ] }
+        { int-4-rep [ PMINSD ] }
+        { uint-4-rep [ PMINUD ] }
+        { float-4-rep [ MINPS ] }
+        { double-2-rep [ MINPD ] }
+    } case ;
+
+M: x86 %min-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { uchar-16-rep short-8-rep double-2-rep } }
+        { sse4.1? { char-16-rep ushort-8-rep int-4-rep uint-4-rep } }
+    } available-reps ;
+
+M: x86 %max-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { char-16-rep [ PMAXSB ] }
+        { uchar-16-rep [ PMAXUB ] }
+        { short-8-rep [ PMAXSW ] }
+        { ushort-8-rep [ PMAXUW ] }
+        { int-4-rep [ PMAXSD ] }
+        { uint-4-rep [ PMAXUD ] }
+        { float-4-rep [ MAXPS ] }
+        { double-2-rep [ MAXPD ] }
+    } case ;
+
+M: x86 %max-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { uchar-16-rep short-8-rep double-2-rep } }
+        { sse4.1? { char-16-rep ushort-8-rep int-4-rep uint-4-rep } }
+    } available-reps ;
+
+M: x86 %avg-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { uchar-16-rep [ PAVGB ] }
+        { ushort-8-rep [ PAVGW ] }
+    } case ;
+
+M: x86 %avg-vector-reps
+    {
+        { sse2? { uchar-16-rep ushort-8-rep } }
+    } available-reps ;
+
+M: x86 %dot-vector
+    [ two-operand ] keep
+    {
+        { float-4-rep [ HEX: ff DPPS ] }
+        { double-2-rep [ HEX: ff DPPD ] }
+    } case ;
+
+M: x86 %dot-vector-reps
+    {
+        { sse4.1? { float-4-rep double-2-rep } }
+    } available-reps ;
+
+M: x86 %sad-vector
+    [ two-operand ] keep
+    {
+        { uchar-16-rep [ PSADBW ] }
+    } case ;
+
+M: x86 %sad-vector-reps
+    {
+        { sse2? { uchar-16-rep } }
+    } available-reps ;
+
+M: x86 %horizontal-add-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    signed-rep {
+        { float-4-rep  [ HADDPS ] }
+        { double-2-rep [ HADDPD ] }
+        { int-4-rep    [ PHADDD ] }
+        { short-8-rep  [ PHADDW ] }
+    } case ;
+
+M: x86 %horizontal-add-vector-reps
+    {
+        { sse3? { float-4-rep double-2-rep } }
+        { ssse3? { int-4-rep uint-4-rep short-8-rep ushort-8-rep } }
+    } available-reps ;
+
+M: x86 %horizontal-shl-vector-imm ( dst src1 src2 rep -- )
+    two-operand PSLLDQ ;
+
+M: x86 %horizontal-shl-vector-imm-reps
+    {
+        { sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep float-4-rep double-2-rep } }
+    } available-reps ;
+
+M: x86 %horizontal-shr-vector-imm ( dst src1 src2 rep -- )
+    two-operand PSRLDQ ;
+
+M: x86 %horizontal-shr-vector-imm-reps
+    {
+        { sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep float-4-rep double-2-rep } }
+    } available-reps ;
+
+M: x86 %abs-vector ( dst src rep -- )
+    {
+        { char-16-rep [ PABSB ] }
+        { short-8-rep [ PABSW ] }
+        { int-4-rep [ PABSD ] }
+    } case ;
+
+M: x86 %abs-vector-reps
+    {
+        { ssse3? { char-16-rep short-8-rep int-4-rep } }
+    } available-reps ;
+
+M: x86 %sqrt-vector ( dst src rep -- )
+    {
+        { float-4-rep [ SQRTPS ] }
+        { double-2-rep [ SQRTPD ] }
+    } case ;
+
+M: x86 %sqrt-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep } }
+    } available-reps ;
+
+M: x86 %and-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { float-4-rep [ ANDPS ] }
+        { double-2-rep [ ANDPS ] }
+        [ drop PAND ]
+    } case ;
+
+M: x86 %and-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %andn-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { float-4-rep [ ANDNPS ] }
+        { double-2-rep [ ANDNPS ] }
+        [ drop PANDN ]
+    } case ;
+
+M: x86 %andn-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %or-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { float-4-rep [ ORPS ] }
+        { double-2-rep [ ORPS ] }
+        [ drop POR ]
+    } case ;
+
+M: x86 %or-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %xor-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { float-4-rep [ XORPS ] }
+        { double-2-rep [ XORPS ] }
+        [ drop PXOR ]
+    } case ;
+
+M: x86 %xor-vector-reps
+    {
+        { sse? { float-4-rep } }
+        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %shl-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { short-8-rep [ PSLLW ] }
+        { ushort-8-rep [ PSLLW ] }
+        { int-4-rep [ PSLLD ] }
+        { uint-4-rep [ PSLLD ] }
+        { longlong-2-rep [ PSLLQ ] }
+        { ulonglong-2-rep [ PSLLQ ] }
+    } case ;
+
+M: x86 %shl-vector-reps
+    {
+        { sse2? { short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %shr-vector ( dst src1 src2 rep -- )
+    [ two-operand ] keep
+    {
+        { short-8-rep [ PSRAW ] }
+        { ushort-8-rep [ PSRLW ] }
+        { int-4-rep [ PSRAD ] }
+        { uint-4-rep [ PSRLD ] }
+        { ulonglong-2-rep [ PSRLQ ] }
+    } case ;
+
+M: x86 %shr-vector-reps
+    {
+        { sse2? { short-8-rep ushort-8-rep int-4-rep uint-4-rep ulonglong-2-rep } }
+    } available-reps ;
+
+M: x86 %shl-vector-imm %shl-vector ;
+M: x86 %shl-vector-imm-reps %shl-vector-reps ;
+M: x86 %shr-vector-imm %shr-vector ;
+M: x86 %shr-vector-imm-reps %shr-vector-reps ;
+
+: scalar-sized-reg ( reg rep -- reg' )
+    rep-size 8 * n-bit-version-of ;
+
+M: x86 %integer>scalar drop MOVD ;
+
+:: %scalar>integer-32 ( dst src rep -- )
+    rep {
+        { int-scalar-rep [
+            dst 32-bit-version-of src MOVD
+            dst dst 32-bit-version-of
+            2dup eq? [ 2drop ] [ MOVSX ] if
+        ] }
+        { uint-scalar-rep [
+            dst 32-bit-version-of src MOVD
+        ] }
+        { short-scalar-rep [
+            dst 32-bit-version-of src MOVD
+            dst dst 16-bit-version-of MOVSX
+        ] }
+        { ushort-scalar-rep [
+            dst 32-bit-version-of src MOVD
+            dst dst 16-bit-version-of MOVZX
+        ] }
+        { char-scalar-rep [
+            dst 32-bit-version-of src MOVD
+            dst { } 8 [| tmp-dst |
+                tmp-dst dst int-rep %copy
+                tmp-dst tmp-dst 8-bit-version-of MOVSX
+                dst tmp-dst int-rep %copy
+            ] with-small-register
+        ] }
+        { uchar-scalar-rep [
+            dst 32-bit-version-of src MOVD
+            dst { } 8 [| tmp-dst |
+                tmp-dst dst int-rep %copy
+                tmp-dst tmp-dst 8-bit-version-of MOVZX
+                dst tmp-dst int-rep %copy
+            ] with-small-register
+        ] }
+    } case ;
+
+M: x86.32 %scalar>integer ( dst src rep -- ) %scalar>integer-32 ;
+
+M: x86.64 %scalar>integer ( dst src rep -- )
+    {
+        { longlong-scalar-rep  [ MOVD ] }
+        { ulonglong-scalar-rep [ MOVD ] }
+        [ %scalar>integer-32 ]
+    } case ;
+
+M: x86 %vector>scalar %copy ;
+
+M: x86 %scalar>vector %copy ;
+
+enable-float-intrinsics
+enable-float-functions
+enable-float-min/max
+enable-fsqrt
diff --git a/basis/cpu/x86/sse/tags.txt b/basis/cpu/x86/sse/tags.txt
new file mode 100644 (file)
index 0000000..ebb74b4
--- /dev/null
@@ -0,0 +1 @@
+not loaded
index 50dfc5156eaf27de98ef174f5412cee2e92b37a0..44629a587600e5c756a09a445297a40dbfdbbf09 100644 (file)
@@ -1,2 +1,2 @@
-untested
+not loaded
 compiler
diff --git a/basis/cpu/x86/unix/bootstrap.factor b/basis/cpu/x86/unix/bootstrap.factor
new file mode 100644 (file)
index 0000000..20dd738
--- /dev/null
@@ -0,0 +1,13 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: cpu.x86.assembler cpu.x86.assembler.operands kernel
+layouts ;
+IN: bootstrap.x86
+
+DEFER: stack-reg
+
+: jit-save-tib ( -- ) ;
+: jit-restore-tib ( -- ) ;
+: jit-update-tib ( ctx-reg -- ) drop ;
+: jit-install-seh ( -- ) stack-reg bootstrap-cell ADD ;
+: jit-update-seh ( ctx-reg -- ) drop ;
diff --git a/basis/cpu/x86/winnt/bootstrap.factor b/basis/cpu/x86/winnt/bootstrap.factor
new file mode 100644 (file)
index 0000000..b81c1eb
--- /dev/null
@@ -0,0 +1,32 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: bootstrap.image.private compiler.constants
+cpu.x86.assembler cpu.x86.assembler.operands kernel layouts
+locals parser sequences ;
+IN: bootstrap.x86
+
+: tib-exception-list-offset ( -- n ) 0 bootstrap-cells ;
+: tib-stack-base-offset ( -- n ) 1 bootstrap-cells ;
+: tib-stack-limit-offset ( -- n ) 2 bootstrap-cells ;
+
+: jit-save-tib ( -- )
+    tib-exception-list-offset [] tib-segment PUSH
+    tib-stack-base-offset [] tib-segment PUSH
+    tib-stack-limit-offset [] tib-segment PUSH ;
+
+: jit-restore-tib ( -- )
+    tib-stack-limit-offset [] tib-segment POP
+    tib-stack-base-offset [] tib-segment POP
+    tib-exception-list-offset [] tib-segment POP ;
+
+:: jit-update-tib ( ctx-reg -- )
+    ! There's a redundant load here because we're not allowed
+    ! to clobber ctx-reg. Clobbers tib-temp.
+    ! Save callstack base in TIB
+    tib-temp ctx-reg context-callstack-seg-offset [+] MOV
+    tib-temp tib-temp segment-end-offset [+] MOV
+    tib-stack-base-offset [] tib-temp tib-segment MOV
+    ! Save callstack limit in TIB
+    tib-temp ctx-reg context-callstack-seg-offset [+] MOV
+    tib-temp tib-temp segment-start-offset [+] MOV
+    tib-stack-limit-offset [] tib-temp tib-segment MOV ;
index e54e307f79fffe8478574272d83732db7f04a1fa..58343a4eeef247ba507c07451b83da6fdc42792f 100644 (file)
@@ -5,13 +5,15 @@ cpu.x86.assembler cpu.x86.assembler.private cpu.x86.assembler.operands
 cpu.x86.features cpu.x86.features.private cpu.architecture kernel
 kernel.private math memory namespaces make sequences words system
 layouts combinators math.order math.vectors fry locals compiler.constants
-byte-arrays io macros quotations compiler compiler.units init vm
+byte-arrays io macros quotations classes.algebra compiler
+compiler.units init vm vocabs.loader
 compiler.cfg.registers
 compiler.cfg.instructions
 compiler.cfg.intrinsics
 compiler.cfg.comparisons
 compiler.cfg.stack-frame
 compiler.codegen.fixup ;
+QUALIFIED-WITH: alien.c-types c
 FROM: layouts => cell ;
 FROM: math => float ;
 IN: cpu.x86
@@ -24,22 +26,17 @@ M: x86 vector-regs float-regs ;
 
 HOOK: stack-reg cpu ( -- reg )
 
-HOOK: frame-reg cpu ( -- reg )
-
 HOOK: reserved-stack-space cpu ( -- n )
 
-HOOK: extra-stack-space cpu ( stack-frame -- n )
-
 : stack@ ( n -- op ) stack-reg swap [+] ;
 
-: special@ ( n -- op )
-    stack-frame get extra-stack-space +
-    reserved-stack-space +
-    stack@ ;
+: special-offset ( m -- n )
+    reserved-stack-space + ;
 
-: spill@ ( n -- op ) spill-offset special@ ;
+: spill@ ( n -- op ) spill-offset special-offset stack@ ;
 
-: gc-root@ ( n -- op ) gc-root-offset special@ ;
+: gc-root-offsets ( seq -- seq' )
+    [ n>> spill-offset special-offset cell + ] map f like ;
 
 : decr-stack-reg ( n -- )
     dup 0 = [ drop ] [ stack-reg swap SUB ] if ;
@@ -50,21 +47,27 @@ HOOK: extra-stack-space cpu ( stack-frame -- n )
 : align-stack ( n -- n' ) 16 align ;
 
 M: x86 stack-frame-size ( stack-frame -- i )
-    [ (stack-frame-size) ]
-    [ extra-stack-space ] bi +
+    (stack-frame-size)
     reserved-stack-space +
     3 cells +
     align-stack ;
 
-! Must be a volatile register not used for parameter passing or
-! integer return
-HOOK: temp-reg cpu ( -- reg )
-
 HOOK: pic-tail-reg cpu ( -- reg )
 
+M: x86 complex-addressing? t ;
+
+M: x86 fused-unboxing? t ;
+
+M: x86 test-instruction? t ;
+
+M: x86 immediate-store? immediate-comparand? ;
+
 M: x86 %load-immediate dup 0 = [ drop dup XOR ] [ MOV ] if ;
 
-M: x86 %load-reference swap 0 MOV rc-absolute-cell rel-immediate ;
+M: x86 %load-reference
+    [ swap 0 MOV rc-absolute-cell rel-literal ]
+    [ \ f type-number MOV ]
+    if* ;
 
 HOOK: ds-reg cpu ( -- reg )
 HOOK: rs-reg cpu ( -- reg )
@@ -77,7 +80,17 @@ M: ds-loc loc>operand n>> ds-reg reg-stack ;
 M: rs-loc loc>operand n>> rs-reg reg-stack ;
 
 M: x86 %peek loc>operand MOV ;
+
 M: x86 %replace loc>operand swap MOV ;
+
+M: x86 %replace-imm
+    loc>operand swap
+    {
+        { [ dup not ] [ drop \ f type-number MOV ] }
+        { [ dup fixnum? ] [ tag-fixnum MOV ] }
+        [ [ HEX: ffffffff MOV ] dip rc-absolute rel-literal ]
+    } cond ;
+
 : (%inc) ( n reg -- ) swap cells dup 0 > [ ADD ] [ neg SUB ] if ; inline
 M: x86 %inc-d ( n -- ) ds-reg (%inc) ;
 M: x86 %inc-r ( n -- ) rs-reg (%inc) ;
@@ -98,18 +111,12 @@ M: x86 %jump-label ( label -- ) 0 JMP rc-relative label-fixup ;
 
 M: x86 %return ( -- ) 0 RET ;
 
-: code-alignment ( align -- n )
-    [ building get length dup ] dip align swap - ;
-
-: align-code ( n -- )
-    0 <repetition> % ;
-
-:: (%slot-imm) ( obj slot tag -- op )
-    obj slot tag slot-offset [+] ; inline
+: (%slot) ( obj slot scale tag -- op ) neg <indirect> ; inline
+: (%slot-imm) ( obj slot tag -- op ) slot-offset [+] ; inline
 
-M: x86 %slot ( dst obj slot -- ) [+] MOV ;
+M: x86 %slot ( dst obj slot scale tag -- ) (%slot) MOV ;
 M: x86 %slot-imm ( dst obj slot tag -- ) (%slot-imm) MOV ;
-M: x86 %set-slot ( src obj slot -- ) [+] swap MOV ;
+M: x86 %set-slot ( src obj slot scale tag -- ) (%slot) swap MOV ;
 M: x86 %set-slot-imm ( src obj slot tag -- ) (%slot-imm) swap MOV ;
 
 :: two-operand ( dst src1 src2 rep -- dst src )
@@ -125,7 +132,7 @@ M: x86 %add     2over eq? [ nip ADD ] [ [+] LEA ] if ;
 M: x86 %add-imm 2over eq? [ nip ADD ] [ [+] LEA ] if ;
 M: x86 %sub     int-rep two-operand SUB ;
 M: x86 %sub-imm 2over eq? [ nip SUB ] [ neg [+] LEA ] if ;
-M: x86 %mul     int-rep two-operand swap IMUL2 ;
+M: x86 %mul     int-rep two-operand IMUL2 ;
 M: x86 %mul-imm IMUL3 ;
 M: x86 %and     int-rep two-operand AND ;
 M: x86 %and-imm int-rep two-operand AND ;
@@ -143,6 +150,7 @@ M: x86 %max     int-rep two-operand [ CMP ] [ CMOVL ] 2bi ;
 M: x86 %not     int-rep one-operand NOT ;
 M: x86 %neg     int-rep one-operand NEG ;
 M: x86 %log2    BSR ;
+M: x86 %bit-count POPCNT ;
 
 ! A bit of logic to avoid using MOVSS/MOVSD for reg-reg moves
 ! since this induces partial register stalls
@@ -151,30 +159,32 @@ GENERIC: copy-memory* ( dst src rep -- )
 
 M: int-rep copy-register* drop MOV ;
 M: tagged-rep copy-register* drop MOV ;
-M: float-rep copy-register* drop MOVAPS ;
-M: double-rep copy-register* drop MOVAPS ;
-M: float-4-rep copy-register* drop MOVAPS ;
-M: double-2-rep copy-register* drop MOVAPS ;
-M: vector-rep copy-register* drop MOVDQA ;
 
 M: object copy-memory* copy-register* ;
-M: float-rep copy-memory* drop MOVSS ;
-M: double-rep copy-memory* drop MOVSD ;
+
+: ?spill-slot ( obj -- obj ) dup spill-slot? [ n>> spill@ ] when ;
 
 M: x86 %copy ( dst src rep -- )
     2over eq? [ 3drop ] [
-        [ [ dup spill-slot? [ n>> spill@ ] when ] bi@ ] dip
+        [ [ ?spill-slot ] bi@ ] dip
         2over [ register? ] both? [ copy-register* ] [ copy-memory* ] if
     ] if ;
 
-M: x86 %fixnum-add ( label dst src1 src2 -- )
-    int-rep two-operand ADD JO ;
+: fixnum-overflow ( label dst src1 src2 cc quot -- )
+    swap [ [ int-rep two-operand ] dip call ] dip
+    {
+        { cc-o [ JO ] }
+        { cc/o [ JNO ] }
+    } case ; inline
+
+M: x86 %fixnum-add ( label dst src1 src2 cc -- )
+    [ ADD ] fixnum-overflow ;
 
-M: x86 %fixnum-sub ( label dst src1 src2 -- )
-    int-rep two-operand SUB JO ;
+M: x86 %fixnum-sub ( label dst src1 src2 cc -- )
+    [ SUB ] fixnum-overflow ;
 
-M: x86 %fixnum-mul ( label dst src1 src2 -- )
-    int-rep two-operand swap IMUL2 JO ;
+M: x86 %fixnum-mul ( label dst src1 src2 cc -- )
+    [ IMUL2 ] fixnum-overflow ;
 
 M: x86 %unbox-alien ( dst src -- )
     alien-offset [+] MOV ;
@@ -215,12 +225,68 @@ M:: x86 %box-alien ( dst src temp -- )
         "end" resolve-label
     ] with-scope ;
 
+:: %box-displaced-alien/f ( dst displacement -- )
+    dst 1 alien@ \ f type-number MOV
+    dst 3 alien@ displacement MOV
+    dst 4 alien@ displacement MOV ;
+
+:: %box-displaced-alien/alien ( dst displacement base temp -- )
+    ! Set new alien's base to base.base
+    temp base 1 alien@ MOV
+    dst 1 alien@ temp MOV
+
+    ! Compute displacement
+    temp base 3 alien@ MOV
+    temp displacement ADD
+    dst 3 alien@ temp MOV
+
+    ! Compute address
+    temp base 4 alien@ MOV
+    temp displacement ADD
+    dst 4 alien@ temp MOV ;
+
+:: %box-displaced-alien/byte-array ( dst displacement base temp -- )
+    dst 1 alien@ base MOV
+    dst 3 alien@ displacement MOV
+    temp base displacement byte-array-offset [++] LEA
+    dst 4 alien@ temp MOV ;
+
+:: %box-displaced-alien/dynamic ( dst displacement base temp -- )
+    "not-f" define-label
+    "not-alien" define-label
+
+    ! Check base type
+    temp base MOV
+    temp tag-mask get AND
+
+    ! Is base f?
+    temp \ f type-number CMP
+    "not-f" get JNE
+
+    ! Yes, it is f. Fill in new object
+    dst displacement %box-displaced-alien/f
+
+    "end" get JMP
+
+    "not-f" resolve-label
+
+    ! Is base an alien?
+    temp alien type-number CMP
+    "not-alien" get JNE
+
+    dst displacement base temp %box-displaced-alien/alien
+
+    ! We are done
+    "end" get JMP
+
+    ! Is base a byte array? It has to be, by now...
+    "not-alien" resolve-label
+
+    dst displacement base temp %box-displaced-alien/byte-array ;
+
 M:: x86 %box-displaced-alien ( dst displacement base temp base-class -- )
-    ! This is ridiculous
     [
         "end" define-label
-        "not-f" define-label
-        "not-alien" define-label
 
         ! If displacement is zero, return the base
         dst base MOV
@@ -234,53 +300,13 @@ M:: x86 %box-displaced-alien ( dst displacement base temp base-class -- )
         ! Set expired to f
         dst 2 alien@ \ f type-number MOV
 
-        ! Is base f?
-        base \ f type-number CMP
-        "not-f" get JNE
-
-        ! Yes, it is f. Fill in new object
-        dst 1 alien@ base MOV
-        dst 3 alien@ displacement MOV
-        dst 4 alien@ displacement MOV
-
-        "end" get JMP
-
-        "not-f" resolve-label
-
-        ! Check base type
-        temp base MOV
-        temp tag-mask get AND
-
-        ! Is base an alien?
-        temp alien type-number CMP
-        "not-alien" get JNE
-
-        ! Yes, it is an alien. Set new alien's base to base.base
-        temp base 1 alien@ MOV
-        dst 1 alien@ temp MOV
-
-        ! Compute displacement
-        temp base 3 alien@ MOV
-        temp displacement ADD
-        dst 3 alien@ temp MOV
-
-        ! Compute address
-        temp base 4 alien@ MOV
-        temp displacement ADD
-        dst 4 alien@ temp MOV
-
-        ! We are done
-        "end" get JMP
-
-        ! Is base a byte array? It has to be, by now...
-        "not-alien" resolve-label
-
-        dst 1 alien@ base MOV
-        dst 3 alien@ displacement MOV
-        temp base MOV
-        temp byte-array-offset ADD
-        temp displacement ADD
-        dst 4 alien@ temp MOV
+        dst displacement base temp
+        {
+            { [ base-class \ f class<= ] [ 2drop %box-displaced-alien/f ] }
+            { [ base-class \ alien class<= ] [ %box-displaced-alien/alien ] }
+            { [ base-class \ byte-array class<= ] [ %box-displaced-alien/byte-array ] }
+            [ %box-displaced-alien/dynamic ]
+        } cond
 
         "end" resolve-label
     ] with-scope ;
@@ -322,82 +348,66 @@ M: x86.64 has-small-reg? 2drop t ;
         [ quot call ] with-save/restore
     ] if ; inline
 
-M:: x86 %string-nth ( dst src index temp -- )
-    ! We request a small-reg of size 8 since those of size 16 are
-    ! a superset.
-    "end" define-label
-    dst { src index temp } 8 [| new-dst |
-        ! Load the least significant 7 bits into new-dst.
-        ! 8th bit indicates whether we have to load from
-        ! the aux vector or not.
-        temp src index [+] LEA
-        new-dst 8-bit-version-of temp string-offset [+] MOV
-        new-dst new-dst 8-bit-version-of MOVZX
-        ! Do we have to look at the aux vector?
-        new-dst HEX: 80 CMP
-        "end" get JL
-        ! Yes, this is a non-ASCII character. Load aux vector
-        temp src string-aux-offset [+] MOV
-        new-dst temp XCHG
-        ! Compute index
-        new-dst index ADD
-        new-dst index ADD
-        ! Load high 16 bits
-        new-dst 16-bit-version-of new-dst byte-array-offset [+] MOV
-        new-dst new-dst 16-bit-version-of MOVZX
-        new-dst 7 SHL
-        ! Compute code point
-        new-dst temp XOR
-        "end" resolve-label
-        dst new-dst int-rep %copy
-    ] with-small-register ;
-
-M:: x86 %set-string-nth-fast ( ch str index temp -- )
-    ch { index str temp } 8 [| new-ch |
-        new-ch ch int-rep %copy
-        temp str index [+] LEA
-        temp string-offset [+] new-ch 8-bit-version-of MOV
-    ] with-small-register ;
-
-:: %alien-integer-getter ( dst src offset size quot -- )
-    dst { src } size [| new-dst |
-        new-dst dup size n-bit-version-of dup src offset [+] MOV
+:: %alien-integer-getter ( dst exclude address bits quot -- )
+    dst exclude bits [| new-dst |
+        new-dst dup bits n-bit-version-of dup address MOV
         quot call
         dst new-dst int-rep %copy
     ] with-small-register ; inline
 
-: %alien-unsigned-getter ( dst src offset size -- )
+: %alien-unsigned-getter ( dst exclude address bits -- )
     [ MOVZX ] %alien-integer-getter ; inline
 
-: %alien-signed-getter ( dst src offset size -- )
+: %alien-signed-getter ( dst exclude address bits -- )
     [ MOVSX ] %alien-integer-getter ; inline
 
-:: %alien-integer-setter ( ptr offset value size -- )
-    value { ptr } size [| new-value |
+:: %alien-integer-setter ( value exclude address bits -- )
+    value exclude bits [| new-value |
         new-value value int-rep %copy
-        ptr offset [+] new-value size n-bit-version-of MOV
+        address new-value bits n-bit-version-of MOV
     ] with-small-register ; inline
 
-M: x86 %alien-unsigned-1 8 %alien-unsigned-getter ;
-M: x86 %alien-unsigned-2 16 %alien-unsigned-getter ;
-M: x86 %alien-unsigned-4 32 [ 2drop ] %alien-integer-getter ;
+: (%memory) ( base displacement scale offset rep c-type -- exclude address rep c-type )
+    [ [ [ 2array ] 2keep ] 2dip <indirect> ] 2dip ;
+
+: (%memory-imm) ( base offset rep c-type -- exclude address rep c-type )
+    [ [ drop 1array ] [ [+] ] 2bi ] 2dip ;
+
+: (%load-memory) ( dst exclude address rep c-type -- )
+    [
+        {
+            { c:char   [ 8 %alien-signed-getter ] }
+            { c:uchar  [ 8 %alien-unsigned-getter ] }
+            { c:short  [ 16 %alien-signed-getter ] }
+            { c:ushort [ 16 %alien-unsigned-getter ] }
+            { c:int    [ 32 %alien-signed-getter ] }
+            { c:uint   [ 32 [ 2drop ] %alien-integer-getter ] }
+        } case
+    ] [ [ drop ] 2dip %copy ] ?if ;
+
+M: x86 %load-memory ( dst base displacement scale offset rep c-type -- )
+    (%memory) (%load-memory) ;
+
+M: x86 %load-memory-imm ( dst base offset rep c-type -- )
+    (%memory-imm) (%load-memory) ;
 
-M: x86 %alien-signed-1 8 %alien-signed-getter ;
-M: x86 %alien-signed-2 16 %alien-signed-getter ;
-M: x86 %alien-signed-4 32 %alien-signed-getter ;
+: (%store-memory) ( src exclude address rep c-type -- )
+    [
+        {
+            { c:char   [ 8 %alien-integer-setter ] }
+            { c:uchar  [ 8 %alien-integer-setter ] }
+            { c:short  [ 16 %alien-integer-setter ] }
+            { c:ushort [ 16 %alien-integer-setter ] }
+            { c:int    [ 32 %alien-integer-setter ] }
+            { c:uint   [ 32 %alien-integer-setter ] }
+        } case
+    ] [ [ nip swap ] dip %copy ] ?if ;
 
-M: x86 %alien-cell [+] MOV ;
-M: x86 %alien-float [+] MOVSS ;
-M: x86 %alien-double [+] MOVSD ;
-M: x86 %alien-vector [ [+] ] dip %copy ;
+M: x86 %store-memory ( src base displacement scale offset rep c-type -- )
+    (%memory) (%store-memory) ;
 
-M: x86 %set-alien-integer-1 8 %alien-integer-setter ;
-M: x86 %set-alien-integer-2 16 %alien-integer-setter ;
-M: x86 %set-alien-integer-4 32 %alien-integer-setter ;
-M: x86 %set-alien-cell [ [+] ] dip MOV ;
-M: x86 %set-alien-float [ [+] ] dip MOVSS ;
-M: x86 %set-alien-double [ [+] ] dip MOVSD ;
-M: x86 %set-alien-vector [ [+] ] 2dip %copy ;
+M: x86 %store-memory-imm ( src base offset rep c-type -- )
+    (%memory-imm) (%store-memory) ;
 
 : shift-count? ( reg -- ? ) { ECX RCX } member-eq? ;
 
@@ -423,8 +433,13 @@ M: x86 %sar int-rep two-operand [ SAR ] emit-shift ;
 
 HOOK: %mov-vm-ptr cpu ( reg -- )
 
+HOOK: %vm-field-ptr cpu ( reg offset -- )
+
+: load-zone-offset ( nursery-ptr -- )
+    "nursery" vm-field-offset %vm-field-ptr ;
+
 : load-allot-ptr ( nursery-ptr allot-ptr -- )
-    [ drop "nursery" %vm-field-ptr ] [ swap [] MOV ] 2bi ;
+    [ drop load-zone-offset ] [ swap [] MOV ] 2bi ;
 
 : inc-allot-ptr ( nursery-ptr n -- )
     [ [] ] dip data-alignment get align ADD ;
@@ -444,969 +459,148 @@ M:: x86 %allot ( dst size class nursery-ptr -- )
 HOOK: %mark-card cpu ( card temp -- )
 HOOK: %mark-deck cpu ( card temp -- )
 
-:: (%write-barrier) ( src slot temp1 temp2 -- )
-    temp1 src slot [+] LEA
+:: (%write-barrier) ( temp1 temp2 -- )
     temp1 card-bits SHR
     temp1 temp2 %mark-card
     temp1 deck-bits card-bits - SHR
     temp1 temp2 %mark-deck ;
 
-M: x86 %write-barrier ( src slot temp1 temp2 -- ) (%write-barrier) ;
+M:: x86 %write-barrier ( src slot scale tag temp1 temp2 -- )
+    temp1 src slot scale tag (%slot) LEA
+    temp1 temp2 (%write-barrier) ;
 
-M: x86 %write-barrier-imm ( src slot temp1 temp2 -- ) (%write-barrier) ;
+M:: x86 %write-barrier-imm ( src slot tag temp1 temp2 -- )
+    temp1 src slot tag (%slot-imm) LEA
+    temp1 temp2 (%write-barrier) ;
 
-M:: x86 %check-nursery ( label size temp1 temp2 -- )
-    temp1 "nursery" %vm-field-ptr
-    ! Load 'here' into temp2
+M:: x86 %check-nursery-branch ( label size cc temp1 temp2 -- )
+    temp1 load-zone-offset
     temp2 temp1 [] MOV
     temp2 size ADD
-    ! Load 'end' into temp1
-    temp1 temp1 2 cells [+] MOV
-    temp2 temp1 CMP
-    label JLE ;
-
-M: x86 %save-gc-root ( gc-root register -- ) [ gc-root@ ] dip MOV ;
-
-M: x86 %load-gc-root ( gc-root register -- ) swap gc-root@ MOV ;
+    temp2 temp1 2 cells [+] CMP
+    cc {
+        { cc<= [ label JLE ] }
+        { cc/<= [ label JG ] }
+    } case ;
 
 M: x86 %alien-global ( dst symbol library -- )
     [ 0 MOV ] 2dip rc-absolute-cell rel-dlsym ;    
 
-M: x86 %push-stack ( -- )
-    ds-reg cell ADD
-    ds-reg [] int-regs return-reg MOV ;
-
-M: x86 %push-context-stack ( -- )
-    temp-reg "ctx" %vm-field
-    temp-reg "datastack" context-field-offset [+] bootstrap-cell ADD
-    temp-reg temp-reg "datastack" context-field-offset [+] MOV
-    temp-reg [] int-regs return-reg MOV ;
-
 M: x86 %epilogue ( n -- ) cell - incr-stack-reg ;
 
-:: %boolean ( dst temp word -- )
+:: (%boolean) ( dst temp insn -- )
     dst \ f type-number MOV
-    temp 0 MOV \ t rc-absolute-cell rel-immediate
-    dst temp word execute ; inline
-
-: (%compare) ( src1 src2 cc -- )
-    2over [ { cc= cc/= } member? ] [ register? ] [ 0 = ] tri* and and
-    [ drop dup TEST ]
-    [ CMP ] if ;
-
-M:: x86 %compare ( dst src1 src2 cc temp -- )
-    src1 src2 cc (%compare)
-    cc order-cc {
-        { cc<  [ dst temp \ CMOVL %boolean ] }
-        { cc<= [ dst temp \ CMOVLE %boolean ] }
-        { cc>  [ dst temp \ CMOVG %boolean ] }
-        { cc>= [ dst temp \ CMOVGE %boolean ] }
-        { cc=  [ dst temp \ CMOVE %boolean ] }
-        { cc/= [ dst temp \ CMOVNE %boolean ] }
-    } case ;
-
-M: x86 %compare-imm ( dst src1 src2 cc temp -- )
-    %compare ;
-
-M:: x86 %compare-branch ( label src1 src2 cc -- )
-    src1 src2 cc (%compare)
-    cc order-cc {
-        { cc<  [ label JL ] }
-        { cc<= [ label JLE ] }
-        { cc>  [ label JG ] }
-        { cc>= [ label JGE ] }
-        { cc=  [ label JE ] }
-        { cc/= [ label JNE ] }
-    } case ;
-
-M: x86 %compare-imm-branch ( label src1 src2 cc -- )
-    %compare-branch ;
-
-M: x86 %add-float double-rep two-operand ADDSD ;
-M: x86 %sub-float double-rep two-operand SUBSD ;
-M: x86 %mul-float double-rep two-operand MULSD ;
-M: x86 %div-float double-rep two-operand DIVSD ;
-M: x86 %min-float double-rep two-operand MINSD ;
-M: x86 %max-float double-rep two-operand MAXSD ;
-M: x86 %sqrt SQRTSD ;
-
-: %clear-unless-in-place ( dst src -- )
-    over = [ drop ] [ dup XORPS ] if ;
-
-M: x86 %single>double-float [ %clear-unless-in-place ] [ CVTSS2SD ] 2bi ;
-M: x86 %double>single-float [ %clear-unless-in-place ] [ CVTSD2SS ] 2bi ;
-
-M: x86 %integer>float [ drop dup XORPS ] [ CVTSI2SD ] 2bi ;
-M: x86 %float>integer CVTTSD2SI ;
-
-: %cmov-float= ( dst src -- )
-    [
-        "no-move" define-label
-
-        "no-move" get [ JNE ] [ JP ] bi
-        MOV
-        "no-move" resolve-label
-    ] with-scope ;
-
-: %cmov-float/= ( dst src -- )
-    [
-        "no-move" define-label
-        "move" define-label
-
-        "move" get JP
-        "no-move" get JE
-        "move" resolve-label
-        MOV
-        "no-move" resolve-label
-    ] with-scope ;
-
-:: (%compare-float) ( dst src1 src2 cc temp compare -- )
-    cc {
-        { cc<    [ src2 src1 \ compare execute( a b -- ) dst temp \ CMOVA  %boolean ] }
-        { cc<=   [ src2 src1 \ compare execute( a b -- ) dst temp \ CMOVAE %boolean ] }
-        { cc>    [ src1 src2 \ compare execute( a b -- ) dst temp \ CMOVA  %boolean ] }
-        { cc>=   [ src1 src2 \ compare execute( a b -- ) dst temp \ CMOVAE %boolean ] }
-        { cc=    [ src1 src2 \ compare execute( a b -- ) dst temp \ %cmov-float= %boolean ] }
-        { cc<>   [ src1 src2 \ compare execute( a b -- ) dst temp \ CMOVNE %boolean ] }
-        { cc<>=  [ src1 src2 \ compare execute( a b -- ) dst temp \ CMOVNP %boolean ] }
-        { cc/<   [ src2 src1 \ compare execute( a b -- ) dst temp \ CMOVBE %boolean ] }
-        { cc/<=  [ src2 src1 \ compare execute( a b -- ) dst temp \ CMOVB  %boolean ] }
-        { cc/>   [ src1 src2 \ compare execute( a b -- ) dst temp \ CMOVBE %boolean ] }
-        { cc/>=  [ src1 src2 \ compare execute( a b -- ) dst temp \ CMOVB  %boolean ] }
-        { cc/=   [ src1 src2 \ compare execute( a b -- ) dst temp \ %cmov-float/= %boolean ] }
-        { cc/<>  [ src1 src2 \ compare execute( a b -- ) dst temp \ CMOVE  %boolean ] }
-        { cc/<>= [ src1 src2 \ compare execute( a b -- ) dst temp \ CMOVP  %boolean ] }
-    } case ; inline
-
-M: x86 %compare-float-ordered ( dst src1 src2 cc temp -- )
-    \ COMISD (%compare-float) ;
-
-M: x86 %compare-float-unordered ( dst src1 src2 cc temp -- )
-    \ UCOMISD (%compare-float) ;
-
-: %jump-float= ( label -- )
-    [
-        "no-jump" define-label
-        "no-jump" get JP
-        JE
-        "no-jump" resolve-label
-    ] with-scope ;
-
-: %jump-float/= ( label -- )
-    [ JNE ] [ JP ] bi ;
-
-:: (%compare-float-branch) ( label src1 src2 cc compare -- )
-    cc {
-        { cc<    [ src2 src1 \ compare execute( a b -- ) label JA  ] }
-        { cc<=   [ src2 src1 \ compare execute( a b -- ) label JAE ] }
-        { cc>    [ src1 src2 \ compare execute( a b -- ) label JA  ] }
-        { cc>=   [ src1 src2 \ compare execute( a b -- ) label JAE ] }
-        { cc=    [ src1 src2 \ compare execute( a b -- ) label %jump-float= ] }
-        { cc<>   [ src1 src2 \ compare execute( a b -- ) label JNE ] }
-        { cc<>=  [ src1 src2 \ compare execute( a b -- ) label JNP ] }
-        { cc/<   [ src2 src1 \ compare execute( a b -- ) label JBE ] }
-        { cc/<=  [ src2 src1 \ compare execute( a b -- ) label JB  ] }
-        { cc/>   [ src1 src2 \ compare execute( a b -- ) label JBE ] }
-        { cc/>=  [ src1 src2 \ compare execute( a b -- ) label JB  ] }
-        { cc/=   [ src1 src2 \ compare execute( a b -- ) label %jump-float/= ] }
-        { cc/<>  [ src1 src2 \ compare execute( a b -- ) label JE  ] }
-        { cc/<>= [ src1 src2 \ compare execute( a b -- ) label JP  ] }
-    } case ;
-
-M: x86 %compare-float-ordered-branch ( label src1 src2 cc -- )
-    \ COMISD (%compare-float-branch) ;
-
-M: x86 %compare-float-unordered-branch ( label src1 src2 cc -- )
-    \ UCOMISD (%compare-float-branch) ;
-
-MACRO: available-reps ( alist -- )
-    ! Each SSE version adds new representations and supports
-    ! all old ones
-    unzip { } [ append ] accumulate rest swap suffix
-    [ [ 1quotation ] map ] bi@ zip
-    reverse [ { } ] suffix
-    '[ _ cond ] ;
-
-M: x86 %alien-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
-
-M: x86 %zero-vector
-    {
-        { double-2-rep [ dup XORPS ] }
-        { float-4-rep [ dup XORPS ] }
-        [ drop dup PXOR ]
-    } case ;
-
-M: x86 %zero-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
-
-M: x86 %fill-vector
-    {
-        { double-2-rep [ dup [ XORPS ] [ CMPEQPS ] 2bi ] }
-        { float-4-rep  [ dup [ XORPS ] [ CMPEQPS ] 2bi ] }
-        [ drop dup PCMPEQB ]
-    } case ;
-
-M: x86 %fill-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
-
-M:: x86 %gather-vector-4 ( dst src1 src2 src3 src4 rep -- )
-    rep signed-rep {
-        { float-4-rep [
-            dst src1 float-4-rep %copy
-            dst src2 UNPCKLPS
-            src3 src4 UNPCKLPS
-            dst src3 MOVLHPS
-        ] }
-        { int-4-rep [
-            dst src1 int-4-rep %copy
-            dst src2 PUNPCKLDQ
-            src3 src4 PUNPCKLDQ
-            dst src3 PUNPCKLQDQ
-        ] }
-    } case ;
-
-M: x86 %gather-vector-4-reps
-    {
-        ! Can't do this with sse1 since it will want to unbox
-        ! double-precision floats and convert to single precision
-        { sse2? { float-4-rep int-4-rep uint-4-rep } }
-    } available-reps ;
-
-M:: x86 %gather-vector-2 ( dst src1 src2 rep -- )
-    rep signed-rep {
-        { double-2-rep [
-            dst src1 double-2-rep %copy
-            dst src2 MOVLHPS
-        ] }
-        { longlong-2-rep [
-            dst src1 longlong-2-rep %copy
-            dst src2 PUNPCKLQDQ
-        ] }
-    } case ;
-
-M: x86 %gather-vector-2-reps
-    {
-        { sse2? { double-2-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
-
-: sse1-float-4-shuffle ( dst shuffle -- )
-    {
-        { { 0 1 2 3 } [ drop ] }
-        { { 0 1 0 1 } [ dup MOVLHPS ] }
-        { { 2 3 2 3 } [ dup MOVHLPS ] }
-        { { 0 0 1 1 } [ dup UNPCKLPS ] }
-        { { 2 2 3 3 } [ dup UNPCKHPS ] }
-        [ dupd SHUFPS ]
-    } case ;
-
-: float-4-shuffle ( dst shuffle -- )
-    sse3? [
-        {
-            { { 0 0 2 2 } [ dup MOVSLDUP ] }
-            { { 1 1 3 3 } [ dup MOVSHDUP ] }
-            [ sse1-float-4-shuffle ]
-        } case
-    ] [ sse1-float-4-shuffle ] if ;
-
-: int-4-shuffle ( dst shuffle -- )
-    {
-        { { 0 1 2 3 } [ drop ] }
-        { { 0 0 1 1 } [ dup PUNPCKLDQ ] }
-        { { 2 2 3 3 } [ dup PUNPCKHDQ ] }
-        { { 0 1 0 1 } [ dup PUNPCKLQDQ ] }
-        { { 2 3 2 3 } [ dup PUNPCKHQDQ ] }
-        [ dupd PSHUFD ]
-    } case ;
-
-: longlong-2-shuffle ( dst shuffle -- )
-    first2 [ 2 * dup 1 + ] bi@ 4array int-4-shuffle ;
-
-: >float-4-shuffle ( double-2-shuffle -- float-4-shuffle )
-    [ 2 * { 0 1 } n+v ] map concat ;
-
-M:: x86 %shuffle-vector-imm ( dst src shuffle rep -- )
-    dst src rep %copy
-    dst shuffle rep signed-rep {
-        { double-2-rep [ >float-4-shuffle float-4-shuffle ] }
-        { float-4-rep [ float-4-shuffle ] }
-        { int-4-rep [ int-4-shuffle ] }
-        { longlong-2-rep [ longlong-2-shuffle ] }
-    } case ;
-
-M: x86 %shuffle-vector-imm-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
-
-M: x86 %shuffle-vector ( dst src shuffle rep -- )
-    two-operand PSHUFB ;
-
-M: x86 %shuffle-vector-reps
-    {
-        { ssse3? { float-4-rep double-2-rep longlong-2-rep ulonglong-2-rep int-4-rep uint-4-rep short-8-rep ushort-8-rep char-16-rep uchar-16-rep } }
-    } available-reps ;
-
-M: x86 %merge-vector-head
-    [ two-operand ] keep
-    signed-rep {
-        { double-2-rep   [ MOVLHPS ] }
-        { float-4-rep    [ UNPCKLPS ] }
-        { longlong-2-rep [ PUNPCKLQDQ ] }
-        { int-4-rep      [ PUNPCKLDQ ] }
-        { short-8-rep    [ PUNPCKLWD ] }
-        { char-16-rep    [ PUNPCKLBW ] }
-    } case ;
-
-M: x86 %merge-vector-tail
-    [ two-operand ] keep
-    signed-rep {
-        { double-2-rep   [ UNPCKHPD ] }
-        { float-4-rep    [ UNPCKHPS ] }
-        { longlong-2-rep [ PUNPCKHQDQ ] }
-        { int-4-rep      [ PUNPCKHDQ ] }
-        { short-8-rep    [ PUNPCKHWD ] }
-        { char-16-rep    [ PUNPCKHBW ] }
-    } case ;
-
-M: x86 %merge-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
-
-M: x86 %signed-pack-vector
-    [ two-operand ] keep
-    {
-        { int-4-rep    [ PACKSSDW ] }
-        { short-8-rep  [ PACKSSWB ] }
-    } case ;
-
-M: x86 %signed-pack-vector-reps
-    {
-        { sse2? { short-8-rep int-4-rep } }
-    } available-reps ;
-
-M: x86 %unsigned-pack-vector
-    [ two-operand ] keep
-    signed-rep {
-        { int-4-rep   [ PACKUSDW ] }
-        { short-8-rep [ PACKUSWB ] }
-    } case ;
-
-M: x86 %unsigned-pack-vector-reps
-    {
-        { sse2? { short-8-rep } }
-        { sse4.1? { int-4-rep } }
-    } available-reps ;
-
-M: x86 %tail>head-vector ( dst src rep -- )
-    dup {
-        { float-4-rep [ drop UNPCKHPD ] }
-        { double-2-rep [ drop UNPCKHPD ] }
-        [ drop [ %copy ] [ drop PUNPCKHQDQ ] 3bi ]
-    } case ;
-
-M: x86 %unpack-vector-head ( dst src rep -- )
-    {
-        { char-16-rep  [ PMOVSXBW ] }
-        { uchar-16-rep [ PMOVZXBW ] }
-        { short-8-rep  [ PMOVSXWD ] }
-        { ushort-8-rep [ PMOVZXWD ] }
-        { int-4-rep    [ PMOVSXDQ ] }
-        { uint-4-rep   [ PMOVZXDQ ] }
-        { float-4-rep  [ CVTPS2PD ] }
-    } case ;
-
-M: x86 %unpack-vector-head-reps ( -- reps )
-    {
-        { sse2? { float-4-rep } }
-        { sse4.1? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep } }
-    } available-reps ;
-
-M: x86 %integer>float-vector ( dst src rep -- )
-    {
-        { int-4-rep [ CVTDQ2PS ] }
-    } case ;
-
-M: x86 %integer>float-vector-reps
-    {
-        { sse2? { int-4-rep } }
-    } available-reps ;
-
-M: x86 %float>integer-vector ( dst src rep -- )
-    {
-        { float-4-rep [ CVTTPS2DQ ] }
-    } case ;
-
-M: x86 %float>integer-vector-reps
-    {
-        { sse2? { float-4-rep } }
-    } available-reps ;
-
-: (%compare-float-vector) ( dst src rep double single -- )
-    [ double-2-rep eq? ] 2dip if ; inline
+    temp 0 MOV \ t rc-absolute-cell rel-literal
+    dst temp insn execute ; inline
 
-: %compare-float-vector ( dst src rep cc -- )
-    {
-        { cc<    [ [ CMPLTPD    ] [ CMPLTPS    ] (%compare-float-vector) ] }
-        { cc<=   [ [ CMPLEPD    ] [ CMPLEPS    ] (%compare-float-vector) ] }
-        { cc=    [ [ CMPEQPD    ] [ CMPEQPS    ] (%compare-float-vector) ] }
-        { cc<>=  [ [ CMPORDPD   ] [ CMPORDPS   ] (%compare-float-vector) ] }
-        { cc/<   [ [ CMPNLTPD   ] [ CMPNLTPS   ] (%compare-float-vector) ] }
-        { cc/<=  [ [ CMPNLEPD   ] [ CMPNLEPS   ] (%compare-float-vector) ] }
-        { cc/=   [ [ CMPNEQPD   ] [ CMPNEQPS   ] (%compare-float-vector) ] }
-        { cc/<>= [ [ CMPUNORDPD ] [ CMPUNORDPS ] (%compare-float-vector) ] }
+: %boolean ( dst cc temp -- )
+    swap order-cc {
+        { cc<  [ \ CMOVL (%boolean) ] }
+        { cc<= [ \ CMOVLE (%boolean) ] }
+        { cc>  [ \ CMOVG (%boolean) ] }
+        { cc>= [ \ CMOVGE (%boolean) ] }
+        { cc=  [ \ CMOVE (%boolean) ] }
+        { cc/= [ \ CMOVNE (%boolean) ] }
     } case ;
 
-:: (%compare-int-vector) ( dst src rep int64 int32 int16 int8 -- )
-    rep signed-rep :> rep'
-    dst src rep' {
-        { longlong-2-rep [ int64 call ] }
-        { int-4-rep      [ int32 call ] }
-        { short-8-rep    [ int16 call ] }
-        { char-16-rep    [ int8  call ] }
-    } case ; inline
+M:: x86 %compare ( dst src1 src2 cc temp -- )
+    src1 src2 CMP
+    dst cc temp %boolean ;
 
-: %compare-int-vector ( dst src rep cc -- )
-    {
-        { cc= [ [ PCMPEQQ ] [ PCMPEQD ] [ PCMPEQW ] [ PCMPEQB ] (%compare-int-vector) ] }
-        { cc> [ [ PCMPGTQ ] [ PCMPGTD ] [ PCMPGTW ] [ PCMPGTB ] (%compare-int-vector) ] }
-    } case ;
+M:: x86 %test ( dst src1 src2 cc temp -- )
+    src1 src2 TEST
+    dst cc temp %boolean ;
 
-M: x86 %compare-vector ( dst src1 src2 rep cc -- )
-    [ [ two-operand ] keep ] dip
-    over float-vector-rep?
-    [ %compare-float-vector ]
-    [ %compare-int-vector ] if ;
+: (%compare-tagged) ( src1 src2 -- )
+    [ HEX: ffffffff CMP ] dip rc-absolute rel-literal ;
 
-: %compare-vector-eq-reps ( -- reps )
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep } }
-        { sse4.1? { longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
+M:: x86 %compare-integer-imm ( dst src1 src2 cc temp -- )
+    src1 src2 CMP
+    dst cc temp %boolean ;
 
-: %compare-vector-ord-reps ( -- reps )
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep short-8-rep int-4-rep } }
-        { sse4.2? { longlong-2-rep } }
-    } available-reps ;
+M:: x86 %test-imm ( dst src1 src2 cc temp -- )
+    src1 src2 TEST
+    dst cc temp %boolean ;
 
-M: x86 %compare-vector-reps
+: (%compare-imm) ( src1 src2 -- )
     {
-        { [ dup { cc= cc/= cc/<>= cc<>= } member-eq? ] [ drop %compare-vector-eq-reps ] }
-        [ drop %compare-vector-ord-reps ]
+        { [ dup fixnum? ] [ tag-fixnum CMP ] }
+        { [ dup not ] [ drop \ f type-number CMP ] }
+        [ (%compare-tagged) ]
     } cond ;
 
-: %compare-float-vector-ccs ( cc -- ccs not? )
-    {
-        { cc<    [ { { cc<  f   }              } f ] }
-        { cc<=   [ { { cc<= f   }              } f ] }
-        { cc>    [ { { cc<  t   }              } f ] }
-        { cc>=   [ { { cc<= t   }              } f ] }
-        { cc=    [ { { cc=  f   }              } f ] }
-        { cc<>   [ { { cc<  f   } { cc<    t } } f ] }
-        { cc<>=  [ { { cc<>= f  }              } f ] }
-        { cc/<   [ { { cc/<  f  }              } f ] }
-        { cc/<=  [ { { cc/<= f  }              } f ] }
-        { cc/>   [ { { cc/<  t  }              } f ] }
-        { cc/>=  [ { { cc/<= t  }              } f ] }
-        { cc/=   [ { { cc/=  f  }              } f ] }
-        { cc/<>  [ { { cc/=  f  } { cc/<>= f } } f ] }
-        { cc/<>= [ { { cc/<>= f }              } f ] }
-    } case ;
+M:: x86 %compare-imm ( dst src1 src2 cc temp -- )
+    src1 src2 (%compare-imm)
+    dst cc temp %boolean ;
 
-: %compare-int-vector-ccs ( cc -- ccs not? )
+: %branch ( label cc -- )
     order-cc {
-        { cc<    [ { { cc> t } } f ] }
-        { cc<=   [ { { cc> f } } t ] }
-        { cc>    [ { { cc> f } } f ] }
-        { cc>=   [ { { cc> t } } t ] }
-        { cc=    [ { { cc= f } } f ] }
-        { cc/=   [ { { cc= f } } t ] }
-        { t      [ {           } t ] }
-        { f      [ {           } f ] }
-    } case ;
-
-M: x86 %compare-vector-ccs
-    swap float-vector-rep?
-    [ %compare-float-vector-ccs ]
-    [ %compare-int-vector-ccs ] if ;
-
-:: %test-vector-mask ( dst temp mask vcc -- )
-    vcc {
-        { vcc-any    [ dst dst TEST dst temp \ CMOVNE %boolean ] }
-        { vcc-none   [ dst dst TEST dst temp \ CMOVE  %boolean ] }
-        { vcc-all    [ dst mask CMP dst temp \ CMOVE  %boolean ] }
-        { vcc-notall [ dst mask CMP dst temp \ CMOVNE %boolean ] }
-    } case ;
-
-: %move-vector-mask ( dst src rep -- mask )
-    {
-        { double-2-rep [ MOVMSKPS HEX: f ] }
-        { float-4-rep  [ MOVMSKPS HEX: f ] }
-        [ drop PMOVMSKB HEX: ffff ]
-    } case ;
-
-M:: x86 %test-vector ( dst src temp rep vcc -- )
-    dst src rep %move-vector-mask :> mask
-    dst temp mask vcc %test-vector-mask ;
-
-:: %test-vector-mask-branch ( label temp mask vcc -- )
-    vcc {
-        { vcc-any    [ temp temp TEST label JNE ] }
-        { vcc-none   [ temp temp TEST label JE ] }
-        { vcc-all    [ temp mask CMP label JE ] }
-        { vcc-notall [ temp mask CMP label JNE ] }
-    } case ;
-
-M:: x86 %test-vector-branch ( label src temp rep vcc -- )
-    temp src rep %move-vector-mask :> mask
-    label temp mask vcc %test-vector-mask-branch ;
-
-M: x86 %test-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
-
-M: x86 %add-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { float-4-rep [ ADDPS ] }
-        { double-2-rep [ ADDPD ] }
-        { char-16-rep [ PADDB ] }
-        { uchar-16-rep [ PADDB ] }
-        { short-8-rep [ PADDW ] }
-        { ushort-8-rep [ PADDW ] }
-        { int-4-rep [ PADDD ] }
-        { uint-4-rep [ PADDD ] }
-        { longlong-2-rep [ PADDQ ] }
-        { ulonglong-2-rep [ PADDQ ] }
-    } case ;
-
-M: x86 %add-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
-
-M: x86 %saturated-add-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { char-16-rep [ PADDSB ] }
-        { uchar-16-rep [ PADDUSB ] }
-        { short-8-rep [ PADDSW ] }
-        { ushort-8-rep [ PADDUSW ] }
-    } case ;
-
-M: x86 %saturated-add-vector-reps
-    {
-        { sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep } }
-    } available-reps ;
-
-M: x86 %add-sub-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { float-4-rep [ ADDSUBPS ] }
-        { double-2-rep [ ADDSUBPD ] }
-    } case ;
-
-M: x86 %add-sub-vector-reps
-    {
-        { sse3? { float-4-rep double-2-rep } }
-    } available-reps ;
-
-M: x86 %sub-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { float-4-rep [ SUBPS ] }
-        { double-2-rep [ SUBPD ] }
-        { char-16-rep [ PSUBB ] }
-        { uchar-16-rep [ PSUBB ] }
-        { short-8-rep [ PSUBW ] }
-        { ushort-8-rep [ PSUBW ] }
-        { int-4-rep [ PSUBD ] }
-        { uint-4-rep [ PSUBD ] }
-        { longlong-2-rep [ PSUBQ ] }
-        { ulonglong-2-rep [ PSUBQ ] }
-    } case ;
-
-M: x86 %sub-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
-
-M: x86 %saturated-sub-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { char-16-rep [ PSUBSB ] }
-        { uchar-16-rep [ PSUBUSB ] }
-        { short-8-rep [ PSUBSW ] }
-        { ushort-8-rep [ PSUBUSW ] }
+        { cc<  [ JL ] }
+        { cc<= [ JLE ] }
+        { cc>  [ JG ] }
+        { cc>= [ JGE ] }
+        { cc=  [ JE ] }
+        { cc/= [ JNE ] }
     } case ;
 
-M: x86 %saturated-sub-vector-reps
-    {
-        { sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep } }
-    } available-reps ;
-
-M: x86 %mul-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { float-4-rep [ MULPS ] }
-        { double-2-rep [ MULPD ] }
-        { short-8-rep [ PMULLW ] }
-        { ushort-8-rep [ PMULLW ] }
-        { int-4-rep [ PMULLD ] }
-        { uint-4-rep [ PMULLD ] }
-    } case ;
-
-M: x86 %mul-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep short-8-rep ushort-8-rep } }
-        { sse4.1? { int-4-rep uint-4-rep } }
-    } available-reps ;
-
-M: x86 %mul-high-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { short-8-rep  [ PMULHW ] }
-        { ushort-8-rep [ PMULHUW ] }
-    } case ;
-
-M: x86 %mul-high-vector-reps
-    {
-        { sse2? { short-8-rep ushort-8-rep } }
-    } available-reps ;
-
-M: x86 %mul-horizontal-add-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { char-16-rep  [ PMADDUBSW ] }
-        { uchar-16-rep [ PMADDUBSW ] }
-        { short-8-rep  [ PMADDWD ] }
-    } case ;
-
-M: x86 %mul-horizontal-add-vector-reps
-    {
-        { sse2?  { short-8-rep } }
-        { ssse3? { char-16-rep uchar-16-rep } }
-    } available-reps ;
-
-M: x86 %div-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { float-4-rep [ DIVPS ] }
-        { double-2-rep [ DIVPD ] }
-    } case ;
-
-M: x86 %div-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep } }
-    } available-reps ;
-
-M: x86 %min-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { char-16-rep [ PMINSB ] }
-        { uchar-16-rep [ PMINUB ] }
-        { short-8-rep [ PMINSW ] }
-        { ushort-8-rep [ PMINUW ] }
-        { int-4-rep [ PMINSD ] }
-        { uint-4-rep [ PMINUD ] }
-        { float-4-rep [ MINPS ] }
-        { double-2-rep [ MINPD ] }
-    } case ;
-
-M: x86 %min-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { uchar-16-rep short-8-rep double-2-rep } }
-        { sse4.1? { char-16-rep ushort-8-rep int-4-rep uint-4-rep } }
-    } available-reps ;
-
-M: x86 %max-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { char-16-rep [ PMAXSB ] }
-        { uchar-16-rep [ PMAXUB ] }
-        { short-8-rep [ PMAXSW ] }
-        { ushort-8-rep [ PMAXUW ] }
-        { int-4-rep [ PMAXSD ] }
-        { uint-4-rep [ PMAXUD ] }
-        { float-4-rep [ MAXPS ] }
-        { double-2-rep [ MAXPD ] }
-    } case ;
-
-M: x86 %max-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { uchar-16-rep short-8-rep double-2-rep } }
-        { sse4.1? { char-16-rep ushort-8-rep int-4-rep uint-4-rep } }
-    } available-reps ;
-
-M: x86 %avg-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { uchar-16-rep [ PAVGB ] }
-        { ushort-8-rep [ PAVGW ] }
-    } case ;
-
-M: x86 %avg-vector-reps
-    {
-        { sse2? { uchar-16-rep ushort-8-rep } }
-    } available-reps ;
-
-M: x86 %dot-vector
-    [ two-operand ] keep
-    {
-        { float-4-rep [ HEX: ff DPPS ] }
-        { double-2-rep [ HEX: ff DPPD ] }
-    } case ;
-
-M: x86 %dot-vector-reps
-    {
-        { sse4.1? { float-4-rep double-2-rep } }
-    } available-reps ;
-
-M: x86 %sad-vector
-    [ two-operand ] keep
-    {
-        { uchar-16-rep [ PSADBW ] }
-    } case ;
-
-M: x86 %sad-vector-reps
-    {
-        { sse2? { uchar-16-rep } }
-    } available-reps ;
-
-M: x86 %horizontal-add-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    signed-rep {
-        { float-4-rep  [ HADDPS ] }
-        { double-2-rep [ HADDPD ] }
-        { int-4-rep    [ PHADDD ] }
-        { short-8-rep  [ PHADDW ] }
-    } case ;
-
-M: x86 %horizontal-add-vector-reps
-    {
-        { sse3? { float-4-rep double-2-rep } }
-        { ssse3? { int-4-rep uint-4-rep short-8-rep ushort-8-rep } }
-    } available-reps ;
-
-M: x86 %horizontal-shl-vector-imm ( dst src1 src2 rep -- )
-    two-operand PSLLDQ ;
-
-M: x86 %horizontal-shl-vector-imm-reps
-    {
-        { sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep float-4-rep double-2-rep } }
-    } available-reps ;
-
-M: x86 %horizontal-shr-vector-imm ( dst src1 src2 rep -- )
-    two-operand PSRLDQ ;
-
-M: x86 %horizontal-shr-vector-imm-reps
-    {
-        { sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep float-4-rep double-2-rep } }
-    } available-reps ;
-
-M: x86 %abs-vector ( dst src rep -- )
-    {
-        { char-16-rep [ PABSB ] }
-        { short-8-rep [ PABSW ] }
-        { int-4-rep [ PABSD ] }
-    } case ;
-
-M: x86 %abs-vector-reps
-    {
-        { ssse3? { char-16-rep short-8-rep int-4-rep } }
-    } available-reps ;
-
-M: x86 %sqrt-vector ( dst src rep -- )
-    {
-        { float-4-rep [ SQRTPS ] }
-        { double-2-rep [ SQRTPD ] }
-    } case ;
-
-M: x86 %sqrt-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep } }
-    } available-reps ;
-
-M: x86 %and-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { float-4-rep [ ANDPS ] }
-        { double-2-rep [ ANDPS ] }
-        [ drop PAND ]
-    } case ;
-
-M: x86 %and-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
-
-M: x86 %andn-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { float-4-rep [ ANDNPS ] }
-        { double-2-rep [ ANDNPS ] }
-        [ drop PANDN ]
-    } case ;
+M:: x86 %compare-branch ( label src1 src2 cc -- )
+    src1 src2 CMP
+    label cc %branch ;
 
-M: x86 %andn-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
+M:: x86 %compare-integer-imm-branch ( label src1 src2 cc -- )
+    src1 src2 CMP
+    label cc %branch ;
 
-M: x86 %or-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { float-4-rep [ ORPS ] }
-        { double-2-rep [ ORPS ] }
-        [ drop POR ]
-    } case ;
+M:: x86 %test-branch ( label src1 src2 cc -- )
+    src1 src2 TEST
+    label cc %branch ;
 
-M: x86 %or-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
+M:: x86 %test-imm-branch ( label src1 src2 cc -- )
+    src1 src2 TEST
+    label cc %branch ;
 
-M: x86 %xor-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { float-4-rep [ XORPS ] }
-        { double-2-rep [ XORPS ] }
-        [ drop PXOR ]
-    } case ;
+M:: x86 %compare-imm-branch ( label src1 src2 cc -- )
+    src1 src2 (%compare-imm)
+    label cc %branch ;
 
-M: x86 %xor-vector-reps
-    {
-        { sse? { float-4-rep } }
-        { sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
+M:: x86 %spill ( src rep dst -- )
+    dst src rep %copy ;
 
-M: x86 %shl-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { short-8-rep [ PSLLW ] }
-        { ushort-8-rep [ PSLLW ] }
-        { int-4-rep [ PSLLD ] }
-        { uint-4-rep [ PSLLD ] }
-        { longlong-2-rep [ PSLLQ ] }
-        { ulonglong-2-rep [ PSLLQ ] }
-    } case ;
+M:: x86 %reload ( dst rep src -- )
+    dst src rep %copy ;
 
-M: x86 %shl-vector-reps
-    {
-        { sse2? { short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
-    } available-reps ;
+M:: x86 %store-stack-param ( src n rep -- )
+    n reserved-stack-space + stack@ src rep %copy ;
 
-M: x86 %shr-vector ( dst src1 src2 rep -- )
-    [ two-operand ] keep
-    {
-        { short-8-rep [ PSRAW ] }
-        { ushort-8-rep [ PSRLW ] }
-        { int-4-rep [ PSRAD ] }
-        { uint-4-rep [ PSRLD ] }
-        { ulonglong-2-rep [ PSRLQ ] }
-    } case ;
+: %load-return ( dst rep -- )
+    [ reg-class-of return-regs at first ] keep %load-reg-param ;
 
-M: x86 %shr-vector-reps
-    {
-        { sse2? { short-8-rep ushort-8-rep int-4-rep uint-4-rep ulonglong-2-rep } }
-    } available-reps ;
-
-M: x86 %shl-vector-imm %shl-vector ;
-M: x86 %shl-vector-imm-reps %shl-vector-reps ;
-M: x86 %shr-vector-imm %shr-vector ;
-M: x86 %shr-vector-imm-reps %shr-vector-reps ;
-
-: scalar-sized-reg ( reg rep -- reg' )
-    rep-size 8 * n-bit-version-of ;
-
-M: x86 %integer>scalar drop MOVD ;
-
-:: %scalar>integer-32 ( dst src rep -- )
-    rep {
-        { int-scalar-rep [
-            dst 32-bit-version-of src MOVD
-            dst dst 32-bit-version-of
-            2dup eq? [ 2drop ] [ MOVSX ] if
-        ] }
-        { uint-scalar-rep [
-            dst 32-bit-version-of src MOVD
-        ] }
-        { short-scalar-rep [
-            dst 32-bit-version-of src MOVD
-            dst dst 16-bit-version-of MOVSX
-        ] }
-        { ushort-scalar-rep [
-            dst 32-bit-version-of src MOVD
-            dst dst 16-bit-version-of MOVZX
-        ] }
-        { char-scalar-rep [
-            dst 32-bit-version-of src MOVD
-            dst { } 8 [| tmp-dst |
-                tmp-dst dst int-rep %copy
-                tmp-dst tmp-dst 8-bit-version-of MOVSX
-                dst tmp-dst int-rep %copy
-            ] with-small-register
-        ] }
-        { uchar-scalar-rep [
-            dst 32-bit-version-of src MOVD
-            dst { } 8 [| tmp-dst |
-                tmp-dst dst int-rep %copy
-                tmp-dst tmp-dst 8-bit-version-of MOVZX
-                dst tmp-dst int-rep %copy
-            ] with-small-register
-        ] }
-    } case ;
+: %store-return ( dst rep -- )
+    [ reg-class-of return-regs at first ] keep %store-reg-param ;
 
-M: x86.32 %scalar>integer ( dst src rep -- ) %scalar>integer-32 ;
+: next-stack@ ( n -- operand )
+    #! nth parameter from the next stack frame. Used to box
+    #! input values to callbacks; the callback has its own
+    #! stack frame set up, and we want to read the frame
+    #! set up by the caller.
+    [ frame-reg ] dip 2 cells + reserved-stack-space + [+] ;
 
-M: x86.64 %scalar>integer ( dst src rep -- )
-    {
-        { longlong-scalar-rep  [ MOVD ] }
-        { ulonglong-scalar-rep [ MOVD ] }
-        [ %scalar>integer-32 ]
-    } case ;
+M:: x86 %load-stack-param ( dst n rep -- )
+    dst n next-stack@ rep %copy ;
 
-M: x86 %vector>scalar %copy ;
-M: x86 %scalar>vector %copy ;
+M:: x86 %local-allot ( dst size align offset -- )
+    dst offset local-allot-offset special-offset stack@ LEA ;
 
-M:: x86 %spill ( src rep dst -- ) dst src rep %copy ;
-M:: x86 %reload ( dst rep src -- ) dst src rep %copy ;
+M: x86 %alien-indirect ( src -- )
+    ?spill-slot CALL ;
 
-M: x86 %loop-entry 16 code-alignment [ NOP ] times ;
+M: x86 %loop-entry 16 alignment [ NOP ] times ;
 
 M:: x86 %restore-context ( temp1 temp2 -- )
     #! Load Factor stack pointers on entry from C to Factor.
-    #! Also save callstack bottom!
-    temp1 "ctx" %vm-field
-    temp2 stack-reg stack-frame get total-size>> cell - [+] LEA
-    temp1 "callstack-bottom" context-field-offset [+] temp2 MOV
+    temp1 %context
+    temp2 stack-reg cell neg [+] LEA
+    temp1 "callstack-top" context-field-offset [+] temp2 MOV
     ds-reg temp1 "datastack" context-field-offset [+] MOV
     rs-reg temp1 "retainstack" context-field-offset [+] MOV ;
 
@@ -1414,7 +608,7 @@ M:: x86 %save-context ( temp1 temp2 -- )
     #! Save Factor stack pointers in case the C code calls a
     #! callback which does a GC, which must reliably trace
     #! all roots.
-    temp1 "ctx" %vm-field
+    temp1 %context
     temp2 stack-reg cell neg [+] LEA
     temp1 "callstack-top" context-field-offset [+] temp2 MOV
     temp1 "datastack" context-field-offset [+] ds-reg MOV
@@ -1428,36 +622,80 @@ M: x86 immediate-arithmetic? ( n -- ? )
 M: x86 immediate-bitwise? ( n -- ? )
     HEX: -80000000 HEX: 7fffffff between? ;
 
-: next-stack@ ( n -- operand )
-    #! nth parameter from the next stack frame. Used to box
-    #! input values to callbacks; the callback has its own
-    #! stack frame set up, and we want to read the frame
-    #! set up by the caller.
-    frame-reg swap 2 cells + [+] ;
+: %cmov-float= ( dst src -- )
+    [
+        "no-move" define-label
 
-enable-min/max
-enable-fixnum-log2
+        "no-move" get [ JNE ] [ JP ] bi
+        MOV
+        "no-move" resolve-label
+    ] with-scope ;
 
-:: install-sse2-check ( -- )
+: %cmov-float/= ( dst src -- )
     [
-        sse-version 20 < [
-            "This image was built to use SSE2 but your CPU does not support it." print
-            "You will need to bootstrap Factor again." print
-            flush
-            1 exit
-        ] when
-    ] "cpu.x86" add-startup-hook ;
-
-: enable-sse2 ( version -- )
-    20 >= [
-        enable-float-intrinsics
-        enable-float-functions
-        enable-float-min/max
-        enable-fsqrt
-        install-sse2-check
-    ] when ;
+        "no-move" define-label
+        "move" define-label
+
+        "move" get JP
+        "no-move" get JE
+        "move" resolve-label
+        MOV
+        "no-move" resolve-label
+    ] with-scope ;
+
+:: (%compare-float) ( dst src1 src2 cc temp compare -- )
+    cc {
+        { cc<    [ src2 src1 \ compare call( a b -- ) dst temp \ CMOVA  (%boolean) ] }
+        { cc<=   [ src2 src1 \ compare call( a b -- ) dst temp \ CMOVAE (%boolean) ] }
+        { cc>    [ src1 src2 \ compare call( a b -- ) dst temp \ CMOVA  (%boolean) ] }
+        { cc>=   [ src1 src2 \ compare call( a b -- ) dst temp \ CMOVAE (%boolean) ] }
+        { cc=    [ src1 src2 \ compare call( a b -- ) dst temp \ %cmov-float= (%boolean) ] }
+        { cc<>   [ src1 src2 \ compare call( a b -- ) dst temp \ CMOVNE (%boolean) ] }
+        { cc<>=  [ src1 src2 \ compare call( a b -- ) dst temp \ CMOVNP (%boolean) ] }
+        { cc/<   [ src2 src1 \ compare call( a b -- ) dst temp \ CMOVBE (%boolean) ] }
+        { cc/<=  [ src2 src1 \ compare call( a b -- ) dst temp \ CMOVB  (%boolean) ] }
+        { cc/>   [ src1 src2 \ compare call( a b -- ) dst temp \ CMOVBE (%boolean) ] }
+        { cc/>=  [ src1 src2 \ compare call( a b -- ) dst temp \ CMOVB  (%boolean) ] }
+        { cc/=   [ src1 src2 \ compare call( a b -- ) dst temp \ %cmov-float/= (%boolean) ] }
+        { cc/<>  [ src1 src2 \ compare call( a b -- ) dst temp \ CMOVE  (%boolean) ] }
+        { cc/<>= [ src1 src2 \ compare call( a b -- ) dst temp \ CMOVP  (%boolean) ] }
+    } case ; inline
+
+: %jump-float= ( label -- )
+    [
+        "no-jump" define-label
+        "no-jump" get JP
+        JE
+        "no-jump" resolve-label
+    ] with-scope ;
+
+: %jump-float/= ( label -- )
+    [ JNE ] [ JP ] bi ;
+
+:: (%compare-float-branch) ( label src1 src2 cc compare -- )
+    cc {
+        { cc<    [ src2 src1 \ compare call( a b -- ) label JA  ] }
+        { cc<=   [ src2 src1 \ compare call( a b -- ) label JAE ] }
+        { cc>    [ src1 src2 \ compare call( a b -- ) label JA  ] }
+        { cc>=   [ src1 src2 \ compare call( a b -- ) label JAE ] }
+        { cc=    [ src1 src2 \ compare call( a b -- ) label %jump-float= ] }
+        { cc<>   [ src1 src2 \ compare call( a b -- ) label JNE ] }
+        { cc<>=  [ src1 src2 \ compare call( a b -- ) label JNP ] }
+        { cc/<   [ src2 src1 \ compare call( a b -- ) label JBE ] }
+        { cc/<=  [ src2 src1 \ compare call( a b -- ) label JB  ] }
+        { cc/>   [ src1 src2 \ compare call( a b -- ) label JBE ] }
+        { cc/>=  [ src1 src2 \ compare call( a b -- ) label JB  ] }
+        { cc/=   [ src1 src2 \ compare call( a b -- ) label %jump-float/= ] }
+        { cc/<>  [ src1 src2 \ compare call( a b -- ) label JE  ] }
+        { cc/<>= [ src1 src2 \ compare call( a b -- ) label JP  ] }
+    } case ;
+
+enable-min/max
+enable-log2
 
 : check-sse ( -- )
+    "Checking for multimedia extensions... " write flush
     [ { (sse-version) } compile ] with-optimizer
-    "Checking for multimedia extensions: " write sse-version
-    [ sse-string write " detected" print ] [ enable-sse2 ] bi ;
+    sse-version
+    [ sse-string " detected" append print ]
+    [ 20 < "cpu.x86.x87" "cpu.x86.sse" ? require ] bi ;
diff --git a/basis/cpu/x86/x87/authors.txt b/basis/cpu/x86/x87/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/cpu/x86/x87/tags.txt b/basis/cpu/x86/x87/tags.txt
new file mode 100644 (file)
index 0000000..ebb74b4
--- /dev/null
@@ -0,0 +1 @@
+not loaded
diff --git a/basis/cpu/x86/x87/x87.factor b/basis/cpu/x86/x87/x87.factor
new file mode 100644 (file)
index 0000000..8f267b4
--- /dev/null
@@ -0,0 +1,103 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types combinators kernel locals system namespaces
+compiler.codegen.fixup compiler.constants
+compiler.cfg.comparisons compiler.cfg.intrinsics
+cpu.architecture cpu.x86 cpu.x86.assembler
+cpu.x86.assembler.operands ;
+IN: cpu.x86.x87
+
+! x87 unit is only used if SSE2 is not available.
+
+: copy-register-x87 ( dst src -- )
+    2dup eq? [ 2drop ] [ FLD shuffle-down FSTP ] if ;
+
+M: float-rep copy-register* drop copy-register-x87 ;
+M: double-rep copy-register* drop copy-register-x87 ;
+
+: load-x87 ( dst src rep -- )
+    {
+        { float-rep [ FLDS shuffle-down FSTP ] }
+        { double-rep [ FLDL shuffle-down FSTP ] }
+    } case ;
+
+: store-x87 ( dst src rep -- )
+    {
+        { float-rep [ FLD FSTPS ] }
+        { double-rep [ FLD FSTPL ] }
+    } case ;
+
+: copy-memory-x87 ( dst src rep -- )
+    {
+        { [ pick register? ] [ load-x87 ] }
+        { [ over register? ] [ store-x87 ] }
+    } cond ;
+
+M: float-rep copy-memory* copy-memory-x87 ;
+M: double-rep copy-memory* copy-memory-x87 ;
+
+M: x86 %load-float
+    0 [] FLDS
+    <float> rc-absolute rel-binary-literal
+    shuffle-down FSTP ;
+
+M: x86 %load-double
+    0 [] FLDL
+    <double> rc-absolute rel-binary-literal
+    shuffle-down FSTP ;
+
+:: binary-op ( dst src1 src2 quot -- )
+    src1 FLD
+    ST0 src2 shuffle-down quot call
+    dst shuffle-down FSTP ; inline
+
+M: x86 %add-float [ FADD ] binary-op ;
+M: x86 %sub-float [ FSUB ] binary-op ;
+M: x86 %mul-float [ FMUL ] binary-op ;
+M: x86 %div-float [ FDIV ] binary-op ;
+
+M: x86 %sqrt FLD FSQRT shuffle-down FSTP ;
+
+M: x86 %single>double-float copy-register-x87 ;
+M: x86 %double>single-float copy-register-x87 ;
+
+M: x86 integer-float-needs-stack-frame? t ;
+
+M:: x86 %integer>float ( dst src -- )
+    4 stack@ src MOV
+    4 stack@ FILDD
+    dst shuffle-down FSTP ;
+
+M:: x86 %float>integer ( dst src -- )
+    src FLD
+    8 stack@ EAX MOV
+    0 stack@ FNSTCW
+    AX 0 stack@ MOV
+    AH 12 <byte> MOV
+    2 stack@ AX MOV
+    2 stack@ FLDCW
+    4 stack@ FISTPD
+    0 stack@ FLDCW
+    EAX 8 stack@ MOV
+    dst 4 stack@ MOV ;
+
+:: compare-op ( src1 src2 quot -- )
+    src1 FLD
+    src2 shuffle-down quot call
+    ST0 FSTP ; inline
+
+M: x86 %compare-float-ordered ( dst src1 src2 cc temp -- )
+    [ [ FCOMI ] compare-op ] (%compare-float) ;
+
+M: x86 %compare-float-unordered ( dst src1 src2 cc temp -- )
+    [ [ FUCOMI ] compare-op ] (%compare-float) ;
+
+M: x86 %compare-float-ordered-branch ( label src1 src2 cc -- )
+    [ [ FCOMI ] compare-op ] (%compare-float-branch) ;
+
+M: x86 %compare-float-unordered-branch ( label src1 src2 cc -- )
+    [ [ FUCOMI ] compare-op ] (%compare-float-branch) ;
+
+enable-float-intrinsics
+enable-float-functions
+enable-fsqrt
index 1f05ab639bd8664b2296bb4497ebcb92ffb54fff..32c4cd53fb8b90ade970bfdf0b8e8f4fb7e583a7 100644 (file)
@@ -1,5 +1,5 @@
 USING: help.syntax help.markup kernel prettyprint sequences
-io.pathnames ;
+io.pathnames strings ;
 IN: csv
 
 HELP: csv
@@ -21,6 +21,20 @@ HELP: csv>file
 }
 { $description "Writes a comma-separated-value structure to a file." } ;
 
+HELP: string>csv
+{ $values
+    { "string" string }
+    { "csv" "csv" }
+}
+{ $description "Parses a string into a sequence of comma-separated-value fields." } ;
+
+HELP: csv>string
+{ $values
+    { "csv" "csv" }
+    { "string" string }
+}
+{ $description "Writes a comma-separated-value structure to a string." } ;
+
 HELP: csv-row
 { $values { "stream" "an input stream" }
           { "row" "an array of fields" } } 
@@ -42,6 +56,10 @@ ARTICLE: "csv" "Comma-separated-values parsing and writing"
 { $subsections file>csv }
 "Writing a csv file:"
 { $subsections csv>file }
+"Reading a string to csv:"
+{ $subsections string>csv }
+"Writing csv to a string:"
+{ $subsections csv>string }
 "Changing the delimiter from a comma:"
 { $subsections with-delimiter }
 "Reading from a stream:"
index 23416d6912aa6899efa3eff7f739fd3d599966d9..1aeb2e1d193ecc4488a504e03cda73d49b71f8c9 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2007, 2008 Phil Dawes
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel sequences io namespaces make combinators
-unicode.categories io.files combinators.short-circuit ;
+unicode.categories io.files combinators.short-circuit
+io.streams.string ;
 IN: csv
 
 SYMBOL: delimiter
@@ -65,6 +66,9 @@ PRIVATE>
     [ [ (csv) ] { } make ] with-input-stream
     dup last { "" } = [ but-last ] when ;
 
+: string>csv ( string -- csv )
+    <string-reader> csv ;
+
 : file>csv ( path encoding -- csv )
     <file-reader> csv ;
 
@@ -96,8 +100,18 @@ PRIVATE>
 : write-row ( row -- )
     [ delimiter get write1 ]
     [ escape-if-required write ] interleave nl ; inline
+
+<PRIVATE
+
+: (write-csv) ( rows -- )
+    [ write-row ] each ;
     
+PRIVATE>
+
 : write-csv ( rows stream -- )
-    [ [ write-row ] each ] with-output-stream ;
+    [ (write-csv) ] with-output-stream ;
 
+: csv>string ( csv -- string )
+    [ (write-csv) ] with-string-writer ;
+    
 : csv>file ( rows path encoding -- ) <file-writer> write-csv ;
index f4a55e32807e33358522fdf0e53ab00d6da33129..99078ca85d0b87aeea9c2e65d449060f11a506b1 100644 (file)
@@ -9,7 +9,7 @@ IN: db.postgresql.ffi
     { [ os winnt? ]  [ "libpq.dll" ] }
     { [ os macosx? ] [ "libpq.dylib" ] }
     { [ os unix?  ]  [ "libpq.so" ] }
-} cond "cdecl" add-library >>
+} cond cdecl add-library >>
 
 ! ConnSatusType
 CONSTANT: CONNECTION_OK                     HEX: 0
@@ -63,7 +63,6 @@ C-TYPE: PGconn
 C-TYPE: PGresult
 C-TYPE: PGcancel
 TYPEDEF: uint Oid
-TYPEDEF: uint* Oid*
 TYPEDEF: char pqbool
 C-TYPE: PQconninfoOption
 C-TYPE: PGnotify
@@ -78,15 +77,15 @@ LIBRARY: postgresql
 
 ! make a new client connection to the backend
 ! Asynchronous (non-blocking)
-FUNCTION: PGconn* PQconnectStart ( char* conninfo ) ;
+FUNCTION: PGconn* PQconnectStart ( c-string conninfo ) ;
 FUNCTION: PostgresPollingStatusType PQconnectPoll ( PGconn* conn ) ;
 
 ! Synchronous (blocking)
-FUNCTION: PGconn* PQconnectdb ( char* conninfo ) ;
-FUNCTION: PGconn* PQsetdbLogin ( char* pghost, char* pgport,
-             char* pgoptions, char* pgtty,
-             char* dbName,
-             char* login, char* pwd ) ;
+FUNCTION: PGconn* PQconnectdb ( c-string conninfo ) ;
+FUNCTION: PGconn* PQsetdbLogin ( c-string pghost, c-string pgport,
+             c-string pgoptions, c-string pgtty,
+             c-string dbName,
+             c-string login, c-string pwd ) ;
 
 : PQsetdb ( M_PGHOST M_PGPORT M_PGOPT M_PGTTY M_DBNAME -- PGconn* )
     f f PQsetdbLogin ;
@@ -117,24 +116,24 @@ FUNCTION: void PQfreeCancel ( PGcancel* cancel ) ;
 FUNCTION: int    PQrequestCancel ( PGconn* conn ) ;
 
 ! Accessor functions for PGconn objects
-FUNCTION: char* PQdb ( PGconn* conn ) ;
-FUNCTION: char* PQuser ( PGconn* conn ) ;
-FUNCTION: char* PQpass ( PGconn* conn ) ;
-FUNCTION: char* PQhost ( PGconn* conn ) ;
-FUNCTION: char* PQport ( PGconn* conn ) ;
-FUNCTION: char* PQtty ( PGconn* conn ) ;
-FUNCTION: char* PQoptions ( PGconn* conn ) ;
+FUNCTION: c-string PQdb ( PGconn* conn ) ;
+FUNCTION: c-string PQuser ( PGconn* conn ) ;
+FUNCTION: c-string PQpass ( PGconn* conn ) ;
+FUNCTION: c-string PQhost ( PGconn* conn ) ;
+FUNCTION: c-string PQport ( PGconn* conn ) ;
+FUNCTION: c-string PQtty ( PGconn* conn ) ;
+FUNCTION: c-string PQoptions ( PGconn* conn ) ;
 FUNCTION: ConnStatusType PQstatus ( PGconn* conn ) ;
 FUNCTION: PGTransactionStatusType PQtransactionStatus ( PGconn* conn ) ;
-FUNCTION: char* PQparameterStatus ( PGconn* conn,
-                  char* paramName ) ;
+FUNCTION: c-string PQparameterStatus ( PGconn* conn,
+                  c-string paramName ) ;
 FUNCTION: int PQprotocolVersion ( PGconn* conn ) ;
 ! FUNCTION: int PQServerVersion ( PGconn* conn ) ;
-FUNCTION: char* PQerrorMessage ( PGconn* conn ) ;
+FUNCTION: c-string PQerrorMessage ( PGconn* conn ) ;
 FUNCTION: int PQsocket ( PGconn* conn ) ;
 FUNCTION: int PQbackendPID ( PGconn* conn ) ;
 FUNCTION: int PQclientEncoding ( PGconn* conn ) ;
-FUNCTION: int PQsetClientEncoding ( PGconn* conn, char* encoding ) ;
+FUNCTION: int PQsetClientEncoding ( PGconn* conn, c-string encoding ) ;
 
 ! May not be compiled into libpq
 ! Get the SSL structure associated with a connection
@@ -154,7 +153,7 @@ FUNCTION: void PQuntrace ( PGconn* conn ) ;
 ! BROKEN
 ! Function types for notice-handling callbacks
 ! typedef void (*PQnoticeReceiver) (void *arg, PGresult *res);
-! typedef void (*PQnoticeProcessor) (void *arg, char* message);
+! typedef void (*PQnoticeProcessor) (void *arg, c-string message);
 ! ALIAS: void* PQnoticeReceiver
 ! ALIAS: void* PQnoticeProcessor
 
@@ -170,43 +169,43 @@ FUNCTION: void PQuntrace ( PGconn* conn ) ;
 ! === in fe-exec.c ===
 
 ! Simple synchronous query
-FUNCTION: PGresult* PQexec ( PGconn* conn, char* query ) ;
+FUNCTION: PGresult* PQexec ( PGconn* conn, c-string query ) ;
 FUNCTION: PGresult* PQexecParams ( PGconn* conn,
-             char* command,
+             c-string command,
              int nParams,
              Oid* paramTypes,
-             char** paramValues,
+             c-string* paramValues,
              int* paramLengths,
              int* paramFormats,
              int resultFormat ) ;
-FUNCTION: PGresult* PQprepare ( PGconn* conn, char* stmtName,
-        char* query, int nParams,
+FUNCTION: PGresult* PQprepare ( PGconn* conn, c-string stmtName,
+        c-string query, int nParams,
         Oid* paramTypes ) ;
 FUNCTION: PGresult* PQexecPrepared ( PGconn* conn,
-             char* stmtName,
+             c-string stmtName,
              int nParams,
-             char** paramValues,
+             c-string* paramValues,
              int* paramLengths,
              int* paramFormats,
              int resultFormat ) ;
 
 ! Interface for multiple-result or asynchronous queries
-FUNCTION: int PQsendQuery ( PGconn* conn, char* query ) ;
+FUNCTION: int PQsendQuery ( PGconn* conn, c-string query ) ;
 FUNCTION: int PQsendQueryParams ( PGconn* conn,
-                  char* command,
+                  c-string command,
                   int nParams,
                   Oid* paramTypes,
-                  char** paramValues,
+                  c-string* paramValues,
                   int* paramLengths,
                   int* paramFormats,
                   int resultFormat ) ;
-FUNCTION: PGresult* PQsendPrepare ( PGconn* conn, char* stmtName,
-            char* query, int nParams,
+FUNCTION: PGresult* PQsendPrepare ( PGconn* conn, c-string stmtName,
+            c-string query, int nParams,
             Oid* paramTypes ) ;
 FUNCTION: int PQsendQueryPrepared ( PGconn* conn,
-                  char* stmtName,
+                  c-string stmtName,
                   int nParams,
-                  char** paramValues,
+                  c-string* paramValues,
                   int *paramLengths,
                   int *paramFormats,
                   int resultFormat ) ;
@@ -220,15 +219,15 @@ FUNCTION: int    PQconsumeInput ( PGconn* conn ) ;
 FUNCTION: PGnotify* PQnotifies ( PGconn* conn ) ;
 
 ! Routines for copy in/out
-FUNCTION: int    PQputCopyData ( PGconn* conn, char* buffer, int nbytes ) ;
-FUNCTION: int    PQputCopyEnd ( PGconn* conn, char* errormsg ) ;
-FUNCTION: int    PQgetCopyData ( PGconn* conn, char** buffer, int async ) ;
+FUNCTION: int    PQputCopyData ( PGconn* conn, c-string buffer, int nbytes ) ;
+FUNCTION: int    PQputCopyEnd ( PGconn* conn, c-string errormsg ) ;
+FUNCTION: int    PQgetCopyData ( PGconn* conn, c-string* buffer, int async ) ;
 
 ! Deprecated routines for copy in/out
-FUNCTION: int    PQgetline ( PGconn* conn, char* string, int length ) ;
-FUNCTION: int    PQputline ( PGconn* conn, char* string ) ;
-FUNCTION: int    PQgetlineAsync ( PGconn* conn, char* buffer, int bufsize ) ;
-FUNCTION: int    PQputnbytes ( PGconn* conn, char* buffer, int nbytes ) ;
+FUNCTION: int    PQgetline ( PGconn* conn, c-string string, int length ) ;
+FUNCTION: int    PQputline ( PGconn* conn, c-string string ) ;
+FUNCTION: int    PQgetlineAsync ( PGconn* conn, c-string buffer, int bufsize ) ;
+FUNCTION: int    PQputnbytes ( PGconn* conn, c-string buffer, int nbytes ) ;
 FUNCTION: int    PQendcopy ( PGconn* conn ) ;
 
 ! Set blocking/nonblocking connection to the backend
@@ -252,25 +251,25 @@ FUNCTION: PGresult* PQfn ( PGconn* conn,
 
 ! Accessor functions for PGresult objects
 FUNCTION: ExecStatusType PQresultStatus ( PGresult* res ) ;
-FUNCTION: char* PQresStatus ( ExecStatusType status ) ;
-FUNCTION: char* PQresultErrorMessage ( PGresult* res ) ;
-FUNCTION: char* PQresultErrorField ( PGresult* res, int fieldcode ) ;
+FUNCTION: c-string PQresStatus ( ExecStatusType status ) ;
+FUNCTION: c-string PQresultErrorMessage ( PGresult* res ) ;
+FUNCTION: c-string PQresultErrorField ( PGresult* res, int fieldcode ) ;
 FUNCTION: int   PQntuples ( PGresult* res ) ;
 FUNCTION: int   PQnfields ( PGresult* res ) ;
 FUNCTION: int   PQbinaryTuples ( PGresult* res ) ;
-FUNCTION: char* PQfname ( PGresult* res, int field_num ) ;
-FUNCTION: int   PQfnumber ( PGresult* res, char* field_name ) ;
+FUNCTION: c-string PQfname ( PGresult* res, int field_num ) ;
+FUNCTION: int   PQfnumber ( PGresult* res, c-string field_name ) ;
 FUNCTION: Oid   PQftable ( PGresult* res, int field_num ) ;
 FUNCTION: int   PQftablecol ( PGresult* res, int field_num ) ;
 FUNCTION: int   PQfformat ( PGresult* res, int field_num ) ;
 FUNCTION: Oid   PQftype ( PGresult* res, int field_num ) ;
 FUNCTION: int   PQfsize ( PGresult* res, int field_num ) ;
 FUNCTION: int   PQfmod ( PGresult* res, int field_num ) ;
-FUNCTION: char* PQcmdStatus ( PGresult* res ) ;
-FUNCTION: char* PQoidStatus ( PGresult* res ) ;
+FUNCTION: c-string PQcmdStatus ( PGresult* res ) ;
+FUNCTION: c-string PQoidStatus ( PGresult* res ) ;
 FUNCTION: Oid   PQoidValue ( PGresult* res ) ;
-FUNCTION: char* PQcmdTuples ( PGresult* res ) ;
-! FUNCTION: char* PQgetvalue ( PGresult* res, int tup_num, int field_num ) ;
+FUNCTION: c-string PQcmdTuples ( PGresult* res ) ;
+! FUNCTION: c-string PQgetvalue ( PGresult* res, int tup_num, int field_num ) ;
 FUNCTION: void* PQgetvalue ( PGresult* res, int tup_num, int field_num ) ;
 FUNCTION: int   PQgetlength ( PGresult* res, int tup_num, int field_num ) ;
 FUNCTION: int   PQgetisnull ( PGresult* res, int tup_num, int field_num ) ;
@@ -293,16 +292,16 @@ FUNCTION: PGresult* PQmakeEmptyPGresult ( PGconn* conn, ExecStatusType status )
 
 ! Quoting strings before inclusion in queries.
 FUNCTION: size_t PQescapeStringConn ( PGconn* conn,
-                                    char* to, char* from, size_t length,
+                                    c-string to, c-string from, size_t length,
                                     int* error ) ;
-FUNCTION: uchar* PQescapeByteaConn ( PGconn* conn,
-                                    char* from, size_t length,
+FUNCTION: c-string PQescapeByteaConn ( PGconn* conn,
+                                    c-string from, size_t length,
                                     size_t* to_length ) ;
-FUNCTION: void* PQunescapeBytea ( uchar* strtext, size_t* retbuflen ) ;
-! FUNCTION: uchar* PQunescapeBytea ( uchar* strtext, size_t* retbuflen ) ;
+FUNCTION: void* PQunescapeBytea ( c-string strtext, size_t* retbuflen ) ;
+! FUNCTION: c-string PQunescapeBytea ( c-string strtext, size_t* retbuflen ) ;
 ! These forms are deprecated!
-FUNCTION: size_t PQescapeString ( void* to, char* from, size_t length ) ;
-FUNCTION: uchar* PQescapeBytea ( uchar* bintext, size_t binlen,
+FUNCTION: size_t PQescapeString ( void* to, c-string from, size_t length ) ;
+FUNCTION: c-string PQescapeBytea ( c-string bintext, size_t binlen,
               size_t* bytealen ) ;
 
 ! === in fe-print.c ===
@@ -313,7 +312,7 @@ FUNCTION: void PQprint ( FILE* fout, PGresult* res, PQprintOpt* ps ) ;
 FUNCTION: void PQdisplayTuples ( PGresult* res,
                                 FILE* fp,               
                                 int fillAlign,
-                                char* fieldSep,
+                                c-string fieldSep,
                                 int printHeader,
                                 int quiet ) ;
 
@@ -327,23 +326,23 @@ FUNCTION: void PQprintTuples ( PGresult* res,
 ! Large-object access routines
 FUNCTION: int    lo_open ( PGconn* conn, Oid lobjId, int mode ) ;
 FUNCTION: int    lo_close ( PGconn* conn, int fd ) ;
-FUNCTION: int    lo_read ( PGconn* conn, int fd, char* buf, size_t len ) ;
-FUNCTION: int    lo_write ( PGconn* conn, int fd, char* buf, size_t len ) ;
+FUNCTION: int    lo_read ( PGconn* conn, int fd, c-string buf, size_t len ) ;
+FUNCTION: int    lo_write ( PGconn* conn, int fd, c-string buf, size_t len ) ;
 FUNCTION: int    lo_lseek ( PGconn* conn, int fd, int offset, int whence ) ;
 FUNCTION: Oid    lo_creat ( PGconn* conn, int mode ) ;
 ! FUNCTION: Oid    lo_creat ( PGconn* conn, Oid lobjId ) ;
 FUNCTION: int    lo_tell ( PGconn* conn, int fd ) ;
 FUNCTION: int    lo_unlink ( PGconn* conn, Oid lobjId ) ;
-FUNCTION: Oid    lo_import ( PGconn* conn, char* filename ) ;
-FUNCTION: int    lo_export ( PGconn* conn, Oid lobjId, char* filename ) ;
+FUNCTION: Oid    lo_import ( PGconn* conn, c-string filename ) ;
+FUNCTION: int    lo_export ( PGconn* conn, Oid lobjId, c-string filename ) ;
 
 ! === in fe-misc.c ===
 
 ! Determine length of multibyte encoded char at *s
-FUNCTION: int    PQmblen ( uchar* s, int encoding ) ;
+FUNCTION: int    PQmblen ( c-string s, int encoding ) ;
 
 ! Determine display length of multibyte encoded char at *s
-FUNCTION: int    PQdsplen ( uchar* s, int encoding ) ;
+FUNCTION: int    PQdsplen ( c-string s, int encoding ) ;
 
 ! Get encoding id from environment variable PGCLIENTENCODING
 FUNCTION: int    PQenv2encoding ( ) ;
index 5398e669ed6af622ef341dbbf27164afbc52dc20..7fe40a73d6ce30eaf5af2628e7e3e072f1aafe97 100644 (file)
@@ -139,15 +139,14 @@ M: postgresql-malloc-destructor dispose ( obj -- )
         [ 3drop ] dip
         [
             memory>byte-array >string
-            0 <uint>
+            { uint }
             [
                 PQunescapeBytea dup zero? [
                     postgresql-result-error-message throw
                 ] [
                     &postgresql-free
                 ] if
-            ] keep
-            *uint memory>byte-array
+            ] [ ] with-out-parameters memory>byte-array
         ] with-destructors 
     ] [
         drop pq-get-is-null nip [ f ] [ B{ } clone ] if
index c180df9bf545f9deab319365946ad5c3980a61f1..b5f9020ce9fb192cd4231530f512352018d599f6 100644 (file)
@@ -10,7 +10,7 @@ IN: db.sqlite.ffi
         { [ os winnt? ]  [ "sqlite3.dll" ] }
         { [ os macosx? ] [ "/usr/lib/libsqlite3.dylib" ] }
         { [ os unix? ]  [ "libsqlite3.so" ] }
-    } cond "cdecl" add-library >>
+    } cond cdecl add-library >>
 
 ! Return values from sqlite functions
 CONSTANT: SQLITE_OK           0 ! Successful result
@@ -99,17 +99,17 @@ CONSTANT: SQLITE_OPEN_TEMP_JOURNAL     HEX: 00001000
 CONSTANT: SQLITE_OPEN_SUBJOURNAL       HEX: 00002000
 CONSTANT: SQLITE_OPEN_MASTER_JOURNAL   HEX: 00004000
 
-TYPEDEF: void* sqlite3*
-TYPEDEF: void* sqlite3_stmt*
+C-TYPE: sqlite3
+C-TYPE: sqlite3_stmt
 TYPEDEF: longlong sqlite3_int64
 TYPEDEF: ulonglong sqlite3_uint64
 
 LIBRARY: sqlite
-FUNCTION: int sqlite3_open ( char* filename, void* ppDb ) ;
+FUNCTION: int sqlite3_open ( c-string filename, void* ppDb ) ;
 FUNCTION: int sqlite3_close ( sqlite3* pDb ) ;
-FUNCTION: char* sqlite3_errmsg ( sqlite3* pDb ) ;
-FUNCTION: int sqlite3_prepare ( sqlite3* pDb, char* zSql, int nBytes, void* ppStmt, void* pzTail ) ;
-FUNCTION: int sqlite3_prepare_v2 ( sqlite3* pDb, char* zSql, int nBytes, void* ppStmt, void* pzTail ) ;
+FUNCTION: c-string sqlite3_errmsg ( sqlite3* pDb ) ;
+FUNCTION: int sqlite3_prepare ( sqlite3* pDb, c-string zSql, int nBytes, void* ppStmt, void* pzTail ) ;
+FUNCTION: int sqlite3_prepare_v2 ( sqlite3* pDb, c-string zSql, int nBytes, void* ppStmt, void* pzTail ) ;
 FUNCTION: int sqlite3_finalize ( sqlite3_stmt* pStmt ) ;
 FUNCTION: int sqlite3_reset ( sqlite3_stmt* pStmt ) ;
 FUNCTION: int sqlite3_step ( sqlite3_stmt* pStmt ) ;
@@ -119,24 +119,22 @@ FUNCTION: int sqlite3_bind_double ( sqlite3_stmt* pStmt, int index, double x ) ;
 FUNCTION: int sqlite3_bind_int ( sqlite3_stmt* pStmt, int index, int n ) ;
 FUNCTION: int sqlite3_bind_int64 ( sqlite3_stmt* pStmt, int index, sqlite3_int64 n ) ;
 ! Bind the same function as above, but for unsigned 64bit integers
-: sqlite3-bind-uint64 ( pStmt index in64 -- int )
-    int "sqlite" "sqlite3_bind_int64"
-    { sqlite3_stmt* int sqlite3_uint64 } alien-invoke ;
+FUNCTION-ALIAS: sqlite3-bind-uint64
+    int sqlite3_bind_int64 ( sqlite3_stmt* pStmt, int index, sqlite3_uint64 in64 ) ;
 FUNCTION: int sqlite3_bind_null ( sqlite3_stmt* pStmt, int n ) ;
-FUNCTION: int sqlite3_bind_text ( sqlite3_stmt* pStmt, int index, char* text, int len, int destructor ) ;
-FUNCTION: int sqlite3_bind_parameter_index ( sqlite3_stmt* pStmt, char* name ) ;
+FUNCTION: int sqlite3_bind_text ( sqlite3_stmt* pStmt, int index, c-string text, int len, int destructor ) ;
+FUNCTION: int sqlite3_bind_parameter_index ( sqlite3_stmt* pStmt, c-string name ) ;
 FUNCTION: int sqlite3_clear_bindings ( sqlite3_stmt* pStmt ) ;
 FUNCTION: int sqlite3_column_count ( sqlite3_stmt* pStmt ) ;
 FUNCTION: void* sqlite3_column_blob ( sqlite3_stmt* pStmt, int col ) ;
 FUNCTION: int sqlite3_column_bytes ( sqlite3_stmt* pStmt, int col ) ;
-FUNCTION: char* sqlite3_column_decltype ( sqlite3_stmt* pStmt, int col ) ;
+FUNCTION: c-string sqlite3_column_decltype ( sqlite3_stmt* pStmt, int col ) ;
 FUNCTION: int sqlite3_column_int ( sqlite3_stmt* pStmt, int col ) ;
 FUNCTION: sqlite3_int64 sqlite3_column_int64 ( sqlite3_stmt* pStmt, int col ) ;
 ! Bind the same function as above, but for unsigned 64bit integers
-: sqlite3-column-uint64 ( pStmt col -- uint64 )
-    sqlite3_uint64 "sqlite" "sqlite3_column_int64"
-    { sqlite3_stmt* int } alien-invoke ;
+FUNCTION-ALIAS: sqlite3-column-uint64
+    sqlite3_uint64 sqlite3_column_int64 ( sqlite3_stmt* pStmt, int col ) ;
 FUNCTION: double sqlite3_column_double ( sqlite3_stmt* pStmt, int col ) ;
-FUNCTION: char* sqlite3_column_name ( sqlite3_stmt* pStmt, int col ) ;
-FUNCTION: char* sqlite3_column_text ( sqlite3_stmt* pStmt, int col ) ;
+FUNCTION: c-string sqlite3_column_name ( sqlite3_stmt* pStmt, int col ) ;
+FUNCTION: c-string sqlite3_column_text ( sqlite3_stmt* pStmt, int col ) ;
 FUNCTION: int sqlite3_column_type ( sqlite3_stmt* pStmt, int col ) ;
index b8e56863c3d6ab25fd2e17c25dd7515bed163ee4..58033a281e8a5bb117eccee0c2371546e588df49 100644 (file)
@@ -27,16 +27,17 @@ ERROR: sqlite-sql-error < sql-error n string ;
 
 : sqlite-open ( path -- db )
     normalize-path
-    void* <c-object>
-    [ sqlite3_open sqlite-check-result ] keep *void* ;
+    { void* } [ sqlite3_open sqlite-check-result ] [ ]
+    with-out-parameters ;
 
 : sqlite-close ( db -- )
     sqlite3_close sqlite-check-result ;
 
 : sqlite-prepare ( db sql -- handle )
-    utf8 encode dup length void* <c-object> void* <c-object>
-    [ sqlite3_prepare_v2 sqlite-check-result ] 2keep
-    drop *void* ;
+    utf8 encode dup length
+    { void* void* }
+    [ sqlite3_prepare_v2 sqlite-check-result ] [ drop ]
+    with-out-parameters ;
 
 : sqlite-bind-parameter-index ( handle name -- index )
     sqlite3_bind_parameter_index ;
index d193b5921e6aa7ef0f4548eb6735411004f7e18b..19e7760c46c489e64b4ea299bffb0f1b2efe9def 100644 (file)
@@ -75,7 +75,7 @@ PRIVATE>
 ERROR: no-slots-named class seq ;
 : check-columns ( class columns -- )
     [ nip ] [
-        [ [ first ] map ]
+        [ keys ]
         [ all-slots [ name>> ] map ] bi* diff
     ] 2bi
     [ drop ] [ no-slots-named ] if-empty ;
index b6497c52a92c52d4f6ea941b5a0dcfa1ba767917..eca34c2526daddb4cecb1fafeb6b2feeab3c98d9 100644 (file)
@@ -1,15 +1,15 @@
 ! Copyright (C) 2004, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: slots arrays definitions generic hashtables summary io kernel
-math namespaces make prettyprint prettyprint.config sequences assocs
-sequences.private strings io.styles io.pathnames vectors words system
-splitting math.parser classes.mixin classes.tuple continuations
-continuations.private combinators generic.math classes.builtin classes
-compiler.units generic.standard generic.single vocabs init
-kernel.private io.encodings accessors math.order destructors
-source-files parser classes.tuple.parser effects.parser lexer
-generic.parser strings.parser vocabs.loader vocabs.parser
-source-files.errors ;
+USING: slots arrays definitions generic hashtables summary io
+kernel math namespaces make prettyprint prettyprint.config
+sequences assocs sequences.private strings io.styles
+io.pathnames vectors words system splitting math.parser
+classes.mixin classes.tuple continuations continuations.private
+combinators generic.math classes.builtin classes compiler.units
+generic.standard generic.single vocabs init kernel.private
+io.encodings accessors math.order destructors source-files
+parser classes.tuple.parser effects.parser lexer generic.parser
+strings.parser vocabs.loader vocabs.parser source-files.errors ;
 IN: debugger
 
 GENERIC: error-help ( error -- topic )
@@ -120,6 +120,8 @@ HOOK: signal-error. os ( obj -- )
 : datastack-overflow. ( obj -- ) "Data" stack-overflow. ;
 : retainstack-underflow. ( obj -- ) "Retain" stack-underflow. ;
 : retainstack-overflow. ( obj -- ) "Retain" stack-overflow. ;
+: callstack-underflow. ( obj -- ) "Call" stack-underflow. ;
+: callstack-overflow. ( obj -- ) "Call" stack-overflow. ;
 
 : memory-error. ( error -- )
     "Memory protection fault at address " write third .h ;
@@ -153,8 +155,10 @@ PREDICATE: vm-error < array
         { 11 [ datastack-overflow.     ] }
         { 12 [ retainstack-underflow.  ] }
         { 13 [ retainstack-overflow.   ] }
-        { 14 [ memory-error.           ] }
-        { 15 [ fp-trap-error.          ] }
+        { 14 [ callstack-underflow.    ] }
+        { 15 [ callstack-overflow.     ] }
+        { 16 [ memory-error.           ] }
+        { 17 [ fp-trap-error.          ] }
     } ; inline
 
 M: vm-error summary drop "VM error" ;
@@ -266,20 +270,20 @@ M: no-current-vocab summary
 
 M: no-word-error summary
     name>>
-    "No word named ``"
-    "'' found in current vocabulary search path" surround ;
+    "No word named "
+    " found in current vocabulary search path" surround ;
 
 M: no-word-error error. summary print ;
 
 M: no-word-in-vocab summary
     [ vocab>> ] [ word>> ] bi
-    [ "No word named ``" % % "'' found in ``" % % "'' vocabulary" % ] "" make ;
+    [ "No word named “" % % "” found in “" % % "” vocabulary" % ] "" make ;
 
 M: no-word-in-vocab error. summary print ;
 
 M: ambiguous-use-error summary
     words>> first name>>
-    "More than one vocabulary defines a word named ``" "''" surround ;
+    "More than one vocabulary defines a word named “" "”" surround ;
 
 M: ambiguous-use-error error. summary print ;
 
@@ -302,6 +306,9 @@ M: bad-inheritance summary
 M: not-in-a-method-error summary
     drop "call-next-method can only be called in a method definition" ;
 
+M: version-control-merge-conflict summary
+    drop "Version control merge conflict in source code" ;
+
 GENERIC: expected>string ( obj -- str )
 
 M: f expected>string drop "end of input" ;
@@ -329,6 +336,12 @@ M: lexer-error error-help
 M: bad-effect summary
     drop "Bad stack effect declaration" ;
 
+M: invalid-row-variable summary
+    drop "Stack effect row variables can only occur as the first input or output" ;
+
+M: row-variable-can't-have-type summary
+    drop "Stack effect row variables cannot have a declared type" ;
+
 M: bad-escape error.
     "Bad escape code: \\" write
     char>> 1string print ;
@@ -342,8 +355,3 @@ M: not-found-in-roots summary drop "Cannot resolve vocab: path" ;
 M: wrong-values summary drop "Quotation's stack effect does not match call site" ;
 
 M: stack-effect-omits-dashes summary drop "Stack effect must contain “--”" ;
-
-{
-    { [ os windows? ] [ "debugger.windows" require ] }
-    { [ os unix? ] [ "debugger.unix" require ] }
-} cond
index 73c6b0e795c7aac78a09a15752621cab5006d24f..662d07d0372ae3625ecccda1d2f2aeccc996da2a 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs debugger io kernel literals math.parser namespaces
-prettyprint sequences system windows.kernel32 ;
+USING: accessors assocs debugger io kernel literals math.parser
+namespaces prettyprint sequences system windows.kernel32
+windows.ole32 windows.errors math ;
 IN: debugger.windows
 
 CONSTANT: seh-names
@@ -41,3 +42,14 @@ CONSTANT: seh-names
 M: windows signal-error.
     "Windows exception 0x" write
     third [ >hex write ] [ seh-name. ] bi nl ;
+
+M: ole32-error error.
+    "COM error 0x" write
+    dup code>> HEX: ffff,ffff bitand >hex write ": " write
+    message>> write ;
+
+M: windows-error error.
+    "Win32 error 0x" write
+    dup n>> HEX: ffff,ffff bitand >hex write ": " write
+    string>> write ;
+
index d4867714d36d7487bf3030811f78f0fd30f9bc28..451016cc6c9f46e57fdb2346d164576b720ef767 100644 (file)
@@ -18,9 +18,16 @@ HELP: define-consult
 { $notes "Usually, " { $link POSTPONE: CONSULT: } " should be used instead. This is only for runtime use." } ;
 
 HELP: CONSULT:
-{ $syntax "CONSULT: group class getter... ;" } 
-{ $values { "group" "a protocol, generic word or tuple class" } { "class" "a class" } { "getter" "code to get where the method should be forwarded" } }
-{ $description "Defines a class to consult, using the given code, on the generic words contained in the group. This means that, when one of the words in the group is called on an object of this class, the quotation will be called, and then the generic word called again. If the getter is empty, this will cause an infinite loop. Consultation overwrites the existing methods, but others can be defined afterwards." } ;
+{ $syntax """CONSULT: group class
+    code ;""" } 
+{ $values { "group" "a protocol, generic word or tuple class" } { "class" "a class" } { "code" "code to get the object to which the method should be forwarded" } }
+{ $description "Declares that objects of " { $snippet "class" } " will delegate the generic words contained in " { $snippet "group" } " to the object returned by executing " { $snippet "code" } " with the original object as an input." { $snippet "CONSULT:" } " will overwrite any existing methods on " { $snippet "class" } " for the members of " { $snippet "group" } ", but new methods can be added after the " { $snippet "CONSULT:" } " to override the delegation." } ;
+
+HELP: BROADCAST:
+{ $syntax """BROADCAST: group class
+    code ;""" } 
+{ $values { "group" "a protocol, generic word or tuple class" } { "class" "a class" } { "code" "code to get the object to which the method should be forwarded" } }
+{ $description "Declares that objects of " { $snippet "class" } " will delegate the generic words contained in " { $snippet "group" } " to every object in the sequence returned by executing " { $snippet "code" } " with the original object as an input." { $snippet "BROADCAST:" } " will overwrite any existing methods on " { $snippet "class" } " for the members of " { $snippet "group" } ", but new methods can be added after the " { $snippet "BROADCAST:" } " to override the delegation. Every generic word in " { $snippet "group" } " must return no outputs; otherwise, a " { $link broadcast-words-must-have-no-outputs } " error will be raised." } ;
 
 HELP: SLOT-PROTOCOL:
 { $syntax "SLOT-PROTOCOL: protocol-name slots... ;" }
@@ -28,7 +35,7 @@ HELP: SLOT-PROTOCOL:
 
 { define-protocol POSTPONE: PROTOCOL: } related-words
 
-{ define-consult POSTPONE: CONSULT: } related-words
+{ define-consult POSTPONE: BROADCAST: POSTPONE: CONSULT: } related-words
 
 HELP: group-words
 { $values { "group" "a group" } { "words" "an array of words" } }
@@ -52,6 +59,7 @@ $nl
 { $subsections POSTPONE: SLOT-PROTOCOL: }
 "Defining consultation:"
 { $subsections
+    POSTPONE: BROADCAST:
     POSTPONE: CONSULT:
     define-consult
 }
index 17f81708c5e94c5d9f5ee1c2fec77156a44b58b6..4a280ef58432998b1fc5246ee20c6c2c619cd5b3 100644 (file)
@@ -1,7 +1,7 @@
 USING: delegate kernel arrays tools.test words math definitions
 compiler.units parser generic prettyprint io.streams.string
 accessors eval multiline generic.single delegate.protocols
-delegate.private assocs see ;
+delegate.private assocs see make ;
 IN: delegate.tests
 
 TUPLE: hello this that ;
@@ -197,3 +197,18 @@ DEFER: seq-delegate
     sequence-protocol \ protocol-consult word-prop
     key?
 ] unit-test
+
+GENERIC: broadcastable ( x -- )
+GENERIC: nonbroadcastable ( x -- y )
+
+TUPLE: broadcaster targets ;
+
+BROADCAST: broadcastable broadcaster targets>> ;
+
+M: integer broadcastable 1 + , ;
+
+[ "USING: accessors delegate ; IN: delegate.tests BROADCAST: nonbroadcastable broadcaster targets>> ;" eval( -- ) ]
+[ error>> broadcast-words-must-have-no-outputs? ] must-fail-with
+
+[ { 2 3 4 } ]
+[ { 1 2 3 } broadcaster boa [ broadcastable ] { } make ] unit-test
index d033b7115bb28f252faba92c49d387ce483a2ab0..5bbd62dfa8c9f0389586c8b52b4c2d11be7c3514 100644 (file)
@@ -1,12 +1,14 @@
 ! Copyright (C) 2007, 2008 Daniel Ehrenberg
-! Portions copyright (C) 2009 Slava Pestov
+! Portions copyright (C) 2009, 2010 Slava Pestov, Joe Groff
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs classes.tuple definitions generic
+USING: accessors arrays assocs classes.tuple definitions effects generic
 generic.standard hashtables kernel lexer math parser
 generic.parser sequences sets slots words words.symbol fry
 compiler.units ;
 IN: delegate
 
+ERROR: broadcast-words-must-have-no-outputs group ;
+
 <PRIVATE
 
 : protocol-words ( protocol -- words )
@@ -28,12 +30,19 @@ M: tuple-class group-words
         2array
     ] map concat ;
 
+: check-broadcast-group ( group -- group )
+    dup group-words [ first stack-effect out>> empty? ] all?
+    [ broadcast-words-must-have-no-outputs ] unless ;
+
 ! Consultation
 
 TUPLE: consultation group class quot loc ;
+TUPLE: broadcast < consultation ;
 
 : <consultation> ( group class quot -- consultation )
     f consultation boa ; 
+: <broadcast> ( group class quot -- consultation )
+    [ check-broadcast-group ] 2dip f broadcast boa ; 
 
 : create-consult-method ( word consultation -- method )
     [ class>> swap first create-method dup fake-definition ] keep
@@ -44,13 +53,21 @@ PREDICATE: consult-method < method "consultation" word-prop ;
 M: consult-method reset-word
     [ call-next-method ] [ f "consultation" set-word-prop ] bi ;
 
-: consult-method-quot ( quot word -- object )
+GENERIC# (consult-method-quot) 2 ( consultation quot word -- object )
+
+M: consultation (consult-method-quot)
+    '[ _ call _ execute ] nip ;
+M: broadcast (consult-method-quot)
+    '[ _ call [ _ execute ] each ] nip ;
+
+: consult-method-quot ( consultation word -- object )
+    [ dup quot>> ] dip
     [ second [ [ dip ] curry ] times ] [ first ] bi
-    '[ _ call _ execute ] ;
+    (consult-method-quot) ;
 
 : consult-method ( word consultation -- )
     [ create-consult-method ]
-    [ quot>> swap consult-method-quot ] 2bi
+    [ swap consult-method-quot ] 2bi
     define ;
 
 : change-word-prop ( word prop quot -- )
@@ -89,9 +106,13 @@ SYNTAX: CONSULT:
     scan-word scan-word parse-definition <consultation>
     [ save-location ] [ define-consult ] bi ;
 
+SYNTAX: BROADCAST:
+    scan-word scan-word parse-definition <broadcast>
+    [ save-location ] [ define-consult ] bi ;
+
 M: consultation where loc>> ;
 
-M: consultation set-where (>>loc) ;
+M: consultation set-where loc<< ;
 
 M: consultation forget*
     [ unconsult-methods ] [ unregister-consult ] bi ;
@@ -99,11 +120,8 @@ M: consultation forget*
 ! Protocols
 <PRIVATE
 
-: cross-2each ( seq1 seq2 quot -- )
-    [ with each ] 2curry each ; inline
-
 : forget-all-methods ( classes words -- )
-    [ first method forget ] cross-2each ;
+    [ first method forget ] cartesian-each ;
 
 : protocol-users ( protocol -- users )
     protocol-consult keys ;
@@ -120,7 +138,7 @@ M: consultation forget*
 
 : add-new-definitions ( protocol wordlist -- )
     [ drop protocol-consult values ] [ added-words ] 2bi
-    [ swap consult-method ] cross-2each ;
+    [ swap consult-method ] cartesian-each ;
 
 : initialize-protocol-props ( protocol wordlist -- )
     [
@@ -160,6 +178,6 @@ M: protocol definer drop \ PROTOCOL: \ ; ;
 M: protocol group-words protocol-words ;
 
 SYNTAX: SLOT-PROTOCOL:
-    CREATE-WORD ";" parse-tokens
-    [ [ reader-word ] [ writer-word ] bi 2array ] map concat
-    define-protocol ;
\ No newline at end of file
+    CREATE-WORD ";"
+    [ [ reader-word ] [ writer-word ] bi 2array ]
+    map-tokens concat define-protocol ;
index 1e1be404a77f5459215e6455e9d3aa7603b5847d..7483c0f56b12c90e330ae9a89c090f1496b68822 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel sequences math fry ;
 IN: deques
@@ -16,22 +16,22 @@ GENERIC: node-value ( node -- value )
 GENERIC: deque-empty? ( deque -- ? )
 
 : push-front ( obj deque -- )
-    push-front* drop ;
+    push-front* drop ; inline
 
 : push-all-front ( seq deque -- )
     [ push-front ] curry each ;
 
 : push-back ( obj deque -- )
-    push-back* drop ;
+    push-back* drop ; inline
 
 : push-all-back ( seq deque -- )
     [ push-back ] curry each ;
 
 : pop-front ( deque -- obj )
-    [ peek-front ] [ pop-front* ] bi ;
+    [ peek-front ] [ pop-front* ] bi ; inline
 
 : pop-back ( deque -- obj )
-    [ peek-back ] [ pop-back* ] bi ;
+    [ peek-back ] [ pop-back* ] bi ; inline
 
 : slurp-deque ( deque quot -- )
     [ drop '[ _ deque-empty? not ] ]
index 05df13f07347d20ef427e2a876d8463f0502a83a..a158302ecc02117523861f40ab5fc38dfc06c7b7 100644 (file)
@@ -74,6 +74,10 @@ GENERIC: disjoint-set-member? ( a disjoint-set -- ? )
 
 M: disjoint-set disjoint-set-member? parents>> key? ;
 
+GENERIC: disjoint-set-members ( disjoint-set -- seq )
+
+M: disjoint-set disjoint-set-members parents>> keys ;
+
 GENERIC: equiv-set-size ( a disjoint-set -- n )
 
 M: disjoint-set equiv-set-size [ representative ] keep count ;
index 317ed81e3e82811e80e464163237b76cbda36c9a..c4b191360bbc50930e1831b80d70e14c5467ef64 100644 (file)
@@ -29,15 +29,15 @@ TUPLE: dlist
 : <hashed-dlist> ( -- search-deque )
     20 <hashtable> <dlist> <search-deque> ;
 
-M: dlist deque-empty? front>> not ;
+M: dlist deque-empty? front>> not ; inline
 
 M: dlist-node node-value obj>> ;
 
 : set-prev-when ( dlist-node dlist-node/f -- )
-    [ (>>prev) ] [ drop ] if* ; inline
+    [ prev<< ] [ drop ] if* ; inline
 
 : set-next-when ( dlist-node dlist-node/f -- )
-    [ (>>next) ] [ drop ] if* ; inline
+    [ next<< ] [ drop ] if* ; inline
 
 : set-next-prev ( dlist-node -- )
     dup next>> set-prev-when ; inline
@@ -54,16 +54,16 @@ M: dlist-node node-value obj>> ;
 : set-front-to-back ( dlist -- )
     dup front>> [ dup back>> >>front ] unless drop ; inline
 
-: (dlist-find-node) ( dlist-node quot: ( node -- ? ) -- node/f ? )
+: (dlist-find-node) ( ... dlist-node quot: ( ... node -- ... ? ) -- ... node/f ? )
     over [
         [ call ] 2keep rot
         [ drop t ] [ [ next>> ] dip (dlist-find-node) ] if
     ] [ 2drop f f ] if ; inline recursive
 
-: dlist-find-node ( dlist quot -- node/f ? )
+: dlist-find-node ( ... dlist quot: ( ... node -- ... ? ) -- ... node/f ? )
     [ front>> ] dip (dlist-find-node) ; inline
 
-: dlist-each-node ( dlist quot -- )
+: dlist-each-node ( ... dlist quot: ( ... node -- ... ) -- ... )
     '[ @ f ] dlist-find-node 2drop ; inline
 
 : unlink-node ( dlist-node -- )
@@ -74,13 +74,13 @@ PRIVATE>
 
 M: dlist push-front* ( obj dlist -- dlist-node )
     [ front>> f swap <dlist-node> dup dup set-next-prev ] keep
-    [ (>>front) ] keep
+    [ front<< ] keep
     set-back-to-front ;
 
 M: dlist push-back* ( obj dlist -- dlist-node )
     [ back>> f <dlist-node> ] keep
     [ back>> set-next-when ] 2keep
-    [ (>>back) ] 2keep
+    [ back<< ] 2keep
     set-front-to-back ;
 
 ERROR: empty-dlist ;
@@ -114,10 +114,10 @@ M: dlist pop-back* ( dlist -- )
     ] keep
     normalize-front ;
 
-: dlist-find ( dlist quot -- obj/f ? )
+: dlist-find ( ... dlist quot: ( ... value -- ... ? ) -- ... obj/f ? )
     '[ obj>> @ ] dlist-find-node [ obj>> t ] [ drop f f ] if ; inline
 
-: dlist-any? ( dlist quot -- ? )
+: dlist-any? ( ... dlist quot: ( ... value -- ... ? ) -- ... ? )
     dlist-find nip ; inline
 
 M: dlist deque-member? ( value dlist -- ? )
@@ -130,7 +130,7 @@ M: dlist delete-node ( dlist-node dlist -- )
         [ drop unlink-node ]
     } cond ;
 
-: delete-node-if* ( dlist quot -- obj/f ? )
+: delete-node-if* ( ... dlist quot: ( ... value -- ... ? ) -- ... obj/f ? )
     dupd dlist-find-node [
         dup [
             [ swap delete-node ] keep obj>> t
@@ -141,7 +141,7 @@ M: dlist delete-node ( dlist-node dlist -- )
         2drop f f
     ] if ; inline
 
-: delete-node-if ( dlist quot -- obj/f )
+: delete-node-if ( ... dlist quot: ( ... value -- ... ? ) -- ... obj/f )
     '[ obj>> @ ] delete-node-if* drop ; inline
 
 M: dlist clear-deque ( dlist -- )
@@ -149,7 +149,7 @@ M: dlist clear-deque ( dlist -- )
     f >>back
     drop ;
 
-: dlist-each ( dlist quot -- )
+: dlist-each ( ... dlist quot: ( ... value -- ... ) -- ... )
     '[ obj>> @ ] dlist-each-node ; inline
 
 : dlist>seq ( dlist -- seq )
@@ -157,7 +157,7 @@ M: dlist clear-deque ( dlist -- )
 
 : 1dlist ( obj -- dlist ) <dlist> [ push-front ] keep ;
 
-: dlist-filter ( dlist quot -- dlist' )
+: dlist-filter ( ... dlist quot: ( ... value -- ... ? ) -- ... dlist' )
     over [ '[ dup obj>> @ [ drop ] [ _ delete-node ] if ] dlist-each-node ] keep ; inline
 
 M: dlist clone
index a4e02009df257530a81efefc4413b6597991965a..203a6e3b09ebcd6c0ea4072bc57982e3956e1129 100644 (file)
@@ -42,7 +42,7 @@ HELP: doc-lines
 { $errors "Throws an error if " { $snippet "from" } " or " { $snippet "to" } " is out of bounds." } ;
 
 HELP: each-line
-{ $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "quot" { $quotation "( string -- )" } } }
+{ $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "quot" { $quotation "( ... line -- ... )" } } }
 { $description "Applies the quotation to each line in the range." }
 { $notes "The range is created by calling " { $link <slice> } "." }
 { $errors "Throws an error if " { $snippet "from" } " or " { $snippet "to" } " is out of bounds." } ;
index dcd1bf5820080ab3225466dd8f76f71a75d98ba2..e84a993eeaadfb4058b9422c9f8068da79585374 100644 (file)
@@ -55,12 +55,12 @@ TUPLE: document < model locs undos redos inside-undo? ;
     to first line# =
     [ to second ] [ line# document doc-line length ] if ;
 
-: each-line ( from to quot -- )
+: each-line ( ... from to quot: ( ... line -- ... ) -- ... )
     2over = [ 3drop ] [
         [ [ first ] bi@ [a,b] ] dip each
     ] if ; inline
 
-: map-lines ( from to quot -- results )
+: map-lines ( ... from to quot: ( ... line -- ... result ) -- ... results )
     collector [ each-line ] dip ; inline
 
 : start/end-on-line ( from to line# document -- n1 n2 )
@@ -109,7 +109,7 @@ CONSTANT: doc-start { 0 0 }
 : entire-doc ( document -- start end document )
     [ [ doc-start ] dip doc-end ] keep ;
 
-: with-undo ( document quot: ( document -- ) -- )
+: with-undo ( ..a document quot: ( ..a document -- ..b ) -- ..b )
     [ t >>inside-undo? ] dip keep f >>inside-undo? drop ; inline
 
 PRIVATE>
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100755 (executable)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
diff --git a/basis/editors/vim/generate-syntax/tags.txt b/basis/editors/vim/generate-syntax/tags.txt
deleted file mode 100644 (file)
index 5d77766..0000000
+++ /dev/null
@@ -1 +0,0 @@
-untested
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 57954385706ed1a007bb0e0b1f8803eb6bab31c9..406dada1454dee054c277cfd259530693a7fd38b 100644 (file)
@@ -4,6 +4,7 @@ USING: sequences kernel splitting lists fry accessors assocs math.order
 math combinators namespaces urls.encoding xml.syntax xmode.code2html
 xml.data arrays strings vectors xml.writer io.streams.string locals
 unicode.categories ;
+FROM: namespaces => set ;
 IN: farkup
 
 SYMBOL: relative-link-prefix
@@ -70,7 +71,7 @@ DEFER: (parse-paragraph)
         { CHAR: % inline-code }
     } at ;
 
-: or-simple-title ( url title/f quot: ( title -- title' ) -- url title' )
+: or-simple-title ( ... url title/f quot: ( ... title -- ... title' ) -- ... url title' )
     [ "" like dup simple-link-title ] if* ; inline
 
 : parse-link ( string -- paragraph-list )
old mode 100644 (file)
new mode 100755 (executable)
index 47720ad..100c88c
@@ -36,7 +36,7 @@ HELP: printf
     "For example:\n"
     { $list
         "\"%5s\" formats a string padding with spaces up to 5 characters wide."
-        "\"%08d\" formats an integer padding with zeros up to 3 characters wide."
+        "\"%03d\" formats an integer padding with zeros up to 3 characters wide."
         "\"%'#5f\" formats a float padding with '#' up to 3 characters wide."
         "\"%-10d\" formats an integer to 10 characters wide and left-aligns." 
     }
@@ -62,10 +62,6 @@ HELP: printf
         "USING: formatting ;"
         "1.23456789 \"%.3f\" printf"
         "1.235" }
-    { $example 
-        "USING: formatting ;"
-        "1234567890 \"%.5e\" printf"
-        "1.23457e+09" }
     { $example
         "USING: formatting ;"
         "12 \"%'#4d\" printf"
old mode 100644 (file)
new mode 100755 (executable)
index 5710ceb..740babf
@@ -1,82 +1,85 @@
 ! Copyright (C) 2008 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
-USING: calendar kernel formatting tools.test ;
+USING: calendar kernel formatting tools.test system ;
 IN: formatting.tests
 
 [ "%s" printf ] must-infer 
 [ "%s" sprintf ] must-infer
 
-[ t ] [ "" "" sprintf = ] unit-test
-[ t ] [ "asdf" "asdf" sprintf = ] unit-test
-[ t ] [ "10" 10 "%d" sprintf = ] unit-test
-[ t ] [ "+10" 10 "%+d" sprintf = ] unit-test
-[ t ] [ "-10" -10 "%d" sprintf = ] unit-test
-[ t ] [ "  -10" -10 "%5d" sprintf = ] unit-test
-[ t ] [ "-0010" -10 "%05d" sprintf = ] unit-test
-[ t ] [ "+0010" 10 "%+05d" sprintf = ] unit-test
-[ t ] [ "123.456000" 123.456 "%f" sprintf = ] unit-test
-[ t ] [ "2.44" 2.436 "%.2f" sprintf = ] unit-test
-[ t ] [ "123.10" 123.1 "%01.2f" sprintf = ] unit-test
-[ t ] [ "1.2346" 1.23456789 "%.4f" sprintf = ] unit-test
-[ t ] [ "  1.23" 1.23456789 "%6.2f" sprintf = ] unit-test
-[ t ] [ "1.234000e+08" 123400000 "%e" sprintf = ] unit-test
-[ t ] [ "-1.234000e+08" -123400000 "%e" sprintf = ] unit-test
-[ t ] [ "1.234567e+08" 123456700 "%e" sprintf = ] unit-test
-[ t ] [ "3.625e+08" 362525200 "%.3e" sprintf = ] unit-test
-[ t ] [ "2.500000e-03" 0.0025 "%e" sprintf = ] unit-test
-[ t ] [ "2.500000E-03" 0.0025 "%E" sprintf = ] unit-test
-[ t ] [ "   1.0E+01" 10 "%10.1E" sprintf = ] unit-test
-[ t ] [ "  -1.0E+01" -10 "%10.1E" sprintf = ] unit-test
-[ t ] [ "  -1.0E+01" -10 "%+10.1E" sprintf = ] unit-test
-[ t ] [ "  +1.0E+01" 10 "%+10.1E" sprintf = ] unit-test
-[ t ] [ "-001.0E+01" -10 "%+010.1E" sprintf = ] unit-test
-[ t ] [ "+001.0E+01" 10 "%+010.1E" sprintf = ] unit-test
-[ t ] [ "ff" HEX: ff "%x" sprintf = ] unit-test
-[ t ] [ "FF" HEX: ff "%X" sprintf = ] unit-test
-[ t ] [ "0f" HEX: f "%02x" sprintf = ] unit-test
-[ t ] [ "0F" HEX: f "%02X" sprintf = ] unit-test
-[ t ] [ "2008-09-10" 
-        2008 9 10 "%04d-%02d-%02d" sprintf = ] unit-test
-[ t ] [ "Hello, World!" 
-        "Hello, World!" "%s" sprintf = ] unit-test
-[ t ] [ "printf test" 
-        "printf test" sprintf = ] unit-test
-[ t ] [ "char a = 'a'"
-        CHAR: a "char %c = 'a'" sprintf = ] unit-test
-[ t ] [ "00" HEX: 0 "%02x" sprintf = ] unit-test
-[ t ] [ "ff" HEX: ff "%02x" sprintf = ] unit-test
-[ t ] [ "0 message(s)"
-        0 "message" "%d %s(s)" sprintf = ] unit-test
-[ t ] [ "0 message(s) with %"
-        0 "message" "%d %s(s) with %%" sprintf = ] unit-test
-[ t ] [ "justif: \"left      \""
-        "left" "justif: \"%-10s\"" sprintf = ] unit-test
-[ t ] [ "justif: \"     right\""
-        "right" "justif: \"%10s\"" sprintf = ] unit-test
-[ t ] [ " 3: 0003 zero padded" 
-        3 " 3: %04d zero padded" sprintf = ] unit-test
-[ t ] [ " 3: 3    left justif" 
-        3 " 3: %-4d left justif" sprintf = ] unit-test
-[ t ] [ " 3:    3 right justif" 
-        3 " 3: %4d right justif" sprintf = ] unit-test
-[ t ] [ " -3: -003 zero padded"
-        -3 " -3: %04d zero padded" sprintf = ] unit-test
-[ t ] [ " -3: -3   left justif"
-        -3 " -3: %-4d left justif" sprintf = ] unit-test
-[ t ] [ " -3:   -3 right justif"
-        -3 " -3: %4d right justif" sprintf = ] unit-test
-[ t ] [ "There are 10 monkeys in the kitchen" 
-        10 "kitchen" "There are %d monkeys in the %s" sprintf = ] unit-test
-[ f ] [ "%d" 10 "%d" sprintf = ] unit-test
-[ t ] [ "[monkey]" "monkey" "[%s]" sprintf = ] unit-test
-[ t ] [ "[    monkey]" "monkey" "[%10s]" sprintf = ] unit-test
-[ t ] [ "[monkey    ]" "monkey" "[%-10s]" sprintf = ] unit-test
-[ t ] [ "[0000monkey]" "monkey" "[%010s]" sprintf = ] unit-test
-[ t ] [ "[####monkey]" "monkey" "[%'#10s]" sprintf = ] unit-test
-[ t ] [ "[many monke]" "many monkeys" "[%10.10s]" sprintf = ] unit-test
+[ "" ] [ "" sprintf ] unit-test
+[ "asdf" ] [ "asdf" sprintf ] unit-test
+[ "10" ] [ 10 "%d" sprintf ] unit-test
+[ "+10" ] [ 10 "%+d" sprintf ] unit-test
+[ "-10" ] [ -10 "%d" sprintf ] unit-test
+[ "  -10" ] [ -10 "%5d" sprintf ] unit-test
+[ "-0010" ] [ -10 "%05d" sprintf ] unit-test
+[ "+0010" ] [ 10 "%+05d" sprintf ] unit-test
+[ "123.456000" ] [ 123.456 "%f" sprintf ] unit-test
+[ "2.44" ] [ 2.436 "%.2f" sprintf ] unit-test
+[ "8.950" ] [ 8.950179003580072 "%.3f" sprintf ] unit-test
+[ "123.10" ] [ 123.1 "%01.2f" sprintf ] unit-test
+[ "1.2346" ] [ 1.23456789 "%.4f" sprintf ] unit-test
+[ "  1.23" ] [ 1.23456789 "%6.2f" sprintf ] unit-test
 
-[ t ] [ "{ 1, 2, 3 }" { 1 2 3 } "%[%s, %]" sprintf = ] unit-test
-[ t ] [ "{ 1:2, 3:4 }" H{ { 1 2 } { 3 4 } } "%[%s: %s %]" sprintf = ] unit-test
+os windows? [
+    [ "1.234000e+008" ] [ 123400000 "%e" sprintf ] unit-test
+    [ "-1.234000e+008" ] [ -123400000 "%e" sprintf ] unit-test
+    [ "1.234567e+008" ] [ 123456700 "%e" sprintf ] unit-test
+    [ "3.625e+008" ] [ 362525200 "%.3e" sprintf ] unit-test
+    [ "2.500000e-003" ] [ 0.0025 "%e" sprintf ] unit-test
+    [ "2.500000E-003" ] [ 0.0025 "%E" sprintf ] unit-test
+    [ "   1.0E+001" ] [ 10 "%11.1E" sprintf ] unit-test
+    [ "  -1.0E+001" ] [ -10 "%11.1E" sprintf ] unit-test
+    [ "  -1.0E+001" ] [ -10 "%+11.1E" sprintf ] unit-test
+    [ "  +1.0E+001" ] [ 10 "%+11.1E" sprintf ] unit-test
+    [ "-001.0E+001" ] [ -10 "%+011.1E" sprintf ] unit-test
+    [ "+001.0E+001" ] [ 10 "%+011.1E" sprintf ] unit-test
+] [
+    [ "1.234000e+08" ] [ 123400000 "%e" sprintf ] unit-test
+    [ "-1.234000e+08" ] [ -123400000 "%e" sprintf ] unit-test
+    [ "1.234567e+08" ] [ 123456700 "%e" sprintf ] unit-test
+    [ "3.625e+08" ] [ 362525200 "%.3e" sprintf ] unit-test
+    [ "2.500000e-03" ] [ 0.0025 "%e" sprintf ] unit-test
+    [ "2.500000E-03" ] [ 0.0025 "%E" sprintf ] unit-test
+    [ "   1.0E+01" ] [ 10 "%10.1E" sprintf ] unit-test
+    [ "  -1.0E+01" ] [ -10 "%10.1E" sprintf ] unit-test
+    [ "  -1.0E+01" ] [ -10 "%+10.1E" sprintf ] unit-test
+    [ "  +1.0E+01" ] [ 10 "%+10.1E" sprintf ] unit-test
+    [ "-001.0E+01" ] [ -10 "%+010.1E" sprintf ] unit-test
+    [ "+001.0E+01" ] [ 10 "%+010.1E" sprintf ] unit-test
+] if
+
+[ "ff" ] [ HEX: ff "%x" sprintf ] unit-test
+[ "FF" ] [ HEX: ff "%X" sprintf ] unit-test
+[ "0f" ] [ HEX: f "%02x" sprintf ] unit-test
+[ "0F" ] [ HEX: f "%02X" sprintf ] unit-test
+[ "2008-09-10" ] [ 2008 9 10 "%04d-%02d-%02d" sprintf ] unit-test
+[ "Hello, World!" ] [ "Hello, World!" "%s" sprintf ] unit-test
+[ "printf test" ] [ "printf test" sprintf ] unit-test
+[ "char a = 'a'" ] [ CHAR: a "char %c = 'a'" sprintf ] unit-test
+[ "00" ] [ HEX: 0 "%02x" sprintf ] unit-test
+[ "ff" ] [ HEX: ff "%02x" sprintf ] unit-test
+[ "0 message(s)" ] [ 0 "message" "%d %s(s)" sprintf ] unit-test
+[ "0 message(s) with %" ] [ 0 "message" "%d %s(s) with %%" sprintf ] unit-test
+[ "justif: \"left      \"" ] [ "left" "justif: \"%-10s\"" sprintf ] unit-test
+[ "justif: \"     right\"" ] [ "right" "justif: \"%10s\"" sprintf ] unit-test
+[ " 3: 0003 zero padded" ] [ 3 " 3: %04d zero padded" sprintf ] unit-test
+[ " 3: 3    left justif" ] [ 3 " 3: %-4d left justif" sprintf ] unit-test
+[ " 3:    3 right justif" ] [ 3 " 3: %4d right justif" sprintf ] unit-test
+[ " -3: -003 zero padded" ] [ -3 " -3: %04d zero padded" sprintf ] unit-test
+[ " -3: -3   left justif" ] [ -3 " -3: %-4d left justif" sprintf ] unit-test
+[ " -3:   -3 right justif" ] [ -3 " -3: %4d right justif" sprintf ] unit-test
+[ "There are 10 monkeys in the kitchen" ] [ 10 "kitchen" "There are %d monkeys in the %s" sprintf ] unit-test
+[ "10" ] [ 10 "%d" sprintf ] unit-test
+[ "[monkey]" ] [ "monkey" "[%s]" sprintf ] unit-test
+[ "[    monkey]" ] [ "monkey" "[%10s]" sprintf ] unit-test
+[ "[monkey    ]" ] [ "monkey" "[%-10s]" sprintf ] unit-test
+[ "[0000monkey]" ] [ "monkey" "[%010s]" sprintf ] unit-test
+[ "[####monkey]" ] [ "monkey" "[%'#10s]" sprintf ] unit-test
+[ "[many monke]" ] [ "many monkeys" "[%10.10s]" sprintf ] unit-test
+
+[ "{ 1, 2, 3 }" ] [ { 1 2 3 } "%[%s, %]" sprintf ] unit-test
+[ "{ 1:2, 3:4 }" ] [ H{ { 1 2 } { 3 4 } } "%[%s: %s %]" sprintf ] unit-test
 
 
 [ "%H:%M:%S" strftime ] must-infer
@@ -95,5 +98,3 @@ IN: formatting.tests
 [ t ] [ "October" testtime "%B" strftime = ] unit-test
 [ t ] [ "Thu Oct 09 12:03:15 2008" testtime "%c" strftime = ] unit-test
 [ t ] [ "PM" testtime "%p" strftime = ] unit-test
-
-
index 40279749d64368592d9c416fb47257dae0412aa9..5abcb12916cab80832235b16eeffcc875ba0a9b2 100644 (file)
@@ -3,7 +3,9 @@
 USING: accessors arrays assocs calendar combinators fry kernel
 generalizations io io.streams.string macros math math.functions
 math.parser peg.ebnf quotations sequences splitting strings
-unicode.categories unicode.case vectors combinators.smart ;
+unicode.categories unicode.case vectors combinators.smart
+present ;
+FROM: math.parser.private => format-float ;
 IN: formatting
 
 <PRIVATE
@@ -12,45 +14,29 @@ IN: formatting
     [ ] [ compose ] reduce ;
 
 : fix-sign ( string -- string )
-    dup CHAR: 0 swap index 0 = 
+    dup CHAR: 0 swap index 0 =
       [ dup 0 swap [ [ CHAR: 0 = not ] keep digit? and ] find-from
          [ dup 1 - rot dup [ nth ] dip swap
             {
                { CHAR: - [ [ 1 - ] dip remove-nth "-" prepend ] }
                { CHAR: + [ [ 1 - ] dip remove-nth "+" prepend ] }
-               [ drop swap drop ] 
-            } case 
+               [ drop swap drop ]
+            } case
          ] [ drop ] if
       ] when ;
 
-: >digits ( string -- digits ) 
+: >digits ( string -- digits )
     [ 0 ] [ string>number ] if-empty ;
 
-: pad-digits ( string digits -- string' )
-    [ "." split1 ] dip [ CHAR: 0 pad-tail ] [ head-slice ] bi "." glue ;
+: format-simple ( x digits string -- string )
+    [ [ >float ] [ number>string ] bi* "%." ] dip
+    surround format-float ;
 
-: max-digits ( n digits -- n' )
-    10^ [ * round ] keep / ; inline
+: format-scientific ( x digits -- string ) "e" format-simple ;
 
-: >exp ( x -- exp base )
-    [ 
-        abs 0 swap
-        [ dup [ 10.0 >= ] [ 1.0 < ] bi or ]
-        [ dup 10.0 >=
-          [ 10.0 / [ 1 + ] dip ]
-          [ 10.0 * [ 1 - ] dip ] if
-        ] while 
-     ] keep 0 < [ neg ] when ;
+: format-decimal ( x digits -- string ) "f" format-simple ;
 
-: exp>string ( exp base digits -- string )
-    [ max-digits ] keep -rot
-    [
-        [ 0 < "-" "+" ? ]
-        [ abs number>string 2 CHAR: 0 pad-head ] bi 
-        "e" -rot 3append
-    ]
-    [ number>string ] bi*
-    rot pad-digits prepend ;
+ERROR: unknown-printf-directive ;
 
 EBNF: parse-printf
 
@@ -58,30 +44,30 @@ zero      = "0"                  => [[ CHAR: 0 ]]
 char      = "'" (.)              => [[ second ]]
 
 pad-char  = (zero|char)?         => [[ CHAR: \s or ]]
-pad-align = ("-")?               => [[ \ pad-tail \ pad-head ? ]] 
+pad-align = ("-")?               => [[ \ pad-tail \ pad-head ? ]]
 pad-width = ([0-9])*             => [[ >digits ]]
 pad       = pad-align pad-char pad-width => [[ reverse >quotation dup first 0 = [ drop [ ] ] when ]]
 
 sign      = ("+")?               => [[ [ dup CHAR: - swap index [ "+" prepend ] unless ] [ ] ? ]]
 
 width_    = "." ([0-9])*         => [[ second >digits '[ _ short head ] ]]
-width     = (width_)?            => [[ [ ] or ]] 
+width     = (width_)?            => [[ [ ] or ]]
 
 digits_   = "." ([0-9])*         => [[ second >digits ]]
 digits    = (digits_)?           => [[ 6 or ]]
 
-fmt-%     = "%"                  => [[ [ "%" ] ]] 
+fmt-%     = "%"                  => [[ [ "%" ] ]]
 fmt-c     = "c"                  => [[ [ 1string ] ]]
 fmt-C     = "C"                  => [[ [ 1string >upper ] ]]
-fmt-s     = "s"                  => [[ [ dup number? [ number>string ] when ] ]]
-fmt-S     = "S"                  => [[ [ dup number? [ number>string ] when >upper ] ]]
-fmt-d     = "d"                  => [[ [ >fixnum number>string ] ]]
-fmt-e     = digits "e"           => [[ first '[ >exp _ exp>string ] ]]
-fmt-E     = digits "E"           => [[ first '[ >exp _ exp>string >upper ] ]]
-fmt-f     = digits "f"           => [[ first dup '[ >float _ max-digits number>string _ pad-digits ] ]] 
+fmt-s     = "s"                  => [[ [ present ] ]]
+fmt-S     = "S"                  => [[ [ present >upper ] ]]
+fmt-d     = "d"                  => [[ [ >integer number>string ] ]]
+fmt-e     = digits "e"           => [[ first '[ _ format-scientific ] ]]
+fmt-E     = digits "E"           => [[ first '[ _ format-scientific >upper ] ]]
+fmt-f     = digits "f"           => [[ first '[ _ format-decimal ] ]]
 fmt-x     = "x"                  => [[ [ >hex ] ]]
 fmt-X     = "X"                  => [[ [ >hex >upper ] ]]
-unknown   = (.)*                 => [[ "Unknown directive" throw ]]
+unknown   = (.)*                 => [[ unknown-printf-directive ]]
 
 strings_  = fmt-c|fmt-C|fmt-s|fmt-S
 strings   = pad width strings_   => [[ reverse compose-all ]]
@@ -89,9 +75,9 @@ strings   = pad width strings_   => [[ reverse compose-all ]]
 numbers_  = fmt-d|fmt-e|fmt-E|fmt-f|fmt-x|fmt-X
 numbers   = sign pad numbers_    => [[ unclip-last prefix compose-all [ fix-sign ] append ]]
 
-types     = strings|numbers 
+types     = strings|numbers
 
-lists     = "[%" types ", %]"    => [[ second '[ _ map ", " join "{ " prepend " }" append ] ]] 
+lists     = "[%" types ", %]"    => [[ second '[ _ map ", " join "{ " prepend " }" append ] ]]
 
 assocs    = "[%" types ": %" types " %]" => [[ [ second ] [ fourth ] bi '[ unzip [ _ map ] dip _ map zip [ ":" join ] map ", " join "{ " prepend " }" append ] ]]
 
index f1bc8adef996aff83726defec4233bec8950e1d0..2a3e82265bfb1f4ed3bd3bcf99842fe5cdec8e19 100644 (file)
@@ -83,7 +83,7 @@ C: <ftp-disconnect> ftp-disconnect
 
 : handle-USER ( ftp-command -- )
     [
-        tokenized>> second client get (>>user)
+        tokenized>> second client get user<<
         "Please specify the password." 331 server-response
     ] [
         2drop "bad USER" ftp-error
@@ -91,7 +91,7 @@ C: <ftp-disconnect> ftp-disconnect
 
 : handle-PASS ( ftp-command -- )
     [
-        tokenized>> second client get (>>password)
+        tokenized>> second client get password<<
         "Login successful" 230 server-response
     ] [
         2drop "PASS error" ftp-error
@@ -241,7 +241,7 @@ M: ftp-disconnect handle-passive-command ( stream obj -- )
     ] if ;
 
 : expect-connection ( -- port )
-    <promise> client get (>>extra-connection)
+    <promise> client get extra-connection<<
     random-local-server
     [ [ passive-loop ] curry in-thread ]
     [ addr>> port>> ] bi ;
index c756d1b83d58aa774a74f3851a9f21fba07655e6..f1e4040167ff0ccd8ad9965566b209f41d3d3bed 100644 (file)
@@ -159,7 +159,7 @@ T-class DEFINES-CLASS ${T}
 WHERE
 
 STRUCT: T-class
-    { NAME c:int }
+    { NAME c:longlong }
     { x { TYPE 4 } }
     { y { c:short N } }
     { z TYPE initial: 5 }
@@ -178,32 +178,32 @@ STRUCT: T-class
             { offset 0 }
             { class integer }
             { initial 0 } 
-            { type c:int }
+            { type c:longlong }
         }
         T{ struct-slot-spec
             { name "x" }
-            { offset 4 }
+            { offset 8 }
             { class object }
             { initial f } 
             { type { c:char 4 } }
         }
         T{ struct-slot-spec
             { name "y" }
-            { offset 8 }
+            { offset 12 }
             { class object }
             { initial f } 
             { type { c:short 2 } }
         }
         T{ struct-slot-spec
             { name "z" }
-            { offset 12 }
+            { offset 16 }
             { class fixnum }
             { initial 5 } 
             { type c:char }
         }
         T{ struct-slot-spec
             { name "float" }
-            { offset 16 }
+            { offset 20 }
             { class object }
             { initial f } 
             { type { c:float 2 } }
index a49d6d54b3b23cde297f94bb3a28fb587b17a5b5..862bdead72a73d912a681eb0b3cc02548c21af39 100644 (file)
@@ -31,7 +31,7 @@ HELP: new-action
 { $description "Constructs a subclass of " { $link action } "." } ;
 
 HELP: page-action
-{ $class-description "The class of Chloe page actions. These are actions whose " { $slot "display" } " slot is pre-set to serve the Chloe template stored in the " { $slot "page" } " slot." } ;
+{ $class-description "The class of Chloe page actions. These are actions whose " { $slot "display" } " slot is pre-set to serve the Chloe template stored in the " { $slot "template" } " slot. The " { $slot "template" } " slot contains a pair with shape " { $snippet "{ responder name }" } "." } ;
 
 HELP: validate-integer-id
 { $description "A utility word which validates an integer parameter named " { $snippet "id" } "." }
index 831ec7f8fc036e4ca11f00d191639f2e312869bc..2acb09919d8aa2a0fd35a3d8a154a7e315dab5bb 100644 (file)
@@ -14,6 +14,8 @@ furnace.redirection
 furnace.boilerplate\r
 furnace.auth.providers\r
 furnace.auth.providers.db ;\r
+FROM: assocs => change-at ;\r
+FROM: namespaces => set ;\r
 IN: furnace.auth\r
 \r
 SYMBOL: logged-in-user\r
index 51de8c0be6852053c8af3ad55a7508ac90899508..676e41d3bcf5886579f27b148e067e7ce56761ee 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel accessors math.intervals
-system calendar alarms fry
+system calendar fry
 random db db.tuples db.types
 http.server.filters ;
 IN: furnace.cache
index 8a08063595692136dace4aaf9c4f4423fc5b6bf4..a187300960bee07d9bb6be8502fbeb85a041d848 100644 (file)
@@ -143,6 +143,6 @@ CHLOE: button
     {
         [ [ attrs>> chloe-attrs-only ] dip add-tag-attrs ]
         [ [ attrs>> non-chloe-attrs-only ] dip "button" deep-tag-named add-tag-attrs ]
-        [ [ children>> ] dip "button" deep-tag-named (>>children) ]
+        [ [ children>> ] dip "button" deep-tag-named children<< ]
         [ nip ]
     } 2cleave compile-chloe-tag ;
index 264be678aef5f1896432826a5ffa4879f979dfe8..3650e2bcf999a5df9435ae4a4aea4df2b9be4768 100644 (file)
@@ -9,23 +9,19 @@ IN: furnace.recaptcha.example
 
 TUPLE: recaptcha-app < dispatcher recaptcha ;
 
-: recaptcha-db ( -- obj ) "recaptcha-example" <sqlite-db> ;
+: recaptcha-db ( -- obj ) "resource:recaptcha-example" <sqlite-db> ;
 
 : <recaptcha-challenge> ( -- obj )
     <page-action>
-        [
-            begin-conversation
-            validate-recaptcha
-            recaptcha-valid? cget
-            "?good" "?bad" ? >url <continue-conversation>
-        ] >>submit
+        [ validate-recaptcha ] >>validate
+        [ "?good" >url <redirect> ] >>submit
         { recaptcha-app "example" } >>template ;
 
 : <recaptcha-app> ( -- obj )
     \ recaptcha-app new-dispatcher
         <recaptcha-challenge> "" add-responder
         <recaptcha>
-        "concatenative.org" >>domain
-        "6LeJWQgAAAAAAFlYV7SuBClE9uSpGtV_ZS-qVON7" >>public-key
-        "6LeJWQgAAAAAALh-XJgSSQ6xKygRgJ8-029Ip2Xv" >>private-key
+            "concatenative.org" >>domain
+            "6LeJWQgAAAAAAFlYV7SuBClE9uSpGtV_ZS-qVON7" >>public-key
+            "6LeJWQgAAAAAALh-XJgSSQ6xKygRgJ8-029Ip2Xv" >>private-key
         recaptcha-db <alloy> ;
index e59f441f7facd2d539f96bd88af392d3a21deb6b..2553b332efbdeab1fd371d8fbaa67c9392cef373 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version='1.0' ?>
 <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
-<html><body><form submit="" method="post"><t:recaptcha/></form></body></html>
+<html><body><t:form t:action=""><t:recaptcha/></t:form></body></html>
 </t:chloe>
index 1349b5243d1b63fb00d703d0d9600bba0f1b9675..3d239799627fa90fd63221dc4090dfab9c66fdfb 100644 (file)
@@ -7,51 +7,44 @@ IN: furnace.recaptcha
 HELP: <recaptcha>
 { $values
     { "responder" "a responder" }
-    { "obj" object }
+    { "recaptcha" recaptcha }
 }
-{ $description "A " { $link filter-responder } " wrapping another responder. Set the domain, public, and private keys using the key you get by registering with Recaptcha." } ;
+{ $description "A " { $link filter-responder } " wrapping another responder. Set the domain, public, and private keys using the key you get by registering with recaptcha." } ;
 
 HELP: recaptcha-error
-{ $var-description "Set to the error string returned by the Recaptcha server." } ;
-
-HELP: recaptcha-valid?
-{ $var-description "Set to " { $link t } " if the user solved the last Recaptcha correctly." } ;
+{ $var-description "Set to the error string returned by the recaptcha server." } ;
 
 HELP: validate-recaptcha
-{ $description "Validates a Recaptcha using the Recaptcha web service API." } ;
+{ $description "Validates a recaptcha using the recaptcha web service API." } ;
 
 ARTICLE: "recaptcha-example" "Recaptcha example"
-"There are several steps to using the Recaptcha library."
+"There are several steps to using the recaptcha library."
 { $list
     { "Wrap the responder in a " { $link <recaptcha> } }
-    { "Wrap the responder in a " { $link <conversations> } " if it is not already" }
-    { "Ensure that there is a database connected, with the " { $link <alloy> } " word" }
-    { "Start a conversation to move values between requests" }
-    { "Add a handler calling " { $link validate-recaptcha } " in the " { $slot "submit" } " of the " { $link page-action } }
-    { "Pass the conversation from your submit action using " { $link <continue-conversation> } }
-    { "Put the chloe tag " { $snippet "<recaptcha/>" } " inside a form tag in the template for your " { $link page-action } }
+    { "Wrap the responder in an " { $link <alloy> } " if it is not already, to enable conversations and database access" }
+    { "Call " { $link validate-recaptcha } " from the " { $slot "validate" } " slot of the " { $link action } }
+    { "Put the chloe tag " { $snippet "<recaptcha/>" } " inside a form tag in the template served by your " { $link action } }
 }
 $nl
-"Run this example vocabulary:"
+"There is an example web app using recaptcha support:"
 { $code
-    "USE: furnace.recaptcha.example"
+    "USING: furnace.recaptcha.example http.server ;"
     "<recaptcha-app> main-responder set-global"
+    "8080 httpd"
 } ;
 
-ARTICLE: "furnace.recaptcha" "Recaptcha"
-"The " { $vocab-link "furnace.recaptcha" } " vocabulary implements support for the Recaptcha. Recaptcha is a web service that provides the user with a captcha, a test that is easy to solve by visual inspection, but hard to solve by writing a computer program. Use a captcha to protect forms from abusive users." $nl
+ARTICLE: "furnace.recaptcha" "Recaptcha support for Furnace"
+"The " { $vocab-link "furnace.recaptcha" } " vocabulary implements support for the recaptcha. Recaptcha is a web service that provides the user with a captcha, a test that is easy to solve by visual inspection, but hard to solve by writing a computer program. Use a captcha to protect forms from abusive users." $nl
 
-"The recaptcha responder is a " { $link filter-responder } " that wraps another responder. Set the " { $slot "domain" } ", " { $slot "public-key" } ", and " { $slot "private-key" } " slots of this responder to your Recaptcha account information." $nl
+"The recaptcha responder is a " { $link filter-responder } " that wraps another responder. Set the " { $slot "domain" } ", " { $slot "public-key" } ", and " { $slot "private-key" } " slots of this responder to your recaptcha account information." $nl
 
-"Wrapping a responder with Recaptcha:"
+"Wrapping a responder with recaptcha support:"
 { $subsections <recaptcha> }
 "Validating recaptcha:"
 { $subsections validate-recaptcha }
-"Symbols set after validation:"
-{ $subsections
-    recaptcha-valid?
-    recaptcha-error
-    "recaptcha-example"
-} ;
+"Symbol set after validation:"
+{ $subsections recaptcha-error }
+"An example:"
+{ $subsections "recaptcha-example" } ;
 
 ABOUT: "furnace.recaptcha"
index 99b223b8e3741d68ad046eee36e02be52c3b0536..38ba8e2b1fdaece1960b8b2b6aef9ed7f57fb61e 100644 (file)
@@ -9,37 +9,37 @@ IN: furnace.recaptcha
 
 TUPLE: recaptcha < filter-responder domain public-key private-key ;
 
-SYMBOLS: recaptcha-valid? recaptcha-error ;
+SYMBOL: recaptcha-error
 
-: <recaptcha> ( responder -- obj )
+: <recaptcha> ( responder -- recaptcha )
     recaptcha new
         swap >>responder ;
 
 M: recaptcha call-responder*
-    dup recaptcha set
+    dup recaptcha set
     responder>> call-responder ;
 
 <PRIVATE
 
 : (render-recaptcha) ( private-key -- xml )
     dup
-[XML <script type="text/javascript"
-   src=<->>
-</script>
-
-<noscript>
-   <iframe src=<->
-       height="300" width="500" frameborder="0"></iframe><br/>
-   <textarea name="recaptcha_challenge_field" rows="3" cols="40">
-   </textarea>
-   <input type="hidden" name="recaptcha_response_field" 
-       value="manual_challenge"/>
-</noscript>
-XML] ;
+    [XML
+        <script type="text/javascript"
+           src=<->>
+        </script>
+
+        <noscript>
+           <iframe src=<->
+               height="300" width="500" frameborder="0"></iframe><br/>
+           <textarea name="recaptcha_challenge_field" rows="3" cols="40">
+           </textarea>
+           <input type="hidden" name="recaptcha_response_field"
+               value="manual_challenge"/>
+        </noscript>
+    XML] ;
 
 : recaptcha-url ( secure? -- ? )
-    [ "https://api.recaptcha.net/challenge" ]
-    [ "http://api.recaptcha.net/challenge" ] if
+    "https://api.recaptcha.net/challenge" "http://api.recaptcha.net/challenge" ?
     recaptcha-error cget [ "?error=" glue ] when* >url ;
 
 : render-recaptcha ( -- xml )
@@ -60,17 +60,23 @@ XML] ;
     } URL" http://api-verify.recaptcha.net/verify"
     <post-request> http-request nip parse-recaptcha-response ;
 
-CHLOE: recaptcha
-    drop [ render-recaptcha ] [xml-code] ;
+: validate-recaptcha-params ( -- )
+    {
+        { "recaptcha_challenge_field" [ v-required ] }
+        { "recaptcha_response_field" [ v-required ] }
+    } validate-params ;
 
 PRIVATE>
 
+CHLOE: recaptcha drop [ render-recaptcha ] [xml-code] ;
+
 : validate-recaptcha ( -- )
-    {
-        { "recaptcha_challenge_field" [ v-required ] }
-        { "recaptcha_response_field" [ v-required ] }
-    } validate-params
+    begin-conversation
+    validate-recaptcha-params
+
     "recaptcha_challenge_field" value
     "recaptcha_response_field" value
-    \ recaptcha get (validate-recaptcha)
-    [ recaptcha-valid? cset ] [ recaptcha-error cset ] bi* ;
+    recaptcha get
+    (validate-recaptcha)
+    recaptcha-error cset
+    [ validation-failed ] unless ;
index c0772185a03123ad998401fa1570972d5899d740..2b4974246080ae8091ed2944e36d2d6176796730 100644 (file)
@@ -1 +1,2 @@
 web
+web services
index daad0dcf915df55a1dcaec13afeb87f41a4810b1..4d005e8adc52be40d3be3c8240057fd75879ccbf 100644 (file)
@@ -2,6 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel accessors assocs destructors
 db.tuples db.types furnace.cache ;
+FROM: assocs => change-at ;
 IN: furnace.scopes
 
 TUPLE: scope < server-state namespace changed? ;
index 876aaf8c98ab45f46aaacd37fdda2206ac81f5d6..b71abf6d86e0ab55c976b7a6aa0dd8c805a998fd 100644 (file)
@@ -1,8 +1,8 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel sequences fry combinators syndication
 http.server.responses http.server.redirection furnace.actions
-furnace.utilities ;
+furnace.utilities io.encodings.utf8 ;
 IN: furnace.syndication
 
 GENERIC: feed-entry-title ( object -- string )
@@ -35,7 +35,9 @@ M: object >entry
     ] map ;
 
 : <feed-content> ( body -- response )
-    feed>xml "application/atom+xml" <content> ;
+    feed>xml "application/atom+xml" <content>
+    "UTF-8" >>content-charset
+    utf8 >>content-encoding ;
 
 TUPLE: feed-action < action title url entries ;
 
index e2c1fda75934280d392c8b286787c364f9e112ae..f5b3520b12d9bdecffc14c6f22859c0999c25925 100755 (executable)
@@ -30,15 +30,15 @@ SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+
     +dinput+ [ com-release f ] change-global ;
 
 : device-for-guid ( guid -- device )
-    +dinput+ get swap f <void*>
+    +dinput+ get-global swap f <void*>
     [ f IDirectInput8W::CreateDevice ole32-error ] keep *void* ;
 
 : set-coop-level ( device -- )
-    +device-change-window+ get DISCL_BACKGROUND DISCL_NONEXCLUSIVE bitor
-    IDirectInputDevice8W::SetCooperativeLevel ole32-error ;
+    +device-change-window+ get-global DISCL_BACKGROUND DISCL_NONEXCLUSIVE bitor
+    IDirectInputDevice8W::SetCooperativeLevel ole32-error ; inline
 
 : set-data-format ( device format-symbol -- )
-    get IDirectInputDevice8W::SetDataFormat ole32-error ;
+    get-global IDirectInputDevice8W::SetDataFormat ole32-error ; inline
 
 : <buffer-size-diprop> ( size -- DIPROPDWORD )
     DIPROPDWORD <struct> [
@@ -92,25 +92,25 @@ SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+
     +dinput+ get swap device-guid
     IDirectInput8W::GetDeviceStatus S_OK = ;
 
+: (find-device-axes-callback) ( lpddoi pvRef -- BOOL )
+    +controller-devices+ get-global at
+    swap guidType>> {
+        { [ dup GUID_XAxis = ] [ drop 0.0 >>x ] }
+        { [ dup GUID_YAxis = ] [ drop 0.0 >>y ] }
+        { [ dup GUID_ZAxis = ] [ drop 0.0 >>z ] }
+        { [ dup GUID_RxAxis = ] [ drop 0.0 >>rx ] }
+        { [ dup GUID_RyAxis = ] [ drop 0.0 >>ry ] }
+        { [ dup GUID_RzAxis = ] [ drop 0.0 >>rz ] }
+        { [ dup GUID_Slider = ] [ drop 0.0 >>slider ] }
+        [ drop ]
+    } cond drop
+    DIENUM_CONTINUE ;
+
 : find-device-axes-callback ( -- alien )
-    [ ! ( lpddoi pvRef -- BOOL )
-        [ DIDEVICEOBJECTINSTANCEW memory>struct ] dip
-        +controller-devices+ get at
-        swap guidType>> {
-            { [ dup GUID_XAxis = ] [ drop 0.0 >>x ] }
-            { [ dup GUID_YAxis = ] [ drop 0.0 >>y ] }
-            { [ dup GUID_ZAxis = ] [ drop 0.0 >>z ] }
-            { [ dup GUID_RxAxis = ] [ drop 0.0 >>rx ] }
-            { [ dup GUID_RyAxis = ] [ drop 0.0 >>ry ] }
-            { [ dup GUID_RzAxis = ] [ drop 0.0 >>rz ] }
-            { [ dup GUID_Slider = ] [ drop 0.0 >>slider ] }
-            [ drop ]
-        } cond drop
-        DIENUM_CONTINUE
-    ] LPDIENUMDEVICEOBJECTSCALLBACKW ;
+    [ (find-device-axes-callback) ] LPDIENUMDEVICEOBJECTSCALLBACKW ;
 
 : find-device-axes ( device controller-state -- controller-state )
-    swap [ +controller-devices+ get set-at ] 2keep
+    swap [ +controller-devices+ get-global set-at ] 2keep
     find-device-axes-callback over DIDFT_AXIS
     IDirectInputDevice8W::EnumObjects ole32-error ;
 
@@ -122,32 +122,33 @@ SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+
     find-device-axes ;
 
 : device-known? ( guid -- ? )
-    +controller-guids+ get key? ; inline
+    +controller-guids+ get-global key? ; inline
 
 : (add-controller) ( guid -- )
     device-for-guid {
         [ configure-controller ]
         [ controller-state-template ]
-        [ dup device-guid clone +controller-guids+ get set-at ]
-        [ +controller-devices+ get set-at ]
+        [ dup device-guid clone +controller-guids+ get-global set-at ]
+        [ +controller-devices+ get-global set-at ]
     } cleave ;
 
 : add-controller ( guid -- )
     dup device-known? [ drop ] [ (add-controller) ] if ;
 
 : remove-controller ( device -- )
-    [ +controller-devices+ get delete-at ]
-    [ device-guid +controller-guids+ get delete-at ]
+    [ +controller-devices+ get-global delete-at ]
+    [ device-guid +controller-guids+ get-global delete-at ]
     [ com-release ] tri ;
 
+: (find-controller-callback) ( lpddi pvRef -- BOOL )
+    drop guidInstance>> add-controller
+    DIENUM_CONTINUE ;
+
 : find-controller-callback ( -- alien )
-    [ ! ( lpddi pvRef -- BOOL )
-        drop DIDEVICEINSTANCEW memory>struct guidInstance>> add-controller
-        DIENUM_CONTINUE
-    ] LPDIENUMDEVICESCALLBACKW ; inline
+    [ (find-controller-callback) ] LPDIENUMDEVICESCALLBACKW ;
 
 : find-controllers ( -- )
-    +dinput+ get DI8DEVCLASS_GAMECTRL find-controller-callback
+    +dinput+ get-global DI8DEVCLASS_GAMECTRL find-controller-callback
     f DIEDFL_ATTACHEDONLY IDirectInput8W::EnumDevices ole32-error ;
 
 : set-up-controllers ( -- )
@@ -156,7 +157,7 @@ SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+
     find-controllers ;
 
 : find-and-remove-detached-devices ( -- )
-    +controller-devices+ get keys
+    +controller-devices+ get-global keys
     [ device-attached? not ] filter
     [ remove-controller ] each ;
 
@@ -252,7 +253,7 @@ M: dinput-game-input-backend (reset-game-input)
     ] bind ;
 
 M: dinput-game-input-backend get-controllers
-    +controller-devices+ get
+    +controller-devices+ get-global
     [ drop controller boa ] { } assoc>map ;
 
 M: dinput-game-input-backend product-string
@@ -314,7 +315,7 @@ CONSTANT: pov-values
     } case ;
 
 : fill-mouse-state ( buffer count -- state )
-    iota [ +mouse-state+ get ] 2dip swap [ nth (fill-mouse-state) ] curry each ;
+    iota [ +mouse-state+ get-global ] 2dip swap [ nth (fill-mouse-state) ] curry each ;
 
 : get-device-state ( device DIJOYSTATE2 -- )
     [ dup IDirectInputDevice8W::Poll ole32-error ] dip
@@ -326,25 +327,25 @@ CONSTANT: pov-values
     [ fill-controller-state ] [ drop f ] with-acquisition ;
 
 M: dinput-game-input-backend read-controller
-    handle>> dup +controller-devices+ get at
+    handle>> dup +controller-devices+ get-global at
     [ (read-controller) ] [ drop f ] if* ;
 
 M: dinput-game-input-backend calibrate-controller
     handle>> f 0 IDirectInputDevice8W::RunControlPanel ole32-error ;
 
 M: dinput-game-input-backend read-keyboard
-    +keyboard-device+ get
-    [ +keyboard-state+ get [ keys>> underlying>> get-device-state ] keep ]
+    +keyboard-device+ get-global
+    [ +keyboard-state+ get-global [ keys>> underlying>> get-device-state ] keep ]
     [ ] [ f ] with-acquisition ;
 
 M: dinput-game-input-backend read-mouse
-    +mouse-device+ get [ +mouse-buffer+ get MOUSE-BUFFER-SIZE read-device-buffer ]
+    +mouse-device+ get-global [ +mouse-buffer+ get-global MOUSE-BUFFER-SIZE read-device-buffer ]
     [ fill-mouse-state ] [ f ] with-acquisition ;
 
 M: dinput-game-input-backend reset-mouse
-    +mouse-device+ get [ f MOUSE-BUFFER-SIZE read-device-buffer ]
+    +mouse-device+ get-global [ f MOUSE-BUFFER-SIZE read-device-buffer ]
     [ 2drop ] [ ] with-acquisition
-    +mouse-state+ get
+    +mouse-state+ get-global
         0 >>dx
         0 >>dy
         0 >>scroll-dx
index f27e1f36d12122c80367aabaa08383caf0bc3ba7..213b6385744e3e0feda63d5efc9751a56bb550d0 100644 (file)
@@ -106,8 +106,8 @@ SYMBOLS: pressed released ;
     { } buttons-delta-as ; inline
 
 {
-    { [ os windows? ] [ "game.input.xinput" require ] }
+    { [ os windows? ] [ "game.input.dinput" require ] }
     { [ os macosx? ] [ "game.input.iokit" require ] }
-    { [ os linux? ] [ "game.input.linux" require ] }
+    { [ os linux? ] [ "game.input.x11" require ] }
     [ ]
 } cond
index efc586e1ef258e4e48f8ae3d1a8e4757a0b219ea..083be8e74f9979580d65f4bc6bc7fdd9a102246b 100644 (file)
@@ -203,10 +203,10 @@ HINTS: record-keyboard { bit-array alien } ;
 HINTS: record-mouse { mouse-state alien } ;
 
 M: iokit-game-input-backend read-mouse
-    +mouse-state+ get ;
+    +mouse-state+ get-global ;
 
 M: iokit-game-input-backend reset-mouse
-    +mouse-state+ get
+    +mouse-state+ get-global
         0 >>dx
         0 >>dy
         0 >>scroll-dx 
@@ -247,37 +247,40 @@ M: iokit-game-input-backend reset-mouse
     } cleave controller-state boa ;
 
 : ?add-mouse-buttons ( device -- )
-    button-count +mouse-state+ get buttons>> 
+    button-count +mouse-state+ get-global buttons>> 
     2dup length >
     [ set-length ] [ 2drop ] if ;
 
+:: (device-matched-callback) ( context result sender device -- )
+    {
+        { [ device mouse-device? ] [ device ?add-mouse-buttons ] }
+        { [ device controller-device? ] [
+            device <device-controller-state>
+            device +controller-states+ get-global set-at
+        ] }
+        [ ]
+    } cond ;
+
 : device-matched-callback ( -- alien )
-    [| context result sender device |
-        {
-            { [ device controller-device? ] [
-                device <device-controller-state>
-                device +controller-states+ get set-at
-            ] }
-            { [ device mouse-device? ] [ device ?add-mouse-buttons ] }
-            [ ]
-        } cond
-    ] IOHIDDeviceCallback ;
+    [ (device-matched-callback) ] IOHIDDeviceCallback ;
+
+:: (device-removed-callback) ( context result sender device -- )
+    device +controller-states+ get-global delete-at ;
 
 : device-removed-callback ( -- alien )
-    [| context result sender device |
-        device +controller-states+ get delete-at
-    ] IOHIDDeviceCallback ;
+    [ (device-removed-callback) ] IOHIDDeviceCallback ;
+
+:: (device-input-callback) ( context result sender value -- )
+    {
+        { [ sender mouse-device? ] [ +mouse-state+ get-global value record-mouse ] }
+        { [ sender controller-device? ] [
+            sender +controller-states+ get-global at value record-controller
+        ] }
+        [ +keyboard-state+ get-global value record-keyboard ]
+    } cond ;
 
 : device-input-callback ( -- alien )
-    [| context result sender value |
-        {
-            { [ sender controller-device? ] [
-                sender +controller-states+ get at value record-controller
-            ] }
-            { [ sender mouse-device? ] [ +mouse-state+ get value record-mouse ] }
-            [ +keyboard-state+ get value record-keyboard ]
-        } cond
-    ] IOHIDValueCallback ;
+    [ (device-input-callback) ] IOHIDValueCallback ;
 
 : initialize-variables ( manager -- )
     +hid-manager+ set-global
@@ -321,7 +324,7 @@ M: iokit-game-input-backend (close-game-input)
     ] when ;
 
 M: iokit-game-input-backend get-controllers ( -- sequence )
-    +controller-states+ get keys [ controller boa ] map ;
+    +controller-states+ get-global keys [ controller boa ] map ;
 
 : ?join ( pre post sep -- string )
     2over start [ swap 2nip ] [ [ 2array ] dip join ] if ;
@@ -338,10 +341,10 @@ M: iokit-game-input-backend instance-id ( controller -- integer )
     handle>> kIOHIDLocationIDKey device-property ;
 
 M: iokit-game-input-backend read-controller ( controller -- controller-state )
-    handle>> +controller-states+ get at clone ;
+    handle>> +controller-states+ get-global at clone ;
 
 M: iokit-game-input-backend read-keyboard ( -- keyboard-state )
-    +keyboard-state+ get clone keyboard-state boa ;
+    +keyboard-state+ get-global clone keyboard-state boa ;
 
 M: iokit-game-input-backend calibrate-controller ( controller -- )
     drop ;
diff --git a/basis/game/input/linux/authors.txt b/basis/game/input/linux/authors.txt
deleted file mode 100644 (file)
index 67cf648..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Erik Charlebois
\ No newline at end of file
diff --git a/basis/game/input/linux/linux.factor b/basis/game/input/linux/linux.factor
deleted file mode 100644 (file)
index 0d451e9..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-! Copyright (C) 2010 Erik Charlebois.
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel game.input namespaces classes bit-arrays vectors ;
-IN: game.input.linux
-
-SINGLETON: linux-game-input-backend
-
-linux-game-input-backend game-input-backend set-global
-
-M: linux-game-input-backend (open-game-input)
-    ;
-
-M: linux-game-input-backend (close-game-input)
-    ;
-
-M: linux-game-input-backend (reset-game-input)
-    ;
-
-M: linux-game-input-backend get-controllers
-    { } ;
-
-M: linux-game-input-backend product-string
-    drop "" ;
-     
-M: linux-game-input-backend product-id
-    drop f ;
-     
-M: linux-game-input-backend instance-id
-    drop f ;
-     
-M: linux-game-input-backend read-controller
-    drop controller-state new ;
-     
-M: linux-game-input-backend calibrate-controller
-    drop ;
-     
-M: linux-game-input-backend vibrate-controller
-    3drop ;
-     
-M: linux-game-input-backend read-keyboard
-    256 <bit-array> keyboard-state boa ;
-     
-M: linux-game-input-backend read-mouse
-    0 0 0 0 2 <vector> mouse-state boa ;
-     
-M: linux-game-input-backend reset-mouse
-    ;
diff --git a/basis/game/input/linux/platforms.txt b/basis/game/input/linux/platforms.txt
deleted file mode 100644 (file)
index a08e1f3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux
diff --git a/basis/game/input/linux/summary.txt b/basis/game/input/linux/summary.txt
deleted file mode 100644 (file)
index 5c88274..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Linux backend for game input.
diff --git a/basis/game/input/linux/tags.txt b/basis/game/input/linux/tags.txt
deleted file mode 100644 (file)
index 84d4140..0000000
+++ /dev/null
@@ -1 +0,0 @@
-games
diff --git a/basis/game/input/x11/authors.txt b/basis/game/input/x11/authors.txt
new file mode 100644 (file)
index 0000000..d73be90
--- /dev/null
@@ -0,0 +1,2 @@
+Erik Charlebois
+William Schlieper
diff --git a/basis/game/input/x11/platforms.txt b/basis/game/input/x11/platforms.txt
new file mode 100644 (file)
index 0000000..a08e1f3
--- /dev/null
@@ -0,0 +1 @@
+linux
diff --git a/basis/game/input/x11/summary.txt b/basis/game/input/x11/summary.txt
new file mode 100644 (file)
index 0000000..5c88274
--- /dev/null
@@ -0,0 +1 @@
+Linux backend for game input.
diff --git a/basis/game/input/x11/tags.txt b/basis/game/input/x11/tags.txt
new file mode 100644 (file)
index 0000000..84d4140
--- /dev/null
@@ -0,0 +1 @@
+games
diff --git a/basis/game/input/x11/x11.factor b/basis/game/input/x11/x11.factor
new file mode 100644 (file)
index 0000000..ecdbee8
--- /dev/null
@@ -0,0 +1,108 @@
+! Copyright (C) 2010 Erik Charlebois, William Schlieper.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types alien.data arrays kernel game.input
+namespaces math classes bit-arrays system sequences vectors
+x11 x11.xlib assocs generalizations ;
+IN: game.input.x11
+
+SINGLETON: x11-game-input-backend
+
+x11-game-input-backend game-input-backend set-global
+
+M: x11-game-input-backend (open-game-input)
+    ;
+
+M: x11-game-input-backend (close-game-input)
+    ;
+
+M: x11-game-input-backend (reset-game-input)
+    ;
+
+M: x11-game-input-backend get-controllers
+    { } ;
+
+M: x11-game-input-backend product-string
+    drop "" ;
+     
+M: x11-game-input-backend product-id
+    drop f ;
+     
+M: x11-game-input-backend instance-id
+    drop f ;
+     
+M: x11-game-input-backend read-controller
+    drop controller-state new ;
+     
+M: x11-game-input-backend calibrate-controller
+    drop ;
+     
+M: x11-game-input-backend vibrate-controller
+    3drop ;
+
+HOOK: x>hid-bit-order os ( -- x )
+
+M: linux x>hid-bit-order
+    {
+        0 0 0 0 0 0 0 0 
+        0 41 30 31 32 33 34 35 
+        36 37 38 39 45 46 42 43 
+        20 26 8 21 23 28 24 12 
+        18 19 47 48 40 224 4 22 
+        7 9 10 11 13 14 15 51 
+        52 53 225 49 29 27 6 25 
+        5 17 16 54 55 56 229 85 
+        226 44 57 58 59 60 61 62 
+        63 64 65 66 67 83 71 95 
+        96 97 86 92 93 94 87 91 
+        90 89 98 99 0 0 0 68 
+        69 0 0 0 0 0 0 0 
+        88 228 84 70 0 0 74 82 
+        75 80 79 77 81 78 73 76 
+        127 129 128 102 103 0 72 0 
+        0 0 0 227 231 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 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 
+    } ; inline
+     
+: x-bits>hid-bits ( bit-array -- bit-array )
+    256 iota [ 2array ] { } 2map-as [ first ] filter values
+    x>hid-bit-order [ nth ] curry map
+    256 <bit-array> swap [ t swap pick set-nth ] each ;
+        
+M: x11-game-input-backend read-keyboard
+    dpy get 256 <bit-array> [ XQueryKeymap drop ] keep
+    x-bits>hid-bits keyboard-state boa ;
+
+: query-pointer ( -- x y buttons )
+    dpy get dup XDefaultRootWindow
+    { int int int int int int int }
+    [ XQueryPointer drop ] [ ] with-out-parameters
+    [ 4 ndrop ] 3dip ;
+
+SYMBOL: mouse-reset?
+     
+M: x11-game-input-backend read-mouse
+    mouse-reset? get [ reset-mouse ] unless
+    query-pointer
+    mouse-state new
+    swap 256 /i >>buttons
+    swap 400 - >>dy
+    swap 400 - >>dx
+    0 >>scroll-dy 0 >>scroll-dx ;
+     
+M: x11-game-input-backend reset-mouse
+    dpy get dup XDefaultRootWindow dup
+    0 0 0 0 400 400 XWarpPointer drop t mouse-reset? set-global ;
index 568deb3750ff669d8c86170c14caa946f193afa7..800b2c4720376451084509fbcbcd66eb7a9a52a5 100644 (file)
@@ -30,7 +30,7 @@ MACRO: map-index-compose ( seq quot -- seq )
       XINPUT_GAMEPAD_B
       XINPUT_GAMEPAD_X
       XINPUT_GAMEPAD_Y }
-      [ [ bitand ] dip swap 0 = [ 2drop ] [ 1.0 -rot swap set-nth ] if ]
+      [ [ bitand ] dip swap 0 = [ 2drop ] [ [ 1.0 ] 2dip swap set-nth ] if ]
       map-index-compose 2cleave ;
 
  : >pov ( byte -- symbol )
@@ -56,14 +56,14 @@ MACRO: map-index-compose ( seq quot -- seq )
 : fill-controller-state ( XINPUT_STATE -- controller-state )
     Gamepad>> controller-state new dup rot
     {
-        [ wButtons>> HEX: f bitand >pov swap (>>pov) ]
-        [ wButtons>> fill-buttons swap (>>buttons) ]
-        [ sThumbLX>> >axis swap (>>x) ]
-        [ sThumbLY>> >axis swap (>>y) ]
-        [ sThumbRX>> >axis swap (>>rx) ]
-        [ sThumbRY>> >axis swap (>>ry) ]
-        [ bLeftTrigger>> >trigger swap (>>z) ]
-        [ bRightTrigger>> >trigger swap (>>rz) ]
+        [ wButtons>> HEX: f bitand >pov swap pov<< ]
+        [ wButtons>> fill-buttons swap buttons<< ]
+        [ sThumbLX>> >axis swap x<< ]
+        [ sThumbLY>> >axis swap y<< ]
+        [ sThumbRX>> >axis swap rx<< ]
+        [ sThumbRY>> >axis swap ry<< ]
+        [ bLeftTrigger>> >trigger swap z<< ]
+        [ bRightTrigger>> >trigger swap rz<< ]
     } 2cleave ;
 PRIVATE>
 
index 5b869f138ee09205fa10db5d13f2382e9eed4dcc..dee69e3cbd0a076ad5a6146b7054d98173634210 100644 (file)
@@ -2,59 +2,10 @@ USING: help.syntax help.markup kernel sequences quotations
 math arrays combinators ;\r
 IN: generalizations\r
 \r
-HELP: nsequence\r
-{ $values { "n" integer } { "seq" "an exemplar" } }\r
-{ $description "A generalization of " { $link 2sequence } ", "\r
-{ $link 3sequence } ", and " { $link 4sequence } " "\r
-"that constructs a sequence from the top " { $snippet "n" } " elements of the stack."\r
-}\r
-{ $examples\r
-    { $example "USING: generalizations prettyprint ;" "CHAR: f CHAR: i CHAR: s CHAR: h 4 \"\" nsequence ." "\"fish\"" }\r
-} ;\r
-\r
-HELP: narray\r
-{ $values { "n" integer } }\r
-{ $description "A generalization of " { $link 1array } ", "\r
-{ $link 2array } ", " { $link 3array } " and " { $link 4array } " "\r
-"that constructs an array from the top " { $snippet "n" } " elements of the stack."\r
-}\r
-{ $examples\r
-    "Some core words expressed in terms of " { $link narray } ":"\r
-    { $table\r
-        { { $link 1array } { $snippet "1 narray" } }\r
-        { { $link 2array } { $snippet "2 narray" } }\r
-        { { $link 3array } { $snippet "3 narray" } }\r
-        { { $link 4array } { $snippet "4 narray" } }\r
-    }\r
-} ;\r
-\r
-{ nsequence narray } related-words\r
-\r
 HELP: nsum\r
 { $values { "n" integer } }\r
 { $description "Adds the top " { $snippet "n" } " stack values." } ;\r
 \r
-HELP: firstn\r
-{ $values { "n" integer } }\r
-{ $description "A generalization of " { $link first } ", "\r
-{ $link first2 } ", " { $link first3 } " and " { $link first4 } " "\r
-"that pushes the first " { $snippet "n" } " elements of a sequence on the stack."\r
-}\r
-{ $examples\r
-    "Some core words expressed in terms of " { $link firstn } ":"\r
-    { $table\r
-        { { $link first } { $snippet "1 firstn" } }\r
-        { { $link first2 } { $snippet "2 firstn" } }\r
-        { { $link first3 } { $snippet "3 firstn" } }\r
-        { { $link first4 } { $snippet "4 firstn" } }\r
-    }\r
-} ;\r
-\r
-HELP: set-firstn\r
-{ $values { "n" integer } }\r
-{ $description "A generalization of " { $link set-first } " "\r
-"that sets the first " { $snippet "n" } " elements of a sequence from the top " { $snippet "n" } " elements of the stack." } ;\r
-\r
 HELP: npick\r
 { $values { "n" integer } }\r
 { $description "A generalization of " { $link dup } ", "\r
@@ -63,7 +14,13 @@ HELP: npick
 "placed on the top of the stack."\r
 }\r
 { $examples\r
-  { $example "USING: kernel prettyprint generalizations ;" "1 2 3 4 4 npick 5 narray ." "{ 1 2 3 4 1 }" }\r
+  { $example\r
+      "USING: kernel generalizations prettyprint"\r
+      "sequences.generalizations ;"\r
+      ""\r
+      "1 2 3 4 4 npick 5 narray ."\r
+      "{ 1 2 3 4 1 }"\r
+  }\r
   "Some core words expressed in terms of " { $link npick } ":"\r
     { $table\r
         { { $link dup } { $snippet "1 npick" } }\r
@@ -80,7 +37,13 @@ HELP: ndup
 "placed on the top of the stack."\r
 }\r
 { $examples\r
-  { $example "USING: prettyprint generalizations kernel ;" "1 2 3 4 4 ndup 8 narray ." "{ 1 2 3 4 1 2 3 4 }" }\r
+  { $example\r
+      "USING: prettyprint generalizations kernel"\r
+      "sequences.generalizations ;"\r
+      ""\r
+      "1 2 3 4 4 ndup 8 narray ."\r
+      "{ 1 2 3 4 1 2 3 4 }"\r
+  }\r
   "Some core words expressed in terms of " { $link ndup } ":"\r
     { $table\r
         { { $link dup } { $snippet "1 ndup" } }\r
@@ -178,7 +141,13 @@ HELP: nkeep
 "saved, the quotation called, and the items restored."\r
 } \r
 { $examples\r
-  { $example "USING: generalizations kernel prettyprint ;" "1 2 3 4 5 [ drop drop drop drop drop 99 ] 5 nkeep 6 narray ." "{ 99 1 2 3 4 5 }" }\r
+  { $example\r
+      "USING: generalizations kernel prettyprint"\r
+      "sequences.generalizations ;"\r
+      ""\r
+      "1 2 3 4 5 [ drop drop drop drop drop 99 ] 5 nkeep 6 narray ."\r
+      "{ 99 1 2 3 4 5 }"\r
+  }\r
   "Some core words expressed in terms of " { $link nkeep } ":"\r
     { $table\r
         { { $link keep } { $snippet "1 nkeep" } }\r
@@ -252,17 +221,17 @@ HELP: spread*
 { $notes "This word can be used with " { $link apply-curry } " to generalize the " { $snippet "bi-curry@ bi*" } " or " { $snippet "tri-curry@ tri*" } " dataflow patterns." } ;\r
 \r
 HELP: apply-curry\r
-{ $values { "...a" { $snippet "n" } " values on the datastack" } { "quot" quotation } { "n" integer } }\r
+{ $values { "a..." { $snippet "n" } " values on the datastack" } { "quot" quotation } { "n" integer } }\r
 { $description "Curries each of the top " { $snippet "n" } " items of the datastack onto " { $snippet "quot" } ", leaving " { $snippet "n" } " quotations on the datastack. A generalization of " { $link bi-curry@ } " and " { $link tri-curry@ } "." }\r
 { $notes "This word can be used with " { $link cleave* } " and " { $link spread* } " to generalize dataflow patterns such as " { $snippet "bi-curry@ bi" } ", " { $snippet "tri-curry@ tri" } ", " { $snippet "bi-curry@ bi*" } ", and " { $snippet "tri-curry@ tri*" } "." } ;\r
 \r
 HELP: cleave-curry\r
-{ $values { "a" object } { "...quot" { $snippet "n" } " quotations on the datastack" } { "n" integer } }\r
+{ $values { "a" object } { "quot..." { $snippet "n" } " quotations on the datastack" } { "n" integer } }\r
 { $description "Curries " { $snippet "a" } " onto the " { $snippet "n" } " quotations on the top of the datastack. A generalization of " { $link bi-curry } " and " { $link tri-curry } "." }\r
 { $notes "This word can be used with " { $link cleave* } " and " { $link spread* } " to generalize dataflow patterns such as " { $snippet "bi-curry bi" } ", " { $snippet "tri-curry tri" } ", " { $snippet "bi-curry bi*" } ", and " { $snippet "tri-curry tri*" } "." } ;\r
 \r
 HELP: spread-curry\r
-{ $values { "...a" { $snippet "n" } " objects on the datastack" } { "...quot" { $snippet "n" } " quotations on the datastack" } { "n" integer } }\r
+{ $values { "a..." { $snippet "n" } " objects on the datastack" } { "quot..." { $snippet "n" } " quotations on the datastack" } { "n" integer } }\r
 { $description "Curries the " { $snippet "n" } " quotations on the top of the datastack with the " { $snippet "n" } " values just below them. A generalization of " { $link bi-curry* } " and " { $link tri-curry* } "." }\r
 { $notes "This word can be used with " { $link cleave* } " and " { $link spread* } " to generalize dataflow patterns such as " { $snippet "bi-curry* bi" } ", " { $snippet "tri-curry* tri" } ", " { $snippet "bi-curry* bi*" } ", and " { $snippet "tri-curry* tri*" } "." } ;\r
 \r
@@ -302,46 +271,6 @@ HELP: n*quot
 }\r
 { $description "Construct a quotation containing the contents of " { $snippet "seq" } " repeated " { $snippet "n"} " times." } ;\r
 \r
-HELP: nappend\r
-{ $values\r
-     { "n" integer }\r
-     { "seq" sequence }\r
-}\r
-{ $description "Outputs a new sequence consisting of the elements of the top " { $snippet "n" } " sequences from the datastack in turn." }\r
-{ $errors "Throws an error if any of the sequences contain elements that are not permitted in the sequence type of the first sequence." }\r
-{ $examples\r
-    { $example "USING: generalizations prettyprint math ;"\r
-               "{ 1 2 } { 3 4 } { 5 6 } { 7 8 } 4 nappend ."\r
-               "{ 1 2 3 4 5 6 7 8 }"\r
-    }\r
-} ;\r
-\r
-HELP: nappend-as\r
-{ $values\r
-     { "n" integer } { "exemplar" sequence }\r
-     { "seq" sequence }\r
-}\r
-{ $description "Outputs a new sequence of type " { $snippet "exemplar" } " consisting of the elements of the top " { $snippet "n" } " sequences from the datastack in turn." }\r
-{ $errors "Throws an error if any of the sequences contain elements that are not permitted in the sequence type of the first sequence." }\r
-{ $examples\r
-    { $example "USING: generalizations prettyprint math ;"\r
-               "{ 1 2 } { 3 4 } { 5 6 } { 7 8 } 4 V{ } nappend-as ."\r
-               "V{ 1 2 3 4 5 6 7 8 }"\r
-    }\r
-} ;\r
-\r
-{ nappend nappend-as } related-words\r
-\r
-ARTICLE: "sequence-generalizations" "Generalized sequence operations"\r
-{ $subsections\r
-    narray\r
-    nsequence\r
-    firstn\r
-    set-firstn\r
-    nappend\r
-    nappend-as\r
-} ;\r
-\r
 ARTICLE: "shuffle-generalizations" "Generalized shuffle words"\r
 { $subsections\r
     ndup\r
@@ -381,11 +310,10 @@ ARTICLE: "generalizations" "Generalized shuffle words and combinators"
 "macros where the arity of the input quotations depends on an "\r
 "input parameter."\r
 { $subsections\r
-    "sequence-generalizations"\r
     "shuffle-generalizations"\r
     "combinator-generalizations"\r
     "other-generalizations"\r
 }\r
-"Also see the " { $vocab-link "sequences.generalizations" } " vocabulary for generalized sequence iteration combinators." ;\r
+"Also see the " { $vocab-link "sequences.generalizations" } " vocabulary for generalized sequence operations." ;\r
 \r
 ABOUT: "generalizations"\r
index 477be4a20fd027c7b16330fd7cdbb44f86e4eb38..9b6374ca5f7c1f105bf35b006e638d8d14597bd5 100644 (file)
@@ -39,24 +39,10 @@ IN: generalizations.tests
 \r
 [ { "xyc" "xyd" } ] [ "x" "y" { "c" "d" } [ 3append ] 2 nwith map ] unit-test\r
 \r
-[ 1 2 3 4 ] [ { 1 2 3 4 } 4 firstn ] unit-test\r
-[ { 1 2 3 4 } ] [ 1 2 3 4 { f f f f } [ 4 set-firstn ] keep ] unit-test\r
-[ 1 2 3 4 { f f f } [ 4 set-firstn ] keep ] must-fail\r
-[ ] [ { } 0 firstn ] unit-test\r
-[ "a" ] [ { "a" } 1 firstn ] unit-test\r
-\r
-[ [ 1 2 ] ] [ 1 2 2 [ ] nsequence ] unit-test\r
-\r
 [ 4 5 1 2 3 ] [ 1 2 3 4 5 2 3 mnswap ] unit-test\r
 \r
 [ 1 2 3 4 5 6 ] [ 1 2 3 4 5 6 2 4 mnswap 4 2 mnswap ] unit-test\r
 \r
-[ { 1 2 3 4 } ] [ { 1 } { 2 } { 3 } { 4 } 4 nappend ] unit-test\r
-[ V{ 1 2 3 4 } ] [ { 1 } { 2 } { 3 } { 4 } 4 V{ } nappend-as ] unit-test\r
-\r
-[ 4 nappend ] must-infer\r
-[ 4 { } nappend-as ] must-infer\r
-\r
 [ 17 ] [ 3 1 3 3 7 5 nsum ] unit-test\r
 { 4 1 } [ 4 nsum ] must-infer-as\r
 \r
index dd0665b534ac7729d25c04a0ceabf78f01b0fd22..2c6a9f1a21854e955b6f26d4b60c5da0d17b979c 100644 (file)
@@ -14,26 +14,9 @@ ALIAS: n*quot (n*quot)
 
 >>
 
-MACRO: nsequence ( n seq -- )
-    [ [nsequence] ] keep
-    '[ @ _ like ] ;
-
-MACRO: narray ( n -- )
-    '[ _ { } nsequence ] ;
-
 MACRO: nsum ( n -- )
     1 - [ + ] n*quot ;
 
-MACRO: firstn-unsafe ( n -- )
-    [firstn] ;
-
-MACRO: firstn ( n -- )
-    dup zero? [ drop [ drop ] ] [
-        [ 1 - swap bounds-check 2drop ]
-        [ firstn-unsafe ]
-        bi-curry '[ _ _ bi ]
-    ] if ;
-
 MACRO: npick ( n -- )
     1 - [ dup ] [ '[ _ dip swap ] ] repeat ;
 
@@ -53,18 +36,6 @@ MACRO: nrot ( n -- )
 MACRO: -nrot ( n -- )
     1 - [ ] [ '[ swap _ dip ] ] repeat ;
 
-MACRO: set-firstn-unsafe ( n -- )
-    [ 1 + ]
-    [ iota [ '[ _ rot [ set-nth-unsafe ] keep ] ] map ] bi
-    '[ _ -nrot _ spread drop ] ;
-
-MACRO: set-firstn ( n -- )
-    dup zero? [ drop [ drop ] ] [
-        [ 1 - swap bounds-check 2drop ]
-        [ set-firstn-unsafe ]
-        bi-curry '[ _ _ bi ]
-    ] if ;
-
 MACRO: ndrop ( n -- )
     [ drop ] n*quot ;
 
@@ -125,13 +96,13 @@ MACRO: cleave* ( n -- )
 : mnapply ( quot m n -- )
     [ nip dupn ] [ nspread* ] 2bi ; inline
 
-: apply-curry ( ...a quot n -- )
+: apply-curry ( a... quot n -- )
     [ [curry] ] dip napply ; inline
 
-: cleave-curry ( a ...quot n -- )
+: cleave-curry ( a quot... n -- )
     [ [curry] ] swap [ napply ] [ cleave* ] bi ; inline
 
-: spread-curry ( ...a ...quot n -- )
+: spread-curry ( a... quot... n -- )
     [ [curry] ] swap [ napply ] [ spread* ] bi ; inline
 
 MACRO: mnswap ( m n -- )
@@ -143,9 +114,3 @@ MACRO: nweave ( n -- )
 
 MACRO: nbi-curry ( n -- )
     [ bi-curry ] n*quot ;
-
-: nappend-as ( n exemplar -- seq )
-    [ narray concat ] dip like ; inline
-
-: nappend ( n -- seq ) narray concat ; inline
-
index 157a426e19e783769ba82c6fd44910ca2ae8def2..7447f24151e2d26bad9afe23970e202781d08820 100644 (file)
@@ -8,14 +8,14 @@ IN: glib
 <<
 
 {
-    { [ os winnt? ] [ "glib" "libglib-2.0-0.dll" "cdecl" add-library ] }
-    { [ os macosx? ] [ "glib" "/opt/local/lib/libglib-2.0.0.dylib" "cdecl" add-library ] }
+    { [ os winnt? ] [ "glib" "libglib-2.0-0.dll" cdecl add-library ] }
+    { [ os macosx? ] [ "glib" "/opt/local/lib/libglib-2.0.0.dylib" cdecl add-library ] }
     { [ os unix? ] [ ] }
 } cond
 
 {
-    { [ os winnt? ] [ "gobject" "libgobject-2.0-0.dll" "cdecl" add-library ] }
-    { [ os macosx? ] [ "gobject" "/opt/local/lib/libgobject-2.0.0.dylib" "cdecl" add-library ] }
+    { [ os winnt? ] [ "gobject" "libgobject-2.0-0.dll" cdecl add-library ] }
+    { [ os macosx? ] [ "gobject" "/opt/local/lib/libgobject-2.0.0.dylib" cdecl add-library ] }
     { [ os unix? ] [ ] }
 } cond
 
index 1901f27a24507e2512d93a1f956aaaa0d2f05714..580f882c8d78327fd1fc737a4da0624407fe0e7a 100644 (file)
@@ -1 +1,2 @@
 Slava Pestov
+Joe Groff
index 2c2fee1d70e79233249c8803478f3652bcb2f97f..c91eb231ab6fee5f5d4e3235501ea3791e9bef8e 100644 (file)
@@ -8,11 +8,19 @@ ARTICLE: "grouping" "Groups and clumps"
 { $subsections groups <groups> <sliced-groups> }
 "Splitting a sequence into overlapping, fixed-length subsequences:"
 { $subsections clump }
+"Splitting a sequence into overlapping, fixed-length subsequences, wrapping around the end of the sequence:"
+{ $subsections circular-clump }
 "A virtual sequence for splitting a sequence into overlapping, fixed-length subsequences:"
 { $subsections clumps <clumps> <sliced-clumps> }
+"A virtual sequence for splitting a sequence into overlapping, fixed-length subsequences:"
+{ $subsections circular-clumps <circular-clumps> <sliced-circular-clumps> }
 "The difference can be summarized as the following:"
 { $list
     { "With groups, the subsequences form the original sequence when concatenated:"
+        { $unchecked-example
+            "USING: grouping ;"
+            "{ 1 2 3 4 } 2 group ." "{ { 1 2 } { 3 4 } }"
+        }
         { $unchecked-example
             "USING: grouping ;"
             "{ 1 2 3 4 } dup" "2 <groups> concat sequence= ." "t"
@@ -21,7 +29,25 @@ ARTICLE: "grouping" "Groups and clumps"
     { "With clumps, collecting the first element of each subsequence but the last one, together with the last subseqence, yields the original sequence:"
         { $unchecked-example
             "USING: grouping ;"
-            "{ 1 2 3 4 } dup" "2 <clumps> unclip-last [ [ first ] map ] dip append sequence= ." "t"
+            "{ 1 2 3 4 } 2 clump ." "{ { 1 2 } { 2 3 } { 3 4 } }"
+        }
+        { $unchecked-example
+            "USING: grouping assocs sequences ;"
+            "{ 1 2 3 4 } dup" "2 <clumps> unclip-last [ keys ] dip append sequence= ." "t"
+        }
+    }
+    { "With circular clumps, collecting the first element of each subsequence yields the original sequence. Collecting the " { $snippet "n" } "th element of each subsequence would rotate the original sequence " { $snippet "n" } " elements rightward:"
+        { $unchecked-example
+            "USING: grouping ;"
+            "{ 1 2 3 4 } 2 circular-clump ." "{ { 1 2 } { 2 3 } { 3 4 } { 4 1 } }"
+        }
+        { $unchecked-example
+            "USING: grouping assocs sequences ;"
+            "{ 1 2 3 4 } dup" "2 <circular-clumps> keys sequence= ." "t"
+        }
+        { $unchecked-example
+            "USING: grouping ;"
+            "{ 1 2 3 4 } dup" "2 <circular-clumps> [ second ] { } map-as ." "{ 2 3 4 1 }"
         }
     }
 }
@@ -79,18 +105,31 @@ HELP: <sliced-groups>
 } ;
 
 HELP: clumps
-{ $class-description "Instances are virtual sequences whose elements are overlapping fixed-length subsequences o an underlying sequence. Clumps are mutable and resizable if the underlying sequence is mutable and resizable, respectively."
+{ $class-description "Instances are virtual sequences whose elements are overlapping fixed-length subsequences of an underlying sequence. Clumps are mutable and resizable if the underlying sequence is mutable and resizable, respectively."
 $nl
 "New clumps are created by calling " { $link <clumps> } " and " { $link <sliced-clumps> } "." } ;
 
+HELP: circular-clumps
+{ $class-description "Instances are virtual sequences whose elements are overlapping fixed-length subsequences of an underlying sequence, beginning with every element in the original sequence and wrapping around its end. Circular clumps are mutable and resizable if the underlying sequence is mutable and resizable, respectively."
+$nl
+"New clumps are created by calling " { $link <circular-clumps> } " and " { $link <sliced-circular-clumps> } "." } ;
+
 HELP: clump
 { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
 { $description "Splits the sequence into overlapping clumps of " { $snippet "n" } " elements and collects the clumps into a new array." }
-{ $errors "Throws an error if " { $snippet "n" } " is smaller than the length of the sequence." }
+{ $errors "Throws an error if " { $snippet "n" } " is larger than the length of the sequence." }
 { $examples
     { $example "USING: grouping prettyprint ;" "{ 3 1 3 3 7 } 2 clump ." "{ { 3 1 } { 1 3 } { 3 3 } { 3 7 } }" }
 } ;
 
+HELP: circular-clump
+{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
+{ $description "Splits the sequence into overlapping clumps of " { $snippet "n" } " elements, wrapping around the end of the sequence, and collects the clumps into a new array." }
+{ $errors "Throws an error if " { $snippet "n" } " is larger than the length of the sequence." }
+{ $examples
+    { $example "USING: grouping prettyprint ;" "{ 3 1 3 3 7 } 2 circular-clump ." "{ { 3 1 } { 1 3 } { 3 3 } { 3 7 } { 7 3 } }" }
+} ;
+
 HELP: <clumps>
 { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } }
 { $description "Outputs a virtual sequence whose elements are overlapping subsequences of " { $snippet "n" } " elements from the underlying sequence." }
@@ -111,24 +150,35 @@ HELP: <clumps>
     }
 } ;
 
-HELP: <sliced-clumps>
+HELP: <circular-clumps>
 { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } }
-{ $description "Outputs a virtual sequence whose elements are overlapping slices of " { $snippet "n" } " elements from the underlying sequence." }
+{ $description "Outputs a virtual sequence whose elements are overlapping subsequences of " { $snippet "n" } " elements from the underlying sequence, starting with each of its elements and wrapping around the end of the sequence." }
 { $examples
     { $example
         "USING: kernel sequences grouping prettyprint ;"
-        "{ 1 2 3 4 5 6 } 3 <sliced-clumps> second ."
-        "T{ slice { from 1 } { to 4 } { seq { 1 2 3 4 5 6 } } }"
+        "{ 1 2 3 4 } 3 <circular-clumps> third ."
+        "{ 3 4 1 }"
+    }
+} ;
+
+HELP: <sliced-circular-clumps>
+{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } }
+{ $description "Outputs a virtual sequence whose elements are overlapping slices of " { $snippet "n" } " elements from the underlying sequence, starting with each of its elements and wrapping around the end of the sequence." }
+{ $examples
+    { $example
+        "USING: arrays kernel sequences grouping prettyprint ;"
+        "{ 1 2 3 4 } 3 <sliced-circular-clumps> third >array ."
+        "{ 3 4 1 }"
     }
 } ;
 
-{ clumps groups } related-words
+{ clumps circular-clumps groups } related-words
 
-{ clump group } related-words
+{ clump circular-clump group } related-words
 
-{ <clumps> <groups> } related-words
+{ <clumps> <circular-clumps> <groups> } related-words
 
-{ <sliced-clumps> <sliced-groups> } related-words
+{ <sliced-clumps> <sliced-circular-clumps> <sliced-groups> } related-words
 
 HELP: monotonic?
 { $values { "seq" sequence } { "quot" { $quotation "( elt elt -- ? )" } } { "?" "a boolean" } }
index 60500558a72f5a9270743d050f609e1fe80df588..9340b322e2d9e2da91a40a4e9c6300e3d29417e2 100644 (file)
@@ -17,6 +17,15 @@ IN: grouping.tests
 [ 1 ] [ { 1 2 } 2 <clumps> length ] unit-test
 [ 2 ] [ { 1 2 3 } 2 <clumps> length ] unit-test
 
+[ { } 2 <circular-clumps> length ] must-fail
+[ { 1 } 2 <circular-clumps> length ] must-fail
+
+[ 2 ] [ { 1 2 } 2 <circular-clumps> length ] unit-test
+[ 3 ] [ { 1 2 3 } 2 <circular-clumps> length ] unit-test
+
+[ { { 1 2 } { 2 1 }         } ] [ { 1 2   } 2 circular-clump ] unit-test
+[ { { 1 2 } { 2 3 } { 3 1 } } ] [ { 1 2 3 } 2 circular-clump ] unit-test
+
 [ 1 ] [ V{ } 2 <clumps> 0 over set-length seq>> length ] unit-test
 [ 2 ] [ V{ } 2 <clumps> 1 over set-length seq>> length ] unit-test
 [ 3 ] [ V{ } 2 <clumps> 2 over set-length seq>> length ] unit-test
index 4ee0d0c38519e9833db99f5745f7d032f9353a65..1a7e267c9088827279fb2c99e9ac289050d78f0a 100644 (file)
@@ -1,7 +1,7 @@
-! Copyright (C) 2005, 2010 Slava Pestov.
+! Copyright (C) 2005, 2010 Slava Pestov, Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel math math.order strings arrays vectors sequences
-sequences.private accessors fry ;
+sequences.private accessors fry combinators ;
 IN: grouping
 
 <PRIVATE
@@ -59,6 +59,12 @@ TUPLE: chunking-seq { seq read-only } { n read-only } ;
 : new-groups ( seq n class -- groups )
     [ check-groups ] dip boa ; inline
 
+: slice-mod ( n length -- n' )
+    2dup >= [ - ] [ drop ] if ; inline
+
+: check-circular-clumps ( seq n -- seq n )
+    2dup 1 - swap bounds-check 2drop ; inline
+
 PRIVATE>
 
 TUPLE: groups < chunking-seq ;
@@ -106,3 +112,47 @@ INSTANCE: sliced-clumps abstract-clumps
 : all-equal? ( seq -- ? ) [ = ] monotonic? ;
 
 : all-eq? ( seq -- ? ) [ eq? ] monotonic? ;
+
+TUPLE: circular-slice { from read-only } { to read-only } { seq read-only } ;
+
+INSTANCE: circular-slice virtual-sequence
+
+M: circular-slice equal? over slice? [ sequence= ] [ 2drop f ] if ;
+
+M: circular-slice hashcode* [ sequence-hashcode ] recursive-hashcode ;
+
+M: circular-slice length [ to>> ] [ from>> ] bi - ; inline
+
+M: circular-slice virtual-exemplar seq>> ; inline
+
+M: circular-slice virtual@
+    [ from>> + ] [ seq>> ] bi [ length slice-mod ] keep ; inline
+
+C: <circular-slice> circular-slice
+
+TUPLE: sliced-circular-clumps < chunking-seq ;
+INSTANCE: sliced-circular-clumps sequence
+
+M: sliced-circular-clumps length
+    seq>> length ; inline
+
+M: sliced-circular-clumps nth
+    [ n>> over + ] [ seq>> ] bi <circular-slice> ; inline
+
+: <sliced-circular-clumps> ( seq n -- clumps )
+    check-circular-clumps sliced-circular-clumps boa ; inline
+
+TUPLE: circular-clumps < chunking-seq ;
+INSTANCE: circular-clumps sequence
+
+M: circular-clumps length
+    seq>> length ; inline
+
+M: circular-clumps nth
+    [ n>> over + ] [ seq>> ] bi [ <circular-slice> ] [ like ] bi ; inline
+
+: <circular-clumps> ( seq n -- clumps )
+    check-circular-clumps circular-clumps boa ; inline
+
+: circular-clump ( seq n -- array )
+    <circular-clumps> { } like ; inline
diff --git a/basis/half-floats/authors.txt b/basis/half-floats/authors.txt
deleted file mode 100644 (file)
index f13c9c1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Joe Groff
diff --git a/basis/half-floats/half-floats-tests.factor b/basis/half-floats/half-floats-tests.factor
deleted file mode 100644 (file)
index d6b26cb..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-USING: accessors alien.c-types alien.syntax half-floats kernel
-math tools.test specialized-arrays alien.data classes.struct ;
-SPECIALIZED-ARRAY: half
-IN: half-floats.tests
-
-[ HEX: 0000 ] [  0.0  half>bits ] unit-test
-[ HEX: 8000 ] [ -0.0  half>bits ] unit-test
-[ HEX: 3e00 ] [  1.5  half>bits ] unit-test
-[ HEX: be00 ] [ -1.5  half>bits ] unit-test
-[ HEX: 7c00 ] [  1/0. half>bits ] unit-test
-[ HEX: fc00 ] [ -1/0. half>bits ] unit-test
-[ HEX: 7eaa ] [ NAN: aaaaaaaaaaaaa half>bits ] unit-test
-
-! too-big floats overflow to infinity
-[ HEX: 7c00 ] [   65536.0 half>bits ] unit-test
-[ HEX: fc00 ] [  -65536.0 half>bits ] unit-test
-[ HEX: 7c00 ] [  131072.0 half>bits ] unit-test
-[ HEX: fc00 ] [ -131072.0 half>bits ] unit-test
-
-! too-small floats flush to zero
-[ HEX: 0000 ] [  1.0e-9 half>bits ] unit-test
-[ HEX: 8000 ] [ -1.0e-9 half>bits ] unit-test
-
-[  0.0  ] [ HEX: 0000 bits>half ] unit-test
-[ -0.0  ] [ HEX: 8000 bits>half ] unit-test
-[  1.5  ] [ HEX: 3e00 bits>half ] unit-test
-[ -1.5  ] [ HEX: be00 bits>half ] unit-test
-[  1/0. ] [ HEX: 7c00 bits>half ] unit-test
-[ -1/0. ] [ HEX: fc00 bits>half ] unit-test
-[  3.0  ] [ HEX: 4200 bits>half ] unit-test
-[    t  ] [ HEX: 7e00 bits>half fp-nan? ] unit-test
-
-STRUCT: halves
-    { tom half }
-    { dick half }
-    { harry half }
-    { harry-jr half } ;
-
-[ 8 ] [ halves heap-size ] unit-test
-
-[ 3.0 ] [
-    halves <struct>
-        3.0 >>dick
-    dick>>
-] unit-test
-
-[ half-array{ 1.0 2.0 3.0 1/0. -1/0. } ]
-[ { 1.0 2.0 3.0 1/0. -1/0. } >half-array ] unit-test
-
diff --git a/basis/half-floats/half-floats.factor b/basis/half-floats/half-floats.factor
deleted file mode 100644 (file)
index 4c84bb8..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-! (c)2009 Joe Groff bsd license
-USING: accessors alien.accessors alien.c-types alien.data
-alien.syntax kernel math math.order ;
-FROM: math => float ;
-IN: half-floats
-
-: half>bits ( float -- bits )
-    float>bits
-    [ -31 shift 15 shift ] [
-        HEX: 7fffffff bitand
-        dup zero? [
-            dup HEX: 7f800000 >= [ -13 shift HEX: 7fff bitand ] [
-                -13 shift
-                112 10 shift -
-                0 HEX: 7c00 clamp
-            ] if
-        ] unless
-    ] bi bitor ;
-
-: bits>half ( bits -- float )
-    [ -15 shift 31 shift ] [
-        HEX: 7fff bitand
-        dup zero? [
-            dup HEX: 7c00 >= [ 13 shift HEX: 7f800000 bitor ] [
-                13 shift
-                112 23 shift + 
-            ] if
-        ] unless
-    ] bi bitor bits>float ;
-
-SYMBOL: half
-
-<<
-
-<c-type>
-    float >>class
-    float >>boxed-class
-    [ alien-unsigned-2 bits>half ] >>getter
-    [ [ >float half>bits ] 2dip set-alien-unsigned-2 ] >>setter
-    2 >>size
-    2 >>align
-    2 >>align-first
-    [ >float ] >>unboxer-quot
-\ half define-primitive-type
-
->>
diff --git a/basis/half-floats/summary.txt b/basis/half-floats/summary.txt
deleted file mode 100644 (file)
index b22448f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Half-precision float support for FFI
index 677daca69de52e85006fbfe78c9b4388248614f2..28d18cb53acce3ab053fa321b8ff34c3cdcce77d 100644 (file)
@@ -35,7 +35,7 @@ TUPLE: max-heap < heap ;
 : <max-heap> ( -- max-heap ) max-heap <heap> ;
 
 M: heap heap-empty? ( heap -- ? )
-    data>> empty? ;
+    data>> empty? ; inline
 
 M: heap heap-size ( heap -- n )
     data>> length ;
index 6fb4c562cfd9038fe9e8b4c0451ee2557c1b078b..99f40622eab3dd078dff1682da9b4a15ab27aab0 100644 (file)
@@ -62,4 +62,4 @@ ARTICLE: "crossref-test-1" "Crossref test 1"
 ARTICLE: "crossref-test-2" "Crossref test 2"
 { $markup-example { $subsection "crossref-test-1" } } ;
 
-[ V{ } ] [ "crossref-test-2" >link article-children ] unit-test
+[ { } ] [ "crossref-test-2" >link article-children ] unit-test
index 91ee1c9c79164ccb0c0bfb1c478b7b7196482abf..076fa593524a3f1d884a3911c707d65c53478a08 100644 (file)
@@ -11,7 +11,7 @@ M: link definer drop \ ARTICLE: \ ; ;
 
 M: link where name>> article loc>> ;
 
-M: link set-where name>> article (>>loc) ;
+M: link set-where name>> article loc<< ;
 
 M: link forget* name>> remove-article ;
 
index e3a7af6fc2b3c2a43b757cb06a3ed8f1edbc0bb6..da5f2911f836cc436eed65a64b89ecf4ed1cec38 100644 (file)
@@ -166,6 +166,7 @@ ARTICLE: "collections" "Collections"
 }
 { $heading "Other collections" }
 { $subsections
+    "sets"
     "lists"
     "disjoint-sets"
     "interval-maps"
index 632cdb46e258adb113b098572a161b03fee0a366..cd389d6367de3e22db17a2fcd1a4e764f519cdc2 100644 (file)
@@ -6,6 +6,7 @@ help help.markup help.topics io.streams.string kernel macros
 namespaces sequences sequences.deep sets sorting splitting
 strings unicode.categories values vocabs vocabs.loader words
 words.symbol summary debugger io ;
+FROM: sets => members ;
 IN: help.lint.checks
 
 ERROR: simple-lint-error message ;
@@ -33,13 +34,29 @@ SYMBOL: vocab-articles
 
 : extract-values ( element -- seq )
     \ $values swap elements dup empty? [
-        first rest [ first ] map
+        first rest keys
+    ] unless ;
+
+: extract-value-effects ( element -- seq )
+    \ $values swap elements dup empty? [
+        first rest [ 
+            \ $quotation swap elements dup empty? [ drop f ] [
+                first second
+            ] if
+        ] map
     ] unless ;
 
 : effect-values ( word -- seq )
     stack-effect
     [ in>> ] [ out>> ] bi append
-    [ dup pair? [ first ] when effect>string ] map prune ;
+    [ dup pair? [ first ] when effect>string ] map members ;
+
+: effect-effects ( word -- seq )
+    stack-effect in>> [
+        dup pair?
+        [ second dup effect? [ effect>string ] [ drop f ] if ]
+        [ drop f ] if
+    ] map ;
 
 : contains-funky-elements? ( element -- ? )
     {
@@ -70,9 +87,16 @@ SYMBOL: vocab-articles
             [ effect-values ]
             [ extract-values ]
             bi* sequence=
-        ]
+        ] 
     } 2|| [ "$values don't match stack effect" simple-lint-error ] unless ;
 
+: check-value-effects ( word element -- )
+    [ effect-effects ]
+    [ extract-value-effects ]
+    bi* [ 2dup and [ = ] [ 2drop t ] if ] 2all?
+    [ "$quotation documentation in $values don't match stack effect" simple-lint-error ]
+    unless ;
+
 : check-nulls ( element -- )
     \ $values swap elements
     null swap deep-member?
@@ -80,7 +104,7 @@ SYMBOL: vocab-articles
 
 : check-see-also ( element -- )
     \ $see-also swap elements [
-        rest dup prune [ length ] bi@ assert=
+        rest all-unique? t assert=
     ] each ;
 
 : vocab-exists? ( name -- ? )
index 47b8820f18d87b4466e66ac2fbc71c44edb1015e..7112eb5da97443e8d42bcf65b8eba47a27984396 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2006, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs continuations fry help help.lint.checks
-help.topics io kernel namespaces parser sequences
-source-files.errors vocabs.hierarchy vocabs words classes
-locals tools.errors listener ;
+USING: assocs combinators continuations fry help
+help.lint.checks help.topics io kernel namespaces parser
+sequences source-files.errors vocabs.hierarchy vocabs words
+classes locals tools.errors listener ;
 FROM: help.lint.checks => all-vocabs ;
 FROM: vocabs => child-vocabs ;
 IN: help.lint
@@ -49,10 +49,12 @@ PRIVATE>
     [ with-file-vocabs ] vocabs-quot set
     dup word-help [
         [ >link ] keep '[
-            _ dup word-help
-            [ check-values ]
-            [ check-class-description ]
-            [ nip [ check-nulls ] [ check-see-also ] [ check-markup ] tri ] 2tri
+            _ dup word-help {
+                [ check-values ]
+                [ check-value-effects ]
+                [ check-class-description ]
+                [ nip [ check-nulls ] [ check-see-also ] [ check-markup ] tri ]
+            } 2cleave
         ] check-something
     ] [ drop ] if ;
 
index f951f30b2f673f8c156fe37e422bc9e8e884faa6..ce954eae986a0249cfa7a8ffce8d0690a1c905a8 100644 (file)
@@ -8,6 +8,7 @@ prettyprint.stylesheet quotations see sequences sets slots
 sorting splitting strings vectors vocabs vocabs.loader words
 words.symbol ;
 FROM: prettyprint.sections => with-pprint ;
+FROM: namespaces => set ;
 IN: help.markup
 
 PREDICATE: simple-element < array
@@ -441,7 +442,7 @@ M: array elements*
 : elements ( elt-type element -- seq ) [ elements* ] { } make ;
 
 : collect-elements ( element seq -- elements )
-    swap '[ _ elements [ rest ] map concat ] map concat prune ;
+    swap '[ _ elements [ rest ] map concat ] gather ;
 
 : <$link> ( topic -- element )
     1array \ $link prefix ;
index 06f2255dfaa0f28a9f089fa287b2fe142c491ac6..241e54d967c746261b61a13626fe622aca48746d 100644 (file)
@@ -14,7 +14,7 @@ M: tip forget* tips get remove-eq! drop ;
 
 M: tip where loc>> ;
 
-M: tip set-where (>>loc) ;
+M: tip set-where loc<< ;
 
 : <tip> ( content -- tip ) f tip boa ;
 
index 894e1dbdc8ec47a236cf341236ae1872a07091d2..fcceab18785e50df333102e6de7a476f9e07c841 100644 (file)
@@ -9,4 +9,4 @@ M: hashtable blahblah 2nip [ 1 + ] change-count drop ;
 
 HINTS: M\ hashtable blahblah { object fixnum object } { object word object } ;
 
-[ t ] [ M\ hashtable blahblah { count>> (>>count) } inlined? ] unit-test
+[ t ] [ M\ hashtable blahblah { count>> count<< } inlined? ] unit-test
index 558f7dd8a4ddef0b0204705c96d1ac2241d34469..dc16cf8b246b4b7e99eb9db215f3721ad1516339 100644 (file)
@@ -2,10 +2,10 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs byte-arrays byte-vectors classes
 combinators definitions effects fry generic generic.single
-generic.standard hashtables io.binary io.streams.string kernel
-kernel.private math math.integers.private math.parser
-namespaces parser sbufs sequences splitting splitting.private strings
-vectors words ;
+generic.standard hashtables io.binary io.encodings
+io.streams.string kernel kernel.private math
+math.integers.private math.parser namespaces parser sbufs
+sequences splitting splitting.private strings vectors words ;
 IN: hints
 
 GENERIC: specializer-predicate ( spec -- quot )
@@ -131,3 +131,5 @@ M\ hashtable at* { { fixnum object } { word object } } "specializer" set-word-pr
 M\ hashtable set-at { { object fixnum object } { object word object } } "specializer" set-word-prop
 
 \ bignum/f { { bignum bignum } { bignum fixnum } { fixnum bignum } { fixnum fixnum } } "specializer" set-word-prop
+
+\ encode-string { string object object } "specializer" set-word-prop
index c35237b403c87cc23ea19051c59087f2baa0fdf1..3b4f1d6ae3254cbc790850da236da2207749afc6 100644 (file)
@@ -29,7 +29,7 @@ HELP: textarea
 { $class-description "Text area components display a multi-line editor for a string value. The " { $slot "rows" } " and " { $slot "cols" } " properties determine the size of the text area." } ;
 
 HELP: link
-{ $description "Link components render a link to an object stored at a value, with the link title and URL determined by the " { $link link-title } " and " { $link link-href } " generic words. The optional " { $slot "target" } " slot is a target frame to open the link in." } ;
+{ $description "Link components render a value responding to the " { $link link-title } " and " { $link link-href } " generic words. The optional " { $slot "target" } " slot is a target frame to open the link in." } ;
 
 HELP: link-title
 { $values { "obj" object } { "string" string } }
index 9dddb856196be32ae008e83cc8b6f12ae80310ce..5a2a55bfd0a3a6f81945ec03c009c889909d2549 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008, 2009 Slava Pestov, Daniel Ehrenberg
+! Copyright (C) 2008, 2010 Slava Pestov, Daniel Ehrenberg
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel namespaces io math.parser assocs classes
 classes.tuple words arrays sequences splitting mirrors
@@ -117,6 +117,13 @@ M: string link-href ;
 M: url link-title ;
 M: url link-href ;
 
+TUPLE: simple-link title href ;
+
+C: <simple-link> simple-link
+
+M: simple-link link-title title>> ;
+M: simple-link link-href href>> ;
+
 TUPLE: link target ;
 
 M: link render*
index 41653cb85adec43024f24a37088bfff4ff76383b..a3032aba96ef2ae0055613de92b00099cf6f7ba4 100644 (file)
@@ -60,7 +60,7 @@ HELP: compile-with-scope
 { $description "Calls the quotation and wraps any output it compiles in a " { $link with-scope } " form." } ;
 
 ARTICLE: "html.templates.chloe.tags.component" "Component Chloe tags"
-"The following Chloe tags correspond exactly to " { $link "html.components" } ". Singleton component tags do not allow any attributes. Attributes of tuple component tags are mapped to tuple slot values of the component instance."
+"The following Chloe tags correspond exactly to " { $link "html.components" } ". The " { $snippet "name" } " attribute should be the name of a form value (see " { $link "html.forms.values" } "). Singleton component tags do not allow any other attributes. Tuple component tags map all other attributes to tuple slot values of the component instance."
 { $table
     { "Tag" "Component class" }
     { { $snippet "t:checkbox" }   { $link checkbox } }
index 482a23aeaa644328712528762155b16e210b9202..aa2fc8962b85e87f9adaf3360ab3da2fc28654d3 100644 (file)
@@ -1,13 +1,13 @@
-! Copyright (C) 2005, 2009 Slava Pestov.
+! Copyright (C) 2005, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: assocs kernel math math.parser namespaces make
 sequences strings splitting calendar continuations accessors vectors
 math.order hashtables byte-arrays destructors
 io io.sockets io.streams.string io.files io.timeouts
 io.pathnames io.encodings io.encodings.string io.encodings.ascii
-io.encodings.utf8 io.encodings.binary io.crlf
+io.encodings.utf8 io.encodings.binary io.encodings.iana io.crlf
 io.streams.duplex fry ascii urls urls.encoding present locals
-http http.parsers http.client.post-data ;
+http http.parsers http.client.post-data mime.types ;
 IN: http.client
 
 ERROR: too-many-redirects ;
@@ -51,13 +51,18 @@ ERROR: too-many-redirects ;
     read-crlf parse-response-line first3
     [ >>version ] [ >>code ] [ >>message ] tri* ;
 
+: detect-encoding ( response -- encoding )
+    [ content-charset>> name>encoding ]
+    [ content-type>> mime-type-encoding ] bi
+    or ;
+
 : read-response-header ( response -- response )
     read-header >>header
     dup "set-cookie" header parse-set-cookie >>cookies
     dup "content-type" header [
         parse-content-type
-        [ >>content-type ]
-        [ >>content-charset ] bi*
+        [ >>content-type ] [ >>content-charset ] bi*
+        dup detect-encoding >>content-encoding
     ] when* ;
 
 : read-response ( -- response )
@@ -149,7 +154,7 @@ ERROR: download-failed response ;
 
 : http-request ( request -- response data )
     [ [ % ] with-http-request ] B{ } make
-    over content-charset>> decode check-response-with-body ;
+    over content-encoding>> decode check-response-with-body ;
 
 : <get-request> ( url -- request )
     "GET" <client-request> ;
@@ -189,6 +194,6 @@ ERROR: download-failed response ;
 : http-delete ( url -- response data )
     <delete-request> http-request ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"debugger" vocab [ "http.client.debugger" require ] when
+{ "http.client" "debugger" } "http.client.debugger" require-when
index 2de2323394634150def828ea5b12d533f7443e3f..a9695c667ad460f5f088b8afe69b342a56f80fd9 100644 (file)
@@ -35,7 +35,8 @@ $nl
     { { $slot "header" } { "An assoc of HTTP header values. See " { $link "http.headers" } } }
     { { $slot "cookies" } { "A sequence of HTTP cookies. See " { $link "http.cookies" } } }
     { { $slot "content-type" } { "an HTTP content type" } }
-    { { $slot "content-charset" } { "an encoding descriptor. See " { $link "io.encodings" } } }
+    { { $slot "content-charset" } { "an encoding name" } }
+    { { $slot "content-encoding" } { "an encoding descriptor. See " { $link "io.encodings" } } }
     { { $slot "body" } { "an HTTP response body" } }
 } } ;
 
index 35d01c10141d7ebbd6157cb02206af74dcc1039e..0c396ff4e94e8518b7046e8a6ee01b7c3bf5ac92 100644 (file)
@@ -6,13 +6,13 @@ continuations urls hashtables accessors namespaces xml.data
 io.encodings.8-bit.latin1 ;
 IN: http.tests
 
-[ "text/plain" latin1 ] [ "text/plain" parse-content-type ] unit-test
+[ "text/plain" "UTF-8" ] [ "text/plain" parse-content-type ] unit-test
 
-[ "text/html" utf8 ] [ "text/html;  charset=UTF-8" parse-content-type ] unit-test
+[ "text/html" "ASCII" ] [ "text/html;  charset=ASCII" parse-content-type ] unit-test
 
-[ "text/html" utf8 ] [ "text/html; charset=\"utf-8\"" parse-content-type ] unit-test
+[ "text/html" "utf-8" ] [ "text/html; charset=\"utf-8\"" parse-content-type ] unit-test
 
-[ "application/octet-stream" binary ] [ "application/octet-stream" parse-content-type ] unit-test
+[ "application/octet-stream" f ] [ "application/octet-stream" parse-content-type ] unit-test
 
 : lf>crlf ( string -- string' ) "\n" split "\r\n" join ;
 
@@ -115,7 +115,8 @@ blah
         { header H{ { "content-type" "text/html; charset=UTF-8" } } }
         { cookies { } }
         { content-type "text/html" }
-        { content-charset utf8 }
+        { content-charset "UTF-8" }
+        { content-encoding utf8 }
     }
 ] [
     read-response-test-1 lf>crlf
index 6f898e949cfadbe4f818528caf565fb12254653a..46b67b53216e76f313a54745907eb212baa1117b 100644 (file)
@@ -1,11 +1,11 @@
-! Copyright (C) 2003, 2008 Slava Pestov.
+! Copyright (C) 2003, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel combinators math namespaces make assocs
 sequences splitting sorting sets strings vectors hashtables
 quotations arrays byte-arrays math.parser calendar
-calendar.format present urls fry
-io io.encodings io.encodings.iana io.encodings.binary
-io.crlf ascii io.encodings.8-bit.latin1 http.parsers base64 ;
+calendar.format present urls fry io io.encodings
+io.encodings.iana io.encodings.binary io.encodings.utf8 io.crlf
+ascii io.encodings.8-bit.latin1 http.parsers base64 mime.types ;
 IN: http
 
 CONSTANT: max-redirects 10
@@ -170,6 +170,7 @@ header
 cookies
 content-type
 content-charset
+content-encoding
 body ;
 
 : <response> ( -- response )
@@ -179,7 +180,7 @@ body ;
         "close" "connection" set-header
         now timestamp>http-string "date" set-header
         "Factor http.server" "server" set-header
-        latin1 >>content-charset
+        utf8 >>content-encoding
         V{ } clone >>cookies ;
 
 M: response clone
@@ -221,5 +222,5 @@ TUPLE: post-data data params content-type content-encoding ;
 
 : parse-content-type ( content-type -- type encoding )
     ";" split1
-    parse-content-type-attributes "charset" swap at name>encoding
-    [ dup "text/" head? latin1 binary ? ] unless* ;
+    parse-content-type-attributes "charset" swap at
+    [ dup mime-type-encoding encoding>name ] unless* ;
index 3902b7f5e284ec32c77149ed81e9348e3c646a8c..14527f5d68774fa69fee39369212920931b34e72 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: math.parser http accessors kernel xml.syntax xml.writer
 io io.streams.string io.encodings.utf8 ;
@@ -8,7 +8,7 @@ IN: http.server.responses
     <response>
         200 >>code
         "Document follows" >>message
-        utf8 >>content-charset
+        utf8 >>content-encoding
         swap >>content-type
         swap >>body ;
     
index 3dc97098a4271e6b0c66aad32ac83c4aa201e5e4..00e8710c7067d97c53e93342734e6030e5eeabe6 100644 (file)
@@ -4,16 +4,26 @@ IN: http.server.tests
 
 [ t ] [ [ \ + first ] [ <500> ] recover response? ] unit-test
 
-[ "text/plain; charset=UTF-8" ] [
+[ "text/plain; charset=ASCII" ] [
     <response>
         "text/plain" >>content-type
-        utf8 >>content-charset
+        "ASCII" >>content-charset
     unparse-content-type
 ] unit-test
 
-[ "text/xml" ] [
+[ "text/xml; charset=UTF-8" ] [
     <response>
         "text/xml" >>content-type
-        binary >>content-charset
+    unparse-content-type
+] unit-test
+
+[ "image/jpeg" ] [
+    <response>
+        "image/jpeg" >>content-type
+    unparse-content-type
+] unit-test
+
+[ "application/octet-stream" ] [
+    <response>
     unparse-content-type
 ] unit-test
\ No newline at end of file
index 131fe3fe186e0d2ea7bf0ec835d566cffa07d990..acdd71d10d2e3541d6f9159e02f60363140f07b7 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2003, 2009 Slava Pestov.
+! Copyright (C) 2003, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel accessors sequences arrays namespaces splitting
 vocabs.loader destructors assocs debugger continuations
@@ -26,6 +26,7 @@ http.server.remapping
 html.templates
 html.streams
 html
+mime.types
 xml.writer ;
 FROM: mime.multipart => parse-multipart ;
 IN: http.server
@@ -101,8 +102,10 @@ GENERIC: write-full-response ( request response -- )
     tri ;
 
 : unparse-content-type ( request -- content-type )
-    [ content-type>> "application/octet-stream" or ] [ content-charset>> ] bi
-    dup binary eq? [ drop ] [ encoding>name "; charset=" glue ] if ;
+    [ content-type>> ] [ content-charset>> ] bi
+    over mime-type-encoding encoding>name or
+    [ "application/octet-stream" or ] dip
+    [ "; charset=" glue ] when* ;
 
 : ensure-domain ( cookie -- cookie )
     [
@@ -133,7 +136,7 @@ M: response write-response ( respose -- )
 M: response write-full-response ( request response -- )
     dup write-response
     swap method>> "HEAD" = [
-        [ content-charset>> encode-output ]
+        [ content-encoding>> encode-output ]
         [ write-response-body ]
         bi
     ] unless drop ;
index f80a3cc7cde7338549bbedbae949cf1d354ac6f1..6b65cd5fe4bcd83fbebbe23fa33a6e6b04d0312e 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2004, 2009 Slava Pestov.\r
+! Copyright (C) 2004, 2010 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: calendar kernel math math.order math.parser namespaces\r
 parser sequences strings assocs hashtables debugger mime.types\r
@@ -16,11 +16,8 @@ TUPLE: file-responder root hook special allow-listings ;
     dup [ rfc822>timestamp ] when ;\r
 \r
 : modified-since? ( filename -- ? )\r
-    request get modified-since dup [\r
-        [ file-info modified>> ] dip after?\r
-    ] [\r
-        2drop t\r
-    ] if ;\r
+    request get modified-since dup\r
+    [ [ file-info modified>> ] dip after? ] [ 2drop t ] if ;\r
 \r
 : <file-responder> ( root hook -- responder )\r
     file-responder new\r
@@ -30,8 +27,8 @@ TUPLE: file-responder root hook special allow-listings ;
 \r
 : (serve-static) ( path mime-type -- response )\r
     [\r
-        [ binary <file-reader> &dispose ] dip\r
-        <content> binary >>content-charset\r
+        [ binary <file-reader> &dispose ] dip <content>\r
+        binary >>content-encoding\r
     ]\r
     [ drop file-info [ size>> ] [ modified>> ] bi ] 2bi\r
     [ "content-length" set-header ]\r
index cebbe2f51097e2912734acb09141811b7999bd5f..2ac2fed4d1d12fe7f503bd377560805dbf0ed21e 100644 (file)
@@ -1,4 +1,4 @@
-USING: images.bitmap images.bitmap.loading images.testing kernel ;
+USING: images.bitmap images.testing kernel ;
 IN: images.bitmap.tests
 
 ! "vocab:images/testing/bmp/1bit.bmp" decode-test
index fa12aaa3204729f86c1273ed7ee4715a647b3a84..424efb993afb464681d807540b103789b3c00512 100644 (file)
 USING: accessors alien alien.c-types arrays byte-arrays columns
 combinators compression.run-length endian fry grouping images
 images.loader images.normalization io io.binary
-io.encodings.binary io.encodings.string io.files
-io.streams.limited kernel locals macros math math.bitwise
-math.functions namespaces sequences specialized-arrays
-strings summary ;
+io.encodings.8-bit.latin1 io.encodings.binary
+io.encodings.string io.files io.streams.limited kernel locals
+macros math math.bitwise math.functions namespaces sequences
+specialized-arrays summary ;
+QUALIFIED-WITH: bitstreams b
 SPECIALIZED-ARRAYS: uint ushort ;
 IN: images.bitmap
 
+! http://www.fileformat.info/format/bmp/egff.htm
+! http://www.digicamsoft.com/bmp/bmp.html
+
 SINGLETON: bmp-image
 "bmp" bmp-image register-image-class
 
 : write2 ( n -- ) 2 >le write ;
 : write4 ( n -- ) 4 >le write ;
 
+ERROR: unknown-component-order bitmap ;
+ERROR: unknown-bitmap-header n ;
+
+: read2 ( -- n ) 2 read le> ;
+: read4 ( -- n ) 4 read le> ;
+
+TUPLE: loading-bitmap
+    file-header header
+    color-palette color-index bitfields ;
+
+TUPLE: file-header
+    { magic initial: "BM" }
+    { size }
+    { reserved1 initial: 0 }
+    { reserved2 initial: 0 }
+    { offset }
+    { header-length } ;
+
+TUPLE: v3-header
+    { width initial: 0 }
+    { height initial: 0 }
+    { planes initial: 0 }
+    { bit-count initial: 0 }
+    { compression initial: 0 }
+    { image-size initial: 0 }
+    { x-resolution initial: 0 }
+    { y-resolution initial: 0 }
+    { colors-used initial: 0 }
+    { colors-important initial: 0 } ;
+
+TUPLE: v4-header < v3-header
+    { red-mask initial: 0 }
+    { green-mask initial: 0 }
+    { blue-mask initial: 0 }
+    { alpha-mask initial: 0 }
+    { cs-type initial: 0 }
+    { end-points initial: 0 }
+    { gamma-red initial: 0 }
+    { gamma-green initial: 0 }
+    { gamma-blue initial: 0 } ;
+
+TUPLE: v5-header < v4-header
+    { intent initial: 0 }
+    { profile-data initial: 0 }
+    { profile-size initial: 0 }
+    { reserved3 initial: 0 } ;
+
+TUPLE: os2v1-header
+    { width initial: 0 }
+    { height initial: 0 }
+    { planes initial: 0 }
+    { bit-count initial: 0 } ;
+
+TUPLE: os2v2-header < os2v1-header
+    { compression initial: 0 }
+    { image-size initial: 0 }
+    { x-resolution initial: 0 }
+    { y-resolution initial: 0 }
+    { colors-used initial: 0 }
+    { colors-important initial: 0 }
+    { units initial: 0 }
+    { reserved initial: 0 }
+    { recording initial: 0 }
+    { rendering initial: 0 }
+    { size1 initial: 0 }
+    { size2 initial: 0 }
+    { color-encoding initial: 0 }
+    { identifier initial: 0 } ;
+
+UNION: v-header v3-header v4-header v5-header ;
+UNION: os2-header os2v1-header os2v2-header ;
+
+: parse-file-header ( -- file-header )
+    \ file-header new
+        2 read latin1 decode >>magic
+        read4 >>size
+        read2 >>reserved1
+        read2 >>reserved2
+        read4 >>offset
+        read4 >>header-length ;
+
+: read-v3-header-data ( header -- header )
+    read4 >>width
+    read4 32 >signed >>height
+    read2 >>planes
+    read2 >>bit-count
+    read4 >>compression
+    read4 >>image-size
+    read4 >>x-resolution
+    read4 >>y-resolution
+    read4 >>colors-used
+    read4 >>colors-important ;
+
+: read-v3-header ( -- header )
+    \ v3-header new
+        read-v3-header-data ;
+
+: read-v4-header-data ( header -- header )
+    read4 >>red-mask
+    read4 >>green-mask
+    read4 >>blue-mask
+    read4 >>alpha-mask
+    read4 >>cs-type
+    read4 read4 read4 3array >>end-points
+    read4 >>gamma-red
+    read4 >>gamma-green
+    read4 >>gamma-blue ;
+
+: read-v4-header ( -- v4-header )
+    \ v4-header new
+        read-v3-header-data
+        read-v4-header-data ;
+
+: read-v5-header-data ( v5-header -- v5-header )
+    read4 >>intent
+    read4 >>profile-data
+    read4 >>profile-size
+    read4 >>reserved3 ;
+
+: read-v5-header ( -- loading-bitmap )
+    \ v5-header new
+        read-v3-header-data
+        read-v4-header-data
+        read-v5-header-data ;
+
+: read-os2v1-header ( -- os2v1-header )
+    \ os2v1-header new
+        read2 >>width
+        read2 16 >signed >>height
+        read2 >>planes
+        read2 >>bit-count ;
+
+: read-os2v2-header-data ( os2v2-header -- os2v2-header )
+    read4 >>width
+    read4 32 >signed >>height
+    read2 >>planes
+    read2 >>bit-count
+    read4 >>compression
+    read4 >>image-size
+    read4 >>x-resolution
+    read4 >>y-resolution
+    read4 >>colors-used
+    read4 >>colors-important
+    read2 >>units
+    read2 >>reserved
+    read2 >>recording
+    read2 >>rendering
+    read4 >>size1
+    read4 >>size2
+    read4 >>color-encoding
+    read4 >>identifier ;
+
+: read-os2v2-header ( -- os2v2-header )
+    \ os2v2-header new
+        read-os2v2-header-data ;
+
+: parse-header ( n -- header )
+    {
+        { 12 [ read-os2v1-header ] }
+        { 64 [ read-os2v2-header ] }
+        { 40 [ read-v3-header ] }
+        { 108 [ read-v4-header ] }
+        { 124 [ read-v5-header ] }
+        [ unknown-bitmap-header ]
+    } case ;
+
+: color-index-length ( header -- n )
+    {
+        [ width>> ]
+        [ planes>> * ]
+        [ bit-count>> * 31 + 32 /i 4 * ]
+        [ height>> abs * ]
+    } cleave ;
+
+: color-palette-length ( loading-bitmap -- n )
+    file-header>>
+    [ offset>> 14 - ] [ header-length>> ] bi - ;
+
+: parse-color-palette ( loading-bitmap -- loading-bitmap )
+    dup color-palette-length read >>color-palette ;
+
+GENERIC: parse-color-data* ( loading-bitmap header -- loading-bitmap )
+
+: parse-color-data ( loading-bitmap -- loading-bitmap )
+    dup header>> parse-color-data* ;
+
+M: os2v1-header parse-color-data* ( loading-bitmap header -- loading-bitmap )
+    color-index-length read >>color-index ;
+
+M: object parse-color-data* ( loading-bitmap header -- loading-bitmap )
+    dup image-size>> [ 0 ] unless* dup 0 >
+    [ nip ] [ drop color-index-length ] if read >>color-index ;
+
+: alpha-used? ( loading-bitmap -- ? )
+    color-index>> 4 <sliced-groups> [ fourth 0 = ] all? not ;
+
+GENERIC: bitmap>component-order* ( loading-bitmap header -- object )
+
+: bitmap>component-order ( loading-bitmap -- object )
+    dup header>> bitmap>component-order* ;
+
+: simple-bitmap>component-order ( loading-bitamp -- object )
+    header>> bit-count>> {
+        { 32 [ BGRX ] }
+        { 24 [ BGR ] }
+        { 16 [ BGR ] }
+        { 8 [ BGR ] }
+        { 4 [ BGR ] }
+        { 1 [ BGR ] }
+        [ unknown-component-order ]
+    } case ;
+
+: advanced-bitmap>component-order ( loading-bitmap -- object )
+    [ ] [ header>> bit-count>> ] [ alpha-used? ] tri 2array {
+        { { 32 t } [ drop BGRA ] }
+        { { 32 f } [ drop BGRX ] }
+        [ drop simple-bitmap>component-order ]
+    } case ;
+
+: color-lookup3 ( loading-bitmap -- seq )
+    [ color-index>> >array ]
+    [ color-palette>> 3 <sliced-groups> ] bi
+    '[ _ nth ] map concat ;
+
+: color-lookup4 ( loading-bitmap -- seq )
+    [ color-index>> >array ]
+    [ color-palette>> 4 <sliced-groups> [ 3 head-slice ] map ] bi
+    '[ _ nth ] map concat ;
+
+! os2v1 is 3bytes each, all others are 3 + 1 unused
+: color-lookup ( loading-bitmap -- seq )
+    dup file-header>> header-length>> {
+        { 12 [ color-lookup3 ] }
+        { 64 [ color-lookup4 ] }
+        { 40 [ color-lookup4 ] }
+        { 108 [ color-lookup4 ] }
+        { 124 [ color-lookup4 ] }
+    } case ;
+
+M: os2v1-header bitmap>component-order* drop simple-bitmap>component-order ;
+M: os2v2-header bitmap>component-order* drop simple-bitmap>component-order ;
+M: v3-header bitmap>component-order* drop simple-bitmap>component-order ;
+M: v4-header bitmap>component-order* drop advanced-bitmap>component-order ;
+M: v5-header bitmap>component-order* drop advanced-bitmap>component-order ;
+
+: uncompress-bitfield ( seq masks -- bytes' )
+    '[
+        _ [
+            [ bitand ] [ bit-count ] [ log2 ] tri - shift
+        ] with map
+    ] { } map-as B{ } concat-as ;
+
+ERROR: bmp-not-supported n ;
+
+: bitmap>bytes ( loading-bitmap -- byte-array )
+    dup header>> bit-count>>
+    {
+        { 32 [ color-index>> ] }
+        { 24 [ color-index>> ] }
+        { 16 [
+            [
+                ! ushort-array-cast
+                2 group [ le> ] map
+                ! 5 6 5
+                ! { HEX: f800 HEX: 7e0 HEX: 1f } uncompress-bitfield
+                ! 5 5 5
+                { HEX: 7c00 HEX: 3e0 HEX: 1f } uncompress-bitfield
+            ] change-color-index
+            color-index>>
+        ] }
+        { 8 [ color-lookup ] }
+        { 4 [ [ 4 b:byte-array-n>seq ] change-color-index color-lookup ] }
+        { 1 [ [ 1 b:byte-array-n>seq ] change-color-index color-lookup ] }
+        [ bmp-not-supported ]
+    } case >byte-array ;
+
+: set-bitfield-widths ( loading-bitmap -- loading-bitmap' )
+    dup header>> bit-count>> {
+        { 16 [ dup color-palette>> 4 group [ le> ] map ] }
+        { 32 [ { HEX: ff0000 HEX: ff00 HEX: ff } ] }
+    } case reverse >>bitfields ;
+
+ERROR: unsupported-bitfield-widths n ;
+
+M: unsupported-bitfield-widths summary
+    drop "Bitmaps only support bitfield compression in 16/32bit images" ;
+
+: uncompress-bitfield-widths ( loading-bitmap -- loading-bitmap' )
+    set-bitfield-widths
+    dup header>> bit-count>> {
+        { 16 [
+            dup bitfields>> '[
+                ushort-array-cast _ uncompress-bitfield
+            ] change-color-index
+        ] }
+        { 32 [ ] }
+        [ unsupported-bitfield-widths ]
+    } case ;
+
+ERROR: unsupported-bitmap-compression compression ;
+
+GENERIC: uncompress-bitmap* ( loading-bitmap header -- loading-bitmap )
+
+: uncompress-bitmap ( loading-bitmap -- loading-bitmap )
+    dup header>> uncompress-bitmap* ;
+
+M: os2-header uncompress-bitmap* ( loading-bitmap header -- loading-bitmap' )
+    drop ;
+
+: do-run-length-uncompress ( loading-bitmap word -- loading-bitmap )
+    dupd '[
+        _ header>> [ width>> ] [ height>> ] bi
+        _ execute
+    ] change-color-index ; inline
+
+M: v-header uncompress-bitmap* ( loading-bitmap header -- loading-bitmap' )
+    compression>> {
+        { f [ ] }
+        { 0 [ ] }
+        { 1 [ \ run-length-uncompress-bitmap8 do-run-length-uncompress ] }
+        { 2 [ \ run-length-uncompress-bitmap4 do-run-length-uncompress ] }
+        { 3 [ uncompress-bitfield-widths ] }
+        { 4 [ "jpeg" unsupported-bitmap-compression ] }
+        { 5 [ "png" unsupported-bitmap-compression ] }
+    } case ;
+
+ERROR: unsupported-bitmap-file magic ;
+
+: load-bitmap ( stream -- loading-bitmap )
+    [
+        \ loading-bitmap new
+        parse-file-header [ >>file-header ] [ ] bi magic>> {
+            { "BM" [
+                dup file-header>> header-length>> parse-header >>header
+                parse-color-palette
+                parse-color-data
+            ] }
+            ! { "BA" [ parse-os2-bitmap-array ] }
+            ! { "CI" [ parse-os2-color-icon ] }
+            ! { "CP" [ parse-os2-color-pointer ] }
+            ! { "IC" [ parse-os2-icon ] }
+            ! { "PT" [ parse-os2-pointer ] }
+            [ unsupported-bitmap-file ]
+        } case
+    ] with-input-stream ;
+
+: loading-bitmap>bytes ( loading-bitmap -- byte-array )
+    uncompress-bitmap bitmap>bytes ;
+
+M: bmp-image stream>image ( stream bmp-image -- bitmap )
+    drop load-bitmap
+    [ image new ] dip
+    {
+        [ loading-bitmap>bytes >>bitmap ]
+        [ header>> [ width>> ] [ height>> abs ] bi 2array >>dim ]
+        [ header>> height>> 0 < not >>upside-down? ]
+        [ bitmap>component-order >>component-order ubyte-components >>component-type ]
+    } cleave ;
+
 : output-width-and-height ( image -- )
     [ dim>> first write4 ]
     [
index 702fd14472fa2f2dc45a6035b93cff0c2c0fa8cb..16e0e459f5c117b713b0ae2dfe25550efea5330c 100644 (file)
@@ -5,368 +5,3 @@ compression.run-length fry grouping images images.loader io
 io.binary io.encodings.binary
 io.encodings.string io.streams.limited kernel math math.bitwise
 io.encodings.8-bit.latin1 sequences specialized-arrays summary images.bitmap ;
-QUALIFIED-WITH: bitstreams b
-SPECIALIZED-ARRAY: ushort
-IN: images.bitmap.loading
-
-! http://www.fileformat.info/format/bmp/egff.htm
-! http://www.digicamsoft.com/bmp/bmp.html
-
-ERROR: unknown-component-order bitmap ;
-ERROR: unknown-bitmap-header n ;
-
-: read2 ( -- n ) 2 read le> ;
-: read4 ( -- n ) 4 read le> ;
-
-TUPLE: loading-bitmap
-    file-header header
-    color-palette color-index bitfields ;
-
-TUPLE: file-header
-    { magic initial: "BM" }
-    { size }
-    { reserved1 initial: 0 }
-    { reserved2 initial: 0 }
-    { offset }
-    { header-length } ;
-
-TUPLE: v3-header
-    { width initial: 0 }
-    { height initial: 0 }
-    { planes initial: 0 }
-    { bit-count initial: 0 }
-    { compression initial: 0 }
-    { image-size initial: 0 }
-    { x-resolution initial: 0 }
-    { y-resolution initial: 0 }
-    { colors-used initial: 0 }
-    { colors-important initial: 0 } ;
-
-TUPLE: v4-header < v3-header
-    { red-mask initial: 0 }
-    { green-mask initial: 0 }
-    { blue-mask initial: 0 }
-    { alpha-mask initial: 0 }
-    { cs-type initial: 0 }
-    { end-points initial: 0 }
-    { gamma-red initial: 0 }
-    { gamma-green initial: 0 }
-    { gamma-blue initial: 0 } ;
-
-TUPLE: v5-header < v4-header
-    { intent initial: 0 }
-    { profile-data initial: 0 }
-    { profile-size initial: 0 }
-    { reserved3 initial: 0 } ;
-
-TUPLE: os2v1-header
-    { width initial: 0 }
-    { height initial: 0 }
-    { planes initial: 0 }
-    { bit-count initial: 0 } ;
-
-TUPLE: os2v2-header < os2v1-header
-    { compression initial: 0 }
-    { image-size initial: 0 }
-    { x-resolution initial: 0 }
-    { y-resolution initial: 0 }
-    { colors-used initial: 0 }
-    { colors-important initial: 0 }
-    { units initial: 0 }
-    { reserved initial: 0 }
-    { recording initial: 0 }
-    { rendering initial: 0 }
-    { size1 initial: 0 }
-    { size2 initial: 0 }
-    { color-encoding initial: 0 }
-    { identifier initial: 0 } ;
-
-UNION: v-header v3-header v4-header v5-header ;
-UNION: os2-header os2v1-header os2v2-header ;
-
-: parse-file-header ( -- file-header )
-    \ file-header new
-        2 read latin1 decode >>magic
-        read4 >>size
-        read2 >>reserved1
-        read2 >>reserved2
-        read4 >>offset
-        read4 >>header-length ;
-
-: read-v3-header-data ( header -- header )
-    read4 >>width
-    read4 32 >signed >>height
-    read2 >>planes
-    read2 >>bit-count
-    read4 >>compression
-    read4 >>image-size
-    read4 >>x-resolution
-    read4 >>y-resolution
-    read4 >>colors-used
-    read4 >>colors-important ;
-
-: read-v3-header ( -- header )
-    \ v3-header new
-        read-v3-header-data ;
-
-: read-v4-header-data ( header -- header )
-    read4 >>red-mask
-    read4 >>green-mask
-    read4 >>blue-mask
-    read4 >>alpha-mask
-    read4 >>cs-type
-    read4 read4 read4 3array >>end-points
-    read4 >>gamma-red
-    read4 >>gamma-green
-    read4 >>gamma-blue ;
-
-: read-v4-header ( -- v4-header )
-    \ v4-header new
-        read-v3-header-data
-        read-v4-header-data ;
-
-: read-v5-header-data ( v5-header -- v5-header )
-    read4 >>intent
-    read4 >>profile-data
-    read4 >>profile-size
-    read4 >>reserved3 ;
-
-: read-v5-header ( -- loading-bitmap )
-    \ v5-header new
-        read-v3-header-data
-        read-v4-header-data
-        read-v5-header-data ;
-
-: read-os2v1-header ( -- os2v1-header )
-    \ os2v1-header new
-        read2 >>width
-        read2 16 >signed >>height
-        read2 >>planes
-        read2 >>bit-count ;
-
-: read-os2v2-header-data ( os2v2-header -- os2v2-header )
-    read4 >>width
-    read4 32 >signed >>height
-    read2 >>planes
-    read2 >>bit-count
-    read4 >>compression
-    read4 >>image-size
-    read4 >>x-resolution
-    read4 >>y-resolution
-    read4 >>colors-used
-    read4 >>colors-important
-    read2 >>units
-    read2 >>reserved
-    read2 >>recording
-    read2 >>rendering
-    read4 >>size1
-    read4 >>size2
-    read4 >>color-encoding
-    read4 >>identifier ;
-
-: read-os2v2-header ( -- os2v2-header )
-    \ os2v2-header new
-        read-os2v2-header-data ;
-
-: parse-header ( n -- header )
-    {
-        { 12 [ read-os2v1-header ] }
-        { 64 [ read-os2v2-header ] }
-        { 40 [ read-v3-header ] }
-        { 108 [ read-v4-header ] }
-        { 124 [ read-v5-header ] }
-        [ unknown-bitmap-header ]
-    } case ;
-
-: color-index-length ( header -- n )
-    {
-        [ width>> ]
-        [ planes>> * ]
-        [ bit-count>> * 31 + 32 /i 4 * ]
-        [ height>> abs * ]
-    } cleave ;
-
-: color-palette-length ( loading-bitmap -- n )
-    file-header>>
-    [ offset>> 14 - ] [ header-length>> ] bi - ;
-
-: parse-color-palette ( loading-bitmap -- loading-bitmap )
-    dup color-palette-length read >>color-palette ;
-
-GENERIC: parse-color-data* ( loading-bitmap header -- loading-bitmap )
-
-: parse-color-data ( loading-bitmap -- loading-bitmap )
-    dup header>> parse-color-data* ;
-
-M: os2v1-header parse-color-data* ( loading-bitmap header -- loading-bitmap )
-    color-index-length read >>color-index ;
-
-M: object parse-color-data* ( loading-bitmap header -- loading-bitmap )
-    dup image-size>> [ 0 ] unless* dup 0 >
-    [ nip ] [ drop color-index-length ] if read >>color-index ;
-
-: alpha-used? ( loading-bitmap -- ? )
-    color-index>> 4 <sliced-groups> [ fourth 0 = ] all? not ;
-
-GENERIC: bitmap>component-order* ( loading-bitmap header -- object )
-
-: bitmap>component-order ( loading-bitmap -- object )
-    dup header>> bitmap>component-order* ;
-
-: simple-bitmap>component-order ( loading-bitamp -- object )
-    header>> bit-count>> {
-        { 32 [ BGRX ] }
-        { 24 [ BGR ] }
-        { 16 [ BGR ] }
-        { 8 [ BGR ] }
-        { 4 [ BGR ] }
-        { 1 [ BGR ] }
-        [ unknown-component-order ]
-    } case ;
-
-: advanced-bitmap>component-order ( loading-bitmap -- object )
-    [ ] [ header>> bit-count>> ] [ alpha-used? ] tri 2array {
-        { { 32 t } [ drop BGRA ] }
-        { { 32 f } [ drop BGRX ] }
-        [ drop simple-bitmap>component-order ]
-    } case ;
-
-: color-lookup3 ( loading-bitmap -- seq )
-    [ color-index>> >array ]
-    [ color-palette>> 3 <sliced-groups> ] bi
-    '[ _ nth ] map concat ;
-
-: color-lookup4 ( loading-bitmap -- seq )
-    [ color-index>> >array ]
-    [ color-palette>> 4 <sliced-groups> [ 3 head-slice ] map ] bi
-    '[ _ nth ] map concat ;
-
-! os2v1 is 3bytes each, all others are 3 + 1 unused
-: color-lookup ( loading-bitmap -- seq )
-    dup file-header>> header-length>> {
-        { 12 [ color-lookup3 ] }
-        { 64 [ color-lookup4 ] }
-        { 40 [ color-lookup4 ] }
-        { 108 [ color-lookup4 ] }
-        { 124 [ color-lookup4 ] }
-    } case ;
-
-M: os2v1-header bitmap>component-order* drop simple-bitmap>component-order ;
-M: os2v2-header bitmap>component-order* drop simple-bitmap>component-order ;
-M: v3-header bitmap>component-order* drop simple-bitmap>component-order ;
-M: v4-header bitmap>component-order* drop advanced-bitmap>component-order ;
-M: v5-header bitmap>component-order* drop advanced-bitmap>component-order ;
-
-: uncompress-bitfield ( seq masks -- bytes' )
-    '[
-        _ [
-            [ bitand ] [ bit-count ] [ log2 ] tri - shift
-        ] with map
-    ] { } map-as B{ } concat-as ;
-
-ERROR: bmp-not-supported n ;
-
-: bitmap>bytes ( loading-bitmap -- byte-array )
-    dup header>> bit-count>>
-    {
-        { 32 [ color-index>> ] }
-        { 24 [ color-index>> ] }
-        { 16 [
-            [
-                ! byte-array>ushort-array
-                2 group [ le> ] map
-                ! 5 6 5
-                ! { HEX: f800 HEX: 7e0 HEX: 1f } uncompress-bitfield
-                ! 5 5 5
-                { HEX: 7c00 HEX: 3e0 HEX: 1f } uncompress-bitfield
-            ] change-color-index
-            color-index>>
-        ] }
-        { 8 [ color-lookup ] }
-        { 4 [ [ 4 b:byte-array-n>seq ] change-color-index color-lookup ] }
-        { 1 [ [ 1 b:byte-array-n>seq ] change-color-index color-lookup ] }
-        [ bmp-not-supported ]
-    } case >byte-array ;
-
-: set-bitfield-widths ( loading-bitmap -- loading-bitmap' )
-    dup header>> bit-count>> {
-        { 16 [ dup color-palette>> 4 group [ le> ] map ] }
-        { 32 [ { HEX: ff0000 HEX: ff00 HEX: ff } ] }
-    } case reverse >>bitfields ;
-
-ERROR: unsupported-bitfield-widths n ;
-
-M: unsupported-bitfield-widths summary
-    drop "Bitmaps only support bitfield compression in 16/32bit images" ;
-
-: uncompress-bitfield-widths ( loading-bitmap -- loading-bitmap' )
-    set-bitfield-widths
-    dup header>> bit-count>> {
-        { 16 [
-            dup bitfields>> '[
-                byte-array>ushort-array _ uncompress-bitfield
-            ] change-color-index
-        ] }
-        { 32 [ ] }
-        [ unsupported-bitfield-widths ]
-    } case ;
-
-ERROR: unsupported-bitmap-compression compression ;
-
-GENERIC: uncompress-bitmap* ( loading-bitmap header -- loading-bitmap )
-
-: uncompress-bitmap ( loading-bitmap -- loading-bitmap )
-    dup header>> uncompress-bitmap* ;
-
-M: os2-header uncompress-bitmap* ( loading-bitmap header -- loading-bitmap' )
-    drop ;
-
-: do-run-length-uncompress ( loading-bitmap word -- loading-bitmap )
-    dupd '[
-        _ header>> [ width>> ] [ height>> ] bi
-        _ execute
-    ] change-color-index ; inline
-
-M: v-header uncompress-bitmap* ( loading-bitmap header -- loading-bitmap' )
-    compression>> {
-        { f [ ] }
-        { 0 [ ] }
-        { 1 [ \ run-length-uncompress-bitmap8 do-run-length-uncompress ] }
-        { 2 [ \ run-length-uncompress-bitmap4 do-run-length-uncompress ] }
-        { 3 [ uncompress-bitfield-widths ] }
-        { 4 [ "jpeg" unsupported-bitmap-compression ] }
-        { 5 [ "png" unsupported-bitmap-compression ] }
-    } case ;
-
-ERROR: unsupported-bitmap-file magic ;
-
-: load-bitmap ( stream -- loading-bitmap )
-    [
-        \ loading-bitmap new
-        parse-file-header [ >>file-header ] [ ] bi magic>> {
-            { "BM" [
-                dup file-header>> header-length>> parse-header >>header
-                parse-color-palette
-                parse-color-data
-            ] }
-            ! { "BA" [ parse-os2-bitmap-array ] }
-            ! { "CI" [ parse-os2-color-icon ] }
-            ! { "CP" [ parse-os2-color-pointer ] }
-            ! { "IC" [ parse-os2-icon ] }
-            ! { "PT" [ parse-os2-pointer ] }
-            [ unsupported-bitmap-file ]
-        } case
-    ] with-input-stream ;
-
-: loading-bitmap>bytes ( loading-bitmap -- byte-array )
-    uncompress-bitmap bitmap>bytes ;
-
-M: bmp-image stream>image ( stream bmp-image -- bitmap )
-    drop load-bitmap
-    [ image new ] dip
-    {
-        [ loading-bitmap>bytes >>bitmap ]
-        [ header>> [ width>> ] [ height>> abs ] bi 2array >>dim ]
-        [ header>> height>> 0 < not >>upside-down? ]
-        [ bitmap>component-order >>component-order ubyte-components >>component-type ]
-    } cleave ;
index db30faee33322a7cd7c7a9dc63afa56c6d4b1617..937c73ceb008d544d0c733cd260d6993b51066d8 100644 (file)
@@ -80,7 +80,7 @@ TUPLE: jpeg-color-info
 : jpeg> ( -- jpeg-image ) jpeg-image get ;
 
 : apply-diff ( dc color -- dc' )
-    [ diff>> + dup ] [ (>>diff) ] bi ;
+    [ diff>> + dup ] [ diff<< ] bi ;
 
 : fetch-tables ( component -- )
     [ [ jpeg> quant-tables>> nth ] change-quant-table drop ]
@@ -98,7 +98,7 @@ TUPLE: jpeg-color-info
         read1 8 assert=
         2 read be>
         2 read be>
-        swap 2array jpeg> (>>dim)
+        swap 2array jpeg> dim<<
         read1
         [
             read1 read4/4 read1 <jpeg-color-info>
@@ -141,7 +141,7 @@ TUPLE: jpeg-color-info
         [   drop
             read1 jpeg> color-info>> nth clone
             read1 16 /mod [ >>dc-huff-table ] [ >>ac-huff-table ] bi*
-        ] map jpeg> (>>components)
+        ] map jpeg> components<<
         read1 0 assert=
         read1 63 assert=
         read1 16 /mod [ 0 assert= ] bi@
@@ -346,7 +346,7 @@ SINGLETONS: YUV420 YUV444 Y MAGIC! ;
 
 : baseline-decompress ( -- )
     jpeg> bitstream>> cleanup-bitstream { 255 255 255 255 } append
-    >byte-array bs:<msb0-bit-reader> jpeg> (>>bitstream)
+    >byte-array bs:<msb0-bit-reader> jpeg> bitstream<<
     jpeg> 
     [ bitstream>> ] 
     [ [ [ <huffman-decoder> ] with map ] change-huff-tables drop ] bi
index c85aed413f925f25a82563177ff8f6b6792ed8a7..3dd270f2c2f6985cf7c59dcae42ce410f1d002fb 100644 (file)
@@ -7,72 +7,87 @@ IN: images.normalization.tests
 ! 1>x
 
 [ B{ 255 255 } ]
-[ B{ 0 1 } A L permute ] unit-test
+[ B{ 0 1 } 2 2 A L permute ] unit-test
 
 [ B{ 255 255 255 255 } ]
-[ B{ 0 1 } A RG permute ] unit-test
+[ B{ 0 1 } 2 2 A RG permute ] unit-test
 
 [ B{ 255 255 255 255 255 255 } ]
-[ B{ 0 1 } A BGR permute ] unit-test
+[ B{ 0 1 } 2 2 A BGR permute ] unit-test
 
 [ B{ 0 255 255 255 1 255 255 255 } ]
-[ B{ 0 1 } A ABGR permute ] unit-test
+[ B{ 0 1 } 2 2 A ABGR permute ] unit-test
+
+! Difference stride
+! The last byte is padding, so it should not end up in the image
+
+[ B{ 255 255 } ]
+[ B{ 0 1 0 } 2 3 A L permute ] unit-test
+
+[ B{ 255 255 255 255 } ]
+[ B{ 0 1 0 } 2 3 A RG permute ] unit-test
+
+[ B{ 255 255 255 255 255 255 } ]
+[ B{ 0 1 0 } 2 3 A BGR permute ] unit-test
+
+[ B{ 0 255 255 255 1 255 255 255 } ]
+[ B{ 0 1 0 } 2 3 A ABGR permute ] unit-test
 
 ! 2>x
 
 [ B{ 0 2 } ]
-[ B{ 0 1 2 3 } LA L permute ] unit-test
+[ B{ 0 1 2 3 } 2 4 LA L permute ] unit-test
 
 [ B{ 255 255 255 255 } ]
-[ B{ 0 1 2 3 } LA RG permute ] unit-test
+[ B{ 0 1 2 3 } 2 4 LA RG permute ] unit-test
 
 [ B{ 255 255 255 255 255 255 } ]
-[ B{ 0 1 2 3 } LA BGR permute ] unit-test
+[ B{ 0 1 2 3 } 2 4 LA BGR permute ] unit-test
 
 [ B{ 1 255 255 255 3 255 255 255 } ]
-[ B{ 0 1 2 3 } LA ABGR permute ] unit-test
+[ B{ 0 1 2 3 } 2 4 LA ABGR permute ] unit-test
 
 ! 3>x
 
 [ B{ 255 255 } ]
-[ B{ 0 1 2 3 4 5 } RGB L permute ] unit-test
+[ B{ 0 1 2 3 4 5 } 2 6 RGB L permute ] unit-test
 
 [ B{ 0 1 3 4 } ]
-[ B{ 0 1 2 3 4 5 } RGB RG permute ] unit-test
+[ B{ 0 1 2 3 4 5 } 2 6 RGB RG permute ] unit-test
 
 [ B{ 2 1 0 5 4 3 } ]
-[ B{ 0 1 2 3 4 5 } RGB BGR permute ] unit-test
+[ B{ 0 1 2 3 4 5 } 2 6 RGB BGR permute ] unit-test
 
 [ B{ 255 2 1 0 255 5 4 3 } ]
-[ B{ 0 1 2 3 4 5 } RGB ABGR permute ] unit-test
+[ B{ 0 1 2 3 4 5 } 2 6 RGB ABGR permute ] unit-test
 
 ! 4>x
 
 [ B{ 255 255 } ]
-[ B{ 0 1 2 3 4 5 6 7 } RGBA L permute ] unit-test
+[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA L permute ] unit-test
 
 [ B{ 0 1 4 5 } ]
-[ B{ 0 1 2 3 4 5 6 7 } RGBA RG permute ] unit-test
+[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA RG permute ] unit-test
 
 [ B{ 2 1 0 6 5 4 } ]
-[ B{ 0 1 2 3 4 5 6 7 } RGBA BGR permute ] unit-test
+[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA BGR permute ] unit-test
 
 [ B{ 3 2 1 0 7 6 5 4 } ]
-[ B{ 0 1 2 3 4 5 6 7 } RGBA ABGR permute ] unit-test
+[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA ABGR permute ] unit-test
 
 ! Edge cases
 
 [ B{ 0 4 } ]
-[ B{ 0 1 2 3 4 5 6 7 } RGBA R permute ] unit-test
+[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA R permute ] unit-test
 
 [ B{ 255 0 1 2 255 4 5 6 } ]
-[ B{ 0 1 2 3 4 5 6 7 } RGBA XRGB permute ] unit-test
+[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA XRGB permute ] unit-test
 
 [ B{ 1 2 3 255 5 6 7 255 } ]
-[ B{ 0 1 2 3 4 5 6 7 } XRGB RGBA permute ] unit-test
+[ B{ 0 1 2 3 4 5 6 7 } 2 8 XRGB RGBA permute ] unit-test
 
 [ B{ 255 255 255 255 255 255 255 255 } ]
-[ B{ 0 1 } L RGBA permute ] unit-test
+[ B{ 0 1 } 2 2 L RGBA permute ] unit-test
 
 ! Invalid inputs
 
index 6eaca01e15c4bc3d24283c1d3c6be2619200bedc..aa85057ee9f70e4d214be5a242637791ca7a6df4 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types byte-arrays combinators fry
 grouping images kernel locals math math.vectors
-sequences specialized-arrays half-floats ;
+sequences specialized-arrays math.floats.half ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: half
 SPECIALIZED-ARRAY: float
@@ -25,15 +25,21 @@ CONSTANT: fill-value 255
         dup 4 >= [ drop fill-value ] [ _ nth ] if
     ] B{ } map-as ;
 
-:: permute ( bytes src-order dst-order -- new-bytes )
+:: permute ( bytes width stride src-order dst-order -- new-bytes )
     src-order name>> :> src
     dst-order name>> :> dst
-    bytes src length group
-    [ pad4 src dst permutation shuffle dst length head ]
-    map concat ;
+    bytes stride group
+    [
+        src length group width head
+        [ pad4 src dst permutation shuffle dst length head ] map concat
+    ] map concat ;
+
+: stride ( image -- n )
+    [ bitmap>> length ] [ dim>> second ] bi / ;
 
 : (reorder-components) ( image src-order dest-order -- image )
-    [ permute ] 2curry change-bitmap ;
+    [ [ ] [ dim>> first ] [ stride ] tri ] 2dip
+    '[ _ _ _ _ permute ] change-bitmap ;
 
 GENERIC: normalize-component-type* ( image component-type -- image )
 
@@ -41,13 +47,13 @@ GENERIC: normalize-component-type* ( image component-type -- image )
     [ 255.0 * >integer ] B{ } map-as ;
 
 M: float-components normalize-component-type*
-    drop byte-array>float-array normalize-floats ;
+    drop float-array-cast normalize-floats ;
 
 M: half-components normalize-component-type*
-    drop byte-array>half-array normalize-floats ;
+    drop half-array-cast normalize-floats ;
 
 : ushorts>ubytes ( bitmap -- bitmap' )
-    byte-array>ushort-array [ -8 shift ] B{ } map-as ; inline
+    ushort-array-cast [ -8 shift ] B{ } map-as ; inline
 
 M: ushort-components normalize-component-type*
     drop ushorts>ubytes ;
diff --git a/basis/images/pbm/authors.txt b/basis/images/pbm/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/basis/images/pbm/pbm-tests.factor b/basis/images/pbm/pbm-tests.factor
new file mode 100644 (file)
index 0000000..73558cc
--- /dev/null
@@ -0,0 +1,7 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: images.testing ;
+IN: images.pbm.tests
+
+"vocab:images/testing/pbm/test.binary.pbm" decode-test
+"vocab:images/testing/pbm/test.ascii.pbm" decode-test
diff --git a/basis/images/pbm/pbm.factor b/basis/images/pbm/pbm.factor
new file mode 100644 (file)
index 0000000..9b8c7c1
--- /dev/null
@@ -0,0 +1,84 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays ascii bit-arrays byte-arrays combinators
+continuations grouping images images.loader io io.encodings.ascii
+io.encodings.string kernel locals make math math.functions math.parser
+sequences ;
+IN: images.pbm
+
+SINGLETON: pbm-image
+"pbm" pbm-image register-image-class
+
+<PRIVATE
+: read-token ( -- token )
+    [
+        read1 dup blank?
+        [ t ]
+        [
+            dup CHAR: # =
+            [ "\n" read-until 2drop t ]
+            [ f ] if
+        ] if
+    ] [ drop ] while
+    " \n\r\t" read-until drop swap
+    prefix ascii decode ;
+
+: read-number ( -- number )
+    read-token string>number ;
+
+: read-ascii-bits ( -- )
+    read1 {
+        { CHAR: 1 [ 0 , read-ascii-bits ] }
+        { CHAR: 0 [ 255 , read-ascii-bits ] }
+        { f [ ] }
+        [ drop read-ascii-bits ]
+    } case ;
+
+:: read-binary-bits ( width height -- )
+    width 8 align 8 / height * read
+    width 8 align 8 / <groups> [| row |
+        width iota [| n |
+            n 8 / floor row nth
+            n 8 mod 7 swap - bit?
+            [ 0 ] [ 255 ] if ,
+        ] each
+    ] each ;
+
+:: write-binary-bits ( bitmap width -- )
+    bitmap width <groups> [
+        width 8 align 255 pad-tail
+        8 <groups> [
+            [ 255 = [ f ] [ t ] if ] { } map-as
+            >bit-array reverse bit-array>integer
+            1array >byte-array write
+        ] each
+    ] each ;
+
+:: read-pbm ( -- image )
+    read-token     :> type
+    read-number    :> width
+    read-number    :> height
+
+    type {
+        { "P1" [ [ [ read-ascii-bits ] ignore-errors ] B{ } make ] }
+        { "P4" [ [ width height read-binary-bits ] B{ } make ] }
+    } case :> data
+
+    image new
+    L                >>component-order
+    { width height } >>dim
+    f                >>upside-down?
+    data             >>bitmap
+    ubyte-components >>component-type ;
+PRIVATE>
+
+M: pbm-image stream>image
+    drop [ read-pbm ] with-input-stream ;
+
+M: pbm-image image>stream
+    drop {
+        [ drop "P4\n" ascii encode write ]
+        [ dim>> first number>string " " append ascii encode write ]
+        [ dim>> second number>string "\n" append ascii encode write ]
+        [ [ bitmap>> ] [ dim>> first ] bi write-binary-bits ]
+    } cleave ;
diff --git a/basis/images/pbm/summary.txt b/basis/images/pbm/summary.txt
new file mode 100644 (file)
index 0000000..4f484f9
--- /dev/null
@@ -0,0 +1 @@
+Image loading for PBM image files.
diff --git a/basis/images/pgm/authors.txt b/basis/images/pgm/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/basis/images/pgm/pgm-tests.factor b/basis/images/pgm/pgm-tests.factor
new file mode 100644 (file)
index 0000000..7bfade4
--- /dev/null
@@ -0,0 +1,7 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: images.testing ;
+IN: images.pgm.tests
+
+"vocab:images/testing/pgm/radial.binary.pgm" decode-test
+"vocab:images/testing/pgm/radial.ascii.pgm" decode-test
diff --git a/basis/images/pgm/pgm.factor b/basis/images/pgm/pgm.factor
new file mode 100644 (file)
index 0000000..52e594d
--- /dev/null
@@ -0,0 +1,62 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types ascii combinators images images.loader
+io io.encodings.ascii io.encodings.string kernel locals make math
+math.parser sequences specialized-arrays ;
+SPECIALIZED-ARRAY: ushort
+IN: images.pgm
+
+SINGLETON: pgm-image
+"pgm" pgm-image register-image-class
+
+: read-token ( -- token )
+    [ read1 dup blank?
+      [ t ]
+      [ dup CHAR: # =
+        [ "\n" read-until 2drop t ]
+        [ f ] if
+      ] if
+    ] [ drop ] while
+    " \n\r\t" read-until drop swap
+    prefix ascii decode ;
+
+: read-number ( -- number )
+    read-token string>number ;
+
+:: read-numbers ( n lim -- )
+    n lim = [
+        read-number ,
+        n 1 + lim read-numbers
+    ] unless ;
+
+:: read-pgm ( -- image )
+    read-token         :> type
+    read-number        :> width
+    read-number        :> height
+    read-number        :> max
+    width height *     :> npixels
+    max 256 >=         :> wide
+    
+    type {
+        { "P2" [ [ 0 npixels read-numbers ] wide [ ushort-array{ } ] [ B{ } ] if make ] }
+        { "P5" [ wide [ 2 ] [ 1 ] if npixels * read ] }
+    } case :> data
+    
+    image new
+    L                                                  >>component-order
+    { width height }                                   >>dim
+    f                                                  >>upside-down?
+    data                                               >>bitmap
+    wide [ ushort-components ] [ ubyte-components ] if >>component-type ;
+
+M: pgm-image stream>image
+    drop [ read-pgm ] with-input-stream ;
+
+M: pgm-image image>stream
+    drop {
+        [ drop "P5\n" ascii encode write ]
+        [ dim>> first number>string " " append ascii encode write ]
+        [ dim>> second number>string "\n" append ascii encode write ]
+        [ component-type>> ubyte-components = [ "255\n" ] [ "65535\n" ] if ascii encode write ]
+        [ bitmap>> write ]
+    } cleave ;
diff --git a/basis/images/pgm/summary.txt b/basis/images/pgm/summary.txt
new file mode 100644 (file)
index 0000000..f558b7c
--- /dev/null
@@ -0,0 +1 @@
+Image loading for PGM image files.
diff --git a/basis/images/ppm/authors.txt b/basis/images/ppm/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/basis/images/ppm/ppm-tests.factor b/basis/images/ppm/ppm-tests.factor
new file mode 100644 (file)
index 0000000..208af76
--- /dev/null
@@ -0,0 +1,7 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: images.testing ;
+IN: images.ppm.tests
+
+"vocab:images/testing/ppm/binary.ppm" decode-test
+"vocab:images/testing/ppm/ascii.ppm" decode-test
diff --git a/basis/images/ppm/ppm.factor b/basis/images/ppm/ppm.factor
new file mode 100755 (executable)
index 0000000..9610189
--- /dev/null
@@ -0,0 +1,59 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors ascii combinators images images.loader io
+io.encodings.ascii io.encodings.string kernel locals make math
+math.parser sequences ;
+IN: images.ppm
+
+SINGLETON: ppm-image
+"ppm" ppm-image register-image-class
+
+: read-token ( -- token )
+    [ read1 dup blank?
+      [ t ]
+      [ dup CHAR: # =
+        [ "\n" read-until 2drop t ]
+        [ f ] if
+      ] if
+    ] [ drop ] while
+    " \n\r\t" read-until drop swap
+    prefix ascii decode ;
+
+: read-number ( -- number )
+    read-token string>number ;
+
+:: read-numbers ( n lim -- )
+    n lim = [
+        read-number ,
+        n 1 + lim read-numbers
+    ] unless ;
+
+:: read-ppm ( -- image )
+    read-token         :> type
+    read-number        :> width
+    read-number        :> height
+    read-number        :> max
+    width height 3 * * :> npixels
+    type {
+        { "P3" [ [ 0 npixels read-numbers ] B{ } make ] }
+        { "P6" [ npixels read ] }
+    } case :> data
+    
+    image new
+    RGB              >>component-order
+    { width height } >>dim
+    f                >>upside-down?
+    data             >>bitmap
+    ubyte-components >>component-type ;
+
+M: ppm-image stream>image
+    drop [ read-ppm ] with-input-stream ;
+
+M: ppm-image image>stream
+    drop {
+        [ drop "P6\n" ascii encode write ]
+        [ dim>> first number>string " " append ascii encode write ]
+        [ dim>> second number>string "\n" append ascii encode write ]
+        [ drop "255\n" ascii encode write ]
+        [ bitmap>> write ]
+    } cleave ;
diff --git a/basis/images/ppm/summary.txt b/basis/images/ppm/summary.txt
new file mode 100644 (file)
index 0000000..f527e2a
--- /dev/null
@@ -0,0 +1 @@
+Image loading for PPM image files.
index b21eb50c62c8d9890a86c0c3106a6895b275760f..aa6434743f4a17eaf4ed25f9efc8ff87fbad0d73 100644 (file)
@@ -6,7 +6,7 @@ math.ranges math.vectors sequences sequences.deep fry ;
 IN: images.processing\r
 \r
 : coord-matrix ( dim -- m )\r
-    [ iota ] map first2 [ [ 2array ] with map ] curry map ;\r
+    [ iota ] map first2 cartesian-product ;\r
 \r
 : map^2 ( m quot -- m' ) '[ _ map ] map ; inline\r
 : each^2 ( m quot -- m' ) '[ _ each ] each ; inline\r
old mode 100644 (file)
new mode 100755 (executable)
index 4a82545..a1880a3
@@ -4,7 +4,7 @@ USING: accessors arrays assocs byte-arrays classes combinators
 compression.lzw endian fry grouping images io
 io.binary io.encodings.ascii io.encodings.binary
 io.encodings.string io.encodings.utf8 io.files kernel math
-math.bitwise math.order math.parser pack prettyprint sequences
+math.bitwise math.order math.parser pack sequences
 strings math.vectors specialized-arrays locals
 images.loader ;
 FROM: alien.c-types => float ;
index 2aa7cd218e02b051ca1ac66b2612bbefe620b2d1..92d61ca7cfa921c023c2e117cb613dc84786e393 100644 (file)
@@ -5,6 +5,7 @@ namespaces prettyprint prettyprint.custom prettyprint.sections
 sequences strings io.styles vectors words quotations mirrors
 splitting math.parser classes vocabs sets sorting summary
 debugger continuations fry combinators ;
+FROM: namespaces => set ;
 IN: inspector
 
 SYMBOL: +number-rows+
index 3485b3efa709c75927485470ce37f66842fb6f0c..b4a3b72b3c8d89232f4b1001ca016b4092e69d8c 100644 (file)
@@ -6,7 +6,7 @@ classes.tuple namespaces make vectors bit-arrays byte-arrays
 strings sbufs math.functions macros sequences.private
 combinators mirrors splitting combinators.smart
 combinators.short-circuit fry words.symbol generalizations
-classes ;
+sequences.generalizations classes ;
 IN: inverse
 
 ERROR: fail ;
index 16d0338da532eb39f8e59129797353b2db545155..41fc7a65bca4799a581f88101be5296ec22e3c1d 100644 (file)
@@ -3,7 +3,7 @@
 USING: accessors alien.c-types combinators destructors
 io.backend.unix kernel math.bitwise sequences
 specialized-arrays unix unix.kqueue unix.time assocs
-io.backend.unix.multiplexers classes.struct ;
+io.backend.unix.multiplexers classes.struct literals ;
 SPECIALIZED-ARRAY: kevent
 IN: io.backend.unix.multiplexers.kqueue
 
@@ -31,13 +31,13 @@ M: kqueue-mx dispose* fd>> close-file ;
 
 M: kqueue-mx add-input-callback ( thread fd mx -- )
     [ call-next-method ] [
-        [ EVFILT_READ { EV_ADD EV_ONESHOT } flags make-kevent ] dip
+        [ EVFILT_READ flags{ EV_ADD EV_ONESHOT } make-kevent ] dip
         register-kevent
     ] 2bi ;
 
 M: kqueue-mx add-output-callback ( thread fd mx -- )
     [ call-next-method ] [
-        [ EVFILT_WRITE { EV_ADD EV_ONESHOT } flags make-kevent ] dip
+        [ EVFILT_WRITE flags{ EV_ADD EV_ONESHOT } make-kevent ] dip
         register-kevent
     ] 2bi ;
 
index 05328b48dc9e34f438ee3af44460638e73c7f486..ea31292c065027af73c3573a77599fa877c669c0 100644 (file)
@@ -11,7 +11,7 @@ TUPLE: run-loop-mx kqueue-mx ;
 
 : file-descriptor-callback ( -- callback )
     void { CFFileDescriptorRef CFOptionFlags void* }
-    "cdecl" [
+    cdecl [
         3drop
         0 mx get kqueue-mx>> wait-for-events
         reset-run-loop
index 39f0a5fec381bd1d2e2bebfbc41a0017ce74bcee..972b2a5b0743c953ebaab2ebea66a2b5806296e7 100644 (file)
@@ -67,12 +67,11 @@ M: io-timeout summary drop "I/O operation timed out" ;
 
 : wait-for-fd ( handle event -- )
     dup +retry+ eq? [ 2drop ] [
-        '[
-            swap handle-fd mx get-global _ {
-                { +input+ [ add-input-callback ] }
-                { +output+ [ add-output-callback ] }
-            } case
-        ] "I/O" suspend nip [ io-timeout ] when
+        [ [ self ] dip handle-fd mx get-global ] dip {
+            { +input+ [ add-input-callback ] }
+            { +output+ [ add-output-callback ] }
+        } case
+        "I/O" suspend [ io-timeout ] when
     ] if ;
 
 : wait-for-port ( port event -- )
@@ -145,7 +144,7 @@ M: stdin dispose*
         tri
     ] with-destructors ;
 
-: wait-for-stdin ( stdin -- n )
+: wait-for-stdin ( stdin -- size )
     [ control>> CHAR: X over io:stream-write1 io:stream-flush ]
     [ size>> ssize_t heap-size swap io:stream-read *int ]
     bi ;
@@ -161,7 +160,12 @@ M: stdin dispose*
     ] if ;
 
 M: stdin refill
-    [ buffer>> ] [ dup wait-for-stdin ] bi* refill-stdin f ;
+    '[
+        buffer>> _ dup wait-for-stdin refill-stdin f
+    ] with-timeout ;
+
+M: stdin cancel-operation
+    [ size>> ] [ control>> ] bi [ cancel-operation ] bi@ ;
 
 : control-write-fd ( -- fd ) &: control_write *uint ;
 
old mode 100644 (file)
new mode 100755 (executable)
index de29f33..c0a6ee8
@@ -1,9 +1,11 @@
-USING: alien alien.c-types arrays assocs combinators continuations
-destructors io io.backend io.ports io.timeouts io.backend.windows
-io.files.windows io.files.windows.nt io.files io.pathnames io.buffers
-io.streams.c io.streams.null libc kernel math namespaces sequences
-threads windows windows.errors windows.kernel32 strings splitting
-ascii system accessors locals classes.struct combinators.short-circuit ;
+USING: alien alien.c-types alien.data alien.syntax arrays assocs
+combinators continuations destructors io io.backend io.ports
+io.timeouts io.backend.windows io.files.windows
+io.files.windows.nt io.files io.pathnames io.buffers
+io.streams.c io.streams.null libc kernel math namespaces
+sequences threads windows windows.errors windows.kernel32
+strings splitting ascii system accessors locals classes.struct
+combinators.short-circuit ;
 IN: io.backend.windows.nt
 
 ! Global variable with assoc mapping overlapped to threads
@@ -40,8 +42,8 @@ M: winnt add-completion ( win32-handle -- )
 : twiddle-thumbs ( overlapped port -- bytes-transferred )
     [
         drop
-        [ >c-ptr pending-overlapped get-global set-at ] curry "I/O" suspend
-        {
+        [ self ] dip >c-ptr pending-overlapped get-global set-at
+        "I/O" suspend {
             { [ dup integer? ] [ ] }
             { [ dup array? ] [
                 first dup eof?
@@ -51,16 +53,12 @@ M: winnt add-completion ( win32-handle -- )
     ] with-timeout ;
 
 :: wait-for-overlapped ( nanos -- bytes-transferred overlapped error? )
-    master-completion-port get-global
-    0 <int> :> bytes
-    f <void*> :> key
-    f <void*> :> overlapped
     nanos [ 1,000,000 /i ] [ INFINITE ] if* :> timeout
-    bytes key overlapped timeout GetQueuedCompletionStatus zero? :> error?
-
-    bytes *int
-    overlapped *void* dup [ OVERLAPPED memory>struct ] when
-    error? ;
+    master-completion-port get-global
+    { int void* pointer: OVERLAPPED }
+    [ timeout GetQueuedCompletionStatus zero? ] [ ] with-out-parameters
+    :> ( error? bytes key overlapped )
+    bytes overlapped error? ;
 
 : resume-callback ( result overlapped -- )
     >c-ptr pending-overlapped get-global delete-at* drop resume-with ;
@@ -90,7 +88,7 @@ ERROR: invalid-file-size n ;
 ERROR: seek-before-start n ;
 
 : set-seek-ptr ( n handle -- )
-    [ dup 0 < [ seek-before-start ] when ] dip (>>ptr) ;
+    [ dup 0 < [ seek-before-start ] when ] dip ptr<< ;
 
 M: winnt tell-handle ( handle -- n ) ptr>> ;
 
index 6022e91efdcbf4c4e3280c659390d642bc646bee..27687df9d5fd7d7975466cfa16286a810d492831 100644 (file)
@@ -1,8 +1,10 @@
-USING: alien alien.c-types alien.data alien.syntax arrays continuations
-destructors generic io.mmap io.ports io.backend.windows io.files.windows
-kernel libc locals math math.bitwise namespaces quotations sequences windows
-windows.advapi32 windows.kernel32 windows.types io.backend system accessors
-io.backend.windows.privileges classes.struct windows.errors ;
+USING: alien alien.c-types alien.data alien.syntax arrays
+continuations destructors generic io.mmap io.ports
+io.backend.windows io.files.windows kernel libc fry locals math
+math.bitwise namespaces quotations sequences windows
+windows.advapi32 windows.kernel32 windows.types io.backend
+system accessors io.backend.windows.privileges classes.struct
+windows.errors literals ;
 IN: io.backend.windows.nt.privileges
 
 TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES
@@ -11,8 +13,10 @@ TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES
 !  http://msdn.microsoft.com/msdnmag/issues/05/03/TokenPrivileges/
 
 : (open-process-token) ( handle -- handle )
-    { TOKEN_ADJUST_PRIVILEGES TOKEN_QUERY } flags PHANDLE <c-object>
-    [ OpenProcessToken win32-error=0/f ] keep *void* ;
+    flags{ TOKEN_ADJUST_PRIVILEGES TOKEN_QUERY }
+    { PHANDLE }
+    [ OpenProcessToken win32-error=0/f ] [ ]
+    with-out-parameters ;
 
 : open-process-token ( -- handle )
     #! remember to CloseHandle
@@ -37,7 +41,11 @@ TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES
         >>Privileges ;
 
 M: winnt set-privilege ( name ? -- )
-    [
-        -rot 0 -rot make-token-privileges
-        dup byte-length f f AdjustTokenPrivileges win32-error=0/f
+    '[
+        0
+        _ _ make-token-privileges
+        dup byte-length
+        f
+        f
+        AdjustTokenPrivileges win32-error=0/f
     ] with-process-token ;
index 6ec2ec4dc585968161b98480dee03a2e998def3c..0e0a803679a8bafd7064d6a6ec51900529192c40 100644 (file)
@@ -5,7 +5,7 @@ io.buffers io.files io.ports io.binary io.timeouts system
 strings kernel math namespaces sequences windows.errors
 windows.kernel32 windows.shell32 windows.types splitting
 continuations math.bitwise accessors init sets assocs
-classes.struct classes ;
+classes.struct classes literals ;
 IN: io.backend.windows
 
 TUPLE: win32-handle < disposable handle ;
@@ -43,12 +43,12 @@ HOOK: add-completion io-backend ( port -- )
     <win32-file> |dispose
     dup add-completion ;
 
-: share-mode ( -- n )
-    {
+CONSTANT: share-mode
+    flags{
         FILE_SHARE_READ
         FILE_SHARE_WRITE
         FILE_SHARE_DELETE
-    } flags ; foldable
+    }
 
 : default-security-attributes ( -- obj )
     SECURITY_ATTRIBUTES <struct>
index 836b4d0cc8aea7c273318d5d2028d0e7ebc64ddb..07e783f26743be087ae58d9fe6bae02ae1d5fd59 100644 (file)
@@ -4,8 +4,9 @@ kernel.private libc sequences tools.test namespaces byte-arrays
 strings accessors destructors ;
 
 : buffer-set ( string buffer -- )
-    over >byte-array over ptr>> byte-array>memory
-    [ length ] dip buffer-reset ;
+    [ ptr>> swap >byte-array binary-object memcpy ]
+    [ [ length ] dip buffer-reset ]
+    2bi ;
 
 : string>buffer ( string -- buffer )
     dup length <buffer> [ buffer-set ] keep ;
index 23358d9a0e20c2fcfd61e331ba344da53ccc1434..562abad082fb24911b73cdeeef7c102405694937 100644 (file)
@@ -60,8 +60,8 @@ HINTS: buffer-read fixnum buffer ;
 HINTS: n>buffer fixnum buffer ;
 
 : >buffer ( byte-array buffer -- )
-    [ buffer-end byte-array>memory ]
-    [ [ length ] dip n>buffer ]
+    [ buffer-end swap binary-object memcpy ]
+    [ [ byte-length ] dip n>buffer ]
     2bi ;
 
 HINTS: >buffer byte-array buffer ;
index 28d7f63d87c4c4158e642b46eccf7cc7e7cb86d9..0b690643111a6c878ed896829a6fda284b53526a 100644 (file)
@@ -41,7 +41,7 @@ TUPLE: directory-iterator path bfs queue ;
         [ nip ] if
     ] if ;
 
-:: iterate-directory-entries ( iter quot: ( obj -- obj ) -- directory-entry/f )
+:: iterate-directory-entries ( ... iter quot: ( ... obj -- ... obj ) -- ... directory-entry/f )
     iter next-directory-entry [
         quot call
         [ iter quot iterate-directory-entries ] unless*
index 77d7f2d1b27354d0be5e328c11f2c16c8c2e20a7..0cc8aaa0e43766f2e508eaebd154e4a33fa61a4e 100644 (file)
@@ -4,11 +4,10 @@ USING: accessors alien.c-types alien.strings combinators
 continuations destructors fry io io.backend io.backend.unix
 io.directories io.encodings.binary io.encodings.utf8 io.files
 io.pathnames io.files.types kernel math.bitwise sequences system
-unix unix.stat vocabs.loader classes.struct unix.ffi ;
+unix unix.stat vocabs.loader classes.struct unix.ffi literals ;
 IN: io.directories.unix
 
-: touch-mode ( -- n )
-    { O_WRONLY O_APPEND O_CREAT O_EXCL } flags ; foldable
+CONSTANT: touch-mode flags{ O_WRONLY O_APPEND O_CREAT O_EXCL }
 
 M: unix touch-file ( path -- )
     normalize-path
index 7f92028c312ff3417e28047ba79e520f43603b9f..db269c319d5a524f87e35db203dc4144186d72f3 100644 (file)
@@ -1,10 +1,10 @@
 ! Copyright (C) 2008 Daniel Ehrenberg, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: math.parser arrays io.encodings sequences kernel assocs
-hashtables io.encodings.ascii generic parser classes.tuple words
-words.symbol io io.files splitting namespaces math
-compiler.units accessors classes.singleton classes.mixin
-io.encodings.iana fry simple-flat-file lexer ;
+USING: arrays assocs biassocs kernel io.encodings math.parser
+sequences hashtables io.encodings.ascii generic parser
+classes.tuple words words.symbol io io.files splitting
+namespaces math compiler.units accessors classes.singleton
+classes.mixin io.encodings.iana fry simple-flat-file lexer ;
 IN: io.encodings.8-bit
 
 <PRIVATE
@@ -15,20 +15,22 @@ IN: io.encodings.8-bit
 SYMBOL: 8-bit-encodings
 8-bit-encodings [ H{ } clone ] initialize
 
-TUPLE: 8-bit biassoc ;
+TUPLE: 8-bit { biassoc biassoc read-only } ;
 
-: encode-8-bit ( char stream assoc -- )
-    swapd value-at
-    [ swap stream-write1 ] [ encode-error ] if* ; inline
+: 8-bit-encode ( char 8-bit -- byte )
+    biassoc>> value-at [ encode-error ] unless* ; inline
 
-M: 8-bit encode-char biassoc>> encode-8-bit ;
+M: 8-bit encode-char
+    swap [ 8-bit-encode ] dip stream-write1 ;
 
-: decode-8-bit ( stream assoc -- char/f )
-    swap stream-read1
-    [ swap at [ replacement-char ] unless* ]
-    [ drop f ] if* ; inline
+M: 8-bit encode-string
+    swap [ '[ _ 8-bit-encode ] B{ } map-as ] dip stream-write ;
 
-M: 8-bit decode-char biassoc>> decode-8-bit ;
+M: 8-bit decode-char
+    swap stream-read1 dup
+    [ swap biassoc>> at [ replacement-char ] unless* ]
+    [ 2drop f ]
+    if ;
 
 MIXIN: 8-bit-encoding
 
index 00d3bc7509052385481bda70c98b2c7fb3f8c760..2b5640489f3d38539903874b1ee01a0a75c41084 100644 (file)
@@ -1,22 +1,27 @@
 ! Copyright (C) 2008 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: io io.encodings kernel math io.encodings.private ;
+USING: accessors byte-arrays io io.encodings
+io.encodings.private kernel math sequences ;
 IN: io.encodings.ascii
 
-<PRIVATE
-: encode-if< ( char stream encoding max -- )
-    nip 1 - pick < [ encode-error ] [ stream-write1 ] if ; inline
-
-: decode-if< ( stream encoding max -- character )
-    nip swap stream-read1 dup
-    [ [ nip ] [ > ] 2bi [ >fixnum ] [ drop replacement-char ] if ]
-    [ 2drop f ] if ; inline
-PRIVATE>
-
 SINGLETON: ascii
 
 M: ascii encode-char
-    128 encode-if< ; inline
+    drop
+    over 127 <= [ stream-write1 ] [ encode-error ] if ; inline
+
+M: ascii encode-string
+    drop
+    [
+        dup aux>>
+        [ [ dup 127 <= [ encode-error ] unless ] B{ } map-as ]
+        [ >byte-array ]
+        if
+    ] dip
+    stream-write ;
 
 M: ascii decode-char
-    128 decode-if< ; inline
+    drop
+    stream-read1 dup [
+        dup 127 <= [ >fixnum ] [ drop replacement-char ] if
+    ] when ; inline
index a2a919da0db276e1eeb473b6420dc253ed0f3c36..544a6a8072258f16165f5b6ed758d4f891d6eddb 100644 (file)
@@ -22,7 +22,7 @@ PRIVATE>
     utf8 file-lines { "" } split [
         [ " " split ] map
         [ first { "Name:" "Alias:" } member? ] filter
-        [ second ] map { "None" } diff
+        values { "None" } diff
     ] map harvest ;
 
 : make-aliases ( file -- n>e )
index 7d4d7f1215f6fa89b43fd118c1e9d68faa238d6b..4f092d628246fbb13aeb39fb98682140d77180ab 100644 (file)
@@ -56,7 +56,7 @@ M:: iso2022-state encode-char ( char stream encoding -- )
     char encoding type>> value? [
         char find-type
         [ stream stream-write ]
-        [ encoding (>>type) ] bi*
+        [ encoding type<< ] bi*
     ] unless
     char encoding type>> value-at stream stream-write-num ;
 
@@ -92,7 +92,7 @@ M:: iso2022-state decode-char ( stream encoding -- char )
     stream stream-read1 {
         { ESC [
             stream read-escape [
-                encoding (>>type)
+                encoding type<<
                 stream encoding decode-char
             ] [ replacement-char ] if*
         ] }
index 2a80e47c7b2a4a5eff77c555b4c3265fdf828476..adff0ecf4b2ccb9ca466332b939d906c98c8b98a 100644 (file)
@@ -12,7 +12,7 @@ IN: io.encodings.utf32.tests
 [ { CHAR: replacement-character } ] [ B{ 0 } utf32be decode >array ] unit-test
 [ { } ] [ { } utf32be decode >array ] unit-test
 
-[ { 0 0 0 CHAR: x 0 1 HEX: D1 HEX: 1E } ] [ { CHAR: x HEX: 1d11e } >string utf32be encode >array ] unit-test
+[ B{ 0 0 0 CHAR: x 0 1 HEX: D1 HEX: 1E } ] [ { CHAR: x HEX: 1d11e } >string utf32be encode ] unit-test
 
 [ { CHAR: x } ] [ B{ CHAR: x 0 0 0 } utf32le decode >array ] unit-test
 [ { HEX: 1d11e } ] [ B{ HEX: 1e HEX: d1 1 0 } utf32le decode >array ] unit-test
@@ -21,10 +21,10 @@ IN: io.encodings.utf32.tests
 [ { CHAR: replacement-character } ] [ B{ HEX: 1e } utf32le decode >array ] unit-test
 [ { } ] [ { } utf32le decode >array ] unit-test
 
-[ { 120 0 0 0 HEX: 1e HEX: d1 1 0 } ] [ { CHAR: x HEX: 1d11e } >string utf32le encode >array ] unit-test
+[ B{ 120 0 0 0 HEX: 1e HEX: d1 1 0 } ] [ { CHAR: x HEX: 1d11e } >string utf32le encode ] unit-test
 
 [ { CHAR: x } ] [ B{ HEX: ff HEX: fe 0 0 CHAR: x 0 0 0 } utf32 decode >array ] unit-test
 [ { CHAR: x } ] [ B{ 0 0 HEX: fe HEX: ff 0 0 0 CHAR: x } utf32 decode >array ] unit-test
 
-[ { HEX: ff HEX: fe 0 0 120 0 0 0 HEX: 1e HEX: d1 1 0 } ] [ { CHAR: x HEX: 1d11e } >string utf32 encode >array ] unit-test
+[ B{ HEX: ff HEX: fe 0 0 120 0 0 0 HEX: 1e HEX: d1 1 0 } ] [ { CHAR: x HEX: 1d11e } >string utf32 encode ] unit-test
 
index f1d6b4db665b85d280d27cad1b15586ee329e989..7c13d86a3c27114ec02a4dbfbffade707a2e339f 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types alien.syntax combinators
+USING: accessors alien alien.c-types alien.syntax combinators
 io.backend io.files io.files.info io.files.unix kernel math system unix
 unix.statfs.freebsd unix.statvfs.freebsd unix.getfsstat.freebsd
 sequences grouping alien.strings io.encodings.utf8 unix.types
index 9e37ec8aa99e05ae5da059dbf35c7bfcf08c13fb..9ea475433bace410bb48e8419365379fcc2275cf 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax kernel unix.stat math unix
+USING: alien alien.syntax kernel unix.stat math unix
 combinators system io.backend accessors alien.c-types
 io.encodings.utf8 alien.strings unix.types io.files.unix
 io.files io.files.info unix.statvfs.netbsd unix.getfsstat.netbsd arrays
index be88929f2e351486506d4fe17e9ac8297091284d..e80a4fdafd1402b52ed8db558e4e1765af9d8488 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types alien.strings alien.syntax
+USING: accessors alien alien.c-types alien.strings alien.syntax
 combinators io.backend io.files io.files.info io.files.unix kernel math
 sequences system unix unix.getfsstat.openbsd grouping
 unix.statfs.openbsd unix.statvfs.openbsd unix.types
old mode 100644 (file)
new mode 100755 (executable)
index 799b6dc..96e3028
@@ -6,7 +6,7 @@ windows.time windows.types windows accessors alien.c-types
 combinators generalizations system alien.strings
 io.encodings.utf16n sequences splitting windows.errors fry
 continuations destructors calendar ascii
-combinators.short-circuit locals classes.struct
+combinators.short-circuit literals locals classes.struct
 specialized-arrays alien.data ;
 SPECIALIZED-ARRAY: ushort
 IN: io.files.info.windows
@@ -21,12 +21,8 @@ IN: io.files.info.windows
 TUPLE: windows-file-info < file-info attributes ;
 
 : get-compressed-file-size ( path -- n )
-    DWORD <c-object> [ GetCompressedFileSize ] keep
-    over INVALID_FILE_SIZE = [
-        win32-error-string throw
-    ] [
-        *uint >64bit
-    ] if ;
+    { DWORD } [ GetCompressedFileSize ] [ ] with-out-parameters
+    over INVALID_FILE_SIZE = [ win32-error-string throw ] [ >64bit ] if ;
 
 : set-windows-size-on-disk ( file-info path -- file-info )
     over attributes>> +compressed+ swap member? [
@@ -99,22 +95,18 @@ M: windows file-info ( path -- info )
 M: windows link-info ( path -- info )
     file-info ;
 
+CONSTANT: path-length $[ MAX_PATH 1 + ]
+
 : volume-information ( normalized-path -- volume-name volume-serial max-component flags type )
-    MAX_PATH 1 + [ <ushort-array> ] keep
-    DWORD <c-object>
-    DWORD <c-object>
-    DWORD <c-object>
-    MAX_PATH 1 + [ <ushort-array> ] keep
-    [ GetVolumeInformation win32-error=0/f ] 7 nkeep
-    drop 5 nrot drop
-    [ utf16n alien>string ] 4 ndip
-    utf16n alien>string ;
+    { { ushort path-length } DWORD DWORD DWORD { ushort path-length } }
+    [ [ path-length ] 4dip path-length GetVolumeInformation win32-error=0/f ]
+    [ [ utf16n alien>string ] 4dip utf16n alien>string ]
+    with-out-parameters ;
 
 : file-system-space ( normalized-path -- available-space total-space free-space )
-    ULARGE_INTEGER <c-object>
-    ULARGE_INTEGER <c-object>
-    ULARGE_INTEGER <c-object>
-    [ GetDiskFreeSpaceEx win32-error=0/f ] 3keep ;
+    { ULARGE_INTEGER ULARGE_INTEGER ULARGE_INTEGER }
+    [ GetDiskFreeSpaceEx win32-error=0/f ] [ ]
+    with-out-parameters ;
 
 : calculate-file-system-info ( file-system-info -- file-system-info' )
     [ dup [ total-space>> ] [ free-space>> ] bi - >>used-space drop ] keep ;
@@ -136,13 +128,13 @@ ERROR: not-absolute-path ;
 : (file-system-info) ( path -- file-system-info )
     dup [ volume-information ] [ file-system-space ] bi
     \ win32-file-system-info new
-        swap *ulonglong >>free-space
-        swap *ulonglong >>total-space
-        swap *ulonglong >>available-space
+        swap >>free-space
+        swap >>total-space
+        swap >>available-space
         swap >>type
-        swap *uint >>flags
-        swap *uint >>max-component
-        swap *uint >>device-serial
+        swap >>flags
+        swap >>max-component
+        swap >>device-serial
         swap >>device-name
         swap >>mount-point
     calculate-file-system-info ;
@@ -152,36 +144,29 @@ PRIVATE>
 M: winnt file-system-info ( path -- file-system-info )
     normalize-path root-directory (file-system-info) ;
 
-:: volume>paths ( string -- array )
-    16384 :> names-buf-length
-    names-buf-length <ushort-array> :> names
-    0 <uint> :> names-length
+CONSTANT: names-buf-length 16384
 
-    string names names-buf-length names-length GetVolumePathNamesForVolumeName :> ret
-    ret 0 = [
-        ret win32-error-string throw
-    ] [
-        names names-length *uint ushort heap-size * head
-        utf16n alien>string { CHAR: \0 } split
-    ] if ;
+: volume>paths ( string -- array )
+    { { ushort names-buf-length } uint }
+    [ [ names-buf-length ] dip GetVolumePathNamesForVolumeName win32-error=0/f ]
+    [ head utf16n alien>string { CHAR: \0 } split ]
+    with-out-parameters ;
 
 : find-first-volume ( -- string handle )
-    MAX_PATH 1 + [ <ushort-array> ] keep
-    dupd
-    FindFirstVolume dup win32-error=0/f
-    [ utf16n alien>string ] dip ;
-
-:: find-next-volume ( handle -- string/f )
-    MAX_PATH 1 + :> buf-length
-    buf-length <ushort-array> :> buf
-
-    handle buf buf-length FindNextVolume :> ret
-    ret 0 = [
-        GetLastError ERROR_NO_MORE_FILES =
-        [ f ] [ win32-error-string throw ] if
-    ] [
-        buf utf16n alien>string
-    ] if ;
+    { { ushort path-length } }
+    [ path-length FindFirstVolume dup win32-error=0/f ]
+    [ utf16n alien>string ]
+    with-out-parameters swap ;
+
+: find-next-volume ( handle -- string/f )
+    { { ushort path-length } }
+    [ path-length FindNextVolume ]
+    [
+        swap 0 = [
+            GetLastError ERROR_NO_MORE_FILES =
+            [ drop f ] [ win32-error-string throw ] if
+        ] [ utf16n alien>string ] if
+    ] with-out-parameters ;
 
 : find-volumes ( -- array )
     find-first-volume
@@ -202,11 +187,10 @@ M: winnt file-systems ( -- array )
 : file-times ( path -- timestamp timestamp timestamp )
     [
         normalize-path open-read &dispose handle>>
-        FILETIME <struct>
-        FILETIME <struct>
-        FILETIME <struct>
-        [ GetFileTime win32-error=0/f ] 3keep
-        [ FILETIME>timestamp >local-time ] tri@
+        { FILETIME FILETIME FILETIME }
+        [ GetFileTime win32-error=0/f ]
+        [ [ FILETIME>timestamp >local-time ] tri@ ]
+        with-out-parameters
     ] with-destructors ;
 
 : set-file-times ( path timestamp/f timestamp/f timestamp/f -- )
index a2051bd10afa1a44c4b426fdfeac3c6ce217eeba..7e8d166b3213a75ff2d1db5a9fc2e3952920dbe5 100644 (file)
@@ -54,12 +54,19 @@ HELP: with-unique-directory
 }
 { $description "Creates a directory with " { $link unique-directory } " and calls the quotation with the pathname on the stack using the " { $link with-temporary-directory } " combinator. The quotation can access the " { $link current-temporary-directory } " symbol for the name of the temporary directory. Subsequent unique files will be created in this unique directory until the combinator returns." } ;
 
+HELP: copy-file-unique
+{ $values
+    { "path" "a pathname string" } { "prefix" string } { "suffix" string }
+    { "path'" "a pathname string" }
+}
+{ $description "Copies " { $snippet "path" } " to a new unique file in the directory stored in " { $link current-temporary-directory } ". Returns the new path." } ;
+
 HELP: move-file-unique
 { $values
-    { "path" "a pathname string" } { "directory" "a directory" }
+    { "path" "a pathname string" } { "prefix" string } { "suffix" string }
     { "path'" "a pathname string" }
 }
-{ $description "Moves " { $snippet "path" } " to " { $snippet "directory" } " by creating a unique file in this directory. Returns the new path." } ;
+{ $description "Moves " { $snippet "path" } " to a new unique file in the directory stored in " { $link current-temporary-directory } ". Returns the new path." } ;
 
 HELP: current-temporary-directory
 { $values
@@ -98,7 +105,10 @@ ARTICLE: "io.files.unique" "Unique files"
 }
 "Default temporary directory:"
 { $subsections default-temporary-directory }
-"Moving files into a directory safely:"
-{ $subsections move-file-unique } ;
+"Copying and moving files to a new unique file:"
+{ $subsections
+    copy-file-unique
+    move-file-unique
+} ;
 
 ABOUT: "io.files.unique"
index 07f7b25140bdc192da95247e2ae6b589c81e75ae..5bf89b95207cf15fe068fb8c2fd1c1796cd2c29f 100644 (file)
@@ -70,10 +70,17 @@ PRIVATE>
 : unique-file ( prefix -- path )
     "" make-unique-file ;
 
-: move-file-unique ( path directory -- path' )
-    [
-        "" unique-file [ move-file ] keep
-    ] with-temporary-directory ;
+: move-file-unique ( path prefix suffix -- path' )
+    make-unique-file [ move-file ] keep ;
+
+: copy-file-unique ( path prefix suffix -- path' )
+    make-unique-file [ copy-file ] keep ;
+
+: temporary-file ( -- path ) "" unique-file ;
+
+: with-working-directory ( path quot -- )
+    over make-directories
+    dupd '[ _ _ with-temporary-directory ] with-directory ; inline
 
 {
     { [ os unix? ] [ "io.files.unique.unix" ] }
index ec72d9128bc4e5a05b6290b6c15afc5ceb08e402..cd60e3d4b8b4c5e0a925baa1251eb412c15b8b06 100644 (file)
@@ -1,11 +1,10 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel io.ports io.backend.unix math.bitwise
-unix system io.files.unique unix.ffi ;
+unix system io.files.unique unix.ffi literals ;
 IN: io.files.unique.unix
 
-: open-unique-flags ( -- flags )
-    { O_RDWR O_CREAT O_EXCL } flags ;
+CONSTANT: open-unique-flags flags{ O_RDWR O_CREAT O_EXCL }
 
 M: unix (touch-unique-file) ( path -- )
     open-unique-flags file-mode open-file close-file ;
index 93e499a5762c53287ea40b9617bd6a97dcb1f27a..06f7473aed44adb91bc35194edb60b4944aad3f5 100644 (file)
@@ -2,7 +2,7 @@ USING: tools.test io.files io.files.temp io.pathnames
 io.directories io.files.info io.files.info.unix continuations
 kernel io.files.unix math.bitwise calendar accessors
 math.functions math unix.users unix.groups arrays sequences
-grouping io.pathnames.private ;
+grouping io.pathnames.private literals ;
 IN: io.files.unix.tests
 
 [ "/usr/libexec/" ] [ "/usr/libexec/awk/" parent-directory ] unit-test
@@ -45,7 +45,7 @@ IN: io.files.unix.tests
 prepare-test-file
 
 [ t ]
-[ test-file { USER-ALL GROUP-ALL OTHER-ALL } flags set-file-permissions perms OCT: 777 = ] unit-test
+[ test-file flags{ USER-ALL GROUP-ALL OTHER-ALL } set-file-permissions perms OCT: 777 = ] unit-test
 
 [ t ] [ test-file user-read? ] unit-test
 [ t ] [ test-file user-write? ] unit-test
@@ -85,7 +85,7 @@ prepare-test-file
 [ f ] [ test-file file-info other-read? ] unit-test
 
 [ t ]
-[ test-file { USER-ALL GROUP-ALL OTHER-EXECUTE } flags set-file-permissions perms OCT: 771 = ] unit-test
+[ test-file flags{ USER-ALL GROUP-ALL OTHER-EXECUTE } set-file-permissions perms OCT: 771 = ] unit-test
 
 prepare-test-file
 
index bf0a21f997921bd32b6256e3ea847571968b5669..e695345125ce8b058d888b3a3af7ea77e55b78de 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: unix byte-arrays kernel io.backend.unix math.bitwise
 io.ports io.files io.files.private io.pathnames environment
-destructors system unix.ffi ;
+destructors system unix.ffi literals ;
 IN: io.files.unix
 
 M: unix cwd ( -- path )
@@ -12,15 +12,14 @@ M: unix cwd ( -- path )
 
 M: unix cd ( path -- ) [ chdir ] unix-system-call drop ;
 
-: read-flags ( -- n ) O_RDONLY ; inline
+CONSTANT: read-flags flags{ O_RDONLY }
 
-: open-read ( path -- fd ) O_RDONLY file-mode open-file ;
+: open-read ( path -- fd ) read-flags file-mode open-file ;
 
 M: unix (file-reader) ( path -- stream )
     open-read <fd> init-fd <input-port> ;
 
-: write-flags ( -- n )
-    { O_WRONLY O_CREAT O_TRUNC } flags ; inline
+CONSTANT: write-flags flags{ O_WRONLY O_CREAT O_TRUNC }
 
 : open-write ( path -- fd )
     write-flags file-mode open-file ;
@@ -28,8 +27,7 @@ M: unix (file-reader) ( path -- stream )
 M: unix (file-writer) ( path -- stream )
     open-write <fd> init-fd <output-port> ;
 
-: append-flags ( -- n )
-    { O_WRONLY O_APPEND O_CREAT } flags ; inline
+CONSTANT: append-flags flags{ O_WRONLY O_APPEND O_CREAT }
 
 : open-append ( path -- fd )
     [
index c4c848cb648ea92ff558d9ec97a6a16da0492c64..4fc2057a744e0c5187d8342f41011479d1ab8fd7 100644 (file)
@@ -6,7 +6,8 @@ io.backend.windows kernel math splitting fry alien.strings
 windows windows.kernel32 windows.time windows.types calendar
 combinators math.functions sequences namespaces make words
 system destructors accessors math.bitwise continuations
-windows.errors arrays byte-arrays generalizations alien.data ;
+windows.errors arrays byte-arrays generalizations alien.data
+literals ;
 IN: io.files.windows
 
 : open-file ( path access-mode create-mode flags -- handle )
@@ -16,7 +17,7 @@ IN: io.files.windows
     ] with-destructors ;
 
 : open-r/w ( path -- win32-file )
-    { GENERIC_READ GENERIC_WRITE } flags
+    flags{ GENERIC_READ GENERIC_WRITE }
     OPEN_EXISTING 0 open-file ;
 
 : open-read ( path -- win32-file )
@@ -29,7 +30,7 @@ IN: io.files.windows
     GENERIC_WRITE OPEN_ALWAYS 0 open-file ;
 
 : open-existing ( path -- win32-file )
-    { GENERIC_READ GENERIC_WRITE } flags
+    flags{ GENERIC_READ GENERIC_WRITE }
     share-mode
     f
     OPEN_EXISTING
@@ -38,7 +39,7 @@ IN: io.files.windows
 
 : maybe-create-file ( path -- win32-file ? )
     #! return true if file was just created
-    { GENERIC_READ GENERIC_WRITE } flags
+    flags{ GENERIC_READ GENERIC_WRITE }
     share-mode
     f
     OPEN_ALWAYS
index 3999a026c08f08baf6a2e35b2a0f1ed0ad78a376..dfbbd33d2e905fc7cc46f10aaac8bde1eabeb607 100755 (executable)
@@ -129,12 +129,8 @@ M: process-was-killed error.
 
 : (wait-for-process) ( process -- status )
     dup handle>>
-    [
-        dup [ processes get at push ] curry
-        "process" suspend drop
-    ] when
-    dup killed>>
-    [ process-was-killed ] [ status>> ] if ;
+    [ self over processes get at push "process" suspend drop ] when
+    dup killed>> [ process-was-killed ] [ status>> ] if ;
 
 : wait-for-process ( process -- status )
     [ (wait-for-process) ] with-timeout ;
index bb7569516a329033b65dbc8064d942682f19a0b5..fef6b076ba2f9890a739ec403df326a6709575fc 100644 (file)
@@ -135,6 +135,6 @@ concurrency.promises threads unix.process calendar unix ;
         ] in-thread
 
         p 1 seconds ?promise-timeout handle>> kill-process*
-        s ?promise 0 =
+        s 3 seconds ?promise-timeout 0 =
     ]
 ] unit-test
index aaaccd4719e1d9b92a32324763a33da2459accdc..e036f34cc600bb1bde297bb206259867791b92d5 100644 (file)
@@ -1,10 +1,11 @@
 ! Copyright (C) 2007, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types arrays assocs combinators
-continuations environment io io.backend io.backend.unix
-io.files io.files.private io.files.unix io.launcher io.pathnames
-io.ports kernel math namespaces sequences strings system threads
-unix unix.process unix.ffi simple-tokenizer ;
+USING: accessors alien.c-types alien.data arrays assocs
+combinators continuations environment io io.backend
+io.backend.unix io.files io.files.private io.files.unix
+io.launcher io.pathnames io.ports kernel math namespaces
+sequences strings system threads unix unix.process unix.ffi
+simple-tokenizer ;
 IN: io.launcher.unix
 
 : get-arguments ( process -- seq )
@@ -68,12 +69,13 @@ IN: io.launcher.unix
     ] when ;
 
 : spawn-process ( process -- * )
-    [ setup-priority ] [ 250 _exit ] recover
-    [ setup-redirection ] [ 251 _exit ] recover
-    [ current-directory get absolute-path cd ] [ 252 _exit ] recover
-    [ setup-environment ] [ 253 _exit ] recover
-    [ get-arguments exec-args-with-path ] [ 254 _exit ] recover
-    255 _exit ;
+    [ setup-priority ] [ 2drop 250 _exit ] recover
+    [ setup-redirection ] [ 2drop 251 _exit ] recover
+    [ current-directory get absolute-path cd ] [ 2drop 252 _exit ] recover
+    [ setup-environment ] [ 2drop 253 _exit ] recover
+    [ get-arguments exec-args-with-path ] [ 2drop 254 _exit ] recover
+    255 _exit
+    f throw ;
 
 M: unix current-process-handle ( -- handle ) getpid ;
 
@@ -93,10 +95,10 @@ TUPLE: signal n ;
     dup WIFSIGNALED [ WTERMSIG signal boa ] [ WEXITSTATUS ] if ;
 
 M: unix wait-for-processes ( -- ? )
-    0 <int> -1 over WNOHANG waitpid
-    dup 0 <= [
+    { int } [ -1 swap WNOHANG waitpid ] [ ] with-out-parameters
+    swap dup 0 <= [
         2drop t
     ] [
         find-process dup
-        [ swap *int code>status notify-exit f ] [ 2drop f ] if
+        [ swap code>status notify-exit f ] [ 2drop f ] if
     ] if ;
index 16d9cbf6c9975cb480ef1cd124f1030a321d247c..959bf931199665bd1e0420de290e3554a9b64ce9 100644 (file)
@@ -105,6 +105,6 @@ IN: io.launcher.windows.nt
 
 M: winnt fill-redirection ( process args -- )
     dup lpStartupInfo>>
-    [ [ redirect-stdout ] dip (>>hStdOutput) ]
-    [ [ redirect-stderr ] dip (>>hStdError) ]
-    [ [ redirect-stdin ] dip (>>hStdInput) ] 3tri ;
+    [ [ redirect-stdout ] dip hStdOutput<< ]
+    [ [ redirect-stderr ] dip hStdError<< ]
+    [ [ redirect-stdin ] dip hStdInput<< ] 3tri ;
index b279b1e964ec0f62d1ce26d1641cf55830673981..cc9e52a1898214ad213e702eb9dc46f16e631a24 100755 (executable)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2007, 2010 Doug Coleman, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types arrays continuations io
+USING: alien alien.c-types alien.data arrays continuations io
 io.backend.windows io.pipes.windows.nt io.pathnames libc
 io.ports windows.types math windows.kernel32 namespaces make
 io.launcher kernel sequences windows.errors splitting system
@@ -159,7 +159,7 @@ M: windows kill-process* ( handle -- )
 
 : exit-code ( process -- n )
     hProcess>>
-    0 <ulong> [ GetExitCodeProcess ] keep *ulong
+    { DWORD } [ GetExitCodeProcess ] [ ] with-out-parameters
     swap win32-error=0/f ;
 
 : process-exited ( process -- )
index f426201b062d96eb9930f3aafe1e4c9bf6dcd675..84378efeb80292c3fd1c43f8fedaf2ed3a81c689 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2007 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors destructors io.backend.unix io.mmap
+USING: accessors destructors io.backend.unix io.mmap literals
 io.mmap.private kernel locals math.bitwise system unix unix.ffi ;
 IN: io.mmap.unix
 
@@ -12,13 +12,13 @@ IN: io.mmap.unix
     ] with-destructors ;
 
 M: unix (mapped-file-r/w)
-    { PROT_READ PROT_WRITE } flags
-    { MAP_FILE MAP_SHARED } flags
+    flags{ PROT_READ PROT_WRITE }
+    flags{ MAP_FILE MAP_SHARED }
     O_RDWR mmap-open ;
 
 M: unix (mapped-file-reader)
-    { PROT_READ } flags
-    { MAP_FILE MAP_SHARED } flags
+    flags{ PROT_READ }
+    flags{ MAP_FILE MAP_SHARED }
     O_RDONLY mmap-open ;
 
 M: unix close-mapped-file ( mmap -- )
index e3e3116b59047f5852b9912f7cecdab773bce76a..b1191082b36d78f22b5f69e25ae0f08ef91c9bf2 100644 (file)
@@ -2,7 +2,7 @@ USING: alien alien.c-types arrays destructors generic io.mmap
 io.ports io.backend.windows io.files.windows io.backend.windows.privileges
 io.mmap.private kernel libc math math.bitwise namespaces quotations sequences
 windows windows.advapi32 windows.kernel32 io.backend system
-accessors locals windows.errors ;
+accessors locals windows.errors literals ;
 IN: io.mmap.windows
 
 : create-file-mapping ( hFile lpAttributes flProtect dwMaximumSizeHigh dwMaximumSizeLow lpName -- HANDLE )
@@ -29,9 +29,9 @@ C: <win32-mapped-file> win32-mapped-file
 
 M: windows (mapped-file-r/w)
     [
-        { GENERIC_WRITE GENERIC_READ } flags
+        flags{ GENERIC_WRITE GENERIC_READ }
         OPEN_ALWAYS
-        { PAGE_READWRITE SEC_COMMIT } flags
+        flags{ PAGE_READWRITE SEC_COMMIT }
         FILE_MAP_ALL_ACCESS mmap-open
         -rot <win32-mapped-file>
     ] with-destructors ;
@@ -40,7 +40,7 @@ M: windows (mapped-file-reader)
     [
         GENERIC_READ
         OPEN_ALWAYS
-        { PAGE_READONLY SEC_COMMIT } flags
+        flags{ PAGE_READONLY SEC_COMMIT }
         FILE_MAP_READ mmap-open
         -rot <win32-mapped-file>
     ] with-destructors ;
index eacc9203031a8961dd488c755802caaf2fa8a203..9b2440aec88edc8bb975d312224b215c0f779141 100644 (file)
@@ -5,7 +5,8 @@ io.files io.pathnames io.buffers io.ports io.timeouts
 io.backend.unix io.encodings.utf8 unix.linux.inotify assocs
 namespaces make threads continuations init math math.bitwise
 sets alien alien.strings alien.c-types vocabs.loader accessors
-system hashtables destructors unix classes.struct ;
+system hashtables destructors unix classes.struct literals ;
+FROM: namespaces => set ;
 IN: io.monitors.linux
 
 SYMBOL: watches
@@ -64,13 +65,13 @@ M: linux-monitor dispose* ( monitor -- )
     tri ;
 
 : ignore-flags? ( mask -- ? )
-    {
+    flags{
         IN_DELETE_SELF
         IN_MOVE_SELF
         IN_UNMOUNT
         IN_Q_OVERFLOW
         IN_IGNORED
-    } flags bitand 0 > ;
+    } bitand 0 > ;
 
 : parse-action ( mask -- changed )
     [
@@ -81,7 +82,7 @@ M: linux-monitor dispose* ( monitor -- )
         IN_MOVED_FROM +rename-file-old+ ?flag
         IN_MOVED_TO +rename-file-new+ ?flag
         drop
-    ] { } make prune ;
+    ] { } make members ;
 
 : parse-event-name ( event -- name )
     dup len>> zero?
index 731798c424f01b0cd4d32002d5984335823d753a..f3e744a59af4628351223ad448408c80e115c252 100644 (file)
@@ -24,7 +24,7 @@ TUPLE: monitor < disposable path queue timeout ;
 
 M: monitor timeout timeout>> ;
 
-M: monitor set-timeout (>>timeout) ;
+M: monitor set-timeout timeout<< ;
 
 <PRIVATE
 
index b573e2fa2b43f49b72cae37d35f512e94cee9508..70daed901851d66083e3dd98b424114f1e74e6a9 100644 (file)
@@ -1,9 +1,10 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors sequences assocs arrays continuations
 destructors combinators kernel threads concurrency.messaging
 concurrency.mailboxes concurrency.promises io.files io.files.info
-io.directories io.pathnames io.monitors debugger fry ;
+io.directories io.pathnames io.monitors io.monitors.private
+debugger fry ;
 IN: io.monitors.recursive
 
 ! Simulate recursive monitors on platforms that don't have them
@@ -71,12 +72,14 @@ M: recursive-monitor dispose*
     ] with with each ;
 
 : pump-loop ( -- )
-    receive dup +stop+ eq? [
-        drop stop-pump
-    ] [
-        [ '[ _ update-hierarchy ] ignore-errors ] [ pump-step ] bi
-        pump-loop
-    ] if ;
+    receive {
+        { [ dup +stop+ eq? ] [ drop stop-pump ] }
+        { [ dup monitor-disposed eq? ] [ drop ] }
+        [
+            [ '[ _ update-hierarchy ] ignore-errors ] [ pump-step ] bi
+            pump-loop
+        ]
+    } cond ;
 
 : monitor-ready ( error/t -- )
     monitor tget ready>> fulfill ;
index 4d061cbb1ad2df8a0c79cad79cf738509998ba4b..e6a055a9d62f998fc78da3606ee0b05bd5e9a26c 100644 (file)
@@ -5,7 +5,7 @@ locals kernel math assocs namespaces make continuations sequences
 hashtables sorting arrays combinators math.bitwise strings
 system accessors threads splitting io.backend io.backend.windows
 io.backend.windows.nt io.files.windows.nt io.monitors io.ports
-io.buffers io.files io.timeouts io.encodings.string
+io.buffers io.files io.timeouts io.encodings.string literals
 io.encodings.utf16n io windows.errors windows.kernel32 windows.types
 io.pathnames classes.struct ;
 IN: io.monitors.windows.nt
@@ -16,7 +16,7 @@ IN: io.monitors.windows.nt
     share-mode
     f
     OPEN_EXISTING
-    { FILE_FLAG_BACKUP_SEMANTICS FILE_FLAG_OVERLAPPED } flags
+    flags{ FILE_FLAG_BACKUP_SEMANTICS FILE_FLAG_OVERLAPPED }
     f
     CreateFile opened-file ;
 
index 7fce8b4de22bcab96332a5205a7cc11922ab10cf..d58e5e3d5f883b18334fb8df40c94cf286829443 100644 (file)
@@ -3,14 +3,14 @@
 USING: alien alien.c-types arrays destructors io io.backend.windows libc
 windows.types math.bitwise windows.kernel32 windows namespaces
 make kernel sequences windows.errors assocs math.parser system
-random combinators accessors io.pipes io.ports ;
+random combinators accessors io.pipes io.ports literals ;
 IN: io.pipes.windows.nt
 
 ! This code is based on
 ! http://twistedmatrix.com/trac/browser/trunk/twisted/internet/iocpreactor/process.py
 
 : create-named-pipe ( name -- handle )
-    { PIPE_ACCESS_INBOUND FILE_FLAG_OVERLAPPED } flags
+    flags{ PIPE_ACCESS_INBOUND FILE_FLAG_OVERLAPPED }
     PIPE_TYPE_BYTE
     1
     4096
@@ -21,7 +21,7 @@ IN: io.pipes.windows.nt
 
 : open-other-end ( name -- handle )
     GENERIC_WRITE
-    { FILE_SHARE_READ FILE_SHARE_WRITE } flags
+    flags{ FILE_SHARE_READ FILE_SHARE_WRITE }
     default-security-attributes
     OPEN_EXISTING
     FILE_FLAG_OVERLAPPED
diff --git a/basis/io/ports/ports-tests.factor b/basis/io/ports/ports-tests.factor
new file mode 100644 (file)
index 0000000..d2fb576
--- /dev/null
@@ -0,0 +1,25 @@
+USING: destructors io io.directories io.encodings.binary
+io.files io.files.temp kernel libc math sequences
+specialized-arrays.instances.alien.c-types.int tools.test ;
+IN: io.ports.tests
+
+! Make sure that writing malloced storage to a file works, and
+! also make sure that writes larger than the buffer size work
+
+[ ] [
+    "test.txt" temp-file binary [
+        [
+            100,000 iota
+            0
+            100,000 malloc-int-array &free [ copy ] keep write
+        ] with-destructors
+    ] with-file-writer
+] unit-test
+
+[ t ] [
+    "test.txt" temp-file binary [
+        100,000 4 * read int-array-cast 100,000 iota sequence=
+    ] with-file-reader
+] unit-test
+
+[ ] [ "test.txt" temp-file delete-file ] unit-test
index 727d69adf8d2382415a1c18ff6962c6040c1159f..6a30a1ed07c76b86ba11dbd873010f66a7e42e67 100644 (file)
@@ -1,10 +1,11 @@
-! Copyright (C) 2005, 2008 Slava Pestov, Doug Coleman
+! Copyright (C) 2005, 2010 Slava Pestov, Doug Coleman
 ! See http://factorcode.org/license.txt for BSD license.
 USING: math kernel io sequences io.buffers io.timeouts generic
 byte-vectors system io.encodings math.order io.backend
-continuations classes byte-arrays namespaces splitting
-grouping dlists assocs io.encodings.binary summary accessors
-destructors combinators ;
+continuations classes byte-arrays namespaces splitting grouping
+dlists alien alien.c-types assocs io.encodings.binary summary
+accessors destructors combinators fry specialized-arrays ;
+SPECIALIZED-ARRAY: uchar
 IN: io.ports
 
 SYMBOL: default-buffer-size
@@ -14,7 +15,7 @@ TUPLE: port < disposable handle timeout ;
 
 M: port timeout timeout>> ;
 
-M: port set-timeout (>>timeout) ;
+M: port set-timeout timeout<< ;
 
 : <port> ( handle class -- port )
     new-disposable swap >>handle ; inline
@@ -111,14 +112,17 @@ M: output-port stream-write1
     1 over wait-to-write
     buffer>> byte>buffer ; inline
 
+: write-in-groups ( byte-array port -- )
+    [ binary-object <direct-uchar-array> ] dip
+    [ buffer>> size>> <sliced-groups> ] [ '[ _ stream-write ] ] bi
+    each ;
+
 M: output-port stream-write
     dup check-disposed
-    over length over buffer>> size>> > [
-        [ buffer>> size>> <groups> ]
-        [ [ stream-write ] curry ] bi
-        each
+    2dup [ byte-length ] [ buffer>> size>> ] bi* > [
+        write-in-groups
     ] [
-        [ [ length ] dip wait-to-write ]
+        [ [ byte-length ] dip wait-to-write ]
         [ buffer>> >buffer ] 2bi
     ] if ;
 
@@ -194,5 +198,3 @@ io.encodings.private ;
 HINTS: decoder-read-until { string input-port utf8 } { string input-port ascii } ;
 
 HINTS: decoder-readln { input-port utf8 } { input-port ascii } ;
-
-HINTS: encoder-write { object output-port utf8 } { object output-port ascii } ;
index fdd42352daca7cbf0e1b1beed7a51f0d76057980..4dfdc13bc93933ece11ff9b52ce2f8b9d13cd34b 100644 (file)
@@ -79,7 +79,7 @@ M: threaded-server handle-client* handler>> call( -- ) ;
         [ timeout>> timeouts ] [ handle-client* ] bi
     ] with-stream ;
 
-\ handle-client ERROR add-error-logging
+\ handle-client NOTICE add-error-logging
 
 : thread-name ( server-name addrspec -- string )
     unparse-short " connection from " glue ;
index b3cf28a497909e1b22c91992d15e82157f3e10df..ca7ba0cd497671f4e234ffc5ecb173e0e28addb4 100644 (file)
@@ -31,7 +31,7 @@ TUPLE: openssl-context < secure-context aliens sessions ;
     ] [ drop ] if ;
 
 : password-callback ( -- alien )
-    int { void* int bool void* } "cdecl"
+    int { void* int bool void* } cdecl
     [| buf size rwflag password! |
         password [ B{ 0 } password! ] unless
 
index 8cc6ef731dfbc6da8eb17d5dd8ef25b493108dd2..a41fc1e6c339be8c178d2592f1688c06dfff782f 100644 (file)
@@ -192,12 +192,13 @@ HELP: <datagram>
     }
 }
 { $notes
-    "To accept UDP/IP packets from any host, use an address specifier returned by the following code, where 1234 is the desired port number:"
-    { $code "f 1234 <inet> resolve-host" }
-    "To accept UDP/IP packets from the loopback interface only, use an address specifier returned by the following code, where 1234 is the desired port number:"
-    { $code "\"localhost\" 1234 <inet> resolve-host" }
+    "To accept UDP/IP packets from any host, use an address specifier where the host name is set to " { $link f } ":"
+    { $code "f 1234 <inet4> <datagram>" }
+    "To create a datagram socket bound to a randomly-assigned port, set the port number in the address specifier to 0, and then read the " { $snippet "addr" } " slot of the datagram instance to obtain the actual port number it is bound to:"
+    { $code "f 0 <inet4> <datagram>" }
+    "To accept UDP/IP packets from the loopback interface only, use an address specifier like the following:"
+    { $code "\"127.0.0.1\" 1234 <inet4> <datagram>s" }
     "Since " { $link resolve-host } " can return multiple address specifiers, your code must create a datagram socket for each one and co-ordinate packet sending accordingly."
-    "Datagrams are low-level binary ports that don't map onto streams, so the constructor does not use an encoding"
 }
 { $errors "Throws an error if the port is already in use, or if the OS forbids access." } ;
 
index 59d12f95bc60e9ceb35cb73eded12ad0a59ae3ee..a1260e80bea712ca1c0015dd540759bf15b0db9c 100644 (file)
@@ -241,7 +241,7 @@ HOOK: (send) io-backend ( packet addrspec datagram -- )
     parse-sockaddr ;
 
 : parse-addrinfo-list ( addrinfo -- seq )
-    [ next>> dup [ addrinfo memory>struct ] when ] follow
+    [ next>> ] follow
     [ addrinfo>addrspec ] map
     sift ;
 
index 8eb2df5b4624f3725f89e608c9c198350f5c1883..17e92b9b9fd91b0d0c0cfa10bedfc850b8936af4 100644 (file)
@@ -17,7 +17,7 @@ M: winnt WSASocket-flags ( -- DWORD )
     SIO_GET_EXTENSION_FUNCTION_POINTER
     WSAID_CONNECTEX
     GUID heap-size
-    void* <c-object>
+    { void* }
     [
         void* heap-size
         DWORD <c-object>
@@ -26,7 +26,7 @@ M: winnt WSASocket-flags ( -- DWORD )
         WSAIoctl SOCKET_ERROR = [
             winsock-error-string throw
         ] when
-    ] keep *void* ;
+    ] [ ] with-out-parameters ;
 
 TUPLE: ConnectEx-args port
     s name namelen lpSendBuffer dwSendDataLength
@@ -57,7 +57,7 @@ TUPLE: ConnectEx-args port
     } cleave
     int
     { SOCKET void* int PVOID DWORD LPDWORD void* }
-    "stdcall" alien-indirect drop
+    stdcall alien-indirect drop
     winsock-error-string [ throw ] when* ; inline
 
 M: object establish-connection ( client-out remote -- )
index 0f3ac39607e089ac63c99c92c12d14d7a9ae1529..cf1edc0cb1bc0f407703e2cd73ee9a61b60551f9 100644 (file)
@@ -34,7 +34,7 @@ M: win32-socket dispose ( stream -- )
     handle>> closesocket drop ;\r
 \r
 : unspecific-sockaddr/size ( addrspec -- sockaddr len )\r
-    [ empty-sockaddr/size ] [ protocol-family ] bi pick (>>family) ;\r
+    [ empty-sockaddr/size ] [ protocol-family ] bi pick family<< ;\r
 \r
 : opened-socket ( handle -- win32-socket )\r
     <win32-socket> |dispose dup add-completion ;\r
diff --git a/basis/io/streams/byte-array/fast/authors.txt b/basis/io/streams/byte-array/fast/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/io/streams/byte-array/fast/fast.factor b/basis/io/streams/byte-array/fast/fast.factor
new file mode 100644 (file)
index 0000000..e231335
--- /dev/null
@@ -0,0 +1,15 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien byte-vectors io kernel libc math sequences ;
+IN: io.streams.byte-array.fast
+
+! This is split off from io.streams.byte-array because it uses
+! memcpy, which is a non-core word that only works after the
+! optimizing compiler has been loaded.
+
+M: byte-vector stream-write
+    [ dup byte-length tail-slice ]
+    [ [ [ byte-length ] bi@ + ] keep lengthen ]
+    [ drop byte-length ]
+    2tri
+    [ >c-ptr swap >c-ptr ] dip memcpy ;
index f5aab9c97619a5e66ea5cabed0e2735c190b36c7..25f1d88363597ae08385d2c83450e52572428fd9 100644 (file)
@@ -128,9 +128,9 @@ M: limited-stream stream-read-partial
 
 :: limited-stream-seek ( n seek-type stream -- )
     seek-type {
-        { seek-absolute [ n stream (>>current) ] }
+        { seek-absolute [ n stream current<< ] }
         { seek-relative [ stream [ n + ] change-current drop ] }
-        { seek-end [ stream stop>> n - stream (>>current) ] }
+        { seek-end [ stream stop>> n - stream current<< ] }
         [ bad-seek-type ]
     } case ;
 
index 994dcd9c501f81d07dfe571f8a4b0f6f29432936..519dec3567715f92588c4a9267bd1c48abb4c736 100644 (file)
@@ -14,6 +14,9 @@ SYMBOL: io-thread-running?
     [ [ io-thread-running? get-global ] [ io-thread ] while ]\r
     "I/O wait" spawn drop ;\r
 \r
+: stop-io-thread ( -- )\r
+    f io-thread-running? set-global ;\r
+\r
 [\r
     t io-thread-running? set-global\r
     start-io-thread\r
index 8e69983e9c8d5e2983fb2b07da4dd9f33bf65f79..957ba301938033cfd9d8ac2f71257fede331dec0 100644 (file)
@@ -17,7 +17,7 @@ GENERIC: cancel-operation ( obj -- )
     [ '[ _ cancel-operation ] ] dip later ;\r
 \r
 : with-timeout* ( obj timeout quot -- )\r
-    3dup drop queue-timeout [ nip call ] dip cancel-alarm ;\r
+    3dup drop queue-timeout [ nip call ] dip stop-alarm ;\r
     inline\r
 \r
 : with-timeout ( obj quot -- )\r
index ca339a78ef2c3ea8308464118187942a1d6f2b0b..a2ac0d5e6f359ad3b81de2a2bc58751cc1781ae0 100644 (file)
@@ -162,10 +162,10 @@ FUNCTION: IOReturn IOHIDDeviceGetValue ( IOHIDDeviceRef device, IOHIDElementRef
 FUNCTION: IOReturn IOHIDDeviceCopyValueMultiple ( IOHIDDeviceRef device, CFArrayRef elements, CFDictionaryRef* pMultiple ) ;
 FUNCTION: IOReturn IOHIDDeviceGetValueWithCallback ( IOHIDDeviceRef device, IOHIDElementRef element, IOHIDValueRef* pValue, CFTimeInterval timeout, IOHIDValueCallback callback, void* context ) ;
 FUNCTION: IOReturn IOHIDDeviceCopyValueMultipleWithCallback ( IOHIDDeviceRef device, CFArrayRef elements, CFDictionaryRef* pMultiple, CFTimeInterval timeout, IOHIDValueMultipleCallback callback, void* context ) ;
-FUNCTION: IOReturn IOHIDDeviceSetReport ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, uchar* report, CFIndex reportLength ) ;
-FUNCTION: IOReturn IOHIDDeviceSetReportWithCallback ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, uchar* report, CFIndex reportLength, CFTimeInterval timeout, IOHIDReportCallback callback, void* context ) ;
-FUNCTION: IOReturn IOHIDDeviceGetReport ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, uchar* report, CFIndex* pReportLength ) ;
-FUNCTION: IOReturn IOHIDDeviceGetReportWithCallback ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, uchar* report, CFIndex* pReportLength, CFTimeInterval timeout, IOHIDReportCallback callback, void* context ) ;
+FUNCTION: IOReturn IOHIDDeviceSetReport ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, char* report, CFIndex reportLength ) ;
+FUNCTION: IOReturn IOHIDDeviceSetReportWithCallback ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, char* report, CFIndex reportLength, CFTimeInterval timeout, IOHIDReportCallback callback, void* context ) ;
+FUNCTION: IOReturn IOHIDDeviceGetReport ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, char* report, CFIndex* pReportLength ) ;
+FUNCTION: IOReturn IOHIDDeviceGetReportWithCallback ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, char* report, CFIndex* pReportLength, CFTimeInterval timeout, IOHIDReportCallback callback, void* context ) ;
 
 ! IOHIDManager
 
@@ -226,8 +226,8 @@ FUNCTION: Boolean IOHIDElementSetProperty ( IOHIDElementRef element, CFStringRef
 
 FUNCTION: CFTypeID IOHIDValueGetTypeID ( ) ;
 FUNCTION: IOHIDValueRef IOHIDValueCreateWithIntegerValue ( CFAllocatorRef allocator, IOHIDElementRef element, ulonglong timeStamp, CFIndex value ) ;
-FUNCTION: IOHIDValueRef IOHIDValueCreateWithBytes ( CFAllocatorRef allocator, IOHIDElementRef element, ulonglong timeStamp, uchar* bytes, CFIndex length ) ;
-FUNCTION: IOHIDValueRef IOHIDValueCreateWithBytesNoCopy ( CFAllocatorRef allocator, IOHIDElementRef element, ulonglong timeStamp, uchar* bytes, CFIndex length ) ;
+FUNCTION: IOHIDValueRef IOHIDValueCreateWithBytes ( CFAllocatorRef allocator, IOHIDElementRef element, ulonglong timeStamp, c-string bytes, CFIndex length ) ;
+FUNCTION: IOHIDValueRef IOHIDValueCreateWithBytesNoCopy ( CFAllocatorRef allocator, IOHIDElementRef element, ulonglong timeStamp, c-string bytes, CFIndex length ) ;
 FUNCTION: IOHIDElementRef IOHIDValueGetElement ( IOHIDValueRef value ) ;
 FUNCTION: ulonglong IOHIDValueGetTimeStamp ( IOHIDValueRef value ) ;
 FUNCTION: CFIndex IOHIDValueGetLength ( IOHIDValueRef value ) ;
index 2b31e5c8a814022623ba57d4d37cb82641488a33..5720fc5997896a1ed9066686d8fa0e5979da9611 100644 (file)
@@ -1,4 +1,4 @@
-USING: alien.syntax alien.c-types core-foundation
+USING: alien.syntax alien.c-types alien.data core-foundation
 core-foundation.bundles core-foundation.dictionaries system
 combinators kernel sequences io accessors unix.types ;
 IN: iokit
@@ -104,9 +104,9 @@ CONSTANT: KERN_SUCCESS 0
 
 FUNCTION: IOReturn IOMasterPort ( mach_port_t bootstrap, mach_port_t* master ) ;
 
-FUNCTION: CFDictionaryRef IOServiceMatching ( char* name ) ;
-FUNCTION: CFDictionaryRef IOServiceNameMatching ( char* name ) ;
-FUNCTION: CFDictionaryRef IOBSDNameMatching ( char* name ) ;
+FUNCTION: CFDictionaryRef IOServiceMatching ( c-string name ) ;
+FUNCTION: CFDictionaryRef IOServiceNameMatching ( c-string name ) ;
+FUNCTION: CFDictionaryRef IOBSDNameMatching ( c-string name ) ;
 
 FUNCTION: IOReturn IOObjectRetain ( io_object_t o ) ;
 FUNCTION: IOReturn IOObjectRelease ( io_object_t o ) ;
@@ -121,7 +121,7 @@ FUNCTION: IOReturn IORegistryEntryGetPath ( io_registry_entry_t entry, io_name_t
 
 FUNCTION: IOReturn IORegistryEntryCreateCFProperties ( io_registry_entry_t entry, CFMutableDictionaryRef properties, CFAllocatorRef allocator, IOOptionBits options ) ;
 
-FUNCTION: char* mach_error_string ( IOReturn error ) ;
+FUNCTION: c-string mach_error_string ( IOReturn error ) ;
 
 TUPLE: mach-error error-code error-string ;
 : <mach-error> ( code -- error )
@@ -131,12 +131,11 @@ TUPLE: mach-error error-code error-string ;
     dup KERN_SUCCESS = [ drop ] [ <mach-error> throw ] if ;
 
 : master-port ( -- port )
-    MACH_PORT_NULL 0 <uint> [ IOMasterPort mach-error ] keep *uint ;
+    MACH_PORT_NULL { uint } [ IOMasterPort mach-error ] [ ] with-out-parameters ;
 
 : io-services-matching-dictionary ( nsdictionary -- iterator )
-    master-port swap 0 <uint>
-    [ IOServiceGetMatchingServices mach-error ] keep
-    *uint ;
+    master-port swap
+    { uint } [ IOServiceGetMatchingServices mach-error ] [ ] with-out-parameters ;
 
 : io-services-matching-service ( service -- iterator )
     IOServiceMatching io-services-matching-dictionary ;
index b89f4174bfa3776a4a8e7c8fbcee053f062c04db..74e96b08d3c82ef7481ef99afdba657f04dbe31e 100644 (file)
@@ -32,6 +32,10 @@ HELP: free
 { $values { "alien" c-ptr } }
 { $description "Deallocates a block of memory allocated by " { $link malloc } ", " { $link calloc } " or " { $link realloc } "." } ;
 
+HELP: (free)
+{ $values { "alien" c-ptr } }
+{ $description "Deallocates a block of memory allocated by an external C library." } ;
+
 HELP: &free
 { $values { "alien" c-ptr } }
 { $description "Marks the block of memory for unconditional deallocation at the end of the current " { $link with-destructors } " scope." } ;
index e935d49748fd3c533479ee0e5bbeabbf5dd59d46..68d041ac8faa482a2b1990a9d973706afdec7ffe 100644 (file)
@@ -1,16 +1,19 @@
 ! Copyright (C) 2004, 2005 Mackenzie Straight
-! Copyright (C) 2007, 2009 Slava Pestov
+! Copyright (C) 2007, 2010 Slava Pestov
 ! Copyright (C) 2007, 2008 Doug Coleman
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types assocs continuations alien.destructors kernel
-namespaces accessors sets summary destructors destructors.private ;
+USING: alien alien.c-types alien.syntax assocs continuations
+alien.destructors kernel namespaces accessors sets summary
+destructors destructors.private ;
 IN: libc
 
-: errno ( -- int )
-    int "factor" "err_no" { } alien-invoke ;
+LIBRARY: factor
 
-: set-errno ( int -- )
-    void "factor" "set_err_no" { int } alien-invoke ;
+FUNCTION-ALIAS: errno
+    int err_no ( ) ;
+
+FUNCTION-ALIAS: set-errno
+    void set_err_no ( int err-no ) ;
 
 : clear-errno ( -- )
     0 set-errno ;
@@ -18,19 +21,21 @@ IN: libc
 : preserve-errno ( quot -- )
     errno [ call ] dip set-errno ; inline
 
-<PRIVATE
+LIBRARY: libc
 
-: (malloc) ( size -- alien )
-    void* "libc" "malloc" { ulong } alien-invoke ;
+FUNCTION-ALIAS: (malloc)
+    void* malloc ( size_t size ) ;
 
-: (calloc) ( count size -- alien )
-    void* "libc" "calloc" { ulong ulong } alien-invoke ;
+FUNCTION-ALIAS: (calloc)
+    void* calloc ( size_t count,  size_t size ) ;
 
-: (free) ( alien -- )
-    void "libc" "free" { void* } alien-invoke ;
+FUNCTION-ALIAS: (free)
+    void free ( void* alien ) ;
 
-: (realloc) ( alien size -- newalien )
-    void* "libc" "realloc" { void* ulong } alien-invoke ;
+FUNCTION-ALIAS: (realloc)
+    void* realloc ( void* alien, size_t size ) ;
+
+<PRIVATE
 
 ! We stick malloc-ptr instances in the global disposables set
 TUPLE: malloc-ptr value continuation ;
@@ -86,16 +91,16 @@ PRIVATE>
 : free ( alien -- )
     >c-ptr [ delete-malloc ] [ (free) ] bi ;
 
-: memcpy ( dst src size -- )
-    void "libc" "memcpy" { void* void* ulong } alien-invoke ;
+FUNCTION: void memcpy ( void* dst, void* src, ulong size ) ;
 
-: memcmp ( a b size -- cmp )
-    int "libc" "memcmp" { void* void* ulong } alien-invoke ;
+FUNCTION: int memcmp ( void* a, void* b, ulong size ) ;
 
 : memory= ( a b size -- ? )
     memcmp 0 = ;
 
-: strlen ( alien -- len )
-    size_t "libc" "strlen" { char* } alien-invoke ;
+FUNCTION: size_t strlen ( c-string alien ) ;
+
+FUNCTION: int system ( c-string command ) ;
 
 DESTRUCTOR: free
+DESTRUCTOR: (free)
index 53fde946872390a1e3b7365477e89994247220f6..a3056b03327f334fb65102d6cce345333361921b 100644 (file)
@@ -127,19 +127,19 @@ HELP: unswons
 { leach foldl lmap>array } related-words
 
 HELP: leach
-{ $values { "list" list } { "quot" { $quotation "( obj -- )" } } }
+{ $values { "list" list } { "quot" { $quotation "( ... elt -- ... )" } } }
 { $description "Call the quotation for each item in the list." } ;
 
 HELP: foldl
-{ $values { "list" list } { "identity" "an object" } { "quot" { $quotation "( prev elt -- next )" } } { "result" "the final result" } }
+{ $values { "list" list } { "identity" "an object" } { "quot" { $quotation "( ... prev elt -- ... next )" } } { "result" "the final result" } }
 { $description "Combines successive elements of the list (in a left-assocative order) using a binary operation and outputs the final result." } ;
 
 HELP: foldr
-{ $values { "list" list } { "identity" "an object" } { "quot" { $quotation "( prev elt -- next )" } } { "result" "the final result" } }
+{ $values { "list" list } { "identity" "an object" } { "quot" { $quotation "( ... prev elt -- ... next )" } } { "result" "the final result" } }
 { $description "Combines successive elements of the list (in a right-assocative order) using a binary operation, and outputs the final result." } ;
 
 HELP: lmap
-{ $values { "list" list } { "quot" { $quotation "( old -- new )" } } { "result" "the final result" } }
+{ $values { "list" list } { "quot" { $quotation "( ... elt -- ... newelt )" } } { "result" "the final result" } }
 { $description "Applies the quotation to each element of the list in order, collecting the new elements into a new list." } ;
 
 HELP: lreverse
index 29adcd47d65d594167bf28a8b261d2555e73c85e..1e009df25c81b6dda4193b9c78aea344dbb5b573 100644 (file)
@@ -55,16 +55,16 @@ M: object nil? drop f ;
 
 PRIVATE>
 
-: leach ( list quot: ( elt -- ) -- )
+: leach ( ... list quot: ( ... elt -- ... ) -- ... )
     over nil? [ 2drop ] [ (leach) leach ] if ; inline recursive
 
-: lmap ( list quot: ( elt -- ) -- result )
+: lmap ( ... list quot: ( ... elt -- ... newelt ) -- ... result )
     over nil? [ drop ] [ (leach) lmap cons ] if ; inline recursive
 
-: foldl ( list identity quot: ( obj1 obj2 -- obj ) -- result )
+: foldl ( ... list identity quot: ( ... prev elt -- ... next ) -- ... result )
     swapd leach ; inline
 
-:: foldr ( list identity quot: ( obj1 obj2 -- obj ) -- result )
+:: foldr ( ... list identity quot: ( ... prev elt -- ... next ) -- ... result )
     list nil? [ identity ] [
         list cdr identity quot foldr
         list car quot call
@@ -87,7 +87,7 @@ PRIVATE>
 : sequence>list ( sequence -- list )    
     <reversed> nil [ swons ] reduce ;
 
-: lmap>array ( list quot -- array )
+: lmap>array ( ... list quot: ( ... elt -- ... newelt ) -- ... array )
     collector [ leach ] dip { } like ; inline
 
 : list>array ( list -- array )  
index a464d75b22bbe939c29e9d97d439ca6eff59c734..6fcf8a5e07c807970d6b510e9fef5704f0c68384 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: help.markup help.syntax kernel multiline ;
+USING: help.markup help.syntax kernel multiline sequences ;
 IN: literals
 
 HELP: $
@@ -62,6 +62,19 @@ ${ five six 7 } .
 
 { POSTPONE: $ POSTPONE: $[ POSTPONE: ${ } related-words
 
+HELP: flags{
+{ $values { "values" sequence } }
+{ $description "Constructs a constant flag value from a sequence of integers or words that output integers. The resulting constant is computed at parse-time, which makes this word as efficient as using a literal integer." }
+{ $examples
+    { $example "USING: literals kernel prettyprint ;"
+        "IN: scratchpad"
+        "CONSTANT: x HEX: 1"
+        "flags{ HEX: 20 x BIN: 100 } .h"
+        "25"
+    }
+} ;
+
+
 ARTICLE: "literals" "Interpolating code results into literal values"
 "The " { $vocab-link "literals" } " vocabulary contains words to run code at parse time and insert the results into more complex literal values."
 { $example """
index d7256a64b140f840b8197c2a8594b68035959955..4357198db6e45a68c2372d0a9e7e6612bca764b3 100644 (file)
@@ -1,4 +1,4 @@
-USING: kernel literals math tools.test ;
+USING: accessors kernel literals math tools.test ;
 IN: literals.tests
 
 <<
@@ -27,3 +27,16 @@ CONSTANT: constant-a 3
 : sixty-nine ( -- a b ) 6 9 ;
 
 [ { 6 9 } ] [ ${ sixty-nine } ] unit-test
+
+CONSTANT: a 1
+CONSTANT: b 2
+ALIAS: c b
+ALIAS: d c
+
+CONSTANT: foo flags{ a b d }
+
+[ 3 ] [ foo ] unit-test
+[ 3 ] [ flags{ a b d } ] unit-test
+\ foo def>> must-infer
+
+[ 1 ] [ flags{ 1 } ] unit-test
index 001c56525f3852c5884c7819d1d43ee16944f72f..42a7ab9668a68dc2fb5912d28a6c3b4f56f0a83b 100644 (file)
@@ -1,6 +1,6 @@
 ! (c) Joe Groff, see license for details
-USING: accessors continuations kernel parser words quotations
-vectors sequences fry ;
+USING: accessors combinators continuations fry kernel lexer
+math parser quotations sequences vectors words words.alias ;
 IN: literals
 
 <PRIVATE
@@ -8,8 +8,13 @@ IN: literals
 ! Use def>> call so that CONSTANT:s defined in the same file can
 ! be called
 
+: expand-alias ( obj -- obj' )
+    dup alias? [ def>> first expand-alias ] when ;
+
 : expand-literal ( seq obj -- seq' )
-    '[ _ dup word? [ def>> call ] when ] with-datastack ;
+    '[
+        _ expand-alias dup word? [ def>> call ] when
+    ] with-datastack ;
 
 : expand-literals ( seq -- seq' )
     [ [ { } ] dip expand-literal ] map concat ;
@@ -19,3 +24,8 @@ PRIVATE>
 SYNTAX: $ scan-word expand-literal >vector ;
 SYNTAX: $[ parse-quotation with-datastack >vector ;
 SYNTAX: ${ \ } [ expand-literals ] parse-literal ;
+SYNTAX: flags{
+    \ } [
+        expand-literals
+        0 [ bitor ] reduce
+    ] parse-literal ;
index 468671361f8fe34f63674e6ab30e94e38159ae74..d8a53b3c4e41d970e3d5e9d7037cf712f14b1fd1 100644 (file)
@@ -19,11 +19,6 @@ ERROR: local-writer-in-literal-error ;
 M: local-writer-in-literal-error summary
     drop "Local writer words not permitted inside literals" ;
 
-ERROR: local-word-in-literal-error ;
-
-M: local-word-in-literal-error summary
-    drop "Local words not permitted inside literals" ;
-
 ERROR: :>-outside-lambda-error ;
 
 M: :>-outside-lambda-error summary
index 8e940bfdd8b8100fb9eedc68c0253e0b8411d795..5fd12e2fb3fe611fb6383e9bc8e07b63a6917f27 100644 (file)
@@ -26,7 +26,5 @@ SYNTAX: MEMO:: (::) define-memoized ;
     "locals.fry"
 } [ require ] each
 
-"prettyprint" vocab [
-    "locals.definitions" require
-    "locals.prettyprint" require
-] when
+{ "locals" "prettyprint" } "locals.definitions" require-when
+{ "locals" "prettyprint" } "locals.prettyprint" require-when
index c0184ee0efed1be229a01e3eee80d41f813b478b..01be7bcd20ae44b13a380fab80a9d645d7c24670 100644 (file)
@@ -21,9 +21,8 @@ SYMBOL: in-lambda?
 : make-locals ( seq -- words assoc )
     [ [ make-local ] map ] H{ } make-assoc ;
 
-: make-local-word ( name def -- word )
-    [ <local-word> [ dup name>> set ] [ ] [ ] tri ] dip
-    "local-word-def" set-word-prop ;
+: parse-local-defs ( -- words assoc )
+    [ "|" [ make-local ] map-tokens ] H{ } make-assoc ;
 
 SINGLETON: lambda-parser
 
@@ -42,12 +41,12 @@ SYMBOL: locals
     [ \ ] parse-until >quotation ] ((parse-lambda)) ;
 
 : parse-lambda ( -- lambda )
-    "|" parse-tokens make-locals
+    parse-local-defs
     (parse-lambda) <lambda>
     ?rewrite-closures ;
 
 : parse-multi-def ( locals -- multi-def )
-    ")" parse-tokens swap [ [ make-local ] map ] bind <multi-def> ;
+    [ ")" [ make-local ] map-tokens ] bind <multi-def> ;
 
 : parse-def ( name/paren locals -- def )
     over "(" = [ nip parse-multi-def ] [ [ make-local ] bind <def> ] if ;
index d85155daade0546d9376bb9e04c2bb5f3cb6a3a6..b0f1426bec6fe20a7138b9229972e8af55718f15 100644 (file)
@@ -18,7 +18,7 @@ GENERIC: rewrite-closures* ( obj -- )
 
 GENERIC: defs-vars* ( seq form -- seq' )
 
-: defs-vars ( form -- vars ) { } [ defs-vars* ] reduce prune ;
+: defs-vars ( form -- vars ) { } [ defs-vars* ] reduce members ;
 
 M: def defs-vars* local>> unquote suffix ;
 
@@ -28,7 +28,7 @@ M: object defs-vars* drop ;
 
 GENERIC: uses-vars* ( seq form -- seq' )
 
-: uses-vars ( form -- vars ) { } [ uses-vars* ] reduce prune ;
+: uses-vars ( form -- vars ) { } [ uses-vars* ] reduce members ;
 
 M: local-writer uses-vars* "local-reader" word-prop suffix ;
 
index 4e91e3d87b5dbca91e603b6a925afa665ef54ee2..0b010a559163d837396deff89b8ca3f3c5b145dc 100644 (file)
@@ -21,8 +21,6 @@ M: local localize dupd read-local-quot ;
 
 M: quote localize dupd local>> read-local-quot ;
 
-M: local-word localize dupd read-local-quot [ call ] append ;
-
 M: local-reader localize dupd read-local-quot [ local-value ] append ;
 
 M: local-writer localize
index a8a12d2614d86c3e353e44e93ca76db7d9e3db76..110cc6ad81db7249dba9ccb2b2aacd274b2b456a 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2007, 2008 Slava Pestov, Eduardo Cavazos.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs classes classes.tuple fry
-generalizations hashtables kernel locals locals.backend
+sequences.generalizations hashtables kernel locals locals.backend
 locals.errors locals.types make quotations sequences vectors
 words ;
 IN: locals.rewrite.sugar
@@ -82,9 +82,6 @@ M: local-reader rewrite-element , ;
 M: local-writer rewrite-element
     local-writer-in-literal-error ;
 
-M: local-word rewrite-element
-    local-word-in-literal-error ;
-
 M: word rewrite-element <wrapper> , ;
 
 : rewrite-wrapper ( wrapper -- )
index 424ef682439edad6faaa049f2aec34366b09533c..a930765b7cea34b8223498cef1298b19eba462c2 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2007, 2009 Slava Pestov, Eduardo Cavazos.
+! Copyright (C) 2007, 2010 Slava Pestov, Eduardo Cavazos.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors combinators kernel sequences words
 quotations ;
@@ -35,11 +35,6 @@ PREDICATE: local < word "local?" word-prop ;
 
 M: local literalize ;
 
-PREDICATE: local-word < word "local-word?" word-prop ;
-
-: <local-word> ( name -- word )
-    f <word> dup t "local-word?" set-word-prop ;
-
 PREDICATE: local-reader < word "local-reader?" word-prop ;
 
 : <local-reader> ( name -- word )
@@ -58,5 +53,5 @@ PREDICATE: local-writer < word "local-writer?" word-prop ;
         [ nip ]
     } 2cleave ;
 
-UNION: lexical local local-reader local-writer local-word ;
+UNION: lexical local local-reader local-writer ;
 UNION: special lexical quote def ;
index 91baae631f507dfdeea5f92fac3c954e3d1762cd..72e37ef8af458561841b97b43b23d73227d107d7 100644 (file)
@@ -34,4 +34,4 @@ SYMBOL: insomniac-recipients
 \r
 : schedule-insomniac ( service word-names -- )\r
     [ [ email-log-report ] assoc-each rotate-logs ] 2curry\r
-    1 days every drop ;\r
+    1 days delayed-every drop ;\r
index c8179108ef12d359c2958bd413c5b68c164b09ff..7542c269bdff9be2b5779b093645cdccabe71ef7 100644 (file)
@@ -4,7 +4,8 @@ USING: logging.server sequences namespaces concurrency.messaging
 words kernel arrays shuffle tools.annotations\r
 prettyprint.config prettyprint debugger io.streams.string\r
 splitting continuations effects generalizations parser strings\r
-quotations fry accessors math assocs math.order ;\r
+quotations fry accessors math assocs math.order\r
+sequences.generalizations ;\r
 IN: logging\r
 \r
 SYMBOLS: DEBUG NOTICE WARNING ERROR CRITICAL ;\r
index 91ca2f301ca219e12b210c189d1a2f77b0faf61f..9137588e6c135a1a3e930677667b1968c483048e 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2007, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: parser kernel sequences words effects combinators assocs
-definitions quotations namespaces memoize accessors fry
-compiler.units ;
+USING: parser effects.parser kernel sequences words effects
+combinators assocs definitions quotations namespaces memoize
+accessors fry compiler.units ;
 IN: macros
 
 <PRIVATE
index b6369249b39502e5d99389cb82abef4d33e6669e..9baadfe1f265a1113c620aefe5cb7adcae1cfc0f 100644 (file)
@@ -17,7 +17,7 @@ SYMBOL: _
     [ define-match-var ] each ;
 
 SYNTAX: MATCH-VARS: ! vars ...
-    ";" parse-tokens define-match-vars ;
+    ";" [ define-match-var ] each-token ;
 
 : match-var? ( symbol -- bool )
     dup word? [ "match-var" word-prop ] [ drop f ] if ;
index bbc72d99e446c974f0a9d7416d254335d30786a4..4024953070565cb0d725c036cd798bb41160da64 100644 (file)
@@ -135,18 +135,6 @@ HELP: clear-bit
     }
 } ;
 
-HELP: flags
-{ $values { "values" sequence } }
-{ $description "Constructs a constant flag value from a sequence of integers or words that output integers. The resulting constant is computed at compile-time, which makes this word as efficient as using a literal integer." }
-{ $examples
-    { $example "USING: math.bitwise kernel prettyprint ;"
-        "IN: scratchpad"
-        "CONSTANT: x HEX: 1"
-        "{ HEX: 20 x BIN: 100 } flags .h"
-        "25"
-    }
-} ;
-
 HELP: symbols>flags
 { $values { "symbols" sequence } { "assoc" assoc } { "flag-bits" integer } }
 { $description "Constructs an integer value by mapping the values in the " { $snippet "symbols" } " sequence to integer values using " { $snippet "assoc" } " and " { $link bitor } "ing the values together." }
@@ -375,6 +363,10 @@ $nl
     bit?
     bit-clear?
 }
+"Toggling a bit:"
+{ $subsections
+    toggle-bit
+}
 "Operations with bitmasks:"
 { $subsections
     mask
@@ -404,7 +396,6 @@ $nl
 }
 "Bitfields:"
 { $subsections
-    flags
     "math-bitfields"
 } ;
 
index a5919d3ec30bedca953e789e698b4ac60a4422e2..93d2d9e882fa62408a66a9d5a364abbd22bea0e3 100644 (file)
@@ -1,6 +1,6 @@
 USING: accessors math math.bitwise tools.test kernel words
 specialized-arrays alien.c-types math.vectors.simd
-sequences destructors libc ;
+sequences destructors libc literals ;
 SPECIALIZED-ARRAY: int
 IN: math.bitwise.tests
 
@@ -23,17 +23,6 @@ IN: math.bitwise.tests
 : test-1+ ( x -- y ) 1 + ;
 [ 512 ] [ 1 { { test-1+ 8 } } bitfield ] unit-test
 
-CONSTANT: a 1
-CONSTANT: b 2
-
-: foo ( -- flags ) { a b } flags ;
-
-[ 3 ] [ foo ] unit-test
-[ 3 ] [ { a b } flags ] unit-test
-\ foo def>> must-infer
-
-[ 1 ] [ { 1 } flags ] unit-test
-
 [ 8 ] [ 0 3 toggle-bit ] unit-test
 [ 0 ] [ 8 3 toggle-bit ] unit-test
 
index e508b49a199d0d0054a9126e4a38f9415b500a50..563cbecd6c65cc4ceb090f6b9376982b5c1052ed 100644 (file)
@@ -44,10 +44,6 @@ IN: math.bitwise
 : W- ( x y -- z ) - 64 bits ; inline
 : W* ( x y -- z ) * 64 bits ; inline
 
-! flags
-MACRO: flags ( values -- )
-    [ 0 ] [ [ ?execute bitor ] curry compose ] reduce ;
-
 : symbols>flags ( symbols assoc -- flag-bits )
     [ at ] curry map
     0 [ bitor ] reduce ;
@@ -88,7 +84,7 @@ DEFER: byte-bit-count
 
 GENERIC: (bit-count) ( x -- n )
 
-M: fixnum (bit-count)
+: fixnum-bit-count ( x -- n )
     0 swap [
         dup 0 >
     ] [
@@ -96,6 +92,9 @@ M: fixnum (bit-count)
         [ + ] dip
     ] while drop ;
 
+M: fixnum (bit-count)
+    fixnum-bit-count ; inline
+
 M: bignum (bit-count)
     dup 0 = [ drop 0 ] [
         [ byte-bit-count ] [ -8 shift (bit-count) ] bi +
@@ -117,8 +116,7 @@ M: byte-array bit-count
     byte-array-bit-count ;
 
 M: object bit-count
-    [ >c-ptr ] [ byte-length ] bi <direct-uchar-array>
-    byte-array-bit-count ;
+    binary-object <direct-uchar-array> byte-array-bit-count ;
 
 : even-parity? ( obj -- ? ) bit-count even? ;
 
index 22c649c54422cf68eb436f42ee9392ea46ee9541..a551190dbdcc35e8080f5bd343a50bc633a54b3c 100644 (file)
@@ -137,7 +137,7 @@ M: blas-matrix-base clone
 : <empty-matrix> ( rows cols exemplar -- matrix )
     [ element-type heap-size * * <byte-array> ]
     [ 2drop ]
-    [ f swap (blas-matrix-like) ] 3tri ;
+    [ [ f ] dip (blas-matrix-like) ] 3tri ;
 
 : n*M.V+n*V ( alpha A x beta y -- alpha*A.x+b*y )
     clone n*M.V+n*V! ;
@@ -153,7 +153,7 @@ M: blas-matrix-base clone
     n*M.V+n*V! ; inline
 
 : M.V ( A x -- A.x )
-    1.0 -rot n*M.V ; inline
+    [ 1.0 ] 2dip n*M.V ; inline
 
 : n*V(*)V ( alpha x y -- alpha*x(*)y )
     2dup [ length>> ] bi@ pick <empty-matrix>
@@ -163,16 +163,16 @@ M: blas-matrix-base clone
     n*V(*)Vconj+M! ;
 
 : V(*) ( x y -- x(*)y )
-    1.0 -rot n*V(*)V ; inline
+    [ 1.0 ] 2dip n*V(*)V ; inline
 : V(*)conj ( x y -- x(*)yconj )
-    1.0 -rot n*V(*)Vconj ; inline
+    [ 1.0 ] 2dip n*V(*)Vconj ; inline
 
 : n*M.M ( alpha A B -- alpha*A.B )
     2dup [ Mheight ] [ Mwidth ] bi* pick <empty-matrix> 
-    1.0 swap n*M.M+n*M! ;
+    [ 1.0 ] dip n*M.M+n*M! ;
 
 : M. ( A B -- A.B )
-    1.0 -rot n*M.M ; inline
+    [ 1.0 ] 2dip n*M.M ; inline
 
 :: (Msub) ( matrix row col height width -- data ld rows cols )
     matrix ld>> col * row + matrix element-type heap-size *
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index ea3bee424f7763ccc7867da201db82eef40286f1..7d45f01337e79b03a21974f48d836f82e48f073d 100644 (file)
@@ -3,26 +3,26 @@ cpu.x86.assembler.operands math.floats.env.x86 system ;
 IN: math.floats.env.x86.32
 
 M: x86.32 get-sse-env
-    void { void* } "cdecl" [
+    void { void* } cdecl [
         EAX ESP [] MOV
         EAX [] STMXCSR
     ] alien-assembly ;
 
 M: x86.32 set-sse-env
-    void { void* } "cdecl" [
+    void { void* } cdecl [
         EAX ESP [] MOV
         EAX [] LDMXCSR
     ] alien-assembly ;
 
 M: x86.32 get-x87-env
-    void { void* } "cdecl" [
+    void { void* } cdecl [
         EAX ESP [] MOV
         EAX [] FNSTSW
         EAX 2 [+] FNSTCW
     ] alien-assembly ;
 
 M: x86.32 set-x87-env
-    void { void* } "cdecl" [
+    void { void* } cdecl [
         EAX ESP [] MOV
         FNCLEX
         EAX 2 [+] FLDCW
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index b6f8ee151f71229bda479d6798ac27db7a22b1ad..7013b8e52d9bfcc8905332dd9697439949c7994b 100644 (file)
@@ -1,25 +1,25 @@
-USING: alien alien.c-types cpu.architecture cpu.x86.assembler
+USING: alien alien.c-types cpu.x86.64 cpu.x86.assembler
 cpu.x86.assembler.operands math.floats.env.x86 sequences system ;
 IN: math.floats.env.x86.64
 
 M: x86.64 get-sse-env
-    void { void* } "cdecl" [
-        int-regs param-regs first [] STMXCSR
+    void { void* } cdecl [
+        param-reg-0 [] STMXCSR
     ] alien-assembly ;
 
 M: x86.64 set-sse-env
-    void { void* } "cdecl" [
-        int-regs param-regs first [] LDMXCSR
+    void { void* } cdecl [
+        param-reg-0 [] LDMXCSR
     ] alien-assembly ;
 
 M: x86.64 get-x87-env
-    void { void* } "cdecl" [
-        int-regs param-regs first [] FNSTSW
-        int-regs param-regs first 2 [+] FNSTCW
+    void { void* } cdecl [
+        param-reg-0 [] FNSTSW
+        param-reg-0 2 [+] FNSTCW
     ] alien-assembly ;
 
 M: x86.64 set-x87-env
-    void { void* } "cdecl" [
+    void { void* } cdecl [
         FNCLEX
-        int-regs param-regs first 2 [+] FLDCW
+        param-reg-0 2 [+] FLDCW
     ] alien-assembly ;
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
diff --git a/basis/math/floats/half/authors.txt b/basis/math/floats/half/authors.txt
new file mode 100644 (file)
index 0000000..f13c9c1
--- /dev/null
@@ -0,0 +1 @@
+Joe Groff
diff --git a/basis/math/floats/half/half-tests.factor b/basis/math/floats/half/half-tests.factor
new file mode 100644 (file)
index 0000000..82db3d1
--- /dev/null
@@ -0,0 +1,49 @@
+USING: accessors alien.c-types alien.syntax math.floats.half kernel
+math tools.test specialized-arrays alien.data classes.struct ;
+SPECIALIZED-ARRAY: half
+IN: math.floats.half.tests
+
+[ HEX: 0000 ] [  0.0  half>bits ] unit-test
+[ HEX: 8000 ] [ -0.0  half>bits ] unit-test
+[ HEX: 3e00 ] [  1.5  half>bits ] unit-test
+[ HEX: be00 ] [ -1.5  half>bits ] unit-test
+[ HEX: 7c00 ] [  1/0. half>bits ] unit-test
+[ HEX: fc00 ] [ -1/0. half>bits ] unit-test
+[ HEX: 7eaa ] [ NAN: aaaaaaaaaaaaa half>bits ] unit-test
+
+! too-big floats overflow to infinity
+[ HEX: 7c00 ] [   65536.0 half>bits ] unit-test
+[ HEX: fc00 ] [  -65536.0 half>bits ] unit-test
+[ HEX: 7c00 ] [  131072.0 half>bits ] unit-test
+[ HEX: fc00 ] [ -131072.0 half>bits ] unit-test
+
+! too-small floats flush to zero
+[ HEX: 0000 ] [  1.0e-9 half>bits ] unit-test
+[ HEX: 8000 ] [ -1.0e-9 half>bits ] unit-test
+
+[  0.0  ] [ HEX: 0000 bits>half ] unit-test
+[ -0.0  ] [ HEX: 8000 bits>half ] unit-test
+[  1.5  ] [ HEX: 3e00 bits>half ] unit-test
+[ -1.5  ] [ HEX: be00 bits>half ] unit-test
+[  1/0. ] [ HEX: 7c00 bits>half ] unit-test
+[ -1/0. ] [ HEX: fc00 bits>half ] unit-test
+[  3.0  ] [ HEX: 4200 bits>half ] unit-test
+[    t  ] [ HEX: 7e00 bits>half fp-nan? ] unit-test
+
+STRUCT: halves
+    { tom half }
+    { dick half }
+    { harry half }
+    { harry-jr half } ;
+
+[ 8 ] [ halves heap-size ] unit-test
+
+[ 3.0 ] [
+    halves <struct>
+        3.0 >>dick
+    dick>>
+] unit-test
+
+[ half-array{ 1.0 2.0 3.0 1/0. -1/0. } ]
+[ { 1.0 2.0 3.0 1/0. -1/0. } >half-array ] unit-test
+
diff --git a/basis/math/floats/half/half.factor b/basis/math/floats/half/half.factor
new file mode 100644 (file)
index 0000000..ffa3550
--- /dev/null
@@ -0,0 +1,46 @@
+! (c)2009 Joe Groff bsd license
+USING: accessors alien.accessors alien.c-types alien.data
+alien.syntax kernel math math.order ;
+FROM: math => float ;
+IN: math.floats.half
+
+: half>bits ( float -- bits )
+    float>bits
+    [ -31 shift 15 shift ] [
+        HEX: 7fffffff bitand
+        dup zero? [
+            dup HEX: 7f800000 >= [ -13 shift HEX: 7fff bitand ] [
+                -13 shift
+                112 10 shift -
+                0 HEX: 7c00 clamp
+            ] if
+        ] unless
+    ] bi bitor ;
+
+: bits>half ( bits -- float )
+    [ -15 shift 31 shift ] [
+        HEX: 7fff bitand
+        dup zero? [
+            dup HEX: 7c00 >= [ 13 shift HEX: 7f800000 bitor ] [
+                13 shift
+                112 23 shift + 
+            ] if
+        ] unless
+    ] bi bitor bits>float ;
+
+SYMBOL: half
+
+<<
+
+<c-type>
+    float >>class
+    float >>boxed-class
+    [ alien-unsigned-2 bits>half ] >>getter
+    [ [ >float half>bits ] 2dip set-alien-unsigned-2 ] >>setter
+    2 >>size
+    2 >>align
+    2 >>align-first
+    [ >float ] >>unboxer-quot
+\ half define-primitive-type
+
+>>
diff --git a/basis/math/floats/half/summary.txt b/basis/math/floats/half/summary.txt
new file mode 100644 (file)
index 0000000..b22448f
--- /dev/null
@@ -0,0 +1 @@
+Half-precision float support for FFI
index 9de6e7d127ce1c007357629f7f0493cff42484f6..7dc6313b86ce9089a777ae3ee1f3bff932a9332b 100644 (file)
@@ -36,53 +36,53 @@ ARTICLE: "math.libm" "C standard library math functions"
 ABOUT: "math.libm"
 
 HELP: facos
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the inverse trigonometric cosine function from the C standard library. User code should call " { $link acos } " instead." } ;
 
 HELP: fasin
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the inverse trigonometric sine function from the C standard library. User code should call " { $link asin } " instead." } ;
 
 HELP: fatan
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the inverse trigonometric tangent function from the C standard library. User code should call " { $link atan } " instead." } ;
 
 HELP: fatan2
-{ $values { "x" real } { "y" real } { "z" real } }
+{ $values { "x" real } { "y" real } { "double" real } }
 { $description "Calls the two-parameter inverse trigonometric tangent function from the C standard library. User code should call " { $link arg } " instead." } ;
 
 HELP: fcos
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the trigonometric cosine function from the C standard library. User code should call " { $link cos } " instead." } ;
 
 HELP: fsin
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the trigonometric sine function from the C standard library. User code should call " { $link sin } " instead." } ;
 
 HELP: fcosh
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the hyperbolic cosine function from the C standard library. User code should call " { $link cosh } " instead." } ;
 
 HELP: fsinh
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the hyperbolic sine function from the C standard library. User code should call " { $link sinh } " instead." } ;
 
 HELP: fexp
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the exponential function (" { $snippet "y=e^x" } " from the C standard library. User code should call " { $link exp } " instead." } ;
 
 HELP: flog
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the natural logarithm function from the C standard library. User code should call " { $link log } " instead." } ;
 
 HELP: flog10
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the base 10 logarithm function from the C standard library. User code should call " { $link log10 } " instead." } ;
 
 HELP: fpow
-{ $values { "x" real } { "y" real } { "z" real } }
+{ $values { "x" real } { "y" real } { "double" real } }
 { $description "Calls the power function (" { $snippet "z=x^y" } ") from the C standard library. User code should call " { $link ^ } " instead." } ;
 
 HELP: fsqrt
-{ $values { "x" real } { "y" real } }
+{ $values { "x" real } { "double" real } }
 { $description "Calls the square root function from the C standard library. User code should call " { $link sqrt } " instead." } ;
index 0288894081bf1006cdc4e5893d28166ed3926cd5..c87a2819cacfc7c4fc5102a36d59bf856187d2e0 100644 (file)
@@ -1,62 +1,64 @@
 ! Copyright (C) 2006 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types ;
+USING: alien alien.c-types alien.syntax ;
 IN: math.libm
 
-: facos ( x -- y )
-    double "libm" "acos" { double } alien-invoke ;
+LIBRARY: libm
 
-: fasin ( x -- y )
-    double "libm" "asin" { double } alien-invoke ;
+FUNCTION-ALIAS: facos
+    double acos ( double x ) ;
 
-: fatan ( x -- y )
-    double "libm" "atan" { double } alien-invoke ;
+FUNCTION-ALIAS: fasin
+    double asin ( double x ) ;
 
-: fatan2 ( x y -- z )
-    double "libm" "atan2" { double double } alien-invoke ;
+FUNCTION-ALIAS: fatan
+    double atan ( double x ) ;
 
-: fcos ( x -- y )
-    double "libm" "cos" { double } alien-invoke ;
+FUNCTION-ALIAS: fatan2
+    double atan2 ( double x, double y ) ;
 
-: fsin ( x -- y )
-    double "libm" "sin" { double } alien-invoke ;
+FUNCTION-ALIAS: fcos
+    double cos ( double x ) ;
 
-: ftan ( x -- y )
-    double "libm" "tan" { double } alien-invoke ;
+FUNCTION-ALIAS: fsin
+    double sin ( double x ) ;
 
-: fcosh ( x -- y )
-    double "libm" "cosh" { double } alien-invoke ;
+FUNCTION-ALIAS: ftan
+    double tan ( double x ) ;
 
-: fsinh ( x -- y )
-    double "libm" "sinh" { double } alien-invoke ;
+FUNCTION-ALIAS: fcosh
+    double cosh ( double x ) ;
 
-: ftanh ( x -- y )
-    double "libm" "tanh" { double } alien-invoke ;
+FUNCTION-ALIAS: fsinh
+    double sinh ( double x ) ;
 
-: fexp ( x -- y )
-    double "libm" "exp" { double } alien-invoke ;
+FUNCTION-ALIAS: ftanh
+    double tanh ( double x ) ;
 
-: flog ( x -- y )
-    double "libm" "log" { double } alien-invoke ;
+FUNCTION-ALIAS: fexp
+    double exp ( double x ) ;
 
-: flog10 ( x -- y )
-    double "libm" "log10" { double } alien-invoke ;
+FUNCTION-ALIAS: flog
+    double log ( double x ) ;
 
-: fpow ( x y -- z )
-    double "libm" "pow" { double double } alien-invoke ;
+FUNCTION-ALIAS: flog10
+    double log10 ( double x ) ;
 
-: fsqrt ( x -- y )
-    double "libm" "sqrt" { double } alien-invoke ;
+FUNCTION-ALIAS: fpow
+    double pow ( double x, double y ) ;
+
+FUNCTION-ALIAS: fsqrt
+    double sqrt ( double x ) ;
     
 ! Windows doesn't have these...
-: flog1+ ( x -- y )
-    double "libm" "log1p" { double } alien-invoke ;
+FUNCTION-ALIAS: flog1+
+    double log1p ( double x ) ;
 
-: facosh ( x -- y )
-    double "libm" "acosh" { double } alien-invoke ;
+FUNCTION-ALIAS: facosh
+    double acosh ( double x ) ;
 
-: fasinh ( x -- y )
-    double "libm" "asinh" { double } alien-invoke ;
+FUNCTION-ALIAS: fasinh
+    double asinh ( double x ) ;
 
-: fatanh ( x -- y )
-    double "libm" "atanh" { double } alien-invoke ;
+FUNCTION-ALIAS: fatanh
+    double atanh ( double x ) ;
index c8d5bb7338ea377811611437316fabe780872b1b..6dfcf9f0ca453e312625eac37c355beb4afc8480 100644 (file)
@@ -11,7 +11,7 @@ SYMBOL: matrix
 
 : nth-row ( row# -- seq ) matrix get nth ;
 
-: change-row ( row# quot: ( seq -- seq ) -- )
+: change-row ( ..a row# quot: ( ..a seq -- ..b seq ) -- ..b )
     matrix get swap change-nth ; inline
 
 : exchange-rows ( row# row# -- ) matrix get exchange ;
index 3ee1ddbd6d229b5baa85c11afbf8c58840e207d2..b8277412091d755b3e9947d6cbfd407bf677d1a2 100644 (file)
@@ -99,14 +99,12 @@ USING: math.matrices math.vectors tools.test math ;
     m.
 ] unit-test
 
-[ { 0 0 -1 } ] [ { 1 0 0 } { 0 1 0 } cross ] unit-test
+[ { 0 0 1 } ] [ { 1 0 0 } { 0 1 0 } cross ] unit-test
 [ { 1 0 0 } ] [ { 0 1 0 } { 0 0 1 } cross ] unit-test
 [ { 0 1 0 } ] [ { 0 0 1 } { 1 0 0 } cross ] unit-test
+[ { 0.0 -0.707 0.707 } ] [ { 1.0 0.0 0.0 } { 0.0 0.707 0.707 } cross ] unit-test
 
 [ { 1 0 0 } ] [ { 1 1 0 } { 1 0 0 } proj ] unit-test
 
-[ { { { 1 "a" } { 1 "b" } } { { 2 "a" } { 2 "b" } } } ]
-[ { 1 2 } { "a" "b" } cross-zip ] unit-test
-
 [ { { 4181 6765 } { 6765 10946 } } ]
 [ { { 0 1 } { 1 1 } } 20 m^n ] unit-test
index bf14d7ba13ccff4bcf5eb55385f561a5543c0e3b..216d2c31bbb142bd7d104ba60abc1540d098d32d 100644 (file)
@@ -11,7 +11,7 @@ IN: math.matrices
 
 : identity-matrix ( n -- matrix )
     #! Make a nxn identity matrix.
-    iota dup [ [ = 1 0 ? ] with map ] curry map ;
+    iota dup [ = 1 0 ? ] cartesian-map ;
 
 :: rotation-matrix3 ( axis theta -- matrix )
     theta cos :> c
@@ -111,12 +111,18 @@ IN: math.matrices
 : mnorm ( m -- n ) dup mmax abs m/n ;
 
 : cross ( vec1 vec2 -- vec3 )
-    [ [ { 1 2 1 } vshuffle ] [ { 2 0 0 } vshuffle ] bi* v* ]
-    [ [ { 2 0 0 } vshuffle ] [ { 1 2 1 } vshuffle ] bi* v* ] 2bi v- ; inline
+    [ [ { 1 2 0 } vshuffle ] [ { 2 0 1 } vshuffle ] bi* v* ]
+    [ [ { 2 0 1 } vshuffle ] [ { 1 2 0 } vshuffle ] bi* v* ] 2bi v- ; inline
 
 : proj ( v u -- w )
     [ [ v. ] [ norm-sq ] bi / ] keep n*v ;
 
+: perp ( v u -- w )
+    dupd proj v- ;
+
+: angle-between ( v u -- a )
+    [ normalize ] bi@ v. acos ;
+
 : (gram-schmidt) ( v seq -- newseq )
     [ dupd proj v- ] each ;
 
@@ -126,9 +132,6 @@ IN: math.matrices
 : norm-gram-schmidt ( seq -- orthonormal )
     gram-schmidt [ normalize ] map ;
 
-: cross-zip ( seq1 seq2 -- seq1xseq2 )
-    [ [ 2array ] with map ] curry map ;
-    
 : m^n ( m n -- n ) 
     make-bits over first length identity-matrix
     [ [ dupd m. ] when [ dup m. ] dip ] reduce nip ;
index 3b8885cc887a1285c323421c6a09f37f31542ab2..dd55c3dd3f2c131ef1734b4a891f5eb28713e5aa 100644 (file)
@@ -56,14 +56,14 @@ HELP: p-
 { $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 } { 0 1 } p- ." "{ 1 0 1 }" } } ;
 
 HELP: n*p
-{ $values { "n" number } { "p" "a polynomial" } { "n*p" "a polynomial" } }
+{ $values { "n" number } { "v" "a polynomial" } { "w" "a polynomial" } }
 { $description "Multiplies each element of " { $snippet "p" } " by " { $snippet "n" } "." }
 { $examples { $example "USING: math.polynomials prettyprint ;" "4 { 3 0 1 } n*p ." "{ 12 0 4 }" } } ;
 
 HELP: pextend-conv
 { $values { "p" "a polynomial" } { "q" "a polynomial" } { "p'" "a polynomial" } { "q'" "a polynomial" } }
 { $description "Convulution, extending to " { $snippet "p_m + q_n - 1" } "." }
-{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv [ . ] bi@" "V{ 1 0 1 0 }\nV{ 0 1 0 0 }" } } ;
+{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv [ . ] bi@" "{ 1 0 1 0 }\n{ 0 1 0 0 }" } } ;
 
 HELP: p*
 { $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } }
index 31152016ea55a3e136d6b2be6255f189bc7f5053..57c3c5b8efcabc71ab51bd5c94746a13593f78a7 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays kernel make math math.order math.vectors sequences
-splitting vectors macros combinators math.bits ;
+USING: arrays combinators fry kernel macros make math math.bits
+math.order math.vectors sequences splitting vectors ;
 IN: math.polynomials
 
 <PRIVATE
@@ -26,17 +26,19 @@ PRIVATE>
 : 2ptrim ( p q -- p' q' ) [ ptrim ] bi@ ;
 : p+ ( p q -- r ) pextend v+ ;
 : p- ( p q -- r ) pextend v- ;
-: n*p ( n p -- n*p ) n*v ;
+ALIAS: n*p n*v
 
 : pextend-conv ( p q -- p' q' )
-    2dup [ length ] bi@ + 1 - 2pad-tail [ >vector ] bi@ ;
+    2dup [ length ] bi@ + 1 - 2pad-tail ;
 
 : p* ( p q -- r )
-    2unempty pextend-conv <reversed> dup length iota
-    [ over length pick <slice> pick [ * ] 2map sum ] map 2nip reverse ;
+    2unempty pextend-conv 
+    [ drop length [ iota ] keep ]
+    [ nip <reversed> ]
+    [ drop ] 2tri
+    '[ _ _ <slice> _ v* sum ] map reverse ;
 
-: p-sq ( p -- p^2 )
-    dup p* ;
+: p-sq ( p -- p^2 ) dup p* ; inline
 
 ERROR: negative-power-polynomial p n ;
 
@@ -56,9 +58,7 @@ ERROR: negative-power-polynomial p n ;
     dup 1 < [ drop 1 ] when
     [ over length + 0 pad-head pextend ] keep 1 + ;
 
-: /-last ( seq seq -- a )
-    #! divide the last two numbers in the sequences
-    [ last ] bi@ / ;
+: /-last ( seq1 seq2 -- x ) [ last ] bi@ / ;
 
 : (p/mod) ( p p -- p p )
     2dup /-last
@@ -75,7 +75,7 @@ PRIVATE>
 <PRIVATE
 
 : (pgcd) ( b a y x -- a d )
-    dup V{ 0 } clone p= [
+    dup V{ 0 } p= [
         drop nip
     ] [
         [ nip ] [ p/mod ] 2bi
index 7cdfd552a1ab5c07de2824e5935f647b5976680c..dd73b0a073e1257b108e37fb14a59e7c639b8133 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2007-2009 Samuel Tardieu.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays combinators kernel make math math.functions
+USING: arrays assocs combinators kernel make math math.functions
 math.primes math.ranges sequences sequences.product sorting
 io math.parser ;
 IN: math.primes.factors
@@ -32,7 +32,7 @@ PRIVATE>
 : group-factors ( n -- seq )
     dup prime? [ 1 2array 1array ] [ (group-factors) ] if ; flushable
 
-: unique-factors ( n -- seq ) group-factors [ first ] map ; flushable
+: unique-factors ( n -- seq ) group-factors keys ; flushable
 
 : factors ( n -- seq )
     group-factors [ first2 swap <array> ] map concat ; flushable
index e314f72c6ba7a80f71f78954b0a4fbd2b77c6c87..16cb379ba840e10a543c3fcf8135c7e1704ba972 100644 (file)
@@ -23,5 +23,5 @@ IN: math.ranges.tests
 [ { 0 1/3 2/3 1 } ] [ 1 0 -1/3 <range> >array reverse ] unit-test
 
 [ 100 ] [
-    1 100 [a,b] [ 2^ [1,b] ] map prune length
+    1 100 [a,b] [ 2^ [1,b] ] map members length
 ] unit-test
index bfde3918841d1e2375f5bbade28e2d9edc940bdd..8714bdfb1a3864e6e2816ce7a73e8bed16fa387d 100644 (file)
@@ -20,7 +20,7 @@ SYNTAX: RECT: scan-object scan-object <rect> suffix! ;
 
 : rect-center ( rect -- center ) rect-bounds 2 v/n v+ ;
 
-: with-rect-extents ( rect1 rect2 loc-quot: ( loc1 loc2 -- ) ext-quot: ( ext1 ext2 -- ) -- )
+: with-rect-extents ( ..a+b rect1 rect2 loc-quot: ( ..a loc1 loc2 -- ..c ) ext-quot: ( ..b ext1 ext2 -- ..d ) -- ..c+d )
     [ [ rect-extent ] bi@ ] 2dip bi-curry* bi* ; inline
 
 : <extent-rect> ( loc ext -- rect ) over [v-] <rect> ;
@@ -58,10 +58,10 @@ M: rect contains-point?
     [ rect-bounds ] dip vmin <rect> ;
 
 : set-rect-bounds ( rect1 rect -- )
-    [ [ loc>> ] dip (>>loc) ]
-    [ [ dim>> ] dip (>>dim) ]
+    [ [ loc>> ] dip loc<< ]
+    [ [ dim>> ] dip dim<< ]
     2bi ; inline
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [ "math.rectangles.prettyprint" require ] when
+{ "math.rectangles" "prettyprint" } "math.rectangles.prettyprint" require-when
index d46f062d9cdce38a9a55bfd5c52098776d8f84a1..c9ff2cb10257d502c44cd10f34890dce7cc30e5a 100644 (file)
@@ -1,7 +1,7 @@
 ! (c)Joe Groff bsd license
 USING: accessors arrays compiler.test continuations generalizations
 kernel kernel.private locals math.vectors.conversion math.vectors.simd
-sequences stack-checker tools.test ;
+sequences stack-checker tools.test sequences.generalizations ;
 FROM: alien.c-types => char uchar short ushort int uint longlong ulonglong float double ;
 IN: math.vectors.conversion.tests
 
index 6148962ee0d5cc6dd5fc8808f1facd888196c4eb..9d60dd03d4e25fb3efdc2545613b258ef2a09c25 100644 (file)
@@ -1,10 +1,10 @@
 ! (c)Joe Groff bsd license
-USING: accessors alien.c-types arrays assocs classes combinators
-combinators.short-circuit fry kernel locals math
-math.vectors math.vectors.simd math.vectors.simd.intrinsics sequences ;
+USING: accessors alien arrays assocs classes combinators
+combinators.short-circuit fry kernel locals math math.vectors
+math.vectors.simd math.vectors.simd.intrinsics sequences ;
 FROM: alien.c-types =>
     char uchar short ushort int uint longlong ulonglong
-    float double ;
+    float double heap-size ;
 IN: math.vectors.conversion
 
 ERROR: bad-vconvert from-type to-type ;
index 815b34a90d7288b816ce0cf9dc37bcba81df7a1d..4d98af538fd8229ae5281a150285168d59f8c2d2 100644 (file)
@@ -1,7 +1,8 @@
 USING: accessors alien.c-types arrays byte-arrays
 cpu.architecture effects functors generalizations kernel lexer
 math math.vectors.simd math.vectors.simd.intrinsics parser
-prettyprint.custom quotations sequences sequences.cords words ;
+prettyprint.custom quotations sequences sequences.cords words
+classes ;
 IN: math.vectors.simd.cords
 
 <<
@@ -35,10 +36,19 @@ WHERE
 BOA-EFFECT define-inline
 
 : A-with ( n -- v )
-    [ A/2-with ] [ A/2-with ] bi cord-append ;
+    [ A/2-with ] [ A/2-with ] bi cord-append ; inline
 
 : A-cast ( v -- v' )
-    [ A/2-cast ] cord-map ;
+    [ A/2-cast ] cord-map ; inline
+
+M: A new-sequence
+    2drop
+    N A/2 new new-sequence
+    N A/2 new new-sequence
+    \ A boa ;
+
+M: A like
+    over \ A instance? [ drop ] [ call-next-method ] if ;
 
 M: A >pprint-sequence ;
 M: A pprint* pprint-object ;
index d80755a6a5c2cb24b37f1c6e5cf142ee0d33096d..2fe4cc922b8b2aeb5cddd4e483af1b94fb7b7810 100644 (file)
@@ -1,9 +1,10 @@
 ! (c)2009 Slava Pestov, Joe Groff bsd license
-USING: accessors alien alien.c-types alien.data combinators
+USING: accessors alien alien.data combinators
 sequences.cords cpu.architecture fry generalizations grouping
-kernel libc locals math math.libm math.order math.ranges
-math.vectors sequences sequences.private specialized-arrays
-vocabs.loader ;
+kernel libc locals macros math math.libm math.order
+math.ranges math.vectors sequences sequences.generalizations
+sequences.private sequences.unrolled sequences.unrolled.private
+specialized-arrays vocabs.loader words effects.parser locals.parser ;
 QUALIFIED-WITH: alien.c-types c
 SPECIALIZED-ARRAYS:
     c:char c:short c:int c:longlong
@@ -11,6 +12,20 @@ SPECIALIZED-ARRAYS:
     c:float c:double ;
 IN: math.vectors.simd.intrinsics
 
+<<
+: simd-intrinsic-body ( def effect -- def' )
+    '[ _ _ call-effect ] ;
+
+: define-simd-intrinsic ( word def effect -- )
+    [ simd-intrinsic-body ] keep define-declared ;
+
+SYNTAX: SIMD-INTRINSIC:
+    (:) define-declared ;
+SYNTAX: SIMD-INTRINSIC::
+    (::) define-declared ;
+
+>>
+
 : assert-positive ( x -- y ) ;
 
 <PRIVATE
@@ -45,16 +60,16 @@ IN: math.vectors.simd.intrinsics
 
 : [byte>rep-array] ( rep -- class )
     {
-        { char-16-rep      [ [ byte-array>char-array      ] ] }
-        { uchar-16-rep     [ [ byte-array>uchar-array     ] ] }
-        { short-8-rep      [ [ byte-array>short-array     ] ] }
-        { ushort-8-rep     [ [ byte-array>ushort-array    ] ] }
-        { int-4-rep        [ [ byte-array>int-array       ] ] }
-        { uint-4-rep       [ [ byte-array>uint-array      ] ] }
-        { longlong-2-rep   [ [ byte-array>longlong-array  ] ] }
-        { ulonglong-2-rep  [ [ byte-array>ulonglong-array ] ] }
-        { float-4-rep      [ [ byte-array>float-array     ] ] }
-        { double-2-rep     [ [ byte-array>double-array    ] ] }
+        { char-16-rep      [ [ 16 <direct-char-array>      ] ] }
+        { uchar-16-rep     [ [ 16 <direct-uchar-array>     ] ] }
+        { short-8-rep      [ [  8 <direct-short-array>     ] ] }
+        { ushort-8-rep     [ [  8 <direct-ushort-array>    ] ] }
+        { int-4-rep        [ [  4 <direct-int-array>       ] ] }
+        { uint-4-rep       [ [  4 <direct-uint-array>      ] ] }
+        { longlong-2-rep   [ [  2 <direct-longlong-array>  ] ] }
+        { ulonglong-2-rep  [ [  2 <direct-ulonglong-array> ] ] }
+        { float-4-rep      [ [  4 <direct-float-array>     ] ] }
+        { double-2-rep     [ [  2 <direct-double-array>    ] ] }
     } case ; foldable
 
 : [>rep-array] ( rep -- class )
@@ -96,55 +111,76 @@ IN: math.vectors.simd.intrinsics
     [<rep-array>] call( -- a' ) ; inline
 
 : components-map ( a rep quot -- c )
-    [ >rep-array ] dip map underlying>> ; inline
+    [ [ >rep-array ] [ rep-length ] bi ] dip unrolled-map-unsafe underlying>> ; inline
 : components-2map ( a b rep quot -- c )
-    [ 2>rep-array ] dip 2map underlying>> ; inline
+    [ [ 2>rep-array ] [ rep-length ] bi ] dip unrolled-2map-unsafe underlying>> ; inline
+! XXX
 : components-reduce ( a rep quot -- x )
     [ >rep-array [ ] ] dip map-reduce ; inline
 
 : bitwise-components-map ( a rep quot -- c )
-    [ >bitwise-vector-rep >rep-array ] dip map underlying>> ; inline
+    [ >bitwise-vector-rep [ >rep-array ] [ rep-length ] bi ] dip
+    unrolled-map-unsafe underlying>> ; inline
 : bitwise-components-2map ( a b rep quot -- c )
-    [ >bitwise-vector-rep 2>rep-array ] dip 2map underlying>> ; inline
+    [ >bitwise-vector-rep [ 2>rep-array ] [ rep-length ] bi ] dip
+    unrolled-2map-unsafe underlying>> ; inline
+! XXX
 : bitwise-components-reduce ( a rep quot -- x )
     [ >bitwise-vector-rep >rep-array [ ] ] dip map-reduce ; inline
 
 :: (vshuffle) ( a elts rep -- c )
     a rep >rep-array :> a'
     rep <rep-array> :> c'
-    elts [| from to |
+    elts rep rep-length [| from to |
         from rep rep-length 1 - bitand
            a' nth-unsafe
         to c' set-nth-unsafe
-    ] each-index
+    ] unrolled-each-index-unsafe
+    c' underlying>> ; inline
+
+:: (vshuffle2) ( a b elts rep -- c )
+    a rep >rep-array :> a'
+    b rep >rep-array :> b'
+    a' b' cord-append :> ab'
+    rep <rep-array> :> c'
+    elts rep rep-length [| from to |
+        from rep rep-length dup + 1 - bitand
+           ab' nth-unsafe
+        to c' set-nth-unsafe
+    ] unrolled-each-index-unsafe
     c' underlying>> ; inline
 
+GENERIC: native/ ( x y -- x/y )
+
+M: integer native/ /i ; inline
+M: float native/ /f ; inline
+
 PRIVATE>
 
-: (simd-v+)                ( a b rep -- c ) [ + ] components-2map ;
-: (simd-v-)                ( a b rep -- c ) [ - ] components-2map ;
-: (simd-vneg)              ( a   rep -- c ) [ neg ] components-map ;
-:: (simd-v+-)              ( a b rep -- c ) 
+SIMD-INTRINSIC: (simd-v+)                ( a b rep -- c ) [ + ] components-2map ;
+SIMD-INTRINSIC: (simd-v-)                ( a b rep -- c ) [ - ] components-2map ;
+SIMD-INTRINSIC: (simd-vneg)              ( a   rep -- c ) [ neg ] components-map ;
+SIMD-INTRINSIC:: (simd-v+-)              ( a b rep -- c ) 
     a b rep 2>rep-array :> ( a' b' )
     rep <rep-array> :> c'
-    0  rep rep-length 1 -  2 <range> [| n |
+    0  rep rep-length [ 1 -  2 <range> ] [ 2 /i ] bi [| n |
         n     a' nth-unsafe n     b' nth-unsafe -
         n     c' set-nth-unsafe
 
         n 1 + a' nth-unsafe n 1 + b' nth-unsafe +
         n 1 + c' set-nth-unsafe
-    ] each
+    ] unrolled-each-unsafe
     c' underlying>> ;
-: (simd-vs+)               ( a b rep -- c )
-    dup rep-component-type '[ + _ c-type-clamp ] components-2map ;
-: (simd-vs-)               ( a b rep -- c )
-    dup rep-component-type '[ - _ c-type-clamp ] components-2map ;
-: (simd-vs*)               ( a b rep -- c )
-    dup rep-component-type '[ * _ c-type-clamp ] components-2map ;
-: (simd-v*)                ( a b rep -- c ) [ * ] components-2map ;
-: (simd-v*high)            ( a b rep -- c )
-    dup rep-component-type heap-size -8 * '[ * _ shift ] components-2map ;
-:: (simd-v*hs+)            ( a b rep -- c )
+SIMD-INTRINSIC: (simd-vs+)               ( a b rep -- c )
+    dup rep-component-type '[ + _ c:c-type-clamp ] components-2map ;
+SIMD-INTRINSIC: (simd-vs-)               ( a b rep -- c )
+    dup rep-component-type '[ - _ c:c-type-clamp ] components-2map ;
+SIMD-INTRINSIC: (simd-vs*)               ( a b rep -- c )
+    dup rep-component-type '[ * _ c:c-type-clamp ] components-2map ;
+SIMD-INTRINSIC: (simd-v*)                ( a b rep -- c ) [ * ] components-2map ;
+SIMD-INTRINSIC: (simd-v*high)            ( a b rep -- c )
+    dup rep-component-type c:heap-size -8 * '[ * _ shift ] components-2map ;
+SIMD-INTRINSIC:: (simd-v*hs+)            ( a b rep -- c )
     rep { char-16-rep uchar-16-rep } member-eq?
     [ uchar-16-rep char-16-rep ]
     [ rep rep ] if :> ( a-rep b-rep )
@@ -152,104 +188,112 @@ PRIVATE>
     wide-rep rep-component-type :> wide-type
     a a-rep >rep-array 2 <groups> :> a'
     b b-rep >rep-array 2 <groups> :> b'
-    a' b' [
+    a' b' rep rep-length 2 /i [
         [ [ first  ] bi@ * ]
         [ [ second ] bi@ * ] 2bi +
-        wide-type c-type-clamp
-    ] wide-rep <rep-array> 2map-as underlying>> ;
-: (simd-v/)                ( a b rep -- c ) [ / ] components-2map ;
-: (simd-vavg)              ( a b rep -- c )
+        wide-type c:c-type-clamp
+    ] wide-rep <rep-array> unrolled-2map-as-unsafe underlying>> ;
+SIMD-INTRINSIC: (simd-v/)                ( a b rep -- c ) [ native/ ] components-2map ;
+SIMD-INTRINSIC: (simd-vavg)              ( a b rep -- c )
     [ + dup integer? [ 1 + -1 shift ] [ 0.5 * ] if ] components-2map ;
-: (simd-vmin)              ( a b rep -- c ) [ min ] components-2map ;
-: (simd-vmax)              ( a b rep -- c ) [ max ] components-2map ;
-: (simd-v.)                ( a b rep -- n )
+SIMD-INTRINSIC: (simd-vmin)              ( a b rep -- c ) [ min ] components-2map ;
+SIMD-INTRINSIC: (simd-vmax)              ( a b rep -- c ) [ max ] components-2map ;
+! XXX
+SIMD-INTRINSIC: (simd-v.)                ( a b rep -- n )
     [ 2>rep-array [ [ first ] bi@ * ] 2keep ] keep
     1 swap rep-length [a,b) [ '[ _ swap nth-unsafe ] bi@ * + ] with with each ;
-: (simd-vsqrt)             ( a   rep -- c ) [ fsqrt ] components-map ;
-: (simd-vsad)              ( a b rep -- c ) 2>rep-array [ - abs ] [ + ] 2map-reduce ;
-: (simd-sum)               ( a   rep -- n ) [ + ] components-reduce ;
-: (simd-vabs)              ( a   rep -- c ) [ abs ] components-map ;
-: (simd-vbitand)           ( a b rep -- c ) [ bitand ] bitwise-components-2map ;
-: (simd-vbitandn)          ( a b rep -- c ) [ [ bitnot ] dip bitand ] bitwise-components-2map ;
-: (simd-vbitor)            ( a b rep -- c ) [ bitor ] bitwise-components-2map ;
-: (simd-vbitxor)           ( a b rep -- c ) [ bitxor ] bitwise-components-2map ;
-: (simd-vbitnot)           ( a   rep -- c ) [ bitnot ] bitwise-components-map ;
-: (simd-vand)              ( a b rep -- c ) [ bitand ] bitwise-components-2map ;
-: (simd-vandn)             ( a b rep -- c ) [ [ bitnot ] dip bitand ] bitwise-components-2map ;
-: (simd-vor)               ( a b rep -- c ) [ bitor ] bitwise-components-2map ;
-: (simd-vxor)              ( a b rep -- c ) [ bitxor ] bitwise-components-2map ;
-: (simd-vnot)              ( a   rep -- c ) [ bitnot ] bitwise-components-map ;
-: (simd-vlshift)           ( a n rep -- c ) swap '[ _ shift ] bitwise-components-map ;
-: (simd-vrshift)           ( a n rep -- c ) swap '[ _ neg shift ] bitwise-components-map ;
-: (simd-hlshift)           ( a n rep -- c )
+SIMD-INTRINSIC: (simd-vsqrt)             ( a   rep -- c ) [ fsqrt ] components-map ;
+SIMD-INTRINSIC: (simd-vsad)              ( a b rep -- c ) 2>rep-array [ - abs ] [ + ] 2map-reduce ;
+SIMD-INTRINSIC: (simd-sum)               ( a   rep -- n ) [ + ] components-reduce ;
+SIMD-INTRINSIC: (simd-vabs)              ( a   rep -- c ) [ abs ] components-map ;
+SIMD-INTRINSIC: (simd-vbitand)           ( a b rep -- c ) [ bitand ] bitwise-components-2map ;
+SIMD-INTRINSIC: (simd-vbitandn)          ( a b rep -- c ) [ [ bitnot ] dip bitand ] bitwise-components-2map ;
+SIMD-INTRINSIC: (simd-vbitor)            ( a b rep -- c ) [ bitor ] bitwise-components-2map ;
+SIMD-INTRINSIC: (simd-vbitxor)           ( a b rep -- c ) [ bitxor ] bitwise-components-2map ;
+SIMD-INTRINSIC: (simd-vbitnot)           ( a   rep -- c ) [ bitnot ] bitwise-components-map ;
+SIMD-INTRINSIC: (simd-vand)              ( a b rep -- c ) [ bitand ] bitwise-components-2map ;
+SIMD-INTRINSIC: (simd-vandn)             ( a b rep -- c ) [ [ bitnot ] dip bitand ] bitwise-components-2map ;
+SIMD-INTRINSIC: (simd-vor)               ( a b rep -- c ) [ bitor ] bitwise-components-2map ;
+SIMD-INTRINSIC: (simd-vxor)              ( a b rep -- c ) [ bitxor ] bitwise-components-2map ;
+SIMD-INTRINSIC: (simd-vnot)              ( a   rep -- c ) [ bitnot ] bitwise-components-map ;
+SIMD-INTRINSIC: (simd-vlshift)           ( a n rep -- c ) swap '[ _ shift ] bitwise-components-map ;
+SIMD-INTRINSIC: (simd-vrshift)           ( a n rep -- c ) swap '[ _ neg shift ] bitwise-components-map ;
+! XXX
+SIMD-INTRINSIC: (simd-hlshift)           ( a n rep -- c )
     drop head-slice* 16 0 pad-head ;
-: (simd-hrshift)           ( a n rep -- c )
+! XXX
+SIMD-INTRINSIC: (simd-hrshift)           ( a n rep -- c )
     drop tail-slice 16 0 pad-tail ;
-: (simd-vshuffle-elements) ( a n rep -- c ) [ rep-length 0 pad-tail ] keep (vshuffle) ;
-: (simd-vshuffle-bytes)    ( a b rep -- c ) drop uchar-16-rep (vshuffle) ;
-:: (simd-vmerge-head)      ( a b rep -- c )
+SIMD-INTRINSIC: (simd-vshuffle-elements) ( a n rep -- c ) [ rep-length 0 pad-tail ] keep (vshuffle) ;
+SIMD-INTRINSIC: (simd-vshuffle2-elements) ( a b n rep -- c ) [ rep-length 0 pad-tail ] keep (vshuffle2) ;
+SIMD-INTRINSIC: (simd-vshuffle-bytes)    ( a b rep -- c ) drop uchar-16-rep (vshuffle) ;
+SIMD-INTRINSIC:: (simd-vmerge-head)      ( a b rep -- c )
     a b rep 2>rep-array :> ( a' b' )
     rep <rep-array> :> c'
-    rep rep-length 2 /i iota [| n |
+    rep rep-length 2 /i [| n |
         n a' nth-unsafe n 2 *     c' set-nth-unsafe
         n b' nth-unsafe n 2 * 1 + c' set-nth-unsafe
-    ] each
+    ] unrolled-each-integer
     c' underlying>> ;
-:: (simd-vmerge-tail)      ( a b rep -- c )
+SIMD-INTRINSIC:: (simd-vmerge-tail)      ( a b rep -- c )
     a b rep 2>rep-array :> ( a' b' )
     rep <rep-array> :> c'
     rep rep-length 2 /i :> len
-    len iota [| n |
+    len [| n |
         n len + a' nth-unsafe n 2 *     c' set-nth-unsafe
         n len + b' nth-unsafe n 2 * 1 + c' set-nth-unsafe
-    ] each
+    ] unrolled-each-integer
     c' underlying>> ;
-: (simd-v<=)               ( a b rep -- c )
+SIMD-INTRINSIC: (simd-v<=)               ( a b rep -- c )
     dup rep-tf-values '[ <= _ _ ? ] components-2map ; 
-: (simd-v<)                ( a b rep -- c )
+SIMD-INTRINSIC: (simd-v<)                ( a b rep -- c )
     dup rep-tf-values '[ <  _ _ ? ] components-2map ;
-: (simd-v=)                ( a b rep -- c )
+SIMD-INTRINSIC: (simd-v=)                ( a b rep -- c )
     dup rep-tf-values '[ =  _ _ ? ] components-2map ;
-: (simd-v>)                ( a b rep -- c )
+SIMD-INTRINSIC: (simd-v>)                ( a b rep -- c )
     dup rep-tf-values '[ >  _ _ ? ] components-2map ;
-: (simd-v>=)               ( a b rep -- c )
+SIMD-INTRINSIC: (simd-v>=)               ( a b rep -- c )
     dup rep-tf-values '[ >= _ _ ? ] components-2map ;
-: (simd-vunordered?)       ( a b rep -- c )
+SIMD-INTRINSIC: (simd-vunordered?)       ( a b rep -- c )
     dup rep-tf-values '[ unordered? _ _ ? ] components-2map ;
-: (simd-vany?)             ( a   rep -- ? ) [ bitor  ] bitwise-components-reduce zero? not ;
-: (simd-vall?)             ( a   rep -- ? ) [ bitand ] bitwise-components-reduce zero? not ;
-: (simd-vnone?)            ( a   rep -- ? ) [ bitor  ] bitwise-components-reduce zero?     ;
-: (simd-v>float)           ( a   rep -- c )
-    [ >rep-array [ >float ] ] [ >float-vector-rep <rep-array> ] bi map-as underlying>> ;
-: (simd-v>integer)         ( a   rep -- c )
-    [ >rep-array [ >integer ] ] [ >int-vector-rep <rep-array> ] bi map-as underlying>> ;
-: (simd-vpack-signed)      ( a b rep -- c )
-    [ 2>rep-array cord-append ]
+SIMD-INTRINSIC: (simd-vany?)             ( a   rep -- ? ) [ bitor  ] bitwise-components-reduce zero? not ;
+SIMD-INTRINSIC: (simd-vall?)             ( a   rep -- ? ) [ bitand ] bitwise-components-reduce zero? not ;
+SIMD-INTRINSIC: (simd-vnone?)            ( a   rep -- ? ) [ bitor  ] bitwise-components-reduce zero?     ;
+SIMD-INTRINSIC: (simd-v>float)           ( a   rep -- c )
+    [ [ >rep-array ] [ rep-length ] bi [ >float ] ]
+    [ >float-vector-rep <rep-array> ] bi unrolled-map-as-unsafe underlying>> ;
+SIMD-INTRINSIC: (simd-v>integer)         ( a   rep -- c )
+    [ [ >rep-array ] [ rep-length ] bi [ >integer ] ]
+    [ >int-vector-rep <rep-array> ] bi unrolled-map-as-unsafe underlying>> ;
+SIMD-INTRINSIC: (simd-vpack-signed)      ( a b rep -- c )
+    [ [ 2>rep-array cord-append ] [ rep-length 2 * ] bi ]
     [ narrow-vector-rep [ <rep-array> ] [ rep-component-type ] bi ] bi
-    '[ _ c-type-clamp ] swap map-as underlying>> ;
-: (simd-vpack-unsigned)    ( a b rep -- c )
-    [ 2>rep-array cord-append ]
+    '[ _ c:c-type-clamp ] swap unrolled-map-as-unsafe underlying>> ;
+SIMD-INTRINSIC: (simd-vpack-unsigned)    ( a b rep -- c )
+    [ [ 2>rep-array cord-append ] [ rep-length 2 * ] bi ]
     [ narrow-vector-rep >uint-vector-rep [ <rep-array> ] [ rep-component-type ] bi ] bi
-    '[ _ c-type-clamp ] swap map-as underlying>> ;
-: (simd-vunpack-head)      ( a   rep -- c ) 
+    '[ _ c:c-type-clamp ] swap unrolled-map-as-unsafe underlying>> ;
+! XXX
+SIMD-INTRINSIC: (simd-vunpack-head)      ( a   rep -- c ) 
     [ >rep-array ] [ widen-vector-rep [ rep-length ] [ [>rep-array] ] bi ] bi
     [ head-slice ] dip call( a' -- c' ) underlying>> ;
-: (simd-vunpack-tail)      ( a   rep -- c )
+! XXX
+SIMD-INTRINSIC: (simd-vunpack-tail)      ( a   rep -- c )
     [ >rep-array ] [ widen-vector-rep [ rep-length ] [ [>rep-array] ] bi ] bi
     [ tail-slice ] dip call( a' -- c' ) underlying>> ;
-: (simd-with)              (   n rep -- v )
+! XXX
+SIMD-INTRINSIC: (simd-with)              (   n rep -- v )
     [ rep-length swap '[ _ ] ] [ <rep-array> ] bi replicate-as 
     underlying>> ;
-: (simd-gather-2)          ( m n rep -- v ) <rep-array> [ 2 set-firstn ] keep underlying>> ;
-: (simd-gather-4)          ( m n o p rep -- v ) <rep-array> [ 4 set-firstn ] keep underlying>> ;
-: (simd-select)            ( a n rep -- x ) [ swap ] dip >rep-array nth-unsafe ;
+SIMD-INTRINSIC: (simd-gather-2)          ( m n rep -- v ) <rep-array> [ 2 set-firstn-unsafe ] keep underlying>> ;
+SIMD-INTRINSIC: (simd-gather-4)          ( m n o p rep -- v ) <rep-array> [ 4 set-firstn-unsafe ] keep underlying>> ;
+SIMD-INTRINSIC: (simd-select)            ( a n rep -- x ) [ swap ] dip >rep-array nth-unsafe ;
 
-: alien-vector     (       c-ptr n rep -- value )
+SIMD-INTRINSIC: alien-vector     (       c-ptr n rep -- value )
     [ swap <displaced-alien> ] dip rep-size memory>byte-array ;
-: set-alien-vector ( value c-ptr n rep --       )
+SIMD-INTRINSIC: set-alien-vector ( value c-ptr n rep --       )
     [ swap <displaced-alien> swap ] dip rep-size memcpy ;
 
 "compiler.cfg.intrinsics.simd" require
 "compiler.tree.propagation.simd" require
 "compiler.cfg.value-numbering.simd" require
-
index bcc05564fc2745df386602df82ad7e0a09ee93e5..accced4b790fbd6609b931578836dc74e96cb161 100644 (file)
@@ -138,11 +138,11 @@ GENERIC: advance ( dt object -- )
 
 : update-velocity ( dt actor -- )
     [ acceleration>> n*v ] [ velocity>> v+ ] [ ] tri
-    (>>velocity) ; inline
+    velocity<< ; inline
 
 : update-position ( dt actor -- )
     [ velocity>> n*v ] [ position>> v+ ] [ ] tri
-    (>>position) ; inline
+    position<< ; inline
 
 M: actor advance ( dt actor -- )
     [ >float ] dip
index 1d19c76dc1ac871e2d64a90d9fff72a12dd5cc9a..9bc90cbf7e41b9357dfaeb293e29862647748cd8 100644 (file)
@@ -1,11 +1,12 @@
 USING: accessors arrays classes compiler.test compiler.tree.debugger
 effects fry io kernel kernel.private math math.functions
-math.private math.vectors math.vectors.simd
+math.private math.vectors math.vectors.simd math.ranges
 math.vectors.simd.private prettyprint random sequences system
 tools.test vocabs assocs compiler.cfg.debugger words
 locals combinators cpu.architecture namespaces byte-arrays alien
 specialized-arrays classes.struct eval classes.algebra sets
-quotations math.constants compiler.units splitting ;
+quotations math.constants compiler.units splitting math.matrices
+math.vectors.simd.cords alien.data ;
 FROM: math.vectors.simd.intrinsics => alien-vector set-alien-vector ;
 QUALIFIED-WITH: alien.c-types c
 SPECIALIZED-ARRAY: c:float
@@ -128,7 +129,7 @@ CONSTANT: vector-words
         @
         [ dup [ class ] { } map-as ] dip '[ _ declare @ ]
         {
-            [ "print-mr" get [ nip test-mr mr. ] [ 2drop ] if ]
+            [ "print-mr" get [ nip regs. ] [ 2drop ] if ]
             [ "print-checks" get [ [ . ] bi@ ] [ 2drop ] if ]
             [ [ [ call ] dip call ] call( quot quot -- result ) ]
             [ [ [ call ] dip compile-call ] call( quot quot -- result ) ]
@@ -375,6 +376,38 @@ simd-classes&reps [
         [ dup '[ _ random ] replicate 1array ]
     } case ;
 
+: 2shuffles-for ( n -- shuffles )
+    {
+        { 2 [
+            {
+                { 0 1 }
+                { 0 3 }
+                { 2 3 }
+                { 2 0 }
+            }
+        ] }
+        { 4 [
+            {
+                { 0 1 2 3 }
+                { 4 1 2 3 }
+                { 0 5 2 3 }
+                { 0 1 6 3 }
+                { 0 1 2 7 }
+                { 4 5 2 3 }
+                { 0 1 6 7 }
+                { 4 5 6 7 }
+                { 0 5 2 7 }
+            }
+        ] }
+        { 8 [
+            4 2shuffles-for
+            4 2shuffles-for
+            [ [ 8 + ] map ] map
+            [ append ] 2map
+        ] }
+        [ dup 2 * '[ _ random ] replicate 1array ]
+    } case ;
+
 simd-classes [
     [ [ { } ] ] dip
     [ new length shuffles-for ] keep
@@ -384,6 +417,19 @@ simd-classes [
     ] unit-test
 ] each
 
+simd-classes [
+    [ [ { } ] ] dip
+    [ new length 2shuffles-for ] keep
+    '[
+        _ [ [
+            _ new
+            [ [ length iota ] keep like ]
+            [ [ length dup dup + [a,b) ] keep like ] bi [ ] 2sequence
+        ] dip '[ _ vshuffle2-elements ] ]
+        [ = ] check-optimizer
+    ] unit-test
+] each
+
 "== Checking variable shuffles" print
 
 : random-shift-vector ( class -- vec )
@@ -564,6 +610,17 @@ STRUCT: simd-struct
 
 [ ] [ char-16 new 1array stack. ] unit-test
 
+! Test some sequence protocol stuff
+[ t ] [ 4 double-4{ 1 2 3 4 } new-sequence double-4? ] unit-test
+[ double-4{ 2 3 4 5 } ] [ double-4{ 1 2 3 4 } [ 1 + ] map ] unit-test
+
+! Test cross product
+[ float-4{ 0.0 0.0 1.0 0.0 } ] [ float-4{ 1.0 0.0 0.0 0.0 } float-4{ 0.0 1.0 0.0 0.0 } cross ] unit-test
+[ float-4{ 0.0 -1.0 0.0 0.0 } ] [ float-4{ 1.0 0.0 0.0 0.0 } float-4{ 0.0 0.0 1.0 0.0 } cross ] unit-test
+
+[ double-4{ 0.0 0.0 1.0 0.0 } ] [ double-4{ 1.0 0.0 0.0 0.0 } double-4{ 0.0 1.0 0.0 0.0 } cross ] unit-test
+[ double-4{ 0.0 -1.0 0.0 0.0 } ] [ double-4{ 1.0 0.0 0.0 0.0 } double-4{ 0.0 0.0 1.0 0.0 } cross ] unit-test
+
 ! CSSA bug
 [ 4000000 ] [
     int-4{ 1000 1000 1000 1000 }
@@ -603,3 +660,47 @@ STRUCT: simd-struct
 
 [ float-4{ 0 0 0 0 } ]
 [ 5.0 float-4{ 1 2 3 4 } float-4{ 4 5 6 7 } 0.0 simd-spill-test-2 ] unit-test
+
+USE: alien
+
+: callback-1 ( -- c )
+    c:int { c:int c:int c:int c:int c:int } cdecl [ + + + + ] alien-callback ;
+
+: indirect-1 ( x x x x x c -- y )
+    c:int { c:int c:int c:int c:int c:int } cdecl alien-indirect ; inline
+
+: simd-spill-test-3 ( a b d c -- v )
+    { float float-4 float-4 float } declare
+    [ [ 3.0 + ] 2dip v+ ] dip sin v*n n*v
+    10 5 100 50 500 callback-1 indirect-1 665 assert= ;
+
+[ float-4{ 0 0 0 0 } ]
+[ 5.0 float-4{ 1 2 3 4 } float-4{ 4 5 6 7 } 0.0 simd-spill-test-3 ] unit-test
+
+! Stack allocation of SIMD values -- make sure that everything is
+! aligned right
+
+: simd-stack-test ( -- b c )
+    { c:int float-4 } [
+        [ 123 swap 0 c:int c:set-alien-value ]
+        [ float-4{ 1 2 3 4 } swap 0 float-4 c:set-alien-value ] bi*
+    ] [ ] with-out-parameters ;
+
+[ 123 float-4{ 1 2 3 4 } ] [ simd-stack-test ] unit-test
+
+! Stack allocation + spilling
+
+: (simd-stack-spill-test) ( -- n ) 17 ;
+
+: simd-stack-spill-test ( x -- b c )
+    { c:int } [
+        123 swap 0 c:int c:set-alien-value
+        >float (simd-stack-spill-test) float-4-with swap cos v*n
+    ] [ ] with-out-parameters ;
+
+[ ] [
+    1.047197551196598 simd-stack-spill-test
+    [ float-4{ 8.5 8.5 8.5 8.5 } approx= t assert= ]
+    [ 123 assert= ]
+    bi*
+] unit-test
index a60026317d2319744d0de7c57cc7d88eb4ba3541..1c2f61c7c620f7ccda91ae1d7da3de429d82ec53 100644 (file)
@@ -1,9 +1,10 @@
-USING: accessors alien.c-types arrays byte-arrays classes combinators
+USING: accessors alien arrays byte-arrays classes combinators
 cpu.architecture effects fry functors generalizations generic
-generic.parser kernel lexer literals macros math math.functions
-math.vectors math.vectors.private math.vectors.simd.intrinsics namespaces parser
-prettyprint.custom quotations sequences sequences.private vocabs
-vocabs.loader words ;
+generic.parser kernel lexer literals locals macros math math.functions
+math.vectors math.vectors.private math.vectors.simd.intrinsics
+namespaces parser prettyprint.custom quotations sequences
+sequences.generalizations sequences.private vocabs vocabs.loader
+words ;
 QUALIFIED-WITH: alien.c-types c
 IN: math.vectors.simd
 
@@ -85,13 +86,19 @@ DEFER: simd-construct-op
 
 : (vv->v-op) ( a b rep quot: ( (a) (b) rep -- (c) ) -- c )
     [ [ simd-unbox ] [ underlying>> ] bi* ] 2dip 3curry make-underlying ; inline
-
 : (vv->n-op) ( a b rep quot: ( (a) (b) rep -- n ) -- n )
     [ [ underlying>> ] bi@ ] 2dip 3curry call ; inline
+: (vvn->v-op) ( a b n rep quot: ( (a) (b) n rep -- (c) ) -- c )
+    [ [ simd-unbox ] [ underlying>> ] bi* ] 3dip 2curry 2curry make-underlying ; inline
     
 : vv->v-op ( a b rep quot: ( (a) (b) rep -- (c) ) fallback-quot -- c )
     [ '[ _ (vv->v-op) ] ] [ '[ drop @ ] ] bi* if-both-vectors-match ; inline
 
+:: vvn->v-op ( a b n rep quot: ( (a) (b) n rep -- (c) ) fallback-quot -- c )
+    a b rep
+    [ n swap quot (vvn->v-op) ]
+    [ drop n fallback-quot call ] if-both-vectors-match ; inline
+
 : vv'->v-op ( a b rep quot: ( (a) (b) rep -- (c) ) fallback-quot -- c )
     [ '[ _ (vv->v-op) ] ] [ '[ drop @ ] ] bi* if-both-vectors ; inline
 
@@ -107,7 +114,7 @@ PRIVATE>
 
 M: simd-128 hashcode* underlying>> hashcode* ; inline
 M: simd-128 clone [ clone ] change-underlying ; inline
-M: simd-128 c:byte-length drop 16 ; inline
+M: simd-128 byte-length drop 16 ; inline
 
 M: simd-128 new-sequence
     2dup length =
@@ -185,6 +192,8 @@ M: simd-128 hrshift
     over simd-rep [ (simd-hrshift)           ] [ call-next-method ] vn->v-op ; inline
 M: simd-128 vshuffle-elements
     over simd-rep [ (simd-vshuffle-elements) ] [ call-next-method ] vn->v-op ; inline
+M: simd-128 vshuffle2-elements
+    over simd-rep [ (simd-vshuffle2-elements) ] [ call-next-method ] vvn->v-op ; inline
 M: simd-128 vshuffle-bytes
     dup simd-rep [ (simd-vshuffle-bytes)    ] [ call-next-method ] vv'->v-op ; inline
 M: simd-128 (vmerge-head)
@@ -243,9 +252,7 @@ A{     DEFINES       ${T}{
 
 ELT     [ A-rep rep-component-type ]
 N       [ A-rep rep-length ]
-COERCER [ ELT c-type-class "coercer" word-prop [ ] or ]
-
-SET-NTH [ ELT dup c:c-setter c:array-accessor ]
+COERCER [ ELT c:c-type-class "coercer" word-prop [ ] or ]
 
 BOA-EFFECT [ N "n" <array> { "v" } <effect> ]
 
@@ -262,7 +269,7 @@ M: A nth-unsafe
     swap \ A-rep [ (simd-select) ] [ call-next-method ] vn->n-op ; inline
 M: A set-nth-unsafe
     [ ELT boolean>element ] 2dip
-    underlying>> SET-NTH call ; inline
+    underlying>> ELT c:set-alien-element ; inline
 
 : >A ( seq -- simd ) \ A new clone-like ; inline
 
@@ -339,6 +346,4 @@ M: short-8 v*hs+
 M: int-4 v*hs+
     int-4-rep [ (simd-v*hs+) ] [ call-next-method ] vv->v-op longlong-2-cast ; inline
 
-"mirrors" vocab [
-    "math.vectors.simd.mirrors" require
-] when
+{ "math.vectors.simd" "mirrors" } "math.vectors.simd.mirrors" require-when
index 6cb16e5efc5f5f96180c9b953583bb4692c9405f..b389235342c9a4e8a030033956f21625f206f903 100644 (file)
@@ -116,6 +116,10 @@ M: object vshuffle-elements
     over length 0 pad-tail
     swap [ '[ _ nth ] ] keep map-as ; inline
 
+GENERIC# vshuffle2-elements 1 ( u v perm -- w )
+M: object vshuffle2-elements
+    [ append ] dip vshuffle-elements ; inline
+
 GENERIC# vshuffle-bytes 1 ( u perm -- v )
 
 GENERIC: vshuffle ( u perm -- v )
@@ -135,8 +139,7 @@ M: object (vmerge-head) over length 2 /i '[ _ head-slice ] bi@ [ zip ] keep conc
 GENERIC: (vmerge-tail) ( u v -- t )
 M: object (vmerge-tail) over length 2 /i '[ _ tail-slice ] bi@ [ zip ] keep concat-as ; inline
 
-GENERIC: (vmerge) ( u v -- h t )
-M: object (vmerge)
+: (vmerge) ( u v -- h t )
     [ (vmerge-head) ] [ (vmerge-tail) ] 2bi ; inline
 
 GENERIC: vmerge ( u v -- w )
index c949c34684e624ce018e05d4f112500ff088ed5e..71f9fe194255cc94db95e118b7ee5f94841640a5 100644 (file)
@@ -1,8 +1,8 @@
-! Copyright (C) 2007, 2009 Slava Pestov, Daniel Ehrenberg.
+! Copyright (C) 2007, 2010 Slava Pestov, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel hashtables sequences sequences.private arrays
-words namespaces make parser math assocs effects definitions
-quotations summary accessors fry ;
+words namespaces make parser effects.parser math assocs effects
+definitions quotations summary accessors fry ;
 IN: memoize
 
 <PRIVATE
index 5693aa9162c451e9678bab641928a133a468aff9..90b856ef23c07390e7ee00a24012d08891735b00 100644 (file)
@@ -1,6 +1,7 @@
-! Copyright (C) 2004, 2008 Slava Pestov.
+! Copyright (C) 2004, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: io.pathnames io.files io.encodings.ascii assocs sequences
+USING: io.pathnames io.files io.encodings.ascii
+io.encodings.binary io.encodings.utf8 assocs sequences
 splitting kernel namespaces fry memoize ;
 IN: mime.types
 
@@ -23,3 +24,7 @@ MEMO: mime-types ( -- assoc )
 
 : mime-type ( filename -- mime-type )
     file-extension mime-types at "application/octet-stream" or ;
+
+: mime-type-encoding ( mime-type -- encoding )
+    "text/" head? utf8 binary ? ;
+
index 65978f0b46af4d4b68d93744740e2949c6f7d012..f12d34e1701bfb3005bc8d4f79bfa974d61ee0bf 100644 (file)
@@ -59,7 +59,3 @@ M: hashtable make-mirror ;
 M: integer make-mirror drop f ;
 M: enumerated-sequence make-mirror <enum> ;
 M: object make-mirror <mirror> ;
-
-"specialized-arrays" vocab [
-    "specialized-arrays.mirrors" require
-] when
index 7c29310a97716c9764422170e19e8f58cd37aac2..3398183edb3e6e4731208d0135869fb7c2c61e88 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: models.arrow models.product stack-checker accessors fry
-generalizations combinators.smart macros kernel ;
+generalizations sequences.generalizations combinators.smart
+macros kernel ;
 IN: models.arrow.smart
 
 MACRO: <smart-arrow> ( quot -- quot' )
index a1d4ee9907fa435929ac287bb45b5037d590aa1f..8292bb9c04fb9ba0e852cc18300eb46c4731eca3 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
-USING: accessors kernel models alarms ;\r
+USING: accessors alarms fry kernel models ;\r
 IN: models.delay\r
 \r
 TUPLE: delay < model model timeout alarm ;\r
@@ -14,14 +14,15 @@ TUPLE: delay < model model timeout alarm ;
         over >>model\r
         [ add-dependency ] keep ;\r
 \r
-: cancel-delay ( delay -- )\r
-    alarm>> [ cancel-alarm ] when* ;\r
+: stop-delay ( delay -- )\r
+    alarm>> [ stop-alarm ] when* ;\r
 \r
 : start-delay ( delay -- )\r
     dup\r
-    [ [ f >>alarm update-delay-model ] curry ] [ timeout>> ] bi later\r
+    [ '[ _ f >>alarm update-delay-model ] ] [ timeout>> ] bi\r
+    later\r
     >>alarm drop ;\r
 \r
-M: delay model-changed nip dup cancel-delay start-delay ;\r
+M: delay model-changed nip dup stop-delay start-delay ;\r
 \r
 M: delay model-activated update-delay-model ;\r
index f9927cfd4cc181b1f549a59a904117c525498cff..efe9bac88d0297c31c5db1cb21292c65fbb2ed37 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors generic kernel math sequences arrays assocs
-alarms calendar math.order continuations fry ;
+calendar math.order continuations fry ;
 IN: models
 
 TUPLE: model < identity-tuple
@@ -94,7 +94,7 @@ M: model update-model drop ;
     ((change-model)) set-model ; inline
 
 : (change-model) ( model quot -- )
-    ((change-model)) (>>value) ; inline
+    ((change-model)) value<< ; inline
 
 GENERIC: range-value ( model -- value )
 GENERIC: range-page-value ( model -- value )
index b4288891e0cb2d1477c77cf658cc25d9e0d7613d..29b26159a778fcc0100ca16ab76019bdfa1fe85b 100644 (file)
@@ -13,7 +13,7 @@ $nl
         "ui.gadgets.labels ui.gadgets.packs ui.gadgets.panes"\r
         "ui.gadgets.sliders ;"\r
         ""\r
-        ": <funny-model> ( -- model ) 0 10 0 100 <range> ;"\r
+        ": <funny-model> ( -- model ) 0 10 0 100 <range> ;"\r
         ": <funny-slider> ( model -- slider ) horizontal <slider> ;"\r
         ""\r
         "<funny-model> <funny-model> 2array"\r
index c39c80c7d15dc63de3e9cc70e01dca338e84c55a..9a4584a9a290bad9df5c5d0ddc4f25f776485d0c 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2008 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: accessors kernel models arrays sequences math math.order\r
-models.product generalizations math.functions ;\r
+models.product generalizations sequences.generalizations\r
+math.functions ;\r
 FROM: models.product => product ;\r
 IN: models.range\r
 \r
index 16bea56862fe19bd921ae11d591cd89473043f7d..712b62f20b0bd248e1847c94b39fd69840aee9ee 100644 (file)
@@ -1,7 +1,7 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: math kernel sequences sequences.private byte-arrays
-alien.c-types prettyprint.custom parser accessors ;
+alien prettyprint.custom parser accessors locals ;
 IN: nibble-arrays
 
 TUPLE: nibble-array
@@ -20,8 +20,10 @@ CONSTANT: nibble BIN: 1111
 : get-nibble ( n byte -- nibble )
     swap neg shift nibble bitand ; inline
 
-: set-nibble ( value n byte -- byte' )
-    nibble pick shift bitnot bitand -rot shift bitor ; inline
+:: set-nibble ( value n byte -- byte' )
+    byte nibble n shift bitnot bitand
+    value n shift
+    bitor ; inline
 
 : nibble@ ( n nibble-array -- shift n' byte-array )
     [ >fixnum byte/nibble ] [ underlying>> ] bi* ; inline
index 61a0950ce4a5d8523df2cd9d35de6ed8fa7419d4..912bb17218b9c5ee23f2cf2bde6f79719577ca6f 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: namespaces sequences math.parser kernel macros
-generalizations locals ;
+generalizations sequences.generalizations locals ;
 IN: nmake
 
 SYMBOL: building-seq 
index d3e6d7e25a809b7797ee49ec75b65d09199f212c..ce19a2ec89852388c950afe3d63887cfe526fbfc 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: opengl opengl.gl combinators continuations kernel
-alien.c-types ;
+alien.c-types alien.data ;
 IN: opengl.framebuffers
 
 : gen-framebuffer ( -- id )
@@ -51,4 +51,4 @@ IN: opengl.framebuffers
 
 : framebuffer-attachment ( attachment -- id )
     GL_FRAMEBUFFER swap GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME
-    0 <uint> [ glGetFramebufferAttachmentParameteriv ] keep *uint ;
+    { uint } [ glGetFramebufferAttachmentParameteriv ] [ ] with-out-parameters ;
index 17813b8c829f582430d57fa2ab7c0607b75bc683..1c6cd3d9edf9287c6a4f51258b9f4de13c225d85 100644 (file)
@@ -7,15 +7,15 @@ ERROR: unknown-gl-platform ;
 << {
     { [ os windows? ] [ "opengl.gl.windows" ] }
     { [ os macosx? ]  [ "opengl.gl.macosx" ] }
-    { [ os unix? ] [ "opengl.gl.unix" ] }
+    { [ os unix? ] [ "opengl.gl.x11" ] }
     [ unknown-gl-platform ]
 } cond use-vocab >>
 
-SYMBOL: +gl-function-number-counter+
+SYMBOL: +gl-function-counter+
 SYMBOL: +gl-function-pointers+
 
 : reset-gl-function-number-counter ( -- )
-    0 +gl-function-number-counter+ set-global ;
+    0 +gl-function-counter+ set-global ;
 : reset-gl-function-pointers ( -- )
     100 <hashtable> +gl-function-pointers+ set-global ;
     
@@ -23,9 +23,9 @@ SYMBOL: +gl-function-pointers+
 reset-gl-function-pointers
 reset-gl-function-number-counter
 
-: gl-function-number ( -- n )
-    +gl-function-number-counter+ get-global
-    dup 1 + +gl-function-number-counter+ set-global ;
+: gl-function-counter ( -- n )
+    +gl-function-counter+ get-global
+    dup 1 + +gl-function-counter+ set-global ;
 
 : gl-function-pointer ( names n -- funptr )
     gl-function-context 2array dup +gl-function-pointers+ get-global at
@@ -41,18 +41,15 @@ reset-gl-function-number-counter
 : indirect-quot ( function-ptr-quot return types abi -- quot )
     '[ @  _ _ _ alien-indirect ] ;
 
-:: define-indirect ( abi return function-ptr-quot function-name parameters -- )
+:: define-indirect ( abi return function-name function-ptr-quot types names -- )
     function-name create-in dup reset-generic
-    function-ptr-quot return
-    parameters return parse-arglist [ abi indirect-quot ] dip
+    function-ptr-quot return types abi indirect-quot
+    names return function-effect
     define-declared ;
 
 SYNTAX: GL-FUNCTION:
     gl-function-calling-convention
-    scan-c-type
-    scan dup
-    scan drop "}" parse-tokens swap prefix
-    gl-function-number
-    [ gl-function-pointer ] 2curry swap
-    ";" parse-tokens [ "()" subseq? not ] filter
-    define-indirect ;
+    scan-function-name
+    "{" expect "}" parse-tokens over prefix
+    gl-function-counter '[ _ _ gl-function-pointer ]
+    ";" scan-c-args define-indirect ;
index d89cee57d4c77ae36ae4f3861ea13ec5d8f6dc40..a6413fee4aa2d2f3aec81bfb86b4858c93d7ff38 100644 (file)
@@ -4,7 +4,7 @@
 ! This file is based on the gl.h that comes with xorg-x11 6.8.2
 
 USING: alien alien.c-types alien.syntax combinators kernel parser
-sequences system words opengl.gl.extensions ;
+sequences system words opengl.gl.extensions io.encodings.ascii ;
 FROM: alien.c-types => short ;
 IN: opengl.gl
 
@@ -22,7 +22,12 @@ TYPEDEF: float   GLfloat
 TYPEDEF: float   GLclampf
 TYPEDEF: double  GLdouble
 TYPEDEF: double  GLclampd
-TYPEDEF: void*   GLvoid*
+TYPEDEF: longlong  GLint64
+TYPEDEF: ulonglong GLuint64
+TYPEDEF: void*     GLsync
+C-TYPE: GLvoid
+
+TYPEDEF: c-string[ascii] GLstring
 
 ! Constants
 
@@ -668,7 +673,7 @@ FUNCTION: void glPopClientAttrib ( ) ;
 
 FUNCTION: GLint glRenderMode ( GLenum mode ) ;
 FUNCTION: GLenum glGetError ( ) ;
-FUNCTION: char* glGetString ( GLenum name ) ;
+FUNCTION: GLstring glGetString ( GLenum name ) ;
 FUNCTION: void glFinish ( ) ;
 FUNCTION: void glFlush ( ) ;
 FUNCTION: void glHint ( GLenum target, GLenum mode ) ;
@@ -898,7 +903,7 @@ FUNCTION: void glEdgeFlagPointer ( GLsizei stride, GLvoid* ptr ) ;
 
 ! [09:39] (slava) NULL <void*>
 ! [09:39] (slava) then keep that object
-! [09:39] (slava) when you want to get the value stored there, *void*
+! [09:39] (slava) when you want to get the value stored there,void*
 ! [09:39] (slava) which returns an alien
 FUNCTION: void glGetPointerv ( GLenum pname, GLvoid** params ) ;
 
@@ -1587,10 +1592,8 @@ CONSTANT: GL_STENCIL_BACK_VALUE_MASK HEX: 8CA4
 CONSTANT: GL_STENCIL_BACK_WRITEMASK HEX: 8CA5
 ALIAS: GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION
 
-TYPEDEF: char GLchar
-
 GL-FUNCTION: void glAttachShader { glAttachObjectARB } ( GLuint program, GLuint shader ) ;
-GL-FUNCTION: void glBindAttribLocation { glBindAttribLocationARB } ( GLuint program, GLuint index, GLchar* name ) ;
+GL-FUNCTION: void glBindAttribLocation { glBindAttribLocationARB } ( GLuint program, GLuint index, GLstring name ) ;
 GL-FUNCTION: void glBlendEquationSeparate { glBlendEquationSeparateEXT } ( GLenum modeRGB, GLenum modeAlpha ) ;
 GL-FUNCTION: void glCompileShader { glCompileShaderARB } ( GLuint shader ) ;
 GL-FUNCTION: GLuint glCreateProgram { glCreateProgramObjectARB } (  ) ;
@@ -1601,16 +1604,16 @@ GL-FUNCTION: void glDetachShader { glDetachObjectARB } ( GLuint program, GLuint
 GL-FUNCTION: void glDisableVertexAttribArray { glDisableVertexAttribArrayARB } ( GLuint index ) ;
 GL-FUNCTION: void glDrawBuffers { glDrawBuffersARB glDrawBuffersATI } ( GLsizei n, GLenum* bufs ) ;
 GL-FUNCTION: void glEnableVertexAttribArray { glEnableVertexAttribArrayARB } ( GLuint index ) ;
-GL-FUNCTION: void glGetActiveAttrib { glGetActiveAttribARB } ( GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name ) ;
-GL-FUNCTION: void glGetActiveUniform { glGetActiveUniformARB } ( GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name ) ;
+GL-FUNCTION: void glGetActiveAttrib { glGetActiveAttribARB } ( GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLstring name ) ;
+GL-FUNCTION: void glGetActiveUniform { glGetActiveUniformARB } ( GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLstring name ) ;
 GL-FUNCTION: void glGetAttachedShaders { glGetAttachedObjectsARB } ( GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders ) ;
-GL-FUNCTION: GLint glGetAttribLocation { glGetAttribLocationARB } ( GLuint program, GLchar* name ) ;
-GL-FUNCTION: void glGetProgramInfoLog { glGetInfoLogARB } ( GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog ) ;
+GL-FUNCTION: GLint glGetAttribLocation { glGetAttribLocationARB } ( GLuint program, GLstring name ) ;
+GL-FUNCTION: void glGetProgramInfoLog { glGetInfoLogARB } ( GLuint program, GLsizei bufSize, GLsizei* length, GLstring infoLog ) ;
 GL-FUNCTION: void glGetProgramiv { glGetObjectParameterivARB } ( GLuint program, GLenum pname, GLint* param ) ;
-GL-FUNCTION: void glGetShaderInfoLog { glGetInfoLogARB } ( GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog ) ;
-GL-FUNCTION: void glGetShaderSource { glGetShaderSourceARB } ( GLint obj, GLsizei maxLength, GLsizei* length, GLchar* source ) ;
+GL-FUNCTION: void glGetShaderInfoLog { glGetInfoLogARB } ( GLuint shader, GLsizei bufSize, GLsizei* length, GLstring infoLog ) ;
+GL-FUNCTION: void glGetShaderSource { glGetShaderSourceARB } ( GLint obj, GLsizei maxLength, GLsizei* length, GLstring source ) ;
 GL-FUNCTION: void glGetShaderiv { glGetObjectParameterivARB } ( GLuint shader, GLenum pname, GLint* param ) ;
-GL-FUNCTION: GLint glGetUniformLocation { glGetUniformLocationARB } ( GLint programObj, GLchar* name ) ;
+GL-FUNCTION: GLint glGetUniformLocation { glGetUniformLocationARB } ( GLint programObj, GLstring name ) ;
 GL-FUNCTION: void glGetUniformfv { glGetUniformfvARB } ( GLuint program, GLint location, GLfloat* params ) ;
 GL-FUNCTION: void glGetUniformiv { glGetUniformivARB } ( GLuint program, GLint location, GLint* params ) ;
 GL-FUNCTION: void glGetVertexAttribPointerv { glGetVertexAttribPointervARB } ( GLuint index, GLenum pname, GLvoid** pointer ) ;
@@ -1620,7 +1623,7 @@ GL-FUNCTION: void glGetVertexAttribiv { glGetVertexAttribivARB } ( GLuint index,
 GL-FUNCTION: GLboolean glIsProgram { glIsProgramARB } ( GLuint program ) ;
 GL-FUNCTION: GLboolean glIsShader { glIsShaderARB } ( GLuint shader ) ;
 GL-FUNCTION: void glLinkProgram { glLinkProgramARB } ( GLuint program ) ;
-GL-FUNCTION: void glShaderSource { glShaderSourceARB } ( GLuint shader, GLsizei count, GLchar** strings, GLint* lengths ) ;
+GL-FUNCTION: void glShaderSource { glShaderSourceARB } ( GLuint shader, GLsizei count, GLstring* strings, GLint* lengths ) ;
 GL-FUNCTION: void glStencilFuncSeparate { glStencilFuncSeparateATI } ( GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask ) ;
 GL-FUNCTION: void glStencilMaskSeparate { } ( GLenum face, GLuint mask ) ;
 GL-FUNCTION: void glStencilOpSeparate { glStencilOpSeparateATI } ( GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass ) ;
@@ -1991,8 +1994,8 @@ GL-FUNCTION: void glUniform4uiv { glUniform4uivEXT } ( GLint location, GLsizei c
 
 GL-FUNCTION: void glGetUniformuiv { glGetUniformuivEXT } ( GLuint program, GLint location, GLuint* params ) ;
 
-GL-FUNCTION: void glBindFragDataLocation { glBindFragDataLocationEXT } ( GLuint program, GLuint colorNumber, GLchar* name ) ;
-GL-FUNCTION: GLint glGetFragDataLocation { glGetFragDataLocationEXT } ( GLuint program, GLchar* name ) ;
+GL-FUNCTION: void glBindFragDataLocation { glBindFragDataLocationEXT } ( GLuint program, GLuint colorNumber, GLstring name ) ;
+GL-FUNCTION: GLint glGetFragDataLocation { glGetFragDataLocationEXT } ( GLuint program, GLstring name ) ;
 
 GL-FUNCTION: void glBeginConditionalRender { glBeginConditionalRenderNV } ( GLuint id, GLenum mode ) ;
 GL-FUNCTION: void glEndConditionalRender { glEndConditionalRenderNV } ( ) ;
@@ -2061,10 +2064,10 @@ GL-FUNCTION: void glBeginTransformFeedback { glBeginTransformFeedbackEXT } ( GLe
 GL-FUNCTION: void glEndTransformFeedback { glEndTransformFeedbackEXT } ( ) ;
 
 GL-FUNCTION: void glTransformFeedbackVaryings { glTransformFeedbackVaryingsEXT } ( GLuint program, GLsizei count,
-                                      GLchar** varyings, GLenum bufferMode ) ;
+                                      GLstring* varyings, GLenum bufferMode ) ;
 GL-FUNCTION: void glGetTransformFeedbackVarying { glGetTransformFeedbackVaryingEXT } ( GLuint program, GLuint index,
                                         GLsizei bufSize, GLsizei* length, 
-                                        GLsizei* size, GLenum* type, GLchar* name ) ;
+                                        GLsizei* size, GLenum* type, GLstring name ) ;
 
 GL-FUNCTION: void glClearBufferiv  { } ( GLenum buffer, GLint drawbuffer, GLint* value ) ;
 GL-FUNCTION: void glClearBufferuiv { } ( GLenum buffer, GLint drawbuffer, GLuint* value ) ;
@@ -2156,42 +2159,338 @@ GL-FUNCTION: void glDrawElementsInstanced { glDrawElementsInstancedARB } ( GLenu
 GL-FUNCTION: void glTexBuffer { glTexBufferEXT } ( GLenum target, GLenum internalformat, GLuint buffer ) ;
 GL-FUNCTION: void glPrimitiveRestartIndex { } ( GLuint index ) ;
 
-GL-FUNCTION: void glGetUniformIndices { } ( GLuint program, GLsizei uniformCount, GLchar** uniformNames, GLuint* uniformIndices ) ;
+GL-FUNCTION: void glGetUniformIndices { } ( GLuint program, GLsizei uniformCount, GLstring* uniformNames, GLuint* uniformIndices ) ;
 GL-FUNCTION: void glGetActiveUniformsiv { } ( GLuint program, GLsizei uniformCount, GLuint* uniformIndices, GLenum pname, GLint* params ) ;
-GL-FUNCTION: void glGetActiveUniformName { } ( GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformName ) ;
-GL-FUNCTION: GLuint glGetUniformBlockIndex { } ( GLuint program, GLchar* uniformBlockName ) ;
+GL-FUNCTION: void glGetActiveUniformName { } ( GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei* length, GLstring uniformName ) ;
+GL-FUNCTION: GLuint glGetUniformBlockIndex { } ( GLuint program, GLstring uniformBlockName ) ;
 GL-FUNCTION: void glGetActiveUniformBlockiv { } ( GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params ) ;
-GL-FUNCTION: void glGetActiveUniformBlockName { } ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformName ) ;
+GL-FUNCTION: void glGetActiveUniformBlockName { } ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLstring uniformName ) ;
 GL-FUNCTION: void glUniformBlockBinding { } ( GLuint buffer, GLuint uniformBlockIndex, GLuint uniformBlockBinding ) ;
 
 GL-FUNCTION: void glCopyBufferSubData { glCopyBufferSubDataEXT } ( GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size ) ;
 
 
-! GL_EXT_geometry_shader4
-
-
-GL-FUNCTION: void glProgramParameteriEXT { } ( GLuint program, GLenum pname, GLint value ) ;
-GL-FUNCTION: void glFramebufferTextureEXT { } ( GLenum target, GLenum attachment, 
-                                                GLuint texture, GLint level ) ;
-
-CONSTANT: GL_GEOMETRY_SHADER_EXT HEX: 8DD9
-CONSTANT: GL_GEOMETRY_VERTICES_OUT_EXT HEX: 8DDA
-CONSTANT: GL_GEOMETRY_INPUT_TYPE_EXT HEX: 8DDB
-CONSTANT: GL_GEOMETRY_OUTPUT_TYPE_EXT HEX: 8DDC
-CONSTANT: GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT HEX: 8C29
-CONSTANT: GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT HEX: 8DDD
-CONSTANT: GL_MAX_VERTEX_VARYING_COMPONENTS_EXT HEX: 8DDE
-CONSTANT: GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT HEX: 8DDF
-CONSTANT: GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT HEX: 8DE0
-CONSTANT: GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT HEX: 8DE1
-CONSTANT: GL_LINES_ADJACENCY_EXT HEX: A
-CONSTANT: GL_LINE_STRIP_ADJACENCY_EXT HEX: B
-CONSTANT: GL_TRIANGLES_ADJACENCY_EXT HEX: C
-CONSTANT: GL_TRIANGLE_STRIP_ADJACENCY_EXT HEX: D
-CONSTANT: GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT HEX: 8DA8
-CONSTANT: GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT HEX: 8DA9
-CONSTANT: GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT HEX: 8DA7
-CONSTANT: GL_PROGRAM_POINT_SIZE_EXT HEX: 8642
+! OpenGL 3.2
+
+CONSTANT: GL_CONTEXT_CORE_PROFILE_BIT HEX: 00000001
+CONSTANT: GL_CONTEXT_COMPATIBILITY_PROFILE_BIT HEX: 00000002
+CONSTANT: GL_LINES_ADJACENCY HEX: 000A
+CONSTANT: GL_LINE_STRIP_ADJACENCY HEX: 000B
+CONSTANT: GL_TRIANGLES_ADJACENCY HEX: 000C
+CONSTANT: GL_TRIANGLE_STRIP_ADJACENCY HEX: 000D
+CONSTANT: GL_PROGRAM_POINT_SIZE HEX: 8642
+CONSTANT: GL_GEOMETRY_VERTICES_OUT HEX: 8916
+CONSTANT: GL_GEOMETRY_INPUT_TYPE HEX: 8917
+CONSTANT: GL_GEOMETRY_OUTPUT_TYPE HEX: 8918
+CONSTANT: GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS HEX: 8C29
+CONSTANT: GL_FRAMEBUFFER_ATTACHMENT_LAYERED HEX: 8DA7
+CONSTANT: GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS HEX: 8DA8
+CONSTANT: GL_GEOMETRY_SHADER HEX: 8DD9
+CONSTANT: GL_MAX_GEOMETRY_UNIFORM_COMPONENTS HEX: 8DDF
+CONSTANT: GL_MAX_GEOMETRY_OUTPUT_VERTICES HEX: 8DE0
+CONSTANT: GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS HEX: 8DE1
+CONSTANT: GL_MAX_VERTEX_OUTPUT_COMPONENTS HEX: 9122
+CONSTANT: GL_MAX_GEOMETRY_INPUT_COMPONENTS HEX: 9123
+CONSTANT: GL_MAX_GEOMETRY_OUTPUT_COMPONENTS HEX: 9124
+CONSTANT: GL_MAX_FRAGMENT_INPUT_COMPONENTS HEX: 9125
+CONSTANT: GL_CONTEXT_PROFILE_MASK HEX: 9126
+CONSTANT: GL_MAX_SERVER_WAIT_TIMEOUT        HEX: 9111
+CONSTANT: GL_OBJECT_TYPE                    HEX: 9112
+CONSTANT: GL_SYNC_CONDITION                 HEX: 9113
+CONSTANT: GL_SYNC_STATUS                    HEX: 9114
+CONSTANT: GL_SYNC_FLAGS                     HEX: 9115
+CONSTANT: GL_SYNC_FENCE                     HEX: 9116
+CONSTANT: GL_SYNC_GPU_COMMANDS_COMPLETE     HEX: 9117
+CONSTANT: GL_UNSIGNALED                     HEX: 9118
+CONSTANT: GL_SIGNALED                       HEX: 9119
+CONSTANT: GL_ALREADY_SIGNALED               HEX: 911A
+CONSTANT: GL_TIMEOUT_EXPIRED                HEX: 911B
+CONSTANT: GL_CONDITION_SATISFIED            HEX: 911C
+CONSTANT: GL_WAIT_FAILED                    HEX: 911D
+CONSTANT: GL_SYNC_FLUSH_COMMANDS_BIT        HEX: 00000001
+CONSTANT: GL_TIMEOUT_IGNORED                HEX: FFFF,FFFF,FFFF,FFFF
+CONSTANT: GL_SAMPLE_POSITION                HEX: 8E50
+CONSTANT: GL_SAMPLE_MASK                    HEX: 8E51
+CONSTANT: GL_SAMPLE_MASK_VALUE              HEX: 8E52
+CONSTANT: GL_MAX_SAMPLE_MASK_WORDS          HEX: 8E59
+CONSTANT: GL_TEXTURE_2D_MULTISAMPLE         HEX: 9100
+CONSTANT: GL_PROXY_TEXTURE_2D_MULTISAMPLE   HEX: 9101
+CONSTANT: GL_TEXTURE_2D_MULTISAMPLE_ARRAY   HEX: 9102
+CONSTANT: GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY HEX: 9103
+CONSTANT: GL_TEXTURE_BINDING_2D_MULTISAMPLE HEX: 9104
+CONSTANT: GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY HEX: 9105
+CONSTANT: GL_TEXTURE_SAMPLES                HEX: 9106
+CONSTANT: GL_TEXTURE_FIXED_SAMPLE_LOCATIONS HEX: 9107
+CONSTANT: GL_SAMPLER_2D_MULTISAMPLE         HEX: 9108
+CONSTANT: GL_INT_SAMPLER_2D_MULTISAMPLE     HEX: 9109
+CONSTANT: GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE HEX: 910A
+CONSTANT: GL_SAMPLER_2D_MULTISAMPLE_ARRAY   HEX: 910B
+CONSTANT: GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY HEX: 910C
+CONSTANT: GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY HEX: 910D
+CONSTANT: GL_MAX_COLOR_TEXTURE_SAMPLES      HEX: 910E
+CONSTANT: GL_MAX_DEPTH_TEXTURE_SAMPLES      HEX: 910F
+CONSTANT: GL_MAX_INTEGER_SAMPLES            HEX: 9110
+CONSTANT: GL_DEPTH_CLAMP                    HEX: 864F
+CONSTANT: GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION HEX: 8E4C
+CONSTANT: GL_FIRST_VERTEX_CONVENTION        HEX: 8E4D
+CONSTANT: GL_LAST_VERTEX_CONVENTION         HEX: 8E4E
+CONSTANT: GL_PROVOKING_VERTEX               HEX: 8E4F
+CONSTANT: GL_TEXTURE_CUBE_MAP_SEAMLESS      HEX: 884F
+
+GL-FUNCTION: void glFramebufferTexture { glFramebufferTextureARB glFramebufferTextureEXT }
+    ( GLenum target, GLenum attachment, GLuint texture, GLint level ) ;
+GL-FUNCTION: void glGetBufferParameteri64v { }
+    ( GLenum target, GLenum pname, GLint64* params ) ;
+GL-FUNCTION: void glGetInteger64i_v { }
+    ( GLenum target, GLuint index, GLint64* data ) ;
+GL-FUNCTION: void glProvokingVertex { } ( GLenum mode ) ;
+
+GL-FUNCTION: GLsync glFenceSync { } ( GLenum condition, GLbitfield flags ) ;
+GL-FUNCTION: GLboolean glIsSync { } ( GLsync sync ) ;
+GL-FUNCTION: void glDeleteSync { } ( GLsync sync ) ;
+GL-FUNCTION: GLenum glClientWaitSync { } ( GLsync sync, GLbitfield flags, GLuint64 timeout ) ;
+GL-FUNCTION: void glWaitSync { } ( GLsync sync, GLbitfield flags, GLuint64 timeout ) ;
+GL-FUNCTION: void glGetInteger64v { } ( GLenum pname, GLint64* params ) ;
+GL-FUNCTION: void glGetSynciv { } ( GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values ) ;
+GL-FUNCTION: void glTexImage2DMultisample { } (  GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations ) ;
+GL-FUNCTION: void glTexImage3DMultisample { } (  GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations ) ;
+GL-FUNCTION: void glGetMultisamplefv { } (  GLenum pname, GLuint index, GLfloat* val ) ;
+GL-FUNCTION: void glSampleMaski { } ( GLuint index, GLbitfield mask ) ;
+
+
+! OpenGL 3.3
+
+CONSTANT: GL_SRC1_COLOR                     HEX: 88F9
+CONSTANT: GL_ONE_MINUS_SRC1_COLOR           HEX: 88FA
+CONSTANT: GL_ONE_MINUS_SRC1_ALPHA           HEX: 88FB
+CONSTANT: GL_MAX_DUAL_SOURCE_DRAW_BUFFERS   HEX: 88FC
+
+CONSTANT: GL_ANY_SAMPLES_PASSED             HEX: 8C2F
+
+CONSTANT: GL_SAMPLER_BINDING                HEX: 8919
+
+CONSTANT: GL_RGB10_A2UI                     HEX: 906F
+
+CONSTANT: GL_TEXTURE_SWIZZLE_R              HEX: 8E42
+CONSTANT: GL_TEXTURE_SWIZZLE_G              HEX: 8E43
+CONSTANT: GL_TEXTURE_SWIZZLE_B              HEX: 8E44
+CONSTANT: GL_TEXTURE_SWIZZLE_A              HEX: 8E45
+CONSTANT: GL_TEXTURE_SWIZZLE_RGBA           HEX: 8E46
+
+CONSTANT: GL_TIME_ELAPSED                   HEX: 88BF
+CONSTANT: GL_TIMESTAMP                      HEX: 8E28
+
+CONSTANT: GL_INT_2_10_10_10_REV             HEX: 8D9F
+
+GL-FUNCTION: void glBindFragDataLocationIndexed { } ( GLuint program, GLuint colorNumber, GLuint index, GLstring name ) ;
+GL-FUNCTION: GLint glGetFragDataIndex { } ( GLuint program, GLstring name ) ;
+
+GL-FUNCTION: void glGenSamplers { } ( GLsizei count, GLuint* samplers ) ;
+GL-FUNCTION: void glDeleteSamplers { } ( GLsizei count, GLuint* samplers ) ;
+GL-FUNCTION: GLboolean glIsSampler { } ( GLuint sampler ) ;
+GL-FUNCTION: void glBindSampler { } ( GLenum unit, GLuint sampler ) ;
+GL-FUNCTION: void glSamplerParameteri { } ( GLuint sampler, GLenum pname, GLint param ) ;
+GL-FUNCTION: void glSamplerParameteriv { } ( GLuint sampler, GLenum pname, GLint* param ) ;
+GL-FUNCTION: void glSamplerParameterf { } ( GLuint sampler, GLenum pname, GLfloat param ) ;
+GL-FUNCTION: void glSamplerParameterfv { } ( GLuint sampler, GLenum pname, GLfloat* param ) ;
+GL-FUNCTION: void glSamplerParameterIiv { } ( GLuint sampler, GLenum pname, GLint* param ) ;
+GL-FUNCTION: void glSamplerParameterIuiv { } ( GLuint sampler, GLenum pname, GLuint* param ) ;
+GL-FUNCTION: void glGetSamplerParameteriv { } ( GLuint sampler, GLenum pname, GLint* params ) ;
+GL-FUNCTION: void glGetSamplerParameterIiv { } ( GLuint sampler, GLenum pname, GLint* params ) ;
+GL-FUNCTION: void glGetSamplerParameterfv { } ( GLuint sampler, GLenum pname, GLfloat* params ) ;
+GL-FUNCTION: void glGetSamplerParameterIfv { } ( GLuint sampler, GLenum pname, GLfloat* params ) ;
+
+GL-FUNCTION: void glQueryCounter { } ( GLuint id, GLenum target ) ;
+GL-FUNCTION: void glGetQueryObjecti64v { } ( GLuint id, GLenum pname, GLint64* params ) ;
+GL-FUNCTION: void glGetQueryObjectui64v { } ( GLuint id, GLenum pname, GLuint64* params ) ;
+
+GL-FUNCTION: void glVertexP2ui { } ( GLenum type, GLuint value ) ;
+GL-FUNCTION: void glVertexP2uiv { } ( GLenum type, GLuint* value ) ;
+GL-FUNCTION: void glVertexP3ui { } ( GLenum type, GLuint value ) ;
+GL-FUNCTION: void glVertexP3uiv { } ( GLenum type, GLuint* value ) ;
+GL-FUNCTION: void glVertexP4ui { } ( GLenum type, GLuint value ) ;
+GL-FUNCTION: void glVertexP4uiv { } ( GLenum type, GLuint* value ) ;
+GL-FUNCTION: void glTexCoordP1ui { } ( GLenum type, GLuint coords ) ;
+GL-FUNCTION: void glTexCoordP1uiv { } ( GLenum type, GLuint* coords ) ;
+GL-FUNCTION: void glTexCoordP2ui { } ( GLenum type, GLuint coords ) ;
+GL-FUNCTION: void glTexCoordP2uiv { } ( GLenum type, GLuint* coords ) ;
+GL-FUNCTION: void glTexCoordP3ui { } ( GLenum type, GLuint coords ) ;
+GL-FUNCTION: void glTexCoordP3uiv { } ( GLenum type, GLuint* coords ) ;
+GL-FUNCTION: void glTexCoordP4ui { } ( GLenum type, GLuint coords ) ;
+GL-FUNCTION: void glTexCoordP4uiv { } ( GLenum type, GLuint* coords ) ;
+GL-FUNCTION: void glMultiTexCoordP1ui { } ( GLenum texture, GLenum type, GLuint coords ) ;
+GL-FUNCTION: void glMultiTexCoordP1uiv { } ( GLenum texture, GLenum type, GLuint* coords ) ;
+GL-FUNCTION: void glMultiTexCoordP2ui { } ( GLenum texture, GLenum type, GLuint coords ) ;
+GL-FUNCTION: void glMultiTexCoordP2uiv { } ( GLenum texture, GLenum type, GLuint* coords ) ;
+GL-FUNCTION: void glMultiTexCoordP3ui { } ( GLenum texture, GLenum type, GLuint coords ) ;
+GL-FUNCTION: void glMultiTexCoordP3uiv { } ( GLenum texture, GLenum type, GLuint* coords ) ;
+GL-FUNCTION: void glMultiTexCoordP4ui { } ( GLenum texture, GLenum type, GLuint coords ) ;
+GL-FUNCTION: void glMultiTexCoordP4uiv { } ( GLenum texture, GLenum type, GLuint* coords ) ;
+GL-FUNCTION: void glNormalP3ui { } ( GLenum type, GLuint coords ) ;
+GL-FUNCTION: void glNormalP3uiv { } ( GLenum type, GLuint* coords ) ;
+GL-FUNCTION: void glColorP3ui { } ( GLenum type, GLuint color ) ;
+GL-FUNCTION: void glColorP3uiv { } ( GLenum type, GLuint* color ) ;
+GL-FUNCTION: void glColorP4ui { } ( GLenum type, GLuint color ) ;
+GL-FUNCTION: void glColorP4uiv { } ( GLenum type, GLuint* color ) ;
+GL-FUNCTION: void glSecondaryColorP3ui { } ( GLenum type, GLuint color ) ;
+GL-FUNCTION: void glSecondaryColorP3uiv { } ( GLenum type, GLuint* color ) ;
+GL-FUNCTION: void glVertexAttribP1ui { } ( GLuint index, GLenum type, GLboolean normalized, GLuint value ) ;
+GL-FUNCTION: void glVertexAttribP1uiv { } ( GLuint index, GLenum type, GLboolean normalized, GLuint* value ) ;
+GL-FUNCTION: void glVertexAttribP2ui { } ( GLuint index, GLenum type, GLboolean normalized, GLuint value ) ;
+GL-FUNCTION: void glVertexAttribP2uiv { } ( GLuint index, GLenum type, GLboolean normalized, GLuint* value ) ;
+GL-FUNCTION: void glVertexAttribP3ui { } ( GLuint index, GLenum type, GLboolean normalized, GLuint value ) ;
+GL-FUNCTION: void glVertexAttribP3uiv { } ( GLuint index, GLenum type, GLboolean normalized, GLuint* value ) ;
+GL-FUNCTION: void glVertexAttribP4ui { } ( GLuint index, GLenum type, GLboolean normalized, GLuint value ) ;
+GL-FUNCTION: void glVertexAttribP4uiv { } ( GLuint index, GLenum type, GLboolean normalized, GLuint* value ) ;
+
+
+! OpenGL 4.0
+
+CONSTANT: GL_DRAW_INDIRECT_BUFFER           HEX: 8F3F
+CONSTANT: GL_DRAW_INDIRECT_BUFFER_BINDING   HEX: 8F43
+
+CONSTANT: GL_GEOMETRY_SHADER_INVOCATIONS    HEX: 887F
+CONSTANT: GL_MAX_GEOMETRY_SHADER_INVOCATIONS HEX: 8E5A
+CONSTANT: GL_MIN_FRAGMENT_INTERPOLATION_OFFSET HEX: 8E5B
+CONSTANT: GL_MAX_FRAGMENT_INTERPOLATION_OFFSET HEX: 8E5C
+CONSTANT: GL_FRAGMENT_INTERPOLATION_OFFSET_BITS HEX: 8E5D
+CONSTANT: GL_MAX_VERTEX_STREAMS             HEX: 8E71
+
+CONSTANT: GL_DOUBLE_VEC2                    HEX: 8FFC
+CONSTANT: GL_DOUBLE_VEC3                    HEX: 8FFD
+CONSTANT: GL_DOUBLE_VEC4                    HEX: 8FFE
+CONSTANT: GL_DOUBLE_MAT2                    HEX: 8F46
+CONSTANT: GL_DOUBLE_MAT3                    HEX: 8F47
+CONSTANT: GL_DOUBLE_MAT4                    HEX: 8F48
+CONSTANT: GL_DOUBLE_MAT2x3                  HEX: 8F49
+CONSTANT: GL_DOUBLE_MAT2x4                  HEX: 8F4A
+CONSTANT: GL_DOUBLE_MAT3x2                  HEX: 8F4B
+CONSTANT: GL_DOUBLE_MAT3x4                  HEX: 8F4C
+CONSTANT: GL_DOUBLE_MAT4x2                  HEX: 8F4D
+CONSTANT: GL_DOUBLE_MAT4x3                  HEX: 8F4E
+
+CONSTANT: GL_ACTIVE_SUBROUTINES             HEX: 8DE5
+CONSTANT: GL_ACTIVE_SUBROUTINE_UNIFORMS     HEX: 8DE6
+CONSTANT: GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS HEX: 8E47
+CONSTANT: GL_ACTIVE_SUBROUTINE_MAX_LENGTH   HEX: 8E48
+CONSTANT: GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH HEX: 8E49
+CONSTANT: GL_MAX_SUBROUTINES                HEX: 8DE7
+CONSTANT: GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS HEX: 8DE8
+CONSTANT: GL_NUM_COMPATIBLE_SUBROUTINES     HEX: 8E4A
+CONSTANT: GL_COMPATIBLE_SUBROUTINES         HEX: 8E4B
+
+CONSTANT: GL_PATCHES                        HEX: 000E
+CONSTANT: GL_PATCH_VERTICES                 HEX: 8E72
+CONSTANT: GL_PATCH_DEFAULT_INNER_LEVEL      HEX: 8E73
+CONSTANT: GL_PATCH_DEFAULT_OUTER_LEVEL      HEX: 8E74
+CONSTANT: GL_TESS_CONTROL_OUTPUT_VERTICES   HEX: 8E75
+CONSTANT: GL_TESS_GEN_MODE                  HEX: 8E76
+CONSTANT: GL_TESS_GEN_SPACING               HEX: 8E77
+CONSTANT: GL_TESS_GEN_VERTEX_ORDER          HEX: 8E78
+CONSTANT: GL_TESS_GEN_POINT_MODE            HEX: 8E79
+CONSTANT: GL_ISOLINES                       HEX: 8E7A
+CONSTANT: GL_FRACTIONAL_ODD                 HEX: 8E7B
+CONSTANT: GL_FRACTIONAL_EVEN                HEX: 8E7C
+CONSTANT: GL_MAX_PATCH_VERTICES             HEX: 8E7D
+CONSTANT: GL_MAX_TESS_GEN_LEVEL             HEX: 8E7E
+CONSTANT: GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS HEX: 8E7F
+CONSTANT: GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS HEX: 8E80
+CONSTANT: GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS HEX: 8E81
+CONSTANT: GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS HEX: 8E82
+CONSTANT: GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS HEX: 8E83
+CONSTANT: GL_MAX_TESS_PATCH_COMPONENTS      HEX: 8E84
+CONSTANT: GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS HEX: 8E85
+CONSTANT: GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS HEX: 8E86
+CONSTANT: GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS HEX: 8E89
+CONSTANT: GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS HEX: 8E8A
+CONSTANT: GL_MAX_TESS_CONTROL_INPUT_COMPONENTS HEX: 886C
+CONSTANT: GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS HEX: 886D
+CONSTANT: GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS HEX: 8E1E
+CONSTANT: GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS HEX: 8E1F
+CONSTANT: GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER HEX: 84F0
+CONSTANT: GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER HEX: 84F1
+CONSTANT: GL_TESS_EVALUATION_SHADER         HEX: 8E87
+CONSTANT: GL_TESS_CONTROL_SHADER            HEX: 8E88
+CONSTANT: GL_TRANSFORM_FEEDBACK             HEX: 8E22
+CONSTANT: GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED HEX: 8E23
+CONSTANT: GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE HEX: 8E24
+CONSTANT: GL_TRANSFORM_FEEDBACK_BINDING     HEX: 8E25
+CONSTANT: GL_MAX_TRANSFORM_FEEDBACK_BUFFERS HEX: 8E70
+
+GL-FUNCTION: void glUniform1d { } ( GLint location, GLdouble x ) ;
+GL-FUNCTION: void glUniform2d { } ( GLint location, GLdouble x, GLdouble y ) ;
+GL-FUNCTION: void glUniform3d { } ( GLint location, GLdouble x, GLdouble y, GLdouble z ) ;
+GL-FUNCTION: void glUniform4d { } ( GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ;
+GL-FUNCTION: void glUniform1dv { } ( GLint location, GLsizei count, GLdouble* value ) ;
+GL-FUNCTION: void glUniform2dv { } ( GLint location, GLsizei count, GLdouble* value ) ;
+GL-FUNCTION: void glUniform3dv { } ( GLint location, GLsizei count, GLdouble* value ) ;
+GL-FUNCTION: void glUniform4dv { } ( GLint location, GLsizei count, GLdouble* value ) ;
+GL-FUNCTION: void glUniformMatrix2dv { } ( GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glUniformMatrix3dv { } ( GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glUniformMatrix4dv { } ( GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glUniformMatrix2x3dv { } ( GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glUniformMatrix2x4dv { } ( GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glUniformMatrix3x2dv { } ( GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glUniformMatrix3x4dv { } ( GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glUniformMatrix4x2dv { } ( GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glUniformMatrix4x3dv { } ( GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glGetUniformdv { } ( GLuint program, GLint location, GLdouble* params ) ;
+GL-FUNCTION: void glProgramUniform1dEXT { } ( GLuint program, GLint location, GLdouble x ) ;
+GL-FUNCTION: void glProgramUniform2dEXT { } ( GLuint program, GLint location, GLdouble x, GLdouble y ) ;
+GL-FUNCTION: void glProgramUniform3dEXT { } ( GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z ) ;
+GL-FUNCTION: void glProgramUniform4dEXT { } ( GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ;
+GL-FUNCTION: void glProgramUniform1dvEXT { } ( GLuint program, GLint location, GLsizei count, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniform2dvEXT { } ( GLuint program, GLint location, GLsizei count, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniform3dvEXT { } ( GLuint program, GLint location, GLsizei count, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniform4dvEXT { } ( GLuint program, GLint location, GLsizei count, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniformMatrix2dvEXT { } ( GLuint program, GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniformMatrix3dvEXT { } ( GLuint program, GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniformMatrix4dvEXT { } ( GLuint program, GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniformMatrix2x3dvEXT { } ( GLuint program, GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniformMatrix2x4dvEXT { } ( GLuint program, GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniformMatrix3x2dvEXT { } ( GLuint program, GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniformMatrix3x4dvEXT { } ( GLuint program, GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniformMatrix4x2dvEXT { } ( GLuint program, GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+GL-FUNCTION: void glProgramUniformMatrix4x3dvEXT { } ( GLuint program, GLint location, GLsizei count, GLboolean transpose, GLdouble* value ) ;
+
+GL-FUNCTION: GLint glGetSubroutineUniformLocation { } ( GLuint program, GLenum shadertype, GLstring name ) ;
+GL-FUNCTION: GLuint glGetSubroutineIndex { } ( GLuint program, GLenum shadertype, GLstring name ) ;
+GL-FUNCTION: void glGetActiveSubroutineUniformiv { } ( GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint* values ) ;
+GL-FUNCTION: void glGetActiveSubroutineUniformName { } ( GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLstring name ) ;
+GL-FUNCTION: void glGetActiveSubroutineName { } ( GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLstring name ) ;
+GL-FUNCTION: void glUniformSubroutinesuiv { } ( GLenum shadertype, GLsizei count, GLuint* indices ) ;
+GL-FUNCTION: void glGetUniformSubroutineuiv { } ( GLenum shadertype, GLint location, GLuint* params ) ;
+GL-FUNCTION: void glGetProgramStageiv { } ( GLuint program, GLenum shadertype, GLenum pname, GLint* values ) ;
+
+GL-FUNCTION: void glPatchParameteri { } ( GLenum pname, GLint value ) ;
+GL-FUNCTION: void glPatchParameterfv { } ( GLenum pname, GLfloat* values ) ;
+
+GL-FUNCTION: void glBindTransformFeedback { } ( GLenum target, GLuint id ) ;
+GL-FUNCTION: void glDeleteTransformFeedbacks { } ( GLsizei n, GLuint* ids ) ;
+GL-FUNCTION: void glGenTransformFeedbacks { } ( GLsizei n, GLuint* ids ) ;
+GL-FUNCTION: GLboolean glIsTransformFeedback { } ( GLuint id ) ;
+GL-FUNCTION: void glPauseTransformFeedback { } ( ) ;
+GL-FUNCTION: void glResumeTransformFeedback { } ( ) ;
+GL-FUNCTION: void glDrawTransformFeedback { } ( GLenum mode, GLuint id ) ;
+
+GL-FUNCTION: void glDrawTransformFeedbackStream { } ( GLenum mode, GLuint id, GLuint stream ) ;
+GL-FUNCTION: void glBeginQueryIndexed { } ( GLenum target, GLuint index, GLuint id ) ;
+GL-FUNCTION: void glEndQueryIndexed { } ( GLenum target, GLuint index ) ;
+GL-FUNCTION: void glGetQueryIndexediv { } ( GLenum target, GLuint index, GLenum pname, GLint* params ) ;
+
+
+! GL_ARB_geometry_shader4
+
+GL-FUNCTION: void glProgramParameteriARB { glProgramParameteriEXT }
+    ( GLuint program, GLenum pname, GLint value ) ;
+GL-FUNCTION: void glFramebufferTextureLayerARB { glFramebufferTextureLayerEXT }
+    ( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer ) ;
+GL-FUNCTION: void glFramebufferTextureFaceARB { glFramebufferTextureFaceEXT }
+    ( GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face ) ;
+
+CONSTANT: GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB HEX: 8DDD
+CONSTANT: GL_MAX_VERTEX_VARYING_COMPONENTS_ARB HEX: 8DDE
+CONSTANT: GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB HEX: 8DA9
 
 
 ! GL_EXT_framebuffer_object
@@ -2212,6 +2511,7 @@ CONSTANT: GL_LUMINANCE_ALPHA16F_ARB HEX: 881F
 CONSTANT: GL_TEXTURE_LUMINANCE_TYPE_ARB HEX: 8C14
 CONSTANT: GL_TEXTURE_INTENSITY_TYPE_ARB HEX: 8C15
 
+
 ! GL_EXT_texture_integer
 
 CONSTANT: GL_ALPHA32UI_EXT HEX: 8D72
@@ -2251,6 +2551,7 @@ CONSTANT: GL_LUMINANCE_ALPHA_INTEGER_EXT  HEX: 8D9D
 GL-FUNCTION: void glClearColorIiEXT { } ( GLint r, GLint g, GLint b, GLint a ) ;
 GL-FUNCTION: void glClearColorIuiEXT { } ( GLuint r, GLuint g, GLuint b, GLuint a ) ;
 
+
 ! GL_EXT_texture_compression_s3tc, GL_EXT_texture_compression_dxt1
 
 CONSTANT: GL_COMPRESSED_RGB_S3TC_DXT1_EXT  HEX: 83F0
@@ -2258,6 +2559,7 @@ CONSTANT: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT HEX: 83F1
 CONSTANT: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT HEX: 83F2
 CONSTANT: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT HEX: 83F3
 
+
 ! GL_EXT_texture_compression_latc
 
 CONSTANT: GL_COMPRESSED_LUMINANCE_LATC1_EXT              HEX: 8C70
index 9e095a62e6b205314023943dfde6fca03fc893e7..aeaa5da4eb759dfdb75e84b038abad88ca6bd104 100644 (file)
@@ -3,4 +3,4 @@ IN: opengl.gl.macosx
 
 : gl-function-context ( -- context ) 0 ; inline
 : gl-function-address ( name -- address ) f dlsym ; inline
-: gl-function-calling-convention ( -- str ) "cdecl" ; inline
+: gl-function-calling-convention ( -- str ) cdecl ; inline
diff --git a/basis/opengl/gl/unix/authors.txt b/basis/opengl/gl/unix/authors.txt
deleted file mode 100755 (executable)
index f13c9c1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Joe Groff
diff --git a/basis/opengl/gl/unix/platforms.txt b/basis/opengl/gl/unix/platforms.txt
deleted file mode 100644 (file)
index 509143d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unix
diff --git a/basis/opengl/gl/unix/unix.factor b/basis/opengl/gl/unix/unix.factor
deleted file mode 100644 (file)
index 3352b18..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-USING: kernel x11.glx ;
-IN: opengl.gl.unix
-
-: gl-function-context ( -- context ) glXGetCurrentContext ; inline
-: gl-function-address ( name -- address ) glXGetProcAddressARB ; inline
-: gl-function-calling-convention ( -- str ) "cdecl" ; inline
index 5821e3f212ca575d7c2cd6d5b166313366a54524..eda1e3178e7cbe08b84ea251d196eb22ada91e94 100644 (file)
@@ -1,11 +1,11 @@
-USING: alien.c-types alien.syntax kernel windows.types ;
+USING: alien alien.c-types alien.syntax kernel windows.types ;
 IN: opengl.gl.windows
 
 LIBRARY: gl
 
 FUNCTION: HGLRC wglGetCurrentContext ( ) ;
-FUNCTION: void* wglGetProcAddress ( char* name ) ;
+FUNCTION: void* wglGetProcAddress ( c-string name ) ;
 
 : gl-function-context ( -- context ) wglGetCurrentContext ; inline
 : gl-function-address ( name -- address ) wglGetProcAddress ; inline
-: gl-function-calling-convention ( -- str ) "stdcall" ; inline
+: gl-function-calling-convention ( -- str ) stdcall ; inline
diff --git a/basis/opengl/gl/x11/authors.txt b/basis/opengl/gl/x11/authors.txt
new file mode 100755 (executable)
index 0000000..f13c9c1
--- /dev/null
@@ -0,0 +1 @@
+Joe Groff
diff --git a/basis/opengl/gl/x11/platforms.txt b/basis/opengl/gl/x11/platforms.txt
new file mode 100644 (file)
index 0000000..509143d
--- /dev/null
@@ -0,0 +1 @@
+unix
diff --git a/basis/opengl/gl/x11/x11.factor b/basis/opengl/gl/x11/x11.factor
new file mode 100644 (file)
index 0000000..2d75275
--- /dev/null
@@ -0,0 +1,6 @@
+USING: alien kernel x11.glx ;
+IN: opengl.gl.x11
+
+: gl-function-context ( -- context ) glXGetCurrentContext ; inline
+: gl-function-address ( name -- address ) glXGetProcAddressARB ; inline
+: gl-function-calling-convention ( -- str ) cdecl ; inline
index 2c10e639e5b547dba1850b692afdb7f4fabeb30b..0faacacf153a9a87c8e129e342fe8b5c6b290de1 100644 (file)
@@ -17,6 +17,7 @@ ALIAS: GL_LINE_STRIP gl:GL_LINE_STRIP
 ALIAS: GL_TRIANGLES gl:GL_TRIANGLES
 ALIAS: GL_TRIANGLE_STRIP gl:GL_TRIANGLE_STRIP
 ALIAS: GL_TRIANGLE_FAN gl:GL_TRIANGLE_FAN
+ALIAS: GL_QUADS gl:GL_QUADS
 ALIAS: GL_NEVER gl:GL_NEVER
 ALIAS: GL_LESS gl:GL_LESS
 ALIAS: GL_EQUAL gl:GL_EQUAL
@@ -354,6 +355,7 @@ ALIAS: GL_DYNAMIC_DRAW gl:GL_DYNAMIC_DRAW
 ALIAS: GL_DYNAMIC_READ gl:GL_DYNAMIC_READ
 ALIAS: GL_DYNAMIC_COPY gl:GL_DYNAMIC_COPY
 ALIAS: GL_SAMPLES_PASSED gl:GL_SAMPLES_PASSED
+ALIAS: GL_SRC1_ALPHA gl:GL_SRC1_ALPHA
 ALIAS: GL_BLEND_EQUATION_RGB gl:GL_BLEND_EQUATION_RGB
 ALIAS: GL_VERTEX_ATTRIB_ARRAY_ENABLED gl:GL_VERTEX_ATTRIB_ARRAY_ENABLED
 ALIAS: GL_VERTEX_ATTRIB_ARRAY_SIZE gl:GL_VERTEX_ATTRIB_ARRAY_SIZE
@@ -726,6 +728,151 @@ ALIAS: GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES gl:GL_UNIFORM_BLOCK_ACTIVE_UNIFOR
 ALIAS: GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER gl:GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER
 ALIAS: GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER gl:GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER
 ALIAS: GL_INVALID_INDEX gl:GL_INVALID_INDEX
+ALIAS: GL_CONTEXT_CORE_PROFILE_BIT gl:GL_CONTEXT_CORE_PROFILE_BIT
+ALIAS: GL_CONTEXT_COMPATIBILITY_PROFILE_BIT gl:GL_CONTEXT_COMPATIBILITY_PROFILE_BIT
+ALIAS: GL_LINES_ADJACENCY gl:GL_LINES_ADJACENCY
+ALIAS: GL_LINE_STRIP_ADJACENCY gl:GL_LINE_STRIP_ADJACENCY
+ALIAS: GL_TRIANGLES_ADJACENCY gl:GL_TRIANGLES_ADJACENCY
+ALIAS: GL_TRIANGLE_STRIP_ADJACENCY gl:GL_TRIANGLE_STRIP_ADJACENCY
+ALIAS: GL_PROGRAM_POINT_SIZE gl:GL_PROGRAM_POINT_SIZE
+ALIAS: GL_GEOMETRY_VERTICES_OUT gl:GL_GEOMETRY_VERTICES_OUT
+ALIAS: GL_GEOMETRY_INPUT_TYPE gl:GL_GEOMETRY_INPUT_TYPE
+ALIAS: GL_GEOMETRY_OUTPUT_TYPE gl:GL_GEOMETRY_OUTPUT_TYPE
+ALIAS: GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS gl:GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS
+ALIAS: GL_FRAMEBUFFER_ATTACHMENT_LAYERED gl:GL_FRAMEBUFFER_ATTACHMENT_LAYERED
+ALIAS: GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS gl:GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
+ALIAS: GL_GEOMETRY_SHADER gl:GL_GEOMETRY_SHADER
+ALIAS: GL_MAX_GEOMETRY_UNIFORM_COMPONENTS gl:GL_MAX_GEOMETRY_UNIFORM_COMPONENTS
+ALIAS: GL_MAX_GEOMETRY_OUTPUT_VERTICES gl:GL_MAX_GEOMETRY_OUTPUT_VERTICES
+ALIAS: GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS gl:GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS
+ALIAS: GL_MAX_VERTEX_OUTPUT_COMPONENTS gl:GL_MAX_VERTEX_OUTPUT_COMPONENTS
+ALIAS: GL_MAX_GEOMETRY_INPUT_COMPONENTS gl:GL_MAX_GEOMETRY_INPUT_COMPONENTS
+ALIAS: GL_MAX_GEOMETRY_OUTPUT_COMPONENTS gl:GL_MAX_GEOMETRY_OUTPUT_COMPONENTS
+ALIAS: GL_MAX_FRAGMENT_INPUT_COMPONENTS gl:GL_MAX_FRAGMENT_INPUT_COMPONENTS
+ALIAS: GL_CONTEXT_PROFILE_MASK gl:GL_CONTEXT_PROFILE_MASK
+ALIAS: GL_MAX_SERVER_WAIT_TIMEOUT gl:GL_MAX_SERVER_WAIT_TIMEOUT
+ALIAS: GL_OBJECT_TYPE gl:GL_OBJECT_TYPE
+ALIAS: GL_SYNC_CONDITION gl:GL_SYNC_CONDITION
+ALIAS: GL_SYNC_STATUS gl:GL_SYNC_STATUS
+ALIAS: GL_SYNC_FLAGS gl:GL_SYNC_FLAGS
+ALIAS: GL_SYNC_FENCE gl:GL_SYNC_FENCE
+ALIAS: GL_SYNC_GPU_COMMANDS_COMPLETE gl:GL_SYNC_GPU_COMMANDS_COMPLETE
+ALIAS: GL_UNSIGNALED gl:GL_UNSIGNALED
+ALIAS: GL_SIGNALED gl:GL_SIGNALED
+ALIAS: GL_ALREADY_SIGNALED gl:GL_ALREADY_SIGNALED
+ALIAS: GL_TIMEOUT_EXPIRED gl:GL_TIMEOUT_EXPIRED
+ALIAS: GL_CONDITION_SATISFIED gl:GL_CONDITION_SATISFIED
+ALIAS: GL_WAIT_FAILED gl:GL_WAIT_FAILED
+ALIAS: GL_SYNC_FLUSH_COMMANDS_BIT gl:GL_SYNC_FLUSH_COMMANDS_BIT
+ALIAS: GL_TIMEOUT_IGNORED gl:GL_TIMEOUT_IGNORED
+ALIAS: GL_SAMPLE_POSITION gl:GL_SAMPLE_POSITION
+ALIAS: GL_SAMPLE_MASK gl:GL_SAMPLE_MASK
+ALIAS: GL_SAMPLE_MASK_VALUE gl:GL_SAMPLE_MASK_VALUE
+ALIAS: GL_MAX_SAMPLE_MASK_WORDS gl:GL_MAX_SAMPLE_MASK_WORDS
+ALIAS: GL_TEXTURE_2D_MULTISAMPLE gl:GL_TEXTURE_2D_MULTISAMPLE
+ALIAS: GL_PROXY_TEXTURE_2D_MULTISAMPLE gl:GL_PROXY_TEXTURE_2D_MULTISAMPLE
+ALIAS: GL_TEXTURE_2D_MULTISAMPLE_ARRAY gl:GL_TEXTURE_2D_MULTISAMPLE_ARRAY
+ALIAS: GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY gl:GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY
+ALIAS: GL_TEXTURE_BINDING_2D_MULTISAMPLE gl:GL_TEXTURE_BINDING_2D_MULTISAMPLE
+ALIAS: GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY gl:GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY
+ALIAS: GL_TEXTURE_SAMPLES gl:GL_TEXTURE_SAMPLES
+ALIAS: GL_TEXTURE_FIXED_SAMPLE_LOCATIONS gl:GL_TEXTURE_FIXED_SAMPLE_LOCATIONS
+ALIAS: GL_SAMPLER_2D_MULTISAMPLE gl:GL_SAMPLER_2D_MULTISAMPLE
+ALIAS: GL_INT_SAMPLER_2D_MULTISAMPLE gl:GL_INT_SAMPLER_2D_MULTISAMPLE
+ALIAS: GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE gl:GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE
+ALIAS: GL_SAMPLER_2D_MULTISAMPLE_ARRAY gl:GL_SAMPLER_2D_MULTISAMPLE_ARRAY
+ALIAS: GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY gl:GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
+ALIAS: GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY gl:GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
+ALIAS: GL_MAX_COLOR_TEXTURE_SAMPLES gl:GL_MAX_COLOR_TEXTURE_SAMPLES
+ALIAS: GL_MAX_DEPTH_TEXTURE_SAMPLES gl:GL_MAX_DEPTH_TEXTURE_SAMPLES
+ALIAS: GL_MAX_INTEGER_SAMPLES gl:GL_MAX_INTEGER_SAMPLES
+ALIAS: GL_DEPTH_CLAMP gl:GL_DEPTH_CLAMP
+ALIAS: GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION gl:GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION
+ALIAS: GL_FIRST_VERTEX_CONVENTION gl:GL_FIRST_VERTEX_CONVENTION
+ALIAS: GL_LAST_VERTEX_CONVENTION gl:GL_LAST_VERTEX_CONVENTION
+ALIAS: GL_PROVOKING_VERTEX gl:GL_PROVOKING_VERTEX
+ALIAS: GL_TEXTURE_CUBE_MAP_SEAMLESS gl:GL_TEXTURE_CUBE_MAP_SEAMLESS
+ALIAS: GL_SRC1_COLOR gl:GL_SRC1_COLOR
+ALIAS: GL_ONE_MINUS_SRC1_COLOR gl:GL_ONE_MINUS_SRC1_COLOR
+ALIAS: GL_ONE_MINUS_SRC1_ALPHA gl:GL_ONE_MINUS_SRC1_ALPHA
+ALIAS: GL_MAX_DUAL_SOURCE_DRAW_BUFFERS gl:GL_MAX_DUAL_SOURCE_DRAW_BUFFERS
+ALIAS: GL_ANY_SAMPLES_PASSED gl:GL_ANY_SAMPLES_PASSED
+ALIAS: GL_SAMPLER_BINDING gl:GL_SAMPLER_BINDING
+ALIAS: GL_RGB10_A2UI gl:GL_RGB10_A2UI
+ALIAS: GL_TEXTURE_SWIZZLE_R gl:GL_TEXTURE_SWIZZLE_R
+ALIAS: GL_TEXTURE_SWIZZLE_G gl:GL_TEXTURE_SWIZZLE_G
+ALIAS: GL_TEXTURE_SWIZZLE_B gl:GL_TEXTURE_SWIZZLE_B
+ALIAS: GL_TEXTURE_SWIZZLE_A gl:GL_TEXTURE_SWIZZLE_A
+ALIAS: GL_TEXTURE_SWIZZLE_RGBA gl:GL_TEXTURE_SWIZZLE_RGBA
+ALIAS: GL_TIME_ELAPSED gl:GL_TIME_ELAPSED
+ALIAS: GL_TIMESTAMP gl:GL_TIMESTAMP
+ALIAS: GL_INT_2_10_10_10_REV gl:GL_INT_2_10_10_10_REV
+ALIAS: GL_DRAW_INDIRECT_BUFFER gl:GL_DRAW_INDIRECT_BUFFER
+ALIAS: GL_DRAW_INDIRECT_BUFFER_BINDING gl:GL_DRAW_INDIRECT_BUFFER_BINDING
+ALIAS: GL_GEOMETRY_SHADER_INVOCATIONS gl:GL_GEOMETRY_SHADER_INVOCATIONS
+ALIAS: GL_MAX_GEOMETRY_SHADER_INVOCATIONS gl:GL_MAX_GEOMETRY_SHADER_INVOCATIONS
+ALIAS: GL_MIN_FRAGMENT_INTERPOLATION_OFFSET gl:GL_MIN_FRAGMENT_INTERPOLATION_OFFSET
+ALIAS: GL_MAX_FRAGMENT_INTERPOLATION_OFFSET gl:GL_MAX_FRAGMENT_INTERPOLATION_OFFSET
+ALIAS: GL_FRAGMENT_INTERPOLATION_OFFSET_BITS gl:GL_FRAGMENT_INTERPOLATION_OFFSET_BITS
+ALIAS: GL_MAX_VERTEX_STREAMS gl:GL_MAX_VERTEX_STREAMS
+ALIAS: GL_DOUBLE_VEC2 gl:GL_DOUBLE_VEC2
+ALIAS: GL_DOUBLE_VEC3 gl:GL_DOUBLE_VEC3
+ALIAS: GL_DOUBLE_VEC4 gl:GL_DOUBLE_VEC4
+ALIAS: GL_DOUBLE_MAT2 gl:GL_DOUBLE_MAT2
+ALIAS: GL_DOUBLE_MAT3 gl:GL_DOUBLE_MAT3
+ALIAS: GL_DOUBLE_MAT4 gl:GL_DOUBLE_MAT4
+ALIAS: GL_DOUBLE_MAT2x3 gl:GL_DOUBLE_MAT2x3
+ALIAS: GL_DOUBLE_MAT2x4 gl:GL_DOUBLE_MAT2x4
+ALIAS: GL_DOUBLE_MAT3x2 gl:GL_DOUBLE_MAT3x2
+ALIAS: GL_DOUBLE_MAT3x4 gl:GL_DOUBLE_MAT3x4
+ALIAS: GL_DOUBLE_MAT4x2 gl:GL_DOUBLE_MAT4x2
+ALIAS: GL_DOUBLE_MAT4x3 gl:GL_DOUBLE_MAT4x3
+ALIAS: GL_ACTIVE_SUBROUTINES gl:GL_ACTIVE_SUBROUTINES
+ALIAS: GL_ACTIVE_SUBROUTINE_UNIFORMS gl:GL_ACTIVE_SUBROUTINE_UNIFORMS
+ALIAS: GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS gl:GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS
+ALIAS: GL_ACTIVE_SUBROUTINE_MAX_LENGTH gl:GL_ACTIVE_SUBROUTINE_MAX_LENGTH
+ALIAS: GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH gl:GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH
+ALIAS: GL_MAX_SUBROUTINES gl:GL_MAX_SUBROUTINES
+ALIAS: GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS gl:GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS
+ALIAS: GL_NUM_COMPATIBLE_SUBROUTINES gl:GL_NUM_COMPATIBLE_SUBROUTINES
+ALIAS: GL_COMPATIBLE_SUBROUTINES gl:GL_COMPATIBLE_SUBROUTINES
+ALIAS: GL_PATCHES gl:GL_PATCHES
+ALIAS: GL_PATCH_VERTICES gl:GL_PATCH_VERTICES
+ALIAS: GL_PATCH_DEFAULT_INNER_LEVEL gl:GL_PATCH_DEFAULT_INNER_LEVEL
+ALIAS: GL_PATCH_DEFAULT_OUTER_LEVEL gl:GL_PATCH_DEFAULT_OUTER_LEVEL
+ALIAS: GL_TESS_CONTROL_OUTPUT_VERTICES gl:GL_TESS_CONTROL_OUTPUT_VERTICES
+ALIAS: GL_TESS_GEN_MODE gl:GL_TESS_GEN_MODE
+ALIAS: GL_TESS_GEN_SPACING gl:GL_TESS_GEN_SPACING
+ALIAS: GL_TESS_GEN_VERTEX_ORDER gl:GL_TESS_GEN_VERTEX_ORDER
+ALIAS: GL_TESS_GEN_POINT_MODE gl:GL_TESS_GEN_POINT_MODE
+ALIAS: GL_ISOLINES gl:GL_ISOLINES
+ALIAS: GL_FRACTIONAL_ODD gl:GL_FRACTIONAL_ODD
+ALIAS: GL_FRACTIONAL_EVEN gl:GL_FRACTIONAL_EVEN
+ALIAS: GL_MAX_PATCH_VERTICES gl:GL_MAX_PATCH_VERTICES
+ALIAS: GL_MAX_TESS_GEN_LEVEL gl:GL_MAX_TESS_GEN_LEVEL
+ALIAS: GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS gl:GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS
+ALIAS: GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS gl:GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS
+ALIAS: GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS gl:GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS
+ALIAS: GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS gl:GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS
+ALIAS: GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS gl:GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS
+ALIAS: GL_MAX_TESS_PATCH_COMPONENTS gl:GL_MAX_TESS_PATCH_COMPONENTS
+ALIAS: GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS gl:GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS
+ALIAS: GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS gl:GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS
+ALIAS: GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS gl:GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS
+ALIAS: GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS gl:GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS
+ALIAS: GL_MAX_TESS_CONTROL_INPUT_COMPONENTS gl:GL_MAX_TESS_CONTROL_INPUT_COMPONENTS
+ALIAS: GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS gl:GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS
+ALIAS: GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS gl:GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS
+ALIAS: GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS gl:GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS
+ALIAS: GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER gl:GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER
+ALIAS: GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER gl:GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER
+ALIAS: GL_TESS_EVALUATION_SHADER gl:GL_TESS_EVALUATION_SHADER
+ALIAS: GL_TESS_CONTROL_SHADER gl:GL_TESS_CONTROL_SHADER
+ALIAS: GL_TRANSFORM_FEEDBACK gl:GL_TRANSFORM_FEEDBACK
+ALIAS: GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED gl:GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED
+ALIAS: GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE gl:GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE
+ALIAS: GL_TRANSFORM_FEEDBACK_BINDING gl:GL_TRANSFORM_FEEDBACK_BINDING
+ALIAS: GL_MAX_TRANSFORM_FEEDBACK_BUFFERS gl:GL_MAX_TRANSFORM_FEEDBACK_BUFFERS
 
 ALIAS: glCullFace gl:glCullFace
 ALIAS: glFrontFace gl:glFrontFace
@@ -1005,3 +1152,101 @@ ALIAS: glGetActiveUniformBlockiv gl:glGetActiveUniformBlockiv
 ALIAS: glGetActiveUniformBlockName gl:glGetActiveUniformBlockName
 ALIAS: glUniformBlockBinding gl:glUniformBlockBinding
 ALIAS: glCopyBufferSubData gl:glCopyBufferSubData
+ALIAS: glFramebufferTexture gl:glFramebufferTexture
+ALIAS: glGetBufferParameteri64v gl:glGetBufferParameteri64v
+ALIAS: glGetInteger64i_v gl:glGetInteger64i_v
+ALIAS: glProvokingVertex gl:glProvokingVertex
+ALIAS: glFenceSync gl:glFenceSync
+ALIAS: glIsSync gl:glIsSync
+ALIAS: glDeleteSync gl:glDeleteSync
+ALIAS: glClientWaitSync gl:glClientWaitSync
+ALIAS: glWaitSync gl:glWaitSync
+ALIAS: glGetInteger64v gl:glGetInteger64v
+ALIAS: glGetSynciv gl:glGetSynciv
+ALIAS: glTexImage2DMultisample gl:glTexImage2DMultisample
+ALIAS: glTexImage3DMultisample gl:glTexImage3DMultisample
+ALIAS: glGetMultisamplefv gl:glGetMultisamplefv
+ALIAS: glSampleMaski gl:glSampleMaski
+ALIAS: glBindFragDataLocationIndexed gl:glBindFragDataLocationIndexed
+ALIAS: glGetFragDataIndex gl:glGetFragDataIndex
+ALIAS: glGenSamplers gl:glGenSamplers
+ALIAS: glDeleteSamplers gl:glDeleteSamplers
+ALIAS: glIsSampler gl:glIsSampler
+ALIAS: glBindSampler gl:glBindSampler
+ALIAS: glSamplerParameteri gl:glSamplerParameteri
+ALIAS: glSamplerParameteriv gl:glSamplerParameteriv
+ALIAS: glSamplerParameterf gl:glSamplerParameterf
+ALIAS: glSamplerParameterfv gl:glSamplerParameterfv
+ALIAS: glSamplerParameterIiv gl:glSamplerParameterIiv
+ALIAS: glSamplerParameterIuiv gl:glSamplerParameterIuiv
+ALIAS: glGetSamplerParameteriv gl:glGetSamplerParameteriv
+ALIAS: glGetSamplerParameterIiv gl:glGetSamplerParameterIiv
+ALIAS: glGetSamplerParameterfv gl:glGetSamplerParameterfv
+ALIAS: glGetSamplerParameterIfv gl:glGetSamplerParameterIfv
+ALIAS: glQueryCounter gl:glQueryCounter
+ALIAS: glGetQueryObjecti64v gl:glGetQueryObjecti64v
+ALIAS: glGetQueryObjectui64v gl:glGetQueryObjectui64v
+ALIAS: glVertexAttribP1ui gl:glVertexAttribP1ui
+ALIAS: glVertexAttribP1uiv gl:glVertexAttribP1uiv
+ALIAS: glVertexAttribP2ui gl:glVertexAttribP2ui
+ALIAS: glVertexAttribP2uiv gl:glVertexAttribP2uiv
+ALIAS: glVertexAttribP3ui gl:glVertexAttribP3ui
+ALIAS: glVertexAttribP3uiv gl:glVertexAttribP3uiv
+ALIAS: glVertexAttribP4ui gl:glVertexAttribP4ui
+ALIAS: glVertexAttribP4uiv gl:glVertexAttribP4uiv
+ALIAS: glUniform1d gl:glUniform1d
+ALIAS: glUniform2d gl:glUniform2d
+ALIAS: glUniform3d gl:glUniform3d
+ALIAS: glUniform4d gl:glUniform4d
+ALIAS: glUniform1dv gl:glUniform1dv
+ALIAS: glUniform2dv gl:glUniform2dv
+ALIAS: glUniform3dv gl:glUniform3dv
+ALIAS: glUniform4dv gl:glUniform4dv
+ALIAS: glUniformMatrix2dv gl:glUniformMatrix2dv
+ALIAS: glUniformMatrix3dv gl:glUniformMatrix3dv
+ALIAS: glUniformMatrix4dv gl:glUniformMatrix4dv
+ALIAS: glUniformMatrix2x3dv gl:glUniformMatrix2x3dv
+ALIAS: glUniformMatrix2x4dv gl:glUniformMatrix2x4dv
+ALIAS: glUniformMatrix3x2dv gl:glUniformMatrix3x2dv
+ALIAS: glUniformMatrix3x4dv gl:glUniformMatrix3x4dv
+ALIAS: glUniformMatrix4x2dv gl:glUniformMatrix4x2dv
+ALIAS: glUniformMatrix4x3dv gl:glUniformMatrix4x3dv
+ALIAS: glGetUniformdv gl:glGetUniformdv
+ALIAS: glProgramUniform1dEXT gl:glProgramUniform1dEXT
+ALIAS: glProgramUniform2dEXT gl:glProgramUniform2dEXT
+ALIAS: glProgramUniform3dEXT gl:glProgramUniform3dEXT
+ALIAS: glProgramUniform4dEXT gl:glProgramUniform4dEXT
+ALIAS: glProgramUniform1dvEXT gl:glProgramUniform1dvEXT
+ALIAS: glProgramUniform2dvEXT gl:glProgramUniform2dvEXT
+ALIAS: glProgramUniform3dvEXT gl:glProgramUniform3dvEXT
+ALIAS: glProgramUniform4dvEXT gl:glProgramUniform4dvEXT
+ALIAS: glProgramUniformMatrix2dvEXT gl:glProgramUniformMatrix2dvEXT
+ALIAS: glProgramUniformMatrix3dvEXT gl:glProgramUniformMatrix3dvEXT
+ALIAS: glProgramUniformMatrix4dvEXT gl:glProgramUniformMatrix4dvEXT
+ALIAS: glProgramUniformMatrix2x3dvEXT gl:glProgramUniformMatrix2x3dvEXT
+ALIAS: glProgramUniformMatrix2x4dvEXT gl:glProgramUniformMatrix2x4dvEXT
+ALIAS: glProgramUniformMatrix3x2dvEXT gl:glProgramUniformMatrix3x2dvEXT
+ALIAS: glProgramUniformMatrix3x4dvEXT gl:glProgramUniformMatrix3x4dvEXT
+ALIAS: glProgramUniformMatrix4x2dvEXT gl:glProgramUniformMatrix4x2dvEXT
+ALIAS: glProgramUniformMatrix4x3dvEXT gl:glProgramUniformMatrix4x3dvEXT
+ALIAS: glGetSubroutineUniformLocation gl:glGetSubroutineUniformLocation
+ALIAS: glGetSubroutineIndex gl:glGetSubroutineIndex
+ALIAS: glGetActiveSubroutineUniformiv gl:glGetActiveSubroutineUniformiv
+ALIAS: glGetActiveSubroutineUniformName gl:glGetActiveSubroutineUniformName
+ALIAS: glGetActiveSubroutineName gl:glGetActiveSubroutineName
+ALIAS: glUniformSubroutinesuiv gl:glUniformSubroutinesuiv
+ALIAS: glGetUniformSubroutineuiv gl:glGetUniformSubroutineuiv
+ALIAS: glGetProgramStageiv gl:glGetProgramStageiv
+ALIAS: glPatchParameteri gl:glPatchParameteri
+ALIAS: glPatchParameterfv gl:glPatchParameterfv
+ALIAS: glBindTransformFeedback gl:glBindTransformFeedback
+ALIAS: glDeleteTransformFeedbacks gl:glDeleteTransformFeedbacks
+ALIAS: glGenTransformFeedbacks gl:glGenTransformFeedbacks
+ALIAS: glIsTransformFeedback gl:glIsTransformFeedback
+ALIAS: glPauseTransformFeedback gl:glPauseTransformFeedback
+ALIAS: glResumeTransformFeedback gl:glResumeTransformFeedback
+ALIAS: glDrawTransformFeedback gl:glDrawTransformFeedback
+ALIAS: glDrawTransformFeedbackStream gl:glDrawTransformFeedbackStream
+ALIAS: glBeginQueryIndexed gl:glBeginQueryIndexed
+ALIAS: glEndQueryIndexed gl:glEndQueryIndexed
+ALIAS: glGetQueryIndexediv gl:glGetQueryIndexediv
index 1f6205e64fda4575661a31fa8b12096593611d24..893a8dfbd69f2cfd3ba580f9fa1464d0ecf33585 100644 (file)
@@ -2,12 +2,12 @@
 ! Portions copyright (C) 2007 Eduardo Cavazos.
 ! Portions copyright (C) 2008 Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types ascii calendar combinators.short-circuit
-continuations kernel libc math macros namespaces math.vectors
-math.parser opengl.gl combinators combinators.smart arrays
-sequences splitting words byte-arrays assocs vocabs
-colors colors.constants accessors generalizations locals fry
-specialized-arrays ;
+USING: alien alien.c-types alien.data ascii calendar
+combinators.short-circuit continuations kernel libc math macros
+namespaces math.vectors math.parser opengl.gl combinators
+combinators.smart arrays sequences splitting words byte-arrays
+assocs vocabs colors colors.constants accessors generalizations
+sequences.generalizations locals fry specialized-arrays ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: float
 SPECIALIZED-ARRAY: uint
@@ -139,7 +139,7 @@ MACRO: all-enabled-client-state ( seq quot -- )
     swap glPushAttrib call glPopAttrib ; inline
 
 : (gen-gl-object) ( quot -- id )
-    [ 1 0 <uint> ] dip keep *uint ; inline
+    [ 1 { uint } ] dip [ ] with-out-parameters ; inline
 
 : (delete-gl-object) ( id quot -- )
     [ 1 swap <uint> ] dip call ; inline
index 562cbc91cec9ef23230a55c15418f499923aebcc..4e17a016243098aea654e1a953c33fdf8f2ddf8f 100644 (file)
@@ -20,7 +20,7 @@ IN: opengl.shaders
     dup integer? [ glIsShader c-bool> ] [ drop f ] if ;
 
 : gl-shader-get-int ( shader enum -- value )
-    0 <int> [ glGetShaderiv ] keep *int ;
+    { int } [ glGetShaderiv ] [ ] with-out-parameters ;
 
 : gl-shader-ok? ( shader -- ? )
     GL_COMPILE_STATUS gl-shader-get-int c-bool> ;
@@ -79,7 +79,7 @@ PREDICATE: fragment-shader < gl-shader (fragment-shader?) ;
     dup integer? [ glIsProgram c-bool> ] [ drop f ] if ;
 
 : gl-program-get-int ( program enum -- value )
-    0 <int> [ glGetProgramiv ] keep *int ;
+    { int } [ glGetProgramiv ] [ ] with-out-parameters ;
 
 : gl-program-ok? ( program -- ? )
     GL_LINK_STATUS gl-program-get-int c-bool> ;
index e53383c98bf9899215e6eebf58e0dcdd449825eb..dacea0888a277fb484d352632e9a85fe1670b8e4 100644 (file)
@@ -1,11 +1,11 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs cache colors.constants destructors
-kernel opengl opengl.gl opengl.capabilities combinators images
-images.tesselation grouping sequences math math.vectors
-math.matrices generalizations fry arrays namespaces system
-locals literals specialized-arrays ;
-FROM: alien.c-types => float ;
+USING: accessors alien.data assocs cache colors.constants
+destructors kernel opengl opengl.gl opengl.capabilities
+combinators images images.tesselation grouping sequences math
+math.vectors generalizations fry arrays namespaces system locals
+literals specialized-arrays ;
+FROM: alien.c-types => int float ;
 SPECIALIZED-ARRAY: float
 IN: opengl.textures
 
@@ -354,7 +354,7 @@ TUPLE: multi-texture < disposable grid display-list loc ;
 : image-locs ( image-grid -- loc-grid )
     [ first [ dim>> first ] map ] [ [ first dim>> second ] map ] bi
     [ 0 [ + ] accumulate nip ] bi@
-    cross-zip flip ;
+    cartesian-product flip ;
 
 : <texture-grid> ( image-grid loc -- grid )
     [ dup image-locs ] dip
@@ -404,3 +404,9 @@ PRIVATE>
     over dim>> max-texture-size [ <= ] 2all?
     [ <single-texture> ]
     [ [ max-texture-size tesselate ] dip <multi-texture> ] if ;
+
+: get-texture-float ( target level enum -- value )
+    { float } [ glGetTexLevelParameterfv ] [ ] with-out-parameters ; inline
+
+: get-texture-int ( target level enum -- value )
+    { int } [ glGetTexLevelParameteriv ] [ ] with-out-parameters ; inline
index dbc5b9e43cdf08c839c18cf7f4dcbffa62df952c..fb39a8e51bef955c6c4fa5666914ac3bea53f078 100644 (file)
@@ -14,9 +14,9 @@ IN: openssl.libcrypto
 {
     { [ os openbsd? ] [ ] } ! VM is linked with it
     { [ os netbsd? ] [ ] }
-    { [ os winnt? ] [ "libcrypto" "libeay32.dll" "cdecl" add-library ] }
-    { [ os macosx? ] [ "libcrypto" "libcrypto.dylib" "cdecl" add-library ] }
-    { [ os unix? ] [ "libcrypto" "libcrypto.so" "cdecl" add-library ] }
+    { [ os winnt? ] [ "libcrypto" "libeay32.dll" cdecl add-library ] }
+    { [ os macosx? ] [ "libcrypto" "libcrypto.dylib" cdecl add-library ] }
+    { [ os unix? ] [ "libcrypto" "libcrypto.so" cdecl add-library ] }
 } cond
 >>
 
@@ -65,9 +65,9 @@ LIBRARY: libcrypto
 ! bio.h
 ! ===============================================
 
-FUNCTION: bio* BIO_new_file ( char* filename, char* mode ) ;
+FUNCTION: bio* BIO_new_file ( c-string filename, c-string mode ) ;
 
-FUNCTION: int BIO_printf ( bio* bio, char* format ) ;
+FUNCTION: int BIO_printf ( bio* bio, c-string format ) ;
 
 FUNCTION: long BIO_ctrl ( void* bio, int cmd, long larg, void* parg ) ;
 
@@ -83,17 +83,17 @@ FUNCTION: void* BIO_push ( void* bio, void* append ) ;
 
 FUNCTION: int BIO_read ( void* b, void* buf, int len ) ;
 
-FUNCTION: int BIO_gets ( void* b, char* buf, int size ) ;
+FUNCTION: int BIO_gets ( void* b, c-string buf, int size ) ;
 
 FUNCTION: int BIO_write ( void* b, void* buf, int len ) ;
 
-FUNCTION: int BIO_puts ( void* bp, char* buf ) ;
+FUNCTION: int BIO_puts ( void* bp, c-string buf ) ;
 
 FUNCTION: ulong ERR_get_error (  ) ;
 
 FUNCTION: void ERR_clear_error ( ) ;
 
-FUNCTION: char* ERR_error_string ( ulong e, void* buf ) ;
+FUNCTION: c-string ERR_error_string ( ulong e, void* buf ) ;
 
 FUNCTION: void* BIO_f_buffer (  ) ;
 
@@ -103,7 +103,7 @@ FUNCTION: void* BIO_f_buffer (  ) ;
 
 CONSTANT: EVP_MAX_MD_SIZE 64
 
-TYPEDEF: void* EVP_MD*
+C-TYPE: EVP_MD
 C-TYPE: ENGINE
 
 STRUCT: EVP_MD_CTX
@@ -120,7 +120,7 @@ FUNCTION: void OpenSSL_add_all_digests (  ) ;
 ! Clean them up before exiting
 FUNCTION: void EVP_cleanup (  ) ;
 
-FUNCTION: EVP_MD* EVP_get_digestbyname ( char* name ) ;
+FUNCTION: EVP_MD* EVP_get_digestbyname ( c-string name ) ;
 
 FUNCTION: void EVP_MD_CTX_init ( EVP_MD* ctx ) ;
 
@@ -166,7 +166,7 @@ FUNCTION: int RSA_print_fp ( void* fp, void* x, int offset ) ;
 ! objects.h
 ! ===============================================
 
-FUNCTION: int OBJ_sn2nid ( char* s ) ;
+FUNCTION: int OBJ_sn2nid ( c-string s ) ;
 
 ! ===============================================
 ! bn.h
index 225d4b3da1b580fbb8a15301215ea0636babf5a8..272b1bb17ebaef2819a6f255c8d03a5aecc9d174 100644 (file)
@@ -3,16 +3,16 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.syntax combinators kernel
 system namespaces assocs parser lexer sequences words
-quotations math.bitwise alien.libraries ;
+quotations math.bitwise alien.libraries literals ;
 
 IN: openssl.libssl
 
 << {
     { [ os openbsd? ] [ ] } ! VM is linked with it
     { [ os netbsd? ] [ ] }
-    { [ os winnt? ] [ "libssl" "ssleay32.dll" "cdecl" add-library ] }
-    { [ os macosx? ] [ "libssl" "libssl.dylib" "cdecl" add-library ] }
-    { [ os unix? ] [ "libssl" "libssl.so" "cdecl" add-library ] }
+    { [ os winnt? ] [ "libssl" "ssleay32.dll" cdecl add-library ] }
+    { [ os macosx? ] [ "libssl" "libssl.dylib" cdecl add-library ] }
+    { [ os unix? ] [ "libssl" "libssl.so" cdecl add-library ] }
 } cond >>
 
 CONSTANT: X509_FILETYPE_PEM       1
@@ -89,8 +89,8 @@ CONSTANT: SSL_ERROR_WANT_ACCEPT      8
     } ;
 
 TYPEDEF: void* ssl-method
-TYPEDEF: void* SSL_CTX*
-TYPEDEF: void* SSL_SESSION*
+C-TYPE: SSL_CTX
+C-TYPE: SSL_SESSION
 C-TYPE: SSL
 
 LIBRARY: libssl
@@ -99,8 +99,7 @@ LIBRARY: libssl
 ! x509.h
 ! ===============================================
 
-TYPEDEF: void* X509_NAME*
-
+C-TYPE: X509_NAME
 C-TYPE: X509
 
 FUNCTION: int X509_NAME_get_text_by_NID ( X509_NAME* name, int nid, void* buf, int len ) ;
@@ -110,7 +109,7 @@ FUNCTION: X509_NAME* X509_get_subject_name ( X509* a ) ;
 ! ssl.h
 ! ===============================================
 
-FUNCTION: char* SSL_get_version ( SSL* ssl ) ;
+FUNCTION: c-string SSL_get_version ( SSL* ssl ) ;
 
 ! Maps OpenSSL errors to strings
 FUNCTION: void SSL_load_error_strings (  ) ;
@@ -144,7 +143,7 @@ FUNCTION: SSL_CTX* SSL_CTX_new ( ssl-method method ) ;
 
 ! Load the certificates and private keys into the SSL_CTX
 FUNCTION: int SSL_CTX_use_certificate_chain_file ( SSL_CTX* ctx,
-                                                   char* file ) ; ! PEM type
+                                                   c-string file ) ; ! PEM type
 
 FUNCTION: SSL* SSL_new ( SSL_CTX* ctx ) ;
 
@@ -175,7 +174,7 @@ CONSTANT: SSL_RECEIVED_SHUTDOWN 2
 
 FUNCTION: int SSL_get_shutdown ( SSL* ssl ) ;
 
-FUNCTION: int SSL_CTX_set_session_id_context ( SSL_CTX* ctx, char* sid_ctx, uint len ) ;
+FUNCTION: int SSL_CTX_set_session_id_context ( SSL_CTX* ctx, c-string sid_ctx, uint len ) ;
 
 FUNCTION: SSL_SESSION* SSL_get1_session ( SSL* ssl ) ;
 
@@ -198,17 +197,17 @@ FUNCTION: void SSL_CTX_free ( SSL_CTX* ctx ) ;
 
 FUNCTION: void RAND_seed ( void* buf, int num ) ;
 
-FUNCTION: int SSL_set_cipher_list ( SSL* ssl, char* str ) ;
+FUNCTION: int SSL_set_cipher_list ( SSL* ssl, c-string str ) ;
 
-FUNCTION: int SSL_use_RSAPrivateKey_file ( SSL* ssl, char* str ) ;
+FUNCTION: int SSL_use_RSAPrivateKey_file ( SSL* ssl, c-string str ) ;
 
 FUNCTION: int SSL_CTX_use_RSAPrivateKey_file ( SSL_CTX* ctx, int type ) ;
 
 FUNCTION: int SSL_use_certificate_file ( SSL* ssl,
-                                         char* str, int type ) ;
+                                         c-string str, int type ) ;
 
-FUNCTION: int SSL_CTX_load_verify_locations ( SSL_CTX* ctx, char* CAfile,
-                                              char* CApath ) ;
+FUNCTION: int SSL_CTX_load_verify_locations ( SSL_CTX* ctx, c-string CAfile,
+                                              c-string CApath ) ;
 
 FUNCTION: int SSL_CTX_set_default_verify_paths ( SSL_CTX* ctx ) ;
 
@@ -221,7 +220,7 @@ FUNCTION: void SSL_CTX_set_verify ( SSL_CTX* ctx, int mode, void* callback ) ;
 
 FUNCTION: void SSL_CTX_set_client_CA_list ( SSL_CTX* ctx, SSL* list ) ;
 
-FUNCTION: SSL* SSL_load_client_CA_file ( char* file ) ;
+FUNCTION: SSL* SSL_load_client_CA_file ( c-string file ) ;
 
 ! Used to manipulate settings of the SSL_CTX and SSL objects.
 ! This function should never be called directly
@@ -232,7 +231,7 @@ FUNCTION: void SSL_CTX_set_default_passwd_cb ( SSL_CTX* ctx, void* cb ) ;
 FUNCTION: void SSL_CTX_set_default_passwd_cb_userdata ( SSL_CTX* ctx,
                                                         void* u ) ;
 
-FUNCTION: int SSL_CTX_use_PrivateKey_file ( SSL_CTX* ctx, char* file,
+FUNCTION: int SSL_CTX_use_PrivateKey_file ( SSL_CTX* ctx, c-string file,
                                             int type ) ;
 
 ! Sets the maximum depth for the allowed ctx certificate chain verification
@@ -259,15 +258,14 @@ CONSTANT: SSL_SESS_CACHE_OFF    HEX: 0000
 CONSTANT: SSL_SESS_CACHE_CLIENT HEX: 0001
 CONSTANT: SSL_SESS_CACHE_SERVER HEX: 0002
 
-: SSL_SESS_CACHE_BOTH ( -- n )
-    { SSL_SESS_CACHE_CLIENT SSL_SESS_CACHE_SERVER } flags ; inline
+CONSTANT: SSL_SESS_CACHE_BOTH flags{ SSL_SESS_CACHE_CLIENT SSL_SESS_CACHE_SERVER }
 
 CONSTANT: SSL_SESS_CACHE_NO_AUTO_CLEAR      HEX: 0080
 CONSTANT: SSL_SESS_CACHE_NO_INTERNAL_LOOKUP HEX: 0100
 CONSTANT: SSL_SESS_CACHE_NO_INTERNAL_STORE  HEX: 0200
 
-: SSL_SESS_CACHE_NO_INTERNAL ( -- n )
-    { SSL_SESS_CACHE_NO_INTERNAL_LOOKUP SSL_SESS_CACHE_NO_INTERNAL_STORE } flags ; inline
+CONSTANT: SSL_SESS_CACHE_NO_INTERNAL
+    flags{ SSL_SESS_CACHE_NO_INTERNAL_LOOKUP SSL_SESS_CACHE_NO_INTERNAL_STORE }
 
 ! ===============================================
 ! x509_vfy.h
index d6baaffe2e77da6557751c3b40d320e5ff6819e1..68a9f2f6df70b0d11ef5679deb79793bfc961733 100644 (file)
@@ -3,17 +3,18 @@
 ! See http://factorcode.org/license.txt for BSD license.
 !
 ! pangocairo bindings, from pango/pangocairo.h
-USING: arrays sequences alien alien.c-types alien.destructors
-alien.libraries alien.syntax math math.functions math.vectors
-destructors combinators colors fonts accessors assocs namespaces
-kernel pango pango.fonts pango.layouts glib unicode.data images
-cache init system math.rectangles fry memoize io.encodings.utf8
-classes.struct cairo cairo.ffi ;
+USING: arrays sequences alien alien.c-types alien.data
+alien.destructors alien.libraries alien.syntax math
+math.functions math.vectors destructors combinators colors fonts
+accessors assocs namespaces kernel pango pango.fonts
+pango.layouts glib unicode.data images cache init system
+math.rectangles fry memoize io.encodings.utf8 classes.struct
+cairo cairo.ffi ;
 IN: pango.cairo
 
 << {
-    { [ os winnt? ] [ "pangocairo" "libpangocairo-1.0-0.dll" "cdecl" add-library ] }
-    { [ os macosx? ] [ "pangocairo" "/opt/local/lib/libpangocairo-1.0.0.dylib" "cdecl" add-library ] }
+    { [ os winnt? ] [ "pangocairo" "libpangocairo-1.0-0.dll" cdecl add-library ] }
+    { [ os macosx? ] [ "pangocairo" "/opt/local/lib/libpangocairo-1.0.0.dylib" cdecl add-library ] }
     { [ os unix? ] [ ] }
 } cond >>
 
@@ -136,16 +137,17 @@ SYMBOL: dpi
 : line-offset>x ( layout n -- x )
     #! n is an index into the UTF8 encoding of the text
     [ drop first-line ] [ swap string>> >utf8-index ] 2bi
-    0 0 <int> [ pango_layout_line_index_to_x ] keep
-    *int pango>float ;
+    0 { int } [ pango_layout_line_index_to_x ] [ ] with-out-parameters
+    pango>float ;
 
 : x>line-offset ( layout x -- n )
     #! n is an index into the UTF8 encoding of the text
     [
         [ first-line ] dip
-        float>pango 0 <int> 0 <int>
-        [ pango_layout_line_x_to_index drop ] 2keep
-        [ *int ] bi@ swap
+        float>pango
+        { int int }
+        [ pango_layout_line_x_to_index drop ] [ ] with-out-parameters
+        swap
     ] [ drop string>> ] 2bi utf8-index> + ;
 
 : selection-start/end ( selection -- start end )
index 31a51e3f128013f8f6bac3a2bb2eb57c493464ba..979e40947c5f4d79729d88f3f4c68520fcc5c6cd 100644 (file)
@@ -8,8 +8,7 @@ IN: pango.fonts
 
 LIBRARY: pango
 
-TYPEDEF: int PangoStyle
-C-ENUM:
+ENUM: PangoStyle
 PANGO_STYLE_NORMAL
 PANGO_STYLE_OBLIQUE
 PANGO_STYLE_ITALIC ;
@@ -45,16 +44,16 @@ pango_font_description_free ( PangoFontDescription* desc ) ;
 DESTRUCTOR: pango_font_description_free
 
 FUNCTION: PangoFontDescription*
-pango_font_description_from_string ( char* str ) ;
+pango_font_description_from_string ( c-string str ) ;
 
-FUNCTION: char*
+FUNCTION: c-string
 pango_font_description_to_string ( PangoFontDescription* desc ) ;
 
-FUNCTION: char*
+FUNCTION: c-string
 pango_font_description_to_filename ( PangoFontDescription* desc ) ;
 
 FUNCTION: void
-pango_font_description_set_family ( PangoFontDescription* desc, char* family ) ;
+pango_font_description_set_family ( PangoFontDescription* desc, c-string family ) ;
 
 FUNCTION: void
 pango_font_description_set_style ( PangoFontDescription* desc, PangoStyle style ) ;
@@ -68,7 +67,7 @@ pango_font_description_set_size ( PangoFontDescription* desc, gint size ) ;
 FUNCTION: void
 pango_font_map_list_families ( PangoFontMap* fontmap, PangoFontFamily*** families, int* n_families ) ;
 
-FUNCTION: char*
+FUNCTION: c-string
 pango_font_family_get_name ( PangoFontFamily* family ) ;
 
 FUNCTION: int
@@ -77,7 +76,7 @@ pango_font_family_is_monospace ( PangoFontFamily* family ) ;
 FUNCTION: void
 pango_font_family_list_faces ( PangoFontFamily* family, PangoFontFace*** faces, int* n_faces ) ;
 
-FUNCTION: char*
+FUNCTION: c-string
 pango_font_face_get_face_name ( PangoFontFace* face ) ;
 
 FUNCTION: void
index 74b6d0b0c3934d84fbc145a1750a4f4933e98c8d..3f3b02c7c78df3be2ddc33f2a170dcc288754867 100644 (file)
@@ -21,9 +21,9 @@ FUNCTION: PangoContext*
 pango_layout_get_context ( PangoLayout* layout ) ;
 
 FUNCTION: void
-pango_layout_set_text ( PangoLayout* layout, char* text, int length ) ;
+pango_layout_set_text ( PangoLayout* layout, c-string text, int length ) ;
 
-FUNCTION: char*
+FUNCTION: c-string
 pango_layout_get_text ( PangoLayout* layout ) ;
 
 FUNCTION: void
index 6dc48e39fe261e4c682ac6fcf5de1998393a7e68..3a249c664c6a99be83cfe5f6d45e227bf997ac70 100644 (file)
@@ -11,8 +11,8 @@ IN: pango
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 << {
-    { [ os winnt? ] [ "pango" "libpango-1.0-0.dll" "cdecl" add-library ] }
-    { [ os macosx? ] [ "pango" "/opt/local/lib/libpango-1.0.0.dylib" "cdecl" add-library ] }
+    { [ os winnt? ] [ "pango" "libpango-1.0-0.dll" cdecl add-library ] }
+    { [ os macosx? ] [ "pango" "/opt/local/lib/libpango-1.0.0.dylib" cdecl add-library ] }
     { [ os unix? ] [ ] }
 } cond >>
 
index aba92899da7f8a4c178b5b56cf672a588bf5ee59..897746a9c963d7c8c66d9753100345cdf273e231 100644 (file)
@@ -528,3 +528,17 @@ Tok                = Spaces (Number | Special )
 ] [
     error>> [ redefined-rule? ] [ name>> "lol" = ] bi and
 ] must-fail-with
+
+[
+    { "a" "a" }
+] [
+    EBNF: foo   Bar = "a":a1 "a":a2 => [[ a1 a2 2array ]] ;EBNF
+    "aa" foo
+] unit-test
+
+[
+    { "a" "a" }
+] [
+    EBNF: foo2   Bar = "a":a-1 "a":a-2 => [[ a-1 a-2 2array ]] ;EBNF
+    "aa" foo2
+] unit-test
index ffc4cb91ad78aa462b4abbf529ac615225179e80..b682f582add9e8420bd959a2a7b72a23aea1b913 100644 (file)
@@ -230,7 +230,11 @@ DEFER: 'action'
 \r
 : 'element' ( -- parser )\r
   [\r
-    [ ('element') , ":" syntax , "a-zA-Z" range-pattern repeat1 [ >string ] action , ] seq* [ first2 <ebnf-var> ] action ,\r
+    [\r
+      ('element') , ":" syntax ,\r
+      "a-zA-Z_" range-pattern\r
+      "a-zA-Z0-9_-" range-pattern repeat1 2seq [ first2 swap prefix >string ] action ,\r
+    ] seq* [ first2 <ebnf-var> ] action ,\r
     ('element') ,\r
   ] choice* ;\r
 \r
index d4397627e809d216665762b075b8360e0d837d33..e0c5350ed1e470bff7e8f2e38c5b98694bf239f8 100644 (file)
@@ -1,10 +1,11 @@
 ! Copyright (C) 2007, 2008 Chris Double.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel sequences strings fry namespaces make math assocs
-io vectors arrays math.parser math.order combinators
-classes sets unicode.categories compiler.units parser words
-quotations memoize accessors locals splitting
+io vectors arrays math.parser math.order combinators classes
+sets unicode.categories compiler.units parser effects.parser
+words quotations memoize accessors locals splitting
 combinators.short-circuit generalizations ;
+FROM: namespaces => set ;
 IN: peg
 
 TUPLE: parse-result remaining ast ;
@@ -159,7 +160,7 @@ TUPLE: peg-head rule-id involved-set eval-set ;
   s [ 
     s left-recursion? [ s throw ] unless
     s head>> l head>> eq? [
-      l head>> s (>>head)
+      l head>> s head<<
       l head>> [ s rule-id>> suffix ] change-involved-set drop
       l s next>> (setup-lr)
     ] unless 
@@ -167,14 +168,14 @@ TUPLE: peg-head rule-id involved-set eval-set ;
 
 :: setup-lr ( r l -- )
   l head>> [
-    r rule-id V{ } clone V{ } clone peg-head boa l (>>head)
+    r rule-id V{ } clone V{ } clone peg-head boa l head<<
   ] unless
   l lrstack get (setup-lr) ;
 
 :: lr-answer ( r p m -- ast )
     m ans>> head>> :> h
     h rule-id>> r rule-id eq? [
-      m ans>> seed>> m (>>ans)
+      m ans>> seed>> m ans<<
       m ans>> failed? [
         fail
       ] [
@@ -209,14 +210,14 @@ TUPLE: peg-head rule-id involved-set eval-set ;
     lr lrstack set lr p memo-entry boa dup p r rule-id set-memo :> m
     r eval-rule :> ans
     lrstack get next>> lrstack set
-    pos get m (>>pos)
+    pos get m pos<<
     lr head>> [
       m ans>> left-recursion? [
-        ans lr (>>seed)
+        ans lr seed<<
         r p m lr-answer
      ] [ ans ] if 
     ] [
-      ans m (>>ans)
+      ans m ans<<
       ans
     ] if ; inline
 
@@ -386,7 +387,7 @@ TUPLE: seq-parser parsers ;
 
 : calc-seq-result ( prev-result current-result -- next-result )
   [
-    [ remaining>> swap (>>remaining) ] 2keep
+    [ remaining>> swap remaining<< ] 2keep
     ast>> dup ignore? [  
       drop
     ] [
@@ -426,7 +427,7 @@ TUPLE: repeat0-parser p1 ;
 
 : (repeat) ( quot: ( -- result ) result -- result )
   over call [
-    [ remaining>> swap (>>remaining) ] 2keep 
+    [ remaining>> swap remaining<< ] 2keep 
     ast>> swap [ ast>> push ] keep
     (repeat) 
   ] [
@@ -627,8 +628,6 @@ SYNTAX: PEG:
         ] append!
     ] ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"debugger" vocab [
-    "peg.debugger" require
-] when
+{ "debugger" "peg" } "peg.debugger" require-when
index 11d97a5118dc8b690e8fb994c138326c9ae70a93..7d0cb4057673bb8346b33c7f7819c38a9ac3649a 100644 (file)
@@ -6,7 +6,8 @@ combinators continuations effects generic hashtables io
 io.pathnames io.styles kernel make math math.order math.parser
 namespaces prettyprint.config prettyprint.custom
 prettyprint.sections prettyprint.stylesheet quotations sbufs
-sequences strings vectors words words.symbol ;
+sequences strings vectors words words.symbol hash-sets ;
+FROM: sets => members ;
 IN: prettyprint.backend
 
 M: effect pprint* effect>string "(" ")" surround text ;
@@ -187,6 +188,7 @@ M: hashtable pprint-delims drop \ H{ \ } ;
 M: tuple pprint-delims drop \ T{ \ } ;
 M: wrapper pprint-delims drop \ W{ \ } ;
 M: callstack pprint-delims drop \ CS{ \ } ;
+M: hash-set pprint-delims drop \ HS{ \ } ;
 
 M: object >pprint-sequence ;
 M: vector >pprint-sequence ;
@@ -195,6 +197,7 @@ M: callable >pprint-sequence ;
 M: hashtable >pprint-sequence >alist ;
 M: wrapper >pprint-sequence wrapped>> 1array ;
 M: callstack >pprint-sequence callstack>array ;
+M: hash-set >pprint-sequence members ;
 
 : class-slot-sequence ( class slots -- sequence )
     [ 1array ] [ [ f 2array ] dip append ] if-empty ;
@@ -226,6 +229,7 @@ M: byte-vector pprint* pprint-object ;
 M: hashtable pprint* pprint-object ;
 M: curry pprint* pprint-object ;
 M: compose pprint* pprint-object ;
+M: hash-set pprint* pprint-object ;
 
 M: wrapper pprint*
     {
index a8848f9061d4dcf2e6994dfc16bfaab547b197a7..0b2c4b888b55e31edaa874b4915ebe7936b5752e 100644 (file)
@@ -28,7 +28,7 @@ string-limit? on
         2 nesting-limit set
         string-limit? on
         boa-tuples? on
-        c-object-pointers? on
+        c-object-pointers? off
         call
     ] with-scope ; inline
 
index 23cf956a1d71afa3364c4c03b22d8bbd6a1bfefa..249a6e0a57d67c026fb496a2455b5cc784205342 100644 (file)
@@ -5,6 +5,7 @@ io.streams.string io.styles kernel make math math.parser namespaces
 parser prettyprint.backend prettyprint.config prettyprint.custom
 prettyprint.sections quotations sequences sorting strings vocabs
 vocabs.prettyprint words sets generic ;
+FROM: namespaces => set ;
 IN: prettyprint
 
 : with-use ( obj quot -- )
index 6f5f61f688ef3ae019c6524e3e4b13099ec5a462..9c23f6017d5dbd05b29b3d3db112709f909922dd 100644 (file)
@@ -4,6 +4,7 @@ USING: arrays generic hashtables io kernel math assocs
 namespaces make sequences strings io.styles vectors words
 prettyprint.config splitting classes continuations
 accessors sets vocabs.parser combinators vocabs ;
+FROM: namespaces => set ;
 IN: prettyprint.sections
 
 ! State
@@ -40,7 +41,7 @@ TUPLE: pprinter last-newline line-count indent ;
     dup pprinter get last-newline>> = [
         drop
     ] [
-        pprinter get (>>last-newline)
+        pprinter get last-newline<<
         line-limit? [
             "..." write pprinter get return
         ] when
@@ -337,8 +338,8 @@ M: block long-section ( block -- )
 
 : pprinter-manifest ( -- manifest )
     <manifest>
-    [ [ pprinter-use get keys >vector ] dip (>>search-vocabs) ]
-    [ [ pprinter-in get ] dip (>>current-vocab) ]
+    [ [ pprinter-use get keys >vector ] dip search-vocabs<< ]
+    [ [ pprinter-in get ] dip current-vocab<< ]
     [ ]
     tri ;
 
index cd9882720685a6ef6daa4ecfd798560845a71863..10d028e012afe3b4c125360f64739ab504ad0a99 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2004, 2006 Chris Double, Matthew Willis.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays effects fry generalizations kernel math
-namespaces parser sequences words ;
+namespaces parser effects.parser sequences words ;
 IN: promises
 
 TUPLE: promise quot forced? value ;
index 9341b96b11499c604310cefd207658936882ce1e..3fc4ff80eb90de72293f5e513ee9f167235362bb 100644 (file)
@@ -14,7 +14,7 @@ IN: random.tests
 [ t ] [ 10000 [ iota 0 [ drop 187 random + ] reduce ] keep / 2 * 187 10 ~ ] unit-test
 [ t ] [ 10000 [ iota 0 [ drop 400 random + ] reduce ] keep / 2 * 400 10 ~ ] unit-test
 
-[ t ] [ 1000 [ 400 random ] replicate prune length 256 > ] unit-test
+[ t ] [ 1000 [ 400 random ] replicate members length 256 > ] unit-test
 
 [ f ] [ 0 random ] unit-test
 
@@ -28,8 +28,8 @@ IN: random.tests
 
 [ { 1 2 } 3 sample ] [ too-many-samples?  ] must-fail-with
 
-[ 3 ] [ { 1 2 3 4 } 3 sample prune length ] unit-test
-[ 99 ] [ 100 iota 99 sample prune length ] unit-test
+[ 3 ] [ { 1 2 3 4 } 3 sample members length ] unit-test
+[ 99 ] [ 100 iota 99 sample members length ] unit-test
 
 [ ]
 [ [ 100 random-bytes ] with-system-random drop ] unit-test
index 04049b542d169edae412682ab7afd79b1772e7fb..ccccaac7eaf53eef675dcbd18327da8cf2f9ba6e 100644 (file)
@@ -60,8 +60,8 @@ GENERIC: generate ( sfmt -- )
 M:: sfmt generate ( sfmt -- )
     sfmt state>> :> state
     sfmt uint-4-array>> :> array
-    state n>> 2 - array nth state (>>r1)
-    state n>> 1 - array nth state (>>r2)
+    state n>> 2 - array nth state r1<<
+    state n>> 1 - array nth state r2<<
     state m>> :> m
     state n>> :> n
     state mask>> :> mask
@@ -72,8 +72,8 @@ M:: sfmt generate ( sfmt -- )
         mask state r1>> state r2>> formula :> r
 
         r i array set-nth-unsafe
-        state r2>> state (>>r1)
-        r state (>>r2)
+        state r2>> state r1<<
+        r state r2<<
     ] each
 
     ! n m - 1 + n [a,b) [
@@ -84,11 +84,11 @@ M:: sfmt generate ( sfmt -- )
         mask state r1>> state r2>> formula :> r
 
         r i array set-nth-unsafe
-        state r2>> state (>>r1)
-        r state (>>r2)
+        state r2>> state r1<<
+        r state r2<<
     ] each
 
-    0 state (>>index) ;
+    0 state index<< ;
 
 : period-certified? ( sfmt -- ? )
     [ uint-4-array>> first ]
@@ -118,7 +118,7 @@ M:: sfmt generate ( sfmt -- )
             state-multiplier * 32 bits
         ] dip + 32 bits
     ] uint-array{ } accumulate-as nip
-    dup underlying>> byte-array>uint-4-array ;
+    dup uint-4-array-cast ;
 
 : <sfmt-state> ( seed n m mask parity -- sfmt )
     sfmt-state <struct>
old mode 100644 (file)
new mode 100755 (executable)
index 30b169b..0629481
@@ -16,27 +16,25 @@ M: windows-crypto-context dispose ( tuple -- )
 
 CONSTANT: factor-crypto-container "FactorCryptoContainer"
 
-:: (acquire-crypto-context) ( provider type flags -- handle ret )
-    HCRYPTPROV <c-object> :> handle
-    handle
-    factor-crypto-container
-    provider
-    type
-    flags
-    CryptAcquireContextW handle swap ;
+:: (acquire-crypto-context) ( provider type flags -- ret handle )
+    { HCRYPTPROV } [
+        factor-crypto-container
+        provider
+        type
+        flags
+        CryptAcquireContextW
+    ] [ ] with-out-parameters ;
 
 : acquire-crypto-context ( provider type -- handle )
     CRYPT_MACHINE_KEYSET
     (acquire-crypto-context)
-    0 = [
+    swap 0 = [
         GetLastError NTE_BAD_KEYSET =
         [ drop f ] [ win32-error-string throw ] if
-    ] [
-        *void*
-    ] if ;
+    ] when ;
 
 : create-crypto-context ( provider type -- handle )
-    { CRYPT_MACHINE_KEYSET CRYPT_NEWKEYSET } flags
+    flags{ CRYPT_MACHINE_KEYSET CRYPT_NEWKEYSET }
     (acquire-crypto-context) win32-error=0/f *void* ;
 
 ERROR: acquire-crypto-context-failed provider type ;
index 668cdd65c3dcfdb025dde18c106d416786ebbff4..18b749087cc58542bc8e42b2280f004007dac2ec 100644 (file)
@@ -30,7 +30,7 @@ M: ref delete-ref ref-off ;
 TUPLE: obj-ref obj ;
 C: <obj-ref> obj-ref
 M: obj-ref get-ref obj>> ;
-M: obj-ref set-ref (>>obj) ;
+M: obj-ref set-ref obj<< ;
 INSTANCE: obj-ref ref
 
 TUPLE: var-ref var ;
index e2db86f6c1c8cd6709ae2bb0cc88777a79cfb29c..4044a059a5ab6245393e54e6b9665b643dc50898 100644 (file)
@@ -36,7 +36,7 @@ IN: regexp.classes.tests
 
 ! Making classes into nested conditionals
 
-[ V{ 1 2 3 4 } ] [ T{ and-class f { 1 T{ not-class f 2 } T{ or-class f { 3 4 } } 2 } } class>questions ] unit-test
+[ { 1 2 3 4 } ] [ T{ and-class f { 1 T{ not-class f 2 } T{ or-class f { 3 4 } } 2 } } class>questions ] unit-test
 [ { 3 } ] [ { { 3 t } } table>condition ] unit-test
 [ { T{ primitive-class } } ] [ { { 1 t } { 2 T{ primitive-class } } } table>questions ] unit-test
 [ { { 1 t } { 2 t } } ] [ { { 1 t } { 2 T{ primitive-class } } } T{ primitive-class } t assoc-answer ] unit-test
index e3e2f0bcf3fda5a0d63e7379fd5eec6de0cc2fdf..fd4c7e7e4fc16c4ea9fc55e7d39c2896acec62b5 100644 (file)
@@ -5,6 +5,7 @@ unicode.categories combinators.short-circuit sequences
 fry macros arrays assocs sets classes mirrors unicode.script
 unicode.data ;
 FROM: ascii => ascii? ;
+FROM: sets => members ;
 IN: regexp.classes
 
 SINGLETONS: dot letter-class LETTER-class Letter-class digit-class
@@ -157,7 +158,7 @@ DEFER: substitute
 TUPLE: class-partition integers not-integers simples not-simples and or other ;
 
 : partition-classes ( seq -- class-partition )
-    prune
+    members
     [ integer? ] partition
     [ not-integer? ] partition
     [ simple-class? ] partition
@@ -194,7 +195,7 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
     [ t swap remove ] change-other
     dup contradiction?
     [ drop f ]
-    [ filter-not-integers class-partition>seq prune t and-class seq>instance ] if ;
+    [ filter-not-integers class-partition>seq members t and-class seq>instance ] if ;
 
 : <and-class> ( seq -- class )
     dup and-class flatten partition-classes
@@ -225,7 +226,7 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
     [ f swap remove ] change-other
     dup tautology?
     [ drop t ]
-    [ filter-integers class-partition>seq prune f or-class seq>instance ] if ;
+    [ filter-integers class-partition>seq members f or-class seq>instance ] if ;
 
 : <or-class> ( seq -- class )
     dup or-class flatten partition-classes
@@ -329,7 +330,7 @@ M: object class>questions 1array ;
 : condition-states ( condition -- states )
     dup condition? [
         [ yes>> ] [ no>> ] bi
-        [ condition-states ] bi@ append prune
+        [ condition-states ] bi@ union
     ] [ 1array ] if ;
 
 : condition-at ( condition assoc -- new-condition )
index d8940bb829a3afc70848194901b8a795d36d8999..0682cc4f56dbdafb371b96013e8399d47050f7cf 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: regexp.classes kernel sequences regexp.negation
-quotations assocs fry math locals combinators
+quotations assocs fry math locals combinators sets
 accessors words compiler.units kernel.private strings
 sequences.private arrays namespaces unicode.breaks
 regexp.transition-tables combinators.short-circuit ;
@@ -106,7 +106,7 @@ C: <box> box
 
 : word>quot ( word dfa -- quot )
     [ transitions>> at ]
-    [ final-states>> key? ] 2bi
+    [ final-states>> in? ] 2bi
     transitions>quot ;
 
 : states>code ( words dfa -- )
index fa75232fd5c0b7472da6c765b6bca3b60a43aa8b..235ff5148f6b6603d6475b5666f29a99a8647640 100644 (file)
@@ -69,11 +69,11 @@ IN: regexp.dfa
 
 : set-final-states ( nfa dfa -- )
     [
-        [ final-states>> keys ]
+        [ final-states>> members ]
         [ transitions>> keys ] bi*
         [ intersects? ] with filter
-        unique
-    ] keep (>>final-states) ;
+        fast-set
+    ] keep final-states<< ;
 
 : initialize-dfa ( nfa -- dfa )
     <transition-table>
index 17a1d51b88e0a3e8142a99e7dc5ffa39b71f5581..7f961f4d98ffffb6efee04473bfe4fe5b851fd15 100644 (file)
@@ -34,7 +34,7 @@ IN: regexp.minimize.tests
             { 3 H{ } }
         } }
         { start-state 0 }
-        { final-states H{ { 3 3 } } }
+        { final-states HS{ 3 } }
     }
 ] [ 
     T{ transition-table
@@ -48,7 +48,7 @@ IN: regexp.minimize.tests
             { 6 H{ } }
         } }
         { start-state 0 }
-        { final-states H{ { 3 3 } { 6 6 } } }
+        { final-states HS{ 3 6 } }
     } combine-states
 ] unit-test
 
index a6eb4f00a288dbf752ccd8a1d2fd74aa9b441321..7991efb047f1df9eab29ba7ddab01a6890bae709 100644 (file)
@@ -3,6 +3,7 @@
 USING: kernel sequences regexp.transition-tables fry assocs
 accessors locals math sorting arrays sets hashtables regexp.dfa
 combinators.short-circuit regexp.classes ;
+FROM: assocs => change-at ;
 IN: regexp.minimize
 
 : table>state-numbers ( table -- assoc )
@@ -18,7 +19,7 @@ IN: regexp.minimize
     {
         [ drop <= ]
         [ transitions>> '[ _ at keys ] bi@ set= ]
-        [ final-states>> '[ _ key? ] bi@ = ]
+        [ final-states>> '[ _ in? ] bi@ = ]
     } 3&& ;
 
 :: initialize-partitions ( transition-table -- partitions )
@@ -51,7 +52,7 @@ IN: regexp.minimize
     <reversed>
     >hashtable ;
 
-:: (while-changes) ( obj quot: ( obj -- obj' ) comp: ( obj -- key ) old-key -- obj )
+:: (while-changes) ( ..a obj quot: ( ..a obj -- ..b obj' ) comp: ( ..b obj' -- ..a key ) old-key -- ..a obj )
     obj quot call :> new-obj
     new-obj comp call :> new-key
     new-key old-key =
index 41dfe7f493d390ce65f418c819a5d1e1362c7c15..f367e62ff55507ac8a3d7b7f169646b1753e7284 100644 (file)
@@ -12,7 +12,7 @@ IN: regexp.negation.tests
             { -1 H{ { t -1 } } }
         } } 
         { start-state 0 }
-        { final-states H{ { 0 0 } { -1 -1 } } }
+        { final-states HS{ 0 -1 } }
     }
 ] [
     ! R/ a/
@@ -22,6 +22,6 @@ IN: regexp.negation.tests
             { 1 H{ } } 
         } }
         { start-state 0 }
-        { final-states H{ { 1 1 } } }
+        { final-states HS{ 1 } }
     } negate-table
 ] unit-test
index 802e2115368d07b0502b230e285a51bfba6a61e4..5f627b645ec438384982eff19debe5d92a63e587 100644 (file)
@@ -3,7 +3,7 @@
 USING: regexp.nfa regexp.disambiguate kernel sequences
 assocs regexp.classes hashtables accessors fry vectors
 regexp.ast regexp.transition-tables regexp.minimize
-regexp.dfa namespaces ;
+regexp.dfa namespaces sets ;
 IN: regexp.negation
 
 CONSTANT: fail-state -1
@@ -21,7 +21,7 @@ CONSTANT: fail-state -1
     fail-state-recurses ;
 
 : inverse-final-states ( transition-table -- final-states )
-    [ transitions>> assoc>set ] [ final-states>> ] bi assoc-diff ;
+    [ transitions>> keys ] [ final-states>> ] bi diff fast-set ;
 
 : negate-table ( transition-table -- transition-table )
     clone
@@ -36,14 +36,14 @@ CONSTANT: fail-state -1
     [ [ [ 1vector ] assoc-map ] assoc-map ] change-transitions ;
 
 : unify-final-state ( transition-table -- transition-table )
-    dup [ final-states>> keys ] keep
+    dup [ final-states>> members ] keep
     '[ -2 epsilon _ set-transition ] each
-    H{ { -2 -2 } } >>final-states ;
+    HS{ -2 } clone >>final-states ;
 
 : adjoin-dfa ( transition-table -- start end )
     unify-final-state renumber-states box-transitions 
     [ start-state>> ]
-    [ final-states>> keys first ]
+    [ final-states>> members first ]
     [ nfa-table get [ transitions>> ] bi@ swap assoc-union! drop ] tri ;
 
 : ast>dfa ( parse-tree -- minimal-dfa )
index 35edcf328af1afea0b564a3eceb95a087c715df5..fb210c5ef2040974a4e285ada7ad4242f3593d13 100644 (file)
@@ -5,6 +5,7 @@ sequences fry quotations math.order math.ranges vectors
 unicode.categories regexp.transition-tables words sets hashtables
 combinators.short-circuit unicode.data regexp.ast
 regexp.classes memoize ;
+FROM: namespaces => set ;
 IN: regexp.nfa
 
 ! This uses unicode.data for ch>upper and ch>lower
@@ -162,6 +163,6 @@ M: with-options nfa-node ( node -- start end )
         <transition-table> nfa-table set
         nfa-node
         nfa-table get
-            swap dup associate >>final-states
+            swap 1array fast-set >>final-states
             swap >>start-state
     ] with-scope ;
index 70281aa798d38708f2d234265634cbe65d62c6fc..a038351cb0cf6bb167f14c57fa0c831a0fe9491a 100644 (file)
@@ -27,7 +27,7 @@ ERROR: bad-class name ;
     [ [ simple ] keep ] H{ } map>assoc ;
 
 MEMO: simple-script-table ( -- table )
-    script-table interval-values prune simple-table ;
+    script-table interval-values members simple-table ;
 
 MEMO: simple-category-table ( -- table )
     categories simple-table ;
@@ -133,7 +133,7 @@ CharacterInBracket = !("}") Character
 QuotedCharacter = !("\\E") .
 
 Escape = "p{" CharacterInBracket*:s "}" => [[ s name>class <primitive-class> ]]
-       | "P{" CharacterInBracket*:s "}" => [[ s name>class <primitive-class> <negation> ]]
+       | "P{" CharacterInBracket*:s "}" => [[ s name>class <primitive-class> <not-class> ]]
        | "Q" QuotedCharacter*:s "\\E" => [[ s <concatenation> ]]
        | "u" Character:a Character:b Character:c Character:d
             => [[ { a b c d } hex> ensure-number ]]
index 1f72fa04bad26ff9ef8900920eb6f2f5414fb739..2488f568dacb004a214d3fcb2764255c6b58d88a 100644 (file)
@@ -530,3 +530,8 @@ IN: regexp-tests
 [ f ] [ "π" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
 [ t ] [ "A" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
 [ f ] [ "3" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
+
+[ t ] [ " " R/ \P{alpha}/ matches? ] unit-test
+[ f ] [ "" R/ \P{alpha}/ matches? ] unit-test
+[ f ] [ "a " R/ \P{alpha}/ matches? ] unit-test
+[ f ] [ "a" R/ \P{alpha}/ matches? ] unit-test
index 0b387acd2a9e88658252b606235541fee77a0701..bbfe44096749edda70412c5235c722e3997da19a 100644 (file)
@@ -69,7 +69,7 @@ PRIVATE>
     dup next-match>>
     execute( i string regexp -- i start end ? ) ; inline
 
-:: (each-match) ( i string regexp quot: ( start end string -- ) -- )
+:: (each-match) ( ... i string regexp quot: ( ... start end string -- ... ) -- ... )
     i string regexp do-next-match [| i' start end |
         start end string quot call
         i' string regexp quot (each-match)
@@ -80,10 +80,10 @@ PRIVATE>
 
 PRIVATE>
 
-: each-match ( string regexp quot: ( start end string -- ) -- )
+: each-match ( ... string regexp quot: ( ... start end string -- ... ) -- ... )
     [ prepare-match-iterator ] dip (each-match) ; inline
 
-: map-matches ( string regexp quot: ( start end string -- obj ) -- seq )
+: map-matches ( ... string regexp quot: ( ... start end string -- ... obj ) -- ... seq )
     collector [ each-match ] dip >array ; inline
 
 : all-matching-slices ( string regexp -- seq )
@@ -216,8 +216,6 @@ SYNTAX: R` CHAR: ` parsing-regexp ;
 SYNTAX: R{ CHAR: } parsing-regexp ;
 SYNTAX: R| CHAR: | parsing-regexp ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [
-    "regexp.prettyprint" require
-] when
+{ "prettyprint" "regexp" } "regexp.prettyprint" require-when
index f452e3d24a4e46c25523a904332647d725c9ea74..b548b883b2a953da98f6263d775c69c3d3cf3f12 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs fry hashtables kernel sequences
-vectors locals regexp.classes ;
+vectors locals regexp.classes sets ;
 IN: regexp.transition-tables
 
 TUPLE: transition-table transitions start-state final-states ;
@@ -9,7 +9,7 @@ TUPLE: transition-table transitions start-state final-states ;
 : <transition-table> ( -- transition-table )
     transition-table new
         H{ } clone >>transitions
-        H{ } clone >>final-states ;
+        HS{ } clone >>final-states ;
 
 :: (set-transition) ( from to obj hash -- )
     from hash at
@@ -27,8 +27,8 @@ TUPLE: transition-table transitions start-state final-states ;
 : add-transition ( from to obj transition-table -- )
     transitions>> (add-transition) ;
 
-: map-set ( assoc quot -- new-assoc )
-    '[ drop @ dup ] assoc-map ; inline
+: map-set ( set quot -- new-set )
+    over [ [ members ] dip map ] dip set-like ; inline
 
 : number-transitions ( transitions numbering -- new-transitions )
     dup '[
index 326e0512191a4d5829312aefbb0c8e6b6b6f3cf5..38a8a489349ad557bd603a0a6941c3ea67a14710 100644 (file)
@@ -8,6 +8,9 @@ io.streams.string io.styles kernel make namespaces prettyprint
 prettyprint.backend prettyprint.config prettyprint.custom
 prettyprint.sections sequences sets sorting strings summary words
 words.symbol words.constant words.alias vocabs slots ;
+FROM: namespaces => set ;
+FROM: classes => members ;
+RENAME: members sets => set-members
 IN: see
 
 GENERIC: synopsis* ( defspec -- )
@@ -237,7 +240,7 @@ PRIVATE>
         dup class? [ dup seeing-implementors % ] when
         dup generic? [ dup seeing-methods % ] when
         drop
-    ] { } make prune ;
+    ] { } make set-members ;
 
 : see-methods ( word -- )
     methods see-all nl ;
index 4a2d267a120ca7987b2e493877204b11cb84f6b9..5be500abd4c1d4d7ece566a3dc730b269522bce7 100644 (file)
@@ -58,6 +58,11 @@ M: T cord-append
     [ [ [ head>> ] bi@ ] dip call ]
     [ [ [ tail>> ] bi@ ] dip call ] 3bi ; inline
 
+<PRIVATE
+: split-shuffle ( shuf -- sh uf )
+    dup length 2 /i cut* ; foldable
+PRIVATE>
+
 M: cord v+                [ v+                ] cord-2map ; inline
 M: cord v-                [ v-                ] cord-2map ; inline
 M: cord vneg              [ vneg              ] cord-map  ; inline
@@ -96,6 +101,9 @@ M: cord vunordered?       [ vunordered?       ] cord-2map ; inline
 M: cord vany?             [ vany?             ] cord-both or  ; inline
 M: cord vall?             [ vall?             ] cord-both and ; inline
 M: cord vnone?            [ vnone?            ] cord-both and ; inline
+M: cord vshuffle-elements 
+    [ [ head>> ] [ tail>> ] bi ] [ split-shuffle ] bi*
+    [ vshuffle2-elements ] bi-curry@ 2bi cord-append ; inline
 
 M: cord n+v [ n+v ] with cord-map ; inline
 M: cord n-v [ n-v ] with cord-map ; inline
@@ -108,5 +116,3 @@ M: cord v/n '[ _ v/n ] cord-map ; inline
 
 M: cord norm-sq [ norm-sq ] cord-both + ; inline
 M: cord distance v- norm ; inline
-
-
index 6f479e48b60dab496d2f82388c8e5ac4d8a06dfb..02d3b9e9ba864aba0eaee9f10bf0eed35aaada80 100644 (file)
@@ -2,27 +2,27 @@ USING: help.syntax help.markup kernel sequences ;
 IN: sequences.deep
 
 HELP: deep-each
-{ $values { "obj" object } { "quot" { $quotation "( elt -- )" } } }
+{ $values { "obj" object } { "quot" { $quotation "( ... elt -- ... )" } } }
 { $description "Execute a quotation on each nested element of an object and its children, in preorder." }
 { $see-also each } ;
 
 HELP: deep-map
-{ $values { "obj" object } { "quot" { $quotation "( elt -- newelt )" } } { "newobj" "the mapped object" } }
+{ $values { "obj" object } { "quot" { $quotation "( ... elt -- ... elt' )" } } { "newobj" "the mapped object" } }
 { $description "Execute a quotation on each nested element of an object and its children, in preorder. That is, the result of the execution of the quotation on the outer is used to map the inner elements." }
 { $see-also map }  ;
 
 HELP: deep-filter
-{ $values { "obj" object } { "quot" { $quotation "( elt -- ? )" } } { "seq" "a sequence" } }
+{ $values { "obj" object } { "quot" { $quotation "( ... elt -- ... ? )" } } { "seq" "a sequence" } }
 { $description "Creates a sequence of sub-nodes in the object which satisfy the given quotation, in preorder. This includes the object itself, if it passes the quotation." }
 { $see-also filter }  ;
 
 HELP: deep-find
-{ $values { "obj" object } { "quot" { $quotation "( elt -- ? )" } } { "elt" "an element" } }
+{ $values { "obj" object } { "quot" { $quotation "( ... elt -- ... ? )" } } { "elt" "an element" } }
 { $description "Gets the first sub-node of the object, in preorder, which satisfies the quotation. If nothing satisifies it, it returns " { $link f } "." }
 { $see-also find }  ;
 
 HELP: deep-any?
-{ $values { "obj" object } { "quot" { $quotation "( elt -- ? )" } } { "?" "a boolean" } }
+{ $values { "obj" object } { "quot" { $quotation "( ... elt -- ... ? )" } } { "?" "a boolean" } }
 { $description "Tests whether the given object or any subnode satisfies the given quotation." }
 { $see-also any? } ;
 
@@ -31,7 +31,7 @@ HELP: flatten
 { $description "Creates a sequence of all of the leaf nodes (non-sequence nodes, but including strings and numbers) in the object." } ;
 
 HELP: deep-map!
-{ $values { "obj" object } { "quot" { $quotation "( elt -- newelt )" } } }
+{ $values { "obj" object } { "quot" { $quotation "( ... elt -- ... elt' )" } } }
 { $description "Modifies each sub-node of an object in place, in preorder, and returns that object." }
 { $see-also map! } ;
 
index c79d0b20029f7490416d23e8831f4027abe033ad..6238962b6c9c4768be13e582a1737b8499836838 100644 (file)
@@ -12,30 +12,30 @@ M: integer branch? drop f ;
 M: string branch? drop f ;
 M: object branch? drop f ;
 
-: deep-each ( obj quot: ( elt -- ) -- )
+: deep-each ( ... obj quot: ( ... elt -- ... ) -- ... )
     [ call ] 2keep over branch?
     [ '[ _ deep-each ] each ] [ 2drop ] if ; inline recursive
 
-: deep-map ( obj quot: ( elt -- elt' ) -- newobj )
+: deep-map ( ... obj quot: ( ... elt -- ... elt' ) -- ... newobj )
     [ call ] keep over branch?
     [ '[ _ deep-map ] map ] [ drop ] if ; inline recursive
 
-: deep-filter ( obj quot: ( elt -- ? ) -- seq )
+: deep-filter ( ... obj quot: ( ... elt -- ... ? ) -- ... seq )
     over [ selector [ deep-each ] dip ] dip
     dup branch? [ like ] [ drop ] if ; inline recursive
 
-: (deep-find) ( obj quot: ( elt -- ? ) -- elt ? )
+: (deep-find) ( ... obj quot: ( ... elt -- ... ? ) -- ... elt ? )
     [ call ] 2keep rot [ drop t ] [
         over branch? [
             [ f ] 2dip '[ nip _ (deep-find) ] find drop >boolean
         ] [ 2drop f f ] if  
     ] if ; inline recursive
 
-: deep-find ( obj quot -- elt ) (deep-find) drop ; inline
+: deep-find ( ... obj quot: ( ... elt -- ... ? ) -- ... elt ) (deep-find) drop ; inline
 
-: deep-any? ( obj quot -- ? ) (deep-find) nip ; inline
+: deep-any? ( ... obj quot: ( ... elt -- ... ? ) -- ... ? ) (deep-find) nip ; inline
 
-: deep-all? ( obj quot -- ? )
+: deep-all? ( ... obj quot: ( ... elt -- ... ? ) -- ... ? )
     '[ @ not ] deep-any? not ; inline
 
 : deep-member? ( obj seq -- ? )
@@ -48,7 +48,7 @@ M: object branch? drop f ;
         _ swap dup branch? [ subseq? ] [ 2drop f ] if
     ] deep-find >boolean ;
 
-: deep-map! ( obj quot: ( elt -- elt' ) -- obj )
+: deep-map! ( ... obj quot: ( ... elt -- ... elt' ) -- ... obj )
     over branch? [
         '[ _ [ call ] keep over [ deep-map! drop ] dip ] map!
     ] [ drop ] if ; inline recursive
index 7940427e698abd6a3b8cd4262379f2496c913fb8..acc9705f10f7fe2720b7b2c25ffd9531ac95afda 100644 (file)
@@ -3,16 +3,95 @@ USING: help.syntax help.markup kernel sequences quotations
 math arrays combinators ;
 IN: sequences.generalizations
 
+HELP: nsequence
+{ $values { "n" integer } { "seq" "an exemplar" } }
+{ $description "A generalization of " { $link 2sequence } ", "
+{ $link 3sequence } ", and " { $link 4sequence } " "
+"that constructs a sequence from the top " { $snippet "n" } " elements of the stack."
+}
+{ $examples
+    { $example "USING: prettyprint sequences.generalizations ;" "CHAR: f CHAR: i CHAR: s CHAR: h 4 \"\" nsequence ." "\"fish\"" }
+} ;
+
+HELP: narray
+{ $values { "n" integer } }
+{ $description "A generalization of " { $link 1array } ", "
+{ $link 2array } ", " { $link 3array } " and " { $link 4array } " "
+"that constructs an array from the top " { $snippet "n" } " elements of the stack."
+}
+{ $examples
+    "Some core words expressed in terms of " { $link narray } ":"
+    { $table
+        { { $link 1array } { $snippet "1 narray" } }
+        { { $link 2array } { $snippet "2 narray" } }
+        { { $link 3array } { $snippet "3 narray" } }
+        { { $link 4array } { $snippet "4 narray" } }
+    }
+} ;
+
+{ nsequence narray } related-words
+
+HELP: firstn
+{ $values { "n" integer } }
+{ $description "A generalization of " { $link first } ", "
+{ $link first2 } ", " { $link first3 } " and " { $link first4 } " "
+"that pushes the first " { $snippet "n" } " elements of a sequence on the stack."
+}
+{ $examples
+    "Some core words expressed in terms of " { $link firstn } ":"
+    { $table
+        { { $link first } { $snippet "1 firstn" } }
+        { { $link first2 } { $snippet "2 firstn" } }
+        { { $link first3 } { $snippet "3 firstn" } }
+        { { $link first4 } { $snippet "4 firstn" } }
+    }
+} ;
+
+HELP: set-firstn
+{ $values { "n" integer } }
+{ $description "A generalization of " { $link set-first } " "
+"that sets the first " { $snippet "n" } " elements of a sequence from the top " { $snippet "n" } " elements of the stack." } ;
+
+HELP: nappend
+{ $values
+     { "n" integer }
+     { "seq" sequence }
+}
+{ $description "Outputs a new sequence consisting of the elements of the top " { $snippet "n" } " sequences from the datastack in turn." }
+{ $errors "Throws an error if any of the sequences contain elements that are not permitted in the sequence type of the first sequence." }
+{ $examples
+    { $example "USING: math prettyprint sequences.generalizations ;"
+               "{ 1 2 } { 3 4 } { 5 6 } { 7 8 } 4 nappend ."
+               "{ 1 2 3 4 5 6 7 8 }"
+    }
+} ;
+
+HELP: nappend-as
+{ $values
+     { "n" integer } { "exemplar" sequence }
+     { "seq" sequence }
+}
+{ $description "Outputs a new sequence of type " { $snippet "exemplar" } " consisting of the elements of the top " { $snippet "n" } " sequences from the datastack in turn." }
+{ $errors "Throws an error if any of the sequences contain elements that are not permitted in the sequence type of the first sequence." }
+{ $examples
+    { $example "USING: math prettyprint sequences.generalizations ;"
+               "{ 1 2 } { 3 4 } { 5 6 } { 7 8 } 4 V{ } nappend-as ."
+               "V{ 1 2 3 4 5 6 7 8 }"
+    }
+} ;
+
+{ nappend nappend-as } related-words
+
 HELP: neach
-{ $values { "...seq" { $snippet "n" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( ...element -- )" } } { "n" integer } }
+{ $values { "seq..." { $snippet "n" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( element... -- )" } } { "n" integer } }
 { $description "A generalization of " { $link each } ", " { $link 2each } ", and " { $link 3each } " that can iterate over any number of sequences in parallel." } ;
 
 HELP: nmap
-{ $values { "...seq" { $snippet "n" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( ...element -- result )" } } { "n" integer } { "result" "a sequence of the same type as the first " { $snippet "seq" } } }
+{ $values { "seq..." { $snippet "n" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( element... -- result )" } } { "n" integer } { "result" "a sequence of the same type as the first " { $snippet "seq" } } }
 { $description "A generalization of " { $link map } ", " { $link 2map } ", and " { $link 3map } " that can map over any number of sequences in parallel." } ;
 
 HELP: nmap-as
-{ $values { "...seq" { $snippet "n" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( ...element -- result )" } } { "exemplar" sequence } { "n" integer } { "result" "a sequence of the same type as " { $snippet "exemplar" } } }
+{ $values { "seq..." { $snippet "n" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( element... -- result )" } } { "exemplar" sequence } { "n" integer } { "result" "a sequence of the same type as " { $snippet "exemplar" } } }
 { $description "A generalization of " { $link map-as } ", " { $link 2map-as } ", and " { $link 3map-as } " that can map over any number of sequences in parallel." } ;
 
 HELP: mnmap
@@ -28,11 +107,20 @@ HELP: nproduce
 { $description "A generalization of " { $link produce } " that generates " { $snippet "n" } " arrays in parallel by calling " { $snippet "quot" } " repeatedly until " { $snippet "pred" } " outputs false." } ;
 
 HELP: nproduce-as
-{ $values { "pred" { $quotation "( -- ? )" } } { "quot" { $quotation "( -- obj1 obj2 ... objn )" } } { "...exemplar" { $snippet "n" } " sequences on the datastack" } { "n" integer } { "seq..." { $snippet "n" } " sequences on the datastack of the same types as the " { $snippet "exemplar" } "s" } }
+{ $values { "pred" { $quotation "( -- ? )" } } { "quot" { $quotation "( -- obj1 obj2 ... objn )" } } { "exemplar..." { $snippet "n" } " sequences on the datastack" } { "n" integer } { "seq..." { $snippet "n" } " sequences on the datastack of the same types as the " { $snippet "exemplar" } "s" } }
 { $description "A generalization of " { $link produce-as } " that generates " { $snippet "n" } " sequences in parallel by calling " { $snippet "quot" } " repeatedly until " { $snippet "pred" } " outputs false." } ;
 
-ARTICLE: "sequences.generalizations" "Generalized sequence iteration combinators"
-"The " { $vocab-link "sequences.generalizations" } " vocabulary defines generalized versions of the iteration " { $link "sequences-combinators" } "."
+ARTICLE: "sequences.generalizations" "Generalized sequence words"
+"The " { $vocab-link "sequences.generalizations" } " vocabulary defines generalized versions of various sequence operations."
+{ $subsections
+    narray
+    nsequence
+    firstn
+    set-firstn
+    nappend
+    nappend-as
+}
+"Generalized " { $link "sequences-combinators" } ":"
 { $subsections
     neach
     nmap
index d1861b8f9dcbc6cb931d94d8f47818f04a3183a4..ff2b7059300b510879be54c6996de5a719f91755 100644 (file)
@@ -3,6 +3,20 @@ USING: tools.test generalizations kernel math arrays sequences
 sequences.generalizations ascii fry math.parser io io.streams.string ;
 IN: sequences.generalizations.tests
 
+[ 1 2 3 4 ] [ { 1 2 3 4 } 4 firstn ] unit-test
+[ { 1 2 3 4 } ] [ 1 2 3 4 { f f f f } [ 4 set-firstn ] keep ] unit-test
+[ 1 2 3 4 { f f f } [ 4 set-firstn ] keep ] must-fail
+[ ] [ { } 0 firstn ] unit-test
+[ "a" ] [ { "a" } 1 firstn ] unit-test
+
+[ [ 1 2 ] ] [ 1 2 2 [ ] nsequence ] unit-test
+
+[ { 1 2 3 4 } ] [ { 1 } { 2 } { 3 } { 4 } 4 nappend ] unit-test
+[ V{ 1 2 3 4 } ] [ { 1 } { 2 } { 3 } { 4 } 4 V{ } nappend-as ] unit-test
+
+[ 4 nappend ] must-infer
+[ 4 { } nappend-as ] must-infer
+
 : neach-test ( a b c d -- )
     [ 4 nappend print ] 4 neach ;
 : nmap-test ( a b c d -- e )
index f49dc8a4e761e1ffc8acf39e94cacc271497583c..8401930db398ce4d683e7b4923c0a949900a9dfb 100644 (file)
@@ -4,35 +4,70 @@ combinators macros math.order math.ranges quotations fry effects
 memoize.private generalizations ;
 IN: sequences.generalizations
 
+MACRO: nsequence ( n seq -- )
+    [ [nsequence] ] keep
+    '[ @ _ like ] ;
+
+MACRO: narray ( n -- )
+    '[ _ { } nsequence ] ;
+
+MACRO: firstn-unsafe ( n -- )
+    [firstn] ;
+
+MACRO: firstn ( n -- )
+    dup zero? [ drop [ drop ] ] [
+        [ 1 - swap bounds-check 2drop ]
+        [ firstn-unsafe ]
+        bi-curry '[ _ _ bi ]
+    ] if ;
+
+MACRO: set-firstn-unsafe ( n -- )
+    [ 1 + ]
+    [ iota [ '[ _ rot [ set-nth-unsafe ] keep ] ] map ] bi
+    '[ _ -nrot _ spread drop ] ;
+
+MACRO: set-firstn ( n -- )
+    dup zero? [ drop [ drop ] ] [
+        [ 1 - swap bounds-check 2drop ]
+        [ set-firstn-unsafe ]
+        bi-curry '[ _ _ bi ]
+    ] if ;
+
+: nappend-as ( n exemplar -- seq )
+    [ narray concat ] dip like ; inline
+
+: nappend ( n -- seq ) narray concat ; inline
+
 MACRO: nmin-length ( n -- )
     dup 1 - [ min ] n*quot
     '[ [ length ] _ napply @ ] ;
 
-: nnth-unsafe ( n ...seq n -- )
+: nnth-unsafe ( n seq... n -- )
     [ nth-unsafe ] swap [ apply-curry ] [ cleave* ] bi ; inline
+
 MACRO: nset-nth-unsafe ( n -- )
     [ [ drop ] ]
     [ '[ [ set-nth-unsafe ] _ [ apply-curry ] [ cleave-curry ] [ spread* ] tri ] ]
     if-zero ;
 
-: (neach) ( ...seq quot n -- len quot' )
+: (neach) ( seq... quot n -- len quot' )
     dup dup dup
     '[ [ _ nmin-length ] _ nkeep [ _ nnth-unsafe ] _ ncurry ] dip compose ; inline
 
-: neach ( ...seq quot n -- )
+: neach ( seq... quot n -- )
     (neach) each-integer ; inline
 
-: nmap-as ( ...seq quot exemplar n -- result )
+: nmap-as ( seq... quot exemplar n -- result )
     '[ _ (neach) ] dip map-integers ; inline
 
-: nmap ( ...seq quot n -- result )
+: nmap ( seq... quot n -- result )
     dup '[ [ _ npick ] dip swap ] dip nmap-as ; inline
 
 MACRO: nnew-sequence ( n -- )
     [ [ drop ] ]
     [ dup '[ [ new-sequence ] _ apply-curry _ cleave* ] ] if-zero ;
 
-: nnew-like ( len ...exemplar quot n -- result... )
+: nnew-like ( len exemplar... quot n -- result... )
     5 dupn '[
         _ nover
         [ [ _ nnew-sequence ] dip call ]
@@ -45,10 +80,10 @@ MACRO: (ncollect) ( n -- )
     3 dupn 1 +
     '[ [ [ keep ] _ ndip _ nset-nth-unsafe ] _ ncurry ] ;
 
-: ncollect ( len quot ...into n -- )
+: ncollect ( len quot into... n -- )
     (ncollect) each-integer ; inline
 
-: nmap-integers ( len quot ...exemplar n -- result... )
+: nmap-integers ( len quot exemplar... n -- result... )
     4 dupn
     '[ [ over ] _ ndip [ [ _ ncollect ] _ nkeep ] _ nnew-like ] call ; inline
 
@@ -58,7 +93,7 @@ MACRO: (ncollect) ( n -- )
 : mnmap ( m*seq quot m n -- result*n )
     2dup '[ [ _ npick ] dip swap _ dupn ] 2dip mnmap-as ; inline
 
-: ncollector-for ( quot ...exemplar n -- quot' vec... )
+: ncollector-for ( quot exemplar... n -- quot' vec... )
     5 dupn '[
         [ [ length ] keep new-resizable ] _ napply
         [ [ [ push ] _ apply-curry _ spread* ] _ ncurry compose ] _ nkeep
@@ -67,7 +102,7 @@ MACRO: (ncollect) ( n -- )
 : ncollector ( quot n -- quot' vec... )
     [ V{ } swap dupn ] keep ncollector-for ; inline
 
-: nproduce-as ( pred quot ...exemplar n -- seq... )
+: nproduce-as ( pred quot exemplar... n -- seq... )
     7 dupn '[
         _ ndup
         [ _ ncollector-for [ while ] _ ndip ]
index 44fa75239cfa08acbd9e60c48f4730f3fb211641..8e1b1f540cc771d7fd4f73e35b3a32cc6c58ae8a 100644 (file)
@@ -15,7 +15,7 @@ TUPLE: sequence-parser sequence n ;
 :: with-sequence-parser ( sequence-parser quot -- seq/f )
     sequence-parser n>> :> n
     sequence-parser quot call [
-        n sequence-parser (>>n) f
+        n sequence-parser n<< f
     ] unless* ; inline
 
 : offset  ( sequence-parser offset -- char/f )
@@ -39,7 +39,7 @@ TUPLE: sequence-parser sequence n ;
 : get+increment ( sequence-parser -- char/f )
     [ current ] [ advance drop ] bi ; inline
 
-:: skip-until ( sequence-parser quot: ( obj -- ? ) -- )
+:: skip-until ( ... sequence-parser quot: ( ... obj -- ... ? ) -- ... )
     sequence-parser current [
         sequence-parser quot call
         [ sequence-parser advance quot skip-until ] unless
@@ -47,7 +47,7 @@ TUPLE: sequence-parser sequence n ;
 
 : sequence-parse-end? ( sequence-parser -- ? ) current not ;
 
-: take-until ( sequence-parser quot: ( obj -- ? ) -- sequence/f )
+: take-until ( ... sequence-parser quot: ( ... obj -- ... ? ) -- ... sequence/f )
     over sequence-parse-end? [
         2drop f
     ] [
@@ -56,7 +56,7 @@ TUPLE: sequence-parser sequence n ;
         [ drop [ n>> ] [ sequence>> ] bi ] 2tri subseq f like
     ] if ; inline
 
-: take-while ( sequence-parser quot: ( obj -- ? ) -- sequence/f )
+: take-while ( ... sequence-parser quot: ( ... obj -- ... ? ) -- ... sequence/f )
     [ not ] compose take-until ; inline
 
 : <safe-slice> ( from to seq -- slice/f )
@@ -92,7 +92,7 @@ TUPLE: sequence-parser sequence n ;
         sequence-parser [ growing length - 1 + ] change-n drop
         ! sequence-parser advance drop
     ] [
-        saved sequence-parser (>>n)
+        saved sequence-parser n<<
         f
     ] if ;
 
diff --git a/basis/sequences/unrolled/authors.txt b/basis/sequences/unrolled/authors.txt
new file mode 100644 (file)
index 0000000..f13c9c1
--- /dev/null
@@ -0,0 +1 @@
+Joe Groff
diff --git a/basis/sequences/unrolled/summary.txt b/basis/sequences/unrolled/summary.txt
new file mode 100644 (file)
index 0000000..1c9ba01
--- /dev/null
@@ -0,0 +1 @@
+Unrolled fixed-length sequence iteration
diff --git a/basis/sequences/unrolled/unrolled-docs.factor b/basis/sequences/unrolled/unrolled-docs.factor
new file mode 100644 (file)
index 0000000..1e6ba39
--- /dev/null
@@ -0,0 +1,96 @@
+! (c)2010 Joe Groff bsd license
+USING: help.markup help.syntax kernel math quotations sequences
+sequences.private ;
+IN: sequences.unrolled
+
+HELP: unrolled-collect
+{ $values
+    { "n" integer } { "quot" { $quotation "( n -- value )" } } { "into" sequence }
+}
+{ $description "Unrolled version of " { $link collect } ". " { $snippet "n" } " must be a compile-time constant." } ;
+
+HELP: unrolled-each
+{ $values
+    { "seq" sequence } { "len" integer } { "quot" { $quotation "( x -- )" } }
+}
+{ $description "Unrolled version of " { $link each } " that iterates over the first " { $snippet "len" } " elements of " { $snippet "seq" } ". " { $snippet "len" } " must be a compile-time constant. If " { $snippet "seq" } " has fewer than " { $snippet "len" } " elements, raises an " { $link unrolled-bounds-error } "." } ;
+
+HELP: unrolled-2each
+{ $values
+    { "xseq" sequence } { "yseq" sequence } { "len" integer } { "quot" { $quotation "( x y -- )" } }
+}
+{ $description "Unrolled version of " { $link 2each } " that iterates over the first " { $snippet "len" } " elements of " { $snippet "xseq" } " and " { $snippet "yseq" } ". " { $snippet "len" } " must be a compile-time constant. If " { $snippet "seq" } " has fewer than " { $snippet "len" } " elements, raises an " { $link unrolled-bounds-error } "." } ;
+
+HELP: unrolled-each-index
+{ $values
+    { "seq" sequence } { "len" integer } { "quot" { $quotation "( x i -- )" } }
+}
+{ $description "Unrolled version of " { $link each-index } " that iterates over the first " { $snippet "len" } " elements of " { $snippet "seq" } ". " { $snippet "len" } " must be a compile-time constant. If " { $snippet "seq" } " has fewer than " { $snippet "len" } " elements, raises an " { $link unrolled-bounds-error } "." } ;
+
+HELP: unrolled-each-integer
+{ $values
+    { "n" integer } { "quot" { $quotation "( i -- )" } }
+}
+{ $description "Unrolled version of " { $link each-integer } ". " { $snippet "n" } " must be a compile-time constant." } ;
+
+HELP: unrolled-map
+{ $values
+    { "seq" sequence } { "len" integer } { "quot" { $quotation "( x -- newx )" } }
+    { "newseq" sequence }
+}
+{ $description "Unrolled version of " { $link map } " that maps over the first " { $snippet "len" } " elements of " { $snippet "seq" } ". " { $snippet "len" } " must be a compile-time constant. If " { $snippet "seq" } " has fewer than " { $snippet "len" } " elements, raises an " { $link unrolled-bounds-error } "." } ;
+
+HELP: unrolled-map-as
+{ $values
+    { "seq" sequence } { "len" integer } { "quot" { $quotation "( x -- newx )" } } { "exemplar" sequence }
+    { "newseq" sequence }
+}
+{ $description "Unrolled version of " { $link map-as } " that maps over the first " { $snippet "len" } " elements of " { $snippet "seq" } ". " { $snippet "len" } " must be a compile-time constant. If " { $snippet "seq" } " has fewer than " { $snippet "len" } " elements, raises an " { $link unrolled-bounds-error } "." } ;
+
+HELP: unrolled-2map
+{ $values
+    { "xseq" sequence } { "yseq" sequence } { "len" integer } { "quot" { $quotation "( x y -- newx )" } } { "newseq" sequence }
+}
+{ $description "Unrolled version of " { $link 2map } " that iterates over the first " { $snippet "len" } " elements of " { $snippet "xseq" } " and " { $snippet "yseq" } ". " { $snippet "len" } " must be a compile-time constant. If " { $snippet "seq" } " has fewer than " { $snippet "len" } " elements, raises an " { $link unrolled-bounds-error } "." } ;
+
+HELP: unrolled-2map-as
+{ $values
+    { "xseq" sequence } { "yseq" sequence } { "len" integer } { "quot" { $quotation "( x y -- newx )" } } { "exemplar" sequence } { "newseq" sequence }
+}
+{ $description "Unrolled version of " { $link 2map-as } " that iterates over the first " { $snippet "len" } " elements of " { $snippet "xseq" } " and " { $snippet "yseq" } ". " { $snippet "len" } " must be a compile-time constant. If " { $snippet "seq" } " has fewer than " { $snippet "len" } " elements, raises an " { $link unrolled-bounds-error } "." } ;
+
+HELP: unrolled-map-index
+{ $values
+    { "seq" sequence } { "len" integer } { "quot" { $quotation "( x i -- newx )" } }
+    { "newseq" sequence }
+}
+{ $description "Unrolled version of " { $link map-index } " that maps over the first " { $snippet "len" } " elements of " { $snippet "seq" } ". " { $snippet "len" } " must be a compile-time constant. If " { $snippet "seq" } " has fewer than " { $snippet "len" } " elements, raises an " { $link unrolled-bounds-error } "." } ;
+
+HELP: unrolled-map-integers
+{ $values
+    { "n" integer } { "quot" { $quotation "( n -- value )" } } { "exemplar" sequence } { "newseq" sequence }
+}
+{ $description "Unrolled version of " { $link map-integers } ". " { $snippet "n" } " must be a compile-time constant." } ;
+
+ARTICLE: "sequences.unrolled" "Unrolled sequence iteration combinators"
+"The " { $vocab-link "sequences.unrolled" } " vocabulary provides versions of some of the " { $link "sequences-combinators" } " that unroll their loops, that is, expand to a constant number of repetitions of a quotation rather than an explicit loop. These unrolled combinators all require a constant integer value to indicate the number of unrolled iterations to perform."
+$nl
+"Unrolled versions of high-level iteration combinators:"
+{ $subsections
+    unrolled-each
+    unrolled-each-index
+    unrolled-2each
+    unrolled-map
+    unrolled-map-index
+    unrolled-map-as
+    unrolled-2map
+    unrolled-2map-as
+}
+"Unrolled versions of low-level iteration combinators:"
+{ $subsections
+    unrolled-each-integer
+    unrolled-map-integers
+    unrolled-collect
+} ;
+
+ABOUT: "sequences.unrolled"
diff --git a/basis/sequences/unrolled/unrolled-tests.factor b/basis/sequences/unrolled/unrolled-tests.factor
new file mode 100644 (file)
index 0000000..e0d70b4
--- /dev/null
@@ -0,0 +1,52 @@
+! (c)2010 Joe Groff bsd license
+USING: compiler.test compiler.tree.debugger kernel make math.parser sequences
+sequences.unrolled tools.test ;
+IN: sequences.unrolled.tests
+
+[ { "0" "1" "2" } ] [ { 0 1 2 } 3 [ number>string ] unrolled-map ] unit-test
+[ { "0" "1" "2" } ] [ { 0 1 2 } [ 3 [ number>string ] unrolled-map ] compile-call ] unit-test
+
+[ { "0" "1" "2" } ] [ [ { 0 1 2 } 3 [ number>string , ] unrolled-each ] { } make ] unit-test
+[ { "0" "1" "2" } ] [ [ { 0 1 2 } [ 3 [ number>string , ] unrolled-each ] compile-call ] { } make ] unit-test
+
+[ { "a0" "b1" "c2" } ]
+[ [ { "a" "b" "c" } 3 [ number>string append , ] unrolled-each-index ] { } make ] unit-test
+
+[ { "a0" "b1" "c2" } ]
+[ [ { "a" "b" "c" } [ 3 [ number>string append , ] unrolled-each-index ] compile-call ] { } make ] unit-test
+
+[ { "aI" "bII" "cIII" } ]
+[ [ { "a" "b" "c" } { "I" "II" "III" } [ 3 [ append , ] unrolled-2each ] compile-call ] { } make ] unit-test
+
+[ { "aI" "bII" "cIII" } ]
+[ { "a" "b" "c" } { "I" "II" "III" } 3 [ append ] unrolled-2map ] unit-test
+
+[ { "aI" "bII" "cIII" } ]
+[ { "a" "b" "c" } { "I" "II" "III" } [ 3 [ append ] unrolled-2map ] compile-call ] unit-test
+
+[ { "a0" "b1" "c2" } ]
+[ { "a" "b" "c" } 3 [ number>string append ] unrolled-map-index ] unit-test
+
+[ { "a0" "b1" "c2" } ]
+[ { "a" "b" "c" } [ 3 [ number>string append ] unrolled-map-index ] compile-call ] unit-test
+
+[ { 0 1 2 } 4 [ number>string ] unrolled-map ] [ unrolled-bounds-error? ] must-fail-with
+[ { 0 1 2 3 } { 0 1 2 } 4 [ number>string append ] unrolled-2map ] [ unrolled-2bounds-error? ] must-fail-with
+
+[ t ]
+[ [ 3 [ number>string ] unrolled-map ] { call } inlined? ] unit-test
+
+[ t ]
+[ [ 3 [ number>string , ] unrolled-each ] { call } inlined? ] unit-test
+
+[ t ]
+[ [ 3 [ number>string append , ] unrolled-each-index ] { call } inlined? ] unit-test
+
+[ t ]
+[ [ 3 [ append , ] unrolled-2each ] { call } inlined? ] unit-test
+
+[ t ]
+[ [ 3 [ append ] unrolled-2map ] { call } inlined? ] unit-test
+
+[ t ]
+[ [ 3 [ number>string append ] unrolled-map-index ] { call } inlined? ] unit-test
diff --git a/basis/sequences/unrolled/unrolled.factor b/basis/sequences/unrolled/unrolled.factor
new file mode 100644 (file)
index 0000000..83da65e
--- /dev/null
@@ -0,0 +1,99 @@
+! (c)2010 Joe Groff bsd license
+USING: combinators combinators.short-circuit fry generalizations kernel
+locals macros math quotations sequences compiler.tree.propagation.transforms ;
+FROM: sequences.private => (each) (each-index) (2each) nth-unsafe set-nth-unsafe ;
+IN: sequences.unrolled
+
+<PRIVATE
+: (unrolled-each-integer) ( quot n -- )
+    swap '[ _ call( i -- ) ] each-integer ;
+
+<< \ (unrolled-each-integer) [
+    iota [ '[ _ swap call( i -- ) ] ] [ ] map-as '[ _ cleave ]
+] 1 define-partial-eval >>
+
+: (unrolled-collect) ( quot into -- quot' )
+    '[ dup @ swap _ set-nth-unsafe ] ; inline
+
+PRIVATE>
+
+: unrolled-each-integer ( n quot: ( i -- ) -- )
+    swap (unrolled-each-integer) ; inline
+
+: unrolled-collect ( n quot: ( n -- value ) into -- )
+    (unrolled-collect) unrolled-each-integer ; inline
+
+: unrolled-map-integers ( n quot: ( n -- value ) exemplar -- newseq )
+    [ over ] dip [ [ unrolled-collect ] keep ] new-like ; inline
+
+ERROR: unrolled-bounds-error
+    seq unroll-length ;
+
+ERROR: unrolled-2bounds-error
+    xseq yseq unroll-length ;
+
+<PRIVATE
+: unrolled-bounds-check ( seq len quot -- seq len quot )
+    2over swap length > [ 2over unrolled-bounds-error ] when ; inline
+
+:: unrolled-2bounds-check ( xseq yseq len quot -- xseq yseq len quot )
+    { [ len xseq length > ] [ len yseq length > ] } 0||
+    [ xseq yseq len unrolled-2bounds-error ]
+    [ xseq yseq len quot ] if ; inline
+
+: (unrolled-each) ( seq len quot -- len quot )
+    swapd '[ _ nth-unsafe @ ] ; inline
+
+: (unrolled-each-index) ( seq len quot -- len quot )
+    swapd '[ dup _ nth-unsafe swap @ ] ; inline
+
+: (unrolled-2each) ( xseq yseq len quot -- len quot )
+    [ '[ _ ] 2dip ] dip (2each) nip ; inline
+
+: unrolled-each-unsafe ( seq len quot: ( x -- ) -- )
+    (unrolled-each) unrolled-each-integer ; inline
+
+: unrolled-2each-unsafe ( xseq yseq len quot: ( x y -- ) -- )
+    (unrolled-2each) unrolled-each-integer ; inline
+
+: unrolled-each-index-unsafe ( seq len quot: ( x -- ) -- )
+    (unrolled-each-index) unrolled-each-integer ; inline
+
+: unrolled-map-as-unsafe ( seq len quot: ( x -- newx ) exemplar -- newseq )
+    [ (unrolled-each) ] dip unrolled-map-integers ; inline
+
+: unrolled-2map-as-unsafe ( xseq yseq len quot: ( x y -- newx ) exemplar -- newseq )
+    [ (unrolled-2each) ] dip unrolled-map-integers ; inline
+
+: unrolled-map-unsafe ( seq len quot: ( x -- newx ) -- newseq )
+    pick unrolled-map-as-unsafe ; inline
+
+: unrolled-2map-unsafe ( xseq yseq len quot: ( x y -- newx ) -- newseq )
+    4 npick unrolled-2map-as-unsafe ; inline
+
+PRIVATE>
+
+: unrolled-each ( seq len quot: ( x -- ) -- )
+    unrolled-bounds-check unrolled-each-unsafe ; inline
+
+: unrolled-2each ( xseq yseq len quot: ( x y -- ) -- )
+    unrolled-2bounds-check unrolled-2each-unsafe ; inline
+
+: unrolled-each-index ( seq len quot: ( x i -- ) -- )
+    unrolled-bounds-check unrolled-each-index-unsafe ; inline
+
+: unrolled-map-as ( seq len quot: ( x -- newx ) exemplar -- newseq )
+    [ unrolled-bounds-check ] dip unrolled-map-as-unsafe ; inline
+
+: unrolled-2map-as ( xseq yseq len quot: ( x y -- newx ) exemplar -- newseq )
+    [ unrolled-2bounds-check ] dip unrolled-2map-as-unsafe ; inline
+
+: unrolled-map ( seq len quot: ( x -- newx ) -- newseq )
+    pick unrolled-map-as ; inline
+
+: unrolled-2map ( xseq yseq len quot: ( x y -- newx ) -- newseq )
+    4 npick unrolled-2map-as ; inline
+
+: unrolled-map-index ( seq len quot: ( x i -- newx ) -- newseq )
+    [ dup length iota ] 2dip unrolled-2map ; inline
+
index 036356e137975eeeec2fa147007450d2cacb2659..9213a54004973c236d4b88fbd357d0dcab46576d 100644 (file)
@@ -4,7 +4,8 @@
 USING: tools.test kernel serialize io io.streams.byte-array
 alien arrays byte-arrays bit-arrays specialized-arrays
 sequences math prettyprint parser classes math.constants
-io.encodings.binary random assocs serialize.private alien.c-types ;
+io.encodings.binary random assocs serialize.private alien.c-types
+combinators.short-circuit ;
 SPECIALIZED-ARRAY: double
 IN: serialize.tests
 
@@ -16,11 +17,12 @@ IN: serialize.tests
 [ t ] [
     100 [
         drop
-        40 [        test-serialize-cell ] all-integers?
-         4 [ 40 *   test-serialize-cell ] all-integers?
-         4 [ 400 *  test-serialize-cell ] all-integers?
-         4 [ 4000 * test-serialize-cell ] all-integers?
-        and and and
+        {
+            [ 40 [        test-serialize-cell ] all-integers? ]
+            [  4 [ 40 *   test-serialize-cell ] all-integers? ]
+            [  4 [ 400 *  test-serialize-cell ] all-integers? ]
+            [  4 [ 4000 * test-serialize-cell ] all-integers? ]
+        } 0&&
     ] all-integers?
 ] unit-test
 
index b826606df51f85070e4d9ddb17270b3a1e9625a4..2659ed3280ddf9e7549a1e034cb3634b41237bfa 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2007 Chris Double, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs combinators effects.parser generalizations
-hashtables kernel locals locals.backend macros make math
-parser sequences ;
+USING: accessors assocs combinators effects.parser
+generalizations sequences.generalizations hashtables kernel
+locals locals.backend macros make math parser sequences ;
 IN: shuffle
 
 <PRIVATE
index 88a64b7746592e0c218c8a7a0d4b6bdefcb5a00c..a2fa8c3c4c11e05d518a1863225e224a1d5aeb68 100644 (file)
@@ -47,7 +47,7 @@ SYMBOL: interned
     ] { } make <interval-map> ;
 
 : process-interval-file ( ranges -- table )
-    dup values prune interned
+    dup values members interned
     [ expand-ranges ] with-variable ;
 
 : load-interval-file ( filename -- table )
index 61ccd5c435c1d7401578927f2cdcd4ed1397d729..045c08df42b86056fec8e5ccd13f35e1585e1b66 100644 (file)
@@ -7,6 +7,7 @@ io.encodings.ascii io.timeouts io.sockets io.sockets.secure io.crlf
 kernel logging sequences combinators splitting assocs strings
 math.order math.parser random system calendar summary calendar.format
 accessors sets hashtables base64 debugger classes prettyprint words ;
+FROM: namespaces => set ;
 IN: smtp
 
 SYMBOL: smtp-domain
index b7fefcad635c9d04d381d34fa669a86069db073e..577d2f0b67ebbec00dba5f3b2835aea665427cb9 100644 (file)
@@ -2,7 +2,7 @@ USING: locals sequences kernel math ;
 IN: sorting.insertion
 
 <PRIVATE
-:: insert ( seq quot: ( elt -- elt' ) n -- )
+:: insert ( ... seq quot: ( ... elt -- ... elt' ) n -- ... )
     n zero? [
         n n 1 - [ seq nth quot call ] bi@ >= [
             n n 1 - seq exchange
index 68ce02e71e7f345b91fc5265bb3d7e42ba812ba2..fd1a4a72f25e2947e86346e3a245ba5e9cc3ae2f 100644 (file)
@@ -21,7 +21,7 @@ ARTICLE: "specialized-array-words" "Specialized array words"
     { { $snippet "(T-array)" } { "Constructor for arrays with elements of type " { $snippet "T" } ", where the initial contents are uninitialized; stack effect " { $snippet "( len -- array )" } } }
     { { $snippet "malloc-T-array" } { "Constructor for arrays with elements of type " { $snippet "T" } " backed by newly-allocated unmanaged memory; stack effect " { $snippet "( alien len -- array )" } } }
     { { $snippet "<direct-T-array>" } { "Constructor for arrays with elements of type " { $snippet "T" } " backed by raw memory; stack effect " { $snippet "( alien len -- array )" } } }
-    { { $snippet "byte-array>T-array" } { "Converts a byte array into a specialized array by interpreting the bytes in as machine-specific values. Code which uses this word is unportable" } }
+    { { $snippet "T-array-cast" } { "Converts a byte array into a specialized array by interpreting the bytes in as machine-specific values. Code which uses this word is unportable" } }
     { { $snippet ">T-array" } { "Converts a sequence into a specialized array of type " { $snippet "T" } "; stack effect " { $snippet "( seq -- array )" } } }
     { { $snippet "T-array{" } { "Literal syntax, consists of a series of values terminated by " { $snippet "}" } } }
 }
index c25f8ae3b15f0bb0a755653445456b4330587f6f..3a34b3891bebbb6fbe53a9ea051b88db7454e10d 100644 (file)
@@ -1,12 +1,13 @@
+USING: tools.test alien.syntax specialized-arrays sequences
+alien accessors kernel arrays combinators compiler
+compiler.units classes.struct combinators.smart
+compiler.tree.debugger math libc destructors sequences.private
+multiline eval words vocabs namespaces assocs prettyprint
+alien.data math.vectors definitions compiler.test ;
+FROM: specialized-arrays.private => specialized-array-vocab ;
+FROM: alien.c-types => int float bool char float ulonglong ushort uint
+heap-size little-endian? ;
 IN: specialized-arrays.tests
-USING: tools.test alien.syntax specialized-arrays
-specialized-arrays.private sequences alien.c-types accessors
-kernel arrays combinators compiler compiler.units classes.struct
-combinators.smart compiler.tree.debugger math libc destructors
-sequences.private multiline eval words vocabs namespaces
-assocs prettyprint alien.data math.vectors definitions
-compiler.test ;
-FROM: alien.c-types => float ;
 
 SPECIALIZED-ARRAY: int
 SPECIALIZED-ARRAYS: bool ushort char uint float ulonglong ;
@@ -26,10 +27,10 @@ SPECIALIZED-ARRAYS: bool ushort char uint float ulonglong ;
 ] unit-test
 
 [ ushort-array{ 1234 } ] [
-    little-endian? B{ 210 4 } B{ 4 210 } ? byte-array>ushort-array
+    little-endian? B{ 210 4 } B{ 4 210 } ? ushort-array-cast
 ] unit-test
 
-[ B{ 210 4 1 } byte-array>ushort-array ] must-fail
+[ B{ 210 4 1 } ushort-array-cast ] must-fail
 
 [ { 3 1 3 3 7 } ] [
     int-array{ 3 1 3 3 7 } malloc-byte-array 5 <direct-int-array> >array
@@ -100,6 +101,12 @@ SPECIALIZED-ARRAY: test-struct
     } second
 ] unit-test
 
+[ ] [
+    [
+        test-struct specialized-array-vocab forget-vocab
+    ] with-compilation-unit
+] unit-test
+
 ! Regression
 STRUCT: fixed-string { text char[64] } ;
 
@@ -114,6 +121,12 @@ SPECIALIZED-ARRAY: fixed-string
     ALIEN: 123 100 <direct-int-array> byte-length
 ] unit-test
 
+[ ] [
+    [
+        fixed-string specialized-array-vocab forget-vocab
+    ] with-compilation-unit
+] unit-test
+
 ! Test prettyprinting
 [ "int-array{ 1 2 3 }" ] [ int-array{ 1 2 3 } unparse ] unit-test
 [ "int-array@ f 100" ] [ f 100 <direct-int-array> unparse ] unit-test
@@ -171,3 +184,10 @@ SPECIALIZED-ARRAY: struct-resize-test
 [ 80 ] [ 10 <struct-resize-test-array> byte-length ] unit-test
 
 [ { 10 20 30 } ] [ { 10 20 30 } struct-resize-test-usage ] unit-test
+
+[ ] [
+    [
+        struct-resize-test specialized-array-vocab forget-vocab
+        \ struct-resize-test-usage forget
+    ] with-compilation-unit
+] unit-test
index fe2a93844cf9ccf8f034fd8e78b7c2810bd160dc..dc070f99b4a453c1770296f42dfcf9573aa6cc01 100644 (file)
@@ -34,19 +34,15 @@ M: not-a-byte-array summary
 
 FUNCTOR: define-array ( T -- )
 
-A            DEFINES-CLASS ${T}-array
-<A>          DEFINES <${A}>
-(A)          DEFINES (${A})
-<direct-A>   DEFINES <direct-${A}>
-malloc-A     DEFINES malloc-${A}
->A           DEFINES >${A}
-byte-array>A DEFINES byte-array>${A}
-
-A{           DEFINES ${A}{
-A@           DEFINES ${A}@
-
-NTH          [ T dup c-type-getter-boxer array-accessor ]
-SET-NTH      [ T dup c-setter array-accessor ]
+A          DEFINES-CLASS ${T}-array
+<A>        DEFINES <${A}>
+(A)        DEFINES (${A})
+<direct-A> DEFINES <direct-${A}>
+malloc-A   DEFINES malloc-${A}
+>A         DEFINES >${A}
+A-cast     DEFINES ${A}-cast
+A{         DEFINES ${A}{
+A@         DEFINES ${A}@
 
 WHERE
 
@@ -65,20 +61,17 @@ TUPLE: A
 : malloc-A ( len -- specialized-array )
     [ \ T heap-size calloc ] keep <direct-A> ; inline
 
-: byte-array>A ( byte-array -- specialized-array )
-    >c-ptr dup byte-array? [
-        dup length \ T heap-size /mod 0 =
-        [ <direct-A> ]
-        [ drop \ T bad-byte-array-length ] if
-    ] [ not-a-byte-array ] if ; inline
+: A-cast ( byte-array -- specialized-array )
+    binary-object \ T heap-size /mod 0 =
+    [ <direct-A> ] [ drop \ T bad-byte-array-length ] if ; inline
 
 M: A clone [ underlying>> clone ] [ length>> ] bi <direct-A> ; inline
 
 M: A length length>> ; inline
 
-M: A nth-unsafe underlying>> NTH call ; inline
+M: A nth-unsafe underlying>> \ T alien-element ; inline
 
-M: A set-nth-unsafe underlying>> SET-NTH call ; inline
+M: A set-nth-unsafe underlying>> \ T set-alien-element ; inline
 
 : >A ( seq -- specialized-array ) A new clone-like ;
 
@@ -95,7 +88,7 @@ M: A resize
     ] [ drop ] 2bi
     <direct-A> ; inline
 
-M: A byte-length length \ T heap-size * ; inline
+M: A element-size drop \ T heap-size ; inline
 
 M: A direct-array-syntax drop \ A@ ;
 
@@ -116,15 +109,19 @@ M: A v*high [ * \ T heap-size neg shift ] 2map ; inline
 
 ;FUNCTOR
 
-: (underlying-type) ( word -- c-type ) "c-type" word-prop ; inline
+GENERIC: underlying-type ( c-type -- c-type' )
 
-: underlying-type ( c-type -- c-type' )
-    dup (underlying-type) {
+M: c-type-word underlying-type
+    dup "c-type" word-prop {
         { [ dup not ] [ drop no-c-type ] }
-        { [ dup c-type-name? ] [ nip underlying-type ] }
+        { [ dup pointer? ] [ 2drop void* ] }
+        { [ dup c-type-word? ] [ nip underlying-type ] }
         [ drop ]
     } cond ;
 
+M: pointer underlying-type
+    drop void* ;
+
 : specialized-array-vocab ( c-type -- vocab )
     [
         "specialized-arrays.instances." %
@@ -140,35 +137,35 @@ PRIVATE>
     [ specialized-array-vocab ] [ '[ _ define-array ] ] bi
     generate-vocab ;
 
-M: c-type-name require-c-array define-array-vocab drop ;
-
 ERROR: specialized-array-vocab-not-loaded c-type ;
 
-M: c-type-name c-array-constructor
+M: c-type-word c-array-constructor
     underlying-type
     dup [ name>> "<" "-array>" surround ] [ specialized-array-vocab ] bi lookup
     [ ] [ specialized-array-vocab-not-loaded ] ?if ; foldable
 
-M: c-type-name c-(array)-constructor
+M: pointer c-array-constructor drop void* c-array-constructor ;
+
+M: c-type-word c-(array)-constructor
     underlying-type
     dup [ name>> "(" "-array)" surround ] [ specialized-array-vocab ] bi lookup
     [ ] [ specialized-array-vocab-not-loaded ] ?if ; foldable
 
-M: c-type-name c-direct-array-constructor
+M: pointer c-(array)-constructor drop void* c-(array)-constructor ;
+
+M: c-type-word c-direct-array-constructor
     underlying-type
     dup [ name>> "<direct-" "-array>" surround ] [ specialized-array-vocab ] bi lookup
     [ ] [ specialized-array-vocab-not-loaded ] ?if ; foldable
 
+M: pointer c-direct-array-constructor drop void* c-direct-array-constructor ;
+
 SYNTAX: SPECIALIZED-ARRAYS:
-    ";" parse-tokens [ parse-c-type define-array-vocab use-vocab ] each ;
+    ";" [ parse-c-type define-array-vocab use-vocab ] each-token ;
 
 SYNTAX: SPECIALIZED-ARRAY:
     scan-c-type define-array-vocab use-vocab ;
 
-"prettyprint" vocab [
-    "specialized-arrays.prettyprint" require
-] when
+{ "specialized-arrays" "prettyprint" } "specialized-arrays.prettyprint" require-when
 
-"mirrors" vocab [
-    "specialized-arrays.mirrors" require
-] when
+{ "specialized-arrays" "mirrors" } "specialized-arrays.mirrors" require-when
index 557ca25cd5929b4a3562cce4d1ba2f5ab6cc90e8..3352c226d8b67c0a471e279823fcd5f8bfb81885 100644 (file)
@@ -1,8 +1,8 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types alien.parser assocs
-compiler.units functors growable kernel lexer math namespaces parser
-prettyprint.custom sequences specialized-arrays
+USING: accessors alien alien.c-types alien.parser assocs
+compiler.units functors growable kernel lexer math namespaces
+parser prettyprint.custom sequences specialized-arrays
 specialized-arrays.private strings vocabs vocabs.parser
 vocabs.generated fry make ;
 QUALIFIED: vectors.functor
@@ -26,7 +26,7 @@ V A <A> vectors.functor:define-vector
 
 M: V contract 2drop ; inline
 
-M: V byte-length length \ T heap-size * ; inline
+M: V element-size drop \ T heap-size ; inline
 
 M: V pprint-delims drop \ V{ \ } ;
 
@@ -56,11 +56,11 @@ PRIVATE>
     generate-vocab ;
 
 SYNTAX: SPECIALIZED-VECTORS:
-    ";" parse-tokens [
+    ";" [
         parse-c-type
         [ define-array-vocab use-vocab ]
         [ define-vector-vocab use-vocab ] bi
-    ] each ;
+    ] each-token ;
 
 SYNTAX: SPECIALIZED-VECTOR:
     scan-c-type
index 81d8a93240dfc2ce867f3bfd0fdf9222671ae718..42c87f05b9519a8c27e76877acce8f21928ad70f 100644 (file)
@@ -1,27 +1,29 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences accessors combinators math namespaces
-init sets words assocs alien.libraries alien alien.c-types
-cpu.architecture fry stack-checker.backend stack-checker.errors
-stack-checker.visitor stack-checker.dependencies ;
+USING: kernel arrays sequences accessors combinators math
+namespaces init sets words assocs alien.libraries alien
+alien.private alien.c-types fry quotations strings
+stack-checker.backend stack-checker.errors stack-checker.visitor
+stack-checker.dependencies compiler.utilities ;
 IN: stack-checker.alien
 
-TUPLE: alien-node-params return parameters abi in-d out-d ;
+TUPLE: alien-node-params
+return parameters
+{ abi abi initial: cdecl }
+in-d
+out-d ;
 
-TUPLE: alien-invoke-params < alien-node-params library function ;
+TUPLE: alien-invoke-params < alien-node-params library { function string } ;
 
 TUPLE: alien-indirect-params < alien-node-params ;
 
-TUPLE: alien-assembly-params < alien-node-params quot ;
+TUPLE: alien-assembly-params < alien-node-params { quot callable } ;
 
-TUPLE: alien-callback-params < alien-node-params quot xt ;
+TUPLE: alien-callback-params < alien-node-params { quot callable } xt ;
 
 : param-prep-quot ( params -- quot )
     parameters>> [ c-type c-type-unboxer-quot ] map spread>quot ;
 
-: infer-params ( params -- )
-    param-prep-quot infer-quot-here ;
-
 : alien-stack ( params extra -- )
     over parameters>> length + consume-d >>in-d
     dup return>> void? 0 1 ? produce-d >>out-d
@@ -61,7 +63,7 @@ TUPLE: alien-callback-params < alien-node-params quot xt ;
     ! Set ABI
     dup library>> library-abi >>abi
     ! Quotation which coerces parameters to required types
-    dup infer-params
+    dup param-prep-quot infer-quot-here
     ! Magic #: consume exactly the number of inputs
     dup 0 alien-stack
     ! Add node to IR
@@ -75,10 +77,8 @@ TUPLE: alien-callback-params < alien-node-params quot xt ;
     pop-abi
     pop-params
     pop-return
-    ! Quotation which coerces parameters to required types
-    1 infer->r
-    dup infer-params
-    1 infer-r>
+    ! Coerce parameters to required types
+    dup param-prep-quot '[ _ [ >c-ptr ] bi* ] infer-quot-here
     ! Magic #: consume the function pointer, too
     dup 1 alien-stack
     ! Add node to IR
@@ -94,7 +94,7 @@ TUPLE: alien-callback-params < alien-node-params quot xt ;
     pop-params
     pop-return
     ! Quotation which coerces parameters to required types
-    dup infer-params
+    dup param-prep-quot infer-quot-here
     ! Magic #: consume exactly the number of inputs
     dup 0 alien-stack
     ! Add node to IR
@@ -102,12 +102,23 @@ TUPLE: alien-callback-params < alien-node-params quot xt ;
     ! Quotation which coerces return value to required type
     infer-return ;
 
-: callback-xt ( word return-rewind -- alien )
-    [ callbacks get ] dip '[ _ <callback> ] cache ;
+: callback-xt ( word -- alien )
+    callbacks get [ dup "stack-cleanup" word-prop <callback> ] cache ;
 
 : callback-bottom ( params -- )
-    [ xt>> ] [ callback-return-rewind ] bi
-    '[ _ _ callback-xt ] infer-quot-here ;
+    xt>> '[ _ callback-xt ] infer-quot-here ;
+
+: callback-return-quot ( ctype -- quot )
+    return>> [ [ ] ] [ c-type c-type-unboxer-quot ] if-void ;
+
+: callback-prep-quot ( params -- quot )
+    parameters>> [ c-type c-type-boxer-quot ] map spread>quot ;
+
+: wrap-callback-quot ( params -- quot )
+    [ callback-prep-quot ] [ quot>> ] [ callback-return-quot ] tri 3append
+     yield-hook get
+     '[ _ _ do-callback ]
+     >quotation ;
 
 : infer-alien-callback ( -- )
     alien-callback-params new
@@ -116,5 +127,6 @@ TUPLE: alien-callback-params < alien-node-params quot xt ;
     pop-params
     pop-return
     "( callback )" <uninterned-word> >>xt
+    dup wrap-callback-quot >>quot
     dup callback-bottom
     #alien-callback, ;
index b58998cb4904208e69b843995f3db6e6c4da02d1..a714ddf5ab924892cae0427114ca2e7752e035c9 100644 (file)
@@ -8,6 +8,7 @@ IN: stack-checker.backend.tests
     V{ } clone \ literals set
     H{ } clone known-values set
     0 input-count set
+    0 inner-d-index set
 ] unit-test
 
 [ 0 ] [ 0 ensure-d length ] unit-test
index 8de930a6cd7672cdab4eabebb51f1c36491aed64..7a18133efff7463117a4369910eae64a240958b6 100644 (file)
@@ -3,9 +3,11 @@
 USING: fry arrays generic io io.streams.string kernel math namespaces
 parser sequences strings vectors words quotations effects classes
 continuations assocs combinators compiler.errors accessors math.order
-definitions sets hints macros stack-checker.state
+definitions locals sets hints macros stack-checker.state
 stack-checker.visitor stack-checker.errors stack-checker.values
 stack-checker.recursive-state stack-checker.dependencies summary ;
+FROM: sequences.private => from-end ;
+FROM: namespaces => set ;
 IN: stack-checker.backend
 
 : push-d ( obj -- ) meta-d push ;
@@ -16,8 +18,13 @@ IN: stack-checker.backend
     [ #introduce, ]
     tri ;
 
+: update-inner-d ( new -- )
+    inner-d-index get min inner-d-index set ;
+
 : pop-d  ( -- obj )
-    meta-d [ <value> dup 1array introduce-values ] [ pop ] if-empty ;
+    meta-d
+    [ <value> dup 1array introduce-values ]
+    [ pop meta-d length update-inner-d ] if-empty ;
 
 : peek-d ( -- obj ) pop-d dup push-d ;
 
@@ -30,13 +37,17 @@ IN: stack-checker.backend
         [ nip >array ] [ length - make-values ] [ nip delete-all ] 2tri
         [ introduce-values ] [ meta-d push-all ] bi
         meta-d push-all
-    ] when swap tail* ;
+    ] when
+    swap from-end [ tail ] [ update-inner-d ] bi ;
 
 : shorten-by ( n seq -- )
     [ length swap - ] keep shorten ; inline
 
+: shorten-d ( n -- )
+    meta-d shorten-by meta-d length update-inner-d ;
+
 : consume-d ( n -- seq )
-    [ ensure-d ] [ meta-d shorten-by ] bi ;
+    [ ensure-d ] [ shorten-d ] bi ;
 
 : output-d ( values -- ) meta-d push-all ;
 
@@ -126,7 +137,7 @@ M: bad-call summary
 : infer-r> ( n -- )
     consume-r dup copy-values [ nip output-d ] [ #r>, ] 2bi ;
 
-: consume/produce ( effect quot: ( inputs outputs -- ) -- )
+: consume/produce ( ..a effect quot: ( ..a inputs outputs -- ..b ) -- ..b )
     '[ [ in>> length consume-d ] [ out>> length produce-d ] bi @ ]
     [ terminated?>> [ terminate ] when ]
     bi ; inline
@@ -140,13 +151,6 @@ M: bad-call summary
 : required-stack-effect ( word -- effect )
     dup stack-effect [ ] [ missing-effect ] ?if ;
 
-: infer-word ( word -- )
-    {
-        { [ dup macro? ] [ do-not-compile ] }
-        { [ dup "no-compile" word-prop ] [ do-not-compile ] }
-        [ dup required-stack-effect apply-word/effect ]
-    } cond ;
-
 : with-infer ( quot -- effect visitor )
     [
         init-inference
@@ -157,3 +161,30 @@ M: bad-call summary
         current-effect
         stack-visitor get
     ] with-scope ; inline
+
+: (infer) ( quot -- effect )
+    [ infer-quot-here ] with-infer drop ;
+
+: ?quotation-effect ( in -- effect/f )
+    dup pair? [ second dup effect? [ drop f ] unless ] [ drop f ] if ;
+
+:: declare-effect-d ( word effect variables branches n -- )
+    meta-d length :> d-length
+    n d-length < [
+        d-length 1 - n - :> n'
+        n' meta-d nth :> value
+        value known :> known
+        known word effect variables branches <declared-effect> :> known'
+        known' value set-known
+        known' branches push
+    ] [ word unknown-macro-input ] if ;
+
+:: declare-input-effects ( word -- )
+    H{ } clone :> variables
+    V{ } clone :> branches
+    word stack-effect in>> <reversed> [| in n |
+        in ?quotation-effect [| effect |
+            word effect variables branches n declare-effect-d
+        ] when*
+    ] each-index ;
+
index 99e5a7040943bbab03c5902bc682fdb0adeef1b0..77e983eefbd00c240936d1cf93a3ef0113514890 100644 (file)
@@ -1,9 +1,10 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov, Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: fry vectors sequences assocs math math.order accessors kernel
-combinators quotations namespaces grouping stack-checker.state
+USING: arrays effects fry vectors sequences assocs math math.order accessors kernel
+combinators quotations namespaces grouping locals stack-checker.state
 stack-checker.backend stack-checker.errors stack-checker.visitor
 stack-checker.values stack-checker.recursive-state ;
+FROM: sequences.private => dispatch ;
 IN: stack-checker.branches
 
 : balanced? ( pairs -- ? )
@@ -43,14 +44,20 @@ SYMBOLS: +bottom+ +top+ ;
 : phi-outputs ( phi-in -- stack )
     flip [ unify-values ] map ;
 
-SYMBOL: quotations
+SYMBOLS: combinator quotations ;
+
+: simple-unbalanced-branches-error ( word quots branches -- * )
+    [ length [ (( ..a -- ..b )) ] replicate ]
+    [ [ length [ "x" <array> ] bi@ <effect> ] { } assoc>map ] bi
+    unbalanced-branches-error ;
 
 : unify-branches ( ins stacks -- in phi-in phi-out )
     zip [ 0 { } { } ] [
         [ keys supremum ] [ ] [ balanced? ] tri
-        [ dupd phi-inputs dup phi-outputs ]
-        [ quotations get unbalanced-branches-error ]
-        if
+        [ dupd phi-inputs dup phi-outputs ] [
+            [ combinator get quotations get ] dip
+            simple-unbalanced-branches-error
+        ] if
     ] if-empty ;
 
 : branch-variable ( seq symbol -- seq )
@@ -61,7 +68,9 @@ SYMBOL: quotations
     branch-variable ;
 
 : datastack-phi ( seq -- phi-in phi-out )
-    [ input-count branch-variable ] [ \ meta-d active-variable ] bi
+    [ input-count branch-variable ]
+    [ inner-d-index branch-variable infimum inner-d-index set ]
+    [ \ meta-d active-variable ] tri
     unify-branches
     [ input-count set ] [ ] [ dup >vector \ meta-d set ] tri* ;
 
@@ -80,7 +89,8 @@ SYMBOL: quotations
 : copy-inference ( -- )
     \ meta-d [ clone ] change
     literals [ clone ] change
-    input-count [ ] change ;
+    input-count [ ] change
+    inner-d-index [ ] change ;
 
 GENERIC: infer-branch ( literal -- namespace )
 
@@ -91,6 +101,9 @@ M: literal infer-branch
         [ value>> quotation set ] [ infer-literal-quot ] bi
     ] H{ } make-assoc ;
 
+M: declared-effect infer-branch
+    known>> infer-branch ;
+
 M: callable infer-branch
     [
         copy-inference
@@ -107,12 +120,26 @@ M: callable infer-branch
     infer-branches
     [ first2 #if, ] dip compute-phi-function ;
 
+GENERIC: curried/composed? ( known -- ? )
+M: object curried/composed? drop f ;
+M: curried curried/composed? drop t ;
+M: composed curried/composed? drop t ;
+M: declared-effect curried/composed? known>> curried/composed? ;
+
+: declare-if-effects ( -- )
+    H{ } clone V{ } clone
+    [ [ \ if (( ..a -- ..b )) ] 2dip 0 declare-effect-d ]
+    [ [ \ if (( ..a -- ..b )) ] 2dip 1 declare-effect-d ] 2bi ;
+
 : infer-if ( -- )
+    \ if combinator set
     2 literals-available? [
         (infer-if)
     ] [
-        drop 2 consume-d
-        dup [ known [ curried? ] [ composed? ] bi or ] any? [
+        drop 2 ensure-d
+        declare-if-effects
+        2 shorten-d
+        dup [ known curried/composed? ] any? [
             output-d
             [ rot [ drop call ] [ nip call ] if ]
             infer-quot-here
@@ -122,5 +149,6 @@ M: callable infer-branch
     ] if ;
 
 : infer-dispatch ( -- )
+    \ dispatch combinator set
     pop-literal nip infer-branches
     [ #dispatch, ] dip compute-phi-function ;
index 25fe12cbc5890b211f930d8a4413ff0231fb245e..50d5ff6189f70932793d083f2692d40247c8011e 100644 (file)
@@ -5,6 +5,7 @@ generic kernel math namespaces sequences words sets
 combinators.short-circuit classes.tuple alien.c-types ;
 FROM: classes.tuple.private => tuple-layout ;
 FROM: assocs => change-at ;
+FROM: namespaces => set ;
 IN: stack-checker.dependencies
 
 ! Words that the current quotation depends on
@@ -47,6 +48,9 @@ M: c-type-word depends-on-c-type depends-on-definition ;
 M: array depends-on-c-type
     [ word? ] filter [ depends-on-definition ] each ;
 
+M: pointer depends-on-c-type
+    to>> depends-on-c-type ;
+
 ! Generic words that the current quotation depends on
 SYMBOL: generic-dependencies
 
@@ -138,7 +142,7 @@ TUPLE: depends-on-final class ;
     [ \ depends-on-final add-conditional-dependency ] bi ;
 
 M: depends-on-final satisfied?
-    class>> final-class? ;
+    class>> { [ class? ] [ final-class? ] } 1&& ;
 
 : init-dependencies ( -- )
     H{ } clone dependencies set
index 9aa7ed0d14538fa2a9b440ab06a0c92186358b66..4f1bb28c5e31d19357eadcd2ffce468a66bf8f8c 100644 (file)
@@ -63,15 +63,16 @@ HELP: bad-macro-input
 } ;
 
 HELP: unbalanced-branches-error
-{ $values { "in" "a sequence of integers" } { "out" "a sequence of integers" } }
-{ $description "Throws an " { $link unbalanced-branches-error } "." }
-{ $error-description "Thrown when inference encounters an " { $link if } " or " { $link dispatch } " where the branches do not all exit with the same stack height. See " { $link "inference-branches" } " for details." }
-{ $notes "If this error comes up when inferring the stack effect of a recursive word, check the word's stack effect declaration; it might be wrong." }
+{ $error-description "Thrown when inference encounters an inline combinator whose input quotations do not match their declared effects, or when it encounters an " { $link if } " or " { $link dispatch } " whose branches do not all exit with the same stack height. See " { $link "inference-combinators" } " and " { $link "inference-branches" } " for details." }
 { $examples
     { $code
-        ": unbalanced-branches-example ( a b c -- )"
+        ": if-unbalanced-branches-example ( a b c -- )"
         "    [ + ] [ dup ] if ;"
     }
+    { $code
+        ": each-unbalanced-branches-example ( x seq -- x' )"
+        "    [ 3append ] each ;"
+    }
 } ;
 
 HELP: too-many->r
index ff06b2ac2749ca55ee190c2c449a437684372f70..f3aeb7bb648e2cc0b9892e2af3b9285a6a1f5f17 100644 (file)
@@ -1,5 +1,6 @@
-! Copyright (C) 2006, 2009 Slava Pestov.
+! Copyright (C) 2006, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
+USING: vocabs.loader ;
 IN: stack-checker.errors
 
 TUPLE: inference-error ;
@@ -10,8 +11,6 @@ ERROR: bad-macro-input < inference-error macro ;
 
 ERROR: unknown-macro-input < inference-error macro ;
 
-ERROR: unbalanced-branches-error < inference-error branches quots ;
-
 ERROR: too-many->r < inference-error ;
 
 ERROR: too-many-r> < inference-error ;
@@ -32,4 +31,8 @@ ERROR: inconsistent-recursive-call-error < inference-error word ;
 
 ERROR: transform-expansion-error < inference-error error continuation word ;
 
-ERROR: bad-declaration-error < inference-error declaration ;
\ No newline at end of file
+ERROR: bad-declaration-error < inference-error declaration ;
+
+ERROR: unbalanced-branches-error < inference-error word quots declareds actuals ;
+
+{ "stack-checker.errors" "debugger" } "stack-checker.errors.prettyprint" require-when
index f762e0559b11dd5545eb1bcdd5dac55f9a0a2000..3d4480a4aa9ba21b7d893e2a15891e04db49de6d 100644 (file)
@@ -10,14 +10,6 @@ M: unknown-macro-input summary
 M: bad-macro-input summary
     macro>> name>> "Cannot apply “" "” to a run-time computed value" surround ;
 
-M: unbalanced-branches-error summary
-    drop "Unbalanced branches" ;
-
-M: unbalanced-branches-error error.
-    dup summary print
-    [ quots>> ] [ branches>> [ length [ "x" <array> ] bi@ <effect> ] { } assoc>map ] bi zip
-    [ [ first pprint-short bl ] [ second effect>string print ] bi ] each ;
-
 M: too-many->r summary
     drop "Quotation pushes elements on retain stack without popping them" ;
 
@@ -35,23 +27,23 @@ M: recursive-quotation-error summary
 
 M: undeclared-recursion-error summary
     word>> name>>
-    "The inline recursive word " " must be declared recursive" surround ;
+    "The inline recursive word “" "” must be declared recursive" surround ;
 
 M: diverging-recursion-error summary
     word>> name>>
-    "The recursive word " " digs arbitrarily deep into the stack" surround ;
+    "The recursive word “" "” digs arbitrarily deep into the stack" surround ;
 
 M: unbalanced-recursion-error summary
     word>> name>>
-    "The recursive word " " leaves with the stack having the wrong height" surround ;
+    "The recursive word “" "” leaves with the stack having the wrong height" surround ;
 
 M: inconsistent-recursive-call-error summary
     word>> name>>
-    "The recursive word "
-    " calls itself with a different set of quotation parameters than were input" surround ;
+    "The recursive word "
+    " calls itself with a different set of quotation parameters than were input" surround ;
 
 M: transform-expansion-error summary
-    word>> name>> "Macro expansion of " " threw an error" surround ;
+    word>> name>> "Macro expansion of “" "” threw an error" surround ;
 
 M: transform-expansion-error error.
     [ summary print ]
@@ -60,4 +52,13 @@ M: transform-expansion-error error.
     tri ;
 
 M: do-not-compile summary
-    word>> name>> "Cannot compile call to " prepend ;
\ No newline at end of file
+    word>> name>> "Cannot compile call to “" "”" surround ;
+
+M: unbalanced-branches-error summary
+    word>> name>>
+    "The input quotations to “" "” don't match their expected effects" surround ;
+
+M: unbalanced-branches-error error.
+    dup summary print
+    [ quots>> ] [ declareds>> ] [ actuals>> ] tri 3array flip
+    { "Input" "Expected" "Got" } prefix simple-table. ;
index 4197aa00a26900ce278911ee0c02536d3e3d7722..697e66840971f769d700096ad81d0d1603b97959 100644 (file)
@@ -11,6 +11,7 @@ stack-checker.backend
 stack-checker.branches
 stack-checker.known-words
 stack-checker.dependencies
+stack-checker.row-polymorphism
 stack-checker.recursive-state ;
 IN: stack-checker.inlining
 
@@ -118,9 +119,15 @@ SYMBOL: enter-out
 : trimmed-enter-out ( label -- stack )
     dup enter-out>> trim-stack ;
 
+GENERIC: (undeclared-known) ( value -- known )
+M: object (undeclared-known) ;
+M: declared-effect (undeclared-known) known>> (undeclared-known) ;
+
+: undeclared-known ( value -- known ) known (undeclared-known) ;
+
 : check-call-site-stack ( label -- )
     [ ] [ call-site-stack ] [ trimmed-enter-out ] tri
-    [ dup known [ [ known ] bi@ = ] [ 2drop t ] if ] 2all?
+    [ dup undeclared-known [ [ undeclared-known ] bi@ = ] [ 2drop t ] if ] 2all?
     [ drop ] [ word>> inconsistent-recursive-call-error inference-error ] if ;
 
 : check-call ( label -- )
@@ -141,6 +148,7 @@ SYMBOL: enter-out
 : inline-word ( word -- )
     commit-literals
     [ depends-on-definition ]
+    [ declare-input-effects ]
     [
         dup inline-recursive-label [
             call-recursive-inline-word
@@ -150,7 +158,7 @@ SYMBOL: enter-out
             [ dup infer-inline-word-def ]
             if
         ] if*
-    ] bi ;
+    ] tri ;
 
 M: word apply-object
     dup inline? [ inline-word ] [ non-inline-word ] if ;
index 4bf7dfe0fd98570a2946b7c2117df2d8c8858aac..a652c500bac5ff180c03e3d415900abba46f61fd 100644 (file)
@@ -1,19 +1,20 @@
 ! Copyright (C) 2004, 2010 Slava Pestov, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: fry accessors alien alien.accessors arrays byte-arrays
-classes continuations.private effects generic hashtables
-hashtables.private io io.backend io.files io.files.private
-io.streams.c kernel kernel.private math math.private
-math.parser.private memory memory.private namespaces
-namespaces.private parser quotations quotations.private sbufs
-sbufs.private sequences sequences.private slots.private strings
-strings.private system threads.private classes.tuple
-classes.tuple.private vectors vectors.private words
-words.private definitions assocs summary compiler.units
-system.private combinators combinators.short-circuit locals
-locals.backend locals.types combinators.private
-stack-checker.values generic.single generic.single.private
-alien.libraries tools.dispatch.private tools.profiler.private
+USING: fry accessors alien alien.accessors alien.private arrays
+byte-arrays classes continuations.private effects generic
+hashtables hashtables.private io io.backend io.files
+io.files.private io.streams.c kernel kernel.private math
+math.private math.parser.private memory memory.private
+namespaces namespaces.private parser quotations
+quotations.private sbufs sbufs.private sequences
+sequences.private slots.private strings strings.private system
+threads.private classes.tuple classes.tuple.private vectors
+vectors.private words words.private definitions assocs summary
+compiler.units system.private combinators
+combinators.short-circuit locals locals.backend locals.types
+combinators.private stack-checker.values generic.single
+generic.single.private alien.libraries tools.dispatch.private
+tools.profiler.private macros
 stack-checker.alien
 stack-checker.state
 stack-checker.errors
@@ -22,14 +23,41 @@ stack-checker.backend
 stack-checker.branches
 stack-checker.transforms
 stack-checker.dependencies
-stack-checker.recursive-state ;
+stack-checker.recursive-state
+stack-checker.row-polymorphism ;
 IN: stack-checker.known-words
 
-: infer-primitive ( word -- )
-    dup
-    [ "input-classes" word-prop ]
-    [ "default-output-classes" word-prop ] bi <effect>
-    apply-word/effect ;
+: infer-special ( word -- )
+    [ current-word set ] [ "special" word-prop call( -- ) ] bi ;
+
+: infer-shuffle ( shuffle -- )
+    [ in>> length consume-d ] keep ! inputs shuffle
+    [ drop ] [ shuffle dup copy-values dup output-d ] 2bi ! inputs outputs copies
+    [ nip f f ] [ swap zip ] 2bi ! in-d out-d in-r out-r mapping
+    #shuffle, ;
+
+: infer-shuffle-word ( word -- )
+    "shuffle" word-prop infer-shuffle ;
+
+: infer-local-reader ( word -- )
+    (( -- value )) apply-word/effect ;
+
+: infer-local-writer ( word -- )
+    (( value -- )) apply-word/effect ;
+
+: non-inline-word ( word -- )
+    dup depends-on-effect
+    {
+        { [ dup "shuffle" word-prop ] [ infer-shuffle-word ] }
+        { [ dup "special" word-prop ] [ infer-special ] }
+        { [ dup "transform-quot" word-prop ] [ apply-transform ] }
+        { [ dup macro? ] [ apply-macro ] }
+        { [ dup local? ] [ infer-local-reader ] }
+        { [ dup local-reader? ] [ infer-local-reader ] }
+        { [ dup local-writer? ] [ infer-local-writer ] }
+        { [ dup "no-compile" word-prop ] [ do-not-compile ] }
+        [ dup required-stack-effect apply-word/effect ]
+    } cond ;
 
 {
     { drop  (( x     --             )) }
@@ -49,15 +77,6 @@ IN: stack-checker.known-words
     { swap  (( x y   -- y x         )) }
 } [ "shuffle" set-word-prop ] assoc-each
 
-: infer-shuffle ( shuffle -- )
-    [ in>> length consume-d ] keep ! inputs shuffle
-    [ drop ] [ shuffle dup copy-values dup output-d ] 2bi ! inputs outputs copies
-    [ nip f f ] [ swap zip ] 2bi ! in-d out-d in-r out-r mapping
-    #shuffle, ;
-
-: infer-shuffle-word ( word -- )
-    "shuffle" word-prop infer-shuffle ;
-
 : check-declaration ( declaration -- declaration )
     dup { [ array? ] [ [ class? ] all? ] } 1&&
     [ bad-declaration-error ] unless ;
@@ -98,6 +117,9 @@ M: composed infer-call*
     1 infer->r infer-call
     terminated? get [ 1 infer-r> infer-call ] unless ;
 
+M: declared-effect infer-call*
+    [ [ known>> infer-call* ] keep ] with-effect-here check-declared-effect ;
+
 M: input-parameter infer-call* \ call unknown-macro-input ;
 M: object infer-call* \ call bad-macro-input ;
 
@@ -175,11 +197,6 @@ M: bad-executable summary
 
 \ call-effect-unsafe [ infer-call-effect-unsafe ] "special" set-word-prop
 
-: infer-exit ( -- )
-    \ exit (( n -- * )) apply-word/effect ;
-
-\ exit [ infer-exit ] "special" set-word-prop
-
 : infer-load-locals ( -- )
     pop-literal nip
     consume-d dup copy-values dup output-r
@@ -242,25 +259,12 @@ M: bad-executable summary
     unwind-native-frames
     lazy-jit-compile
     c-to-factor
-    call-clear
 } [ dup '[ _ do-not-compile ] "special" set-word-prop ] each
 
-: infer-special ( word -- )
-    [ current-word set ] [ "special" word-prop call( -- ) ] bi ;
-
-: infer-local-reader ( word -- )
-    (( -- value )) apply-word/effect ;
-
-: infer-local-writer ( word -- )
-    (( value -- )) apply-word/effect ;
-
-: infer-local-word ( word -- )
-    "local-word-def" word-prop infer-quot-here ;
-
 {
     declare call (call) dip 2dip 3dip curry compose
     execute (execute) call-effect-unsafe execute-effect-unsafe if
-    dispatch <tuple-boa> exit load-local load-locals get-local
+    dispatch <tuple-boa> load-local load-locals get-local
     drop-locals do-primitive alien-invoke alien-indirect
     alien-callback
 } [ t "no-compile" set-word-prop ] each
@@ -272,471 +276,190 @@ M: bad-executable summary
 ! More words not to compile
 \ clear t "no-compile" set-word-prop
 
-: non-inline-word ( word -- )
-    dup depends-on-effect
-    {
-        { [ dup "shuffle" word-prop ] [ infer-shuffle-word ] }
-        { [ dup "special" word-prop ] [ infer-special ] }
-        { [ dup "primitive" word-prop ] [ infer-primitive ] }
-        { [ dup "transform-quot" word-prop ] [ apply-transform ] }
-        { [ dup "macro" word-prop ] [ apply-macro ] }
-        { [ dup local? ] [ infer-local-reader ] }
-        { [ dup local-reader? ] [ infer-local-reader ] }
-        { [ dup local-writer? ] [ infer-local-writer ] }
-        { [ dup local-word? ] [ infer-local-word ] }
-        [ infer-word ]
-    } cond ;
-
 : define-primitive ( word inputs outputs -- )
-    [ 2drop t "primitive" set-word-prop ]
-    [ drop "input-classes" set-word-prop ]
-    [ nip "default-output-classes" set-word-prop ]
-    3tri ;
+    [ "input-classes" set-word-prop ]
+    [ "default-output-classes" set-word-prop ]
+    bi-curry* bi ;
 
 ! Stack effects for all primitives
-\ fixnum< { fixnum fixnum } { object } define-primitive
-\ fixnum< make-foldable
-
-\ fixnum<= { fixnum fixnum } { object } define-primitive
-\ fixnum<= make-foldable
-
-\ fixnum> { fixnum fixnum } { object } define-primitive
-\ fixnum> make-foldable
-
-\ fixnum>= { fixnum fixnum } { object } define-primitive
-\ fixnum>= make-foldable
-
-\ eq? { object object } { object } define-primitive
-\ eq? make-foldable
-
-\ bignum>fixnum { bignum } { fixnum } define-primitive
-\ bignum>fixnum make-foldable
-
-\ float>fixnum { float } { fixnum } define-primitive
-\ bignum>fixnum make-foldable
-
-\ fixnum>bignum { fixnum } { bignum } define-primitive
-\ fixnum>bignum make-foldable
-
-\ float>bignum { float } { bignum } define-primitive
-\ float>bignum make-foldable
-
-\ fixnum>float { fixnum } { float } define-primitive
-\ fixnum>float make-foldable
-
-\ bignum>float { bignum } { float } define-primitive
-\ bignum>float make-foldable
-
-\ (float>string) { float } { byte-array } define-primitive
-\ (float>string) make-foldable
-
-\ float>bits { real } { integer } define-primitive
-\ float>bits make-foldable
-
-\ double>bits { real } { integer } define-primitive
-\ double>bits make-foldable
-
-\ bits>float { integer } { float } define-primitive
-\ bits>float make-foldable
-
-\ bits>double { integer } { float } define-primitive
-\ bits>double make-foldable
-
-\ both-fixnums? { object object } { object } define-primitive
-
-\ fixnum+ { fixnum fixnum } { integer } define-primitive
-\ fixnum+ make-foldable
-
-\ fixnum+fast { fixnum fixnum } { fixnum } define-primitive
-\ fixnum+fast make-foldable
-
-\ fixnum- { fixnum fixnum } { integer } define-primitive
-\ fixnum- make-foldable
-
-\ fixnum-fast { fixnum fixnum } { fixnum } define-primitive
-\ fixnum-fast make-foldable
-
-\ fixnum* { fixnum fixnum } { integer } define-primitive
-\ fixnum* make-foldable
-
-\ fixnum*fast { fixnum fixnum } { fixnum } define-primitive
-\ fixnum*fast make-foldable
-
-\ fixnum/i { fixnum fixnum } { integer } define-primitive
-\ fixnum/i make-foldable
-
-\ fixnum/i-fast { fixnum fixnum } { fixnum } define-primitive
-\ fixnum/i-fast make-foldable
-
-\ fixnum-mod { fixnum fixnum } { fixnum } define-primitive
-\ fixnum-mod make-foldable
-
-\ fixnum/mod { fixnum fixnum } { integer fixnum } define-primitive
-\ fixnum/mod make-foldable
-
-\ fixnum/mod-fast { fixnum fixnum } { fixnum fixnum } define-primitive
-\ fixnum/mod-fast make-foldable
-
-\ fixnum-bitand { fixnum fixnum } { fixnum } define-primitive
-\ fixnum-bitand make-foldable
-
-\ fixnum-bitor { fixnum fixnum } { fixnum } define-primitive
-\ fixnum-bitor make-foldable
-
-\ fixnum-bitxor { fixnum fixnum } { fixnum } define-primitive
-\ fixnum-bitxor make-foldable
-
-\ fixnum-bitnot { fixnum } { fixnum } define-primitive
-\ fixnum-bitnot make-foldable
-
-\ fixnum-shift { fixnum fixnum } { integer } define-primitive
-\ fixnum-shift make-foldable
-
-\ fixnum-shift-fast { fixnum fixnum } { fixnum } define-primitive
-\ fixnum-shift-fast make-foldable
-
-\ bignum= { bignum bignum } { object } define-primitive
-\ bignum= make-foldable
-
-\ bignum+ { bignum bignum } { bignum } define-primitive
-\ bignum+ make-foldable
-
-\ bignum- { bignum bignum } { bignum } define-primitive
-\ bignum- make-foldable
-
-\ bignum* { bignum bignum } { bignum } define-primitive
-\ bignum* make-foldable
-
-\ bignum/i { bignum bignum } { bignum } define-primitive
-\ bignum/i make-foldable
-
-\ bignum-mod { bignum bignum } { bignum } define-primitive
-\ bignum-mod make-foldable
-
-\ bignum/mod { bignum bignum } { bignum bignum } define-primitive
-\ bignum/mod make-foldable
-
-\ bignum-bitand { bignum bignum } { bignum } define-primitive
-\ bignum-bitand make-foldable
-
-\ bignum-bitor { bignum bignum } { bignum } define-primitive
-\ bignum-bitor make-foldable
-
-\ bignum-bitxor { bignum bignum } { bignum } define-primitive
-\ bignum-bitxor make-foldable
-
-\ bignum-bitnot { bignum } { bignum } define-primitive
-\ bignum-bitnot make-foldable
-
-\ bignum-shift { bignum fixnum } { bignum } define-primitive
-\ bignum-shift make-foldable
-
-\ bignum< { bignum bignum } { object } define-primitive
-\ bignum< make-foldable
-
-\ bignum<= { bignum bignum } { object } define-primitive
-\ bignum<= make-foldable
-
-\ bignum> { bignum bignum } { object } define-primitive
-\ bignum> make-foldable
-
-\ bignum>= { bignum bignum } { object } define-primitive
-\ bignum>= make-foldable
-
-\ bignum-bit? { bignum integer } { object } define-primitive
-\ bignum-bit? make-foldable
-
-\ bignum-log2 { bignum } { bignum } define-primitive
-\ bignum-log2 make-foldable
-
-\ byte-array>bignum { byte-array } { bignum } define-primitive
-\ byte-array>bignum make-foldable
-
-\ float= { float float } { object } define-primitive
-\ float= make-foldable
-
-\ float+ { float float } { float } define-primitive
-\ float+ make-foldable
-
-\ float- { float float } { float } define-primitive
-\ float- make-foldable
-
-\ float* { float float } { float } define-primitive
-\ float* make-foldable
-
-\ float/f { float float } { float } define-primitive
-\ float/f make-foldable
-
-\ float-mod { float float } { float } define-primitive
-\ float-mod make-foldable
-
-\ float< { float float } { object } define-primitive
-\ float< make-foldable
-
-\ float<= { float float } { object } define-primitive
-\ float<= make-foldable
-
-\ float> { float float } { object } define-primitive
-\ float> make-foldable
-
-\ float>= { float float } { object } define-primitive
-\ float>= make-foldable
-
-\ float-u< { float float } { object } define-primitive
-\ float-u< make-foldable
-
-\ float-u<= { float float } { object } define-primitive
-\ float-u<= make-foldable
-
-\ float-u> { float float } { object } define-primitive
-\ float-u> make-foldable
-
-\ float-u>= { float float } { object } define-primitive
-\ float-u>= make-foldable
-
-\ (word) { object object object } { word } define-primitive
-\ (word) make-flushable
-
-\ word-code { word } { integer integer } define-primitive
-\ word-code make-flushable
-
-\ special-object { fixnum } { object } define-primitive
-\ special-object make-flushable
-
-\ set-special-object { object fixnum } { } define-primitive
-
+\ (byte-array) { integer } { byte-array } define-primitive \ (byte-array) make-flushable
+\ (clone) { object } { object } define-primitive \ (clone) make-flushable
+\ (code-blocks) { } { array } define-primitive \ (code-blocks)  make-flushable
+\ (dlopen) { byte-array } { dll } define-primitive
+\ (dlsym) { byte-array object } { c-ptr } define-primitive
 \ (exists?) { string } { object } define-primitive
-
-\ minor-gc { } { } define-primitive
-
-\ gc { } { } define-primitive
-
-\ compact-gc { } { } define-primitive
-
+\ (exit) { integer } { } define-primitive
+\ (format-float) { float byte-array } { byte-array } define-primitive \ (format-float) make-foldable
+\ (fopen) { byte-array byte-array } { alien } define-primitive
+\ (identity-hashcode) { object } { fixnum } define-primitive
 \ (save-image) { byte-array byte-array } { } define-primitive
-
 \ (save-image-and-exit) { byte-array byte-array } { } define-primitive
-
-\ data-room { } { byte-array } define-primitive
-\ data-room make-flushable
-
-\ (code-blocks) { } { array } define-primitive
-\ (code-blocks)  make-flushable
-
-\ code-room { } { byte-array } define-primitive
-\ code-room  make-flushable
-
-\ system-micros { } { integer } define-primitive
-\ system-micros make-flushable
-
-\ nano-count { } { integer } define-primitive
-\ nano-count make-flushable
-
-\ tag { object } { fixnum } define-primitive
-\ tag make-foldable
-
-\ (dlopen) { byte-array } { dll } define-primitive
-
-\ (dlsym) { byte-array object } { c-ptr } define-primitive
-
-\ dlclose { dll } { } define-primitive
-
-\ <byte-array> { integer } { byte-array } define-primitive
-\ <byte-array> make-flushable
-
-\ (byte-array) { integer } { byte-array } define-primitive
-\ (byte-array) make-flushable
-
-\ <displaced-alien> { integer c-ptr } { c-ptr } define-primitive
-\ <displaced-alien> make-flushable
-
-\ alien-signed-cell { c-ptr integer } { integer } define-primitive
-\ alien-signed-cell make-flushable
-
-\ set-alien-signed-cell { integer c-ptr integer } { } define-primitive
-
-\ alien-unsigned-cell { c-ptr integer } { integer } define-primitive
-\ alien-unsigned-cell make-flushable
-
-\ set-alien-unsigned-cell { integer c-ptr integer } { } define-primitive
-
-\ alien-signed-8 { c-ptr integer } { integer } define-primitive
-\ alien-signed-8 make-flushable
-
-\ set-alien-signed-8 { integer c-ptr integer } { } define-primitive
-
-\ alien-unsigned-8 { c-ptr integer } { integer } define-primitive
-\ alien-unsigned-8 make-flushable
-
-\ set-alien-unsigned-8 { integer c-ptr integer } { } define-primitive
-
-\ alien-signed-4 { c-ptr integer } { integer } define-primitive
-\ alien-signed-4 make-flushable
-
-\ set-alien-signed-4 { integer c-ptr integer } { } define-primitive
-
-\ alien-unsigned-4 { c-ptr integer } { integer } define-primitive
-\ alien-unsigned-4 make-flushable
-
-\ set-alien-unsigned-4 { integer c-ptr integer } { } define-primitive
-
-\ alien-signed-2 { c-ptr integer } { fixnum } define-primitive
-\ alien-signed-2 make-flushable
-
-\ set-alien-signed-2 { integer c-ptr integer } { } define-primitive
-
-\ alien-unsigned-2 { c-ptr integer } { fixnum } define-primitive
-\ alien-unsigned-2 make-flushable
-
-\ set-alien-unsigned-2 { integer c-ptr integer } { } define-primitive
-
-\ alien-signed-1 { c-ptr integer } { fixnum } define-primitive
-\ alien-signed-1 make-flushable
-
-\ set-alien-signed-1 { integer c-ptr integer } { } define-primitive
-
-\ alien-unsigned-1 { c-ptr integer } { fixnum } define-primitive
-\ alien-unsigned-1 make-flushable
-
-\ set-alien-unsigned-1 { integer c-ptr integer } { } define-primitive
-
-\ alien-float { c-ptr integer } { float } define-primitive
-\ alien-float make-flushable
-
-\ set-alien-float { float c-ptr integer } { } define-primitive
-
-\ alien-double { c-ptr integer } { float } define-primitive
-\ alien-double make-flushable
-
-\ set-alien-double { float c-ptr integer } { } define-primitive
-
-\ alien-cell { c-ptr integer } { pinned-c-ptr } define-primitive
-\ alien-cell make-flushable
-
-\ set-alien-cell { c-ptr c-ptr integer } { } define-primitive
-
-\ alien-address { alien } { integer } define-primitive
-\ alien-address make-flushable
-
-\ slot { object fixnum } { object } define-primitive
-\ slot make-flushable
-
-\ set-slot { object object fixnum } { } define-primitive
-
-\ string-nth { fixnum string } { fixnum } define-primitive
-\ string-nth make-flushable
-
-\ set-string-nth-slow { fixnum fixnum string } { } define-primitive
-\ set-string-nth-fast { fixnum fixnum string } { } define-primitive
-
-\ resize-array { integer array } { array } define-primitive
-\ resize-array make-flushable
-
-\ resize-byte-array { integer byte-array } { byte-array } define-primitive
-\ resize-byte-array make-flushable
-
-\ resize-string { integer string } { string } define-primitive
-\ resize-string make-flushable
-
-\ <array> { integer object } { array } define-primitive
-\ <array> make-flushable
-
+\ (set-context) { object alien } { object } define-primitive
+\ (set-context-and-delete) { object alien } { } define-primitive
+\ (sleep) { integer } { } define-primitive
+\ (start-context) { object quotation } { object } define-primitive
+\ (start-context-and-delete) { object quotation } { } define-primitive
+\ (word) { object object object } { word } define-primitive \ (word) make-flushable
+\ <array> { integer object } { array } define-primitive \ <array> make-flushable
+\ <byte-array> { integer } { byte-array } define-primitive \ <byte-array> make-flushable
+\ <callback> { integer word } { alien } define-primitive
+\ <displaced-alien> { integer c-ptr } { c-ptr } define-primitive \ <displaced-alien> make-flushable
+\ <string> { integer integer } { string } define-primitive \ <string> make-flushable
+\ <tuple> { tuple-layout } { tuple } define-primitive \ <tuple> make-flushable
+\ <wrapper> { object } { wrapper } define-primitive \ <wrapper> make-foldable
+\ alien-address { alien } { integer } define-primitive \ alien-address make-flushable
+\ alien-cell { c-ptr integer } { pinned-c-ptr } define-primitive \ alien-cell make-flushable
+\ alien-double { c-ptr integer } { float } define-primitive \ alien-double make-flushable
+\ alien-float { c-ptr integer } { float } define-primitive \ alien-float make-flushable
+\ alien-signed-1 { c-ptr integer } { fixnum } define-primitive \ alien-signed-1 make-flushable
+\ alien-signed-2 { c-ptr integer } { fixnum } define-primitive \ alien-signed-2 make-flushable
+\ alien-signed-4 { c-ptr integer } { integer } define-primitive \ alien-signed-4 make-flushable
+\ alien-signed-8 { c-ptr integer } { integer } define-primitive \ alien-signed-8 make-flushable
+\ alien-signed-cell { c-ptr integer } { integer } define-primitive \ alien-signed-cell make-flushable
+\ alien-unsigned-1 { c-ptr integer } { fixnum } define-primitive \ alien-unsigned-1 make-flushable
+\ alien-unsigned-2 { c-ptr integer } { fixnum } define-primitive \ alien-unsigned-2 make-flushable
+\ alien-unsigned-4 { c-ptr integer } { integer } define-primitive \ alien-unsigned-4 make-flushable
+\ alien-unsigned-8 { c-ptr integer } { integer } define-primitive \ alien-unsigned-8 make-flushable
+\ alien-unsigned-cell { c-ptr integer } { integer } define-primitive \ alien-unsigned-cell make-flushable
 \ all-instances { } { array } define-primitive
-
-\ size { object } { fixnum } define-primitive
-\ size make-flushable
-
+\ array>quotation { array } { quotation } define-primitive \ array>quotation make-foldable
+\ become { array array } { } define-primitive
+\ bignum* { bignum bignum } { bignum } define-primitive \ bignum* make-foldable
+\ bignum+ { bignum bignum } { bignum } define-primitive \ bignum+ make-foldable
+\ bignum- { bignum bignum } { bignum } define-primitive \ bignum- make-foldable
+\ bignum-bit? { bignum integer } { object } define-primitive \ bignum-bit? make-foldable
+\ bignum-bitand { bignum bignum } { bignum } define-primitive \ bignum-bitand make-foldable
+\ bignum-bitnot { bignum } { bignum } define-primitive \ bignum-bitnot make-foldable
+\ bignum-bitor { bignum bignum } { bignum } define-primitive \ bignum-bitor make-foldable
+\ bignum-bitxor { bignum bignum } { bignum } define-primitive \ bignum-bitxor make-foldable
+\ bignum-log2 { bignum } { bignum } define-primitive \ bignum-log2 make-foldable
+\ bignum-mod { bignum bignum } { bignum } define-primitive \ bignum-mod make-foldable
+\ bignum-shift { bignum fixnum } { bignum } define-primitive \ bignum-shift make-foldable
+\ bignum/i { bignum bignum } { bignum } define-primitive \ bignum/i make-foldable
+\ bignum/mod { bignum bignum } { bignum bignum } define-primitive \ bignum/mod make-foldable
+\ bignum< { bignum bignum } { object } define-primitive \ bignum< make-foldable
+\ bignum<= { bignum bignum } { object } define-primitive \ bignum<= make-foldable
+\ bignum= { bignum bignum } { object } define-primitive \ bignum= make-foldable
+\ bignum> { bignum bignum } { object } define-primitive \ bignum> make-foldable
+\ bignum>= { bignum bignum } { object } define-primitive \ bignum>= make-foldable
+\ bignum>fixnum { bignum } { fixnum } define-primitive \ bignum>fixnum make-foldable
+\ bignum>float { bignum } { float } define-primitive \ bignum>float make-foldable
+\ bits>double { integer } { float } define-primitive \ bits>double make-foldable
+\ bits>float { integer } { float } define-primitive \ bits>float make-foldable
+\ both-fixnums? { object object } { object } define-primitive
+\ byte-array>bignum { byte-array } { bignum } define-primitive \ byte-array>bignum make-foldable
+\ callstack { } { callstack } define-primitive \ callstack make-flushable
+\ callstack-bounds { } { alien alien } define-primitive \ callstack-bounds make-flushable
+\ callstack-for { c-ptr } { callstack } define-primitive \ callstack make-flushable
+\ callstack>array { callstack } { array } define-primitive \ callstack>array make-flushable
+\ check-datastack { array integer integer } { object } define-primitive \ check-datastack make-flushable
+\ code-room { } { byte-array } define-primitive \ code-room  make-flushable
+\ compact-gc { } { } define-primitive
+\ compute-identity-hashcode { object } { } define-primitive
+\ context-object { fixnum } { object } define-primitive \ context-object make-flushable
+\ context-object-for { fixnum c-ptr } { object } define-primitive \ context-object-for make-flushable
+\ current-callback { } { fixnum } define-primitive \ current-callback make-flushable
+\ data-room { } { byte-array } define-primitive \ data-room make-flushable
+\ datastack { } { array } define-primitive \ datastack make-flushable
+\ datastack-for { c-ptr } { array } define-primitive \ datastack-for make-flushable
 \ die { } { } define-primitive
-
-\ (fopen) { byte-array byte-array } { alien } define-primitive
-
+\ disable-gc-events { } { object } define-primitive
+\ dispatch-stats { } { byte-array } define-primitive
+\ dlclose { dll } { } define-primitive
+\ dll-valid? { object } { object } define-primitive
+\ double>bits { real } { integer } define-primitive \ double>bits make-foldable
+\ enable-gc-events { } { } define-primitive
+\ eq? { object object } { object } define-primitive \ eq? make-foldable
+\ fclose { alien } { } define-primitive
+\ fflush { alien } { } define-primitive
 \ fgetc { alien } { object } define-primitive
-
-\ fwrite { string alien } { } define-primitive
-
+\ fixnum* { fixnum fixnum } { integer } define-primitive \ fixnum* make-foldable
+\ fixnum*fast { fixnum fixnum } { fixnum } define-primitive \ fixnum*fast make-foldable
+\ fixnum+ { fixnum fixnum } { integer } define-primitive \ fixnum+ make-foldable
+\ fixnum+fast { fixnum fixnum } { fixnum } define-primitive \ fixnum+fast make-foldable
+\ fixnum- { fixnum fixnum } { integer } define-primitive \ fixnum- make-foldable
+\ fixnum-bitand { fixnum fixnum } { fixnum } define-primitive \ fixnum-bitand make-foldable
+\ fixnum-bitnot { fixnum } { fixnum } define-primitive \ fixnum-bitnot make-foldable
+\ fixnum-bitor { fixnum fixnum } { fixnum } define-primitive \ fixnum-bitor make-foldable
+\ fixnum-bitxor { fixnum fixnum } { fixnum } define-primitive \ fixnum-bitxor make-foldable
+\ fixnum-fast { fixnum fixnum } { fixnum } define-primitive \ fixnum-fast make-foldable
+\ fixnum-mod { fixnum fixnum } { fixnum } define-primitive \ fixnum-mod make-foldable
+\ fixnum-shift { fixnum fixnum } { integer } define-primitive \ fixnum-shift make-foldable
+\ fixnum-shift-fast { fixnum fixnum } { fixnum } define-primitive \ fixnum-shift-fast make-foldable
+\ fixnum/i { fixnum fixnum } { integer } define-primitive \ fixnum/i make-foldable
+\ fixnum/i-fast { fixnum fixnum } { fixnum } define-primitive \ fixnum/i-fast make-foldable
+\ fixnum/mod { fixnum fixnum } { integer fixnum } define-primitive \ fixnum/mod make-foldable
+\ fixnum/mod-fast { fixnum fixnum } { fixnum fixnum } define-primitive \ fixnum/mod-fast make-foldable
+\ fixnum< { fixnum fixnum } { object } define-primitive \ fixnum< make-foldable
+\ fixnum<= { fixnum fixnum } { object } define-primitive \ fixnum<= make-foldable
+\ fixnum> { fixnum fixnum } { object } define-primitive \ fixnum> make-foldable
+\ fixnum>= { fixnum fixnum } { object } define-primitive \ fixnum>= make-foldable
+\ fixnum>bignum { fixnum } { bignum } define-primitive \ fixnum>bignum make-foldable
+\ fixnum>float { fixnum } { float } define-primitive \ fixnum>float make-foldable
+\ float* { float float } { float } define-primitive \ float* make-foldable
+\ float+ { float float } { float } define-primitive \ float+ make-foldable
+\ float- { float float } { float } define-primitive \ float- make-foldable
+\ float-mod { float float } { float } define-primitive \ float-mod make-foldable
+\ float-u< { float float } { object } define-primitive \ float-u< make-foldable
+\ float-u<= { float float } { object } define-primitive \ float-u<= make-foldable
+\ float-u> { float float } { object } define-primitive \ float-u> make-foldable
+\ float-u>= { float float } { object } define-primitive \ float-u>= make-foldable
+\ float/f { float float } { float } define-primitive \ float/f make-foldable
+\ float< { float float } { object } define-primitive \ float< make-foldable
+\ float<= { float float } { object } define-primitive \ float<= make-foldable
+\ float= { float float } { object } define-primitive \ float= make-foldable
+\ float> { float float } { object } define-primitive \ float> make-foldable
+\ float>= { float float } { object } define-primitive \ float>= make-foldable
+\ float>bignum { float } { bignum } define-primitive \ float>bignum make-foldable
+\ float>bits { real } { integer } define-primitive \ float>bits make-foldable
+\ float>fixnum { float } { fixnum } define-primitive \ bignum>fixnum make-foldable
 \ fputc { object alien } { } define-primitive
-
-\ fread { integer string } { object } define-primitive
-
-\ fflush { alien } { } define-primitive
-
-\ fseek { alien integer integer } { } define-primitive
-
+\ fread { integer alien } { object } define-primitive
+\ fseek { integer integer alien } { } define-primitive
 \ ftell { alien } { integer } define-primitive
-
-\ fclose { alien } { } define-primitive
-
-\ <wrapper> { object } { wrapper } define-primitive
-\ <wrapper> make-foldable
-
-\ (clone) { object } { object } define-primitive
-\ (clone) make-flushable
-
-\ <string> { integer integer } { string } define-primitive
-\ <string> make-flushable
-
-\ array>quotation { array } { quotation } define-primitive
-\ array>quotation make-flushable
-
-\ quotation-code { quotation } { integer integer } define-primitive
-\ quotation-code make-flushable
-
-\ <tuple> { tuple-layout } { tuple } define-primitive
-\ <tuple> make-flushable
-
-\ datastack { } { array } define-primitive
-\ datastack make-flushable
-
-\ check-datastack { array integer integer } { object } define-primitive
-\ check-datastack make-flushable
-
-\ retainstack { } { array } define-primitive
-\ retainstack make-flushable
-
-\ callstack { } { callstack } define-primitive
-\ callstack make-flushable
-
-\ callstack>array { callstack } { array } define-primitive
-\ callstack>array make-flushable
-
-\ (sleep) { integer } { } define-primitive
-
-\ become { array array } { } define-primitive
-
+\ fwrite { c-ptr integer alien } { } define-primitive
+\ gc { } { } define-primitive
 \ innermost-frame-executing { callstack } { object } define-primitive
-
 \ innermost-frame-scan { callstack } { fixnum } define-primitive
-
-\ set-innermost-frame-quot { quotation callstack } { } define-primitive
-
-\ dll-valid? { object } { object } define-primitive
-
-\ modify-code-heap { array object object } { } define-primitive
-
-\ unimplemented { } { } define-primitive
-
 \ jit-compile { quotation } { } define-primitive
-
 \ lookup-method { object array } { word } define-primitive
-
-\ reset-dispatch-stats { } { } define-primitive
-\ dispatch-stats { } { byte-array } define-primitive
-
+\ minor-gc { } { } define-primitive
+\ modify-code-heap { array object object } { } define-primitive
+\ nano-count { } { integer } define-primitive \ nano-count make-flushable
 \ optimized? { word } { object } define-primitive
-
-\ strip-stack-traces { } { } define-primitive
-
-\ <callback> { integer word } { alien } define-primitive
-
-\ enable-gc-events { } { } define-primitive
-\ disable-gc-events { } { object } define-primitive
-
 \ profiling { object } { } define-primitive
-
-\ (identity-hashcode) { object } { fixnum } define-primitive
-
-\ compute-identity-hashcode { object } { } define-primitive
-
-\ (exit) { integer } { } define-primitive
-
 \ quot-compiled? { quotation } { object } define-primitive
+\ quotation-code { quotation } { integer integer } define-primitive \ quotation-code make-flushable
+\ reset-dispatch-stats { } { } define-primitive
+\ resize-array { integer array } { array } define-primitive \ resize-array make-flushable
+\ resize-byte-array { integer byte-array } { byte-array } define-primitive \ resize-byte-array make-flushable
+\ resize-string { integer string } { string } define-primitive \ resize-string make-flushable
+\ retainstack { } { array } define-primitive \ retainstack make-flushable
+\ retainstack-for { c-ptr } { array } define-primitive \ retainstack-for make-flushable
+\ set-alien-cell { c-ptr c-ptr integer } { } define-primitive
+\ set-alien-double { float c-ptr integer } { } define-primitive
+\ set-alien-float { float c-ptr integer } { } define-primitive
+\ set-alien-signed-1 { integer c-ptr integer } { } define-primitive
+\ set-alien-signed-2 { integer c-ptr integer } { } define-primitive
+\ set-alien-signed-4 { integer c-ptr integer } { } define-primitive
+\ set-alien-signed-8 { integer c-ptr integer } { } define-primitive
+\ set-alien-signed-cell { integer c-ptr integer } { } define-primitive
+\ set-alien-unsigned-1 { integer c-ptr integer } { } define-primitive
+\ set-alien-unsigned-2 { integer c-ptr integer } { } define-primitive
+\ set-alien-unsigned-4 { integer c-ptr integer } { } define-primitive
+\ set-alien-unsigned-8 { integer c-ptr integer } { } define-primitive
+\ set-alien-unsigned-cell { integer c-ptr integer } { } define-primitive
+\ set-context-object { object fixnum } { } define-primitive
+\ set-innermost-frame-quot { quotation callstack } { } define-primitive
+\ set-slot { object object fixnum } { } define-primitive
+\ set-special-object { object fixnum } { } define-primitive
+\ set-string-nth-fast { fixnum fixnum string } { } define-primitive
+\ size { object } { fixnum } define-primitive \ size make-flushable
+\ slot { object fixnum } { object } define-primitive \ slot make-flushable
+\ special-object { fixnum } { object } define-primitive \ special-object make-flushable
+\ string-nth-fast { fixnum string } { fixnum } define-primitive \ string-nth-fast make-flushable
+\ strip-stack-traces { } { } define-primitive
+\ system-micros { } { integer } define-primitive \ system-micros make-flushable
+\ tag { object } { fixnum } define-primitive \ tag make-foldable
+\ unimplemented { } { } define-primitive
+\ word-code { word } { integer integer } define-primitive \ word-code make-flushable
diff --git a/basis/stack-checker/row-polymorphism/row-polymorphism.factor b/basis/stack-checker/row-polymorphism/row-polymorphism.factor
new file mode 100644 (file)
index 0000000..ad4f92c
--- /dev/null
@@ -0,0 +1,65 @@
+! (c)2010 Joe Groff bsd license
+USING: accessors arrays assocs combinators combinators.short-circuit
+continuations effects fry kernel locals math math.order namespaces
+quotations sequences splitting
+stack-checker.backend
+stack-checker.errors
+stack-checker.state
+stack-checker.values
+stack-checker.visitor ;
+IN: stack-checker.row-polymorphism
+
+: with-inner-d ( quot -- inner-d )
+    inner-d-index get
+    [ meta-d length inner-d-index set call ] dip
+    inner-d-index get [ min inner-d-index set ] keep ; inline
+
+:: (effect-here) ( inner-d old-meta-d-length old-input-count -- effect )
+    old-meta-d-length inner-d - input-count get old-input-count - +
+    meta-d length inner-d -
+    [ "x" <array> ] bi@ terminated? get <terminated-effect> ; inline
+
+: with-effect-here ( quot -- effect )
+    meta-d length input-count get
+    [ with-inner-d ] 2dip (effect-here) ; inline
+
+: (diff-variable) ( diff variable vars -- diff' )
+    [ key? ] [ '[ _ _ at - ] ] [ '[ _ _ set-at 0 ] ] 2tri if ;
+
+: (check-variable) ( actual-count declared-count variable vars -- diff ? )
+    [ - ] 2dip dupd '[ _ _ (diff-variable) t ] [ dup 0 <= ] if ;
+
+: adjust-variable ( diff var vars -- )
+    pick 0 >= [ at+ ] [ 3drop ] if ; inline
+
+:: check-variable ( vars declared actual slot var-slot -- diff ok? var )
+    actual declared [ slot call length ] bi@ declared var-slot call
+    [ vars (check-variable) ] keep ; inline
+
+:: unify-variables ( in-diff in-ok? in-var out-diff out-ok? out-var vars -- ? )
+    { [ in-ok? ] [ out-ok? ] [ in-diff out-diff = ] } 0&& dup [
+        in-var  [ in-diff  swap vars adjust-variable ] when*
+        out-var [ out-diff swap vars adjust-variable ] when*
+    ] when ;
+
+: (check-variables) ( vars declared actual -- ? )
+    [ [ in>>  ] [ in-var>>  ] check-variable ]
+    [ [ out>> ] [ out-var>> ] check-variable ]
+    [ 2drop ] 3tri unify-variables ;
+
+: check-variables ( vars declared actual -- ? )
+    dup terminated?>> [ 3drop t ] [ (check-variables) ] if ;
+
+: combinator-branches-effects ( branches -- quots declareds actuals )
+    [ [ known>callable ] { } map-as ]
+    [ [ effect>> ] { } map-as ]
+    [ [ actual>> ] { } map-as ] tri ;
+
+: combinator-unbalanced-branches-error ( known -- * )
+    [ word>> ] [ branches>> <reversed> combinator-branches-effects ] bi
+    unbalanced-branches-error ;
+
+: check-declared-effect ( known effect -- )
+    [ >>actual ] keep
+    2dup [ [ variables>> ] [ effect>> ] bi ] dip check-variables
+    [ 2drop ] [ drop combinator-unbalanced-branches-error ] if ;
index 5ba70ed18166944c22a88c4ecddc1ddeaefd7fbd..4fa66f7f389b8e455185b7a64a8a2160fcb9bb06 100644 (file)
@@ -27,6 +27,8 @@ ARTICLE: "inference-combinators" "Combinator stack effects"
   { "If the word is declared " { $link POSTPONE: inline } ", the combinator may additionally be called on one of the word's input parameters or with quotations built from the word's input parameters, literal quotations, " { $link curry } ", and " { $link compose } ". When inline, a word is itself considered to be a combinator, and its callers must in turn satisfy these conditions." }
 }
 "If neither condition holds, the stack checker throws a " { $link unknown-macro-input } " or " { $link bad-macro-input } " error. To make the code compile, a runtime checking combinator such as " { $link POSTPONE: call( } " must be used instead. See " { $link "inference-escape" } " for details. An inline combinator can be called with an unknown quotation by " { $link curry } "ing the quotation onto a literal quotation that uses " { $link POSTPONE: call( } "."
+{ $heading "Input stack effects" }
+"Inline combinators will verify the stack effect of their input quotations if they are declared in the combinator's stack effect. See " { $link "effects-variables" } " for details."
 { $heading "Examples" }
 { $subheading "Calling a combinator" }
 "The following usage of " { $link map } " passes the stack checker, because the quotation is the result of " { $link curry } ":"
index 270e5695b33bcae60dbf4c7202594b05c3487693..351cf5cde0661e3c707332922a7a1efb8cd32d70 100644 (file)
@@ -234,10 +234,12 @@ DEFER: blah4
 
 ! Test some curry stuff
 { 1 1 } [ 3 [ ] curry 4 [ ] curry if ] must-infer-as
+{ 3 1 } [ [ ] curry [ [ ] curry ] dip if ] must-infer-as
 
 { 2 1 } [ [ ] curry 4 [ ] curry if ] must-infer-as
 
 [ [ 3 [ ] curry 1 2 [ ] 2curry if ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [ ] curry [ [ ] 2curry ] dip if ] infer ] [ unbalanced-branches-error? ] must-fail-with
 
 { 1 3 } [ [ 2drop f ] assoc-find ] must-infer-as
 
@@ -250,6 +252,11 @@ DEFER: blah4
 ! A typo
 { 1 0 } [ { [ ] } dispatch ] must-infer-as
 
+! Make sure the error is correct
+[
+    [ { [ drop ] [ dup ] } dispatch ] infer
+] [ word>> \ dispatch eq? ] must-fail-with
+
 DEFER: inline-recursive-2
 : inline-recursive-1 ( -- ) inline-recursive-2 ;
 : inline-recursive-2 ( -- ) inline-recursive-1 ;
@@ -378,7 +385,10 @@ DEFER: eee'
 
 [ [ cond ] infer ] [ T{ unknown-macro-input f cond } = ] must-fail-with
 [ [ bi ] infer ] [ T{ unknown-macro-input f call } = ] must-fail-with
-[ [ each ] infer ] [ T{ unknown-macro-input f call } = ] must-fail-with
+
+[ [ each ] infer ] [ T{ unknown-macro-input f each } = ] must-fail-with
+[ [ if* ] infer ] [ T{ unknown-macro-input f if* } = ] must-fail-with
+[ [ [ "derp" ] if* ] infer ] [ T{ unknown-macro-input f if* } = ] must-fail-with
 
 [ [ [ "OOPS" throw ] dip ] [ drop ] if ] must-infer
 
@@ -402,3 +412,64 @@ DEFER: eee'
     [ "special" word-prop not ] filter
     [ "shuffle" word-prop not ] filter
 ] unit-test
+
+{ 1 0 } [ [ drop       ] each ] must-infer-as
+{ 2 1 } [ [ append     ] each ] must-infer-as
+{ 1 1 } [ [            ] map  ] must-infer-as
+{ 1 1 } [ [ reverse    ] map  ] must-infer-as
+{ 2 2 } [ [ append dup ] map  ] must-infer-as
+{ 2 2 } [ [ swap nth suffix dup ] map-index ] must-infer-as
+
+{ 4 1 } [ [ 2drop ] [ 2nip    ] if ] must-infer-as
+{ 3 3 } [ [ dup   ] [ over    ] if ] must-infer-as
+{ 1 1 } [ [ 1     ] [ 0       ] if ] must-infer-as
+{ 2 2 } [ [ t     ] [ 1 + f   ] if ] must-infer-as
+
+{ 1 0 } [ [ write     ] [ "(f)" write ] if* ] must-infer-as
+{ 1 1 } [ [           ] [ f           ] if* ] must-infer-as
+{ 2 1 } [ [ nip       ] [ drop f      ] if* ] must-infer-as
+{ 2 1 } [ [ nip       ] [             ] if* ] must-infer-as
+{ 3 2 } [ [ 3append f ] [             ] if* ] must-infer-as
+{ 1 0 } [ [ drop      ] [             ] if* ] must-infer-as
+
+{ 1 1 } [ [ 1 +       ] [ "oops" throw ] if* ] must-infer-as
+
+: strict-each ( seq quot: ( x -- ) -- )
+    each ; inline
+: strict-map ( seq quot: ( x -- x' ) -- seq' )
+    map ; inline
+: strict-2map ( xs ys quot: ( x y -- z ) -- zs )
+    2map ; inline
+
+{ 1 0 } [ [ drop ] strict-each ] must-infer-as
+{ 1 1 } [ [ 1 + ] strict-map ] must-infer-as
+{ 1 1 } [ [  ] strict-map ] must-infer-as
+{ 2 1 } [ [ + ] strict-2map ] must-infer-as
+{ 2 1 } [ [ drop ] strict-2map ] must-infer-as
+[ [ [ append ] strict-each ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [ 1 + ] strict-2map ] infer ] [ unbalanced-branches-error? ] must-fail-with
+
+! ensure that polymorphic checking works on recursive combinators
+FROM: splitting.private => split, ;
+{ 2 0 } [ [ member? ] curry split, ] must-infer-as
+
+[ [ [ write write ] each      ] infer ] [ unbalanced-branches-error? ] must-fail-with
+
+[ [ [             ] each      ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [ dup         ] map       ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [ drop        ] map       ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [ 1 +         ] map-index ] infer ] [ unbalanced-branches-error? ] must-fail-with
+
+[ [ [ dup  ] [      ] if ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [ 2dup ] [ over ] if ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [ drop ] [      ] if ] infer ] [ unbalanced-branches-error? ] must-fail-with
+
+[ [ [      ] [       ] if* ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [ dup  ] [       ] if* ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [ drop ] [ drop  ] if* ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [      ] [ drop  ] if* ] infer ] [ unbalanced-branches-error? ] must-fail-with
+[ [ [      ] [ 2dup  ] if* ] infer ] [ unbalanced-branches-error? ] must-fail-with
+
+! M\ declared-effect infer-call* didn't properly unify branches
+{ 1 0 } [ [ 1 [ drop ] [ drop ] if ] each ] must-infer-as
+
index 12e86609004c992de19e056ff95352967b4d18df..beb5026a2ba8af94032d0caac64843892e58e860 100644 (file)
@@ -11,7 +11,7 @@ IN: stack-checker
 GENERIC: infer ( quot -- effect )
 
 M: callable infer ( quot -- effect )
-    [ infer-quot-here ] with-infer drop ;
+    (infer) ;
 
 : infer. ( quot -- )
     #! Safe to call from inference transforms.
index f0b595ebe5c2ebfa4f54be0a36f65fa7312ad223..3ac6a4531f236c9900cd4b13c9b0fbdac7476a44 100644 (file)
@@ -11,6 +11,7 @@ SYMBOL: terminated?
 
 ! Number of inputs current word expects from the stack
 SYMBOL: input-count
+SYMBOL: inner-d-index
 
 DEFER: commit-literals
 
@@ -40,10 +41,11 @@ SYMBOL: literals
 : current-effect ( -- effect )
     input-count get "x" <array>
     meta-d length "x" <array>
-    terminated? get effect boa ;
+    terminated? get <terminated-effect> ;
 
 : init-inference ( -- )
     terminated? off
     V{ } clone \ meta-d set
     V{ } clone literals set
-    0 input-count set ;
+    0 input-count set
+    0 inner-d-index set ;
index cf32792a2e9a2d869f38346602d2142aa0bb08f4..610d3f8600ea131684e7327b0268544264ed41b5 100644 (file)
@@ -9,6 +9,7 @@ sequences.private generalizations stack-checker.backend
 stack-checker.state stack-checker.visitor stack-checker.errors
 stack-checker.values stack-checker.recursive-state
 stack-checker.dependencies ;
+FROM: namespaces => set ;
 IN: stack-checker.transforms
 
 : call-transformer ( stack quot -- newquot )
@@ -18,7 +19,7 @@ IN: stack-checker.transforms
 
 :: ((apply-transform)) ( quot values stack rstate -- )
     rstate recursive-state [ stack quot call-transformer ] with-variable
-    values [ length meta-d shorten-by ] [ #drop, ] bi
+    values [ length shorten-d ] [ #drop, ] bi
     rstate infer-quot ;
 
 : literal-values? ( values -- ? ) [ literal-value? ] all? ;
index 7e11ec3edb57a85f51f73e1219e2d5299bdc0eea..e701f297d745da808aa9af7386d017adfdd41c45 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors namespaces kernel assocs sequences
-stack-checker.recursive-state stack-checker.errors ;
+USING: accessors namespaces fry kernel assocs sequences
+stack-checker.recursive-state stack-checker.errors
+quotations ;
 IN: stack-checker.values
 
 ! Values
@@ -97,9 +98,41 @@ M: input-parameter (literal-value?) drop f ;
 
 M: input-parameter (literal) current-word get unknown-macro-input ;
 
+! Argument corresponding to polymorphic declared input of inline combinator
+
+TUPLE: declared-effect known word effect variables branches actual ;
+
+C: (declared-effect) declared-effect
+
+: <declared-effect> ( known word effect variables branches -- declared-effect )
+    f (declared-effect) ; inline
+
+M: declared-effect (input-value?) known>> (input-value?) ;
+
+M: declared-effect (literal-value?) known>> (literal-value?) ;
+
+M: declared-effect (literal) known>> (literal) ;
+
 ! Computed values
 M: f (input-value?) drop f ;
 
 M: f (literal-value?) drop f ;
 
-M: f (literal) current-word get bad-macro-input ;
\ No newline at end of file
+M: f (literal) current-word get bad-macro-input ;
+
+GENERIC: known>callable ( known -- quot )
+
+: ?@ ( x -- y )
+    dup callable? [ drop [ @ ] ] unless ;
+
+M: object known>callable drop \ _ ;
+M: literal known>callable value>> ;
+M: composed known>callable
+    [ quot1>> known known>callable ?@ ] [ quot2>> known known>callable ?@ ] bi
+    append ;
+M: curried known>callable
+    [ quot>> known known>callable ] [ obj>> known known>callable ] bi
+    prefix ;
+M: declared-effect known>callable
+    known>> known>callable ;
+
index 5149804ce609b31f6080a005af748536e4fed863..f9de4979ab68a8cc0b4c97034c5fbc73eb4b4f91 100644 (file)
@@ -25,14 +25,14 @@ IN: suffix-arrays.tests
 [ { } ]
 [ SA{ } "something" swap query ] unit-test
 
-[ V{ "unit-test" "(unit-test)" } ]
+[ { "unit-test" "(unit-test)" } ]
 [ "suffix-array" get "unit-test" swap query ] unit-test
 
 [ t ]
 [ "suffix-array" get "something else" swap query empty? ] unit-test
 
-[ V{ "rofl" } ] [ SA{ "rofl" } "r" swap query ] unit-test
-[ V{ "rofl" } ] [ SA{ "rofl" } "o" swap query ] unit-test
-[ V{ "rofl" } ] [ SA{ "rofl" } "f" swap query ] unit-test
-[ V{ "rofl" } ] [ SA{ "rofl" } "l" swap query ] unit-test
-[ V{ } ] [ SA{ "rofl" } "t" swap query ] unit-test
+[ { "rofl" } ] [ SA{ "rofl" } "r" swap query ] unit-test
+[ { "rofl" } ] [ SA{ "rofl" } "o" swap query ] unit-test
+[ { "rofl" } ] [ SA{ "rofl" } "f" swap query ] unit-test
+[ { "rofl" } ] [ SA{ "rofl" } "l" swap query ] unit-test
+[ { } ] [ SA{ "rofl" } "t" swap query ] unit-test
index 134c144fda07442be067257492139cfb21299452..8f728c1eda0d0541a7b460f266131a2bba7b4c6f 100644 (file)
@@ -35,5 +35,5 @@ SYNTAX: SA{ \ } [ >suffix-array ] parse-literal ;
 
 : query ( begin suffix-array -- matches )
     2dup find-index dup
-    [ -rot [ from-to ] keep <funky-slice> [ seq>> ] map prune ]
+    [ -rot [ from-to ] keep <funky-slice> [ seq>> ] map members ]
     [ 3drop { } ] if ;
index e30cd6826c7f0dd29df44ae50d5ecbba6fcee05d..fe31a49265d425ca2f4d9e7592b0292a329a44c4 100644 (file)
@@ -70,7 +70,8 @@ TUPLE: entry title url description date ;
     tri ;
 
 : atom-entry-link ( tag -- url/f )
-    "link" tags-named [ "rel" attr "alternate" = ] find nip
+    "link" tags-named
+    [ "rel" attr { f "alternate" } member? ] find nip
     dup [ "href" attr >url ] when ;
 
 : atom1.0-entry ( tag -- entry )
index 0c21597a2f4ca9d1ecbb19a25ddb3866862e9c29..2eb395b8d1b65cb5d6df813201ff34f0f5b61797 100644 (file)
@@ -2,12 +2,12 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: unix alien alien.c-types kernel math sequences strings
 io.backend.unix splitting io.encodings.utf8 io.encodings.string
-specialized-arrays ;
+specialized-arrays alien.syntax ;
 SPECIALIZED-ARRAY: char
 IN: system-info.linux
 
-: (uname) ( buf -- int )
-    int f "uname" { char* } alien-invoke ;
+FUNCTION-ALIAS: (uname)
+    int uname ( c-string buf ) ;
 
 : uname ( -- seq )
     65536 <char-array> [ (uname) io-error ] keep
diff --git a/basis/system-info/windows/nt/nt-tests.factor b/basis/system-info/windows/nt/nt-tests.factor
new file mode 100755 (executable)
index 0000000..dfbd8b3
--- /dev/null
@@ -0,0 +1,7 @@
+USING: math.order strings system-info.backend
+system-info.windows system-info.windows.nt
+tools.test ;
+IN: system-info.windows.nt.tests
+
+[ t ] [ cpus 0 1024 between? ] unit-test
+[ t ] [ username string? ] unit-test
index 2c13c8d5d2593e693ccc0395b74cb7018db8c3a9..804eb25def68191d641bbd403c7d1008c0da4a4c 100644 (file)
@@ -11,8 +11,8 @@ M: winnt cpus ( -- n )
     system-info dwNumberOfProcessors>> ;
 
 : memory-status ( -- MEMORYSTATUSEX )
-    "MEMORYSTATUSEX" <struct>
-    dup class heap-size >>dwLength
+    MEMORYSTATUSEX <struct>
+    MEMORYSTATUSEX heap-size >>dwLength
     dup GlobalMemoryStatusEx win32-error=0/f ;
 
 M: winnt memory-load ( -- n )
index 995fc867e71c94f9160fa25f607187ff032d241e..3e63a81d9abaf326445d879fd869b420751b188a 100644 (file)
@@ -1,6 +1,6 @@
 USING: help.markup help.syntax kernel kernel.private io
-threads.private continuations init quotations strings
-assocs heaps boxes namespaces deques dlists system ;
+threads.private init quotations strings assocs heaps boxes
+namespaces deques dlists system ;
 IN: threads
 
 ARTICLE: "threads-start/stop" "Starting and stopping threads"
@@ -48,7 +48,7 @@ ARTICLE: "thread-state" "Thread-local state and variables"
 $nl
 "Global hashtable of all threads, keyed by " { $snippet "id" } ":"
 { $subsections threads }
-"Threads have an identity independent of continuations. If a continuation is refied in one thread and then resumed in another thread, the code running in that continuation will observe a change in the value output by " { $link self } "." ;
+"Threads have an identity independent of continuations. If a continuation is reified in one thread and then reflected in another thread, the code running in that continuation will observe a change in the value output by " { $link self } "." ;
 
 ARTICLE: "thread-impl" "Thread implementation"
 "Thread implementation:"
@@ -57,10 +57,8 @@ ARTICLE: "thread-impl" "Thread implementation"
     sleep-queue
 } ;
 
-ARTICLE: "threads" "Lightweight co-operative threads"
-"Factor supports lightweight co-operative threads implemented on top of " { $link "continuations" } ". A thread will yield while waiting for input/output operations to complete, or when a yield has been explicitly requested."
-$nl
-"Factor threads are very lightweight. Each thread can take as little as 900 bytes of memory. This library has been tested running hundreds of thousands of simple threads."
+ARTICLE: "threads" "Co-operative threads"
+"Factor supports co-operative threads. A thread will yield while waiting for input/output operations to complete, or when a yield has been explicitly requested."
 $nl
 "Words for working with threads are in the " { $vocab-link "threads" } " vocabulary."
 { $subsections
@@ -78,7 +76,7 @@ HELP: thread
         { { $snippet "id" } " - a unique identifier assigned to each thread." }
         { { $snippet "name" } " - the name passed to " { $link spawn } "." }
         { { $snippet "quot" } " - the initial quotation passed to " { $link spawn } "." }
-        { { $snippet "continuation" } " - a " { $link box } "; if the thread is ready to run, the box holds the continuation, otherwise it is empty." }
+        { { $snippet "status" } " - a " { $link string } " indicating what the thread is waiting for, or " { $link f } ". This slot is intended to be used for debugging purposes." }
     }
 } ;
 
@@ -142,10 +140,8 @@ HELP: interrupt
 { $description "Interrupts a sleeping thread." } ;
 
 HELP: suspend
-{ $values { "quot" { $quotation "( thread -- )" } } { "state" string } { "obj" object } }
-{ $description "Suspends the current thread and passes it to the quotation."
-$nl
-"After the quotation returns, control yields to the next runnable thread and the current thread does not execute again until it is resumed, and so the quotation must arrange for another thread to later resume the suspended thread with a call to " { $link resume } " or " { $link resume-with } "."
+{ $values { "state" string } { "obj" object } }
+{ $description "Suspends the current thread. Control yields to the next runnable thread and the current thread does not execute again until it is resumed, and so the caller of this word must arrange for another thread to later resume the suspended thread with a call to " { $link resume } " or " { $link resume-with } "."
 $nl
 "The status string is for debugging purposes; see " { $link "tools.threads" } "." } ;
 
index 4568b7c491c76cf73b077f5ffdd3108107ed076c..01578d4e64a8767e49918de6d1d81b1d46496874 100644 (file)
@@ -13,9 +13,7 @@ yield
 [ ] [ 0.3 sleep ] unit-test
 [ "hey" sleep ] must-fail
 
-[ 3 ] [
-    [ 3 swap resume-with ] "Test suspend" suspend
-] unit-test
+[ 3 ] [ 3 self resume-with "Test suspend" suspend ] unit-test
 
 [ f ] [ f get-global ] unit-test
 
@@ -29,8 +27,6 @@ yield
     ] parallel-map
 ] unit-test
 
-[ [ 3 throw ] "A" suspend ] [ 3 = ] must-fail-with
-
 :: spawn-namespace-test ( -- ? )
     <promise> :> p gensym :> g
     [
@@ -44,3 +40,22 @@ yield
 [ "a" [ 1 1 + ] spawn 100 sleep ] must-fail
 
 [ ] [ 0.1 seconds sleep ] unit-test
+
+! Test thread-local variables
+<promise> "p" set
+
+5 "x" tset
+
+[ 5 ] [ "x" tget ] unit-test
+
+[ ] [ "x" [ 1 + ] tchange ] unit-test
+
+[ 6 ] [ "x" tget ] unit-test
+
+! Are they truly thread-local?
+[ "x" tget "p" get fulfill ] in-thread
+
+[ f ] [ "p" get ?promise ] unit-test
+
+! Test system traps inside threads
+[ ] [ [ dup ] in-thread yield ] unit-test
index 952652d801dbeeb036e200ef1337694732eb4165..330b4abd6cae99b88a9b61d9302f061f3d8e8739 100644 (file)
@@ -1,12 +1,49 @@
-! Copyright (C) 2004, 2009 Slava Pestov.
+! Copyright (C) 2004, 2010 Slava Pestov.
 ! Copyright (C) 2005 Mackenzie Straight.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays hashtables heaps kernel kernel.private math
 namespaces sequences vectors continuations continuations.private
-dlists assocs system combinators combinators.private init boxes
-accessors math.order deques strings quotations fry ;
+dlists assocs system combinators init boxes accessors math.order
+deques strings quotations fry ;
 IN: threads
 
+<PRIVATE
+
+! Wrap sub-primitives; we don't want them inlined into callers
+! since their behavior depends on what frames are on the callstack
+: context ( -- context )
+    2 context-object ; inline
+
+: set-context ( obj context -- obj' )
+    (set-context) ; inline
+
+: start-context ( obj quot: ( obj -- * ) -- obj' )
+    (start-context) ; inline
+
+: set-context-and-delete ( obj context -- * )
+    (set-context-and-delete) ; inline
+
+: start-context-and-delete ( obj quot: ( obj -- * ) -- * )
+    (start-context-and-delete) ; inline
+
+! Context introspection
+: namestack-for ( context -- namestack )
+    [ 0 ] dip context-object-for ;
+
+: catchstack-for ( context -- catchstack )
+    [ 1 ] dip context-object-for ;
+
+: continuation-for ( context -- continuation )
+    {
+        [ datastack-for ]
+        [ callstack-for ]
+        [ retainstack-for ]
+        [ namestack-for ]
+        [ catchstack-for ]
+    } cleave <continuation> ;
+
+PRIVATE>
+
 SYMBOL: initial-thread
 
 TUPLE: thread
@@ -14,82 +51,75 @@ TUPLE: thread
 { quot callable initial: [ ] }
 { exit-handler callable initial: [ ] }
 { id integer }
-continuation
+{ context box }
 state
 runnable
 mailbox
-variables
+{ variables hashtable }
 sleep-entry ;
 
-: self ( -- thread ) 63 special-object ; inline
+: self ( -- thread )
+    63 special-object { thread } declare ; inline
+
+: thread-continuation ( thread -- continuation )
+    context>> check-box value>> continuation-for ;
 
 ! Thread-local storage
 : tnamespace ( -- assoc )
-    self variables>> [ H{ } clone dup self (>>variables) ] unless* ;
+    self variables>> ; inline
 
 : tget ( key -- value )
-    self variables>> at ;
+    tnamespace at ;
 
 : tset ( value key -- )
     tnamespace set-at ;
 
 : tchange ( key quot -- )
-    tnamespace swap change-at ; inline
+    [ tnamespace ] dip change-at ; inline
 
-: threads ( -- assoc ) 64 special-object ;
-
-: thread ( id -- thread ) threads at ;
+: threads ( -- assoc )
+    64 special-object { hashtable } declare ; inline
 
 : thread-registered? ( thread -- ? )
     id>> threads key? ;
 
-ERROR: already-stopped thread ;
-
-: check-unregistered ( thread -- thread )
-    dup thread-registered? [ already-stopped ] when ;
-
-ERROR: not-running thread ;
-
-: check-registered ( thread -- thread )
-    dup thread-registered? [ not-running ] unless ;
-
 <PRIVATE
 
 : register-thread ( thread -- )
-    check-unregistered dup id>> threads set-at ;
+    dup id>> threads set-at ;
 
 : unregister-thread ( thread -- )
-    check-registered id>> threads delete-at ;
+    id>> threads delete-at ;
 
 : set-self ( thread -- ) 63 set-special-object ; inline
 
 PRIVATE>
 
+: run-queue ( -- dlist )
+    65 special-object { dlist } declare ; inline
+
+: sleep-queue ( -- heap )
+    66 special-object { min-heap } declare ; inline
+
 : new-thread ( quot name class -- thread )
     new
         swap >>name
         swap >>quot
         \ thread counter >>id
-        <box> >>continuation ; inline
+        H{ } clone >>variables
+        <box> >>context ; inline
 
 : <thread> ( quot name -- thread )
     \ thread new-thread ;
 
-: run-queue ( -- dlist ) 65 special-object ;
-
-: sleep-queue ( -- heap ) 66 special-object ;
-
 : resume ( thread -- )
-    f >>state
-    check-registered run-queue push-front ;
+    f >>state run-queue push-front ;
 
 : resume-now ( thread -- )
-    f >>state
-    check-registered run-queue push-back ;
+    f >>state run-queue push-back ;
 
 : resume-with ( obj thread -- )
-    f >>state
-    check-registered 2array run-queue push-front ;
+    f >>state 2array run-queue push-front ;
 
 : sleep-time ( -- nanos/f )
     {
@@ -98,107 +128,89 @@ PRIVATE>
         [ sleep-queue heap-peek nip nano-count [-] ]
     } cond ;
 
+: interrupt ( thread -- )
+    dup state>> [
+        dup sleep-entry>> [ sleep-queue heap-delete ] when*
+        f >>sleep-entry
+        dup resume
+    ] when drop ;
+
 DEFER: stop
 
 <PRIVATE
 
 : schedule-sleep ( thread dt -- )
-    [ check-registered dup ] dip sleep-queue heap-push*
-    >>sleep-entry drop ;
+    dupd sleep-queue heap-push* >>sleep-entry drop ;
 
-: expire-sleep? ( heap -- ? )
-    dup heap-empty?
+: expire-sleep? ( -- ? )
+    sleep-queue dup heap-empty?
     [ drop f ] [ heap-peek nip nano-count <= ] if ;
 
 : expire-sleep ( thread -- )
     f >>sleep-entry resume ;
 
 : expire-sleep-loop ( -- )
-    sleep-queue
-    [ dup expire-sleep? ]
-    [ dup heap-pop drop expire-sleep ]
-    while
-    drop ;
+    [ expire-sleep? ]
+    [ sleep-queue heap-pop drop expire-sleep ]
+    while ;
 
-: start ( namestack thread -- * )
+CONSTANT: [start]
     [
-        set-self
         set-namestack
-        V{ } set-catchstack
-        { } set-retainstack
-        { } set-datastack
-        self quot>> [ call stop ] call-clear
-    ] (( namestack thread -- * )) call-effect-unsafe ;
-
-DEFER: next
-
-: no-runnable-threads ( -- * )
-    ! We should never be in a state where the only threads
-    ! are sleeping; the I/O wait thread is always runnable.
-    ! However, if it dies, we handle this case
-    ! semi-gracefully.
-    !
-    ! And if sleep-time outputs f, there are no sleeping
-    ! threads either... so WTF.
-    sleep-time {
-        { [ dup not ] [ drop die ] }
-        { [ dup 0 = ] [ drop ] }
-        [ (sleep) ]
-    } cond next ;
-
-: (next) ( arg thread -- * )
-    f >>state
-    dup set-self
-    dup runnable>> [
-        continuation>> box> continue-with
-    ] [
-        t >>runnable start
-    ] if ;
-
-: next ( -- * )
+        init-catchstack
+        self quot>> call
+        stop
+    ]
+
+: no-runnable-threads ( -- ) die ;
+
+GENERIC: (next) ( obj thread -- obj' )
+
+M: thread (next)
+    dup runnable>>
+    [ context>> box> set-context ]
+    [ t >>runnable drop [start] start-context ] if ;
+
+: (stop) ( obj thread -- * )
+    dup runnable>>
+    [ context>> box> set-context-and-delete ]
+    [ t >>runnable drop [start] start-context-and-delete ] if ;
+
+: next ( -- obj thread )
     expire-sleep-loop
-    run-queue dup deque-empty? [
-        drop no-runnable-threads
-    ] [
-        pop-back dup array? [ first2 ] [ f swap ] if (next)
-    ] if ;
+    run-queue pop-back
+    dup array? [ first2 ] [ [ f ] dip ] if
+    f >>state
+    dup set-self ;
 
 PRIVATE>
 
-: stop ( -- )
-    self [ exit-handler>> call( -- ) ] [ unregister-thread ] bi next ;
+: stop ( -- * )
+    self [ exit-handler>> call( -- ) ] [ unregister-thread ] bi
+    next (stop) ;
 
-: suspend ( quot state -- obj )
-    [
-        [ [ self swap call ] dip self (>>state) ] dip
-        self continuation>> >box
-        next
-    ] callcc1 2nip ; inline
+: suspend ( state -- obj )
+    [ self ] dip >>state
+    [ context ] dip context>> >box
+    next (next) ;
 
-: yield ( -- ) [ resume ] f suspend drop ;
+: yield ( -- ) self resume f suspend drop ;
 
 GENERIC: sleep-until ( n/f -- )
 
 M: integer sleep-until
-    '[ _ schedule-sleep ] "sleep" suspend drop ;
+    [ self ] dip schedule-sleep "sleep" suspend drop ;
 
 M: f sleep-until
-    drop [ drop ] "interrupt" suspend drop ;
+    drop "standby" suspend drop ;
 
 GENERIC: sleep ( dt -- )
 
 M: real sleep
     >integer nano-count + sleep-until ;
 
-: interrupt ( thread -- )
-    dup state>> [
-        dup sleep-entry>> [ sleep-queue heap-delete ] when*
-        f >>sleep-entry
-        dup resume
-    ] when drop ;
-
 : (spawn) ( thread -- )
-    [ register-thread ] [ namestack swap resume-with ] bi ;
+    [ register-thread ] [ [ namestack ] dip resume-with ] bi ;
 
 : spawn ( quot name -- thread )
     <thread> [ (spawn) ] keep ;
@@ -208,24 +220,29 @@ M: real sleep
 
 : in-thread ( quot -- )
     [ datastack ] dip
-    '[ _ set-datastack _ call ]
+    '[ _ set-datastack @ ]
     "Thread" spawn drop ;
 
 GENERIC: error-in-thread ( error thread -- )
 
 <PRIVATE
 
-: init-threads ( -- )
+: init-thread-state ( -- )
     H{ } clone 64 set-special-object
     <dlist> 65 set-special-object
-    <min-heap> 66 set-special-object
-    initial-thread global
-    [ drop [ ] "Initial" <thread> ] cache
-    <box> >>continuation
+    <min-heap> 66 set-special-object ;
+
+: init-initial-thread ( -- )
+    [ ] "Initial" <thread>
     t >>runnable
-    f >>state
-    dup register-thread
-    set-self ;
+    [ initial-thread set-global ]
+    [ register-thread ]
+    [ set-self ]
+    tri ;
+
+: init-threads ( -- )
+    init-thread-state
+    init-initial-thread ;
 
 PRIVATE>
 
index c9dfc4a5625163b6586c5c45239e2eb89312f6ea..5c9210e44a6e39d0d8837a1c6903e0f73fb757b2 100644 (file)
@@ -1,9 +1,10 @@
 ! Copyright (C) 2005, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel math sorting words parser io summary
-quotations sequences prettyprint continuations effects
-definitions compiler.units namespaces assocs tools.time generic
-inspector fry locals generalizations macros ;
+quotations sequences sequences.generalizations prettyprint
+continuations effects definitions compiler.units namespaces
+assocs tools.time generic inspector fry locals generalizations
+macros ;
 IN: tools.annotations
 
 <PRIVATE
index 7b9c8b43bc167bdcbc8a099934e12035d384ebd7..d62c192ac1768d42fab6149fff960e71299c08d9 100644 (file)
@@ -54,7 +54,7 @@ IN: tools.completion
     sort-keys <reversed>
     [ 0 [ first max ] reduce 3 /f ] keep
     [ first < ] with filter
-    [ second ] map ;
+    values ;
 
 : complete ( full short -- score )
     [ dupd fuzzy score ] 2keep
index 15fdb9f9b551b5b431e2d1d8da76412f754d770f..6f748cdb311c61240f6ad8e64cd0a0ce8620774b 100644 (file)
@@ -1,10 +1,11 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: threads kernel namespaces continuations combinators
-sequences math namespaces.private continuations.private
-concurrency.messaging quotations kernel.private words
-sequences.private assocs models models.arrow arrays accessors
-generic generic.single definitions make sbufs tools.crossref fry ;
+USING: threads threads.private kernel namespaces continuations
+combinators sequences math namespaces.private
+continuations.private concurrency.messaging quotations
+kernel.private words sequences.private assocs models
+models.arrow arrays accessors generic generic.single definitions
+make sbufs tools.crossref fry ;
 IN: tools.continuations
 
 <PRIVATE
@@ -126,6 +127,7 @@ PRIVATE>
     >n ndrop >c c>
     continue continue-with
     stop suspend (spawn)
+    set-context start-context
 } [ don't-step-into ] each
 
 \ break [ break ] "step-into" set-word-prop
index 89d1fe3821d90db514065c507cebbdc41fcb8c7f..aa3701dc8508ddcf8c4848ebe97f4d4d555ab1af 100644 (file)
@@ -7,6 +7,7 @@ IN: tools.deploy.config
 SYMBOL: deploy-name
 
 SYMBOL: deploy-ui?
+SYMBOL: deploy-console?
 SYMBOL: deploy-math?
 SYMBOL: deploy-unicode?
 SYMBOL: deploy-threads?
@@ -52,6 +53,7 @@ SYMBOL: deploy-image
 : default-config ( vocab -- assoc )
     vocab-name deploy-name associate H{
         { deploy-ui?                f }
+        { deploy-console?           t }
         { deploy-io                 2 }
         { deploy-reflection         1 }
         { deploy-threads?           t }
index 976fc253576204943b433cd1ae470ed5d324a028..27c5bbccf108096a8f87c85eb9e3a9b5344ea976 100755 (executable)
@@ -17,7 +17,7 @@ $nl
 
 ARTICLE: "tools.deploy.usage" "Deploy tool usage"
 "Once the necessary deployment flags have been set, the application can be deployed:"
-{ $subsections deploy }
+{ $subsections deploy deploy-image-only }
 "For example, you can deploy the " { $vocab-link "hello-ui" } " demo which comes with Factor. Note that this demo already has a deployment configuration, so nothing needs to be configured:"
 { $code "\"hello-ui\" deploy" }
 { $list
@@ -61,4 +61,10 @@ ABOUT: "tools.deploy"
 
 HELP: deploy
 { $values { "vocab" "a vocabulary specifier" } }
-{ $description "Deploys " { $snippet "vocab" } ", saving the deployed image as " { $snippet { $emphasis "vocab" } ".image" } "." } ;
+{ $description "Deploys " { $snippet "vocab" } " into a packaged application. This will create a directory containing the Factor VM, a deployed image set up to run the " { $link POSTPONE: MAIN: } " entry point of " { $snippet "vocab" } " at startup, and any " { $link "deploy-resources" } " and shared libraries the application depends on. On Mac OS X, the deployment directory will be a standard " { $snippet ".app" } " bundle executable from Finder. To only generate the Factor image, use " { $link deploy-image-only } "." } ;
+
+HELP: deploy-image-only
+{ $values { "vocab" "a vocabulary specifier" } { "image" "a pathname" } }
+{ $description "Deploys " { $snippet "vocab" } ", saving the deployed image to the location specified by " { $snippet "image" } ". This only builds the Factor image for the vocabulary; to create a complete packaged application, use " { $link deploy } "." } ;
+
+{ deploy deploy-image-only } related-words
index e57cc1f04b1322dfe083d5de7745b4d31f71364b..9430802803fda3e723a1f3bdea115ed28495e3b6 100644 (file)
@@ -1,13 +1,16 @@
 ! Copyright (C) 2007, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: tools.deploy.backend system vocabs.loader kernel
-combinators ;
+combinators tools.deploy.config.editor ;
 IN: tools.deploy
 
 : deploy ( vocab -- ) deploy* ;
 
+: deploy-image-only ( vocab image -- ) 
+    [ vm ] 2dip swap dup deploy-config make-deploy-image drop ;
+
 {
     { [ os macosx? ] [ "tools.deploy.macosx" ] }
     { [ os winnt? ] [ "tools.deploy.windows" ] }
     { [ os unix? ] [ "tools.deploy.unix" ] }
-} cond require
\ No newline at end of file
+} cond require
index c02642ba1d1c5db792d5e865a23108b472e656f4..ecfe52928651092121c935ba08afd16965a1d264 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2007, 2009 Slava Pestov.
+! Copyright (C) 2007, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: io io.files io.files.info.unix io.pathnames
 io.directories io.directories.hierarchy kernel namespaces make
@@ -10,7 +10,10 @@ combinators vocabs.metadata vocabs.loader ;
 IN: tools.deploy.macosx
 
 : bundle-dir ( -- dir )
-    vm parent-directory parent-directory ;
+    running.app?
+    [ vm parent-directory parent-directory ]
+    [ "resource:Factor.app" ]
+    if ;
 
 : copy-bundle-dir ( bundle-name dir -- )
     [ bundle-dir prepend-path swap ] keep
@@ -34,9 +37,6 @@ IN: tools.deploy.macosx
     "Contents/Info.plist" append-path
     write-plist ;
 
-: copy-dll ( bundle-name -- )
-    "Frameworks/libfactor.dylib" copy-bundle-dir ;
-
 : copy-nib ( bundle-name -- )
     deploy-ui? get [
         "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir
@@ -50,11 +50,10 @@ IN: tools.deploy.macosx
 : create-app-dir ( vocab bundle-name -- vm )
     {
         [
-            nip {
-                [ copy-dll ]
-                [ copy-nib ]
-                [ "Contents/Resources" append-path make-directories ]
-            } cleave
+            nip
+            [ copy-nib ]
+            [ "Contents/Resources" append-path make-directories ]
+            [ "Contents/Frameworks" append-path make-directories ] tri
         ]
         [ copy-icns ]
         [ create-app-plist ]
@@ -74,7 +73,6 @@ IN: tools.deploy.macosx
     -> selectFile:inFileViewerRootedAtPath: drop ;
 
 M: macosx deploy* ( vocab -- )
-    ".app deploy tool" assert.app
     "resource:" [
         dup deploy-config [
             bundle-name dup exists? [ delete-tree ] [ drop ] if
index 09219a8e5e7612caf4ae17b3ced2c83e3af4b519..44291a96cc5b5193bce15435631fad31f58b39d1 100755 (executable)
@@ -1,13 +1,15 @@
 ! Copyright (C) 2007, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays alien.libraries accessors io.backend io.encodings.utf8 io.files
-io.streams.c init fry namespaces math make assocs kernel parser
-parser.notes lexer strings.parser vocabs sequences sequences.deep
-sequences.private words memory kernel.private continuations io
-vocabs.loader system strings sets vectors quotations byte-arrays
-sorting compiler.units definitions generic generic.standard
-generic.single tools.deploy.config combinators classes
-classes.builtin slots.private grouping command-line io.pathnames ;
+USING: arrays alien.libraries accessors io.backend
+io.encodings.utf8 io.files io.streams.c init fry namespaces math
+make assocs kernel parser parser.notes lexer strings.parser
+vocabs sequences sequences.deep sequences.private words memory
+kernel.private continuations io vocabs.loader system strings
+sets vectors quotations byte-arrays sorting compiler.units
+definitions generic generic.standard generic.single
+tools.deploy.config combinators combinators.private classes
+vocabs.loader.private classes.builtin slots.private grouping
+command-line io.pathnames ;
 QUALIFIED: bootstrap.stage2
 QUALIFIED: classes.private
 QUALIFIED: compiler.crossref
@@ -20,6 +22,8 @@ QUALIFIED: source-files
 QUALIFIED: source-files.errors
 QUALIFIED: vocabs
 FROM: alien.libraries.private => >deployed-library-path ;
+FROM: namespaces => set ;
+FROM: sets => members ;
 IN: tools.deploy.shaker
 
 ! This file is some hairy shit.
@@ -40,12 +44,8 @@ IN: tools.deploy.shaker
     deploy-threads? get [
         "threads" startup-hooks get delete-at
     ] unless
-    native-io? [
-        "io.thread" startup-hooks get delete-at
-    ] unless
     strip-io? [
         "io.backend" startup-hooks get delete-at
-        "io.thread" startup-hooks get delete-at
     ] when
     strip-dictionary? [
         {
@@ -62,6 +62,13 @@ IN: tools.deploy.shaker
         run-file
     ] when ;
 
+: strip-ui-error-hook ( -- )
+    strip-debugger? deploy-ui? get and "ui" vocab and [
+        "Installing generic UI error hook" show
+        "vocab:tools/deploy/shaker/strip-ui-error-hook.factor"
+        run-file
+    ] when ;
+
 : strip-libc ( -- )
     "libc" vocab [
         "Stripping manual memory management debug code" show
@@ -166,7 +173,6 @@ IN: tools.deploy.shaker
                 "predicate"
                 "predicate-definition"
                 "predicating"
-                "primitive"
                 "reader"
                 "reading"
                 "recursive"
@@ -345,6 +351,8 @@ IN: tools.deploy.shaker
                 lexer-factory
                 print-use-hook
                 root-cache
+                require-when-vocabs
+                require-when-table
                 source-files.errors:error-types
                 source-files.errors:error-observers
                 vocabs:dictionary
@@ -372,10 +380,6 @@ IN: tools.deploy.shaker
                 compiler.errors:compiler-errors
                 continuations:thread-error-hook
             } %
-            
-            deploy-ui? get [
-                "ui-error-hook" "ui.gadgets.worlds" lookup ,
-            ] when
         ] when
 
         "windows-messages" "windows.messages" lookup [ , ] when*
@@ -392,16 +396,15 @@ IN: tools.deploy.shaker
     ] [ drop ] if ;
 
 : strip-c-io ( -- )
+    ! On all platforms, if deploy-io is 1, we strip out C streams.
+    ! On Unix, if deploy-io is 3, we strip out C streams as well.
+    ! On Windows, even if deploy-io is 3, C streams are still used
+    ! for the console, so don't strip it there.
     strip-io?
     deploy-io get 3 = os windows? not and
     or [
-        [
-            c-io-backend forget
-            "io.streams.c" forget-vocab
-            "io-thread-running?" "io.thread" lookup [
-                global delete-at
-            ] when*
-        ] with-compilation-unit
+        "Stripping C I/O" show
+        "vocab:tools/deploy/shaker/strip-c-io.factor" run-file
     ] when ;
 
 : compress ( pred post-process string -- )
@@ -503,7 +506,7 @@ SYMBOL: deploy-vocab
 : write-vocab-manifest ( vocab-manifest-out -- )
     "Writing vocabulary manifest to " write dup print flush
     vocabs "VOCABS:" prefix
-    deploy-libraries get [ libraries get at path>> ] map prune "LIBRARIES:" prefix append
+    deploy-libraries get [ libraries get at path>> ] map members "LIBRARIES:" prefix append
     swap utf8 set-file-lines ;
 
 : prepare-deploy-libraries ( -- )
@@ -529,6 +532,7 @@ SYMBOL: deploy-vocab
     strip-call
     strip-cocoa
     strip-debugger
+    strip-ui-error-hook
     strip-specialized-arrays
     compute-next-methods
     strip-startup-hooks
@@ -546,10 +550,18 @@ SYMBOL: deploy-vocab
     strip-words
     clear-megamorphic-caches ;
 
+: die-with ( error original-error -- * )
+    #! We don't want DCE to drop the error before the die call!
+    [ die 1 exit ] (( a -- * )) call-effect-unsafe ;
+
+: die-with2 ( error original-error -- * )
+    #! We don't want DCE to drop the error before the die call!
+    [ die 1 exit ] (( a b -- * )) call-effect-unsafe ;
+
 : deploy-error-handler ( quot -- )
     [
         strip-debugger?
-        [ error-continuation get call>> callstack>array die 1 exit ]
+        [ original-error get die-with2 ]
         ! Don't reference these words literally, if we're stripping the
         ! debugger out we don't want to load the prettyprinter at all
         [ [:c] execute( -- ) nl [print-error] execute( error -- ) flush ] if
diff --git a/basis/tools/deploy/shaker/strip-c-io.factor b/basis/tools/deploy/shaker/strip-c-io.factor
new file mode 100644 (file)
index 0000000..44c63c5
--- /dev/null
@@ -0,0 +1,10 @@
+USING: compiler.units definitions io.backend io.streams.c kernel
+math threads.private vocabs ;
+
+[
+    c-io-backend forget
+    "io.streams.c" forget-vocab
+] with-compilation-unit
+
+M: object io-multiplex
+    dup 0 = [ drop ] [ 60 60 * 1000 * 1000 * or (sleep) ] if ;
index b7565e7d9e7407985e2eeb5c45413bc545f4de5d..121891b5636b450a37756a6b74ff0b1a4a284a01 100644 (file)
@@ -1,17 +1,14 @@
-USING: compiler.units words vocabs kernel threads.private ;
+USING: compiler.units continuations kernel namespaces
+threads.private words vocabs tools.deploy.shaker ;
 IN: debugger
 
-: consume ( error -- )
-    #! We don't want DCE to drop the error before the die call!
-    drop ;
+: error. ( error -- ) original-error get die-with2 ;
 
-: print-error ( error -- ) die consume ;
-
-: error. ( error -- ) die consume ;
+: print-error ( error -- ) error. ;
 
 "threads" vocab [
     [
         "error-in-thread" "threads" lookup
-        [ [ die 2drop ] define ] [ f "combination" set-word-prop ] bi
+        [ [ drop error. ] define ] [ f "combination" set-word-prop ] bi
     ] with-compilation-unit
 ] when
diff --git a/basis/tools/deploy/shaker/strip-ui-error-hook.factor b/basis/tools/deploy/shaker/strip-ui-error-hook.factor
new file mode 100644 (file)
index 0000000..0664dc5
--- /dev/null
@@ -0,0 +1,7 @@
+USING: namespaces tools.deploy.config fry sequences system kernel ui ui.gadgets.worlds ;
+
+deploy-name get "Factor" or '[
+    _ " encountered an error." append
+    "The application encountered an error it cannot recover from and will now exit."
+    system-alert die
+] ui-error-hook set-global
index 642ee48e6769a8b6f3a58e8154d5f198ff6ad6bc..73dade6657f409d6a9eeb747acccc1688f0e47ac 100644 (file)
@@ -2,9 +2,9 @@ USING: alien alien.c-types kernel math ;
 IN: tools.deploy.test.9
 
 : callback-test ( -- callback )
-    int { int } "cdecl" [ 1 + ] alien-callback ;
+    int { int } cdecl [ 1 + ] alien-callback ;
 
 : indirect-test ( -- )
-    10 callback-test int { int } "cdecl" alien-indirect 11 assert= ;
+    10 callback-test int { int } cdecl alien-indirect 11 assert= ;
 
 MAIN: indirect-test
index f52154ccd0ded30bc2473ad3af305752c1ccea60..7981859573b570c4a139b5e326c6bd3d6a65e418 100755 (executable)
@@ -11,17 +11,13 @@ IN: tools.deploy.windows
 
 CONSTANT: app-icon-resource-id "APPICON"
 
-: copy-dll ( bundle-name -- )
-    "resource:factor.dll" swap copy-file-into ;
-
 :: copy-vm ( executable bundle-name extension -- vm )
     vm "." split1-last drop extension append
     bundle-name executable ".exe" append append-path
     [ copy-file ] keep ;
 
 : create-exe-dir ( vocab bundle-name -- vm )
-    dup copy-dll
-    deploy-ui? get ".exe" ".com" ? copy-vm ;
+    deploy-console? get ".com" ".exe" ? copy-vm ;
 
 : open-in-explorer ( dir -- )
     [ f "open" ] dip absolute-path normalize-separators
index c0b3c9a586cedb2f8e506bc515f63280a9a65993..c8df2f1094d851949ac8d7634dc4c9dce4f84159 100644 (file)
@@ -15,6 +15,11 @@ HOOK: disassemble* disassembler-backend ( from to -- lines )
 
 TR: tabs>spaces "\t" "\s" ;
 
+GENERIC: (>address) ( object -- n )
+
+M: integer (>address) ;
+M: alien (>address) alien-address ;
+
 PRIVATE>
 
 M: byte-array disassemble 
@@ -24,7 +29,7 @@ M: byte-array disassemble
         2array disassemble
     ] with-destructors ;
 
-M: pair disassemble first2 disassemble* [ tabs>spaces print ] each ;
+M: pair disassemble first2 [ (>address) ] bi@ disassemble* [ tabs>spaces print ] each ;
 
 M: word disassemble word-code 2array disassemble ;
 
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index ee77268e2277149fa8d1ff3d55ceffd11a7409f8..e998a5cfdb2af984fa3a327533b70e5e63ff9134 100644 (file)
@@ -12,7 +12,7 @@ IN: tools.disassembler.udis
     { [ os macosx? ] [ "libudis86.0.dylib" ] }
     { [ os unix? ] [ "libudis86.so.0" ] }
     { [ os winnt? ] [ "libudis86.dll" ] }
-} cond "cdecl" add-library
+} cond cdecl add-library
 >>
 
 LIBRARY: libudis86
@@ -32,8 +32,8 @@ STRUCT: ud
     { inp_fill uchar }
     { inp_file void* }
     { inp_ctr uchar }
-    { inp_buff uchar* }
-    { inp_buff_end uchar* }
+    { inp_buff c-string }
+    { inp_buff_end c-string }
     { inp_end uchar }
     { translator void* }
     { insn_offset ulonglong }
@@ -83,19 +83,19 @@ CONSTANT: UD_VENDOR_INTEL 1
 FUNCTION: void ud_init ( ud* u ) ;
 FUNCTION: void ud_set_mode ( ud* u, uchar mode ) ;
 FUNCTION: void ud_set_pc ( ud* u, ulonglong pc ) ;
-FUNCTION: void ud_set_input_buffer ( ud* u, uchar* offset, size_t size ) ;
+FUNCTION: void ud_set_input_buffer ( ud* u, c-string offset, size_t size ) ;
 FUNCTION: void ud_set_vendor ( ud* u, uint vendor ) ;
 FUNCTION: void ud_set_syntax ( ud* u, void* syntax ) ;
 FUNCTION: void ud_input_skip ( ud* u, size_t size ) ;
 FUNCTION: int ud_input_end ( ud* u ) ;
 FUNCTION: uint ud_decode ( ud* u ) ;
 FUNCTION: uint ud_disassemble ( ud* u ) ;
-FUNCTION: char* ud_insn_asm ( ud* u ) ;
+FUNCTION: c-string ud_insn_asm ( ud* u ) ;
 FUNCTION: void* ud_insn_ptr ( ud* u ) ;
 FUNCTION: ulonglong ud_insn_off ( ud* u ) ;
-FUNCTION: char* ud_insn_hex ( ud* u ) ;
+FUNCTION: c-string ud_insn_hex ( ud* u ) ;
 FUNCTION: uint ud_insn_len ( ud* u ) ;
-FUNCTION: char* ud_lookup_mnemonic ( int c ) ;
+FUNCTION: c-string ud_lookup_mnemonic ( int c ) ;
 
 : <ud> ( -- ud )
     ud malloc-struct &free
@@ -103,7 +103,7 @@ FUNCTION: char* ud_lookup_mnemonic ( int c ) ;
     dup cell-bits ud_set_mode
     dup UD_SYN_INTEL ud_set_syntax ;
 
-: with-ud ( quot: ( ud -- ) -- )
+: with-ud ( ..a quot: ( ..a ud -- ..b ) -- ..b )
     [ [ [ <ud> ] dip call ] with-destructors ] with-code-blocks ; inline
 
 SINGLETON: udis-disassembler
index 7d30dac36bc7622afd6bf3ebe6b380a3980f6966..72830b29b44a28d7f724021f6116864989582d55 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel namespaces prettyprint classes.struct
 vm tools.dispatch.private ;
@@ -17,8 +17,7 @@ SYMBOL: last-dispatch-stats
         { "Tuple check count" [ pic-tuple-count>> ] }
     } object-table. ;
 
-: collect-dispatch-stats ( quot -- )
+: collect-dispatch-stats ( quot -- dispatch-statistics )
     reset-dispatch-stats
     call
-    dispatch-stats dispatch-statistics memory>struct
-    last-dispatch-stats set ; inline
+    dispatch-stats dispatch-statistics memory>struct ; inline
index b41d236fd7b89a36e0bf5bf2640f82cb43250776..09748ccbefc3494cf440b24b367932264d9dd758 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: models source-files.errors namespaces models.delay init
 kernel calendar ;
@@ -6,13 +6,14 @@ IN: tools.errors.model
 
 SYMBOLS: (error-list-model) error-list-model ;
 
-(error-list-model) [ f <model> ] initialize
-
-error-list-model [ (error-list-model) get-global 100 milliseconds <delay> ] initialize
-
 SINGLETON: updater
 
-M: updater errors-changed drop f (error-list-model) get-global set-model ;
+M: updater errors-changed
+    drop f (error-list-model) get-global set-model ;
 
-[ updater add-error-observer ] "ui.tools.error-list" add-startup-hook
+[
+    f <model> (error-list-model) set-global
+    (error-list-model) get-global 100 milliseconds <delay> error-list-model set-global
+    updater add-error-observer
+] "ui.tools.error-list" add-startup-hook
 
index 4711f472a390e17ab8643f198625fed40b29aa18..1ea5854939a9e6dd87b360d2b72b470e3e3ad6eb 100644 (file)
@@ -1,9 +1,9 @@
-USING: tools.test tools.memory memory ;
+USING: tools.test tools.memory memory arrays ;
 IN: tools.memory.tests
 
 [ ] [ room. ] unit-test
 [ ] [ heap-stats. ] unit-test
-[ ] [ [ gc gc ] collect-gc-events ] unit-test
+[ t ] [ [ gc gc ] collect-gc-events array? ] unit-test
 [ ] [ gc-events. ] unit-test
 [ ] [ gc-stats. ] unit-test
 [ ] [ gc-summary. ] unit-test
index 0c55612466a0149822615a74f5311e2ff882ebdd..1f1a9876b5d870c26e8c4e34da216185a0d7ffe8 100644 (file)
@@ -4,8 +4,9 @@ USING: accessors arrays assocs binary-search classes
 classes.struct combinators combinators.smart continuations fry
 generalizations generic grouping io io.styles kernel make math
 math.order math.parser math.statistics memory memory.private
-layouts namespaces parser prettyprint sequences sorting
-splitting strings system vm words hints hashtables ;
+layouts namespaces parser prettyprint sequences
+sequences.generalizations sorting splitting strings system vm
+words hints hashtables ;
 IN: tools.memory
 
 <PRIVATE
@@ -90,12 +91,10 @@ PRIVATE>
         ] each 2drop
     ] tabular-output nl ;
 
-SYMBOL: gc-events
-
-: collect-gc-events ( quot -- )
+: collect-gc-events ( quot -- gc-events )
     enable-gc-events
     [ ] [ disable-gc-events drop ] cleanup
-    disable-gc-events [ gc-event memory>struct ] map gc-events set ; inline
+    disable-gc-events [ gc-event memory>struct ] map ; inline
 
 <PRIVATE
 
@@ -164,6 +163,8 @@ TUPLE: gc-stats collections times ;
 
 PRIVATE>
 
+SYMBOL: gc-events
+
 : gc-event. ( event -- )
     {
         { "Event type:" [ op>> gc-op-string ] }
index 5c31cdaeb481b664ca6359db8db32939178e0bba..b02b800463f2b94a5044dc6d0e83a1834793e32e 100644 (file)
@@ -21,9 +21,9 @@ IN: tools.profiler.tests
 
 [ ] [ \ + usage-profile. ] unit-test
 
-: callback-test ( -- callback ) void { } "cdecl" [ ] alien-callback ;
+: callback-test ( -- callback ) void { } cdecl [ ] alien-callback ;
 
-: indirect-test ( callback -- ) void { } "cdecl" alien-indirect ;
+: indirect-test ( callback -- ) void { } cdecl alien-indirect ;
 
 : foobar ( -- ) ;
 
index b0ce5dfbe4a173326386f7f68c9d1bf9d2134d70..c79d8b443c00799363ba63611c31335b7f7e4fef 100644 (file)
@@ -5,6 +5,7 @@ io io.styles namespaces assocs kernel.private strings
 combinators sorting math.parser vocabs definitions
 tools.profiler.private tools.crossref continuations generic
 compiler.units compiler.crossref sets classes fry ;
+FROM: sets => members ;
 IN: tools.profiler
 
 : profile ( quot -- )
@@ -41,7 +42,7 @@ IN: tools.profiler
     [ smart-usage [ word? ] filter ]
     [ generic-call-sites-of keys ]
     [ effect-dependencies-of keys ]
-    tri 3append prune ;
+    tri 3append members ;
 
 : usage-counters ( word -- alist )
     profiler-usage counters ;
index fee37496c8ffd20c8f6a6451996fb7c441c4c711..8fd3e53e19230db9ab725828e5666de54998fdc3 100644 (file)
@@ -94,7 +94,7 @@ M: bad-developer-name summary
     ] with-string-writer ;
 
 : set-scaffold-main-file ( vocab path -- )
-    [ main-file-string ] dip utf8 set-file-contents ;
+    [ main-file-string 1array ] dip utf8 set-file-lines ;
 
 : scaffold-main ( vocab-root vocab -- )
     [ ".factor" vocab-root/vocab/suffix>path ] keep swap scaffolding? [
@@ -106,8 +106,8 @@ M: bad-developer-name summary
 : scaffold-metadata ( vocab file contents -- )
     [ ensure-vocab-exists ] 2dip
     [
-        [ vocab/file>path ] dip swap scaffolding? [
-            utf8 set-file-contents
+        [ vocab/file>path ] dip 1array swap scaffolding? [
+            utf8 set-file-lines
         ] [
             2drop
         ] if
@@ -267,6 +267,9 @@ PRIVATE>
 : scaffold-summary ( vocab summary -- )
     [ "summary.txt" ] dip scaffold-metadata ;
 
+: scaffold-platforms ( vocab platforms -- )
+    [ "platforms.txt" ] dip scaffold-metadata ;
+
 : scaffold-vocab ( vocab-root string -- )
     {
         [ scaffold-directory ]
index 8dda4fe16c484eb7b6ddc969609c2b572e546105..b789fa853785de6455618564f7b41885e73b2950 100644 (file)
@@ -1,12 +1,13 @@
-! Copyright (C) 2003, 2009 Slava Pestov.
+! Copyright (C) 2003, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs combinators compiler.units
-continuations debugger effects fry generalizations io io.files
-io.styles kernel lexer locals macros math.parser namespaces parser
-vocabs.parser prettyprint quotations sequences source-files splitting
+continuations debugger effects fry generalizations
+sequences.generalizations io io.files io.styles kernel lexer
+locals macros math.parser namespaces parser vocabs.parser
+prettyprint quotations sequences source-files splitting
 stack-checker summary unicode.case vectors vocabs vocabs.loader
-vocabs.files words tools.errors source-files.errors io.streams.string
-make compiler.errors ;
+vocabs.files vocabs.metadata words tools.errors
+source-files.errors io.streams.string make compiler.errors ;
 IN: tools.test
 
 TUPLE: test-failure < source-file-error continuation ;
@@ -118,15 +119,26 @@ PRIVATE>
         '[ _ run-file ] [ file-failure ] recover
     ] with-variable ;
 
+SYMBOL: forget-tests?
+
 <PRIVATE
 
-: run-vocab-tests ( vocab -- )
+: forget-tests ( files -- )
+    forget-tests? get
+    [ [ [ forget-source ] each ] with-compilation-unit ] [ drop ] if ;
+
+: test-vocab ( vocab -- )
     vocab dup [
         dup source-loaded?>> [
-            vocab-tests [ run-test-file ] each
+            vocab-tests
+            [ [ run-test-file ] each ]
+            [ forget-tests ]
+            bi
         ] [ drop ] if
     ] [ drop ] if ;
 
+: test-vocabs ( vocabs -- ) [ test-vocab ] each ;
+
 PRIVATE>
 
 TEST: unit-test
@@ -145,7 +157,6 @@ M: test-failure error. ( error -- )
 
 : :test-failures ( -- ) test-failures get errors. ;
 
-: test ( prefix -- )
-    child-vocabs [ run-vocab-tests ] each ;
+: test ( prefix -- ) child-vocabs test-vocabs ;
 
-: test-all ( -- ) "" test ;
+: test-all ( -- ) vocabs filter-don't-test test-vocabs ;
index ea85fb1129c3e02ecb8e29bf39abed0784e02f8f..1bb0918b82e977ce190c72cb12edb4eb00f1e86d 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Slava Pestov.\r
+! Copyright (C) 2008, 2010 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: threads kernel prettyprint prettyprint.config\r
 io io.styles sequences assocs namespaces sorting boxes\r
@@ -7,7 +7,9 @@ IN: tools.threads
 \r
 : thread. ( thread -- )\r
     dup id>> pprint-cell\r
-    dup name>> over [ write-object ] with-cell\r
+    dup name>> [\r
+        over write-object\r
+    ] with-cell\r
     dup state>> [\r
         [ dup self eq? "running" "yield" ? ] unless*\r
         write\r
index d28202f8440a20c0b23a84f0ba7c1f8a41e8ce85..cbcd38c80159769d4844c18bf8753fb2fa7ec94d 100644 (file)
@@ -27,11 +27,11 @@ HELP: time
 { benchmark system-micros time } related-words
 
 HELP: collect-gc-events
-{ $values { "quot" quotation } }
-{ $description "Calls the quotation, storing an array of " { $link gc-event } " instances in the " { $link gc-events } " variable." }
+{ $values { "quot" quotation } { "gc-events" "a sequence of " { $link gc-event } " instances" } }
+{ $description "Calls the quotation and outputs a sequence of " { $link gc-event } " instances." }
 { $notes "The " { $link time } " combinator automatically calls this combinator." } ;
 
 HELP: collect-dispatch-stats
-{ $values { "quot" quotation } }
-{ $description "Calls the quotation, collecting method dispatch statistics and storing them in the " { $link last-dispatch-stats } " variable. " }
+{ $values { "quot" quotation } { "dispatch-statistics" dispatch-statistics } }
+{ $description "Calls the quotation and outputs a " { $link dispatch-statistics } " instance." }
 { $notes "The " { $link time } " combinator automatically calls this combinator." } ;
index 0bd97f563dbf3bbc5b0e8468f21446938bb54675..8355f1f20cb14dd52b1b6c593f611e9f3351538a 100644 (file)
@@ -1,6 +1,6 @@
-! Copyright (C) 2003, 2009 Slava Pestov.
+! Copyright (C) 2003, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: system kernel math io prettyprint tools.memory
+USING: system kernel math namespaces io prettyprint tools.memory
 tools.dispatch ;
 IN: tools.time
 
@@ -18,5 +18,7 @@ IN: tools.time
     "gc-summary.      - Print aggregate garbage collection statistics" print ;
 
 : time ( quot -- )
-    [ [ benchmark ] collect-dispatch-stats ] collect-gc-events
+    [
+        [ benchmark ] collect-dispatch-stats last-dispatch-stats set
+    ] collect-gc-events gc-events set
     time. nl time-banner. ; inline
index 35a9ce7787e831f99acdabced598c16a654328b0..3cc53cda9d58ef059ef74028b9da17637dea3338 100644 (file)
@@ -145,7 +145,7 @@ SYMBOL: +stopped+
 : associate-thread ( walker -- )
     walker-thread tset
     [ f walker-thread tget send-synchronous drop ]
-    self (>>exit-handler) ;
+    self exit-handler<< ;
 
 : start-walker-thread ( status continuation -- thread' )
     self [
index dae30fa9d80d7cafec5e0d89e4e7fd0e83ff452e..98a083a2babb32d878583b304676638859ec2fdd 100644 (file)
@@ -3,12 +3,11 @@ USING: typed compiler.cfg.debugger compiler.tree.debugger
 tools.disassembler words ;
 IN: typed.debugger
 
-: typed-test-mr ( word -- mrs )
-    "typed-word" word-prop test-mr ; inline
-: typed-test-mr. ( word -- )
-    "typed-word" word-prop test-mr mr. ; inline
+M: typed-word test-builder
+    "typed-word" word-prop test-builder ;
+
 : typed-optimized. ( word -- )
-    "typed-word" word-prop optimized. ; inline
+    "typed-word" word-prop optimized. ;
 
-: typed-disassemble ( word -- )
-    "typed-word" word-prop disassemble ; inline
+M: typed-word disassemble ( word -- )
+    "typed-word" word-prop disassemble ;
index 7f984ccaf25d49fd6a823764ab4e60f995d6b87b..bca1136ee6bb57f44eefd378931a4d3526e5772e 100644 (file)
@@ -1,5 +1,6 @@
 USING: accessors effects eval kernel layouts math namespaces
-quotations tools.test typed words ;
+quotations tools.test typed words words.symbol
+compiler.tree.debugger prettyprint definitions compiler.units ;
 IN: typed.tests
 
 TYPED: f+ ( a: float b: float -- c: float )
@@ -122,3 +123,38 @@ TYPED: recompile-fail ( a: subclass -- ? ) buh get eq? ;
 [ ] [ "IN: typed.tests TUPLE: subclass < superclass { y read-only } ;" eval( -- ) ] unit-test
 
 [ t ] [ subclass new [ buh set ] [ recompile-fail ] bi ] unit-test
+
+! Make sure that foldable and flushable work on typed words
+TYPED: add ( a: integer b: integer -- c: integer ) + ; foldable
+
+[ [ 3 ] ] [ [ 1 2 add ] cleaned-up-tree nodes>quot ] unit-test
+
+TYPED: flush-test ( s: symbol -- ? ) on t ; flushable
+
+: flush-print-1 ( symbol -- ) flush-test drop ;
+: flush-print-2 ( symbol -- ) flush-test . ;
+
+SYMBOL: a-symbol
+
+[ f ] [
+    f a-symbol [
+        a-symbol flush-print-1
+        a-symbol get
+    ] with-variable
+] unit-test
+
+[ t ] [
+    f a-symbol [
+        a-symbol flush-print-2
+        a-symbol get
+    ] with-variable
+] unit-test
+
+! Forgetting an unboxed final class should work
+TUPLE: forget-class { x read-only } ; final
+
+TYPED: forget-fail ( a: forget-class -- ) drop ;
+
+[ ] [ [ \ forget-class forget ] with-compilation-unit ] unit-test
+
+[ ] [ [ \ forget-fail forget ] with-compilation-unit ] unit-test
index 8a85ca1afbd4256199db1f233d7fe04ca86651a9..50da7b1bad5e1386c45c563058ad97cb44837662 100644 (file)
@@ -2,7 +2,7 @@
 USING: accessors arrays classes classes.tuple combinators
 combinators.short-circuit definitions effects fry hints
 math kernel kernel.private namespaces parser quotations
-sequences slots words locals 
+sequences slots words locals effects.parser
 locals.parser macros stack-checker.dependencies ;
 FROM: classes.tuple.private => tuple-layout ;
 IN: typed
@@ -11,8 +11,8 @@ ERROR: type-mismatch-error word expected-types ;
 ERROR: input-mismatch-error < type-mismatch-error ;
 ERROR: output-mismatch-error < type-mismatch-error ;
 
-PREDICATE: typed-gensym < word "typed-gensym" word-prop ;
-PREDICATE: typed-word < word "typed-word" word-prop ;
+PREDICATE: typed-gensym < word "typed-gensym" word-prop >boolean ;
+PREDICATE: typed-word < word "typed-word" word-prop >boolean ;
 
 <PRIVATE
 
@@ -120,10 +120,10 @@ MACRO: (typed) ( word def effect -- quot )
     [ effect-in-types unboxed-types [ "in" swap 2array ] map ]
     [ effect-out-types unboxed-types [ "out" swap 2array ] map ] bi <effect> ;
 
-M: typed-gensym stack-effect
-    call-next-method unboxed-effect ;
-M: typed-gensym crossref? 
-    "typed-gensym" word-prop crossref? ;
+M: typed-gensym stack-effect call-next-method unboxed-effect ;
+M: typed-gensym parent-word "typed-gensym" word-prop ;
+M: typed-gensym crossref? parent-word crossref? ;
+M: typed-gensym where parent-word where ;
 
 : define-typed-gensym ( word def effect -- gensym )
     [ 2drop <typed-gensym> dup ]
@@ -164,6 +164,7 @@ SYNTAX: TYPED:
 SYNTAX: TYPED::
     (::) define-typed ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [ "typed.prettyprint" require ] when
+{ "typed" "prettyprint" } "typed.prettyprint" require-when
+{ "typed" "compiler.cfg.debugger" } "typed.debugger" require-when
index 8eeca89c2f14903c396d40e4abbd673eee0e17ad..7982458bb420b28970a60385087003a8115d6f58 100644 (file)
@@ -1,14 +1,14 @@
 ! Copyright (C) 2006, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types arrays assocs classes cocoa
-cocoa.application cocoa.classes cocoa.messages cocoa.nibs
+USING: accessors alien.c-types alien.data arrays assocs classes
+cocoa cocoa.application cocoa.classes cocoa.messages cocoa.nibs
 cocoa.pasteboard cocoa.runtime cocoa.subclassing cocoa.types
 cocoa.views cocoa.windows combinators command-line
 core-foundation core-foundation.run-loop core-graphics
 core-graphics.types destructors fry generalizations io.thread
-kernel libc literals locals math math.bitwise math.rectangles memory
-namespaces sequences threads ui colors
-ui.backend ui.backend.cocoa.views ui.clipboards ui.gadgets
+kernel libc literals locals math math.bitwise math.rectangles
+memory namespaces sequences threads ui colors ui.backend
+ui.backend.cocoa.views ui.clipboards ui.gadgets
 ui.gadgets.worlds ui.pixel-formats ui.pixel-formats.private
 ui.private words.symbol ;
 IN: ui.backend.cocoa
@@ -55,8 +55,11 @@ M: cocoa-ui-backend (free-pixel-format)
 M: cocoa-ui-backend (pixel-format-attribute)
     [ handle>> ] [ >NSOpenGLPFA ] bi*
     [ drop f ]
-    [ first 0 <int> [ swap 0 -> getValues:forAttribute:forVirtualScreen: ] keep *int ]
-    if-empty ;
+    [
+        first
+        { int } [ swap 0 -> getValues:forAttribute:forVirtualScreen: ] [ ]
+        with-out-parameters
+    ] if-empty ;
 
 TUPLE: pasteboard handle ;
 
@@ -138,7 +141,7 @@ M:: cocoa-ui-backend (open-window) ( world -- )
     window world window-loc>> auto-position
     world window save-position
     window install-window-delegate
-    view window <window-handle> world (>>handle)
+    view window <window-handle> world handle<<
     window f -> makeKeyAndOrderFront: ;
 
 M: cocoa-ui-backend (close-window) ( handle -- )
@@ -213,6 +216,18 @@ M: cocoa-ui-backend offscreen-pixels ( world -- alien w h )
 M: cocoa-ui-backend beep ( -- )
     NSBeep ;
 
+M: cocoa-ui-backend system-alert
+    invalidate-run-loop-timers
+    NSAlert -> alloc -> init -> autorelease [
+        {
+            [ swap <NSString> -> setInformativeText: ]
+            [ swap <NSString> -> setMessageText: ]
+            [ "OK" <NSString> -> addButtonWithTitle: drop ]
+            [ -> runModal drop ]
+        } cleave
+    ] [ 2drop ] if*
+    init-thread-timer ;
+
 CLASS: {
     { +superclass+ "NSObject" }
     { +name+ "FactorApplicationDelegate" }
@@ -237,7 +252,7 @@ M: cocoa-ui-backend (with-ui)
             init-clipboard
             cocoa-startup-hook get call( -- )
             start-ui
-            f io-thread-running? set-global
+            stop-io-thread
             init-thread-timer
             reset-run-loop
             NSApp -> run
index 88e5f243ad5602be777a118e50ce555b7cad4833..331f26aa32e0247b4c2ca960b14480b8adc07790 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2006, 2008 Slava Pestov
+! Copyright (C) 2006, 2010 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.c-types alien.data alien.strings
 arrays assocs cocoa kernel math cocoa.messages cocoa.subclassing
@@ -90,11 +90,11 @@ CONSTANT: key-codes
     [ drop window ]
     2tri send-button-up ;
 
-: send-wheel$ ( view event -- )
-    [ nip [ -> deltaX ] [ -> deltaY ] bi [ sgn neg ] bi@ 2array ]
+: send-scroll$ ( view event -- )
+    [ nip [ -> deltaX ] [ -> deltaY ] bi [ neg ] bi@ 2array ]
     [ mouse-location ]
     [ drop window ]
-    2tri send-wheel ;
+    2tri send-scroll ;
 
 : send-action$ ( view event gesture -- junk )
     [ drop window ] dip send-action f ;
@@ -149,7 +149,7 @@ CLASS: {
 
 ! Rendering
 { "drawRect:" void { id SEL NSRect }
-    [ 2drop window relayout-1 yield ]
+    [ 2drop window draw-world ]
 }
 
 ! Events
@@ -206,7 +206,7 @@ CLASS: {
 }
 
 { "scrollWheel:" void { id SEL id }
-    [ nip send-wheel$ ]
+    [ nip send-scroll$ ]
 }
 
 { "keyDown:" void { id SEL id }
old mode 100644 (file)
new mode 100755 (executable)
index 69b09dc..8b8bd3c
@@ -1,5 +1,5 @@
 ! Copyright (C) 2005, 2006 Doug Coleman.
-! Portions copyright (C) 2007, 2009 Slava Pestov.
+! Portions copyright (C) 2007, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.strings arrays assocs ui
 ui.private ui.gadgets ui.gadgets.private ui.backend
@@ -14,6 +14,7 @@ math.order calendar ascii sets io.encodings.utf16n
 windows.errors literals ui.pixel-formats
 ui.pixel-formats.private memoize classes colors
 specialized-arrays classes.struct alien.data ;
+FROM: namespaces => set ;
 SPECIALIZED-ARRAY: POINT
 IN: ui.backend.windows
 
@@ -58,16 +59,16 @@ PIXEL-FORMAT-ATTRIBUTE-TABLE: WGL_ARB { $ WGL_SUPPORT_OPENGL_ARB 1 } H{
     drop f ;
 
 : arb-make-pixel-format ( world attributes -- pf )
-    [ handle>> hDC>> ] dip >WGL_ARB-int-array f 1 0 <int> 0 <int>
-    [ wglChoosePixelFormatARB win32-error=0/f ] 2keep drop *int ;
+    [ handle>> hDC>> ] dip >WGL_ARB-int-array f 1 { int int }
+    [ wglChoosePixelFormatARB win32-error=0/f ] [ ] with-out-parameters drop ;
 
 : arb-pixel-format-attribute ( pixel-format attribute -- value )
     >WGL_ARB
     [ drop f ] [
         [ [ world>> handle>> hDC>> ] [ handle>> ] bi 0 1 ] dip
-        first <int> 0 <int>
-        [ wglGetPixelFormatAttribivARB win32-error=0/f ]
-        keep *int
+        first <int> { int }
+        [ wglGetPixelFormatAttribivARB win32-error=0/f ] [ ]
+        with-out-parameters
     ] if-empty ;
 
 CONSTANT: pfd-flag-map H{
@@ -212,7 +213,7 @@ PRIVATE>
             dup win32-error=0/f
     
         dup GlobalLock dup win32-error=0/f
-        swapd byte-array>memory
+        rot binary-object memcpy
         dup GlobalUnlock win32-error=0/f
         CF_UNICODETEXT swap SetClipboardData win32-error=0/f
     ] with-clipboard ;
@@ -284,12 +285,12 @@ CONSTANT: window-control>ex-style
 : handle-wm-size ( hWnd uMsg wParam lParam -- )
     2nip
     [ lo-word ] keep hi-word 2array
-    dup { 0 0 } = [ 2drop ] [ swap window [ (>>dim) ] [ drop ] if* ] if ;
+    dup { 0 0 } = [ 2drop ] [ swap window [ dim<< ] [ drop ] if* ] if ;
 
 : handle-wm-move ( hWnd uMsg wParam lParam -- )
     2nip
     [ lo-word ] keep hi-word 2array
-    swap window [ (>>window-loc) ] [ drop ] if* ;
+    swap window [ window-loc<< ] [ drop ] if* ;
 
 CONSTANT: wm-keydown-codes
     H{
@@ -414,7 +415,7 @@ CONSTANT: exclude-keys-wm-char
     ] unless ;
 
 :: set-window-active ( hwnd uMsg wParam lParam ? -- n )
-    ? hwnd window (>>active?)
+    ? hwnd window active?<<
     hwnd uMsg wParam lParam DefWindowProc ;
 
 : handle-wm-syscommand ( hWnd uMsg wParam lParam -- n )
@@ -474,7 +475,8 @@ SYMBOL: nc-buttons
     message>button nc-buttons get
     swap [ push ] [ remove! drop ] if ;
 
-: mouse-wheel ( wParam -- array ) >lo-hi [ sgn neg ] map ;
+: mouse-scroll ( wParam -- array )
+    >lo-hi [ -80 /f ] map ;
 
 : mouse-event>gesture ( uMsg -- button )
     key-modifiers swap message>button
@@ -533,7 +535,7 @@ SYMBOL: nc-buttons
     >lo-hi swap window move-hand fire-motion ;
 
 :: handle-wm-mousewheel ( hWnd uMsg wParam lParam -- )
-    wParam mouse-wheel hand-loc get hWnd window send-wheel ;
+    wParam mouse-scroll hand-loc get hWnd window send-scroll ;
 
 : handle-wm-cancelmode ( hWnd uMsg wParam lParam -- )
     #! message sent if windows needs application to stop dragging
@@ -608,7 +610,7 @@ SYMBOL: trace-messages?
 
 ! return 0 if you handle the message, else just let DefWindowProc return its val
 : ui-wndproc ( -- object )
-    uint { void* uint long long } "stdcall" [
+    uint { void* uint long long } stdcall [
         pick
         trace-messages? get-global [ dup windows-message-name name>> print flush ] when
         wm-handlers get-global at* [ call ] [ drop DefWindowProc ] if
@@ -627,12 +629,12 @@ M: windows-ui-backend do-events
     WNDCLASSEX <struct> f GetModuleHandle
     class-name-ptr pick GetClassInfoEx 0 = [
         WNDCLASSEX heap-size >>cbSize
-        { CS_HREDRAW CS_VREDRAW CS_OWNDC } flags >>style
+        flags{ CS_HREDRAW CS_VREDRAW CS_OWNDC } >>style
         ui-wndproc >>lpfnWndProc
         0 >>cbClsExtra
         0 >>cbWndExtra
         f GetModuleHandle >>hInstance
-        f GetModuleHandle "fraptor" utf16n string>alien LoadIcon >>hIcon
+        f GetModuleHandle "APPICON" utf16n string>alien LoadIcon >>hIcon
         f IDC_ARROW LoadCursor >>hCursor
 
         class-name-ptr >>lpszClassName
@@ -783,6 +785,9 @@ M: windows-ui-backend (with-ui)
 M: windows-ui-backend beep ( -- )
     0 MessageBeep drop ;
 
+M: windows-ui-backend system-alert
+    [ f ] 2dip swap MB_OK MessageBox drop ;
+
 : fullscreen-RECT ( hwnd -- RECT )
     MONITOR_DEFAULTTONEAREST MonitorFromWindow
     MONITORINFOEX <struct>
@@ -792,7 +797,7 @@ M: windows-ui-backend beep ( -- )
 : client-area>RECT ( hwnd -- RECT )
     RECT <struct>
     [ GetClientRect win32-error=0/f ]
-    [ >c-ptr byte-array>POINT-array [ ClientToScreen drop ] with each ]
+    [ >c-ptr POINT-array-cast [ ClientToScreen drop ] with each ]
     [ nip ] 2tri ;
 
 : hwnd>RECT ( hwnd -- RECT )
@@ -807,8 +812,7 @@ M: windows-ui-backend (ungrab-input) ( handle -- )
     f ClipCursor drop
     1 ShowCursor drop ;
 
-: fullscreen-flags ( -- n )
-    { WS_CAPTION WS_BORDER WS_THICKFRAME } flags ; inline
+CONSTANT: fullscreen-flags flags{ WS_CAPTION WS_BORDER WS_THICKFRAME }
 
 : enter-fullscreen ( world -- )
     handle>> hWnd>>
@@ -828,24 +832,25 @@ M: windows-ui-backend (ungrab-input) ( handle -- )
     } cleave ;
 
 : exit-fullscreen ( world -- )
-    dup handle>> hWnd>>
+    [ handle>> hWnd>> ] [ world>style ] bi
     {
-        [ GWL_STYLE rot world>style SetWindowLong win32-error=0/f ]
+        [ [ GWL_STYLE ] dip SetWindowLong win32-error=0/f ]
         [
+            drop
             f
             over hwnd>RECT get-RECT-dimensions
-            { SWP_NOMOVE SWP_NOSIZE SWP_NOZORDER SWP_FRAMECHANGED } flags
+            flags{ SWP_NOMOVE SWP_NOSIZE SWP_NOZORDER SWP_FRAMECHANGED }
             SetWindowPos win32-error=0/f
         ]
-        [ SW_RESTORE ShowWindow win32-error=0/f ]
-    } cleave ;
+        [ drop SW_RESTORE ShowWindow win32-error=0/f ]
+    } 2cleave ;
 
 M: windows-ui-backend (set-fullscreen) ( ? world -- )
     [ enter-fullscreen ] [ exit-fullscreen ] if ;
 
 M: windows-ui-backend (fullscreen?) ( world -- ? )
-    [ handle>> hWnd>> hwnd>RECT ]
-    [ handle>> hWnd>> fullscreen-RECT ] bi
+    handle>> hWnd>>
+    [ hwnd>RECT ] [ fullscreen-RECT ] bi
     [ get-RECT-dimensions 2array 2nip ] bi@ = ;
 
 windows-ui-backend ui-backend set-global
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 673dd8e9c3899a592e42bdcca393a1f8b7ea4c35..f3d603ddd8fe920a33eb64f8a4878bcd89ca42f4 100644 (file)
@@ -1,18 +1,52 @@
-! Copyright (C) 2005, 2009 Eduardo Cavazos and Slava Pestov
+! Copyright (C) 2005, 2010 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types ascii assocs classes.struct combinators
-combinators.short-circuit command-line environment io.encodings.ascii
-io.encodings.string io.encodings.utf8 kernel literals locals math
-namespaces sequences specialized-arrays.instances.alien.c-types.uchar
-strings ui ui.backend ui.clipboards ui.event-loop ui.gadgets
-ui.gadgets.private ui.gadgets.worlds ui.gestures ui.pixel-formats
-ui.pixel-formats.private ui.private x11 x11.clipboard x11.constants
-x11.events x11.glx x11.io x11.windows x11.xim x11.xlib ;
+USING: accessors arrays alien.c-types alien.data alien.syntax ascii
+assocs classes.struct combinators combinators.short-circuit
+command-line environment io.encodings.ascii io.encodings.string
+io.encodings.utf8 kernel literals locals math namespaces
+sequences specialized-arrays strings ui ui.backend ui.clipboards
+ui.event-loop ui.gadgets ui.gadgets.private ui.gadgets.worlds
+ui.gestures ui.pixel-formats ui.pixel-formats.private ui.private
+x11 x11.clipboard x11.constants x11.events x11.glx x11.io
+x11.windows x11.xim x11.xlib ;
+FROM: libc => system ;
+SPECIALIZED-ARRAYS: uchar ulong ;
 IN: ui.backend.x11
 
 SINGLETON: x11-ui-backend
 
+: XA_NET_SUPPORTED ( -- atom ) "_NET_SUPPORTED" x-atom ;
 : XA_NET_WM_NAME ( -- atom ) "_NET_WM_NAME" x-atom ;
+: XA_NET_WM_STATE ( -- atom ) "_NET_WM_STATE" x-atom ;
+: XA_NET_WM_STATE_FULLSCREEN ( -- atom ) "_NET_WM_STATE_FULLSCREEN" x-atom ;
+: XA_NET_ACTIVE_WINDOW ( -- atom ) "_NET_ACTIVE_WINDOW" x-atom ;
+
+: supported-net-wm-hints ( -- seq )
+    { Atom int ulong ulong pointer: Atom }
+    [| type format n-atoms bytes-after atoms |
+        dpy get
+        root get
+        XA_NET_SUPPORTED
+        0
+        ulong c-type-interval nip
+        0
+        XA_ATOM
+        type
+        format
+        n-atoms
+        bytes-after
+        atoms
+        XGetWindowProperty
+        Success assert=
+    ]
+    [| type format n-atoms bytes-after atoms |
+        atoms n-atoms <direct-ulong-array> >array
+        atoms XFree
+    ]
+    with-out-parameters ;
+
+: net-wm-hint-supported? ( atom -- ? )
+    supported-net-wm-hints member? ;
 
 TUPLE: x11-handle-base glx ;
 TUPLE: x11-handle < x11-handle-base window xic ;
@@ -28,7 +62,7 @@ M: world configure-event
     ! In case dimensions didn't change
     relayout-1 ;
 
-PIXEL-FORMAT-ATTRIBUTE-TABLE: glx-visual { $ GLX_USE_GL $ GLX_RGBA } H{
+PIXEL-FORMAT-ATTRIBUTE-TABLE: glx-visual { $ GLX_RGBA } H{
     { double-buffered { $ GLX_DOUBLEBUFFER } }
     { stereo { $ GLX_STEREO } }
     { color-bits { $ GLX_BUFFER_SIZE } }
@@ -49,8 +83,7 @@ PIXEL-FORMAT-ATTRIBUTE-TABLE: glx-visual { $ GLX_USE_GL $ GLX_RGBA } H{
 
 M: x11-ui-backend (make-pixel-format)
     [ drop dpy get scr get ] dip
-    >glx-visual-int-array glXChooseVisual
-    XVisualInfo memory>struct ;
+    >glx-visual-int-array glXChooseVisual ;
 
 M: x11-ui-backend (free-pixel-format)
     handle>> XFree ;
@@ -60,7 +93,7 @@ M: x11-ui-backend (pixel-format-attribute)
     [ handle>> ] [ >glx-visual ] bi*
     [ 2drop f ] [
         first
-        0 <int> [ glXGetConfig drop ] keep *int
+        { int } [ glXGetConfig drop ] [ ] with-out-parameters
     ] if-empty ;
 
 CONSTANT: modifiers
@@ -149,9 +182,9 @@ M: world button-up-event
         { 7 { 1 0 } }
     } at ;
 
-M: world wheel-event
+M: world scroll-event
     [ [ mouse-event>scroll-direction ] [ event-loc ] bi ] dip
-    send-wheel ;
+    send-scroll ;
 
 M: world enter-event motion-event ;
 
@@ -171,8 +204,7 @@ M: world selection-notify-event
     user-input ;
 
 : supported-type? ( atom -- ? )
-    { "UTF8_STRING" "STRING" "TEXT" }
-    [ x-atom = ] with any? ;
+    XA_UTF8_STRING XA_STRING XA_TEXT 3array member? ;
 
 : clipboard-for-atom ( atom -- clipboard )
     {
@@ -195,8 +227,8 @@ M: world selection-notify-event
 M: world selection-request-event
     drop dup target>> {
         { [ dup supported-type? ] [ drop dup set-selection-prop send-notify-success ] }
-        { [ dup "TARGETS" x-atom = ] [ drop dup set-targets-prop send-notify-success ] }
-        { [ dup "TIMESTAMP" x-atom = ] [ drop dup set-timestamp-prop send-notify-success ] }
+        { [ dup XA_TARGETS = ] [ drop dup set-targets-prop send-notify-success ] }
+        { [ dup XA_TIMESTAMP = ] [ drop dup set-timestamp-prop send-notify-success ] }
         [ drop send-notify-failure ]
     } cond ;
 
@@ -233,7 +265,7 @@ M: x11-ui-backend do-events
 
 M: x-clipboard copy-clipboard
     [ x-clipboard@ own-selection ] keep
-    (>>contents) ;
+    contents<< ;
 
 M: x-clipboard paste-clipboard
     [ find-world handle>> window>> ] dip atom>> convert-selection ;
@@ -257,31 +289,57 @@ M: x11-ui-backend set-title ( string world -- )
     handle>> window>> swap
     [ dpy get ] 2dip [ set-title-old ] [ set-title-new ] 3bi ;
 
-: make-fullscreen-msg ( world ? -- msg )
+: make-fullscreen-msg ( window ? -- msg )
     XClientMessageEvent <struct>
-    ClientMessage >>type
-    dpy get >>display
-    "_NET_WM_STATE" x-atom >>message_type
-    swap _NET_WM_STATE_ADD _NET_WM_STATE_REMOVE ? >>data0
-    swap handle>> window>> >>window
-    32 >>format
-    "_NET_WM_STATE_FULLSCREEN" x-atom >>data1 ;
+        ClientMessage >>type
+        dpy get >>display
+        XA_NET_WM_STATE >>message_type
+        swap _NET_WM_STATE_ADD _NET_WM_STATE_REMOVE ? >>data0
+        swap >>window
+        32 >>format
+        XA_NET_WM_STATE_FULLSCREEN >>data1 ;
+
+: send-event ( event -- )
+    [
+        dpy get
+        root get
+        0
+        SubstructureNotifyMask SubstructureRedirectMask bitor
+    ] dip XSendEvent drop ;
 
 M: x11-ui-backend (set-fullscreen) ( world ? -- )
-    [ dpy get root get 0 SubstructureNotifyMask ] 2dip
-    make-fullscreen-msg XSendEvent drop ;
+    [ handle>> window>> ] dip make-fullscreen-msg send-event ;
 
 M: x11-ui-backend (open-window) ( world -- )
-    dup gadget-window
-    handle>> window>>
-    [ set-closable ] [ dpy get swap set-class ] [ map-window ] tri ;
+    dup gadget-window handle>> window>>
+    [ set-closable ]
+    [ [ dpy get ] dip set-class ]
+    [ map-window ]
+    tri ;
+
+: make-raise-window-msg ( window -- msg )
+    XClientMessageEvent <struct>
+        ClientMessage >>type
+        1 >>send_event
+        dpy get >>display
+        swap >>window
+        XA_NET_ACTIVE_WINDOW >>message_type
+        32 >>format ;
+
+: raise-window-new ( window -- )
+    make-raise-window-msg send-event ;
+
+: raise-window-old ( window -- )
+    [ dpy get ] dip
+    [ RevertToPointerRoot CurrentTime XSetInputFocus drop ]
+    [ XRaiseWindow drop ]
+    2bi ;
 
 M: x11-ui-backend raise-window* ( world -- )
     handle>> [
-        dpy get swap window>>
-        [ RevertToPointerRoot CurrentTime XSetInputFocus drop ]
-        [ XRaiseWindow drop ]
-        2bi
+        window>>
+        XA_NET_ACTIVE_WINDOW net-wm-hint-supported?
+        [ raise-window-new ] [ raise-window-old ] if
     ] when* ;
 
 M: x11-handle select-gl-context ( handle -- )
@@ -327,6 +385,17 @@ M: x11-ui-backend (with-ui) ( quot -- )
 M: x11-ui-backend beep ( -- )
     dpy get 100 XBell drop ;
 
+<PRIVATE
+: escape-' ( string -- string' )
+    [ dup CHAR: ' = [ drop "'\\''" ] [ 1string ] if ] { } map-as concat ;
+
+: xmessage ( string -- )
+    escape-' "/usr/bin/env xmessage '" "'" surround system drop ;
+PRIVATE>
+
+M: x11-ui-backend system-alert
+    "\n\n" glue xmessage ;
+
 : black ( -- xcolor ) 0 0 0 0 0 0 XColor <struct-boa> ; inline
 
 M:: x11-ui-backend (grab-input) ( handle -- )
index 42c3f6ddef79a0ce77639b42cf8a69d0ba1915d5..ec7bb5993151b62a1117f152b4d617a0ceccbd8b 100644 (file)
@@ -15,7 +15,7 @@ GENERIC: set-clipboard-contents ( string clipboard -- )
 
 M: clipboard clipboard-contents contents>> ;
 
-M: clipboard set-clipboard-contents (>>contents) ;
+M: clipboard set-clipboard-contents contents<< ;
 
 : <clipboard> ( -- clipboard ) "" clipboard boa ;
 
index d0d25a063083b4e39609e5717c205ac2a0eba059..4a68b47f15fdf14ec67bf8c2a5b6ada1a5aeafdd 100644 (file)
@@ -220,8 +220,8 @@ TUPLE: radio-control < button value ;
 M: radio-control model-changed
     2dup [ value>> ] bi@ = >>selected? relayout-1 drop ;
 
-:: <radio-controls> ( parent model assoc quot: ( value model label -- gadget ) -- parent )
-    assoc model [ parent swap quot call add-gadget ] assoc-each ; inline
+:: <radio-controls> ( model assoc parent quot: ( value model label -- gadget ) -- parent )
+    parent assoc [ model swap quot call add-gadget ] assoc-each ; inline
 
 PRIVATE>
 
index da60d66afff72794d83ee90b6919bf2b23fc036a..4777e42abcaa28e65dbd98482f604be67d302e4d 100644 (file)
@@ -60,14 +60,11 @@ SYMBOL: blink-interval
 750 milliseconds blink-interval set-global
 
 : stop-blinking ( editor -- )
-    [ [ cancel-alarm ] when* f ] change-blink-alarm drop ;
+    blink-alarm>> [ stop-alarm ] when* ;
 
 : start-blinking ( editor -- )
-    [ stop-blinking ] [
-        t >>blink
-        dup '[ _ blink-caret ] blink-interval get every
-        >>blink-alarm drop
-    ] bi ;
+    t >>blink
+    blink-alarm>> [ restart-alarm ] when* ;
 
 : restart-blinking ( editor -- )
     dup focused?>> [
@@ -80,10 +77,15 @@ PRIVATE>
 
 M: editor graft*
     [ dup caret>> activate-editor-model ]
-    [ dup mark>> activate-editor-model ] bi ;
+    [ dup mark>> activate-editor-model ]
+    [
+        [
+            '[ _ blink-caret ] blink-interval get dup <alarm>
+        ] keep blink-alarm<<
+    ] tri ;
 
 M: editor ungraft*
-    [ stop-blinking ]
+    [ [ stop-blinking ] [ f >>blink-alarm drop ] bi ]
     [ dup caret>> deactivate-editor-model ]
     [ dup mark>> deactivate-editor-model ] tri ;
 
index ea16abb9bae6ba80697f68042a5e483800086216..e9d677537c275b31316354e8a0e8d75860a3176a 100644 (file)
@@ -2,6 +2,7 @@ USING: accessors ui.gadgets ui.gadgets.packs ui.gadgets.worlds
 tools.test namespaces models kernel dlists deques math
 math.parser ui sequences hashtables assocs io arrays prettyprint
 io.streams.string math.rectangles ui.gadgets.private sets generic ;
+FROM: namespaces => set ;
 IN: ui.gadgets.tests
 
 [ { 300 300 } ]
@@ -126,16 +127,16 @@ M: mock-gadget ungraft*
         ] each-integer ;
 
     : status-flags ( -- seq )
-        { "g" "1" "2" "3" } [ get graft-state>> ] map prune ;
+        { "g" "1" "2" "3" } [ get graft-state>> ] map members ;
 
     : notify-combo ( ? ? -- )
         nl "===== Combo: " write 2dup 2array . nl
         <dlist> \ graft-queue [
             <mock-gadget> "g" set
             [ ] [ add-some-children ] unit-test
-            [ V{ { f f } } ] [ status-flags ] unit-test
+            [ { { f f } } ] [ status-flags ] unit-test
             [ ] [ "g" get graft ] unit-test
-            [ V{ { f t } } ] [ status-flags ] unit-test
+            [ { { f t } } ] [ status-flags ] unit-test
             dup [ [ ] [ notify-queued ] unit-test ] when
             [ ] [ "g" get clear-gadget ] unit-test
             [ [ t ] [ graft-queue [ front>> ] [ back>> ] bi eq? ] unit-test ] unless
@@ -146,7 +147,7 @@ M: mock-gadget ungraft*
             [ { f t } ] [ "3" get graft-state>> ] unit-test
             [ ] [ graft-queue [ "x" print notify ] slurp-deque ] unit-test
             [ ] [ notify-queued ] unit-test
-            [ V{ { t t } } ] [ status-flags ] unit-test
+            [ { { t t } } ] [ status-flags ] unit-test
         ] with-variable ;
 
     { { f f } { f t } { t f } { t t } } [ notify-combo ] assoc-each
index 7e47bf627ba83b7652dab0a3cecddb772e5ffc20..267654304a144f4d4b094cec97d534f98e1525a4 100644 (file)
@@ -174,7 +174,7 @@ M: gadget dim-changed
 
 PRIVATE>
 
-M: gadget (>>dim) ( dim gadget -- )
+M: gadget dim<< ( dim gadget -- )
     2dup dim>> =
     [ 2drop ]
     [ [ nip ] [ call-next-method ] 2bi dim-changed ] if ;
@@ -184,7 +184,7 @@ GENERIC: pref-dim* ( gadget -- dim )
 : pref-dim ( gadget -- dim )
     dup pref-dim>> [ ] [
         [ pref-dim* ] [ ] [ layout-state>> ] tri
-        [ drop ] [ dupd (>>pref-dim) ] if
+        [ drop ] [ dupd pref-dim<< ] if
     ] ?if ;
 
 : pref-dims ( gadgets -- seq ) [ pref-dim ] map ;
@@ -393,6 +393,6 @@ M: f request-focus-on 2drop ;
 : focus-path ( gadget -- seq )
     [ focus>> ] follow ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [ "ui.gadgets.prettyprint" require ] when
+{ "ui.gadgets" "prettyprint" } "ui.gadgets.prettyprint" require-when
index 10b3bb7259f5aaa2bfba8ccfc667095ef2ce8215..1632072ca2cd38d30d2be815562894a85cd0b4be 100644 (file)
@@ -2,7 +2,7 @@ USING: ui.gadgets help.markup help.syntax arrays ;
 IN: ui.gadgets.grids
 
 ARTICLE: "ui-grid-layout" "Grid layouts"
-"Grid gadgets layout their children in a rectangular grid."
+"Grid gadgets layout their children in a rectangular grid. The grid is represented as a sequence of sequences of gadgets. Every child sequence is a row of gadgets. Every row must have an equal number of gadgets in it."
 { $subsections grid }
 "Creating grids from a fixed set of gadgets:"
 { $subsections <grid> }
index 2e964b48b693a7b1b1cb40d81e26c1938e1993c1..d103ce401ca5936fe5320f36da04d603533b4d79 100644 (file)
@@ -1,9 +1,8 @@
 ! Copyright (C) 2006, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays kernel math math.order math.matrices namespaces
-make sequences words io math.vectors ui.gadgets
-ui.baseline-alignment columns accessors strings.tables
-math.rectangles fry ;
+USING: arrays kernel math math.order namespaces make sequences
+words io math.vectors ui.gadgets ui.baseline-alignment columns
+accessors strings.tables math.rectangles fry ;
 IN: ui.gadgets.grids
 
 TUPLE: grid < gadget
@@ -90,7 +89,7 @@ M: grid pref-dim* <grid-layout> grid-pref-dim ;
 : (compute-cell-locs) ( grid-layout -- locs )
     [ accumulate-cell-xs nip ]
     [ accumulate-cell-ys nip ]
-    bi cross-zip flip ;
+    bi cartesian-product flip ;
 
 : adjust-for-baseline ( row-locs row-cells -- row-locs' )
     align-baselines [ 0 swap 2array v+ ] 2map ;
@@ -104,7 +103,7 @@ M: grid pref-dim* <grid-layout> grid-pref-dim ;
 
 : cell-dims ( grid-layout -- dims )
     dup fill?>>
-    [ [ column-widths>> ] [ row-heights>> ] bi cross-zip flip ]
+    [ [ column-widths>> ] [ row-heights>> ] bi cartesian-product flip ]
     [ grid>> [ [ pref-dim>> ] map ] map ]
     if ;
 
index c655e289b0f6063a21f4ac6486d393f3f714d3ea..5e91e5bfb7d44a00b088ccfcba25014d8bd16716 100644 (file)
@@ -26,14 +26,14 @@ PRIVATE>
 
 ERROR: not-a-string object ;
 
-M: label (>>string) ( string label -- )
+M: label string<< ( string label -- )
     [
         {
             { [ dup string-array? ] [ ] }
             { [ dup string? ] [ ?string-lines ] }
             [ not-a-string ]
         } cond
-    ] dip (>>text) ; inline
+    ] dip text<< ; inline
 
 : label-theme ( gadget -- gadget )
     sans-serif-font >>font ; inline
index 5f21d74180409e70a3db3b9b94f16a6eae33b281..09a0e222d8bf9d34af10a0024a0d9f836e31c9a4 100644 (file)
@@ -46,8 +46,8 @@ PRIVATE>
 
 : pack-layout ( pack sizes -- )
     [ round-dims packed-dims ] [ drop ] 2bi
-    [ children>> [ (>>dim) ] 2each ]
-    [ [ packed-locs ] [ children>> ] bi [ (>>loc) ] 2each ] 2bi ;
+    [ children>> [ dim<< ] 2each ]
+    [ [ packed-locs ] [ children>> ] bi [ loc<< ] 2each ] 2bi ;
 
 : <pack> ( orientation -- pack )
     pack new
index 6851ff4be76b9154466a8459d381aa66526ca875..867a53eb68e871adb8e2cfb8c47bc3dbb755673a 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2005, 2009 Slava Pestov.
+! Copyright (C) 2005, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs kernel math namespaces sequences
 vectors models models.range math.vectors math.functions quotations
@@ -234,7 +234,7 @@ PRIVATE>
 : <slider> ( range orientation -- slider )
     slider new-track
         swap >>model
-        32 >>line
+        16 >>line
         dup orientation>> {
             [ <slider-pen> >>interior ]
             [ <thumb> >>thumb ]
index 057c8320acad497d758e3b095b5eb84c3a203352..45f948e14ada974c687836e23dd3c8bed7951a7a 100644 (file)
@@ -25,13 +25,11 @@ ARTICLE: "ui.gadgets.tables.selection" "Table row selection"
   { { $slot "selection" } { " - if set to a model, the values of the currently selected row or rows, as determined by a " { $link row-value } " call to the renderer, is stored in this model. See " { $link "models" } "." } }
   { { $slot "selection-index" } { " - if set to a model, the indices of the currently selected rows." } }
   { { $slot "selection-required?" } { " - if set to a true value, the table ensures that some row is always selected, if the model is non-empty. If set to " { $link f } ", a state where nothing is selected is permitted to occur. The default is " { $link f } "." } }
-  { { $slot "multiple-selection?" } { " - if set to a true value, users are allowed to select more than one value." } }
 }
 "Some words for row selection:"
 { $subsections
-    selected-rows
-    (selected-rows)
-    selected
+    selected-row
+    (selected-row)
 } ;
 
 ARTICLE: "ui.gadgets.tables.actions" "Table row actions"
index c907e90673fa58af3e6c44035a64e38baea1eae7..77b9ec99edb76bb365d420002cacf86dbe493b50 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs hashtables arrays colors colors.constants fry
 kernel math math.functions math.ranges math.rectangles math.order
@@ -18,6 +18,7 @@ GENERIC: column-titles ( renderer -- strings )
 GENERIC: row-columns ( row renderer -- columns )
 GENERIC: row-value ( row renderer -- object )
 GENERIC: row-color ( row renderer -- color )
+GENERIC: row-value? ( value row renderer -- ? )
 
 SINGLETON: trivial-renderer
 
@@ -29,6 +30,7 @@ M: object column-titles drop f ;
 M: trivial-renderer row-columns drop ;
 M: object row-value drop ;
 M: object row-color 2drop f ;
+M: object row-value? drop eq? ;
 
 TUPLE: table < line-gadget
 { renderer initial: trivial-renderer }
@@ -41,33 +43,11 @@ focus-border-color
 { mouse-color initial: COLOR: black }
 column-line-color
 selection-required?
-selection
 selection-index
-selected-indices
+selection
 mouse-index
 { takes-focus? initial: t }
-focused?
-multiple-selection? ;
-
-<PRIVATE
-
-: add-selected-index ( table n -- table )
-    over selected-indices>> conjoin ;
-
-: multiple>single ( values -- value/f ? )
-    dup assoc-empty? [ drop f f ] [ values first t ] if ;
-
-: selected-index ( table -- n )
-    selected-indices>> multiple>single drop ;
-
-: set-selected-index ( table n -- table )
-    dup associate >>selected-indices ;
-
-PRIVATE>
-
-: selected ( table -- index/indices )
-    [ selected-indices>> ] [ multiple-selection?>> ] bi
-    [ multiple>single drop ] unless ;
+focused? ;
 
 : new-table ( rows renderer class -- table )
     new-line-gadget
@@ -77,8 +57,7 @@ PRIVATE>
         focus-border-color >>focus-border-color
         transparent >>column-line-color
         f <model> >>selection-index
-        f <model> >>selection
-        H{ } clone >>selected-indices ;
+        f <model> >>selection ;
 
 : <table> ( rows renderer -- table ) table new-table ;
 
@@ -156,30 +135,23 @@ M: table layout*
 : row-bounds ( table row -- loc dim )
     row-rect rect-bounds ; inline
 
-: draw-selected-rows ( table -- )
-    {
-        { [ dup selected-indices>> assoc-empty? ] [ drop ] }
-        [
-            [ selected-indices>> keys ] [ selection-color>> gl-color ] [ ] tri
-            [ swap row-bounds gl-fill-rect ] curry each
-        ]
-    } cond ;
+: draw-selected-row ( table -- )
+    dup selection-index>> value>> [
+        dup selection-color>> gl-color
+        dup selection-index>> value>> row-bounds gl-fill-rect
+    ] [ drop ] if ;
 
 : draw-focused-row ( table -- )
-    {
-        { [ dup focused?>> not ] [ drop ] }
-        { [ dup selected-index not ] [ drop ] }
-        [
-            [ ] [ selected-index ] [ focus-border-color>> gl-color ] tri
-            row-bounds gl-rect
-        ]
-    } cond ;
+    dup { [ focused?>> ] [ selection-index>> value>> ] } 1&& [
+        dup focus-border-color>> gl-color
+        dup selection-index>> value>> row-bounds gl-rect
+    ] [ drop ] if ;
 
 : draw-moused-row ( table -- )
-    dup mouse-index>> dup [
-        over mouse-color>> gl-color
-        row-bounds gl-rect
-    ] [ 2drop ] if ;
+    dup mouse-index>> [
+        dup mouse-color>> gl-color
+        dup mouse-index>> row-bounds gl-rect
+    ] [ drop ] if ;
 
 : column-line-offsets ( table -- xs )
     [ column-widths>> ] [ gap>> ] bi
@@ -217,7 +189,7 @@ M: table layout*
 :: row-font ( row ind table -- font )
     table font>> clone
     row table renderer>> row-color [ >>foreground ] when*
-    ind table selected-indices>> key?
+    ind table selection-index>> value>> =
     [ table selection-color>> >>background ] when ;
 
 : draw-columns ( columns widths alignment font gap -- )
@@ -239,7 +211,7 @@ M: table draw-gadget*
     dup control-value empty? [ drop ] [
         dup line-height \ line-height [
             {
-                [ draw-selected-rows ]
+                [ draw-selected-row ]
                 [ draw-lines ]
                 [ draw-column-lines ]
                 [ draw-focused-row ]
@@ -262,37 +234,15 @@ M: table pref-dim*
 
 PRIVATE>
 
-: (selected-rows) ( table -- assoc )
-    [ selected-indices>> ] keep
-    '[ _ nth-row drop ] assoc-map ;
-
-: selected-rows ( table -- assoc )
-    [ selected-indices>> ] [ ] [ renderer>> ] tri
-    '[ _ nth-row drop _ row-value ] assoc-map ;
-
-: (selected-row) ( table -- value/f ? ) (selected-rows) multiple>single ;
+: (selected-row) ( table -- value/f ? )
+    [ selection-index>> value>> ] keep nth-row ;
 
-: selected-row ( table -- value/f ? ) selected-rows multiple>single ;
+: selected-row ( table -- value/f ? )
+    [ (selected-row) ] [ renderer>> ] bi
+    swap [ row-value t ] [ 2drop f f ] if ;
 
 <PRIVATE
 
-: set-table-model ( model value multiple? -- )
-    [ values ] [ multiple>single drop ] if swap set-model ;
-
-: update-selected ( table -- )
-    [
-        [ selection>> ]
-        [ selected-rows ]
-        [ multiple-selection?>> ] tri
-        set-table-model
-    ]
-    [
-        [ selection-index>> ]
-        [ selected-indices>> ]
-        [ multiple-selection?>> ] tri
-        set-table-model
-    ] bi ;
-
 : show-row-summary ( table n -- )
     over nth-row
     [ swap [ renderer>> row-value ] keep show-summary ]
@@ -302,34 +252,45 @@ PRIVATE>
 : hide-mouse-help ( table -- )
     f >>mouse-index [ hide-status ] [ relayout-1 ] bi ;
 
-: find-row-index ( value table -- n/f )
-    [ model>> value>> ] [ renderer>> ] bi
-    '[ _ row-value eq? ] with find drop ;
+: ((select-row)) ( n table -- )
+    [ selection-index>> set-model ]
+    [ [ selected-row drop ] keep selection>> set-model ]
+    bi ;
 
-: (update-selected-indices) ( table -- set )
-    [ selection>> value>> dup { [ array? not ] [ ] } 1&& [ 1array ] when ] keep
-    '[ _ find-row-index ] map sift unique f assoc-like ;
+: update-mouse-index ( table -- )
+    dup [ model>> value>> ] [ mouse-index>> ] bi
+    dup [ swap length [ drop f ] [ 1 - min ] if-zero ] [ 2drop f ] if
+    >>mouse-index drop ;
 
-: initial-selected-indices ( table -- set )
+: initial-selection-index ( table -- n/f )
     {
         [ model>> value>> empty? not ]
         [ selection-required?>> ]
-        [ drop { 0 } unique ]
+        [ drop 0 ]
     } 1&& ;
 
-: update-selected-indices ( table -- set )
-    {
-        [ (update-selected-indices) ]
-        [ initial-selected-indices ]
-    } 1|| ;
+: find-row-index ( value table -- n/f )
+    [ model>> value>> ] [ renderer>> ] bi
+    '[ _ row-value? ] with find drop ;
+
+: update-selection ( table -- )
+    [
+        {
+            [ [ selection>> value>> ] keep find-row-index ]
+            [ initial-selection-index ]
+        } 1||
+    ] keep
+    over [ ((select-row)) ] [
+        [ selection-index>> set-model ]
+        [ selection>> set-model ]
+        2bi
+    ] if ;
 
 M: table model-changed
-    nip dup update-selected-indices {
-        [ >>selected-indices f >>mouse-index drop ]
-        [ multiple>single drop show-row-summary ]
-        [ drop update-selected ]
-        [ drop relayout ]
-    } 2cleave ;
+    nip
+        dup update-selection
+        dup update-mouse-index
+    [ dup mouse-index>> show-row-summary ] [ relayout ] bi ;
 
 : thin-row-rect ( table row -- rect )
     row-rect [ { 0 1 } v* ] change-dim ;
@@ -337,14 +298,11 @@ M: table model-changed
 : scroll-to-row ( table n -- )
     dup [ [ thin-row-rect ] [ drop ] 2bi scroll>rect ] [ 2drop ] if ;
 
-: add-selected-row ( table n -- )
-    [ scroll-to-row ]
-    [ add-selected-index relayout-1 ] 2bi ;
-
 : (select-row) ( table n -- )
     [ scroll-to-row ]
-    [ set-selected-index relayout-1 ]
-    2bi ;
+    [ swap ((select-row)) ]
+    [ drop relayout-1 ]
+    2tri ;
 
 : mouse-row ( table -- n )
     [ hand-rel second ] keep y>line ;
@@ -353,23 +311,9 @@ M: table model-changed
     [ [ mouse-row ] keep 2dup valid-line? ]
     [ ] [ '[ nip @ ] ] tri* if ; inline
 
-: (table-button-down) ( quot table -- )
-    dup takes-focus?>> [ dup request-focus ] when swap
-   '[ swap [ >>mouse-index ] _ bi ] [ drop ] if-mouse-row ; inline
-
 : table-button-down ( table -- )
-    [ (select-row) ] swap (table-button-down) ;
-
-: continued-button-down ( table -- )
-    dup multiple-selection?>>
-    [ [ add-selected-row ] swap (table-button-down) ] [ table-button-down ] if ;
-
-: thru-button-down ( table -- )
-    dup multiple-selection?>> [
-      [ 2dup over selected-index (a,b) swap
-      [ swap add-selected-index drop ] curry each add-selected-row ]
-      swap (table-button-down)
-    ] [ table-button-down ] if ;
+    dup takes-focus?>> [ dup request-focus ] when
+    [ swap [ >>mouse-index ] [ (select-row) ] bi ] [ drop ] if-mouse-row ; inline
 
 PRIVATE>
 
@@ -386,22 +330,20 @@ PRIVATE>
 
 : table-button-up ( table -- )
     dup [ mouse-row ] keep valid-line? [
-        dup row-action? [ row-action ] [ update-selected ] if
+        dup row-action? [ row-action ] [ drop ] if
     ] [ drop ] if ;
 
 PRIVATE>
 
 : select-row ( table n -- )
     over validate-line
-    [ (select-row) ]
-    [ drop update-selected ]
-    [ show-row-summary ]
-    2tri ;
+    [ (select-row) ] [ show-row-summary ] 2bi ;
 
 <PRIVATE
 
 : prev/next-row ( table n -- )
-    [ dup selected-index ] dip '[ _ + ] [ 0 ] if* select-row ;
+    [ dup selection-index>> value>> ] dip
+    '[ _ + ] [ 0 ] if* select-row ;
     
 : previous-row ( table -- )
     -1 prev/next-row ;
@@ -453,8 +395,6 @@ table "sundry" f {
     { mouse-enter show-mouse-help }
     { mouse-leave hide-mouse-help }
     { motion show-mouse-help }
-    { T{ button-down f { S+ } 1 } thru-button-down }
-    { T{ button-down f { A+ } 1 } continued-button-down }
     { T{ button-up } table-button-up }
     { T{ button-up f { S+ } } table-button-up }
     { T{ button-down } table-button-down }
index eea2933b0461d22eaa21378e4f8c5d83efacfdae..a63d64312be1663e3db01017319b50ae7e4115dc 100644 (file)
@@ -20,7 +20,6 @@ CONSTANT: default-world-pixel-format-attributes
     {
         windowed
         double-buffered
-        T{ depth-bits { value 16 } }
     }
 
 CONSTANT: default-world-window-controls
@@ -33,7 +32,8 @@ CONSTANT: default-world-window-controls
     }
 
 TUPLE: world < track
-    active? focused? grab-input?
+    active? focused? grab-input? fullscreen?
+    saved-position
     layers
     title status status-owner
     text-handle handle images
@@ -75,14 +75,14 @@ TUPLE: world-attributes
 : show-status ( string/f gadget -- )
     dup find-world dup [
         dup status>> [
-            [ (>>status-owner) ] [ status>> set-model ] bi
+            [ status-owner<< ] [ status>> set-model ] bi
         ] [ 3drop ] if
     ] [ 3drop ] if ;
 
 : hide-status ( gadget -- )
     dup find-world dup [
         [ status-owner>> eq? ] keep
-        '[ f _ [ (>>status-owner) ] [ status>> set-model ] 2bi ] when
+        '[ f _ [ status-owner<< ] [ status>> set-model ] 2bi ] when
     ] [ 2drop ] if ;
 
 : window-resource ( resource -- resource )
@@ -173,7 +173,7 @@ M: world end-world
 M: world resize-world
     drop ;
 
-M: world (>>dim)
+M: world dim<<
     [ call-next-method ]
     [
         dup active?>> [
@@ -217,8 +217,7 @@ ui-error-hook [ [ rethrow ] ] initialize
                 dup [ draw-world* ] with-gl-context
                 flush-layout-cache-hook get call( -- )
             ] [
-                over <world-error> ui-error
-                f >>active? drop
+                swap f >>active? <world-error> ui-error
             ] recover
         ] with-variable
     ] [ drop ] if ;
index f33b6ec6da8ebb38cf21cec403e38ed90c23fc7e..41b7f69cbe31b1b8a1c5060a3b14c8d8924d943d 100644 (file)
@@ -1,10 +1,12 @@
-! Copyright (C) 2005, 2009 Slava Pestov.
+! Copyright (C) 2005, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs kernel math math.order models
 namespaces make sequences words strings system hashtables math.parser
 math.vectors classes.tuple classes boxes calendar alarms combinators
 sets columns fry deques ui.gadgets ui.gadgets.private ascii
 combinators.short-circuit ;
+FROM: namespaces => set ;
+FROM: sets => members ;
 IN: ui.gestures
 
 : get-gesture-handler ( gesture gadget -- quot )
@@ -186,13 +188,15 @@ SYMBOL: drag-timer
         [ drag-gesture ]
         300 milliseconds
         100 milliseconds
-        add-alarm drag-timer get-global >box
+        <alarm>
+        [ drag-timer get-global >box ]
+        [ start-alarm ] bi
     ] when ;
 
 : stop-drag-timer ( -- )
     hand-buttons get-global empty? [
         drag-timer get-global ?box
-        [ cancel-alarm ] [ drop ] if
+        [ stop-alarm ] [ drop ] if
     ] when ;
 
 : fire-motion ( -- )
@@ -225,16 +229,16 @@ SYMBOL: drag-timer
             dup send-lose-focus
             f swap t focus-child
         ] when*
-        dupd (>>focus) [
+        dupd focus<< [
             send-gain-focus
         ] when*
     ] [
-        (>>focus)
+        focus<<
     ] if ;
 
 : modifier ( mod modifiers -- seq )
     [ second swap bitand 0 > ] with filter
-    0 <column> prune [ f ] [ >array ] if-empty ;
+    0 <column> members [ f ] [ >array ] if-empty ;
 
 : drag-loc ( -- loc )
     hand-loc get-global hand-click-loc get-global v- ;
@@ -302,7 +306,7 @@ SYMBOL: drag-timer
     stop-drag-timer
     button-gesture ;
 
-: send-wheel ( direction loc world -- )
+: send-scroll ( direction loc world -- )
     move-hand
     scroll-direction set-global
     mouse-scroll hand-gadget get-global propagate-gesture ;
index 454e4700a0ac78f6bd120afc6459493824436c95..3412d039491775d922f81ff83a660c00e2c9c3df 100644 (file)
@@ -5,7 +5,7 @@ IN: ui.tools.browser.history.tests
 TUPLE: dummy obj ;
 
 M: dummy history-value obj>> ;
-M: dummy set-history-value (>>obj) ;
+M: dummy set-history-value obj<< ;
 
 dummy new <history> "history" set
 
index cf6f1c066d77d72fd1d5c15c136557b9c1915921..3a5f31bee3af9d9dd7adf8d3507e073764df1592 100644 (file)
@@ -14,6 +14,10 @@ TUPLE: deploy-gadget < pack vocab settings ;
     deploy-name get <model-field>
     "Executable name:" label-on-left add-gadget ;
 
+: deploy-console ( parent -- parent )
+    deploy-console? get
+    "Deploy as Windows console application" <checkbox> add-gadget ;
+
 : deploy-ui ( parent -- parent )
     deploy-ui? get
     "Include user interface framework" <checkbox> add-gadget ;
@@ -45,6 +49,7 @@ TUPLE: deploy-gadget < pack vocab settings ;
             <pile>
             bundle-name
             deploy-ui
+            deploy-console
             io-settings
             reflection-settings
             advanced-settings
index 34a52213075872de29180991731dcf88163319a7..8cc8781b192247a0936776f1b92c42fce29934af 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays sequences sorting assocs colors.constants fry
 combinators combinators.smart combinators.short-circuit editors make
@@ -49,6 +49,8 @@ M: source-file-renderer prototype-row
 M: source-file-renderer row-value
     drop dup [ first [ <pathname> ] [ f ] if* ] when ;
 
+M: source-file-renderer row-value? row-value = ;
+
 M: source-file-renderer column-titles
     drop { "" "File" "Errors" } ;
 
@@ -66,8 +68,8 @@ M: source-file-renderer filled-column drop 1 ;
         [ invoke-primary-operation ] >>action
         COLOR: dark-gray >>column-line-color
         6 >>gap
-        5 >>min-rows
-        5 >>max-rows
+        4 >>min-rows
+        4 >>max-rows
         60 >>min-cols
         60 >>max-cols
         t >>selection-required?
@@ -115,8 +117,8 @@ M: error-renderer column-alignment drop { 0 1 0 0 } ;
         [ invoke-primary-operation ] >>action
         COLOR: dark-gray >>column-line-color
         6 >>gap
-        5 >>min-rows
-        5 >>max-rows
+        4 >>min-rows
+        4 >>max-rows
         60 >>min-cols
         60 >>max-cols
         t >>selection-required?
@@ -152,7 +154,7 @@ error-display "toolbar" f {
     [ swap '[ error-type _ at ] filter ] <smart-arrow> ;
 
 :: <error-list-gadget> ( model -- gadget )
-    vertical error-list-gadget new-track
+    vertical error-list-gadget new-track
         <error-toggle> [ >>error-toggle ] [ >>visible-errors ] bi*
         dup visible-errors>> model <error-model> >>model 
         f <model> >>source-file
@@ -176,16 +178,16 @@ M: error-list-gadget focusable-child*
 
 \ error-list-help H{ { +nullary+ t } } define-command
 
-error-list-gadget "toolbar" f {
+error-list-gadget "toolbar" f {
     { T{ key-down f f "F1" } error-list-help }
 } define-command-map
 
-: error-list-window ( -- )
-    error-list-model get [ drop all-errors ] <arrow>
-    <error-list-gadget> "Errors" open-status-window ;
+MEMO: error-list-gadget ( -- gadget )
+    error-list-model get-global [ drop all-errors ] <arrow>
+    <error-list-gadget> ;
 
 : show-error-list ( -- )
-    [ error-list-gadget? ] find-window
-    [ raise-window ] [ error-list-window ] if* ;
+    [ error-list-gadget eq? ] find-window
+    [ raise-window ] [ error-list-gadget "Errors" open-status-window ] if* ;
 
 \ show-error-list H{ { +nullary+ t } } define-command
index fbbac8f3fa137e97b17ecb5ff8479bbeea747c52..94d0b4f263b3d39d7c5793b94b1c63abc226e8e4 100644 (file)
@@ -16,7 +16,7 @@ IN: ui.tools.listener.tests
     [ ] [ <promise> "promise" set ] unit-test
 
     [
-        self "interactor" get (>>thread)
+        self "interactor" get thread<<
         "interactor" get stream-read-quot "promise" get fulfill
     ] "Interactor test" spawn drop
 
@@ -40,7 +40,7 @@ IN: ui.tools.listener.tests
     [ ] [ <promise> "promise" set ] unit-test
 
     [
-        self "interactor" get (>>thread)
+        self "interactor" get thread<<
         "interactor" get stream-readln "promise" get fulfill
     ] "Interactor test" spawn drop
 
index 2a948fddc01342b2ce006e44ef7f67dfdb846dbc..bd877e66e45d059947f7033f27acef1a8ae18afb 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2005, 2009 Slava Pestov.
+! Copyright (C) 2005, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs calendar combinators locals
 source-files.errors colors.constants combinators.short-circuit
@@ -16,6 +16,7 @@ ui.tools.listener.completion ui.tools.listener.popups
 ui.tools.listener.history ui.images ui.tools.error-list
 tools.errors.model ;
 FROM: source-files.errors => all-errors ;
+FROM: namespaces => set ;
 IN: ui.tools.listener
 
 ! If waiting is t, we're waiting for user input, and invoking
@@ -29,7 +30,7 @@ output history flag mailbox thread waiting token-model word-model popup ;
     drop ;
 
 : interactor-continuation ( interactor -- continuation )
-    thread>> continuation>> value>> ;
+    thread>> thread-continuation ;
 
 : interactor-busy? ( interactor -- ? )
     #! We're busy if there's no thread to resume.
@@ -194,6 +195,7 @@ TUPLE: listener-gadget < tool error-summary output scroller input ;
         H{ { table-gap { 3 3 } } } [
             [ [ [ icon>> write-image ] with-cell ] each ] with-row
         ] tabular-output
+        last-element off
         { "Press " { $command tool "common" show-error-list } " to view errors." }
         print-element
     ] unless-empty ;
index 3019de4e21f2dced2352d4d77208536759d70aea..9d8e50c615cbd162c8d55c4b2a3d56413e8e4e19 100644 (file)
@@ -62,10 +62,7 @@ IN: ui.tools.operations
 
 ! Thread
 : com-thread-traceback-window ( thread -- )
-    continuation>> dup occupied>>
-    [ value>> traceback-window ]
-    [ drop beep ]
-    if ;
+    thread-continuation traceback-window ;
 
 [ thread? ] \ com-thread-traceback-window H{
     { +primary+ t }
index 42bc0ef1f22d7b58a023badf037ce67418b7f96c..1b5fcb50c43a9f86ac3f1f0526d7d911ffcddea7 100644 (file)
@@ -5,10 +5,7 @@ ui.tools.listener ui.tools.browser ui.tools.common ui.tools.error-list
 ui.tools.walker ui.commands ui.gestures ui ui.private ;
 IN: ui.tools
 
-: main ( -- )
-    restore-windows? [ restore-windows ] [ listener-window ] if ;
-
-MAIN: main
+MAIN: listener-window
 
 \ refresh-all H{ { +nullary+ t } { +listener+ t } } define-command
 
index b55ea44c6bc8474082096191ae3a3cd6ef3eeae1..b2f97857f636dba93075c3c2cb19145426332ef6 100644 (file)
@@ -81,6 +81,11 @@ HELP: with-ui
 HELP: beep
 { $description "Plays the system beep sound." } ;
 
+HELP: system-alert
+{ $values { "caption" string } { "text" string } }
+{ $description "Displays an application-modal alert dialog box with the given caption and text." }
+{ $notes "Since the window raised by this word is modal, all processing in all Factor threads will halt until the dialog is dismissed. In an application that makes full use of the UI framework, it would be more appropriate to display a pane gadget in a Factor window. This word is meant primarily to be used to display errors in deployed applications with minimal dependencies on the UI library, such as games." } ;
+
 HELP: topmost-window
 { $values { "world" world } }
 { $description "Returns the " { $link world } " representing the currently focused window." } ;
index e0fa560935f35b551040fbb2c1cafe3d96a45011..d55d1af0968ca0792c3e9daf8ff00876a5526743 100644 (file)
@@ -1,11 +1,12 @@
-! Copyright (C) 2006, 2009 Slava Pestov.
+! Copyright (C) 2006, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays assocs io kernel math models namespaces make dlists
-deques sequences threads words continuations init
-combinators combinators.short-circuit hashtables concurrency.flags
-sets accessors calendar fry destructors ui.gadgets ui.gadgets.private
-ui.gadgets.worlds ui.gadgets.tracks ui.gestures ui.backend ui.render
-strings classes.tuple classes.tuple.parser lexer vocabs.parser parser ;
+USING: arrays assocs boxes io kernel math models namespaces make
+dlists deques sequences threads words continuations init
+combinators combinators.short-circuit hashtables
+concurrency.flags sets accessors calendar fry destructors
+ui.gadgets ui.gadgets.private ui.gadgets.worlds
+ui.gadgets.tracks ui.gestures ui.backend ui.render strings
+classes.tuple classes.tuple.parser lexer vocabs.parser parser ;
 IN: ui
 
 <PRIVATE
@@ -82,12 +83,7 @@ M: world graft*
         [ [ clean-up-broken-window ] [ ui-error ] bi* ] recover
     ] bi ;
 
-: reset-world ( world -- )
-    #! This is used when a window is being closed, but also
-    #! when restoring saved worlds on image startup.
-    f >>handle unfocus-world ;
-
-: (ungraft-world) ( world -- )
+M: world ungraft*
     {
         [ set-gl-context ]
         [ text-handle>> [ dispose ] when* ]
@@ -96,38 +92,21 @@ M: world graft*
         [ hand-gadget close-global ]
         [ end-world ]
         [ [ <reversed> [ [ dispose ] when* ] each V{ } clone ] change-window-resources drop ]
+        [ [ (close-window) f ] change-handle drop ]
+        [ unfocus-world ]
     } cleave ;
 
-M: world ungraft*
-    [ (ungraft-world) ]
-    [ handle>> (close-window) ]
-    [ reset-world ] tri ;
-
 : init-ui ( -- )
+    <box> drag-timer set-global
+    f hand-gadget set-global
+    f hand-clicked set-global
+    f hand-world set-global
+    f world set-global
     <dlist> \ graft-queue set-global
     <dlist> \ layout-queue set-global
     <dlist> \ gesture-queue set-global
     V{ } clone windows set-global ;
 
-: restore-gadget-later ( gadget -- )
-    dup graft-state>> {
-        { { f f } [ ] }
-        { { f t } [ ] }
-        { { t t } [ { f f } >>graft-state ] }
-        { { t f } [ dup unqueue-graft { f f } >>graft-state ] }
-    } case graft-later ;
-
-: restore-gadget ( gadget -- )
-    dup restore-gadget-later
-    children>> [ restore-gadget ] each ;
-
-: restore-world ( world -- )
-    {
-        [ reset-world ]
-        [ f >>text-handle f >>images drop ]
-        [ restore-gadget ]
-    } cleave ;
-
 : update-hand ( world -- )
     dup hand-world get-global eq?
     [ hand-loc get-global swap move-hand ] [ drop ] if ;
@@ -138,7 +117,7 @@ M: world ungraft*
         layout-queue [
             dup layout find-world [ , ] when*
         ] slurp-deque
-    ] { } make prune ;
+    ] { } make members ;
 
 : redraw-worlds ( seq -- )
     [ dup update-hand draw-world ] each ;
@@ -188,16 +167,6 @@ PRIVATE>
 : start-ui ( quot -- )
     call( -- ) notify-ui-thread start-ui-thread ;
 
-: restore-windows ( -- )
-    [
-        windows get [ values ] [ delete-all ] bi
-        [ restore-world ] each
-        forget-rollover
-    ] (with-ui) ;
-
-: restore-windows? ( -- ? )
-    windows get empty? not ;
-
 : ?attributes ( gadget title/attributes -- attributes )
     dup string? [ world-attributes new swap >>title ] [ clone ] if
     swap [ [ [ 1array ] [ f ] if* ] curry unless* ] curry change-gadgets ;
@@ -243,13 +212,15 @@ M: object close-window
 
 HOOK: beep ui-backend ( -- )
 
+HOOK: system-alert ui-backend ( caption text -- )
+
 : parse-main-window-attributes ( class -- attributes )
     "{" expect dup all-slots parse-tuple-literal-slots ;
 
 : define-main-window ( word attributes quot -- )
     [
         '[ [ f _ clone @ open-window ] with-ui ] (( -- )) define-declared
-    ] [ 2drop current-vocab (>>main) ] 3bi ;
+    ] [ 2drop current-vocab main<< ] 3bi ;
 
 SYNTAX: MAIN-WINDOW:
     CREATE
index 46651bd7de8c1f2a345c7dc742e115d3f403ce95..13c7d1ac79d1372903c2f64670f149bb5a5231b4 100644 (file)
@@ -12,8 +12,19 @@ IN: unicode.breaks
 <PRIVATE
 ! Grapheme breaks
 
-C-ENUM: Any L V T LV LVT Extend Control CR LF
-    SpacingMark Prepend graphemes ;
+CONSTANT: Any 0
+CONSTANT: L 1
+CONSTANT: V 2
+CONSTANT: T 3
+CONSTANT: LV 4
+CONSTANT: LVT 5
+CONSTANT: Extend 6
+CONSTANT: Control 7
+CONSTANT: CR 8
+CONSTANT: LF 9
+CONSTANT: SpacingMark 10
+CONSTANT: Prepend 11
+CONSTANT: graphemes 12
 
 : jamo-class ( ch -- class )
     dup initial? [ drop L ]
@@ -131,8 +142,20 @@ VALUE: word-break-table
 "vocab:unicode/data/WordBreakProperty.txt" load-interval-file
 to: word-break-table
 
-C-ENUM: wOther wCR wLF wNewline wExtend wFormat wKatakana wALetter wMidLetter
-wMidNum wMidNumLet wNumeric wExtendNumLet words ;
+CONSTANT: wOther 0
+CONSTANT: wCR 1
+CONSTANT: wLF 2
+CONSTANT: wNewline 3
+CONSTANT: wExtend 4
+CONSTANT: wFormat 5
+CONSTANT: wKatakana 6
+CONSTANT: wALetter 7
+CONSTANT: wMidLetter 8
+CONSTANT: wMidNum 9
+CONSTANT: wMidNumLet 10
+CONSTANT: wNumeric 11
+CONSTANT: wExtendNumLet 12
+CONSTANT: words 13
 
 : word-break-classes ( -- table ) ! Is there a way to avoid this?
     H{
index 24dfba6be02dab57ec4a1f89bd091c22d67b7529..b2cb4d205d380f9d0ef64a1f92a413bfaa813e25 100644 (file)
@@ -6,6 +6,7 @@ math.parser hash2 math.order byte-arrays namespaces
 compiler.units parser io.encodings.ascii values interval-maps
 ascii sets combinators locals math.ranges sorting make
 strings.parser io.encodings.utf8 memoize simple-flat-file ;
+FROM: namespaces => set ;
 IN: unicode.data
 
 <PRIVATE
@@ -183,7 +184,7 @@ C: <code-point> code-point
     ] assoc-map ;
 
 : properties>intervals ( properties -- assoc[str,interval] )
-    dup values prune [ f ] H{ } map>assoc
+    dup values members [ f ] H{ } map>assoc
     [ [ push-at ] curry assoc-each ] keep
     [ <interval-set> ] assoc-map ;
 
@@ -208,7 +209,7 @@ load-data {
 } cleave
 
 : postprocess-class ( -- )
-    combine-map [ [ second ] map ] map concat
+    combine-map [ values ] map concat
     [ combining-class not ] filter
     [ 0 swap class-map set-at ] each ;
 
index bda99422fcf9488e1cc2707081928ca27d1b8779..ad323bf14af40fd07c1d338c96ea634c090c53da 100644 (file)
@@ -48,15 +48,15 @@ STRUCT: sockaddr-un
     { path char[104] } ;
 
 STRUCT: passwd
-    { pw_name char* }
-    { pw_passwd char* }
+    { pw_name c-string }
+    { pw_passwd c-string }
     { pw_uid uid_t }
     { pw_gid gid_t }
     { pw_change time_t }
-    { pw_class char* }
-    { pw_gecos char* }
-    { pw_dir char* }
-    { pw_shell char* }
+    { pw_class c-string }
+    { pw_gecos c-string }
+    { pw_dir c-string }
+    { pw_shell c-string }
     { pw_expire time_t }
     { pw_fields int } ;
 
index 992d1c3ad00c8ab36b1487f354c32ff5d2db7554..112758a3e8fdbcf984ad4327785b23551842f801 100644 (file)
@@ -9,7 +9,7 @@ STRUCT: addrinfo
     { socktype int }
     { protocol int }
     { addrlen socklen_t }
-    { canonname char* }
+    { canonname c-string }
     { addr void* }
     { next addrinfo* } ;
 
index a2e75b6ca64b396b1f4159f96d3477c7a98108eb..2ca1d9315d8c7742d792ebb8aa8d76df0c3612ac 100644 (file)
@@ -11,7 +11,7 @@ STRUCT: addrinfo
     { socktype int }
     { protocol int }
     { addrlen socklen_t }
-    { canonname char* }
+    { canonname c-string }
     { addr void* }
     { next addrinfo* } ;
 
@@ -32,7 +32,7 @@ STRUCT: utmpx
 
 CONSTANT: __DARWIN_MAXPATHLEN 1024
 CONSTANT: __DARWIN_MAXNAMELEN 255
-CONSTANT: __DARWIN_MAXNAMELEN+1 255
+CONSTANT: __DARWIN_MAXNAMELEN+1 256
 
 STRUCT: dirent
     { d_ino ino_t }
index d755caf874605d662cc617bf1c58006bb798f242..e15971b1504bd3b1c152acce4023af67c271503d 100644 (file)
@@ -10,7 +10,7 @@ STRUCT: addrinfo
     { socktype int }
     { protocol int }
     { addrlen socklen_t }
-    { canonname char* }
+    { canonname c-string }
     { addr void* }
     { next addrinfo* } ;
 
index 076dbdfd24e9750415d0db461026edba253782a5..1f4eddef66cbf5138685357baa749fae0aad987a 100644 (file)
@@ -10,7 +10,7 @@ STRUCT: addrinfo
     { protocol int }
     { addrlen socklen_t }
     { addr void* }
-    { canonname char* }
+    { canonname c-string }
     { next addrinfo* } ;
 
 STRUCT: dirent
index 10346cff2cd7b1ff1100e561629fc7ab95fda9a6..26cdc22bc17b1d1fe28d530a8cd4b6221422a00c 100644 (file)
@@ -44,21 +44,21 @@ CONSTANT: DT_WHT      14
 
 LIBRARY: libc
 
-FUNCTION: char* strerror ( int errno ) ;
+FUNCTION: c-string strerror ( int errno ) ;
 
 STRUCT: group
-    { gr_name char* }
-    { gr_passwd char* }
+    { gr_name c-string }
+    { gr_passwd c-string }
     { gr_gid int }
-    { gr_mem char** } ;
+    { gr_mem c-string* } ;
 
 FUNCTION: int accept ( int s, void* sockaddr, socklen_t* socklen ) ;
 FUNCTION: int bind ( int s, void* name, socklen_t namelen ) ;
-FUNCTION: int chdir ( char* path ) ;
-FUNCTION: int chmod ( char* path, mode_t mode ) ;
+FUNCTION: int chdir ( c-string path ) ;
+FUNCTION: int chmod ( c-string path, mode_t mode ) ;
 FUNCTION: int fchmod ( int fd, mode_t mode ) ;
-FUNCTION: int chown ( char* path, uid_t owner, gid_t group ) ;
-FUNCTION: int chroot ( char* path ) ;
+FUNCTION: int chown ( c-string path, uid_t owner, gid_t group ) ;
+FUNCTION: int chroot ( c-string path ) ;
 FUNCTION: int close ( int fd ) ;
 FUNCTION: int closedir ( DIR* dirp ) ;
 FUNCTION: int connect ( int s, void* name, socklen_t namelen ) ;
@@ -70,31 +70,31 @@ FUNCTION: int fcntl ( int fd, int cmd, int arg ) ;
 FUNCTION: int flock ( int fd, int operation ) ;
 FUNCTION: void freeaddrinfo ( addrinfo* ai ) ;
 FUNCTION: int futimes ( int id, timeval[2] times ) ;
-FUNCTION: char* gai_strerror ( int ecode ) ;
-FUNCTION: int getaddrinfo ( char* hostname, char* servname, addrinfo* hints, addrinfo** res ) ;
-FUNCTION: char* getcwd ( char* buf, size_t size ) ;
+FUNCTION: c-string gai_strerror ( int ecode ) ;
+FUNCTION: int getaddrinfo ( c-string hostname, c-string servname, addrinfo* hints, addrinfo** res ) ;
+FUNCTION: c-string getcwd ( c-string buf, size_t size ) ;
 FUNCTION: pid_t getpid ;
 FUNCTION: int getdtablesize ;
 FUNCTION: gid_t getegid ;
 FUNCTION: uid_t geteuid ;
 FUNCTION: gid_t getgid ;
-FUNCTION: char* getenv ( char* name ) ;
+FUNCTION: c-string getenv ( c-string name ) ;
 
-FUNCTION: int getgrgid_r ( gid_t gid, group* grp, char* buffer, size_t bufsize, group** result ) ;
-FUNCTION: int getgrnam_r ( char* name, group* grp, char* buffer, size_t bufsize, group** result ) ;
+FUNCTION: int getgrgid_r ( gid_t gid, group* grp, c-string buffer, size_t bufsize, group** result ) ;
+FUNCTION: int getgrnam_r ( c-string name, group* grp, c-string buffer, size_t bufsize, group** result ) ;
 FUNCTION: passwd* getpwent ( ) ;
 FUNCTION: passwd* getpwuid ( uid_t uid ) ;
-FUNCTION: passwd* getpwnam ( char* login ) ;
-FUNCTION: int getpwnam_r ( char* login, passwd* pwd, char* buffer, size_t bufsize, passwd** result ) ;
+FUNCTION: passwd* getpwnam ( c-string login ) ;
+FUNCTION: int getpwnam_r ( c-string login, passwd* pwd, c-string buffer, size_t bufsize, passwd** result ) ;
 FUNCTION: int getgroups ( int gidsetlen, gid_t* gidset ) ;
-FUNCTION: int getgrouplist ( char* name, int basegid, int* groups, int* ngroups ) ;
+FUNCTION: int getgrouplist ( c-string name, int basegid, int* groups, int* ngroups ) ;
 FUNCTION: int getrlimit ( int resource, rlimit* rlp ) ;
 FUNCTION: int setrlimit ( int resource, rlimit* rlp ) ;
 FUNCTION: int getpriority ( int which, id_t who ) ;
 FUNCTION: int setpriority ( int which, id_t who, int prio ) ;
 FUNCTION: int getrusage ( int who, rusage* r_usage ) ;
 FUNCTION: group* getgrent ;
-FUNCTION: int gethostname ( char* name, int len ) ;
+FUNCTION: int gethostname ( c-string name, int len ) ;
 FUNCTION: int getsockname ( int socket, sockaddr* address, socklen_t* address_len ) ;
 FUNCTION: int getpeername ( int socket, sockaddr* address, socklen_t* address_len ) ;
 FUNCTION: uid_t getuid ;
@@ -102,44 +102,44 @@ FUNCTION: uint htonl ( uint n ) ;
 FUNCTION: ushort htons ( ushort n ) ;
 ! FUNCTION: int issetugid ;
 FUNCTION: int isatty ( int fildes ) ;
-FUNCTION: int ioctl ( int fd, ulong request, char* argp ) ;
-FUNCTION: int lchown ( char* path, uid_t owner, gid_t group ) ;
+FUNCTION: int ioctl ( int fd, ulong request, c-string argp ) ;
+FUNCTION: int lchown ( c-string path, uid_t owner, gid_t group ) ;
 FUNCTION: int listen ( int s, int backlog ) ;
 FUNCTION: off_t lseek ( int fildes, off_t offset, int whence ) ;
-FUNCTION: int mkdir ( char* path, mode_t mode ) ;
+FUNCTION: int mkdir ( c-string path, mode_t mode ) ;
 FUNCTION: void* mmap ( void* addr, size_t len, int prot, int flags, int fd, off_t offset ) ;
 FUNCTION: int munmap ( void* addr, size_t len ) ;
 FUNCTION: uint ntohl ( uint n ) ;
 FUNCTION: ushort ntohs ( ushort n ) ;
 FUNCTION: int shutdown ( int fd, int how ) ;
-FUNCTION: int open ( char* path, int flags, int prot ) ;
-FUNCTION: DIR* opendir ( char* path ) ;
+FUNCTION: int open ( c-string path, int flags, int prot ) ;
+FUNCTION: DIR* opendir ( c-string path ) ;
 
 STRUCT: utimbuf
     { actime time_t }
     { modtime time_t } ;
 
-FUNCTION: int utime ( char* path, utimbuf* buf ) ;
+FUNCTION: int utime ( c-string path, utimbuf* buf ) ;
 
 FUNCTION: int pclose ( void* file ) ;
 FUNCTION: int pipe ( int* filedes ) ;
-FUNCTION: void* popen ( char* command, char* type ) ;
+FUNCTION: void* popen ( c-string command, c-string type ) ;
 FUNCTION: ssize_t read ( int fd, void* buf, size_t nbytes ) ;
 
 FUNCTION: dirent* readdir ( DIR* dirp ) ;
 FUNCTION: int readdir_r ( void* dirp, dirent* entry, dirent** result ) ;
-FUNCTION: ssize_t readlink ( char* path, char* buf, size_t bufsize ) ;
+FUNCTION: ssize_t readlink ( c-string path, c-string buf, size_t bufsize ) ;
 
 CONSTANT: PATH_MAX 1024
 
 FUNCTION: ssize_t recv ( int s, void* buf, size_t nbytes, int flags ) ;
 FUNCTION: ssize_t recvfrom ( int s, void* buf, size_t nbytes, int flags, sockaddr-in* from, socklen_t* fromlen ) ;
-FUNCTION: int rename ( char* from, char* to ) ;
-FUNCTION: int rmdir ( char* path ) ;
+FUNCTION: int rename ( c-string from, c-string to ) ;
+FUNCTION: int rmdir ( c-string path ) ;
 FUNCTION: int select ( int nfds, void* readfds, void* writefds, void* exceptfds, timeval* timeout ) ;
 FUNCTION: ssize_t sendto ( int s, void* buf, size_t len, int flags, sockaddr-in* to, socklen_t tolen ) ;
-FUNCTION: int setenv ( char* name, char* value, int overwrite ) ;
-FUNCTION: int unsetenv ( char* name ) ;
+FUNCTION: int setenv ( c-string name, c-string value, int overwrite ) ;
+FUNCTION: int unsetenv ( c-string name ) ;
 FUNCTION: int setegid ( gid_t egid ) ;
 FUNCTION: int seteuid ( uid_t euid ) ;
 FUNCTION: int setgid ( gid_t gid ) ;
@@ -149,11 +149,10 @@ FUNCTION: int setreuid ( uid_t ruid, uid_t euid ) ;
 FUNCTION: int setsockopt ( int s, int level, int optname, void* optval, socklen_t optlen ) ;
 FUNCTION: int setuid ( uid_t uid ) ;
 FUNCTION: int socket ( int domain, int type, int protocol ) ;
-FUNCTION: int symlink ( char* path1, char* path2 ) ;
-FUNCTION: int link ( char* path1, char* path2 ) ;
-FUNCTION: int system ( char* command ) ;
-FUNCTION: int unlink ( char* path ) ;
-FUNCTION: int utimes ( char* path, timeval[2] times ) ;
+FUNCTION: int symlink ( c-string path1, c-string path2 ) ;
+FUNCTION: int link ( c-string path1, c-string path2 ) ;
+FUNCTION: int unlink ( c-string path ) ;
+FUNCTION: int utimes ( c-string path, timeval[2] times ) ;
 FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ;
 
-"librt" "librt.so" "cdecl" add-library
+"librt" "librt.so" cdecl add-library
index 260796b5e4146ff0ecf6a2db4dff9a2c927cd20f..3f19e18c14af2202b8f42324fae327dbe81c3aba 100644 (file)
@@ -38,7 +38,7 @@ STRUCT: addrinfo
     { protocol int }
     { addrlen socklen_t }
     { addr void* }
-    { canonname char* }
+    { canonname c-string }
     { next addrinfo* } ;
 
 STRUCT: sockaddr-in
@@ -83,13 +83,13 @@ CONSTANT: SEEK_CUR 1
 CONSTANT: SEEK_END 2
 
 STRUCT: passwd
-    { pw_name char* }
-    { pw_passwd char* }
+    { pw_name c-string }
+    { pw_passwd c-string }
     { pw_uid uid_t }
     { pw_gid gid_t }
-    { pw_gecos char* }
-    { pw_dir char* }
-    { pw_shell char* } ;
+    { pw_gecos c-string }
+    { pw_dir c-string }
+    { pw_shell c-string } ;
 
 ! dirent64
 STRUCT: dirent
@@ -99,7 +99,7 @@ STRUCT: dirent
     { d_type uchar }
     { d_name char[256] } ;
 
-FUNCTION: int open64 ( char* path, int flags, int prot ) ;
+FUNCTION: int open64 ( c-string path, int flags, int prot ) ;
 FUNCTION: dirent* readdir64 ( DIR* dirp ) ;
 FUNCTION: int readdir64_r ( void* dirp, dirent* entry, dirent** result ) ;
 
index d641961a25b9bf31d36cc871c544d789a6aff9b7..a08785823a0432c240a05f88946ff8762c39174e 100644 (file)
@@ -35,7 +35,7 @@ STRUCT: addrinfo
 !         int _ai_pad;            
 ! #endif
     { addrlen int }
-    { canonname char* }
+    { canonname c-string }
     { addr void* }
     { next void* } ;
 
index b009fe529fca0e4d1fd459da38fa54ac20a09c2c..7be124ced4c2f2568927259f4192d80e6c2eedcb 100644 (file)
@@ -83,7 +83,7 @@ M: integer user-groups ( id -- seq )
     user-name (user-groups) ;
     
 : all-groups ( -- seq )
-    [ unix.ffi:getgrent dup ] [ \ unix.ffi:group memory>struct group-struct>group ] produce nip ;
+    [ unix.ffi:getgrent dup ] [ group-struct>group ] produce nip ;
 
 : <group-cache> ( -- assoc )
     all-groups [ [ id>> ] keep ] H{ } map>assoc ;
index f589c17e288de81009ece66c7ab398fc5f057173..947191e7dd458e65597226d25dd694a5b15f8e9c 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
-USING: alien.c-types alien.syntax math math.bitwise classes.struct ;\r
+USING: alien.c-types alien.syntax math math.bitwise classes.struct\r
+literals ;\r
 IN: unix.linux.inotify\r
 \r
 STRUCT: inotify-event\r
@@ -27,8 +28,8 @@ CONSTANT: IN_UNMOUNT HEX: 2000     ! Backing fs was unmounted
 CONSTANT: IN_Q_OVERFLOW HEX: 4000  ! Event queued overflowed\r
 CONSTANT: IN_IGNORED HEX: 8000     ! File was ignored\r
 \r
-: IN_CLOSE ( -- n ) { IN_CLOSE_WRITE IN_CLOSE_NOWRITE } flags ; foldable ! close\r
-: IN_MOVE ( -- n ) { IN_MOVED_FROM IN_MOVED_TO } flags        ; foldable ! moves\r
+CONSTANT: IN_CLOSE flags{ IN_CLOSE_WRITE IN_CLOSE_NOWRITE }\r
+CONSTANT: IN_MOVE flags{ IN_MOVED_FROM IN_MOVED_TO }\r
 \r
 CONSTANT: IN_ONLYDIR HEX: 1000000     ! only watch the path if it is a directory\r
 CONSTANT: IN_DONT_FOLLOW HEX: 2000000 ! don't follow a sym link\r
@@ -36,21 +37,21 @@ CONSTANT: IN_MASK_ADD HEX: 20000000   ! add to the mask of an already existing w
 CONSTANT: IN_ISDIR HEX: 40000000      ! event occurred against dir\r
 CONSTANT: IN_ONESHOT HEX: 80000000    ! only send event once\r
 \r
-: IN_CHANGE_EVENTS ( -- n )\r
-    {\r
+CONSTANT: IN_CHANGE_EVENTS \r
+    flags{\r
         IN_MODIFY IN_ATTRIB IN_MOVED_FROM\r
         IN_MOVED_TO IN_DELETE IN_CREATE IN_DELETE_SELF\r
         IN_MOVE_SELF\r
-    } flags ; foldable\r
+    }\r
 \r
-: IN_ALL_EVENTS ( -- n )\r
-    {\r
+CONSTANT: IN_ALL_EVENTS\r
+    flags{\r
         IN_ACCESS IN_MODIFY IN_ATTRIB IN_CLOSE_WRITE\r
         IN_CLOSE_NOWRITE IN_OPEN IN_MOVED_FROM\r
         IN_MOVED_TO IN_DELETE IN_CREATE IN_DELETE_SELF\r
         IN_MOVE_SELF\r
-    } flags ; foldable\r
+    }\r
 \r
 FUNCTION: int inotify_init ( ) ;\r
-FUNCTION: int inotify_add_watch ( int fd, char* name, uint mask  ) ;\r
+FUNCTION: int inotify_add_watch ( int fd, c-string name, uint mask  ) ;\r
 FUNCTION: int inotify_rm_watch ( int fd, uint wd ) ;\r
index ab10aef3eac299fc60b899c4e5fcbc14512d492b..a112b9829a6ab9ca52d420990772b3ffe3add138 100644 (file)
@@ -11,9 +11,9 @@ FUNCTION: pid_t fork ( ) ;
 
 : fork-process ( -- pid ) [ fork ] unix-system-call ;
 
-FUNCTION: int execv ( char* path, char** argv ) ;
-FUNCTION: int execvp ( char* path, char** argv ) ;
-FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
+FUNCTION: int execv ( c-string path, c-string* argv ) ;
+FUNCTION: int execvp ( c-string path, c-string* argv ) ;
+FUNCTION: int execve ( c-string path, c-string* argv, c-string* envp ) ;
 
 : exec ( pathname argv -- int )
     [ utf8 malloc-string ] [ utf8 strings>alien ] bi* execv ;
@@ -36,8 +36,7 @@ FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
     [ [ first ] [ ] bi ] dip exec-with-env ;
 
 : with-fork ( child parent -- )
-    [ [ fork-process dup zero? ] dip '[ drop @ ] ] dip
-    if ; inline
+    [ fork-process ] 2dip if-zero ; inline
 
 CONSTANT: SIGKILL 9
 CONSTANT: SIGTERM 15
@@ -96,6 +95,3 @@ CONSTANT: WNOWAIT    HEX: 1000000
 
 FUNCTION: pid_t wait ( int* status ) ;
 FUNCTION: pid_t waitpid ( pid_t wpid, int* status, int options ) ;
-
-: wait-for-pid ( pid -- status )
-    0 <int> [ 0 waitpid drop ] keep *int WEXITSTATUS ;
index 04f884e496823ec083fcb3c4d493d5b973d2ea59..93ed1a42db9b8702d433b87d53824504964733b8 100644 (file)
@@ -24,5 +24,5 @@ STRUCT: stat
     { st_birthtimespec timespec }
     { pad0 __int32_t[2] } ;
 
-FUNCTION: int stat  ( char* pathname, stat* buf ) ;
-FUNCTION: int lstat ( char* pathname, stat* buf ) ;
+FUNCTION: int stat  ( c-string pathname, stat* buf ) ;
+FUNCTION: int lstat ( c-string pathname, stat* buf ) ;
index f01140ff4b2b6256ac8f5e46aab2d34c05fa2a19..b3becff2408caaa2e9bbc72ee1744ad7ff778fe5 100644 (file)
@@ -21,8 +21,8 @@ STRUCT: stat
     { st_ctimespec timespec }
     { st_ino ulonglong } ;
 
-FUNCTION: int __xstat64  ( int ver, char* pathname, stat* buf ) ;
-FUNCTION: int __lxstat64 ( int ver, char* pathname, stat* buf ) ;
+FUNCTION: int __xstat64  ( int ver, c-string pathname, stat* buf ) ;
+FUNCTION: int __lxstat64 ( int ver, c-string pathname, stat* buf ) ;
 
 :  stat ( pathname buf -- int ) [ 1 ] 2dip __xstat64 ;
 : lstat ( pathname buf -- int ) [ 1 ] 2dip __lxstat64 ;
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index bb16133c76bba3a7b39199cda40739ccef639ab1..0862bf82a0d4f9dbacfe4463a9cb8eaeb82edd96 100644 (file)
@@ -21,8 +21,8 @@ STRUCT: stat
     { st_ctimespec timespec }
     { __unused0 long[3] } ;
 
-FUNCTION: int __xstat64  ( int ver, char* pathname, stat* buf ) ;
-FUNCTION: int __lxstat64 ( int ver, char* pathname, stat* buf ) ;
+FUNCTION: int __xstat64  ( int ver, c-string pathname, stat* buf ) ;
+FUNCTION: int __lxstat64 ( int ver, c-string pathname, stat* buf ) ;
 
 :  stat ( pathname buf -- int ) [ 1 ] 2dip __xstat64 ;
 : lstat ( pathname buf -- int ) [ 1 ] 2dip __lxstat64 ;
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 4e6b2dfb21e2d1400f4c78d0fe55165765bb0fd9..024cd317e81672426df1f8a34d491388c9521d6a 100644 (file)
@@ -26,8 +26,8 @@ STRUCT: stat
     { st_qspare0 __int64_t }
     { st_qspare1 __int64_t } ;
 
-FUNCTION: int stat64  ( char* pathname, stat* buf ) ;
-FUNCTION: int lstat64 ( char* pathname, stat* buf ) ;
+FUNCTION: int stat64  ( c-string pathname, stat* buf ) ;
+FUNCTION: int lstat64 ( c-string pathname, stat* buf ) ;
 
 : stat ( path buf -- n ) stat64 ;
 : lstat ( path buf -- n ) lstat64 ;
index fb0d61b7e9efcbd3e10cd2de48ecd4c428acc517..bb0a40375153d8592da0daa8145cea85bc48c94e 100644 (file)
@@ -23,8 +23,8 @@ STRUCT: stat
     { st_gen uint32_t }
     { st_qspare uint32_t[2] } ;
 
-FUNCTION: int __stat30  ( char* pathname, stat* buf ) ;
-FUNCTION: int __lstat30 ( char* pathname, stat* buf ) ;
+FUNCTION: int __stat30  ( c-string pathname, stat* buf ) ;
+FUNCTION: int __lstat30 ( c-string pathname, stat* buf ) ;
 
 : stat ( pathname buf -- n ) __stat30 ;
 : lstat ( pathname buf -- n ) __lstat30 ;
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 47c4e0c129f58d3a8c0cae47b907b5976e3377a2..010dcca7242f03a4fa71cf0e47ca2c468f710192 100644 (file)
@@ -23,8 +23,8 @@ STRUCT: stat
     { st_spare0 uint32_t }
     { st_birthtimespec timespec } ;
 
-FUNCTION: int __stat13 ( char* pathname, stat* buf ) ;
-FUNCTION: int __lstat13 ( char* pathname, stat* buf ) ;
+FUNCTION: int __stat13 ( c-string pathname, stat* buf ) ;
+FUNCTION: int __lstat13 ( c-string pathname, stat* buf ) ;
 
 : stat ( pathname buf -- n ) __stat13 ;
 : lstat ( pathname buf -- n ) __lstat13 ;
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 2702e60f6cdd21813ca36da9414304304901578d..b562d085b389865504420325a7957d09db6c4dd0 100644 (file)
@@ -25,5 +25,5 @@ STRUCT: stat
     { st_birthtimespec timespec }
     { st_qspare int64_t[2] } ;
 
-FUNCTION: int stat  ( char* pathname, stat* buf ) ;
-FUNCTION: int lstat ( char* pathname, stat* buf ) ;
+FUNCTION: int stat  ( c-string pathname, stat* buf ) ;
+FUNCTION: int lstat ( c-string pathname, stat* buf ) ;
index ae418e6eb469c09e5b5fcdd6147718fb9fa9eecd..f12473da92f471bf1cbd1d8ba7f91b06a729ce96 100644 (file)
@@ -31,4 +31,4 @@ STRUCT: statfs
     { f_mntfromname { char MNAMELEN } }
     { f_mntonname { char MNAMELEN } } ;
 
-FUNCTION: int statfs ( char* path, statfs* buf ) ;
+FUNCTION: int statfs ( c-string path, statfs* buf ) ;
index ab37ab9605970bd76a9cf1e5fff5df7dc30cf626..2cf2541a100c184b848fb8b7bfc71c005e6e79c9 100644 (file)
@@ -16,4 +16,4 @@ STRUCT: statfs64
     { f_frsize __SWORD_TYPE }
     { f_spare __SWORD_TYPE[5] } ;
 
-FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
+FUNCTION: int statfs64 ( c-string path, statfs64* buf ) ;
index 56c89898951788b7a0ab88f7e120b31a5893358f..b5ae2c222327d78541ed9b9a9ab312403d017c05 100644 (file)
@@ -3,7 +3,7 @@
 USING: alien.c-types io.encodings.utf8 io.encodings.string
 kernel sequences unix.stat accessors unix combinators math
 grouping system alien.strings math.bitwise alien.syntax
-unix.types classes.struct unix.ffi ;
+unix.types classes.struct unix.ffi literals ;
 IN: unix.statfs.macosx
 
 CONSTANT: MNT_RDONLY  HEX: 00000001
@@ -29,8 +29,8 @@ CONSTANT: MNT_MULTILABEL  HEX: 04000000
 CONSTANT: MNT_NOATIME HEX: 10000000
 ALIAS: MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP
 
-: MNT_VISFLAGMASK ( -- n )
-    {
+CONSTANT: MNT_VISFLAGMASK
+    flags{
         MNT_RDONLY MNT_SYNCHRONOUS MNT_NOEXEC
         MNT_NOSUID MNT_NODEV MNT_UNION
         MNT_ASYNC MNT_EXPORTED MNT_QUARANTINE
@@ -38,14 +38,13 @@ ALIAS: MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP
         MNT_ROOTFS MNT_DOVOLFS MNT_DONTBROWSE
         MNT_IGNORE_OWNERSHIP MNT_AUTOMOUNTED MNT_JOURNALED
         MNT_NOUSERXATTR MNT_DEFWRITE MNT_MULTILABEL MNT_NOATIME
-    } flags ; inline
+    }
 
 CONSTANT: MNT_UPDATE  HEX: 00010000
 CONSTANT: MNT_RELOAD  HEX: 00040000
 CONSTANT: MNT_FORCE   HEX: 00080000
 
-: MNT_CMDFLAGS ( -- n )
-    { MNT_UPDATE MNT_RELOAD MNT_FORCE } flags ; inline
+CONSTANT: MNT_CMDFLAGS flags{ MNT_UPDATE MNT_RELOAD MNT_FORCE }
 
 CONSTANT: VFS_GENERIC 0
 CONSTANT: VFS_NUMMNTOPS 1
@@ -116,5 +115,5 @@ STRUCT: statfs64
     { f_mntfromname { char MAXPATHLEN } }
     { f_reserved uint32_t[8] } ;
 
-FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
+FUNCTION: int statfs64 ( c-string path, statfs64* buf ) ;
 FUNCTION: int getmntinfo64 ( statfs64** mntbufp, int flags ) ;
index 4e65e74c2c085f37ced2478c446b8124aa67e9c5..9c63bfa96b19b9460e1d7145084d1cf9c277c590 100644 (file)
@@ -31,4 +31,4 @@ STRUCT: statfs
     { f_mntfromname { char MNAMELEN } }
     { mount_info char[160] } ;
 
-FUNCTION: int statfs ( char* path, statfs* buf ) ;
+FUNCTION: int statfs ( c-string path, statfs* buf ) ;
index c2834736b7b103b8b35b6b4bbca65225632c031d..5e66a7daf95f5d5a16de3e5e68b0b8559e0b5e47 100644 (file)
@@ -20,4 +20,4 @@ STRUCT: statvfs
 CONSTANT: ST_RDONLY   HEX: 1 ! Read-only file system
 CONSTANT: ST_NOSUID   HEX: 2 ! Does not honor setuid/setgid
 
-FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
+FUNCTION: int statvfs ( c-string path, statvfs* buf ) ;
index d7139d84b283a2530dd577e5dc7d2f2c378d8bd5..bda1eb9605f2fbbd8f8830f8d8f7d937ce5ef7cd 100644 (file)
@@ -17,7 +17,7 @@ STRUCT: statvfs64
     { f_namemax ulong }
     { __f_spare int[6] } ;
 
-FUNCTION: int statvfs64 ( char* path, statvfs64* buf ) ;
+FUNCTION: int statvfs64 ( c-string path, statvfs64* buf ) ;
 
 CONSTANT: ST_RDONLY 1        ! Mount read-only.
 CONSTANT: ST_NOSUID 2        ! Ignore suid and sgid bits.
index 3fe44a28d06f1667137a04df6fe1d339ed5cdb00..18b794acbf71e9b4428c86d0c9af5d777caded13 100644 (file)
@@ -20,4 +20,4 @@ STRUCT: statvfs
 CONSTANT: ST_RDONLY   HEX: 1 ! Read-only file system
 CONSTANT: ST_NOSUID   HEX: 2 ! Does not honor setuid/setgid
 
-FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
+FUNCTION: int statvfs ( c-string path, statvfs* buf ) ;
index a76774b656cf918a7aa097b693c42d37ef879397..f53d72f02e3daf1420ff8c76a47759dde4b4f6ce 100644 (file)
@@ -33,4 +33,4 @@ STRUCT: statvfs
     { f_mntonname { char _VFS_MNAMELEN } }
     { f_mntfromname { char _VFS_MNAMELEN } } ;
 
-FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
+FUNCTION: int statvfs ( c-string path, statvfs* buf ) ;
index d5b2ee30a811a3b9d0caa33255e5bfcfed9fa441..146db770efcec0e74916fc90c9f08bc1b9c76b6e 100644 (file)
@@ -19,4 +19,4 @@ STRUCT: statvfs
 CONSTANT: ST_RDONLY       1
 CONSTANT: ST_NOSUID       2
 
-FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
+FUNCTION: int statvfs ( c-string path, statvfs* buf ) ;
index 0a63965c20179fda605ac448a88183708c923ac9..72132bb132fb2675effe90cd9455240d263da25c 100644 (file)
@@ -35,7 +35,7 @@ STRUCT: tm
     { yday int }
     { isdst int }
     { gmtoff long }
-    { zone char* } ;
+    { zone c-string } ;
 
 FUNCTION: time_t time ( time_t* t ) ;
 FUNCTION: tm* localtime ( time_t* clock ) ;
index 215e344231d94b5a0a44233831e5f502eb45ba83..4973df989da1c5a353e3774a47304ca2ba06ab47 100644 (file)
@@ -21,6 +21,6 @@ TYPEDEF: __uint32_t     blksize_t
 TYPEDEF: __uint32_t     fflags_t
 TYPEDEF: long           ssize_t
 TYPEDEF: int            pid_t
-TYPEDEF: int            time_t
+TYPEDEF: long           time_t
 
-ALIAS: <time_t> <int>
+ALIAS: <time_t> <long>
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 4e77a41713a64a50beb95b9c0dc565ff8a6a5678..101736ea1f76681775989406def1f41ef4d500b4 100644 (file)
@@ -5,8 +5,8 @@ USING: accessors alien alien.c-types alien.libraries
 alien.syntax byte-arrays classes.struct combinators
 combinators.short-circuit combinators.smart continuations
 generalizations io kernel libc locals macros math namespaces
-sequences stack-checker strings system unix.time unix.types
-vocabs vocabs.loader unix.ffi ;
+sequences sequences.generalizations stack-checker strings system
+unix.time unix.types vocabs vocabs.loader unix.ffi ;
 IN: unix
 
 ERROR: unix-error errno message ;
@@ -50,9 +50,7 @@ HOOK: open-file os ( path flags mode -- fd )
 
 : close-file ( fd -- ) [ close ] unix-system-call drop ;
 
-: _exit ( status -- * )
-    #! We throw to give this a terminating stack effect.
-    int f "_exit" { int } alien-invoke "Exit failed" throw ;
+FUNCTION: int _exit ( int status ) ;
 
 M: unix open-file [ open ] unix-system-call ;
 
@@ -74,8 +72,6 @@ M: unix open-file [ open ] unix-system-call ;
 
 <<
 
-"debugger" vocab [
-    "unix.debugger" require
-] when
+{ "unix" "debugger" } "unix.debugger" require-when
 
 >>
index 5de176e2424cab7cad635cc40dec93470234a638..0575538b87aa8cc256b0871c7254e0753ce1def9 100644 (file)
@@ -37,7 +37,7 @@ PRIVATE>
 
 : all-users ( -- seq )
     [
-        [ unix.ffi:getpwent dup ] [ unix.ffi:passwd memory>struct passwd>new-passwd ] produce nip
+        [ unix.ffi:getpwent dup ] [ passwd>new-passwd ] produce nip
     ] with-pwent ;
 
 SYMBOL: user-cache
@@ -52,10 +52,10 @@ GENERIC: user-passwd ( obj -- passwd/f )
 
 M: integer user-passwd ( id -- passwd/f )
     user-cache get
-    [ at ] [ unix.ffi:getpwuid [ unix.ffi:passwd memory>struct passwd>new-passwd ] [ f ] if* ] if* ;
+    [ at ] [ unix.ffi:getpwuid [ passwd>new-passwd ] [ f ] if* ] if* ;
 
 M: string user-passwd ( string -- passwd/f )
-    unix.ffi:getpwnam dup [ unix.ffi:passwd memory>struct passwd>new-passwd ] when ;
+    unix.ffi:getpwnam dup [ passwd>new-passwd ] when ;
 
 : user-name ( id -- string )
     dup user-passwd
index 78556ab22524d7d5c4a3ba7d5ece2ed3b4ee1de7..1d6dfdedec12ab954fd2e9564e66ac47a47e368b 100644 (file)
@@ -41,7 +41,7 @@ M: unix new-utmpx-record
     utmpx-record new ;
     
 M: unix utmpx>utmpx-record ( utmpx -- utmpx-record )
-    [ new-utmpx-record ] dip \ utmpx memory>struct
+    [ new-utmpx-record ] dip
     {
         [ ut_user>> _UTX_USERSIZE memory>string >>user ]
         [ ut_id>>   _UTX_IDSIZE memory>string >>id ]
index 9e2c9539c6ecfa2362efbbc7892a1aee165e2cd6..a1ec025e45bd7a62e48bf883dc556403f8d17ba3 100644 (file)
@@ -47,7 +47,7 @@ M: unrolled-list clear-deque
         unroll-factor 0 <array>
         [ unroll-factor 1 - swap set-nth ] keep f
     ] dip [ node boa dup ] keep
-    dup [ (>>prev) ] [ 2drop ] if ; inline
+    dup [ prev<< ] [ 2drop ] if ; inline
 
 : normalize-back ( list -- )
     dup back>> [
@@ -93,7 +93,7 @@ M: unrolled-list pop-front*
     [
         unroll-factor 0 <array> [ set-first ] keep
     ] dip [ f node boa dup ] keep
-    dup [ (>>next) ] [ 2drop ] if ; inline
+    dup [ next<< ] [ 2drop ] if ; inline
 
 : normalize-front ( list -- )
     dup front>> [
index bf4a9bb76c9d6cd83cd1c3bf815fa333468fa737..0f89ba0d9f062f5d478b953664217285906cf3bf 100644 (file)
@@ -183,8 +183,6 @@ PRIVATE>
 ! Literal syntax
 SYNTAX: URL" lexer get skip-blank parse-string >url suffix! ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [
-    "urls.prettyprint" require
-] when
+{ "urls" "prettyprint" } "urls.prettyprint" require-when
index acdcdda5d2b27954b3b7732cd13adafe55de4826..6b5936977f433bae7745c8cc48c1a2660301242f 100644 (file)
@@ -2,17 +2,12 @@ IN: validators.tests
 USING: kernel sequences tools.test validators accessors
 namespaces assocs ;
 
-[ "" v-one-line ] must-fail
-[ "hello world" ] [ "hello world" v-one-line ] unit-test
-[ "hello\nworld" v-one-line ] must-fail
-
-[ "" v-one-word ] must-fail
-[ "hello" ] [ "hello" v-one-word ] unit-test
-[ "hello world" v-one-word ] must-fail
-
 [ t ] [ "on" v-checkbox ] unit-test
 [ f ] [ "off" v-checkbox ] unit-test
 
+[ "default test" ] [ "" "default test" v-default ] unit-test
+[ "blah" ] [ "blah" "default test" v-default ] unit-test
+
 [ "foo" v-number ] must-fail
 [ 123 ] [ "123" v-number ] unit-test
 [ 123 ] [ "123" v-integer ] unit-test
@@ -42,6 +37,14 @@ namespaces assocs ;
 [ "http:/www.factorcode.org" v-url ]
 [ "invalid URL" = ] must-fail-with
 
+[ "" v-one-line ] must-fail
+[ "hello world" ] [ "hello world" v-one-line ] unit-test
+[ "hello\nworld" v-one-line ] must-fail
+
+[ "" v-one-word ] must-fail
+[ "hello" ] [ "hello" v-one-word ] unit-test
+[ "hello world" v-one-word ] must-fail
+
 [ 4561261212345467 ] [ "4561261212345467" v-credit-card ] unit-test
 
 [ 4561261212345467 ] [ "4561-2612-1234-5467" v-credit-card ] unit-test
index f2c5691452458497180028612a5185d87aeaf571..45287a60c6641ef7e45fffd4610e86dc4166cdd0 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2006, 2008 Slava Pestov
+! Copyright (C) 2006, 2010 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel continuations sequences math namespaces make sets
 math.parser math.ranges assocs regexp unicode.categories arrays
@@ -9,7 +9,7 @@ IN: validators
     >lower "on" = ;
 
 : v-default ( str def -- str/def )
-    [ nip empty? ] 2keep ? ;
+    [ drop empty? not ] 2keep ? ;
 
 : v-required ( str -- str )
     dup empty? [ "required" throw ] when ;
@@ -97,7 +97,7 @@ IN: validators
     sum 10 mod 0 = ;
 
 : v-credit-card ( str -- n )
-    "- " diff
+    "- " without
     dup CHAR: 0 CHAR: 9 [a,b] diff empty? [
         13 v-min-length
         16 v-max-length
index 4329affe82b33ec342ec5127a54ab458d5b56b61..61217b10379f90544b675f919576c491bdd7aea0 100644 (file)
@@ -41,7 +41,7 @@ M: value-word definer drop \ VALUE: f ;
 M: value-word definition drop f ;
 
 : set-value ( value word -- )
-    def>> first (>>obj) ;
+    def>> first obj<< ;
 
 SYNTAX: to:
     scan-word literalize suffix!
index cc4a291a8b089922fda2dd93bb77174c2e827e1d..b335d489880914fc4b51c2d0d51b18fa1586ab52 100644 (file)
@@ -10,23 +10,23 @@ STRUCT: context
 { callstack-bottom void* }
 { datastack cell }
 { retainstack cell }
-{ magic-frame void* }
+{ callstack-save cell }
 { datastack-region void* }
 { retainstack-region void* }
-{ catchstack-save cell }
-{ current-callback-save cell }
-{ next context* } ;
+{ callstack-region void* }
+{ context-objects cell[10] } ;
 
 : context-field-offset ( field -- offset ) context offset-of ; inline
 
 STRUCT: zone
-{ start cell }
 { here cell }
-{ size cell }
-{ end cell } ;
+{ start cell }
+{ end cell }
+{ size cell } ;
 
 STRUCT: vm
 { ctx context* }
+{ spare-ctx context* }
 { nursery zone }
 { cards-offset cell }
 { decks-offset cell }
@@ -34,13 +34,12 @@ STRUCT: vm
 
 : vm-field-offset ( field -- offset ) vm offset-of ; inline
 
-C-ENUM:
-collect-nursery-op
-collect-aging-op
-collect-to-tenured-op
-collect-full-op
-collect-compact-op
-collect-growing-heap-op ;
+CONSTANT: collect-nursery-op 0
+CONSTANT: collect-aging-op 1
+CONSTANT: collect-to-tenured-op 2
+CONSTANT: collect-full-op 3
+CONSTANT: collect-compact-op 4
+CONSTANT: collect-growing-heap-op 5
 
 STRUCT: copying-sizes
 { size cell }
index b840b5ab9dfe96d83ff8dcb22a18fad77c8e5117..609d485f0c7e13d1f8ddb36a6ca1ce8624457835 100644 (file)
@@ -65,8 +65,8 @@ PRIVATE>
     #! Hack.\r
     [ vocab-prefix? ] partition\r
     [\r
-        [ vocab-name ] map unique\r
-        '[ name>> _ key? not ] filter\r
+        [ vocab-name ] map fast-set\r
+        '[ name>> _ in? not ] filter\r
         convert-prefixes\r
     ] keep\r
     append ;\r
@@ -97,9 +97,6 @@ MEMO: all-vocabs-recursive ( -- assoc )
 \r
 <PRIVATE\r
 \r
-: filter-unportable ( seq -- seq' )\r
-    [ vocab-name unportable? not ] filter ;\r
-\r
 : collect-vocabs ( quot -- seq )\r
     [ all-vocabs-recursive no-roots no-prefixes ] dip\r
     gather natural-sort ; inline\r
@@ -109,7 +106,7 @@ PRIVATE>
 : (load) ( prefix -- failures )\r
     [ child-vocabs-recursive no-roots no-prefixes ]\r
     [ dup find-vocab-root [ >vocab-link prefix ] [ drop ] if ] bi\r
-    filter-unportable\r
+    filter-don't-load\r
     require-all ;\r
 \r
 : load ( prefix -- )\r
index 09ca012fcc0ed7f02bc6e597a2f7af402ae8bc42..bb14581f0d5c6700930b2c8a5f28dd96761de7e5 100644 (file)
@@ -73,7 +73,7 @@ M: vocab-link summary vocab-summary ;
     dup vocab-tags-path set-vocab-file-contents ;
 
 : add-vocab-tags ( tags vocab -- )
-    [ vocab-tags append prune ] keep set-vocab-tags ;
+    [ vocab-tags append members ] keep set-vocab-tags ;
 
 : remove-vocab-tags ( tags vocab -- )
     [ vocab-tags swap diff ] keep set-vocab-tags ;
@@ -103,12 +103,21 @@ ERROR: bad-platform name ;
 : supported-platform? ( platforms -- ? )
     [ t ] [ [ os swap class<= ] any? ] if-empty ;
 
-: unportable? ( vocab -- ? )
+: don't-load? ( vocab -- ? )
     {
-        [ vocab-tags "untested" swap member? ]
+        [ vocab-tags "not loaded" swap member? ]
         [ vocab-platforms supported-platform? not ]
     } 1|| ;
 
+: filter-don't-load ( vocabs -- vocabs' )
+    [ vocab-name don't-load? not ] filter ;
+
+: don't-test? ( vocab -- ? )
+    vocab-tags "not tested" swap member? ;
+
+: filter-don't-test ( vocabs -- vocabs' )
+    [ don't-test? not ] filter ;
+
 TUPLE: unsupported-platform vocab requires ;
 
 : unsupported-platform ( vocab requires -- )
index 1bf73862e6b58b0da3dcff4cbe08a0c22d331df0..c9b664dc91fda9927e3edd2a03f9eb6f3cc7a9eb 100644 (file)
@@ -1,59 +1,58 @@
-! Copyright (C) 2008, 2009 Slava Pestov.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: accessors assocs command-line concurrency.messaging\r
-continuations init io.backend io.files io.monitors io.pathnames\r
-kernel namespaces sequences sets splitting threads\r
-tr vocabs vocabs.loader vocabs.refresh vocabs.cache ;\r
-IN: vocabs.refresh.monitor\r
-\r
-TR: convert-separators "/\\" ".." ;\r
-\r
-: vocab-dir>vocab-name ( path -- vocab )\r
-    trim-head-separators\r
-    trim-tail-separators\r
-    convert-separators ;\r
-\r
-: path>vocab-name ( path -- vocab )\r
-    dup ".factor" tail? [ parent-directory ] when ;\r
-\r
-: chop-vocab-root ( path -- path' )\r
-    "resource:" prepend-path normalize-path\r
-    dup vocab-roots get\r
-    [ normalize-path ] map\r
-    [ head? ] with find nip\r
-    ?head drop ;\r
-\r
-: path>vocab ( path -- vocab )\r
-    chop-vocab-root path>vocab-name vocab-dir>vocab-name ;\r
-\r
-: monitor-loop ( -- )\r
-    #! On OS X, monitors give us the full path, so we chop it\r
-    #! off if its there.\r
-    receive path>> path>vocab changed-vocab\r
-    reset-cache\r
-    monitor-loop ;\r
-\r
-: add-monitor-for-path ( path -- )\r
-    dup exists? [ t my-mailbox (monitor) ] when drop ;\r
-\r
-: monitor-thread ( -- )\r
-    [\r
-        [\r
-            vocab-roots get prune [ add-monitor-for-path ] each\r
-\r
-            H{ } clone changed-vocabs set-global\r
-            vocabs [ changed-vocab ] each\r
-\r
-            monitor-loop\r
-        ] with-monitors\r
-    ] ignore-errors ;\r
-\r
-: start-monitor-thread ( -- )\r
-    #! Silently ignore errors during monitor creation since\r
-    #! monitors are not supported on all platforms.\r
-    [ monitor-thread ] "Vocabulary monitor" spawn drop ;\r
-\r
-[\r
-    "-no-monitors" (command-line) member?\r
-    [ start-monitor-thread ] unless\r
-] "vocabs.refresh.monitor" add-startup-hook\r
+! Copyright (C) 2008, 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors assocs command-line concurrency.messaging
+continuations init io.backend io.files io.monitors io.pathnames
+kernel namespaces sequences sets splitting threads fry
+tr vocabs vocabs.loader vocabs.refresh vocabs.cache ;
+IN: vocabs.refresh.monitor
+
+TR: convert-separators "/\\" ".." ;
+
+: vocab-dir>vocab-name ( path -- vocab )
+    trim-head-separators
+    trim-tail-separators
+    convert-separators ;
+
+: path>vocab-name ( path -- vocab )
+    dup ".factor" tail? [ parent-directory ] when ;
+
+: chop-vocab-root ( path -- path' )
+    "resource:" prepend-path normalize-path
+    dup vocab-roots get
+    [ normalize-path ] map
+    [ head? ] with find nip
+    ?head drop ;
+
+: path>vocab ( path -- vocab )
+    chop-vocab-root path>vocab-name vocab-dir>vocab-name ;
+
+: monitor-loop ( monitor -- )
+    #! On OS X, monitors give us the full path, so we chop it
+    #! off if its there.
+    [ next-change path>> path>vocab changed-vocab reset-cache ]
+    [ monitor-loop ]
+    bi ;
+
+: (start-vocab-monitor) ( vocab-root -- )
+    dup exists?
+    [ [ t <monitor> monitor-loop ] with-monitors ] [ drop ] if ;
+
+: start-vocab-monitor ( vocab-root -- )
+    [ '[ [ _ (start-vocab-monitor) ] ignore-errors ] ]
+    [ "Root monitor: " prepend ]
+    bi spawn drop ;
+
+: init-vocab-monitor ( -- )
+    H{ } clone changed-vocabs set-global
+    vocabs [ changed-vocab ] each ;
+
+[
+    "-no-monitors" (command-line) member? [
+        [ drop ] add-vocab-root-hook set-global
+        f changed-vocabs set-global
+    ] [
+        init-vocab-monitor
+        vocab-roots get [ start-vocab-monitor ] each
+        [ start-vocab-monitor ] add-vocab-root-hook set-global
+    ] if
+] "vocabs.refresh.monitor" add-startup-hook
index 9ec89e3102337eab0d66a1835a8f0167b3ec9919..3d9c91bbcd52beeead288bf03bc8f7651a41f8c6 100644 (file)
@@ -3,6 +3,7 @@
 USING: accessors assocs checksums checksums.crc32
 io.encodings.utf8 io.files kernel namespaces sequences sets
 source-files vocabs vocabs.errors vocabs.loader ;
+FROM: namespaces => set ;
 IN: vocabs.refresh
 
 : source-modified? ( path -- ? )
@@ -81,11 +82,11 @@ SYMBOL: modified-docs
         [ [ vocab f >>docs-loaded? drop ] each ] bi*
     ]
     [
-        append prune
+        union
         [ unchanged-vocabs ]
         [ require-all load-failures. ] bi
     ] 2bi ;
 
 : refresh ( prefix -- ) to-refresh do-refresh ;
 
-: refresh-all ( -- ) "" refresh ;
\ No newline at end of file
+: refresh-all ( -- ) "" refresh ;
old mode 100644 (file)
new mode 100755 (executable)
index d5fe33b..c40cc23
@@ -1,28 +1,9 @@
-USING: alien.c-types alien.syntax kernel math windows.types
-windows.kernel32 math.bitwise classes.struct ;
+USING: alien.c-types alien.syntax classes.struct kernel
+literals math math.bitwise windows.kernel32 windows.types ;
 IN: windows.advapi32
 
 LIBRARY: advapi32
 
-CONSTANT: PROV_RSA_FULL       1
-CONSTANT: PROV_RSA_SIG        2
-CONSTANT: PROV_DSS            3
-CONSTANT: PROV_FORTEZZA       4
-CONSTANT: PROV_MS_EXCHANGE    5
-CONSTANT: PROV_SSL            6
-CONSTANT: PROV_RSA_SCHANNEL  12
-CONSTANT: PROV_DSS_DH        13
-CONSTANT: PROV_EC_ECDSA_SIG  14
-CONSTANT: PROV_EC_ECNRA_SIG  15
-CONSTANT: PROV_EC_ECDSA_FULL 16
-CONSTANT: PROV_EC_ECNRA_FULL 17
-CONSTANT: PROV_DH_SCHANNEL   18
-CONSTANT: PROV_SPYRUS_LYNKS  20
-CONSTANT: PROV_RNG           21
-CONSTANT: PROV_INTEL_SEC     22
-CONSTANT: PROV_REPLACE_OWF   23
-CONSTANT: PROV_RSA_AES       24
-
 CONSTANT: MS_DEF_DH_SCHANNEL_PROV "Microsoft DH Schannel Cryptographic Provider"
 
 CONSTANT: MS_DEF_DSS_DH_PROV
@@ -56,12 +37,6 @@ CONSTANT: MS_SCARD_PROV
 CONSTANT: MS_STRONG_PROV
     "Microsoft Strong Cryptographic Provider"
 
-CONSTANT: CRYPT_VERIFYCONTEXT  HEX: F0000000
-CONSTANT: CRYPT_NEWKEYSET      HEX: 8
-CONSTANT: CRYPT_DELETEKEYSET   HEX: 10
-CONSTANT: CRYPT_MACHINE_KEYSET HEX: 20
-CONSTANT: CRYPT_SILENT         HEX: 40
-
 STRUCT: ACL
     { AclRevision BYTE }
     { Sbz1 BYTE }
@@ -171,8 +146,7 @@ CONSTANT: TokenSessionReference 14
 CONSTANT: TokenSandBoxInert 15
 ! } TOKEN_INFORMATION_CLASS;
 
-TYPEDEF: DWORD ACCESS_MODE
-C-ENUM:
+ENUM: ACCESS_MODE
     NOT_USED_ACCESS
     GRANT_ACCESS
     SET_ACCESS
@@ -181,21 +155,18 @@ C-ENUM:
     SET_AUDIT_SUCCESS
     SET_AUDIT_FAILURE ;
 
-TYPEDEF: DWORD MULTIPLE_TRUSTEE_OPERATION
-C-ENUM:
+ENUM: MULTIPLE_TRUSTEE_OPERATION
     NO_MULTIPLE_TRUSTEE
     TRUSTEE_IS_IMPERSONATE ;
 
-TYPEDEF: DWORD TRUSTEE_FORM
-C-ENUM:
+ENUM: TRUSTEE_FORM
   TRUSTEE_IS_SID
   TRUSTEE_IS_NAME
   TRUSTEE_BAD_FORM
   TRUSTEE_IS_OBJECTS_AND_SID
   TRUSTEE_IS_OBJECTS_AND_NAME ;
 
-TYPEDEF: DWORD TRUSTEE_TYPE
-C-ENUM:
+ENUM: TRUSTEE_TYPE
     TRUSTEE_IS_UNKNOWN
     TRUSTEE_IS_USER
     TRUSTEE_IS_GROUP
@@ -206,8 +177,7 @@ C-ENUM:
     TRUSTEE_IS_INVALID
     TRUSTEE_IS_COMPUTER ;
 
-TYPEDEF: DWORD SE_OBJECT_TYPE
-C-ENUM:
+ENUM: SE_OBJECT_TYPE
     SE_UNKNOWN_OBJECT_TYPE
     SE_FILE_OBJECT
     SE_SERVICE
@@ -361,18 +331,18 @@ CONSTANT: TOKEN_IMPERSONATE            HEX: 0004
 CONSTANT: TOKEN_QUERY                  HEX: 0008
 CONSTANT: TOKEN_QUERY_SOURCE           HEX: 0010
 CONSTANT: TOKEN_ADJUST_DEFAULT         HEX: 0080
-: TOKEN_READ ( -- n ) { STANDARD_RIGHTS_READ TOKEN_QUERY } flags ;
+CONSTANT: TOKEN_READ flags{ STANDARD_RIGHTS_READ TOKEN_QUERY }
 
-: TOKEN_WRITE ( -- n )
-    {
+CONSTANT: TOKEN_WRITE
+    flags{
         STANDARD_RIGHTS_WRITE
         TOKEN_ADJUST_PRIVILEGES
         TOKEN_ADJUST_GROUPS
         TOKEN_ADJUST_DEFAULT
-    } flags ; foldable
+    }
 
-: TOKEN_ALL_ACCESS ( -- n )
-    {
+CONSTANT: TOKEN_ALL_ACCESS
+    flags{
         STANDARD_RIGHTS_REQUIRED
         TOKEN_ASSIGN_PRIMARY
         TOKEN_DUPLICATE
@@ -383,7 +353,7 @@ CONSTANT: TOKEN_ADJUST_DEFAULT         HEX: 0080
         TOKEN_ADJUST_GROUPS
         TOKEN_ADJUST_SESSIONID
         TOKEN_ADJUST_DEFAULT
-    } flags ; foldable
+    }
 
 CONSTANT: HKEY_CLASSES_ROOT        HEX: 80000000
 CONSTANT: HKEY_CURRENT_USER        HEX: 80000001
@@ -426,6 +396,305 @@ CONSTANT: REG_QWORD_LITTLE_ENDIAN         11
 CONSTANT: REG_CREATED_NEW_KEY     1
 CONSTANT: REG_OPENED_EXISTING_KEY 2
 
+
+
+CONSTANT: ALG_CLASS_ANY 0
+CONSTANT: ALG_CLASS_SIGNATURE  8192
+CONSTANT: ALG_CLASS_MSG_ENCRYPT  16384
+CONSTANT: ALG_CLASS_DATA_ENCRYPT  24576
+CONSTANT: ALG_CLASS_HASH  32768
+CONSTANT: ALG_CLASS_KEY_EXCHANGE  40960
+CONSTANT: ALG_CLASS_ALL 57344
+CONSTANT: ALG_TYPE_ANY 0
+CONSTANT: ALG_TYPE_DSS 512
+CONSTANT: ALG_TYPE_RSA 1024
+CONSTANT: ALG_TYPE_BLOCK 1536
+CONSTANT: ALG_TYPE_STREAM  2048
+CONSTANT: ALG_TYPE_DH 2560
+CONSTANT: ALG_TYPE_SECURECHANNEL 3072
+CONSTANT: ALG_SID_ANY 0
+CONSTANT: ALG_SID_RSA_ANY 0
+CONSTANT: ALG_SID_RSA_PKCS 1
+CONSTANT: ALG_SID_RSA_MSATWORK 2
+CONSTANT: ALG_SID_RSA_ENTRUST 3
+CONSTANT: ALG_SID_RSA_PGP 4
+CONSTANT: ALG_SID_DSS_ANY 0
+CONSTANT: ALG_SID_DSS_PKCS 1
+CONSTANT: ALG_SID_DSS_DMS 2
+CONSTANT: ALG_SID_DES 1
+CONSTANT: ALG_SID_3DES 3
+CONSTANT: ALG_SID_DESX 4
+CONSTANT: ALG_SID_IDEA 5
+CONSTANT: ALG_SID_CAST 6
+CONSTANT: ALG_SID_SAFERSK64 7
+CONSTANT: ALG_SID_SAFERSK128 8
+CONSTANT: ALG_SID_3DES_112 9
+CONSTANT: ALG_SID_SKIPJACK 10
+CONSTANT: ALG_SID_TEK 11
+CONSTANT: ALG_SID_CYLINK_MEK 12
+CONSTANT: ALG_SID_RC5 13
+CONSTANT: ALG_SID_RC2 2
+CONSTANT: ALG_SID_RC4 1
+CONSTANT: ALG_SID_SEAL 2
+CONSTANT: ALG_SID_MD2 1
+CONSTANT: ALG_SID_MD4 2
+CONSTANT: ALG_SID_MD5 3
+CONSTANT: ALG_SID_SHA 4
+CONSTANT: ALG_SID_MAC 5
+CONSTANT: ALG_SID_RIPEMD 6
+CONSTANT: ALG_SID_RIPEMD160 7
+CONSTANT: ALG_SID_SSL3SHAMD5 8
+CONSTANT: ALG_SID_HMAC 9
+CONSTANT: ALG_SID_TLS1PRF 10
+CONSTANT: ALG_SID_EXAMPLE 80
+
+CONSTANT: CALG_MD2 flags{ ALG_CLASS_HASH ALG_TYPE_ANY ALG_SID_MD2 }
+CONSTANT: CALG_MD4 flags{ ALG_CLASS_HASH ALG_TYPE_ANY ALG_SID_MD4 }
+CONSTANT: CALG_MD5 flags{ ALG_CLASS_HASH ALG_TYPE_ANY ALG_SID_MD5 }
+CONSTANT: CALG_SHA flags{ ALG_CLASS_HASH ALG_TYPE_ANY ALG_SID_SHA }
+CONSTANT: CALG_MAC flags{ ALG_CLASS_HASH ALG_TYPE_ANY ALG_SID_MAC }
+CONSTANT: CALG_3DES flags{ ALG_CLASS_DATA_ENCRYPT ALG_TYPE_BLOCK 3 }
+CONSTANT: CALG_CYLINK_MEK flags{ ALG_CLASS_DATA_ENCRYPT ALG_TYPE_BLOCK 12 }
+CONSTANT: CALG_SKIPJACK flags{ ALG_CLASS_DATA_ENCRYPT ALG_TYPE_BLOCK 10 }
+CONSTANT: CALG_KEA_KEYX flags{ ALG_CLASS_KEY_EXCHANGE ALG_TYPE_STREAM ALG_TYPE_DSS 4 }
+CONSTANT: CALG_RSA_SIGN flags{ ALG_CLASS_SIGNATURE ALG_TYPE_RSA ALG_SID_RSA_ANY }
+CONSTANT: CALG_DSS_SIGN flags{ ALG_CLASS_SIGNATURE ALG_TYPE_DSS ALG_SID_DSS_ANY }
+CONSTANT: CALG_RSA_KEYX flags{ ALG_CLASS_KEY_EXCHANGE ALG_TYPE_RSA ALG_SID_RSA_ANY }
+CONSTANT: CALG_DES flags{ ALG_CLASS_DATA_ENCRYPT ALG_TYPE_BLOCK ALG_SID_DES }
+CONSTANT: CALG_RC2 flags{ ALG_CLASS_DATA_ENCRYPT ALG_TYPE_BLOCK ALG_SID_RC2 }
+CONSTANT: CALG_RC4 flags{ ALG_CLASS_DATA_ENCRYPT ALG_TYPE_STREAM ALG_SID_RC4 }
+CONSTANT: CALG_SEAL flags{ ALG_CLASS_DATA_ENCRYPT ALG_TYPE_STREAM ALG_SID_SEAL }
+CONSTANT: CALG_DH_EPHEM flags{ ALG_CLASS_KEY_EXCHANGE ALG_TYPE_STREAM ALG_TYPE_DSS ALG_SID_DSS_DMS }
+CONSTANT: CALG_DESX flags{ ALG_CLASS_DATA_ENCRYPT ALG_TYPE_BLOCK ALG_SID_DESX }
+! CONSTANT: CALG_TLS1PRF flags{ ALG_CLASS_DHASH ALG_TYPE_ANY ALG_SID_TLS1PRF }
+
+CONSTANT: CRYPT_VERIFYCONTEXT HEX: F0000000
+CONSTANT: CRYPT_NEWKEYSET 8
+CONSTANT: CRYPT_DELETEKEYSET 16
+CONSTANT: CRYPT_MACHINE_KEYSET 32
+CONSTANT: CRYPT_SILENT 64
+CONSTANT: CRYPT_EXPORTABLE 1
+CONSTANT: CRYPT_USER_PROTECTED 2
+CONSTANT: CRYPT_CREATE_SALT 4
+CONSTANT: CRYPT_UPDATE_KEY 8
+CONSTANT: AT_KEYEXCHANGE 1
+CONSTANT: AT_SIGNATURE 2
+CONSTANT: CRYPT_USERDATA 1
+CONSTANT: KP_IV 1
+CONSTANT: KP_SALT 2
+CONSTANT: KP_PADDING 3
+CONSTANT: KP_MODE 4
+CONSTANT: KP_MODE_BITS 5
+CONSTANT: KP_PERMISSIONS 6
+CONSTANT: KP_ALGID 7
+CONSTANT: KP_BLOCKLEN 8
+CONSTANT: PKCS5_PADDING 1
+CONSTANT: CRYPT_MODE_CBC 1
+CONSTANT: CRYPT_MODE_ECB 2
+CONSTANT: CRYPT_MODE_OFB 3
+CONSTANT: CRYPT_MODE_CFB 4
+CONSTANT: CRYPT_MODE_CTS 5
+CONSTANT: CRYPT_MODE_CBCI 6
+CONSTANT: CRYPT_MODE_CFBP 7
+CONSTANT: CRYPT_MODE_OFBP 8
+CONSTANT: CRYPT_MODE_CBCOFM 9
+CONSTANT: CRYPT_MODE_CBCOFMI 10
+CONSTANT: CRYPT_ENCRYPT 1
+CONSTANT: CRYPT_DECRYPT 2
+CONSTANT: CRYPT_EXPORT 4
+CONSTANT: CRYPT_READ 8
+CONSTANT: CRYPT_WRITE 16
+CONSTANT: CRYPT_MAC 32
+CONSTANT: HP_ALGID 1
+CONSTANT: HP_HASHVAL 2
+CONSTANT: HP_HASHSIZE 4
+CONSTANT: PP_ENUMALGS 1
+CONSTANT: PP_ENUMCONTAINERS 2
+CONSTANT: PP_IMPTYPE 3
+CONSTANT: PP_NAME 4
+CONSTANT: PP_VERSION 5
+CONSTANT: PP_CONTAINER 6
+CONSTANT: PP_ENUMMANDROOTS 25
+CONSTANT: PP_ENUMELECTROOTS 26
+CONSTANT: PP_KEYSET_TYPE 27
+CONSTANT: PP_ADMIN_PIN 31
+CONSTANT: PP_KEYEXCHANGE_PIN 32
+CONSTANT: PP_SIGNATURE_PIN 33
+CONSTANT: PP_SIG_KEYSIZE_INC 34
+CONSTANT: PP_KEYX_KEYSIZE_INC 35
+CONSTANT: PP_UNIQUE_CONTAINER 36
+CONSTANT: PP_SGC_INFO 37
+CONSTANT: PP_USE_HARDWARE_RNG 38
+CONSTANT: PP_KEYSPEC 39
+CONSTANT: PP_ENUMEX_SIGNING_PROT 40
+CONSTANT: CRYPT_FIRST 1
+CONSTANT: CRYPT_NEXT 2
+CONSTANT: CRYPT_IMPL_HARDWARE 1
+CONSTANT: CRYPT_IMPL_SOFTWARE 2
+CONSTANT: CRYPT_IMPL_MIXED 3
+CONSTANT: CRYPT_IMPL_UNKNOWN 4
+CONSTANT: PROV_RSA_FULL 1
+CONSTANT: PROV_RSA_SIG 2
+CONSTANT: PROV_DSS 3
+CONSTANT: PROV_FORTEZZA 4
+CONSTANT: PROV_MS_MAIL 5
+CONSTANT: PROV_SSL 6
+CONSTANT: PROV_STT_MER 7
+CONSTANT: PROV_STT_ACQ 8
+CONSTANT: PROV_STT_BRND 9
+CONSTANT: PROV_STT_ROOT 10
+CONSTANT: PROV_STT_ISS 11
+CONSTANT: PROV_RSA_SCHANNEL 12
+CONSTANT: PROV_DSS_DH 13
+CONSTANT: PROV_EC_ECDSA_SIG 14
+CONSTANT: PROV_EC_ECNRA_SIG 15
+CONSTANT: PROV_EC_ECDSA_FULL 16
+CONSTANT: PROV_EC_ECNRA_FULL 17
+CONSTANT: PROV_DH_SCHANNEL 18
+CONSTANT: PROV_SPYRUS_LYNKS 20
+CONSTANT: PROV_RNG 21
+CONSTANT: PROV_INTEL_SEC 22
+CONSTANT: PROV_REPLACE_OWF 23
+CONSTANT: PROV_RSA_AES 24
+CONSTANT: MAXUIDLEN 64
+CONSTANT: CUR_BLOB_VERSION 2
+CONSTANT: X509_ASN_ENCODING 1
+CONSTANT: PKCS_7_ASN_ENCODING  65536
+CONSTANT: CERT_V1 0
+CONSTANT: CERT_V2 1
+CONSTANT: CERT_V3 2
+CONSTANT: CERT_E_CHAINING -2146762486
+CONSTANT: CERT_E_CN_NO_MATCH -2146762481
+CONSTANT: CERT_E_EXPIRED -2146762495
+CONSTANT: CERT_E_PURPOSE -2146762490
+CONSTANT: CERT_E_REVOCATION_FAILURE -2146762482
+CONSTANT: CERT_E_REVOKED -2146762484
+CONSTANT: CERT_E_ROLE -2146762493
+CONSTANT: CERT_E_UNTRUSTEDROOT -2146762487
+CONSTANT: CERT_E_UNTRUSTEDTESTROOT -2146762483
+CONSTANT: CERT_E_VALIDITYPERIODNESTING -2146762494
+CONSTANT: CERT_E_WRONG_USAGE -2146762480
+CONSTANT: CERT_E_PATHLENCONST -2146762492
+CONSTANT: CERT_E_CRITICAL -2146762491
+CONSTANT: CERT_E_ISSUERCHAINING -2146762489
+CONSTANT: CERT_E_MALFORMED -2146762488
+CONSTANT: CRYPT_E_REVOCATION_OFFLINE -2146885613
+CONSTANT: CRYPT_E_REVOKED -2146885616
+CONSTANT: TRUST_E_BASIC_CONSTRAINTS -2146869223
+CONSTANT: TRUST_E_CERT_SIGNATURE -2146869244
+CONSTANT: TRUST_E_FAIL -2146762485
+CONSTANT: CERT_TRUST_NO_ERROR 0
+CONSTANT: CERT_TRUST_IS_NOT_TIME_VALID 1
+CONSTANT: CERT_TRUST_IS_NOT_TIME_NESTED 2
+CONSTANT: CERT_TRUST_IS_REVOKED 4
+CONSTANT: CERT_TRUST_IS_NOT_SIGNATURE_VALID 8
+CONSTANT: CERT_TRUST_IS_NOT_VALID_FOR_USAGE 16
+CONSTANT: CERT_TRUST_IS_UNTRUSTED_ROOT 32
+CONSTANT: CERT_TRUST_REVOCATION_STATUS_UNKNOWN 64
+CONSTANT: CERT_TRUST_IS_CYCLIC 128
+CONSTANT: CERT_TRUST_IS_PARTIAL_CHAIN 65536
+CONSTANT: CERT_TRUST_CTL_IS_NOT_TIME_VALID 131072
+CONSTANT: CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID 262144
+CONSTANT: CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE 524288
+CONSTANT: CERT_TRUST_HAS_EXACT_MATCH_ISSUER 1
+CONSTANT: CERT_TRUST_HAS_KEY_MATCH_ISSUER 2
+CONSTANT: CERT_TRUST_HAS_NAME_MATCH_ISSUER 4
+CONSTANT: CERT_TRUST_IS_SELF_SIGNED 8
+CONSTANT: CERT_TRUST_IS_COMPLEX_CHAIN 65536
+CONSTANT: CERT_CHAIN_POLICY_BASE 1
+CONSTANT: CERT_CHAIN_POLICY_AUTHENTICODE 2
+CONSTANT: CERT_CHAIN_POLICY_AUTHENTICODE_TS 3
+CONSTANT: CERT_CHAIN_POLICY_SSL 4
+CONSTANT: CERT_CHAIN_POLICY_BASIC_CONSTRAINTS 5
+CONSTANT: CERT_CHAIN_POLICY_NT_AUTH 6
+CONSTANT: USAGE_MATCH_TYPE_AND 0
+CONSTANT: USAGE_MATCH_TYPE_OR 1
+CONSTANT: CERT_SIMPLE_NAME_STR 1
+CONSTANT: CERT_OID_NAME_STR 2
+CONSTANT: CERT_X500_NAME_STR 3
+CONSTANT: CERT_NAME_STR_SEMICOLON_FLAG 1073741824
+CONSTANT: CERT_NAME_STR_CRLF_FLAG 134217728
+CONSTANT: CERT_NAME_STR_NO_PLUS_FLAG 536870912
+CONSTANT: CERT_NAME_STR_NO_QUOTING_FLAG 268435456
+CONSTANT: CERT_NAME_STR_REVERSE_FLAG 33554432
+CONSTANT: CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG 131072
+CONSTANT: CERT_FIND_ANY 0
+CONSTANT: CERT_FIND_CERT_ID 1048576
+CONSTANT: CERT_FIND_CTL_USAGE 655360
+CONSTANT: CERT_FIND_ENHKEY_USAGE 655360
+CONSTANT: CERT_FIND_EXISTING 851968
+CONSTANT: CERT_FIND_HASH 65536
+CONSTANT: CERT_FIND_ISSUER_ATTR 196612
+CONSTANT: CERT_FIND_ISSUER_NAME 131076
+CONSTANT: CERT_FIND_ISSUER_OF 786432
+CONSTANT: CERT_FIND_KEY_IDENTIFIER 983040
+CONSTANT: CERT_FIND_KEY_SPEC 589824
+CONSTANT: CERT_FIND_MD5_HASH 262144
+CONSTANT: CERT_FIND_PROPERTY 327680
+CONSTANT: CERT_FIND_PUBLIC_KEY 393216
+CONSTANT: CERT_FIND_SHA1_HASH 65536
+CONSTANT: CERT_FIND_SIGNATURE_HASH 917504
+CONSTANT: CERT_FIND_SUBJECT_ATTR 196615
+CONSTANT: CERT_FIND_SUBJECT_CERT 720896
+CONSTANT: CERT_FIND_SUBJECT_NAME 131079
+CONSTANT: CERT_FIND_SUBJECT_STR_A 458759
+CONSTANT: CERT_FIND_SUBJECT_STR_W 524295
+CONSTANT: CERT_FIND_ISSUER_STR_A 458756
+CONSTANT: CERT_FIND_ISSUER_STR_W 524292
+CONSTANT: CERT_FIND_OR_ENHKEY_USAGE_FLAG 16
+CONSTANT: CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG  1
+CONSTANT: CERT_FIND_NO_ENHKEY_USAGE_FLAG  8
+CONSTANT: CERT_FIND_VALID_ENHKEY_USAGE_FLAG  32
+CONSTANT: CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG  2
+CONSTANT: CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG  2
+CONSTANT: CERT_UNICODE_IS_RDN_ATTRS_FLAG 1
+CONSTANT: CERT_CHAIN_FIND_BY_ISSUER 1
+CONSTANT: CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG 1
+CONSTANT: CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG 2
+CONSTANT: CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG 32768
+CONSTANT: CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG 4
+CONSTANT: CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG 8
+CONSTANT: CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG 16384
+CONSTANT: CERT_STORE_PROV_SYSTEM 10
+CONSTANT: CERT_SYSTEM_STORE_LOCAL_MACHINE 131072
+CONSTANT: szOID_PKIX_KP_SERVER_AUTH "4235600"
+CONSTANT: szOID_SERVER_GATED_CRYPTO "4235658"
+CONSTANT: szOID_SGC_NETSCAPE "2.16.840.1.113730.4.1"
+CONSTANT: szOID_PKIX_KP_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
+
+CONSTANT: CRYPT_NOHASHOID HEX: 00000001
+CONSTANT: CRYPT_NO_SALT HEX: 10
+CONSTANT: CRYPT_PREGEN HEX: 40
+CONSTANT: CRYPT_RECIPIENT HEX: 10
+CONSTANT: CRYPT_INITIATOR HEX: 40
+CONSTANT: CRYPT_ONLINE HEX: 80
+CONSTANT: CRYPT_SF HEX: 100
+CONSTANT: CRYPT_CREATE_IV HEX: 200
+CONSTANT: CRYPT_KEK HEX: 400
+CONSTANT: CRYPT_DATA_KEY HEX: 800
+CONSTANT: CRYPT_VOLATILE HEX: 1000
+CONSTANT: CRYPT_SGCKEY HEX: 2000
+
+CONSTANT: KEYSTATEBLOB HEX: C
+CONSTANT: OPAQUEKEYBLOB HEX: 9
+CONSTANT: PLAINTEXTKEYBLOB HEX: 8
+CONSTANT: PRIVATEKEYBLOB HEX: 7
+CONSTANT: PUBLICKEYBLOB HEX: 6
+CONSTANT: PUBLICKEYBLOBEX HEX: A
+CONSTANT: SIMPLEBLOB HEX: 1
+CONSTANT: SYMMETRICWRAPKEYBLOB HEX: B
+
+TYPEDEF: uint ALG_ID
+
+STRUCT: PUBLICKEYSTRUC
+    { bType BYTE }
+    { bVersion BYTE }
+    { reserved WORD }
+    { aiKeyAlg ALG_ID } ;
+
+TYPEDEF: PUBLICKEYSTRUC BLOBHEADER
+TYPEDEF: LONG HCRYPTHASH
+TYPEDEF: LONG HCRYPTKEY
 TYPEDEF: DWORD REGSAM
 
 ! : I_ScGetCurrentGroupStateW ;
@@ -590,7 +859,7 @@ FUNCTION: BOOL CryptAcquireContextW ( HCRYPTPROV* phProv,
 ALIAS: CryptAcquireContext CryptAcquireContextW
 
 ! : CryptContextAddRef ;
-! : CryptCreateHash ;
+FUNCTION: BOOL CryptCreateHash ( HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, HCRYPTHASH *pHash ) ;
 ! : CryptDecrypt ;
 ! : CryptDeriveKey ;
 ! : CryptDestroyHash ;
@@ -613,7 +882,7 @@ FUNCTION: BOOL CryptGenRandom ( HCRYPTPROV hProv, DWORD dwLen, BYTE* pbBuffer )
 ! : CryptGetUserKey ;
 ! : CryptHashData ;
 ! : CryptHashSessionKey ;
-! : CryptImportKey ;
+FUNCTION: BOOL CryptImportKey ( HCRYPTPROV hProv, BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey ) ;
 FUNCTION: BOOL CryptReleaseContext ( HCRYPTPROV hProv, DWORD dwFlags ) ;
 ! : CryptSetHashParam ;
 ! : CryptSetKeyParam ;
index ff6a9ad4fcb4eeaeca9c7a429f230227bd07b961..614a535ea0ce747eea02c17fd2e9b4414e74c659 100644 (file)
@@ -1,14 +1,14 @@
 USING: alien sequences alien.libraries ;
 {
-    { "advapi32" "\\windows\\coredll.dll" "stdcall" }
-    { "gdi32"    "\\windows\\coredll.dll" "stdcall" }
-    { "user32"   "\\windows\\coredll.dll" "stdcall" }
-    { "kernel32" "\\windows\\coredll.dll" "stdcall" }
-    { "winsock"  "\\windows\\ws2.dll" "stdcall" }
-    { "mswsock"  "\\windows\\ws2.dll" "stdcall" }
-    { "libc"     "\\windows\\coredll.dll" "stdcall"   }
-    { "libm"     "\\windows\\coredll.dll" "stdcall"   }
-    ! { "gl"       "libGLES_CM.dll"         "stdcall" }
-    ! { "glu"      "libGLES_CM.dll"         "stdcall" }
-    { "ole32"    "ole32.dll"    "stdcall" }
+    { "advapi32" "\\windows\\coredll.dll" stdcall }
+    { "gdi32"    "\\windows\\coredll.dll" stdcall }
+    { "user32"   "\\windows\\coredll.dll" stdcall }
+    { "kernel32" "\\windows\\coredll.dll" stdcall }
+    { "winsock"  "\\windows\\ws2.dll" stdcall }
+    { "mswsock"  "\\windows\\ws2.dll" stdcall }
+    { "libc"     "\\windows\\coredll.dll" stdcall   }
+    { "libm"     "\\windows\\coredll.dll" stdcall   }
+    ! { "gl"       "libGLES_CM.dll"         stdcall }
+    ! { "glu"      "libGLES_CM.dll"         stdcall }
+    { "ole32"    "ole32.dll"    stdcall }
 } [ first3 add-library ] each
index f0b4eadb9f545cad974f32ea8a2a6112e1782404..fdc48adfbe5fc8fb2ea9fae2a9e5c8a0affa56ec 100644 (file)
@@ -16,6 +16,9 @@ COM-INTERFACE: IUnrelated IUnknown {b06ac3f4-30e4-406b-a7cd-c29cead4552c}
     int xPlus ( int y )
     int xMulAdd ( int mul, int add ) ;
 
+COM-INTERFACE: ISelfReferential IUnknown {d4f45bf8-f720-4701-a09d-e8e341981121}
+    ISelfReferential* selfReference ( ) ;
+
 { GUID: {216fb341-0eb2-44b1-8edb-60b76e353abc} } [ ISimple-iid ] unit-test
 { GUID: {9620ecec-8438-423b-bb14-86f835aa40dd} } [ IInherited-iid ] unit-test
 { GUID: {00000000-0000-0000-C000-000000000046} } [ IUnknown-iid ] unit-test
index 33164f52c4123784765a258b70a5a5bc4c89032f..094859009d75737f2238cb026b30767957fd3125 100644 (file)
@@ -11,6 +11,8 @@ COM-INTERFACE: IUnknown f {00000000-0000-0000-C000-000000000046}
     ULONG Release ( ) ;
 
 C-TYPE: IAdviseSink
+C-TYPE: IEnumFORMATETC
+C-TYPE: IEnumSTATDATA
 
 COM-INTERFACE: IDataObject IUnknown {0000010E-0000-0000-C000-000000000046}
     HRESULT GetData ( FORMATETC* pFormatetc, STGMEDIUM* pmedium )
index 7e93a6e9f8e3c8b8beb8523e0da0b08de0844ec4..dc6a0604fbc0341425d23550a98bf07f5a2496d9 100644 (file)
@@ -2,7 +2,8 @@ USING: alien alien.c-types alien.accessors alien.parser
 effects kernel windows.ole32 parser lexer splitting grouping
 sequences namespaces assocs quotations generalizations
 accessors words macros alien.syntax fry arrays layouts math
-classes.struct windows.kernel32 ;
+classes.struct windows.kernel32 locals ;
+FROM: alien.parser.private => parse-pointers return-type-name ;
 IN: windows.com.syntax
 
 <PRIVATE
@@ -11,13 +12,13 @@ MACRO: com-invoke ( n return parameters -- )
     [ 2nip length ] 3keep
     '[
         _ npick *void* _ cell * alien-cell _ _
-        "stdcall" alien-indirect
+        stdcall alien-indirect
     ] ;
 
 TUPLE: com-interface-definition word parent iid functions ;
 C: <com-interface-definition> com-interface-definition
 
-TUPLE: com-function-definition name return parameters ;
+TUPLE: com-function-definition return name parameter-types parameter-names ;
 C: <com-function-definition> com-function-definition
 
 SYMBOL: +com-interface-definitions+
@@ -36,19 +37,20 @@ ERROR: no-com-interface interface ;
 : save-com-interface-definition ( definition -- )
     dup word>> +com-interface-definitions+ get-global set-at ;
 
-: (parse-com-function) ( tokens -- definition )
-    [ second ]
-    [ first parse-c-type ]
-    [
-        3 tail [ CHAR: , swap remove ] map
-        2 group [ first2 normalize-c-arg 2array ] map
-        { void* "this" } prefix
-    ] tri
+: (parse-com-function) ( return name -- definition )
+    ")" scan-c-args
+    [ pointer: void prefix ] [ "this" prefix ] bi*
     <com-function-definition> ;
 
+:: (parse-com-functions) ( functions -- )
+    scan dup ";" = [ drop ] [
+        parse-c-type scan parse-pointers
+        (parse-com-function) functions push
+        functions (parse-com-functions)
+    ] if ;
+
 : parse-com-functions ( -- functions )
-    ";" parse-tokens { ")" } split harvest
-    [ (parse-com-function) ] map ;
+    V{ } clone [ (parse-com-functions) ] keep >array ;
 
 : (iid-word) ( definition -- word )
     word>> name>> "-iid" append create-in ;
@@ -65,35 +67,24 @@ ERROR: no-com-interface interface ;
     dup parent>> [ family-tree-functions ] [ { } ] if*
     swap functions>> append ;
 
-: (invocation-quot) ( function return parameters -- quot )
-    [ first ] map [ com-invoke ] 3curry ;
-
-: (stack-effect-from-return-and-parameters) ( return parameters -- stack-effect )
-    swap
-    [ [ second ] map ]
-    [ dup void? [ drop { } ] [ name>> 1array ] if ] bi*
-    <effect> ;
-
-: (define-word-for-function) ( function interface n -- )
-    -rot [ (function-word) swap ] 2keep drop
-    [ return>> ] [ parameters>> ] bi
-    [ (invocation-quot) ] 2keep
-    (stack-effect-from-return-and-parameters)
+:: (define-word-for-function) ( function interface n -- )
+    function interface (function-word)
+    n function [ return>> ] [ parameter-types>> ] bi '[ _ _ _ com-invoke ]
+    function [ parameter-names>> ] [ return>> ] bi function-effect
     define-declared ;
 
 : define-words-for-com-interface ( definition -- )
     [ [ (iid-word) ] [ iid>> 1quotation ] bi (( -- iid )) define-declared ]
-    [ word>> void* swap typedef ]
     [
         dup family-tree-functions
         [ (define-word-for-function) ] with each-index
-    ]
-    tri ;
+    ] bi ;
 
 PRIVATE>
 
 SYNTAX: COM-INTERFACE:
     CREATE-C-TYPE
+    void* over typedef
     scan-object find-com-interface-definition
     scan string>guid
     parse-com-functions
@@ -103,8 +94,6 @@ SYNTAX: COM-INTERFACE:
 
 SYNTAX: GUID: scan string>guid suffix! ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [
-    "windows.com.prettyprint" require
-] when
+{ "windows.com" "prettyprint" } "windows.com.prettyprint" require-when
index 696902439ca7f9d075d29c6f5732594ad0cb37fc..20de2a9e4e3d9149060b1e037caf4a6414217340 100644 (file)
@@ -49,8 +49,7 @@ unless
 : (make-query-interface) ( interfaces -- quot )
     (query-interface-cases) 
     '[
-        swap GUID memory>struct
-        _ case
+        swap _ case
         [
             void* heap-size * rot <displaced-alien> com-add-ref
             swap 0 set-alien-cell S_OK
@@ -111,19 +110,15 @@ unless
     keep (next-vtbl-counter) '[
         swap [
             [ name>> _ _ (callback-word) ]
-            [ return>> ] [
-                parameters>>
-                [ [ first ] map ]
-                [ length ] bi
-            ] tri
+            [ return>> ] [ parameter-types>> dup length ] tri
         ] [
             first2 (finish-thunk)
         ] bi*
-        "stdcall" swap compile-alien-callback
+        stdcall swap compile-alien-callback
     ] 2map ;
 
 : (make-callbacks) ( implementations -- sequence )
-    dup [ first ] map (make-iunknown-methods)
+    dup keys (make-iunknown-methods)
     [ [ first2 ] 2dip swap (make-interface-callbacks) ]
     curry map-index ;
 
old mode 100644 (file)
new mode 100755 (executable)
index 9c8a55e..957ff86
@@ -1,10 +1,10 @@
 ! Copyright (C) 2010 Erik Charlebois.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.libraries alien.syntax classes.struct
-kernel math windows.types windows.ole32 ;
+USING: alien alien.c-types alien.libraries alien.syntax
+classes.struct kernel math windows.types windows.ole32 ;
 IN: windows.ddk.hid
 
-<< "hid" "hid.dll" "stdcall" add-library >>
+<< "hid" "hid.dll" stdcall add-library >>
 LIBRARY: hid
 
 TYPEDEF: LONG   NTSTATUS
@@ -206,11 +206,10 @@ CONSTANT: HID_USAGE_DIGITIZER_BARREL_SWITCH HEX: 44
 CONSTANT: HIDP_LINK_COLLECTION_ROOT        -1
 CONSTANT: HIDP_LINK_COLLECTION_UNSPECIFIED 0
 
-C-ENUM:
+ENUM: HIDP_REPORT_TYPE
     HidP_Input
     HidP_Output
     HidP_Feature ;
-TYPEDEF: int HIDP_REPORT_TYPE
 
 STRUCT: USAGE_AND_PAGE
     { Usage     USAGE }
@@ -608,10 +607,9 @@ HidP_UsageAndPageListDifference (
    ULONG           UsageListLength
    ) ;
 
-C-ENUM:
+ENUM: HIDP_KEYBOARD_DIRECTION
     HidP_Keyboard_Break
     HidP_Keyboard_Make ;
-TYPEDEF: int HIDP_KEYBOARD_DIRECTION
 
 STRUCT: HIDP_KEYBOARD_MODIFIER_STATE
     { ul ULONG } ;
diff --git a/basis/windows/ddk/hid/summary.txt b/basis/windows/ddk/hid/summary.txt
new file mode 100644 (file)
index 0000000..71ad299
--- /dev/null
@@ -0,0 +1 @@
+Bindings to the HID section of the Windows DDK
\ No newline at end of file
diff --git a/basis/windows/ddk/hid/tags.txt b/basis/windows/ddk/hid/tags.txt
new file mode 100644 (file)
index 0000000..024277a
--- /dev/null
@@ -0,0 +1 @@
+bindings\r
diff --git a/basis/windows/ddk/setupapi/authors.txt b/basis/windows/ddk/setupapi/authors.txt
new file mode 100644 (file)
index 0000000..f596342
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois\r
diff --git a/basis/windows/ddk/setupapi/platforms.txt b/basis/windows/ddk/setupapi/platforms.txt
new file mode 100644 (file)
index 0000000..d2e9c5b
--- /dev/null
@@ -0,0 +1 @@
+winnt\r
diff --git a/basis/windows/ddk/setupapi/setupapi.factor b/basis/windows/ddk/setupapi/setupapi.factor
new file mode 100755 (executable)
index 0000000..7af177b
--- /dev/null
@@ -0,0 +1,2033 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: literals windows.kernel32 math alien.syntax windows.types
+classes.struct alien alien.c-types windows.errors windows.ole32
+windows.advapi32 alien.libraries ;
+IN: windows.ddk.setupapi
+
+<< "setupapi" "setupapi.dll" stdcall add-library >>
+LIBRARY: setupapi
+
+TYPEDEF: DWORDLONG SP_LOG_TOKEN
+TYPEDEF: DWORDLONG* PSP_LOG_TOKEN
+
+CONSTANT: LOGTOKEN_TYPE_MASK              3
+CONSTANT: LOGTOKEN_UNSPECIFIED            0
+CONSTANT: LOGTOKEN_NO_LOG                 1
+CONSTANT: LOGTOKEN_SETUPAPI_APPLOG        2
+CONSTANT: LOGTOKEN_SETUPAPI_DEVLOG        3
+
+CONSTANT: TXTLOG_SETUPAPI_DEVLOG      HEX: 00000001
+CONSTANT: TXTLOG_SETUPAPI_CMDLINE     HEX: 00000002
+CONSTANT: TXTLOG_SETUPAPI_BITS        HEX: 00000003
+
+CONSTANT: TXTLOG_ERROR                    HEX: 1
+CONSTANT: TXTLOG_WARNING                  HEX: 2
+CONSTANT: TXTLOG_SYSTEM_STATE_CHANGE      HEX: 3
+CONSTANT: TXTLOG_SUMMARY                  HEX: 4
+CONSTANT: TXTLOG_DETAILS                  HEX: 5
+CONSTANT: TXTLOG_VERBOSE                  HEX: 6
+CONSTANT: TXTLOG_VERY_VERBOSE             HEX: 7
+
+CONSTANT: TXTLOG_RESERVED_FLAGS   HEX: 0000FFF0
+
+CONSTANT: TXTLOG_TIMESTAMP        HEX: 00010000
+CONSTANT: TXTLOG_DEPTH_INCR       HEX: 00020000
+CONSTANT: TXTLOG_DEPTH_DECR       HEX: 00040000
+CONSTANT: TXTLOG_TAB_1            HEX: 00080000
+CONSTANT: TXTLOG_FLUSH_FILE       HEX: 00100000
+
+: TXTLOG_LEVEL ( flags -- n ) HEX: f bitand ; inline
+
+CONSTANT: TXTLOG_DEVINST          HEX: 00000001
+CONSTANT: TXTLOG_INF              HEX: 00000002
+CONSTANT: TXTLOG_FILEQ            HEX: 00000004
+CONSTANT: TXTLOG_COPYFILES        HEX: 00000008
+CONSTANT: TXTLOG_SIGVERIF         HEX: 00000020
+CONSTANT: TXTLOG_BACKUP           HEX: 00000080
+CONSTANT: TXTLOG_UI               HEX: 00000100
+CONSTANT: TXTLOG_UTIL             HEX: 00000200
+CONSTANT: TXTLOG_INFDB            HEX: 00000400
+CONSTANT: TXTLOG_POLICY           HEX: 00800000
+CONSTANT: TXTLOG_NEWDEV           HEX: 01000000
+CONSTANT: TXTLOG_UMPNPMGR         HEX: 02000000
+CONSTANT: TXTLOG_DRIVER_STORE     HEX: 04000000
+CONSTANT: TXTLOG_SETUP            HEX: 08000000
+CONSTANT: TXTLOG_CMI              HEX: 10000000
+CONSTANT: TXTLOG_DEVMGR           HEX: 20000000
+CONSTANT: TXTLOG_INSTALLER        HEX: 40000000
+CONSTANT: TXTLOG_VENDOR           HEX: 80000000
+
+TYPEDEF: void* HPROPSHEETPAGE
+TYPEDEF: void* HIMAGELIST
+C-TYPE: DEVPROPKEY
+TYPEDEF: ULONG DEVPROPTYPE
+TYPEDEF: DEVPROPTYPE* PDEVPROPTYPE
+TYPEDEF: void* LPPROPSHEETHEADERA
+TYPEDEF: void* LPPROPSHEETHEADERW
+
+CONSTANT: LINE_LEN                     256
+CONSTANT: LINE_LEN*2                   512
+CONSTANT: MAX_INF_STRING_LENGTH        4096
+CONSTANT: MAX_INF_SECTION_NAME_LENGTH  255
+CONSTANT: MAX_TITLE_LEN                60
+CONSTANT: MAX_INSTRUCTION_LEN          256
+CONSTANT: MAX_LABEL_LEN                30
+CONSTANT: MAX_SERVICE_NAME_LEN         256
+CONSTANT: MAX_SUBTITLE_LEN             256
+CONSTANT: SP_MAX_MACHINENAME_LENGTH    $[ MAX_PATH 3 + ]
+
+TYPEDEF: PVOID HINF
+
+STRUCT: INFCONTEXT
+    { Inf        PVOID }
+    { CurrentInf PVOID }
+    { Section    UINT  }
+    { Line       UINT  } ;
+TYPEDEF: INFCONTEXT* PINFCONTEXT
+
+STRUCT: SP_INF_INFORMATION
+    { InfStyle   DWORD               }
+    { InfCount   DWORD               }
+    { VersionDat BYTE[ANYSIZE_ARRAY] } ;
+TYPEDEF: SP_INF_INFORMATION* PSP_INF_INFORMATION
+
+STRUCT: SP_ALTPLATFORM_INFO_V2
+    { cbSize                     DWORD }
+    { Platform                   DWORD }
+    { MajorVersion               DWORD }
+    { MinorVersion               DWORD }
+    { ProcessorArchitecture      WORD  }
+    { Flags                      WORD  }
+    { FirstValidatedMajorVersion DWORD }
+    { FirstValidatedMinorVersion DWORD } ;
+TYPEDEF: SP_ALTPLATFORM_INFO_V2* PSP_ALTPLATFORM_INFO_V2
+
+STRUCT: SP_ALTPLATFORM_INFO_V1
+    { cbSize                 DWORD }
+    { Platform               DWORD }
+    { MajorVersion           DWORD }
+    { MinorVersion           DWORD }
+    { ProcessorArchitecture  WORD  }
+    { Reserved               WORD  } ;
+TYPEDEF: SP_ALTPLATFORM_INFO_V1* PSP_ALTPLATFORM_INFO_V1
+TYPEDEF: SP_ALTPLATFORM_INFO_V2 SP_ALTPLATFORM_INFO
+TYPEDEF: PSP_ALTPLATFORM_INFO_V2 PSP_ALTPLATFORM_INFO
+
+CONSTANT: SP_ALTPLATFORM_FLAGS_VERSION_RANGE 1
+
+STRUCT: SP_ORIGINAL_FILE_INFO_A
+    { cbSize              DWORD          }
+    { OriginalInfName     CHAR[MAX_PATH] }
+    { OriginalCatalogName CHAR[MAX_PATH] } ;
+TYPEDEF: SP_ORIGINAL_FILE_INFO_A* PSP_ORIGINAL_FILE_INFO_A
+STRUCT: SP_ORIGINAL_FILE_INFO_W
+    { cbSize              DWORD           }
+    { OriginalInfName     WCHAR[MAX_PATH] }
+    { OriginalCatalogName WCHAR[MAX_PATH] } ;
+TYPEDEF: SP_ORIGINAL_FILE_INFO_W* PSP_ORIGINAL_FILE_INFO_W
+TYPEDEF: SP_ORIGINAL_FILE_INFO_W SP_ORIGINAL_FILE_INFO
+TYPEDEF: PSP_ORIGINAL_FILE_INFO_W PSP_ORIGINAL_FILE_INFO
+
+CONSTANT: INF_STYLE_NONE           HEX: 00000000
+CONSTANT: INF_STYLE_OLDNT          HEX: 00000001
+CONSTANT: INF_STYLE_WIN4           HEX: 00000002
+CONSTANT: INF_STYLE_CACHE_ENABLE   HEX: 00000010
+CONSTANT: INF_STYLE_CACHE_DISABLE  HEX: 00000020
+CONSTANT: INF_STYLE_CACHE_IGNORE   HEX: 00000040
+CONSTANT: DIRID_ABSOLUTE          -1
+CONSTANT: DIRID_ABSOLUTE_16BIT     HEX: ffff
+CONSTANT: DIRID_NULL               0
+CONSTANT: DIRID_SRCPATH            1
+CONSTANT: DIRID_WINDOWS           10
+CONSTANT: DIRID_SYSTEM            11
+CONSTANT: DIRID_DRIVERS           12
+CONSTANT: DIRID_IOSUBSYS          $ DIRID_DRIVERS
+CONSTANT: DIRID_INF               17
+CONSTANT: DIRID_HELP              18
+CONSTANT: DIRID_FONTS             20
+CONSTANT: DIRID_VIEWERS           21
+CONSTANT: DIRID_COLOR             23
+CONSTANT: DIRID_APPS              24
+CONSTANT: DIRID_SHARED            25
+CONSTANT: DIRID_BOOT              30
+CONSTANT: DIRID_SYSTEM16          50
+CONSTANT: DIRID_SPOOL             51
+CONSTANT: DIRID_SPOOLDRIVERS      52
+CONSTANT: DIRID_USERPROFILE       53
+CONSTANT: DIRID_LOADER            54
+CONSTANT: DIRID_PRINTPROCESSOR    55
+CONSTANT: DIRID_DEFAULT           $ DIRID_SYSTEM
+CONSTANT: DIRID_COMMON_STARTMENU        16406
+CONSTANT: DIRID_COMMON_PROGRAMS         16407
+CONSTANT: DIRID_COMMON_STARTUP          16408
+CONSTANT: DIRID_COMMON_DESKTOPDIRECTORY 16409
+CONSTANT: DIRID_COMMON_FAVORITES        16415
+CONSTANT: DIRID_COMMON_APPDATA          16419
+CONSTANT: DIRID_PROGRAM_FILES           16422
+CONSTANT: DIRID_SYSTEM_X86              16425
+CONSTANT: DIRID_PROGRAM_FILES_X86       16426
+CONSTANT: DIRID_PROGRAM_FILES_COMMON    16427
+CONSTANT: DIRID_PROGRAM_FILES_COMMONX86 16428
+CONSTANT: DIRID_COMMON_TEMPLATES        16429
+CONSTANT: DIRID_COMMON_DOCUMENTS        16430
+CONSTANT: DIRID_USER              HEX: 8000
+CALLBACK: UINT PSP_FILE_CALLBACK_A ( PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2 ) ;
+CALLBACK: UINT PSP_FILE_CALLBACK_W ( PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2 ) ;
+TYPEDEF: PSP_FILE_CALLBACK_W PSP_FILE_CALLBACK
+CONSTANT: SPFILENOTIFY_STARTQUEUE         HEX: 00000001
+CONSTANT: SPFILENOTIFY_ENDQUEUE           HEX: 00000002
+CONSTANT: SPFILENOTIFY_STARTSUBQUEUE      HEX: 00000003
+CONSTANT: SPFILENOTIFY_ENDSUBQUEUE        HEX: 00000004
+CONSTANT: SPFILENOTIFY_STARTDELETE        HEX: 00000005
+CONSTANT: SPFILENOTIFY_ENDDELETE          HEX: 00000006
+CONSTANT: SPFILENOTIFY_DELETEERROR        HEX: 00000007
+CONSTANT: SPFILENOTIFY_STARTRENAME        HEX: 00000008
+CONSTANT: SPFILENOTIFY_ENDRENAME          HEX: 00000009
+CONSTANT: SPFILENOTIFY_RENAMEERROR        HEX: 0000000a
+CONSTANT: SPFILENOTIFY_STARTCOPY          HEX: 0000000b
+CONSTANT: SPFILENOTIFY_ENDCOPY            HEX: 0000000c
+CONSTANT: SPFILENOTIFY_COPYERROR          HEX: 0000000d
+CONSTANT: SPFILENOTIFY_NEEDMEDIA          HEX: 0000000e
+CONSTANT: SPFILENOTIFY_QUEUESCAN          HEX: 0000000f
+CONSTANT: SPFILENOTIFY_CABINETINFO        HEX: 00000010
+CONSTANT: SPFILENOTIFY_FILEINCABINET      HEX: 00000011
+CONSTANT: SPFILENOTIFY_NEEDNEWCABINET     HEX: 00000012
+CONSTANT: SPFILENOTIFY_FILEEXTRACTED      HEX: 00000013
+CONSTANT: SPFILENOTIFY_FILEOPDELAYED      HEX: 00000014
+CONSTANT: SPFILENOTIFY_STARTBACKUP        HEX: 00000015
+CONSTANT: SPFILENOTIFY_BACKUPERROR        HEX: 00000016
+CONSTANT: SPFILENOTIFY_ENDBACKUP          HEX: 00000017
+CONSTANT: SPFILENOTIFY_QUEUESCAN_EX       HEX: 00000018
+CONSTANT: SPFILENOTIFY_STARTREGISTRATION  HEX: 00000019
+CONSTANT: SPFILENOTIFY_ENDREGISTRATION    HEX: 00000020
+CONSTANT: SPFILENOTIFY_QUEUESCAN_SIGNERINFO HEX: 00000040
+CONSTANT: SPFILENOTIFY_LANGMISMATCH       HEX: 00010000
+CONSTANT: SPFILENOTIFY_TARGETEXISTS       HEX: 00020000
+CONSTANT: SPFILENOTIFY_TARGETNEWER        HEX: 00040000
+CONSTANT: FILEOP_COPY                     0
+CONSTANT: FILEOP_RENAME                   1
+CONSTANT: FILEOP_DELETE                   2
+CONSTANT: FILEOP_BACKUP                   3
+CONSTANT: FILEOP_ABORT                    0
+CONSTANT: FILEOP_DOIT                     1
+CONSTANT: FILEOP_SKIP                     2
+CONSTANT: FILEOP_RETRY                    $ FILEOP_DOIT
+CONSTANT: FILEOP_NEWPATH                  4
+CONSTANT: COPYFLG_WARN_IF_SKIP            HEX: 00000001
+CONSTANT: COPYFLG_NOSKIP                  HEX: 00000002
+CONSTANT: COPYFLG_NOVERSIONCHECK          HEX: 00000004
+CONSTANT: COPYFLG_FORCE_FILE_IN_USE       HEX: 00000008
+CONSTANT: COPYFLG_NO_OVERWRITE            HEX: 00000010
+CONSTANT: COPYFLG_NO_VERSION_DIALOG       HEX: 00000020
+CONSTANT: COPYFLG_OVERWRITE_OLDER_ONLY    HEX: 00000040
+CONSTANT: COPYFLG_PROTECTED_WINDOWS_DRIVER_FILE HEX: 00000100
+CONSTANT: COPYFLG_REPLACEONLY             HEX: 00000400
+CONSTANT: COPYFLG_NODECOMP                HEX: 00000800
+CONSTANT: COPYFLG_REPLACE_BOOT_FILE       HEX: 00001000
+CONSTANT: COPYFLG_NOPRUNE                 HEX: 00002000
+CONSTANT: COPYFLG_IN_USE_TRY_RENAME       HEX: 00004000
+CONSTANT: DELFLG_IN_USE                   HEX: 00000001
+CONSTANT: DELFLG_IN_USE1                  HEX: 00010000
+STRUCT: FILEPATHS_A
+    { Target       PCSTR }
+    { Source       PCSTR }
+    { Win32Error   UINT  }
+    { Flags        DWORD } ;
+TYPEDEF: FILEPATHS_A* PFILEPATHS_A
+STRUCT: FILEPATHS_W
+    { Target       PCWSTR }
+    { Source       PCWSTR }
+    { Win32Error   UINT   }
+    { Flags        DWORD  } ;
+TYPEDEF: FILEPATHS_W* PFILEPATHS_W
+TYPEDEF: FILEPATHS_W FILEPATHS
+TYPEDEF: PFILEPATHS_W PFILEPATHS
+STRUCT: FILEPATHS_SIGNERINFO_A
+    { Target         PCSTR }
+    { Source         PCSTR }
+    { Win32Error     UINT  }
+    { Flags          DWORD }
+    { DigitalSigner  PCSTR }
+    { Version        PCSTR }
+    { CatalogFile    PCSTR } ;
+TYPEDEF: FILEPATHS_SIGNERINFO_A* PFILEPATHS_SIGNERINFO_A
+STRUCT: FILEPATHS_SIGNERINFO_W
+    { Target        PCWSTR }
+    { Source        PCWSTR }
+    { Win32Error    UINT   }
+    { Flags         DWORD  }
+    { DigitalSigner PCWSTR }
+    { Version       PCWSTR }
+    { CatalogFile   PCWSTR } ;
+TYPEDEF: FILEPATHS_SIGNERINFO_W* PFILEPATHS_SIGNERINFO_W
+TYPEDEF: FILEPATHS_SIGNERINFO_W FILEPATHS_SIGNERINFO
+TYPEDEF: PFILEPATHS_SIGNERINFO_W PFILEPATHS_SIGNERINFO
+
+STRUCT: SOURCE_MEDIA_A
+    { Reserved    PCSTR }
+    { Tagfile     PCSTR }
+    { Description PCSTR }
+    { SourcePath  PCSTR }
+    { SourceFile  PCSTR }
+    { Flags       DWORD } ;
+TYPEDEF: SOURCE_MEDIA_A* PSOURCE_MEDIA_A
+STRUCT: SOURCE_MEDIA_W
+    { Reserved    PCWSTR }
+    { Tagfile     PCWSTR }
+    { Description PCWSTR }
+    { SourcePath  PCWSTR }
+    { SourceFile  PCWSTR }
+    { Flags       DWORD  } ;
+TYPEDEF: SOURCE_MEDIA_W* PSOURCE_MEDIA_W
+TYPEDEF: SOURCE_MEDIA_W SOURCE_MEDIA
+TYPEDEF: PSOURCE_MEDIA_W PSOURCE_MEDIA
+
+STRUCT: CABINET_INFO_A
+    { CabinetPath   PCSTR  }
+    { CabinetFile   PCSTR  }
+    { DiskName      PCSTR  }
+    { SetId         USHORT }
+    { CabinetNumber USHORT } ;
+TYPEDEF: CABINET_INFO_A* PCABINET_INFO_A
+STRUCT: CABINET_INFO_W
+    { CabinetPath   PCWSTR }
+    { CabinetFile   PCWSTR }
+    { DiskName      PCWSTR }
+    { SetId         USHORT }
+    { CabinetNumber USHORT } ;
+TYPEDEF: CABINET_INFO_W* PCABINET_INFO_W
+TYPEDEF: CABINET_INFO_W CABINET_INFO
+TYPEDEF: PCABINET_INFO_W PCABINET_INFO
+
+STRUCT: FILE_IN_CABINET_INFO_A
+    { NameInCabinet   PCSTR          }
+    { FileSize        DWORD          }
+    { Win32Error      DWORD          }
+    { DosDate         WORD           }
+    { DosTime         WORD           }
+    { DosAttribs      WORD           }
+    { FullTargetName  CHAR[MAX_PATH] } ;
+TYPEDEF: FILE_IN_CABINET_INFO_A* PFILE_IN_CABINET_INFO_A
+STRUCT: FILE_IN_CABINET_INFO_W
+    { NameInCabinet   PCWSTR          }
+    { FileSize        DWORD           }
+    { Win32Error      DWORD           }
+    { DosDate         WORD            }
+    { DosTime         WORD            }
+    { DosAttribs      WORD            }
+    { FullTargetName  WCHAR[MAX_PATH] } ;
+TYPEDEF: FILE_IN_CABINET_INFO_W* PFILE_IN_CABINET_INFO_W
+TYPEDEF: FILE_IN_CABINET_INFO_W FILE_IN_CABINET_INFO
+TYPEDEF: PFILE_IN_CABINET_INFO_W PFILE_IN_CABINET_INFO
+
+STRUCT: SP_REGISTER_CONTROL_STATUSA
+    { cbSize         DWORD }
+    { FileName       PCSTR }
+    { Win32Error     DWORD }
+    { FailureCode    DWORD } ;
+TYPEDEF: SP_REGISTER_CONTROL_STATUSA* PSP_REGISTER_CONTROL_STATUSA
+STRUCT: SP_REGISTER_CONTROL_STATUSW
+    { cbSize         DWORD  }
+    { FileName       PCWSTR }
+    { Win32Error     DWORD  }
+    { FailureCode    DWORD  } ;
+TYPEDEF: SP_REGISTER_CONTROL_STATUSW* PSP_REGISTER_CONTROL_STATUSW
+
+TYPEDEF: SP_REGISTER_CONTROL_STATUSW SP_REGISTER_CONTROL_STATUS
+TYPEDEF: PSP_REGISTER_CONTROL_STATUSW PSP_REGISTER_CONTROL_STATUS
+
+CONSTANT: SPREG_SUCCESS       HEX: 00000000
+CONSTANT: SPREG_LOADLIBRARY   HEX: 00000001
+CONSTANT: SPREG_GETPROCADDR   HEX: 00000002
+CONSTANT: SPREG_REGSVR        HEX: 00000003
+CONSTANT: SPREG_DLLINSTALL    HEX: 00000004
+CONSTANT: SPREG_TIMEOUT       HEX: 00000005
+CONSTANT: SPREG_UNKNOWN       HEX: FFFFFFFF
+
+TYPEDEF: PVOID HSPFILEQ
+
+STRUCT: SP_FILE_COPY_PARAMS_A
+    { cbSize                DWORD    }
+    { QueueHandle           HSPFILEQ }
+    { SourceRootPath        PCSTR    }
+    { SourcePath            PCSTR    }
+    { SourceFilename        PCSTR    }
+    { SourceDescription     PCSTR    }
+    { SourceTagfile         PCSTR    }
+    { TargetDirectory       PCSTR    }
+    { TargetFilename        PCSTR    }
+    { CopyStyle             DWORD    }
+    { LayoutInf             HINF     }
+    { SecurityDescriptor    PCSTR    } ;
+TYPEDEF: SP_FILE_COPY_PARAMS_A* PSP_FILE_COPY_PARAMS_A
+STRUCT: SP_FILE_COPY_PARAMS_W
+    { cbSize               DWORD    }
+    { QueueHandle          HSPFILEQ }
+    { SourceRootPath       PCWSTR   }
+    { SourcePath           PCWSTR   }
+    { SourceFilename       PCWSTR   }
+    { SourceDescription    PCWSTR   }
+    { SourceTagfile        PCWSTR   }
+    { TargetDirectory      PCWSTR   }
+    { TargetFilename       PCWSTR   }
+    { CopyStyle            DWORD    }
+    { LayoutInf            HINF     }
+    { SecurityDescriptor   PCWSTR   } ;
+TYPEDEF: SP_FILE_COPY_PARAMS_W* PSP_FILE_COPY_PARAMS_W
+
+TYPEDEF: SP_FILE_COPY_PARAMS_W SP_FILE_COPY_PARAMS
+TYPEDEF: PSP_FILE_COPY_PARAMS_W PSP_FILE_COPY_PARAMS
+
+TYPEDEF: PVOID HDSKSPC
+TYPEDEF: PVOID HDEVINFO
+
+STRUCT: SP_DEVINFO_DATA
+    { cbSize     DWORD     }
+    { ClassGuid  GUID      }
+    { DevInst    DWORD     }
+    { Reserved   ULONG_PTR } ;
+TYPEDEF: SP_DEVINFO_DATA* PSP_DEVINFO_DATA
+STRUCT: SP_DEVICE_INTERFACE_DATA
+    { cbSize              DWORD     }
+    { InterfaceClassGuid  GUID      }
+    { Flags               DWORD     }
+    { Reserved            ULONG_PTR } ;
+TYPEDEF: SP_DEVICE_INTERFACE_DATA* PSP_DEVICE_INTERFACE_DATA
+
+CONSTANT: SPINT_ACTIVE  HEX: 00000001
+CONSTANT: SPINT_DEFAULT HEX: 00000002
+CONSTANT: SPINT_REMOVED HEX: 00000004
+TYPEDEF: SP_DEVICE_INTERFACE_DATA  SP_INTERFACE_DEVICE_DATA
+TYPEDEF: PSP_DEVICE_INTERFACE_DATA PSP_INTERFACE_DEVICE_DAT
+CONSTANT: SPID_ACTIVE               $ SPINT_ACTIVE
+CONSTANT: SPID_DEFAULT              $ SPINT_DEFAULT
+CONSTANT: SPID_REMOVED              $ SPINT_REMOVED
+
+STRUCT: SP_DEVICE_INTERFACE_DETAIL_DATA_A
+    { cbSize     DWORD               }
+    { DevicePath CHAR[ANYSIZE_ARRAY] } ;
+TYPEDEF: SP_DEVICE_INTERFACE_DETAIL_DATA_A* PSP_DEVICE_INTERFACE_DETAIL_DATA_A
+STRUCT: SP_DEVICE_INTERFACE_DETAIL_DATA_W
+    { cbSize      DWORD                }
+    { DevicePath  WCHAR[ANYSIZE_ARRAY] } ;
+TYPEDEF: SP_DEVICE_INTERFACE_DETAIL_DATA_W* PSP_DEVICE_INTERFACE_DETAIL_DATA_W
+TYPEDEF: SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_DEVICE_INTERFACE_DETAIL_DATA
+TYPEDEF: PSP_DEVICE_INTERFACE_DETAIL_DATA_W PSP_DEVICE_INTERFACE_DETAIL_DATA
+TYPEDEF: SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_INTERFACE_DEVICE_DETAIL_DATA_W
+TYPEDEF: PSP_DEVICE_INTERFACE_DETAIL_DATA_W PSP_INTERFACE_DEVICE_DETAIL_DATA_W
+TYPEDEF: SP_DEVICE_INTERFACE_DETAIL_DATA_A SP_INTERFACE_DEVICE_DETAIL_DATA_A
+TYPEDEF: PSP_DEVICE_INTERFACE_DETAIL_DATA_A PSP_INTERFACE_DEVICE_DETAIL_DATA_A
+
+TYPEDEF: SP_INTERFACE_DEVICE_DETAIL_DATA_W SP_INTERFACE_DEVICE_DETAIL_DATA
+TYPEDEF: PSP_INTERFACE_DEVICE_DETAIL_DATA_W PSP_INTERFACE_DEVICE_DETAIL_DATA
+
+STRUCT: SP_DEVINFO_LIST_DETAIL_DATA_A
+    { cbSize              DWORD                           }
+    { ClassGuid           GUID                            }
+    { RemoteMachineHandle HANDLE                          }
+    { RemoteMachineName   CHAR[SP_MAX_MACHINENAME_LENGTH] } ;
+TYPEDEF: SP_DEVINFO_LIST_DETAIL_DATA_A* PSP_DEVINFO_LIST_DETAIL_DATA_A
+STRUCT: SP_DEVINFO_LIST_DETAIL_DATA_W
+    { cbSize              DWORD                            }
+    { ClassGuid           GUID                             }
+    { RemoteMachineHandle HANDLE                           }
+    { RemoteMachineName   WCHAR[SP_MAX_MACHINENAME_LENGTH] } ;
+TYPEDEF: SP_DEVINFO_LIST_DETAIL_DATA_W* PSP_DEVINFO_LIST_DETAIL_DATA_W
+
+TYPEDEF: SP_DEVINFO_LIST_DETAIL_DATA_W SP_DEVINFO_LIST_DETAIL_DATA
+TYPEDEF: PSP_DEVINFO_LIST_DETAIL_DATA_W PSP_DEVINFO_LIST_DETAIL_DATA
+
+CONSTANT: DIF_SELECTDEVICE                    HEX: 00000001
+CONSTANT: DIF_INSTALLDEVICE                   HEX: 00000002
+CONSTANT: DIF_ASSIGNRESOURCES                 HEX: 00000003
+CONSTANT: DIF_PROPERTIES                      HEX: 00000004
+CONSTANT: DIF_REMOVE                          HEX: 00000005
+CONSTANT: DIF_FIRSTTIMESETUP                  HEX: 00000006
+CONSTANT: DIF_FOUNDDEVICE                     HEX: 00000007
+CONSTANT: DIF_SELECTCLASSDRIVERS              HEX: 00000008
+CONSTANT: DIF_VALIDATECLASSDRIVERS            HEX: 00000009
+CONSTANT: DIF_INSTALLCLASSDRIVERS             HEX: 0000000A
+CONSTANT: DIF_CALCDISKSPACE                   HEX: 0000000B
+CONSTANT: DIF_DESTROYPRIVATEDATA              HEX: 0000000C
+CONSTANT: DIF_VALIDATEDRIVER                  HEX: 0000000D
+CONSTANT: DIF_DETECT                          HEX: 0000000F
+CONSTANT: DIF_INSTALLWIZARD                   HEX: 00000010
+CONSTANT: DIF_DESTROYWIZARDDATA               HEX: 00000011
+CONSTANT: DIF_PROPERTYCHANGE                  HEX: 00000012
+CONSTANT: DIF_ENABLECLASS                     HEX: 00000013
+CONSTANT: DIF_DETECTVERIFY                    HEX: 00000014
+CONSTANT: DIF_INSTALLDEVICEFILES              HEX: 00000015
+CONSTANT: DIF_UNREMOVE                        HEX: 00000016
+CONSTANT: DIF_SELECTBESTCOMPATDRV             HEX: 00000017
+CONSTANT: DIF_ALLOW_INSTALL                   HEX: 00000018
+CONSTANT: DIF_REGISTERDEVICE                  HEX: 00000019
+CONSTANT: DIF_NEWDEVICEWIZARD_PRESELECT       HEX: 0000001A
+CONSTANT: DIF_NEWDEVICEWIZARD_SELECT          HEX: 0000001B
+CONSTANT: DIF_NEWDEVICEWIZARD_PREANALYZE      HEX: 0000001C
+CONSTANT: DIF_NEWDEVICEWIZARD_POSTANALYZE     HEX: 0000001D
+CONSTANT: DIF_NEWDEVICEWIZARD_FINISHINSTALL   HEX: 0000001E
+CONSTANT: DIF_UNUSED1                         HEX: 0000001F
+CONSTANT: DIF_INSTALLINTERFACES               HEX: 00000020
+CONSTANT: DIF_DETECTCANCEL                    HEX: 00000021
+CONSTANT: DIF_REGISTER_COINSTALLERS           HEX: 00000022
+CONSTANT: DIF_ADDPROPERTYPAGE_ADVANCED        HEX: 00000023
+CONSTANT: DIF_ADDPROPERTYPAGE_BASIC           HEX: 00000024
+CONSTANT: DIF_RESERVED1                       HEX: 00000025
+CONSTANT: DIF_TROUBLESHOOTER                  HEX: 00000026
+CONSTANT: DIF_POWERMESSAGEWAKE                HEX: 00000027
+CONSTANT: DIF_ADDREMOTEPROPERTYPAGE_ADVANCED  HEX: 00000028
+CONSTANT: DIF_UPDATEDRIVER_UI                 HEX: 00000029
+CONSTANT: DIF_FINISHINSTALL_ACTION            HEX: 0000002A
+CONSTANT: DIF_RESERVED2                       HEX: 00000030
+CONSTANT: DIF_MOVEDEVICE                      HEX: 0000000E
+TYPEDEF: UINT DI_FUNCTION
+
+STRUCT: SP_DEVINSTALL_PARAMS_A
+    { cbSize                               DWORD             }
+    { Flags                                DWORD             }
+    { FlagsEx                              DWORD             }
+    { hwndParent                           HWND              }
+    { InstallMsgHandler                    PSP_FILE_CALLBACK }
+    { InstallMsgHandlerContext             PVOID             }
+    { FileQueue                            HSPFILEQ          }
+    { ClassInstallReserved                 ULONG_PTR         }
+    { Reserved                             DWORD             }
+    { DriverPath                           CHAR[MAX_PATH]    } ;
+TYPEDEF: SP_DEVINSTALL_PARAMS_A* PSP_DEVINSTALL_PARAMS_A
+STRUCT: SP_DEVINSTALL_PARAMS_W
+    { cbSize                               DWORD             }
+    { Flags                                DWORD             }
+    { FlagsEx                              DWORD             }
+    { hwndParent                           HWND              }
+    { InstallMsgHandler                    PSP_FILE_CALLBACK }
+    { InstallMsgHandlerContext             PVOID             }
+    { FileQueue                            HSPFILEQ          }
+    { ClassInstallReserved                 ULONG_PTR         }
+    { Reserved                             DWORD             }
+    { DriverPath                           WCHAR[MAX_PATH]   } ;
+TYPEDEF: SP_DEVINSTALL_PARAMS_W* PSP_DEVINSTALL_PARAMS_W
+TYPEDEF: SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS
+TYPEDEF: PSP_DEVINSTALL_PARAMS_W PSP_DEVINSTALL_PARAMS
+
+CONSTANT: DI_SHOWOEM                  HEX: 00000001
+CONSTANT: DI_SHOWCOMPAT               HEX: 00000002
+CONSTANT: DI_SHOWCLASS                HEX: 00000004
+CONSTANT: DI_SHOWALL                  HEX: 00000007
+CONSTANT: DI_NOVCP                    HEX: 00000008
+CONSTANT: DI_DIDCOMPAT                HEX: 00000010
+CONSTANT: DI_DIDCLASS                 HEX: 00000020
+CONSTANT: DI_AUTOASSIGNRES            HEX: 00000040
+CONSTANT: DI_NEEDRESTART              HEX: 00000080
+CONSTANT: DI_NEEDREBOOT               HEX: 00000100
+CONSTANT: DI_NOBROWSE                 HEX: 00000200
+CONSTANT: DI_MULTMFGS                 HEX: 00000400
+CONSTANT: DI_DISABLED                 HEX: 00000800
+CONSTANT: DI_GENERALPAGE_ADDED        HEX: 00001000
+CONSTANT: DI_RESOURCEPAGE_ADDED       HEX: 00002000
+CONSTANT: DI_PROPERTIES_CHANGE        HEX: 00004000
+CONSTANT: DI_INF_IS_SORTED            HEX: 00008000
+CONSTANT: DI_ENUMSINGLEINF            HEX: 00010000
+CONSTANT: DI_DONOTCALLCONFIGMG        HEX: 00020000
+CONSTANT: DI_INSTALLDISABLED          HEX: 00040000
+CONSTANT: DI_COMPAT_FROM_CLASS        HEX: 00080000
+CONSTANT: DI_CLASSINSTALLPARAMS       HEX: 00100000
+CONSTANT: DI_NODI_DEFAULTACTION       HEX: 00200000
+CONSTANT: DI_QUIETINSTALL             HEX: 00800000
+CONSTANT: DI_NOFILECOPY               HEX: 01000000
+CONSTANT: DI_FORCECOPY                HEX: 02000000
+CONSTANT: DI_DRIVERPAGE_ADDED         HEX: 04000000
+CONSTANT: DI_USECI_SELECTSTRINGS      HEX: 08000000
+CONSTANT: DI_OVERRIDE_INFFLAGS        HEX: 10000000
+CONSTANT: DI_PROPS_NOCHANGEUSAGE      HEX: 20000000
+CONSTANT: DI_NOSELECTICONS            HEX: 40000000
+CONSTANT: DI_NOWRITE_IDS              HEX: 80000000
+CONSTANT: DI_FLAGSEX_RESERVED2                HEX: 00000001
+CONSTANT: DI_FLAGSEX_RESERVED3                HEX: 00000002
+CONSTANT: DI_FLAGSEX_CI_FAILED                HEX: 00000004
+CONSTANT: DI_FLAGSEX_FINISHINSTALL_ACTION     HEX: 00000008
+CONSTANT: DI_FLAGSEX_DIDINFOLIST              HEX: 00000010
+CONSTANT: DI_FLAGSEX_DIDCOMPATINFO            HEX: 00000020
+CONSTANT: DI_FLAGSEX_FILTERCLASSES            HEX: 00000040
+CONSTANT: DI_FLAGSEX_SETFAILEDINSTALL         HEX: 00000080
+CONSTANT: DI_FLAGSEX_DEVICECHANGE             HEX: 00000100
+CONSTANT: DI_FLAGSEX_ALWAYSWRITEIDS           HEX: 00000200
+CONSTANT: DI_FLAGSEX_PROPCHANGE_PENDING       HEX: 00000400
+CONSTANT: DI_FLAGSEX_ALLOWEXCLUDEDDRVS        HEX: 00000800
+CONSTANT: DI_FLAGSEX_NOUIONQUERYREMOVE        HEX: 00001000
+CONSTANT: DI_FLAGSEX_USECLASSFORCOMPAT        HEX: 00002000
+CONSTANT: DI_FLAGSEX_RESERVED4                HEX: 00004000
+CONSTANT: DI_FLAGSEX_NO_DRVREG_MODIFY         HEX: 00008000
+CONSTANT: DI_FLAGSEX_IN_SYSTEM_SETUP          HEX: 00010000
+CONSTANT: DI_FLAGSEX_INET_DRIVER              HEX: 00020000
+CONSTANT: DI_FLAGSEX_APPENDDRIVERLIST         HEX: 00040000
+CONSTANT: DI_FLAGSEX_PREINSTALLBACKUP         HEX: 00080000
+CONSTANT: DI_FLAGSEX_BACKUPONREPLACE          HEX: 00100000
+CONSTANT: DI_FLAGSEX_DRIVERLIST_FROM_URL      HEX: 00200000
+CONSTANT: DI_FLAGSEX_RESERVED1                HEX: 00400000
+CONSTANT: DI_FLAGSEX_EXCLUDE_OLD_INET_DRIVERS HEX: 00800000
+CONSTANT: DI_FLAGSEX_POWERPAGE_ADDED          HEX: 01000000
+CONSTANT: DI_FLAGSEX_FILTERSIMILARDRIVERS     HEX: 02000000
+CONSTANT: DI_FLAGSEX_INSTALLEDDRIVER          HEX: 04000000
+CONSTANT: DI_FLAGSEX_NO_CLASSLIST_NODE_MERGE  HEX: 08000000
+CONSTANT: DI_FLAGSEX_ALTPLATFORM_DRVSEARCH    HEX: 10000000
+CONSTANT: DI_FLAGSEX_RESTART_DEVICE_ONLY      HEX: 20000000
+CONSTANT: DI_FLAGSEX_RECURSIVESEARCH          HEX: 40000000
+CONSTANT: DI_FLAGSEX_SEARCH_PUBLISHED_INFS    HEX: 80000000
+
+STRUCT: SP_CLASSINSTALL_HEADER
+    { cbSize          DWORD       }
+    { InstallFunction DI_FUNCTION } ;
+TYPEDEF: SP_CLASSINSTALL_HEADER* PSP_CLASSINSTALL_HEADER
+
+STRUCT: SP_ENABLECLASS_PARAMS
+    { ClassInstallHeader             SP_CLASSINSTALL_HEADER }
+    { ClassGuid                      GUID                   }
+    { EnableMessage                  DWORD                  } ;
+TYPEDEF: SP_ENABLECLASS_PARAMS* PSP_ENABLECLASS_PARAMS
+
+CONSTANT: ENABLECLASS_QUERY   0
+CONSTANT: ENABLECLASS_SUCCESS 1
+CONSTANT: ENABLECLASS_FAILURE 2
+CONSTANT: DICS_ENABLE      HEX: 00000001
+CONSTANT: DICS_DISABLE     HEX: 00000002
+CONSTANT: DICS_PROPCHANGE  HEX: 00000003
+CONSTANT: DICS_START       HEX: 00000004
+CONSTANT: DICS_STOP        HEX: 00000005
+CONSTANT: DICS_FLAG_GLOBAL         HEX: 00000001
+CONSTANT: DICS_FLAG_CONFIGSPECIFIC HEX: 00000002
+CONSTANT: DICS_FLAG_CONFIGGENERAL  HEX: 00000004
+
+STRUCT: SP_PROPCHANGE_PARAMS
+    { ClassInstallHeader           SP_CLASSINSTALL_HEADER }
+    { StateChange                  DWORD                  }
+    { Scope                        DWORD                  }
+    { HwProfile                    DWORD                  } ;
+TYPEDEF: SP_PROPCHANGE_PARAMS* PSP_PROPCHANGE_PARAMS
+
+STRUCT: SP_REMOVEDEVICE_PARAMS
+    { ClassInstallHeader SP_CLASSINSTALL_HEADER }
+    { Scope              DWORD                  }
+    { HwProfile          DWORD                  } ;
+TYPEDEF: SP_REMOVEDEVICE_PARAMS* PSP_REMOVEDEVICE_PARAMS
+
+CONSTANT: DI_REMOVEDEVICE_GLOBAL                  HEX: 00000001
+CONSTANT: DI_REMOVEDEVICE_CONFIGSPECIFIC          HEX: 00000002
+
+STRUCT: SP_UNREMOVEDEVICE_PARAMS
+    { ClassInstallHeader SP_CLASSINSTALL_HEADER }
+    { Scope              DWORD                  }
+    { HwProfile          DWORD                  } ;
+TYPEDEF: SP_UNREMOVEDEVICE_PARAMS* PSP_UNREMOVEDEVICE_PARAMS
+
+CONSTANT: DI_UNREMOVEDEVICE_CONFIGSPECIFIC        HEX: 00000002
+
+STRUCT: SP_SELECTDEVICE_PARAMS_A
+    { ClassInstallHeader             SP_CLASSINSTALL_HEADER    }
+    { Title                          CHAR[MAX_TITLE_LEN]       }
+    { Instructions                   CHAR[MAX_INSTRUCTION_LEN] }
+    { ListLabel                      CHAR[MAX_LABEL_LEN]       }
+    { SubTitle                       CHAR[MAX_SUBTITLE_LEN]    }
+    { Reserved                       BYTE[2]                   } ;
+TYPEDEF: SP_SELECTDEVICE_PARAMS_A* PSP_SELECTDEVICE_PARAMS_A
+STRUCT: SP_SELECTDEVICE_PARAMS_W
+    { ClassInstallHeader            SP_CLASSINSTALL_HEADER     }
+    { Title                         WCHAR[MAX_TITLE_LEN]       }
+    { Instructions                  WCHAR[MAX_INSTRUCTION_LEN] }
+    { ListLabel                     WCHAR[MAX_LABEL_LEN]       }
+    { SubTitle                      WCHAR[MAX_SUBTITLE_LEN]    } ;
+TYPEDEF: SP_SELECTDEVICE_PARAMS_W* PSP_SELECTDEVICE_PARAMS_W
+TYPEDEF: SP_SELECTDEVICE_PARAMS_W SP_SELECTDEVICE_PARAMS
+TYPEDEF: PSP_SELECTDEVICE_PARAMS_W PSP_SELECTDEVICE_PARAMS
+
+CALLBACK: BOOL PDETECT_PROGRESS_NOTIFY ( PVOID ProgressNotifyParam, DWORD DetectComplete ) ;
+
+STRUCT: SP_DETECTDEVICE_PARAMS
+    { ClassInstallHeader                    SP_CLASSINSTALL_HEADER  }
+    { DetectProgressNotify                  PDETECT_PROGRESS_NOTIFY }
+    { ProgressNotifyParam                   PVOID                   } ;
+TYPEDEF: SP_DETECTDEVICE_PARAMS* PSP_DETECTDEVICE_PARAMS
+
+CONSTANT: MAX_INSTALLWIZARD_DYNAPAGES 20
+
+STRUCT: SP_INSTALLWIZARD_DATA
+    { ClassInstallHeader                SP_CLASSINSTALL_HEADER                      }
+    { Flags                             DWORD                                       }
+    { DynamicPages                      HPROPSHEETPAGE[MAX_INSTALLWIZARD_DYNAPAGES] }
+    { NumDynamicPages                   DWORD                                       }
+    { DynamicPageFlags                  DWORD                                       }
+    { PrivateFlags                      DWORD                                       }
+    { PrivateData                       LPARAM                                      }
+    { hwndWizardDlg                     HWND                                        } ;
+TYPEDEF: SP_INSTALLWIZARD_DATA* PSP_INSTALLWIZARD_DATA
+
+CONSTANT: NDW_INSTALLFLAG_DIDFACTDEFS         HEX: 00000001
+CONSTANT: NDW_INSTALLFLAG_HARDWAREALLREADYIN  HEX: 00000002
+CONSTANT: NDW_INSTALLFLAG_NEEDRESTART         $ DI_NEEDRESTART
+CONSTANT: NDW_INSTALLFLAG_NEEDREBOOT          $ DI_NEEDREBOOT
+CONSTANT: NDW_INSTALLFLAG_NEEDSHUTDOWN        HEX: 00000200
+CONSTANT: NDW_INSTALLFLAG_EXPRESSINTRO        HEX: 00000400
+CONSTANT: NDW_INSTALLFLAG_SKIPISDEVINSTALLED  HEX: 00000800
+CONSTANT: NDW_INSTALLFLAG_NODETECTEDDEVS      HEX: 00001000
+CONSTANT: NDW_INSTALLFLAG_INSTALLSPECIFIC     HEX: 00002000
+CONSTANT: NDW_INSTALLFLAG_SKIPCLASSLIST       HEX: 00004000
+CONSTANT: NDW_INSTALLFLAG_CI_PICKED_OEM       HEX: 00008000
+CONSTANT: NDW_INSTALLFLAG_PCMCIAMODE          HEX: 00010000
+CONSTANT: NDW_INSTALLFLAG_PCMCIADEVICE        HEX: 00020000
+CONSTANT: NDW_INSTALLFLAG_USERCANCEL          HEX: 00040000
+CONSTANT: NDW_INSTALLFLAG_KNOWNCLASS          HEX: 00080000
+CONSTANT: DYNAWIZ_FLAG_PAGESADDED             HEX: 00000001
+CONSTANT: DYNAWIZ_FLAG_ANALYZE_HANDLECONFLICT HEX: 00000008
+CONSTANT: DYNAWIZ_FLAG_INSTALLDET_NEXT        HEX: 00000002
+CONSTANT: DYNAWIZ_FLAG_INSTALLDET_PREV        HEX: 00000004
+CONSTANT: MIN_IDD_DYNAWIZ_RESOURCE_ID             10000
+CONSTANT: MAX_IDD_DYNAWIZ_RESOURCE_ID             11000
+CONSTANT: IDD_DYNAWIZ_FIRSTPAGE                   10000
+CONSTANT: IDD_DYNAWIZ_SELECT_PREVPAGE             10001
+CONSTANT: IDD_DYNAWIZ_SELECT_NEXTPAGE             10002
+CONSTANT: IDD_DYNAWIZ_ANALYZE_PREVPAGE            10003
+CONSTANT: IDD_DYNAWIZ_ANALYZE_NEXTPAGE            10004
+CONSTANT: IDD_DYNAWIZ_SELECTDEV_PAGE              10009
+CONSTANT: IDD_DYNAWIZ_ANALYZEDEV_PAGE             10010
+CONSTANT: IDD_DYNAWIZ_INSTALLDETECTEDDEVS_PAGE    10011
+CONSTANT: IDD_DYNAWIZ_SELECTCLASS_PAGE            10012
+CONSTANT: IDD_DYNAWIZ_INSTALLDETECTED_PREVPAGE    10006
+CONSTANT: IDD_DYNAWIZ_INSTALLDETECTED_NEXTPAGE    10007
+CONSTANT: IDD_DYNAWIZ_INSTALLDETECTED_NODEVS      10008
+
+STRUCT: SP_NEWDEVICEWIZARD_DATA
+    { ClassInstallHeader SP_CLASSINSTALL_HEADER                      }
+    { Flags              DWORD                                       }
+    { DynamicPages       HPROPSHEETPAGE[MAX_INSTALLWIZARD_DYNAPAGES] }
+    { NumDynamicPages    DWORD                                       }
+    { hwndWizardDlg      HWND                                        } ;
+TYPEDEF: SP_NEWDEVICEWIZARD_DATA* PSP_NEWDEVICEWIZARD_DATA
+TYPEDEF: SP_NEWDEVICEWIZARD_DATA SP_ADDPROPERTYPAGE_DATA
+TYPEDEF: PSP_NEWDEVICEWIZARD_DATA PSP_ADDPROPERTYPAGE_DATA
+
+STRUCT: SP_TROUBLESHOOTER_PARAMS_A
+    { ClassInstallHeader SP_CLASSINSTALL_HEADER }
+    { ChmFile            CHAR[MAX_PATH]         }
+    { HtmlTroubleShooter CHAR[MAX_PATH]         } ;
+TYPEDEF: SP_TROUBLESHOOTER_PARAMS_A* PSP_TROUBLESHOOTER_PARAMS_A
+STRUCT: SP_TROUBLESHOOTER_PARAMS_W
+    { ClassInstallHeader SP_CLASSINSTALL_HEADER }
+    { ChmFile            WCHAR[MAX_PATH]        }
+    { HtmlTroubleShooter WCHAR[MAX_PATH]        } ;
+TYPEDEF: SP_TROUBLESHOOTER_PARAMS_W* PSP_TROUBLESHOOTER_PARAMS_W
+TYPEDEF: SP_TROUBLESHOOTER_PARAMS_W SP_TROUBLESHOOTER_PARAMS
+TYPEDEF: PSP_TROUBLESHOOTER_PARAMS_W PSP_TROUBLESHOOTER_PARAMS
+
+STRUCT: SP_POWERMESSAGEWAKE_PARAMS_A
+    { ClassInstallHeader     SP_CLASSINSTALL_HEADER }
+    { PowerMessageWake       CHAR[LINE_LEN*2]       } ;
+TYPEDEF: SP_POWERMESSAGEWAKE_PARAMS_A* PSP_POWERMESSAGEWAKE_PARAMS_A
+STRUCT: SP_POWERMESSAGEWAKE_PARAMS_W
+    { ClassInstallHeader    SP_CLASSINSTALL_HEADER }
+    { PowerMessageWake      WCHAR[LINE_LEN*2]      } ;
+TYPEDEF: SP_POWERMESSAGEWAKE_PARAMS_W* PSP_POWERMESSAGEWAKE_PARAMS_W
+TYPEDEF: SP_POWERMESSAGEWAKE_PARAMS_W SP_POWERMESSAGEWAKE_PARAMS
+TYPEDEF: PSP_POWERMESSAGEWAKE_PARAMS_W PSP_POWERMESSAGEWAKE_PARAMS
+
+STRUCT: SP_DRVINFO_DATA_V2_A
+    { cbSize         DWORD          }
+    { DriverType     DWORD          }
+    { Reserved       ULONG_PTR      }
+    { Description    CHAR[LINE_LEN] }
+    { MfgName        CHAR[LINE_LEN] }
+    { ProviderName   CHAR[LINE_LEN] }
+    { DriverDate     FILETIME       }
+    { DriverVersion  DWORDLONG      } ;
+TYPEDEF: SP_DRVINFO_DATA_V2_A* PSP_DRVINFO_DATA_V2_A
+STRUCT: SP_DRVINFO_DATA_V2_W
+    { cbSize         DWORD           }
+    { DriverType     DWORD           }
+    { Reserved       ULONG_PTR       }
+    { Description    WCHAR[LINE_LEN] }
+    { MfgName        WCHAR[LINE_LEN] }
+    { ProviderName   WCHAR[LINE_LEN] }
+    { DriverDate     FILETIME        }
+    { DriverVersion  DWORDLONG       } ;
+TYPEDEF: SP_DRVINFO_DATA_V2_W* PSP_DRVINFO_DATA_V2_W
+STRUCT: SP_DRVINFO_DATA_V1_A
+    { cbSize         DWORD          }
+    { DriverType     DWORD          }
+    { Reserved       ULONG_PTR      }
+    { Description    CHAR[LINE_LEN] }
+    { MfgName        CHAR[LINE_LEN] }
+    { ProviderName   CHAR[LINE_LEN] } ;
+TYPEDEF: SP_DRVINFO_DATA_V1_A* PSP_DRVINFO_DATA_V1_A
+STRUCT: SP_DRVINFO_DATA_V1_W
+    { cbSize         DWORD           }
+    { DriverType     DWORD           }
+    { Reserved       ULONG_PTR       }
+    { Description    WCHAR[LINE_LEN] }
+    { MfgName        WCHAR[LINE_LEN] }
+    { ProviderName   WCHAR[LINE_LEN] } ;
+TYPEDEF: SP_DRVINFO_DATA_V1_W* PSP_DRVINFO_DATA_V1_W
+TYPEDEF: SP_DRVINFO_DATA_V1_W SP_DRVINFO_DATA_V1
+TYPEDEF: PSP_DRVINFO_DATA_V1_W PSP_DRVINFO_DATA_V1
+TYPEDEF: SP_DRVINFO_DATA_V2_W SP_DRVINFO_DATA_V2
+TYPEDEF: PSP_DRVINFO_DATA_V2_W PSP_DRVINFO_DATA_V2
+TYPEDEF: SP_DRVINFO_DATA_V2_A SP_DRVINFO_DATA_A
+TYPEDEF: PSP_DRVINFO_DATA_V2_A PSP_DRVINFO_DATA_A
+TYPEDEF: SP_DRVINFO_DATA_V2_W SP_DRVINFO_DATA_W
+TYPEDEF: PSP_DRVINFO_DATA_V2_W PSP_DRVINFO_DATA_W
+TYPEDEF: SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA
+TYPEDEF: PSP_DRVINFO_DATA_V2 PSP_DRVINFO_DATA
+
+STRUCT: SP_DRVINFO_DETAIL_DATA_A
+    { cbSize             DWORD               }
+    { InfDate            FILETIME            }
+    { CompatIDsOffset    DWORD               }
+    { CompatIDsLength    DWORD               }
+    { Reserved           ULONG_PTR           }
+    { SectionName        CHAR[LINE_LEN]      }
+    { InfFileName        CHAR[MAX_PATH]      }
+    { DrvDescription     CHAR[LINE_LEN]      }
+    { HardwareID         CHAR[ANYSIZE_ARRAY] } ;
+TYPEDEF: SP_DRVINFO_DETAIL_DATA_A* PSP_DRVINFO_DETAIL_DATA_A
+STRUCT: SP_DRVINFO_DETAIL_DATA_W
+    { cbSize             DWORD                }
+    { InfDate            FILETIME             }
+    { CompatIDsOffset    DWORD                }
+    { CompatIDsLength    DWORD                }
+    { Reserved           ULONG_PTR            }
+    { SectionName        WCHAR[LINE_LEN]      }
+    { InfFileName        WCHAR[MAX_PATH]      }
+    { DrvDescription     WCHAR[LINE_LEN]      }
+    { HardwareID         WCHAR[ANYSIZE_ARRAY] } ;
+TYPEDEF: SP_DRVINFO_DETAIL_DATA_W* PSP_DRVINFO_DETAIL_DATA_W
+
+TYPEDEF: SP_DRVINFO_DETAIL_DATA_W SP_DRVINFO_DETAIL_DATA
+TYPEDEF: PSP_DRVINFO_DETAIL_DATA_W PSP_DRVINFO_DETAIL_DATA
+
+STRUCT: SP_DRVINSTALL_PARAMS
+    { cbSize      DWORD     }
+    { Rank        DWORD     }
+    { Flags       DWORD     }
+    { PrivateData DWORD_PTR }
+    { Reserved    DWORD     } ;
+TYPEDEF: SP_DRVINSTALL_PARAMS* PSP_DRVINSTALL_PARAMS
+
+CONSTANT: DNF_DUPDESC             HEX: 00000001
+CONSTANT: DNF_OLDDRIVER           HEX: 00000002
+CONSTANT: DNF_EXCLUDEFROMLIST     HEX: 00000004
+CONSTANT: DNF_NODRIVER            HEX: 00000008
+CONSTANT: DNF_LEGACYINF           HEX: 00000010
+CONSTANT: DNF_CLASS_DRIVER        HEX: 00000020
+CONSTANT: DNF_COMPATIBLE_DRIVER   HEX: 00000040
+CONSTANT: DNF_INET_DRIVER         HEX: 00000080
+CONSTANT: DNF_UNUSED1             HEX: 00000100
+CONSTANT: DNF_UNUSED2             HEX: 00000200
+CONSTANT: DNF_OLD_INET_DRIVER     HEX: 00000400
+CONSTANT: DNF_BAD_DRIVER          HEX: 00000800
+CONSTANT: DNF_DUPPROVIDER         HEX: 00001000
+CONSTANT: DNF_INF_IS_SIGNED         HEX: 00002000
+CONSTANT: DNF_OEM_F6_INF            HEX: 00004000
+CONSTANT: DNF_DUPDRIVERVER          HEX: 00008000
+CONSTANT: DNF_BASIC_DRIVER          HEX: 00010000
+CONSTANT: DNF_AUTHENTICODE_SIGNED   HEX: 00020000
+CONSTANT: DNF_INSTALLEDDRIVER       HEX: 00040000
+CONSTANT: DNF_ALWAYSEXCLUDEFROMLIST HEX: 00080000
+CONSTANT: DNF_INBOX_DRIVER          HEX: 00100000
+CONSTANT: DNF_REQUESTADDITIONALSOFTWARE   HEX: 00200000
+CONSTANT: DNF_UNUSED_22             HEX: 00400000
+CONSTANT: DNF_UNUSED_23             HEX: 00800000
+CONSTANT: DNF_UNUSED_24             HEX: 01000000
+CONSTANT: DNF_UNUSED_25             HEX: 02000000
+CONSTANT: DNF_UNUSED_26             HEX: 04000000
+CONSTANT: DNF_UNUSED_27             HEX: 08000000
+CONSTANT: DNF_UNUSED_28             HEX: 10000000
+CONSTANT: DNF_UNUSED_29             HEX: 20000000
+CONSTANT: DNF_UNUSED_30             HEX: 40000000
+CONSTANT: DNF_UNUSED_31             HEX: 80000000
+CONSTANT: DRIVER_HARDWAREID_RANK  HEX: 00000FFF
+CONSTANT: DRIVER_HARDWAREID_MASK  HEX: 80000FFF
+CONSTANT: DRIVER_UNTRUSTED_RANK   HEX: 80000000
+CONSTANT: DRIVER_W9X_SUSPECT_RANK HEX: C0000000
+
+CALLBACK: DWORD PSP_DETSIG_CMPPROC ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA NewDeviceData, PSP_DEVINFO_DATA ExistingDeviceData, PVOID CompareContext ) ;
+
+STRUCT: COINSTALLER_CONTEXT_DATA
+    { PostProcessing  BOOL  }
+    { InstallResult   DWORD }
+    { PrivateData     PVOID } ;
+TYPEDEF: COINSTALLER_CONTEXT_DATA* PCOINSTALLER_CONTEXT_DATA
+
+STRUCT: SP_CLASSIMAGELIST_DATA
+    { cbSize      DWORD      }
+    { ImageList   HIMAGELIST }
+    { Reserved    ULONG_PTR  } ;
+TYPEDEF: SP_CLASSIMAGELIST_DATA* PSP_CLASSIMAGELIST_DATA
+
+STRUCT: SP_PROPSHEETPAGE_REQUEST
+    { cbSize                   DWORD            }
+    { PageRequested            DWORD            }
+    { DeviceInfoSet            HDEVINFO         }
+    { DeviceInfoData           PSP_DEVINFO_DATA } ;
+TYPEDEF: SP_PROPSHEETPAGE_REQUEST* PSP_PROPSHEETPAGE_REQUEST
+
+CONSTANT: SPPSR_SELECT_DEVICE_RESOURCES      1
+CONSTANT: SPPSR_ENUM_BASIC_DEVICE_PROPERTIES 2
+CONSTANT: SPPSR_ENUM_ADV_DEVICE_PROPERTIES   3
+
+STRUCT: SP_BACKUP_QUEUE_PARAMS_V2_A
+    { cbSize              DWORD          }
+    { FullInfPath         CHAR[MAX_PATH] }
+    { FilenameOffset      INT            }
+    { ReinstallInstance   CHAR[MAX_PATH] } ;
+TYPEDEF: SP_BACKUP_QUEUE_PARAMS_V2_A* PSP_BACKUP_QUEUE_PARAMS_V2_A
+
+STRUCT: SP_BACKUP_QUEUE_PARAMS_V2_W
+    { cbSize              DWORD           }
+    { FullInfPath         WCHAR[MAX_PATH] }
+    { FilenameOffset      INT             }
+    { ReinstallInstance   WCHAR[MAX_PATH] } ;
+TYPEDEF: SP_BACKUP_QUEUE_PARAMS_V2_W* PSP_BACKUP_QUEUE_PARAMS_V2_W
+
+STRUCT: SP_BACKUP_QUEUE_PARAMS_V1_A
+    { cbSize              DWORD          }
+    { FullInfPath         CHAR[MAX_PATH] }
+    { FilenameOffset      INT            } ;
+TYPEDEF: SP_BACKUP_QUEUE_PARAMS_V1_A* PSP_BACKUP_QUEUE_PARAMS_V1_A
+
+STRUCT: SP_BACKUP_QUEUE_PARAMS_V1_W
+    { cbSize              DWORD           }
+    { FullInfPath         WCHAR[MAX_PATH] }
+    { FilenameOffset      INT             } ;
+TYPEDEF: SP_BACKUP_QUEUE_PARAMS_V1_W* PSP_BACKUP_QUEUE_PARAMS_V1_W
+
+TYPEDEF: SP_BACKUP_QUEUE_PARAMS_V1_W SP_BACKUP_QUEUE_PARAMS_V1
+TYPEDEF: PSP_BACKUP_QUEUE_PARAMS_V1_W PSP_BACKUP_QUEUE_PARAMS_V1
+TYPEDEF: SP_BACKUP_QUEUE_PARAMS_V2_W SP_BACKUP_QUEUE_PARAMS_V2
+TYPEDEF: PSP_BACKUP_QUEUE_PARAMS_V2_W PSP_BACKUP_QUEUE_PARAMS_V2
+TYPEDEF: SP_BACKUP_QUEUE_PARAMS_V2_A SP_BACKUP_QUEUE_PARAMS_A
+TYPEDEF: PSP_BACKUP_QUEUE_PARAMS_V2_A PSP_BACKUP_QUEUE_PARAMS_A
+TYPEDEF: SP_BACKUP_QUEUE_PARAMS_V2_W SP_BACKUP_QUEUE_PARAMS_W
+TYPEDEF: PSP_BACKUP_QUEUE_PARAMS_V2_W PSP_BACKUP_QUEUE_PARAMS_W
+TYPEDEF: SP_BACKUP_QUEUE_PARAMS_V2 SP_BACKUP_QUEUE_PARAMS
+TYPEDEF: PSP_BACKUP_QUEUE_PARAMS_V2 PSP_BACKUP_QUEUE_PARAMS
+
+CONSTANT: ERROR_EXPECTED_SECTION_NAME  $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR 0 bitor bitor ]
+CONSTANT: ERROR_BAD_SECTION_NAME_LINE  $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR 1 bitor bitor ]
+CONSTANT: ERROR_SECTION_NAME_TOO_LONG  $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR 2 bitor bitor ]
+CONSTANT: ERROR_GENERAL_SYNTAX         $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR 3 bitor bitor ]
+CONSTANT: ERROR_WRONG_INF_STYLE        $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 100 bitor bitor ]
+CONSTANT: ERROR_SECTION_NOT_FOUND      $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 101 bitor bitor ]
+CONSTANT: ERROR_LINE_NOT_FOUND         $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 102 bitor bitor ]
+CONSTANT: ERROR_NO_BACKUP              $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 103 bitor bitor ]
+CONSTANT: ERROR_NO_ASSOCIATED_CLASS                $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 200 bitor bitor ]
+CONSTANT: ERROR_CLASS_MISMATCH                     $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 201 bitor bitor ]
+CONSTANT: ERROR_DUPLICATE_FOUND                    $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 202 bitor bitor ]
+CONSTANT: ERROR_NO_DRIVER_SELECTED                 $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 203 bitor bitor ]
+CONSTANT: ERROR_KEY_DOES_NOT_EXIST                 $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 204 bitor bitor ]
+CONSTANT: ERROR_INVALID_DEVINST_NAME               $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 205 bitor bitor ]
+CONSTANT: ERROR_INVALID_CLASS                      $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 206 bitor bitor ]
+CONSTANT: ERROR_DEVINST_ALREADY_EXISTS             $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 207 bitor bitor ]
+CONSTANT: ERROR_DEVINFO_NOT_REGISTERED             $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 208 bitor bitor ]
+CONSTANT: ERROR_INVALID_REG_PROPERTY               $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 209 bitor bitor ]
+CONSTANT: ERROR_NO_INF                             $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 20A bitor bitor ]
+CONSTANT: ERROR_NO_SUCH_DEVINST                    $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 20B bitor bitor ]
+CONSTANT: ERROR_CANT_LOAD_CLASS_ICON               $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 20C bitor bitor ]
+CONSTANT: ERROR_INVALID_CLASS_INSTALLER            $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 20D bitor bitor ]
+CONSTANT: ERROR_DI_DO_DEFAULT                      $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 20E bitor bitor ]
+CONSTANT: ERROR_DI_NOFILECOPY                      $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 20F bitor bitor ]
+CONSTANT: ERROR_INVALID_HWPROFILE                  $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 210 bitor bitor ]
+CONSTANT: ERROR_NO_DEVICE_SELECTED                 $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 211 bitor bitor ]
+CONSTANT: ERROR_DEVINFO_LIST_LOCKED                $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 212 bitor bitor ]
+CONSTANT: ERROR_DEVINFO_DATA_LOCKED                $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 213 bitor bitor ]
+CONSTANT: ERROR_DI_BAD_PATH                        $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 214 bitor bitor ]
+CONSTANT: ERROR_NO_CLASSINSTALL_PARAMS             $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 215 bitor bitor ]
+CONSTANT: ERROR_FILEQUEUE_LOCKED                   $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 216 bitor bitor ]
+CONSTANT: ERROR_BAD_SERVICE_INSTALLSECT            $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 217 bitor bitor ]
+CONSTANT: ERROR_NO_CLASS_DRIVER_LIST               $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 218 bitor bitor ]
+CONSTANT: ERROR_NO_ASSOCIATED_SERVICE              $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 219 bitor bitor ]
+CONSTANT: ERROR_NO_DEFAULT_DEVICE_INTERFACE        $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 21A bitor bitor ]
+CONSTANT: ERROR_DEVICE_INTERFACE_ACTIVE            $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 21B bitor bitor ]
+CONSTANT: ERROR_DEVICE_INTERFACE_REMOVED           $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 21C bitor bitor ]
+CONSTANT: ERROR_BAD_INTERFACE_INSTALLSECT          $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 21D bitor bitor ]
+CONSTANT: ERROR_NO_SUCH_INTERFACE_CLASS            $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 21E bitor bitor ]
+CONSTANT: ERROR_INVALID_REFERENCE_STRING           $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 21F bitor bitor ]
+CONSTANT: ERROR_INVALID_MACHINENAME                $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 220 bitor bitor ]
+CONSTANT: ERROR_REMOTE_COMM_FAILURE                $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 221 bitor bitor ]
+CONSTANT: ERROR_MACHINE_UNAVAILABLE                $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 222 bitor bitor ]
+CONSTANT: ERROR_NO_CONFIGMGR_SERVICES              $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 223 bitor bitor ]
+CONSTANT: ERROR_INVALID_PROPPAGE_PROVIDER          $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 224 bitor bitor ]
+CONSTANT: ERROR_NO_SUCH_DEVICE_INTERFACE           $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 225 bitor bitor ]
+CONSTANT: ERROR_DI_POSTPROCESSING_REQUIRED         $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 226 bitor bitor ]
+CONSTANT: ERROR_INVALID_COINSTALLER                $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 227 bitor bitor ]
+CONSTANT: ERROR_NO_COMPAT_DRIVERS                  $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 228 bitor bitor ]
+CONSTANT: ERROR_NO_DEVICE_ICON                     $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 229 bitor bitor ]
+CONSTANT: ERROR_INVALID_INF_LOGCONFIG              $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 22A bitor bitor ]
+CONSTANT: ERROR_DI_DONT_INSTALL                    $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 22B bitor bitor ]
+CONSTANT: ERROR_INVALID_FILTER_DRIVER              $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 22C bitor bitor ]
+CONSTANT: ERROR_NON_WINDOWS_NT_DRIVER              $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 22D bitor bitor ]
+CONSTANT: ERROR_NON_WINDOWS_DRIVER                 $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 22E bitor bitor ]
+CONSTANT: ERROR_NO_CATALOG_FOR_OEM_INF             $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 22F bitor bitor ]
+CONSTANT: ERROR_DEVINSTALL_QUEUE_NONNATIVE         $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 230 bitor bitor ]
+CONSTANT: ERROR_NOT_DISABLEABLE                    $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 231 bitor bitor ]
+CONSTANT: ERROR_CANT_REMOVE_DEVINST                $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 232 bitor bitor ]
+CONSTANT: ERROR_INVALID_TARGET                     $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 233 bitor bitor ]
+CONSTANT: ERROR_DRIVER_NONNATIVE                   $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 234 bitor bitor ]
+CONSTANT: ERROR_IN_WOW64                           $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 235 bitor bitor ]
+CONSTANT: ERROR_SET_SYSTEM_RESTORE_POINT           $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 236 bitor bitor ]
+CONSTANT: ERROR_SCE_DISABLED                       $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 238 bitor bitor ]
+CONSTANT: ERROR_UNKNOWN_EXCEPTION                  $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 239 bitor bitor ]
+CONSTANT: ERROR_PNP_REGISTRY_ERROR                 $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 23A bitor bitor ]
+CONSTANT: ERROR_REMOTE_REQUEST_UNSUPPORTED         $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 23B bitor bitor ]
+CONSTANT: ERROR_NOT_AN_INSTALLED_OEM_INF           $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 23C bitor bitor ]
+CONSTANT: ERROR_INF_IN_USE_BY_DEVICES              $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 23D bitor bitor ]
+CONSTANT: ERROR_DI_FUNCTION_OBSOLETE               $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 23E bitor bitor ]
+CONSTANT: ERROR_NO_AUTHENTICODE_CATALOG            $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 23F bitor bitor ]
+CONSTANT: ERROR_AUTHENTICODE_DISALLOWED            $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 240 bitor bitor ]
+CONSTANT: ERROR_AUTHENTICODE_TRUSTED_PUBLISHER     $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 241 bitor bitor ]
+CONSTANT: ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 242 bitor bitor ]
+CONSTANT: ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 243 bitor bitor ]
+CONSTANT: ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH     $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 244 bitor bitor ]
+CONSTANT: ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE     $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 245 bitor bitor ]
+CONSTANT: ERROR_DEVICE_INSTALLER_NOT_READY         $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 246 bitor bitor ]
+CONSTANT: ERROR_DRIVER_STORE_ADD_FAILED            $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 247 bitor bitor ]
+CONSTANT: ERROR_DEVICE_INSTALL_BLOCKED             $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 248 bitor bitor ]
+CONSTANT: ERROR_DRIVER_INSTALL_BLOCKED             $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 249 bitor bitor ]
+CONSTANT: ERROR_WRONG_INF_TYPE                     $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 24A bitor bitor ]
+CONSTANT: ERROR_FILE_HASH_NOT_IN_CATALOG           $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 24B bitor bitor ]
+CONSTANT: ERROR_DRIVER_STORE_DELETE_FAILED         $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 24C bitor bitor ]
+CONSTANT: ERROR_UNRECOVERABLE_STACK_OVERFLOW $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 300 bitor bitor ]
+CONSTANT: EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW $ ERROR_UNRECOVERABLE_STACK_OVERFLOW
+CONSTANT: ERROR_NO_DEFAULT_INTERFACE_DEVICE $ ERROR_NO_DEFAULT_DEVICE_INTERFACE
+CONSTANT: ERROR_INTERFACE_DEVICE_ACTIVE     $ ERROR_DEVICE_INTERFACE_ACTIVE
+CONSTANT: ERROR_INTERFACE_DEVICE_REMOVED    $ ERROR_DEVICE_INTERFACE_REMOVED
+CONSTANT: ERROR_NO_SUCH_INTERFACE_DEVICE    $ ERROR_NO_SUCH_DEVICE_INTERFACE
+CONSTANT: ERROR_NOT_INSTALLED $[ APPLICATION_ERROR_MASK ERROR_SEVERITY_ERROR HEX: 1000 bitor bitor ]
+
+FUNCTION: BOOL SetupGetInfInformationA ( LPCVOID InfSpec, DWORD SearchControl, PSP_INF_INFORMATION ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupGetInfInformationW ( LPCVOID InfSpec, DWORD SearchControl, PSP_INF_INFORMATION ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+CONSTANT: INFINFO_INF_SPEC_IS_HINF        1
+CONSTANT: INFINFO_INF_NAME_IS_ABSOLUTE    2
+CONSTANT: INFINFO_DEFAULT_SEARCH          3
+CONSTANT: INFINFO_REVERSE_DEFAULT_SEARCH  4
+CONSTANT: INFINFO_INF_PATH_LIST_SEARCH    5
+ALIAS: SetupGetInfInformation SetupGetInfInformationW
+
+FUNCTION: BOOL SetupQueryInfFileInformationA ( PSP_INF_INFORMATION InfInformation, UINT InfIndex, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupQueryInfFileInformationW ( PSP_INF_INFORMATION InfInformation, UINT InfIndex, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupQueryInfFileInformation SetupQueryInfFileInformationW
+
+FUNCTION: BOOL SetupQueryInfOriginalFileInformationA ( PSP_INF_INFORMATION InfInformation, UINT InfIndex, PSP_ALTPLATFORM_INFO AlternatePlatformInfo, PSP_ORIGINAL_FILE_INFO_A OriginalFileInfo ) ;
+FUNCTION: BOOL SetupQueryInfOriginalFileInformationW ( PSP_INF_INFORMATION InfInformation, UINT InfIndex, PSP_ALTPLATFORM_INFO AlternatePlatformInfo, PSP_ORIGINAL_FILE_INFO_W OriginalFileInfo ) ;
+ALIAS: SetupQueryInfOriginalFileInformation SetupQueryInfOriginalFileInformationW
+
+FUNCTION: BOOL SetupQueryInfVersionInformationA ( PSP_INF_INFORMATION InfInformation, UINT InfIndex, PCSTR Key, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupQueryInfVersionInformationW ( PSP_INF_INFORMATION InfInformation, UINT InfIndex, PCWSTR Key, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupQueryInfVersionInformation SetupQueryInfVersionInformationW
+
+FUNCTION: BOOL SetupGetInfDriverStoreLocationA ( PCSTR FileName, PSP_ALTPLATFORM_INFO AlternatePlatformInfo, PCSTR LocaleName, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupGetInfDriverStoreLocationW ( PCWSTR FileName, PSP_ALTPLATFORM_INFO AlternatePlatformInfo, PCWSTR LocaleName, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupGetInfDriverStoreLocation SetupGetInfDriverStoreLocationW
+
+FUNCTION: BOOL SetupGetInfPublishedNameA ( PCSTR DriverStoreLocation, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupGetInfPublishedNameW ( PCWSTR DriverStoreLocation, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupGetInfPublishedName SetupGetInfPublishedNameW
+
+FUNCTION: BOOL SetupGetInfFileListA ( PCSTR DirectoryPath, DWORD InfStyle, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupGetInfFileListW ( PCWSTR DirectoryPath, DWORD InfStyle, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupGetInfFileList SetupGetInfFileListW
+
+FUNCTION: HINF SetupOpenInfFileW ( PCWSTR FileName, PCWSTR InfClass, DWORD InfStyle, PUINT ErrorLine ) ;
+FUNCTION: HINF SetupOpenInfFileA ( PCSTR FileName, PCSTR InfClass, DWORD InfStyle, PUINT ErrorLine ) ;
+ALIAS: SetupOpenInfFile SetupOpenInfFileW
+
+FUNCTION: HINF SetupOpenMasterInf ( ) ;
+
+FUNCTION: BOOL SetupOpenAppendInfFileW ( PCWSTR FileName, HINF InfHandle, PUINT ErrorLine ) ;
+FUNCTION: BOOL SetupOpenAppendInfFileA ( PCSTR FileName, HINF InfHandle, PUINT ErrorLine ) ;
+ALIAS: SetupOpenAppendInfFile SetupOpenAppendInfFileW
+
+FUNCTION: void SetupCloseInfFile ( HINF InfHandle ) ;
+FUNCTION: BOOL SetupFindFirstLineA ( HINF InfHandle, PCSTR Section, PCSTR Key, PINFCONTEXT Context ) ;
+FUNCTION: BOOL SetupFindFirstLineW ( HINF InfHandle, PCWSTR Section, PCWSTR Key, PINFCONTEXT Context ) ;
+ALIAS: SetupFindFirstLine SetupFindFirstLineW
+
+FUNCTION: BOOL SetupFindNextLine ( PINFCONTEXT ContextIn, PINFCONTEXT ContextOut ) ;
+FUNCTION: BOOL SetupFindNextMatchLineA ( PINFCONTEXT ContextIn, PCSTR Key, PINFCONTEXT ContextOut ) ;
+FUNCTION: BOOL SetupFindNextMatchLineW ( PINFCONTEXT ContextIn, PCWSTR Key, PINFCONTEXT ContextOut ) ;
+ALIAS: SetupFindNextMatchLine SetupFindNextMatchLineW
+
+FUNCTION: BOOL SetupGetLineByIndexA ( HINF InfHandle, PCSTR Section, DWORD Index, PINFCONTEXT Context ) ;
+FUNCTION: BOOL SetupGetLineByIndexW ( HINF InfHandle, PCWSTR Section, DWORD Index, PINFCONTEXT Context ) ;
+ALIAS: SetupGetLineByIndex SetupGetLineByIndexW
+
+FUNCTION: LONG SetupGetLineCountA ( HINF InfHandle, PCSTR Section ) ;
+FUNCTION: LONG SetupGetLineCountW ( HINF InfHandle, PCWSTR Section ) ;
+ALIAS: SetupGetLineCount SetupGetLineCountW
+
+FUNCTION: BOOL SetupGetLineTextA ( PINFCONTEXT Context, HINF InfHandle, PCSTR Section, PCSTR Key, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupGetLineTextW ( PINFCONTEXT Context, HINF InfHandle, PCWSTR Section, PCWSTR Key, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupGetLineText SetupGetLineTextW
+
+FUNCTION: DWORD SetupGetFieldCount ( PINFCONTEXT Context ) ;
+FUNCTION: BOOL SetupGetStringFieldA ( PINFCONTEXT Context, DWORD FieldIndex, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupGetStringFieldW ( PINFCONTEXT Context, DWORD FieldIndex, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupGetStringField SetupGetStringFieldW
+
+FUNCTION: BOOL SetupGetIntField ( PINFCONTEXT Context, DWORD FieldIndex, PINT IntegerValue ) ;
+FUNCTION: BOOL SetupGetMultiSzFieldA ( PINFCONTEXT Context, DWORD FieldIndex, PSTR ReturnBuffer, DWORD ReturnBufferSize, LPDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupGetMultiSzFieldW ( PINFCONTEXT Context, DWORD FieldIndex, PWSTR ReturnBuffer, DWORD ReturnBufferSize, LPDWORD RequiredSize ) ;
+ALIAS: SetupGetMultiSzField SetupGetMultiSzFieldW
+
+FUNCTION: BOOL SetupGetBinaryField ( PINFCONTEXT Context, DWORD FieldIndex, PBYTE ReturnBuffer, DWORD ReturnBufferSize, LPDWORD RequiredSize ) ;
+FUNCTION: DWORD SetupGetFileCompressionInfoA ( PCSTR SourceFileName, PSTR* ActualSourceFileName, PDWORD SourceFileSize, PDWORD TargetFileSize, PUINT CompressionType ) ;
+FUNCTION: DWORD SetupGetFileCompressionInfoW ( PCWSTR SourceFileName, PWSTR* ActualSourceFileName, PDWORD SourceFileSize, PDWORD TargetFileSize, PUINT CompressionType ) ;
+ALIAS: SetupGetFileCompressionInfo SetupGetFileCompressionInfoW
+
+FUNCTION: BOOL SetupGetFileCompressionInfoExA ( PCSTR SourceFileName, PSTR ActualSourceFileNameBuffer, DWORD ActualSourceFileNameBufferLen, PDWORD RequiredBufferLen, PDWORD SourceFileSize, PDWORD TargetFileSize, PUINT CompressionType ) ;
+FUNCTION: BOOL SetupGetFileCompressionInfoExW ( PCWSTR SourceFileName, PWSTR ActualSourceFileNameBuffer, DWORD ActualSourceFileNameBufferLen, PDWORD RequiredBufferLen, PDWORD SourceFileSize, PDWORD TargetFileSize, PUINT CompressionType ) ;
+ALIAS: SetupGetFileCompressionInfoEx SetupGetFileCompressionInfoExW
+
+CONSTANT: FILE_COMPRESSION_NONE       0
+CONSTANT: FILE_COMPRESSION_WINLZA     1
+CONSTANT: FILE_COMPRESSION_MSZIP      2
+CONSTANT: FILE_COMPRESSION_NTCAB      3
+
+FUNCTION: DWORD SetupDecompressOrCopyFileA ( PCSTR SourceFileName, PCSTR TargetFileName, PUINT CompressionType ) ;
+FUNCTION: DWORD SetupDecompressOrCopyFileW ( PCWSTR SourceFileName, PCWSTR TargetFileName, PUINT CompressionType ) ;
+ALIAS: SetupDecompressOrCopyFile SetupDecompressOrCopyFileW
+
+FUNCTION: BOOL SetupGetSourceFileLocationA ( HINF InfHandle, PINFCONTEXT InfContext, PCSTR FileName, PUINT SourceId, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupGetSourceFileLocationW ( HINF InfHandle, PINFCONTEXT InfContext, PCWSTR FileName, PUINT SourceId, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupGetSourceFileLocation SetupGetSourceFileLocationW
+
+FUNCTION: BOOL SetupGetSourceFileSizeA ( HINF InfHandle, PINFCONTEXT InfContext, PCSTR FileName, PCSTR Section, PDWORD FileSize, UINT RoundingFactor ) ;
+FUNCTION: BOOL SetupGetSourceFileSizeW ( HINF InfHandle, PINFCONTEXT InfContext, PCWSTR FileName, PCWSTR Section, PDWORD FileSize, UINT RoundingFactor ) ;
+ALIAS: SetupGetSourceFileSize SetupGetSourceFileSizeW
+
+FUNCTION: BOOL SetupGetTargetPathA ( HINF InfHandle, PINFCONTEXT InfContext, PCSTR Section, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupGetTargetPathW ( HINF InfHandle, PINFCONTEXT InfContext, PCWSTR Section, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupGetTargetPath SetupGetTargetPathW
+
+CONSTANT: SRCLIST_TEMPORARY       HEX: 00000001
+CONSTANT: SRCLIST_NOBROWSE        HEX: 00000002
+CONSTANT: SRCLIST_SYSTEM          HEX: 00000010
+CONSTANT: SRCLIST_USER            HEX: 00000020
+CONSTANT: SRCLIST_SYSIFADMIN      HEX: 00000040
+CONSTANT: SRCLIST_SUBDIRS         HEX: 00000100
+CONSTANT: SRCLIST_APPEND          HEX: 00000200
+CONSTANT: SRCLIST_NOSTRIPPLATFORM HEX: 00000400
+
+FUNCTION: BOOL SetupSetSourceListA ( DWORD Flags, PCSTR* SourceList, UINT SourceCount ) ;
+FUNCTION: BOOL SetupSetSourceListW ( DWORD Flags, PCWSTR* SourceList, UINT SourceCount ) ;
+ALIAS: SetupSetSourceList SetupSetSourceListW
+
+FUNCTION: BOOL SetupCancelTemporarySourceList( ) ;
+FUNCTION: BOOL SetupAddToSourceListA ( DWORD Flags, PCSTR Source ) ;
+FUNCTION: BOOL SetupAddToSourceListW ( DWORD Flags, PCWSTR Source ) ;
+ALIAS: SetupAddToSourceList SetupAddToSourceListW
+
+FUNCTION: BOOL SetupRemoveFromSourceListA ( DWORD Flags, PCSTR Source ) ;
+FUNCTION: BOOL SetupRemoveFromSourceListW ( DWORD Flags, PCWSTR Source ) ;
+ALIAS: SetupRemoveFromSourceList SetupRemoveFromSourceListW
+
+FUNCTION: BOOL SetupQuerySourceListA ( DWORD Flags, PCSTR** List, PUINT Count ) ;
+FUNCTION: BOOL SetupQuerySourceListW ( DWORD Flags, PCWSTR** List, PUINT Count ) ;
+ALIAS: SetupQuerySourceList SetupQuerySourceListW
+
+FUNCTION: BOOL SetupFreeSourceListA ( PCSTR** List, UINT Count ) ;
+FUNCTION: BOOL SetupFreeSourceListW ( PCWSTR** List, UINT Count ) ;
+ALIAS: SetupFreeSourceList SetupFreeSourceListW
+
+FUNCTION: UINT SetupPromptForDiskA ( HWND hwndParent, PCSTR DialogTitle, PCSTR DiskName, PCSTR PathToSource, PCSTR FileSought, PCSTR TagFile, DWORD DiskPromptStyle, PSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize ) ;
+FUNCTION: UINT SetupPromptForDiskW ( HWND hwndParent, PCWSTR DialogTitle, PCWSTR DiskName, PCWSTR PathToSource, PCWSTR FileSought, PCWSTR TagFile, DWORD DiskPromptStyle, PWSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize ) ;
+ALIAS: SetupPromptForDisk SetupPromptForDiskW
+
+FUNCTION: UINT SetupCopyErrorA ( HWND hwndParent, PCSTR DialogTitle, PCSTR DiskName, PCSTR PathToSource, PCSTR SourceFile, PCSTR TargetPathFile, UINT Win32ErrorCode, DWORD Style, PSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize ) ;
+FUNCTION: UINT SetupCopyErrorW ( HWND hwndParent, PCWSTR DialogTitle, PCWSTR DiskName, PCWSTR PathToSource, PCWSTR SourceFile, PCWSTR TargetPathFile, UINT Win32ErrorCode, DWORD Style, PWSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize ) ;
+ALIAS: SetupCopyError SetupCopyErrorW
+
+FUNCTION: UINT SetupRenameErrorA ( HWND hwndParent, PCSTR DialogTitle, PCSTR SourceFile, PCSTR TargetFile, UINT Win32ErrorCode, DWORD Style ) ;
+FUNCTION: UINT SetupRenameErrorW ( HWND hwndParent, PCWSTR DialogTitle, PCWSTR SourceFile, PCWSTR TargetFile, UINT Win32ErrorCode, DWORD Style ) ;
+ALIAS: SetupRenameError SetupRenameErrorW
+
+FUNCTION: UINT SetupDeleteErrorA ( HWND hwndParent, PCSTR DialogTitle, PCSTR File, UINT Win32ErrorCode, DWORD Style ) ;
+FUNCTION: UINT SetupDeleteErrorW ( HWND hwndParent, PCWSTR DialogTitle, PCWSTR File, UINT Win32ErrorCode, DWORD Style ) ;
+ALIAS: SetupDeleteError SetupDeleteErrorW
+
+FUNCTION: UINT SetupBackupErrorA ( HWND hwndParent, PCSTR DialogTitle, PCSTR SourceFile, PCSTR TargetFile, UINT Win32ErrorCode, DWORD Style ) ;
+FUNCTION: UINT SetupBackupErrorW ( HWND hwndParent, PCWSTR DialogTitle, PCWSTR SourceFile, PCWSTR TargetFile, UINT Win32ErrorCode, DWORD Style ) ;
+ALIAS: SetupBackupError SetupBackupErrorW
+
+CONSTANT: IDF_NOBROWSE                    HEX: 00000001
+CONSTANT: IDF_NOSKIP                      HEX: 00000002
+CONSTANT: IDF_NODETAILS                   HEX: 00000004
+CONSTANT: IDF_NOCOMPRESSED                HEX: 00000008
+CONSTANT: IDF_CHECKFIRST                  HEX: 00000100
+CONSTANT: IDF_NOBEEP                      HEX: 00000200
+CONSTANT: IDF_NOFOREGROUND                HEX: 00000400
+CONSTANT: IDF_WARNIFSKIP                  HEX: 00000800
+CONSTANT: IDF_NOREMOVABLEMEDIAPROMPT      HEX: 00001000
+CONSTANT: IDF_USEDISKNAMEASPROMPT         HEX: 00002000
+CONSTANT: IDF_OEMDISK                     HEX: 80000000
+
+CONSTANT: DPROMPT_SUCCESS         0
+CONSTANT: DPROMPT_CANCEL          1
+CONSTANT: DPROMPT_SKIPFILE        2
+CONSTANT: DPROMPT_BUFFERTOOSMALL  3
+CONSTANT: DPROMPT_OUTOFMEMORY     4
+
+FUNCTION: BOOL SetupSetDirectoryIdA ( HINF InfHandle, DWORD Id, PCSTR Directory ) ;
+FUNCTION: BOOL SetupSetDirectoryIdW ( HINF InfHandle, DWORD Id, PCWSTR Directory ) ;
+ALIAS: SetupSetDirectoryId SetupSetDirectoryIdW
+
+FUNCTION: BOOL SetupSetDirectoryIdExA ( HINF InfHandle, DWORD Id, PCSTR Directory, DWORD Flags, DWORD Reserved1, PVOID Reserved2 ) ;
+FUNCTION: BOOL SetupSetDirectoryIdExW ( HINF InfHandle, DWORD Id, PCWSTR Directory, DWORD Flags, DWORD Reserved1, PVOID Reserved2 ) ;
+ALIAS: SetupSetDirectoryIdEx SetupSetDirectoryIdExW
+
+CONSTANT: SETDIRID_NOT_FULL_PATH      HEX: 00000001
+
+FUNCTION: BOOL SetupGetSourceInfoA ( HINF InfHandle, UINT SourceId, UINT InfoDesired, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupGetSourceInfoW ( HINF InfHandle, UINT SourceId, UINT InfoDesired, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupGetSourceInfo SetupGetSourceInfoW
+
+CONSTANT: SRCINFO_PATH            1
+CONSTANT: SRCINFO_TAGFILE         2
+CONSTANT: SRCINFO_DESCRIPTION     3
+CONSTANT: SRCINFO_FLAGS           4
+CONSTANT: SRCINFO_TAGFILE2        5
+CONSTANT: SRC_FLAGS_CABFILE       HEX: 0010
+
+FUNCTION: BOOL SetupInstallFileA ( HINF InfHandle, PINFCONTEXT InfContext, PCSTR SourceFile, PCSTR SourcePathRoot, PCSTR DestinationName, DWORD CopyStyle, PSP_FILE_CALLBACK_A CopyMsgHandler, PVOID Context ) ;
+FUNCTION: BOOL SetupInstallFileW ( HINF InfHandle, PINFCONTEXT InfContext, PCWSTR SourceFile, PCWSTR SourcePathRoot, PCWSTR DestinationName, DWORD CopyStyle, PSP_FILE_CALLBACK_W CopyMsgHandler, PVOID Context ) ;
+ALIAS: SetupInstallFile SetupInstallFileW
+
+FUNCTION: BOOL SetupInstallFileExA ( HINF InfHandle, PINFCONTEXT InfContext, PCSTR SourceFile, PCSTR SourcePathRoot, PCSTR DestinationName, DWORD CopyStyle, PSP_FILE_CALLBACK_A CopyMsgHandler, PVOID Context, PBOOL FileWasInUse ) ;
+FUNCTION: BOOL SetupInstallFileExW ( HINF InfHandle, PINFCONTEXT InfContext, PCWSTR SourceFile, PCWSTR SourcePathRoot, PCWSTR DestinationName, DWORD CopyStyle, PSP_FILE_CALLBACK_W CopyMsgHandler, PVOID Context, PBOOL FileWasInUse ) ;
+ALIAS: SetupInstallFileEx SetupInstallFileExW
+
+CONSTANT: SP_COPY_DELETESOURCE        HEX: 0000001
+CONSTANT: SP_COPY_REPLACEONLY         HEX: 0000002
+CONSTANT: SP_COPY_NEWER               HEX: 0000004
+CONSTANT: SP_COPY_NEWER_OR_SAME       $ SP_COPY_NEWER
+CONSTANT: SP_COPY_NOOVERWRITE         HEX: 0000008
+CONSTANT: SP_COPY_NODECOMP            HEX: 0000010
+CONSTANT: SP_COPY_LANGUAGEAWARE       HEX: 0000020
+CONSTANT: SP_COPY_SOURCE_ABSOLUTE     HEX: 0000040
+CONSTANT: SP_COPY_SOURCEPATH_ABSOLUTE HEX: 0000080
+CONSTANT: SP_COPY_IN_USE_NEEDS_REBOOT HEX: 0000100
+CONSTANT: SP_COPY_FORCE_IN_USE        HEX: 0000200
+CONSTANT: SP_COPY_NOSKIP              HEX: 0000400
+CONSTANT: SP_FLAG_CABINETCONTINUATION HEX: 0000800
+CONSTANT: SP_COPY_FORCE_NOOVERWRITE   HEX: 0001000
+CONSTANT: SP_COPY_FORCE_NEWER         HEX: 0002000
+CONSTANT: SP_COPY_WARNIFSKIP          HEX: 0004000
+CONSTANT: SP_COPY_NOBROWSE            HEX: 0008000
+CONSTANT: SP_COPY_NEWER_ONLY          HEX: 0010000
+CONSTANT: SP_COPY_RESERVED            HEX: 0020000
+CONSTANT: SP_COPY_OEMINF_CATALOG_ONLY HEX: 0040000
+CONSTANT: SP_COPY_REPLACE_BOOT_FILE   HEX: 0080000
+CONSTANT: SP_COPY_NOPRUNE             HEX: 0100000
+CONSTANT: SP_COPY_OEM_F6_INF          HEX: 0200000
+CONSTANT: SP_COPY_ALREADYDECOMP       HEX: 0400000
+CONSTANT: SP_COPY_WINDOWS_SIGNED      HEX: 1000000
+CONSTANT: SP_COPY_PNPLOCKED           HEX: 2000000
+CONSTANT: SP_COPY_IN_USE_TRY_RENAME   HEX: 4000000
+CONSTANT: SP_COPY_INBOX_INF           HEX: 8000000
+CONSTANT: SP_COPY_HARDLINK            HEX: 10000000
+
+CONSTANT: SP_BACKUP_BACKUPPASS        HEX: 00000001
+CONSTANT: SP_BACKUP_DEMANDPASS        HEX: 00000002
+CONSTANT: SP_BACKUP_SPECIAL           HEX: 00000004
+CONSTANT: SP_BACKUP_BOOTFILE          HEX: 00000008
+
+FUNCTION: HSPFILEQ SetupOpenFileQueue ( ) ;
+FUNCTION: BOOL SetupCloseFileQueue ( HSPFILEQ QueueHandle ) ;
+FUNCTION: BOOL SetupSetFileQueueAlternatePlatformA ( HSPFILEQ QueueHandle, PSP_ALTPLATFORM_INFO AlternatePlatformInfo, PCSTR AlternateDefaultCatalogFile ) ;
+FUNCTION: BOOL SetupSetFileQueueAlternatePlatformW ( HSPFILEQ QueueHandle, PSP_ALTPLATFORM_INFO AlternatePlatformInfo, PCWSTR AlternateDefaultCatalogFile ) ;
+ALIAS: SetupSetFileQueueAlternatePlatform SetupSetFileQueueAlternatePlatformW
+
+FUNCTION: BOOL SetupSetPlatformPathOverrideA ( PCSTR Override ) ;
+FUNCTION: BOOL SetupSetPlatformPathOverrideW ( PCWSTR Override ) ;
+ALIAS: SetupSetPlatformPathOverride SetupSetPlatformPathOverrideW
+
+FUNCTION: BOOL SetupQueueCopyA ( HSPFILEQ QueueHandle, PCSTR SourceRootPath, PCSTR SourcePath, PCSTR SourceFilename, PCSTR SourceDescription, PCSTR SourceTagfile, PCSTR TargetDirectory, PCSTR TargetFilename, DWORD CopyStyle ) ;
+FUNCTION: BOOL SetupQueueCopyW ( HSPFILEQ QueueHandle, PCWSTR SourceRootPath, PCWSTR SourcePath, PCWSTR SourceFilename, PCWSTR SourceDescription, PCWSTR SourceTagfile, PCWSTR TargetDirectory, PCWSTR TargetFilename, DWORD CopyStyle ) ;
+ALIAS: SetupQueueCopy SetupQueueCopyW
+
+FUNCTION: BOOL SetupQueueCopyIndirectA ( PSP_FILE_COPY_PARAMS_A CopyParams ) ;
+FUNCTION: BOOL SetupQueueCopyIndirectW ( PSP_FILE_COPY_PARAMS_W CopyParams ) ;
+ALIAS: SetupQueueCopyIndirect SetupQueueCopyIndirectW
+
+FUNCTION: BOOL SetupQueueDefaultCopyA ( HSPFILEQ QueueHandle, HINF InfHandle, PCSTR SourceRootPath, PCSTR SourceFilename, PCSTR TargetFilename, DWORD CopyStyle ) ;
+FUNCTION: BOOL SetupQueueDefaultCopyW ( HSPFILEQ QueueHandle, HINF InfHandle, PCWSTR SourceRootPath, PCWSTR SourceFilename, PCWSTR TargetFilename, DWORD CopyStyle ) ;
+ALIAS: SetupQueueDefaultCopy SetupQueueDefaultCopyW
+
+FUNCTION: BOOL SetupQueueCopySectionA ( HSPFILEQ QueueHandle, PCSTR SourceRootPath, HINF InfHandle, HINF ListInfHandle, PCSTR Section, DWORD CopyStyle ) ;
+FUNCTION: BOOL SetupQueueCopySectionW ( HSPFILEQ QueueHandle, PCWSTR SourceRootPath, HINF InfHandle, HINF ListInfHandle, PCWSTR Section, DWORD CopyStyle ) ;
+ALIAS: SetupQueueCopySection SetupQueueCopySectionW
+
+FUNCTION: BOOL SetupQueueDeleteA ( HSPFILEQ QueueHandle, PCSTR PathPart1, PCSTR PathPart2 ) ;
+FUNCTION: BOOL SetupQueueDeleteW ( HSPFILEQ QueueHandle, PCWSTR PathPart1, PCWSTR PathPart2 ) ;
+ALIAS: SetupQueueDelete SetupQueueDeleteW
+
+FUNCTION: BOOL SetupQueueDeleteSectionA ( HSPFILEQ QueueHandle, HINF InfHandle, HINF ListInfHandle, PCSTR Section ) ;
+FUNCTION: BOOL SetupQueueDeleteSectionW ( HSPFILEQ QueueHandle, HINF InfHandle, HINF ListInfHandle, PCWSTR Section ) ;
+ALIAS: SetupQueueDeleteSection SetupQueueDeleteSectionW
+
+FUNCTION: BOOL SetupQueueRenameA ( HSPFILEQ QueueHandle, PCSTR SourcePath, PCSTR SourceFilename, PCSTR TargetPath, PCSTR TargetFilename ) ;
+FUNCTION: BOOL SetupQueueRenameW ( HSPFILEQ QueueHandle, PCWSTR SourcePath, PCWSTR SourceFilename, PCWSTR TargetPath, PCWSTR TargetFilename ) ;
+ALIAS: SetupQueueRename SetupQueueRenameW
+
+FUNCTION: BOOL SetupQueueRenameSectionA ( HSPFILEQ QueueHandle, HINF InfHandle, HINF ListInfHandle, PCSTR Section ) ;
+FUNCTION: BOOL SetupQueueRenameSectionW ( HSPFILEQ QueueHandle, HINF InfHandle, HINF ListInfHandle, PCWSTR Section ) ;
+ALIAS: SetupQueueRenameSection SetupQueueRenameSectionW
+
+FUNCTION: BOOL SetupCommitFileQueueA ( HWND Owner, HSPFILEQ QueueHandle, PSP_FILE_CALLBACK_A MsgHandler, PVOID Context ) ;
+FUNCTION: BOOL SetupCommitFileQueueW ( HWND Owner, HSPFILEQ QueueHandle, PSP_FILE_CALLBACK_W MsgHandler, PVOID Context ) ;
+ALIAS: SetupCommitFileQueue SetupCommitFileQueueW
+
+FUNCTION: BOOL SetupScanFileQueueA ( HSPFILEQ FileQueue, DWORD Flags, HWND Window, PSP_FILE_CALLBACK_A CallbackRoutine, PVOID CallbackContext, PDWORD Result ) ;
+FUNCTION: BOOL SetupScanFileQueueW ( HSPFILEQ FileQueue, DWORD Flags, HWND Window, PSP_FILE_CALLBACK_W CallbackRoutine, PVOID CallbackContext, PDWORD Result ) ;
+ALIAS: SetupScanFileQueue SetupScanFileQueueW
+
+CONSTANT: SPQ_SCAN_FILE_PRESENCE                  HEX: 00000001
+CONSTANT: SPQ_SCAN_FILE_VALIDITY                  HEX: 00000002
+CONSTANT: SPQ_SCAN_USE_CALLBACK                   HEX: 00000004
+CONSTANT: SPQ_SCAN_USE_CALLBACKEX                 HEX: 00000008
+CONSTANT: SPQ_SCAN_INFORM_USER                    HEX: 00000010
+CONSTANT: SPQ_SCAN_PRUNE_COPY_QUEUE               HEX: 00000020
+CONSTANT: SPQ_SCAN_USE_CALLBACK_SIGNERINFO        HEX: 00000040
+CONSTANT: SPQ_SCAN_PRUNE_DELREN                   HEX: 00000080
+CONSTANT: SPQ_SCAN_FILE_PRESENCE_WITHOUT_SOURCE   HEX: 00000100
+CONSTANT: SPQ_SCAN_FILE_COMPARISON                HEX: 00000200
+CONSTANT: SPQ_SCAN_ACTIVATE_DRP                   HEX: 00000400
+CONSTANT: SPQ_DELAYED_COPY                        HEX: 00000001
+
+FUNCTION: BOOL SetupGetFileQueueCount ( HSPFILEQ FileQueue, UINT SubQueueFileOp, PUINT NumOperations ) ;
+FUNCTION: BOOL SetupGetFileQueueFlags ( HSPFILEQ FileQueue, PDWORD Flags ) ;
+FUNCTION: BOOL SetupSetFileQueueFlags ( HSPFILEQ FileQueue, DWORD FlagMask, DWORD Flags ) ;
+
+CONSTANT: SPQ_FLAG_BACKUP_AWARE      HEX: 00000001
+CONSTANT: SPQ_FLAG_ABORT_IF_UNSIGNED HEX: 00000002
+CONSTANT: SPQ_FLAG_FILES_MODIFIED    HEX: 00000004
+CONSTANT: SPQ_FLAG_DO_SHUFFLEMOVE    HEX: 00000008
+CONSTANT: SPQ_FLAG_VALID             HEX: 0000000F
+
+CONSTANT: SPOST_NONE  0
+CONSTANT: SPOST_PATH  1
+CONSTANT: SPOST_URL   2
+CONSTANT: SPOST_MAX   3
+
+FUNCTION: BOOL SetupCopyOEMInfA ( PCSTR SourceInfFileName, PCSTR OEMSourceMediaLocation, DWORD OEMSourceMediaType, DWORD CopyStyle, PSTR DestinationInfFileName, DWORD DestinationInfFileNameSize, PDWORD RequiredSize, PSTR* DestinationInfFileNameComponent ) ;
+FUNCTION: BOOL SetupCopyOEMInfW ( PCWSTR SourceInfFileName, PCWSTR OEMSourceMediaLocation, DWORD OEMSourceMediaType, DWORD CopyStyle, PWSTR DestinationInfFileName, DWORD DestinationInfFileNameSize, PDWORD RequiredSize, PWSTR* DestinationInfFileNameComponent ) ;
+ALIAS: SetupCopyOEMInf SetupCopyOEMInfW
+
+CONSTANT: SUOI_FORCEDELETE   HEX: 00000001
+CONSTANT: SUOI_INTERNAL1     HEX: 00000002
+
+FUNCTION: BOOL SetupUninstallOEMInfA ( PCSTR InfFileName, DWORD Flags, PVOID Reserved ) ;
+FUNCTION: BOOL SetupUninstallOEMInfW ( PCWSTR InfFileName, DWORD Flags, PVOID Reserved ) ;
+ALIAS: SetupUninstallOEMInf SetupUninstallOEMInfW
+
+FUNCTION: BOOL SetupUninstallNewlyCopiedInfs( HSPFILEQ FileQueue, DWORD Flags, PVOID Reserved ) ;
+
+FUNCTION: HDSKSPC SetupCreateDiskSpaceListA ( PVOID Reserved1, DWORD Reserved2, UINT Flags ) ;
+FUNCTION: HDSKSPC SetupCreateDiskSpaceListW ( PVOID Reserved1, DWORD Reserved2, UINT Flags ) ;
+ALIAS: SetupCreateDiskSpaceList SetupCreateDiskSpaceListW
+
+CONSTANT: SPDSL_IGNORE_DISK              HEX: 00000001
+CONSTANT: SPDSL_DISALLOW_NEGATIVE_ADJUST HEX: 00000002
+
+FUNCTION: HDSKSPC SetupDuplicateDiskSpaceListA ( HDSKSPC DiskSpace, PVOID Reserved1, DWORD Reserved2, UINT Flags ) ;
+FUNCTION: HDSKSPC SetupDuplicateDiskSpaceListW ( HDSKSPC DiskSpace, PVOID Reserved1, DWORD Reserved2, UINT Flags ) ;
+ALIAS: SetupDuplicateDiskSpaceList SetupDuplicateDiskSpaceListW
+
+FUNCTION: BOOL SetupDestroyDiskSpaceList( HDSKSPC DiskSpace ) ;
+FUNCTION: BOOL SetupQueryDrivesInDiskSpaceListA ( HDSKSPC DiskSpace, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupQueryDrivesInDiskSpaceListW ( HDSKSPC DiskSpace, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupQueryDrivesInDiskSpaceList SetupQueryDrivesInDiskSpaceListW
+
+FUNCTION: BOOL SetupQuerySpaceRequiredOnDriveA ( HDSKSPC DiskSpace, PCSTR DriveSpec, LONGLONG* SpaceRequired, PVOID Reserved1, UINT Reserved2 ) ;
+FUNCTION: BOOL SetupQuerySpaceRequiredOnDriveW ( HDSKSPC DiskSpace, PCWSTR DriveSpec, LONGLONG* SpaceRequired, PVOID Reserved1, UINT Reserved2 ) ;
+ALIAS: SetupQuerySpaceRequiredOnDrive SetupQuerySpaceRequiredOnDriveW
+
+FUNCTION: BOOL SetupAdjustDiskSpaceListA ( HDSKSPC DiskSpace, LPCSTR DriveRoot, LONGLONG Amount, PVOID Reserved1, UINT Reserved2 ) ;
+FUNCTION: BOOL SetupAdjustDiskSpaceListW ( HDSKSPC DiskSpace, LPCWSTR DriveRoot, LONGLONG Amount, PVOID Reserved1, UINT Reserved2 ) ;
+ALIAS: SetupAdjustDiskSpaceList SetupAdjustDiskSpaceListW
+
+FUNCTION: BOOL SetupAddToDiskSpaceListA ( HDSKSPC DiskSpace, PCSTR TargetFilespec, LONGLONG FileSize, UINT Operation, PVOID Reserved1, UINT Reserved2 ) ;
+FUNCTION: BOOL SetupAddToDiskSpaceListW ( HDSKSPC DiskSpace, PCWSTR TargetFilespec, LONGLONG FileSize, UINT Operation, PVOID Reserved1, UINT Reserved2 ) ;
+ALIAS: SetupAddToDiskSpaceList SetupAddToDiskSpaceListW
+
+FUNCTION: BOOL SetupAddSectionToDiskSpaceListA ( HDSKSPC DiskSpace, HINF InfHandle, HINF ListInfHandle, PCSTR SectionName, UINT Operation, PVOID Reserved1, UINT Reserved2 ) ;
+FUNCTION: BOOL SetupAddSectionToDiskSpaceListW ( HDSKSPC DiskSpace, HINF InfHandle, HINF ListInfHandle, PCWSTR SectionName, UINT Operation, PVOID Reserved1, UINT Reserved2 ) ;
+ALIAS: SetupAddSectionToDiskSpaceList SetupAddSectionToDiskSpaceListW
+
+FUNCTION: BOOL SetupAddInstallSectionToDiskSpaceListA ( HDSKSPC DiskSpace, HINF InfHandle, HINF LayoutInfHandle, PCSTR SectionName, PVOID Reserved1, UINT Reserved2 ) ;
+FUNCTION: BOOL SetupAddInstallSectionToDiskSpaceListW ( HDSKSPC DiskSpace, HINF InfHandle, HINF LayoutInfHandle, PCWSTR SectionName, PVOID Reserved1, UINT Reserved2 ) ;
+ALIAS: SetupAddInstallSectionToDiskSpaceList SetupAddInstallSectionToDiskSpaceListW
+
+FUNCTION: BOOL SetupRemoveFromDiskSpaceListA ( HDSKSPC DiskSpace, PCSTR TargetFilespec, UINT Operation, PVOID Reserved1, UINT Reserved2 ) ;
+FUNCTION: BOOL SetupRemoveFromDiskSpaceListW ( HDSKSPC DiskSpace, PCWSTR TargetFilespec, UINT Operation, PVOID Reserved1, UINT Reserved2 ) ;
+ALIAS: SetupRemoveFromDiskSpaceList SetupRemoveFromDiskSpaceListW
+
+FUNCTION: BOOL SetupRemoveSectionFromDiskSpaceListA ( HDSKSPC DiskSpace, HINF InfHandle, HINF ListInfHandle, PCSTR SectionName, UINT Operation, PVOID Reserved1, UINT Reserved2 ) ;
+FUNCTION: BOOL SetupRemoveSectionFromDiskSpaceListW ( HDSKSPC DiskSpace, HINF InfHandle, HINF ListInfHandle, PCWSTR SectionName, UINT Operation, PVOID Reserved1, UINT Reserved2 ) ;
+ALIAS: SetupRemoveSectionFromDiskSpaceList SetupRemoveSectionFromDiskSpaceListW
+
+FUNCTION: BOOL SetupRemoveInstallSectionFromDiskSpaceListA ( HDSKSPC DiskSpace, HINF InfHandle, HINF LayoutInfHandle, PCSTR SectionName, PVOID Reserved1, UINT Reserved2 ) ;
+FUNCTION: BOOL SetupRemoveInstallSectionFromDiskSpaceListW ( HDSKSPC DiskSpace, HINF InfHandle, HINF LayoutInfHandle, PCWSTR SectionName, PVOID Reserved1, UINT Reserved2 ) ;
+ALIAS: SetupRemoveInstallSectionFromDiskSpaceList SetupRemoveInstallSectionFromDiskSpaceListW
+
+FUNCTION: BOOL SetupIterateCabinetA ( PCSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_A MsgHandler, PVOID Context ) ;
+FUNCTION: BOOL SetupIterateCabinetW ( PCWSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_W MsgHandler, PVOID Context ) ;
+ALIAS: SetupIterateCabinet SetupIterateCabinetW
+
+FUNCTION: INT SetupPromptReboot ( HSPFILEQ FileQueue, HWND Owner, BOOL ScanOnly ) ;
+
+CONSTANT: SPFILEQ_FILE_IN_USE         HEX: 00000001
+CONSTANT: SPFILEQ_REBOOT_RECOMMENDED  HEX: 00000002
+CONSTANT: SPFILEQ_REBOOT_IN_PROGRESS  HEX: 00000004
+
+FUNCTION: PVOID SetupInitDefaultQueueCallback ( HWND OwnerWindow ) ;
+FUNCTION: PVOID SetupInitDefaultQueueCallbackEx ( HWND OwnerWindow, HWND AlternateProgressWindow, UINT ProgressMessage, DWORD Reserved1, PVOID Reserved2 ) ;
+FUNCTION: void SetupTermDefaultQueueCallback ( PVOID Context ) ;
+
+FUNCTION: UINT SetupDefaultQueueCallbackA ( PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2 ) ;
+FUNCTION: UINT SetupDefaultQueueCallbackW ( PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2 ) ;
+ALIAS: SetupDefaultQueueCallback SetupDefaultQueueCallbackW
+
+CONSTANT: FLG_ADDREG_DELREG_BIT       HEX: 00008000
+CONSTANT: FLG_ADDREG_BINVALUETYPE     HEX: 00000001
+CONSTANT: FLG_ADDREG_NOCLOBBER        HEX: 00000002
+CONSTANT: FLG_ADDREG_DELVAL           HEX: 00000004
+CONSTANT: FLG_ADDREG_APPEND           HEX: 00000008
+CONSTANT: FLG_ADDREG_KEYONLY          HEX: 00000010
+CONSTANT: FLG_ADDREG_OVERWRITEONLY    HEX: 00000020
+CONSTANT: FLG_ADDREG_64BITKEY         HEX: 00001000
+CONSTANT: FLG_ADDREG_KEYONLY_COMMON   HEX: 00002000
+CONSTANT: FLG_ADDREG_32BITKEY         HEX: 00004000
+CONSTANT: FLG_ADDREG_TYPE_MASK        HEX: FFFF0001
+CONSTANT: FLG_ADDREG_TYPE_SZ          HEX: 00000000
+CONSTANT: FLG_ADDREG_TYPE_MULTI_SZ    HEX: 00010000
+CONSTANT: FLG_ADDREG_TYPE_EXPAND_SZ   HEX: 00020000
+CONSTANT: FLG_ADDREG_TYPE_BINARY      HEX: 00000001
+CONSTANT: FLG_ADDREG_TYPE_DWORD       HEX: 00010001
+CONSTANT: FLG_ADDREG_TYPE_NONE        HEX: 00020001
+CONSTANT: FLG_DELREG_VALUE            HEX: 00000000
+CONSTANT: FLG_DELREG_TYPE_MASK        $ FLG_ADDREG_TYPE_MASK
+CONSTANT: FLG_DELREG_TYPE_SZ          $ FLG_ADDREG_TYPE_SZ
+CONSTANT: FLG_DELREG_TYPE_MULTI_SZ    $ FLG_ADDREG_TYPE_MULTI_SZ
+CONSTANT: FLG_DELREG_TYPE_EXPAND_SZ   $ FLG_ADDREG_TYPE_EXPAND_SZ
+CONSTANT: FLG_DELREG_TYPE_BINARY      $ FLG_ADDREG_TYPE_BINARY
+CONSTANT: FLG_DELREG_TYPE_DWORD       $ FLG_ADDREG_TYPE_DWORD
+CONSTANT: FLG_DELREG_TYPE_NONE        $ FLG_ADDREG_TYPE_NONE
+CONSTANT: FLG_DELREG_64BITKEY         $ FLG_ADDREG_64BITKEY
+CONSTANT: FLG_DELREG_KEYONLY_COMMON   $ FLG_ADDREG_KEYONLY_COMMON
+CONSTANT: FLG_DELREG_32BITKEY         $ FLG_ADDREG_32BITKEY
+CONSTANT: FLG_DELREG_OPERATION_MASK   HEX: 000000FE
+CONSTANT: FLG_DELREG_MULTI_SZ_DELSTRING HEX: 00018002
+CONSTANT: FLG_BITREG_CLEARBITS        HEX: 00000000
+CONSTANT: FLG_BITREG_SETBITS          HEX: 00000001
+CONSTANT: FLG_BITREG_64BITKEY         HEX: 00001000
+CONSTANT: FLG_BITREG_32BITKEY         HEX: 00004000
+CONSTANT: FLG_INI2REG_64BITKEY        HEX: 00001000
+CONSTANT: FLG_INI2REG_32BITKEY        HEX: 00004000
+CONSTANT: FLG_REGSVR_DLLREGISTER      HEX: 00000001
+CONSTANT: FLG_REGSVR_DLLINSTALL       HEX: 00000002
+CONSTANT: FLG_PROFITEM_CURRENTUSER    HEX: 00000001
+CONSTANT: FLG_PROFITEM_DELETE         HEX: 00000002
+CONSTANT: FLG_PROFITEM_GROUP          HEX: 00000004
+CONSTANT: FLG_PROFITEM_CSIDL          HEX: 00000008
+CONSTANT: FLG_ADDPROPERTY_NOCLOBBER       HEX: 00000001
+CONSTANT: FLG_ADDPROPERTY_OVERWRITEONLY   HEX: 00000002
+CONSTANT: FLG_ADDPROPERTY_APPEND          HEX: 00000004
+CONSTANT: FLG_ADDPROPERTY_OR              HEX: 00000008
+CONSTANT: FLG_ADDPROPERTY_AND             HEX: 00000010
+CONSTANT: FLG_DELPROPERTY_MULTI_SZ_DELSTRING  HEX: 00000001
+
+FUNCTION: BOOL SetupInstallFromInfSectionA ( HWND Owner, HINF InfHandle, PCSTR SectionName, UINT Flags, HKEY RelativeKeyRoot, PCSTR SourceRootPath, UINT CopyFlags, PSP_FILE_CALLBACK_A MsgHandler, PVOID Context, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupInstallFromInfSectionW ( HWND Owner, HINF InfHandle, PCWSTR SectionName, UINT Flags, HKEY RelativeKeyRoot, PCWSTR SourceRootPath, UINT CopyFlags, PSP_FILE_CALLBACK_W MsgHandler, PVOID Context, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+ALIAS: SetupInstallFromInfSection SetupInstallFromInfSectionW
+
+CONSTANT: SPINST_LOGCONFIG                HEX: 00000001
+CONSTANT: SPINST_INIFILES                 HEX: 00000002
+CONSTANT: SPINST_REGISTRY                 HEX: 00000004
+CONSTANT: SPINST_INI2REG                  HEX: 00000008
+CONSTANT: SPINST_FILES                    HEX: 00000010
+CONSTANT: SPINST_BITREG                   HEX: 00000020
+CONSTANT: SPINST_REGSVR                   HEX: 00000040
+CONSTANT: SPINST_UNREGSVR                 HEX: 00000080
+CONSTANT: SPINST_PROFILEITEMS             HEX: 00000100
+CONSTANT: SPINST_COPYINF                  HEX: 00000200
+CONSTANT: SPINST_PROPERTIES               HEX: 00000400
+CONSTANT: SPINST_ALL                      HEX: 000007ff
+CONSTANT: SPINST_SINGLESECTION            HEX: 00010000
+CONSTANT: SPINST_LOGCONFIG_IS_FORCED      HEX: 00020000
+CONSTANT: SPINST_LOGCONFIGS_ARE_OVERRIDES HEX: 00040000
+CONSTANT: SPINST_REGISTERCALLBACKAWARE    HEX: 00080000
+CONSTANT: SPINST_DEVICEINSTALL            HEX: 00100000
+
+FUNCTION: BOOL SetupInstallFilesFromInfSectionA ( HINF InfHandle, HINF LayoutInfHandle, HSPFILEQ FileQueue, PCSTR SectionName, PCSTR SourceRootPath, UINT CopyFlags ) ;
+FUNCTION: BOOL SetupInstallFilesFromInfSectionW ( HINF InfHandle, HINF LayoutInfHandle, HSPFILEQ FileQueue, PCWSTR SectionName, PCWSTR SourceRootPath, UINT CopyFlags ) ;
+ALIAS: SetupInstallFilesFromInfSection SetupInstallFilesFromInfSectionW
+
+CONSTANT: SPSVCINST_TAGTOFRONT                   HEX: 00000001
+CONSTANT: SPSVCINST_ASSOCSERVICE                 HEX: 00000002
+CONSTANT: SPSVCINST_DELETEEVENTLOGENTRY          HEX: 00000004
+CONSTANT: SPSVCINST_NOCLOBBER_DISPLAYNAME        HEX: 00000008
+CONSTANT: SPSVCINST_NOCLOBBER_STARTTYPE          HEX: 00000010
+CONSTANT: SPSVCINST_NOCLOBBER_ERRORCONTROL       HEX: 00000020
+CONSTANT: SPSVCINST_NOCLOBBER_LOADORDERGROUP     HEX: 00000040
+CONSTANT: SPSVCINST_NOCLOBBER_DEPENDENCIES       HEX: 00000080
+CONSTANT: SPSVCINST_NOCLOBBER_DESCRIPTION        HEX: 00000100
+CONSTANT: SPSVCINST_STOPSERVICE                  HEX: 00000200
+CONSTANT: SPSVCINST_CLOBBER_SECURITY             HEX: 00000400
+CONSTANT: SPSVCINST_STARTSERVICE                 HEX: 00000800
+CONSTANT: SPSVCINST_NOCLOBBER_REQUIREDPRIVILEGES HEX: 00001000
+
+FUNCTION: BOOL SetupInstallServicesFromInfSectionA ( HINF InfHandle, PCSTR SectionName, DWORD Flags ) ;
+FUNCTION: BOOL SetupInstallServicesFromInfSectionW ( HINF InfHandle, PCWSTR SectionName, DWORD Flags ) ;
+ALIAS: SetupInstallServicesFromInfSection SetupInstallServicesFromInfSectionW
+
+FUNCTION: BOOL SetupInstallServicesFromInfSectionExA ( HINF InfHandle, PCSTR SectionName, DWORD Flags, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PVOID Reserved1, PVOID Reserved2 ) ;
+FUNCTION: BOOL SetupInstallServicesFromInfSectionExW ( HINF InfHandle, PCWSTR SectionName, DWORD Flags, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PVOID Reserved1, PVOID Reserved2 ) ;
+ALIAS: SetupInstallServicesFromInfSectionEx SetupInstallServicesFromInfSectionExW
+
+FUNCTION: void InstallHinfSectionA ( HWND Window, HINSTANCE ModuleHandle, PCSTR CommandLine, INT ShowCommand ) ;
+FUNCTION: void InstallHinfSectionW ( HWND Window, HINSTANCE ModuleHandle, PCWSTR CommandLine, INT ShowCommand ) ;
+ALIAS: InstallHinfSection InstallHinfSectionW
+
+TYPEDEF: PVOID HSPFILELOG
+
+FUNCTION: HSPFILELOG SetupInitializeFileLogA ( PCSTR LogFileName, DWORD Flags ) ;
+FUNCTION: HSPFILELOG SetupInitializeFileLogW ( PCWSTR LogFileName, DWORD Flags ) ;
+ALIAS: SetupInitializeFileLog SetupInitializeFileLogW
+
+CONSTANT: SPFILELOG_SYSTEMLOG     HEX: 00000001
+CONSTANT: SPFILELOG_FORCENEW      HEX: 00000002
+CONSTANT: SPFILELOG_QUERYONLY     HEX: 00000004
+
+FUNCTION: BOOL SetupTerminateFileLog ( HSPFILELOG FileLogHandle ) ;
+FUNCTION: BOOL SetupLogFileA ( HSPFILELOG FileLogHandle, PCSTR LogSectionName, PCSTR SourceFilename, PCSTR TargetFilename, DWORD Checksum, PCSTR DiskTagfile, PCSTR DiskDescription, PCSTR OtherInfo, DWORD Flags ) ;
+FUNCTION: BOOL SetupLogFileW ( HSPFILELOG FileLogHandle, PCWSTR LogSectionName, PCWSTR SourceFilename, PCWSTR TargetFilename, DWORD Checksum, PCWSTR DiskTagfile, PCWSTR DiskDescription, PCWSTR OtherInfo, DWORD Flags ) ;
+ALIAS: SetupLogFile SetupLogFileW
+
+CONSTANT: SPFILELOG_OEMFILE   HEX: 00000001
+FUNCTION: BOOL SetupRemoveFileLogEntryA ( HSPFILELOG FileLogHandle, PCSTR LogSectionName, PCSTR TargetFilename ) ;
+FUNCTION: BOOL SetupRemoveFileLogEntryW ( HSPFILELOG FileLogHandle, PCWSTR LogSectionName, PCWSTR TargetFilename ) ;
+ALIAS: SetupRemoveFileLogEntry SetupRemoveFileLogEntryW
+
+ENUM: SetupFileLogInfo
+    SetupFileLogSourceFilename
+    SetupFileLogChecksum
+    SetupFileLogDiskTagfile
+    SetupFileLogDiskDescription
+    SetupFileLogOtherInfo
+    SetupFileLogMax ;
+
+FUNCTION: BOOL SetupQueryFileLogA ( HSPFILELOG FileLogHandle, PCSTR LogSectionName, PCSTR TargetFilename, SetupFileLogInfo DesiredInfo, PSTR DataOut, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupQueryFileLogW ( HSPFILELOG FileLogHandle, PCWSTR LogSectionName, PCWSTR TargetFilename, SetupFileLogInfo DesiredInfo, PWSTR DataOut, DWORD ReturnBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupQueryFileLog SetupQueryFileLogW
+
+TYPEDEF: DWORD LogSeverity
+CONSTANT: LogSevInformation           HEX: 00000000
+CONSTANT: LogSevWarning               HEX: 00000001
+CONSTANT: LogSevError                 HEX: 00000002
+CONSTANT: LogSevFatalError            HEX: 00000003
+CONSTANT: LogSevMaximum               HEX: 00000004
+
+FUNCTION: BOOL SetupOpenLog ( BOOL Erase ) ;
+FUNCTION: BOOL SetupLogErrorA ( LPCSTR MessageString, LogSeverity Severity ) ;
+FUNCTION: BOOL SetupLogErrorW ( LPCWSTR MessageString, LogSeverity Severity ) ;
+ALIAS: SetupLogError SetupLogErrorW
+
+FUNCTION: void SetupCloseLog ( ) ;
+FUNCTION: SP_LOG_TOKEN SetupGetThreadLogToken ( ) ;
+FUNCTION: void SetupSetThreadLogToken ( SP_LOG_TOKEN LogToken ) ;
+! Unavailable until FFI to vargargs is supported.
+! FUNCTION: void SetupWriteTextLog ( SP_LOG_TOKEN LogToken, DWORD Category, DWORD Flags, PCSTR MessageStr, ... ) ;
+! FUNCTION: void SetupWriteTextLogError ( SP_LOG_TOKEN LogToken, DWORD Category, DWORD LogFlags, DWORD Error, PCSTR MessageStr, ... ) ;
+FUNCTION: void SetupWriteTextLogInfLine ( SP_LOG_TOKEN LogToken, DWORD Flags, HINF InfHandle, PINFCONTEXT Context ) ;
+
+FUNCTION: BOOL SetupGetBackupInformationA ( HSPFILEQ QueueHandle, PSP_BACKUP_QUEUE_PARAMS_A BackupParams ) ;
+FUNCTION: BOOL SetupGetBackupInformationW ( HSPFILEQ QueueHandle, PSP_BACKUP_QUEUE_PARAMS_W BackupParams ) ;
+ALIAS: SetupGetBackupInformation SetupGetBackupInformationW
+
+FUNCTION: BOOL SetupPrepareQueueForRestoreA ( HSPFILEQ QueueHandle, PCSTR BackupPath, DWORD RestoreFlags ) ;
+FUNCTION: BOOL SetupPrepareQueueForRestoreW ( HSPFILEQ QueueHandle, PCWSTR BackupPath, DWORD RestoreFlags ) ;
+ALIAS: SetupPrepareQueueForRestore SetupPrepareQueueForRestoreW
+
+FUNCTION: BOOL SetupSetNonInteractiveMode ( BOOL NonInteractiveFlag ) ;
+FUNCTION: BOOL SetupGetNonInteractiveMode ( ) ;
+
+FUNCTION: HDEVINFO SetupDiCreateDeviceInfoList ( GUID* ClassGuid, HWND hwndParent ) ;
+FUNCTION: HDEVINFO SetupDiCreateDeviceInfoListExA ( GUID* ClassGuid, HWND hwndParent, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: HDEVINFO SetupDiCreateDeviceInfoListExW ( GUID* ClassGuid, HWND hwndParent, PCWSTR MachineName, PVOID Reserved ) ;
+
+ALIAS: SetupDiCreateDeviceInfoListEx SetupDiCreateDeviceInfoListExW
+
+FUNCTION: BOOL SetupDiGetDeviceInfoListClass( HDEVINFO DeviceInfoSet, LPGUID ClassGuid ) ;
+FUNCTION: BOOL SetupDiGetDeviceInfoListDetailA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_LIST_DETAIL_DATA_A DeviceInfoSetDetailData ) ;
+FUNCTION: BOOL SetupDiGetDeviceInfoListDetailW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_LIST_DETAIL_DATA_W DeviceInfoSetDetailData ) ;
+ALIAS: SetupDiGetDeviceInfoListDetail SetupDiGetDeviceInfoListDetailW
+
+CONSTANT: DICD_GENERATE_ID        HEX: 00000001
+CONSTANT: DICD_INHERIT_CLASSDRVS  HEX: 00000002
+
+FUNCTION: BOOL SetupDiCreateDeviceInfoA ( HDEVINFO DeviceInfoSet, PCSTR DeviceName, GUID* ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiCreateDeviceInfoW ( HDEVINFO DeviceInfoSet, PCWSTR DeviceName, GUID* ClassGuid, PCWSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData ) ;
+ALIAS: SetupDiCreateDeviceInfo SetupDiCreateDeviceInfoW
+
+CONSTANT: DIOD_INHERIT_CLASSDRVS  HEX: 00000002
+CONSTANT: DIOD_CANCEL_REMOVE      HEX: 00000004
+
+FUNCTION: BOOL SetupDiOpenDeviceInfoA ( HDEVINFO DeviceInfoSet, PCSTR DeviceInstanceId, HWND hwndParent, DWORD OpenFlags, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiOpenDeviceInfoW ( HDEVINFO DeviceInfoSet, PCWSTR DeviceInstanceId, HWND hwndParent, DWORD OpenFlags, PSP_DEVINFO_DATA DeviceInfoData ) ;
+ALIAS: SetupDiOpenDeviceInfo SetupDiOpenDeviceInfoW
+
+FUNCTION: BOOL SetupDiGetDeviceInstanceIdA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiGetDeviceInstanceIdW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PWSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize ) ;
+ALIAS: SetupDiGetDeviceInstanceId SetupDiGetDeviceInstanceIdW
+
+FUNCTION: BOOL SetupDiDeleteDeviceInfo ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiEnumDeviceInfo ( HDEVINFO DeviceInfoSet, DWORD MemberIndex, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiDestroyDeviceInfoList ( HDEVINFO DeviceInfoSet ) ;
+FUNCTION: BOOL SetupDiEnumDeviceInterfaces ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, GUID* InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData ) ;
+ALIAS: SetupDiEnumInterfaceDevice SetupDiEnumDeviceInterfaces
+
+FUNCTION: BOOL SetupDiCreateDeviceInterfaceA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, GUID* InterfaceClassGuid, PCSTR ReferenceString, DWORD CreationFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData ) ;
+FUNCTION: BOOL SetupDiCreateDeviceInterfaceW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, GUID* InterfaceClassGuid, PCWSTR ReferenceString, DWORD CreationFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData ) ;
+ALIAS: SetupDiCreateDeviceInterface SetupDiCreateDeviceInterfaceW
+
+ALIAS: SetupDiCreateInterfaceDeviceW SetupDiCreateDeviceInterfaceW
+ALIAS: SetupDiCreateInterfaceDeviceA SetupDiCreateDeviceInterfaceA
+
+ALIAS: SetupDiCreateInterfaceDevice SetupDiCreateDeviceInterfaceW
+
+CONSTANT: DIODI_NO_ADD    HEX: 00000001
+
+FUNCTION: BOOL SetupDiOpenDeviceInterfaceA ( HDEVINFO DeviceInfoSet, PCSTR DevicePath, DWORD OpenFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData ) ;
+FUNCTION: BOOL SetupDiOpenDeviceInterfaceW ( HDEVINFO DeviceInfoSet, PCWSTR DevicePath, DWORD OpenFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData ) ;
+ALIAS: SetupDiOpenDeviceInterface SetupDiOpenDeviceInterfaceW
+
+ALIAS: SetupDiOpenInterfaceDeviceW SetupDiOpenDeviceInterfaceW
+ALIAS: SetupDiOpenInterfaceDeviceA SetupDiOpenDeviceInterfaceA
+
+ALIAS: SetupDiOpenInterfaceDevice SetupDiOpenDeviceInterfaceW
+
+FUNCTION: BOOL SetupDiGetDeviceInterfaceAlias ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, GUID* AliasInterfaceClassGuid, PSP_DEVICE_INTERFACE_DATA AliasDeviceInterfaceData ) ;
+ALIAS: SetupDiGetInterfaceDeviceAlias SetupDiGetDeviceInterfaceAlias
+
+FUNCTION: BOOL SetupDiDeleteDeviceInterfaceData ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData ) ;
+ALIAS: SetupDiDeleteInterfaceDeviceData SetupDiDeleteDeviceInterfaceData
+
+FUNCTION: BOOL SetupDiRemoveDeviceInterface ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData ) ;
+ALIAS: SetupDiRemoveInterfaceDevice SetupDiRemoveDeviceInterface
+
+FUNCTION: BOOL SetupDiGetDeviceInterfaceDetailA ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_A DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiGetDeviceInterfaceDetailW ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData ) ;
+ALIAS: SetupDiGetDeviceInterfaceDetail SetupDiGetDeviceInterfaceDetailW
+
+ALIAS: SetupDiGetInterfaceDeviceDetailW SetupDiGetDeviceInterfaceDetailW
+ALIAS: SetupDiGetInterfaceDeviceDetailA SetupDiGetDeviceInterfaceDetailA
+
+ALIAS: SetupDiGetInterfaceDeviceDetail SetupDiGetDeviceInterfaceDetailW
+
+FUNCTION: BOOL SetupDiInstallDeviceInterfaces ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+ALIAS: SetupDiInstallInterfaceDevices SetupDiInstallDeviceInterfaces
+
+FUNCTION: BOOL SetupDiSetDeviceInterfaceDefault ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Flags, PVOID Reserved ) ;
+
+CONSTANT: SPRDI_FIND_DUPS        HEX: 00000001
+
+FUNCTION: BOOL SetupDiRegisterDeviceInfo ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Flags, PSP_DETSIG_CMPPROC CompareProc, PVOID CompareContext, PSP_DEVINFO_DATA DupDeviceInfoData ) ;
+
+CONSTANT: SPDIT_NODRIVER           HEX: 00000000
+CONSTANT: SPDIT_CLASSDRIVER        HEX: 00000001
+CONSTANT: SPDIT_COMPATDRIVER       HEX: 00000002
+
+FUNCTION: BOOL SetupDiBuildDriverInfoList ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType ) ;
+FUNCTION: BOOL SetupDiCancelDriverInfoSearch ( HDEVINFO DeviceInfoSet ) ;
+FUNCTION: BOOL SetupDiEnumDriverInfoA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType, DWORD MemberIndex, PSP_DRVINFO_DATA_A DriverInfoData ) ;
+FUNCTION: BOOL SetupDiEnumDriverInfoW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType, DWORD MemberIndex, PSP_DRVINFO_DATA_W DriverInfoData ) ;
+ALIAS: SetupDiEnumDriverInfo SetupDiEnumDriverInfoW
+
+FUNCTION: BOOL SetupDiGetSelectedDriverA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DRVINFO_DATA_A DriverInfoData ) ;
+FUNCTION: BOOL SetupDiGetSelectedDriverW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DRVINFO_DATA_W DriverInfoData ) ;
+ALIAS: SetupDiGetSelectedDriver SetupDiGetSelectedDriverW
+
+FUNCTION: BOOL SetupDiSetSelectedDriverA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DRVINFO_DATA_A DriverInfoData ) ;
+FUNCTION: BOOL SetupDiSetSelectedDriverW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DRVINFO_DATA_W DriverInfoData ) ;
+ALIAS: SetupDiSetSelectedDriver SetupDiSetSelectedDriverW
+
+FUNCTION: BOOL SetupDiGetDriverInfoDetailA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DRVINFO_DATA_A DriverInfoData, PSP_DRVINFO_DETAIL_DATA_A DriverInfoDetailData, DWORD DriverInfoDetailDataSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiGetDriverInfoDetailW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DRVINFO_DATA_W DriverInfoData, PSP_DRVINFO_DETAIL_DATA_W DriverInfoDetailData, DWORD DriverInfoDetailDataSize, PDWORD RequiredSize ) ;
+ALIAS: SetupDiGetDriverInfoDetail SetupDiGetDriverInfoDetailW
+
+FUNCTION: BOOL SetupDiDestroyDriverInfoList ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType ) ;
+
+CONSTANT: DIGCF_DEFAULT           HEX: 00000001
+CONSTANT: DIGCF_PRESENT           HEX: 00000002
+CONSTANT: DIGCF_ALLCLASSES        HEX: 00000004
+CONSTANT: DIGCF_PROFILE           HEX: 00000008
+CONSTANT: DIGCF_DEVICEINTERFACE   HEX: 00000010
+CONSTANT: DIGCF_INTERFACEDEVICE   $ DIGCF_DEVICEINTERFACE
+
+FUNCTION: HDEVINFO SetupDiGetClassDevsA ( GUID* ClassGuid, PCSTR Enumerator, HWND hwndParent, DWORD Flags ) ;
+FUNCTION: HDEVINFO SetupDiGetClassDevsW ( GUID* ClassGuid, PCWSTR Enumerator, HWND hwndParent, DWORD Flags ) ;
+ALIAS: SetupDiGetClassDevs SetupDiGetClassDevsW
+
+FUNCTION: HDEVINFO SetupDiGetClassDevsExA ( GUID* ClassGuid, PCSTR Enumerator, HWND hwndParent, DWORD Flags, HDEVINFO DeviceInfoSet, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: HDEVINFO SetupDiGetClassDevsExW ( GUID* ClassGuid, PCWSTR Enumerator, HWND hwndParent, DWORD Flags, HDEVINFO DeviceInfoSet, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiGetClassDevsEx SetupDiGetClassDevsExW
+
+FUNCTION: BOOL SetupDiGetINFClassA ( PCSTR InfName, LPGUID ClassGuid, PSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiGetINFClassW ( PCWSTR InfName, LPGUID ClassGuid, PWSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize ) ;
+ALIAS: SetupDiGetINFClass SetupDiGetINFClassW
+
+CONSTANT: DIBCI_NOINSTALLCLASS   HEX: 00000001
+CONSTANT: DIBCI_NODISPLAYCLASS   HEX: 00000002
+
+FUNCTION: BOOL SetupDiBuildClassInfoList ( DWORD Flags, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiBuildClassInfoListExA ( DWORD Flags, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiBuildClassInfoListExW ( DWORD Flags, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiBuildClassInfoListEx SetupDiBuildClassInfoListExW
+
+FUNCTION: BOOL SetupDiGetClassDescriptionA ( GUID* ClassGuid, PSTR ClassDescription, DWORD ClassDescriptionSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiGetClassDescriptionW ( GUID* ClassGuid, PWSTR ClassDescription, DWORD ClassDescriptionSize, PDWORD RequiredSize ) ;
+ALIAS: SetupDiGetClassDescription SetupDiGetClassDescriptionW
+
+FUNCTION: BOOL SetupDiGetClassDescriptionExA ( GUID* ClassGuid, PSTR ClassDescription, DWORD ClassDescriptionSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiGetClassDescriptionExW ( GUID* ClassGuid, PWSTR ClassDescription, DWORD ClassDescriptionSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiGetClassDescriptionEx SetupDiGetClassDescriptionExW
+
+FUNCTION: BOOL SetupDiCallClassInstaller ( DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiSelectDevice ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiSelectBestCompatDrv ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiInstallDevice ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiInstallDriverFiles ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiRegisterCoDeviceInstallers( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiRemoveDevice ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiUnremoveDevice ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiRestartDevices ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiChangeState ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiFinishInstallAction ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+
+FUNCTION: BOOL SetupDiInstallClassA ( HWND hwndParent, PCSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue ) ;
+FUNCTION: BOOL SetupDiInstallClassW ( HWND hwndParent, PCWSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue ) ;
+ALIAS: SetupDiInstallClass SetupDiInstallClassW
+
+FUNCTION: BOOL SetupDiInstallClassExA ( HWND hwndParent, PCSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue, GUID* InterfaceClassGuid, PVOID Reserved1, PVOID Reserved2 ) ;
+FUNCTION: BOOL SetupDiInstallClassExW ( HWND hwndParent, PCWSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue, GUID* InterfaceClassGuid, PVOID Reserved1, PVOID Reserved2 ) ;
+ALIAS: SetupDiInstallClassEx SetupDiInstallClassExW
+
+FUNCTION: HKEY SetupDiOpenClassRegKey ( GUID* ClassGuid, REGSAM samDesired ) ;
+
+CONSTANT: DIOCR_INSTALLER   HEX: 00000001
+CONSTANT: DIOCR_INTERFACE   HEX: 00000002
+
+FUNCTION: HKEY SetupDiOpenClassRegKeyExA ( GUID* ClassGuid, REGSAM samDesired, DWORD Flags, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: HKEY SetupDiOpenClassRegKeyExW ( GUID* ClassGuid, REGSAM samDesired, DWORD Flags, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiOpenClassRegKeyEx SetupDiOpenClassRegKeyExW
+
+FUNCTION: HKEY SetupDiCreateDeviceInterfaceRegKeyA ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved, REGSAM samDesired, HINF InfHandle, PCSTR InfSectionName ) ;
+FUNCTION: HKEY SetupDiCreateDeviceInterfaceRegKeyW ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved, REGSAM samDesired, HINF InfHandle, PCWSTR InfSectionName ) ;
+ALIAS: SetupDiCreateDeviceInterfaceRegKey SetupDiCreateDeviceInterfaceRegKeyW
+ALIAS: SetupDiCreateInterfaceDeviceRegKeyW SetupDiCreateDeviceInterfaceRegKeyW
+ALIAS: SetupDiCreateInterfaceDeviceRegKeyA SetupDiCreateDeviceInterfaceRegKeyA
+ALIAS: SetupDiCreateInterfaceDeviceRegKey SetupDiCreateDeviceInterfaceRegKeyW
+
+FUNCTION: HKEY SetupDiOpenDeviceInterfaceRegKey ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved, REGSAM samDesired ) ;
+ALIAS: SetupDiOpenInterfaceDeviceRegKey SetupDiOpenDeviceInterfaceRegKey
+
+FUNCTION: BOOL SetupDiDeleteDeviceInterfaceRegKey ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved ) ;
+ALIAS: SetupDiDeleteInterfaceDeviceRegKey SetupDiDeleteDeviceInterfaceRegKey
+
+CONSTANT: DIREG_DEV       HEX: 00000001
+CONSTANT: DIREG_DRV       HEX: 00000002
+CONSTANT: DIREG_BOTH      HEX: 00000004
+
+FUNCTION: HKEY SetupDiCreateDevRegKeyA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCSTR InfSectionName ) ;
+FUNCTION: HKEY SetupDiCreateDevRegKeyW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCWSTR InfSectionName ) ;
+ALIAS: SetupDiCreateDevRegKey SetupDiCreateDevRegKeyW
+
+FUNCTION: HKEY SetupDiOpenDevRegKey ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired ) ;
+FUNCTION: BOOL SetupDiDeleteDevRegKey ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType ) ;
+FUNCTION: BOOL SetupDiGetHwProfileList ( PDWORD HwProfileList, DWORD HwProfileListSize, PDWORD RequiredSize, PDWORD CurrentlyActiveIndex ) ;
+FUNCTION: BOOL SetupDiGetHwProfileListExA ( PDWORD HwProfileList, DWORD HwProfileListSize, PDWORD RequiredSize, PDWORD CurrentlyActiveIndex, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiGetHwProfileListExW ( PDWORD HwProfileList, DWORD HwProfileListSize, PDWORD RequiredSize, PDWORD CurrentlyActiveIndex, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiGetHwProfileListEx SetupDiGetHwProfileListExW
+
+FUNCTION: BOOL SetupDiGetDevicePropertyKeys ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DEVPROPKEY* PropertyKeyArray, DWORD PropertyKeyCount, PDWORD RequiredPropertyKeyCount, DWORD Flags ) ;
+FUNCTION: BOOL SetupDiGetDevicePropertyW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DEVPROPKEY* PropertyKey, DEVPROPTYPE* PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize, DWORD Flags ) ;
+ALIAS: SetupDiGetDeviceProperty SetupDiGetDevicePropertyW
+
+FUNCTION: BOOL SetupDiSetDevicePropertyW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DEVPROPKEY* PropertyKey, DEVPROPTYPE PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, DWORD Flags ) ;
+ALIAS: SetupDiSetDeviceProperty SetupDiSetDevicePropertyW
+
+FUNCTION: BOOL SetupDiGetDeviceInterfacePropertyKeys ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DEVPROPKEY* PropertyKeyArray, DWORD PropertyKeyCount, PDWORD RequiredPropertyKeyCount, DWORD Flags ) ;
+FUNCTION: BOOL SetupDiGetDeviceInterfacePropertyW ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DEVPROPKEY* PropertyKey, DEVPROPTYPE* PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize, DWORD Flags ) ;
+ALIAS: SetupDiGetDeviceInterfaceProperty SetupDiGetDeviceInterfacePropertyW
+
+FUNCTION: BOOL SetupDiSetDeviceInterfacePropertyW ( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DEVPROPKEY* PropertyKey, DEVPROPTYPE PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, DWORD Flags ) ;
+ALIAS: SetupDiSetDeviceInterfaceProperty SetupDiSetDeviceInterfacePropertyW
+
+CONSTANT: DICLASSPROP_INSTALLER   HEX: 00000001
+CONSTANT: DICLASSPROP_INTERFACE   HEX: 00000002
+
+FUNCTION: BOOL SetupDiGetClassPropertyKeys ( GUID* ClassGuid, DEVPROPKEY* PropertyKeyArray, DWORD PropertyKeyCount, PDWORD RequiredPropertyKeyCount, DWORD Flags ) ;
+FUNCTION: BOOL SetupDiGetClassPropertyKeysExW ( GUID* ClassGuid, DEVPROPKEY* PropertyKeyArray, DWORD PropertyKeyCount, PDWORD RequiredPropertyKeyCount, DWORD Flags, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiGetClassPropertyKeysEx SetupDiGetClassPropertyKeysExW
+
+FUNCTION: BOOL SetupDiGetClassPropertyW ( GUID* ClassGuid, DEVPROPKEY* PropertyKey, DEVPROPTYPE* PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize, DWORD Flags ) ;
+ALIAS: SetupDiGetClassProperty SetupDiGetClassPropertyW
+
+FUNCTION: BOOL SetupDiGetClassPropertyExW ( GUID* ClassGuid, DEVPROPKEY* PropertyKey, DEVPROPTYPE* PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize, DWORD Flags, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiGetClassPropertyEx SetupDiGetClassPropertyExW
+
+FUNCTION: BOOL SetupDiSetClassPropertyW ( GUID* ClassGuid, DEVPROPKEY* PropertyKey, DEVPROPTYPE PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, DWORD Flags ) ;
+ALIAS: SetupDiSetClassProperty SetupDiSetClassPropertyW
+
+FUNCTION: BOOL SetupDiSetClassPropertyExW ( GUID* ClassGuid, DEVPROPKEY* PropertyKey, DEVPROPTYPE PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, DWORD Flags, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiSetClassPropertyEx SetupDiSetClassPropertyExW
+
+CONSTANT: SPDRP_DEVICEDESC                  HEX: 00000000
+CONSTANT: SPDRP_HARDWAREID                  HEX: 00000001
+CONSTANT: SPDRP_COMPATIBLEIDS               HEX: 00000002
+CONSTANT: SPDRP_UNUSED0                     HEX: 00000003
+CONSTANT: SPDRP_SERVICE                     HEX: 00000004
+CONSTANT: SPDRP_UNUSED1                     HEX: 00000005
+CONSTANT: SPDRP_UNUSED2                     HEX: 00000006
+CONSTANT: SPDRP_CLASS                       HEX: 00000007
+CONSTANT: SPDRP_CLASSGUID                   HEX: 00000008
+CONSTANT: SPDRP_DRIVER                      HEX: 00000009
+CONSTANT: SPDRP_CONFIGFLAGS                 HEX: 0000000A
+CONSTANT: SPDRP_MFG                         HEX: 0000000B
+CONSTANT: SPDRP_FRIENDLYNAME                HEX: 0000000C
+CONSTANT: SPDRP_LOCATION_INFORMATION        HEX: 0000000D
+CONSTANT: SPDRP_PHYSICAL_DEVICE_OBJECT_NAME HEX: 0000000E
+CONSTANT: SPDRP_CAPABILITIES                HEX: 0000000F
+CONSTANT: SPDRP_UI_NUMBER                   HEX: 00000010
+CONSTANT: SPDRP_UPPERFILTERS                HEX: 00000011
+CONSTANT: SPDRP_LOWERFILTERS                HEX: 00000012
+CONSTANT: SPDRP_BUSTYPEGUID                 HEX: 00000013
+CONSTANT: SPDRP_LEGACYBUSTYPE               HEX: 00000014
+CONSTANT: SPDRP_BUSNUMBER                   HEX: 00000015
+CONSTANT: SPDRP_ENUMERATOR_NAME             HEX: 00000016
+CONSTANT: SPDRP_SECURITY                    HEX: 00000017
+CONSTANT: SPDRP_SECURITY_SDS                HEX: 00000018
+CONSTANT: SPDRP_DEVTYPE                     HEX: 00000019
+CONSTANT: SPDRP_EXCLUSIVE                   HEX: 0000001A
+CONSTANT: SPDRP_CHARACTERISTICS             HEX: 0000001B
+CONSTANT: SPDRP_ADDRESS                     HEX: 0000001C
+CONSTANT: SPDRP_UI_NUMBER_DESC_FORMAT       HEX: 0000001D
+CONSTANT: SPDRP_DEVICE_POWER_DATA           HEX: 0000001E
+CONSTANT: SPDRP_REMOVAL_POLICY              HEX: 0000001F
+CONSTANT: SPDRP_REMOVAL_POLICY_HW_DEFAULT   HEX: 00000020
+CONSTANT: SPDRP_REMOVAL_POLICY_OVERRIDE     HEX: 00000021
+CONSTANT: SPDRP_INSTALL_STATE               HEX: 00000022
+CONSTANT: SPDRP_LOCATION_PATHS              HEX: 00000023
+CONSTANT: SPDRP_BASE_CONTAINERID            HEX: 00000024
+CONSTANT: SPDRP_MAXIMUM_PROPERTY            HEX: 00000025
+CONSTANT: SPCRP_UPPERFILTERS                HEX: 00000011
+CONSTANT: SPCRP_LOWERFILTERS                HEX: 00000012
+CONSTANT: SPCRP_SECURITY                    HEX: 00000017
+CONSTANT: SPCRP_SECURITY_SDS                HEX: 00000018
+CONSTANT: SPCRP_DEVTYPE                     HEX: 00000019
+CONSTANT: SPCRP_EXCLUSIVE                   HEX: 0000001A
+CONSTANT: SPCRP_CHARACTERISTICS             HEX: 0000001B
+CONSTANT: SPCRP_MAXIMUM_PROPERTY            HEX: 0000001C
+
+FUNCTION: BOOL SetupDiGetDeviceRegistryPropertyA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiGetDeviceRegistryPropertyW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupDiGetDeviceRegistryProperty SetupDiGetDeviceRegistryPropertyW
+
+FUNCTION: BOOL SetupDiGetClassRegistryPropertyA ( GUID* ClassGuid, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiGetClassRegistryPropertyW ( GUID* ClassGuid, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiGetClassRegistryProperty SetupDiGetClassRegistryPropertyW
+
+FUNCTION: BOOL SetupDiSetDeviceRegistryPropertyA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, BYTE* PropertyBuffer, DWORD PropertyBufferSize ) ;
+FUNCTION: BOOL SetupDiSetDeviceRegistryPropertyW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, BYTE* PropertyBuffer, DWORD PropertyBufferSize ) ;
+ALIAS: SetupDiSetDeviceRegistryProperty SetupDiSetDeviceRegistryPropertyW
+
+FUNCTION: BOOL SetupDiSetClassRegistryPropertyA ( GUID* ClassGuid, DWORD Property, BYTE* PropertyBuffer, DWORD PropertyBufferSize, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiSetClassRegistryPropertyW ( GUID* ClassGuid, DWORD Property, BYTE* PropertyBuffer, DWORD PropertyBufferSize, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiSetClassRegistryProperty SetupDiSetClassRegistryPropertyW
+
+FUNCTION: BOOL SetupDiGetDeviceInstallParamsA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DEVINSTALL_PARAMS_A DeviceInstallParams ) ;
+FUNCTION: BOOL SetupDiGetDeviceInstallParamsW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DEVINSTALL_PARAMS_W DeviceInstallParams ) ;
+ALIAS: SetupDiGetDeviceInstallParams SetupDiGetDeviceInstallParamsW
+
+FUNCTION: BOOL SetupDiGetClassInstallParamsA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_CLASSINSTALL_HEADER ClassInstallParams, DWORD ClassInstallParamsSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiGetClassInstallParamsW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_CLASSINSTALL_HEADER ClassInstallParams, DWORD ClassInstallParamsSize, PDWORD RequiredSize ) ;
+ALIAS: SetupDiGetClassInstallParams SetupDiGetClassInstallParamsW
+
+FUNCTION: BOOL SetupDiSetDeviceInstallParamsA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DEVINSTALL_PARAMS_A DeviceInstallParams ) ;
+FUNCTION: BOOL SetupDiSetDeviceInstallParamsW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DEVINSTALL_PARAMS_W DeviceInstallParams ) ;
+ALIAS: SetupDiSetDeviceInstallParams SetupDiSetDeviceInstallParamsW
+
+FUNCTION: BOOL SetupDiSetClassInstallParamsA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_CLASSINSTALL_HEADER ClassInstallParams, DWORD ClassInstallParamsSize ) ;
+FUNCTION: BOOL SetupDiSetClassInstallParamsW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_CLASSINSTALL_HEADER ClassInstallParams, DWORD ClassInstallParamsSize ) ;
+ALIAS: SetupDiSetClassInstallParams SetupDiSetClassInstallParamsW
+
+FUNCTION: BOOL SetupDiGetDriverInstallParamsA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DRVINFO_DATA_A DriverInfoData, PSP_DRVINSTALL_PARAMS DriverInstallParams ) ;
+FUNCTION: BOOL SetupDiGetDriverInstallParamsW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DRVINFO_DATA_W DriverInfoData, PSP_DRVINSTALL_PARAMS DriverInstallParams ) ;
+ALIAS: SetupDiGetDriverInstallParams SetupDiGetDriverInstallParamsW
+
+FUNCTION: BOOL SetupDiSetDriverInstallParamsA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DRVINFO_DATA_A DriverInfoData, PSP_DRVINSTALL_PARAMS DriverInstallParams ) ;
+FUNCTION: BOOL SetupDiSetDriverInstallParamsW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DRVINFO_DATA_W DriverInfoData, PSP_DRVINSTALL_PARAMS DriverInstallParams ) ;
+ALIAS: SetupDiSetDriverInstallParams SetupDiSetDriverInstallParamsW
+
+FUNCTION: BOOL SetupDiLoadClassIcon ( GUID* ClassGuid, HICON* LargeIcon, PINT MiniIconIndex ) ;
+FUNCTION: BOOL SetupDiLoadDeviceIcon ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, UINT cxIcon, UINT cyIcon, DWORD Flags, HICON* hIcon ) ;
+
+CONSTANT: DMI_MASK      HEX: 00000001
+CONSTANT: DMI_BKCOLOR   HEX: 00000002
+CONSTANT: DMI_USERECT   HEX: 00000004
+
+FUNCTION: INT SetupDiDrawMiniIcon ( HDC hdc, RECT rc, INT MiniIconIndex, DWORD Flags ) ;
+FUNCTION: BOOL SetupDiGetClassBitmapIndex ( GUID* ClassGuid, PINT MiniIconIndex ) ;
+FUNCTION: BOOL SetupDiGetClassImageList ( PSP_CLASSIMAGELIST_DATA ClassImageListData ) ;
+FUNCTION: BOOL SetupDiGetClassImageListExA ( PSP_CLASSIMAGELIST_DATA ClassImageListData, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiGetClassImageListExW ( PSP_CLASSIMAGELIST_DATA ClassImageListData, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiGetClassImageListEx SetupDiGetClassImageListExW
+
+FUNCTION: BOOL SetupDiGetClassImageIndex ( PSP_CLASSIMAGELIST_DATA ClassImageListData, GUID* ClassGuid, PINT ImageIndex ) ;
+FUNCTION: BOOL SetupDiDestroyClassImageList ( PSP_CLASSIMAGELIST_DATA ClassImageListData ) ;
+
+CONSTANT: DIGCDP_FLAG_BASIC           HEX: 00000001
+CONSTANT: DIGCDP_FLAG_ADVANCED        HEX: 00000002
+CONSTANT: DIGCDP_FLAG_REMOTE_BASIC    HEX: 00000003
+CONSTANT: DIGCDP_FLAG_REMOTE_ADVANCED HEX: 00000004
+
+FUNCTION: BOOL SetupDiGetClassDevPropertySheetsA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, LPPROPSHEETHEADERA PropertySheetHeader, DWORD PropertySheetHeaderPageListSize, PDWORD RequiredSize, DWORD PropertySheetType ) ;
+FUNCTION: BOOL SetupDiGetClassDevPropertySheetsW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, LPPROPSHEETHEADERW PropertySheetHeader, DWORD PropertySheetHeaderPageListSize, PDWORD RequiredSize, DWORD PropertySheetType ) ;
+ALIAS: SetupDiGetClassDevPropertySheets SetupDiGetClassDevPropertySheetsW
+
+CONSTANT: IDI_RESOURCEFIRST           159
+CONSTANT: IDI_RESOURCE                159
+CONSTANT: IDI_RESOURCELAST            161
+CONSTANT: IDI_RESOURCEOVERLAYFIRST    161
+CONSTANT: IDI_RESOURCEOVERLAYLAST     161
+CONSTANT: IDI_CONFLICT                161
+CONSTANT: IDI_CLASSICON_OVERLAYFIRST  500
+CONSTANT: IDI_CLASSICON_OVERLAYLAST   502
+CONSTANT: IDI_PROBLEM_OVL             500
+CONSTANT: IDI_DISABLED_OVL            501
+CONSTANT: IDI_FORCED_OVL              502
+
+FUNCTION: BOOL SetupDiAskForOEMDisk ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiSelectOEMDrv ( HWND hwndParent, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiClassNameFromGuidA ( GUID* ClassGuid, PSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiClassNameFromGuidW ( GUID* ClassGuid, PWSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize ) ;
+ALIAS: SetupDiClassNameFromGuid SetupDiClassNameFromGuidW
+
+FUNCTION: BOOL SetupDiClassNameFromGuidExA ( GUID* ClassGuid, PSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiClassNameFromGuidExW ( GUID* ClassGuid, PWSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiClassNameFromGuidEx SetupDiClassNameFromGuidExW
+
+FUNCTION: BOOL SetupDiClassGuidsFromNameA ( PCSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiClassGuidsFromNameW ( PCWSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize ) ;
+ALIAS: SetupDiClassGuidsFromName SetupDiClassGuidsFromNameW
+
+FUNCTION: BOOL SetupDiClassGuidsFromNameExA ( PCSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiClassGuidsFromNameExW ( PCWSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiClassGuidsFromNameEx SetupDiClassGuidsFromNameExW
+
+FUNCTION: BOOL SetupDiGetHwProfileFriendlyNameA ( DWORD HwProfile, PSTR FriendlyName, DWORD FriendlyNameSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiGetHwProfileFriendlyNameW ( DWORD HwProfile, PWSTR FriendlyName, DWORD FriendlyNameSize, PDWORD RequiredSize ) ;
+ALIAS: SetupDiGetHwProfileFriendlyName SetupDiGetHwProfileFriendlyNameW
+
+FUNCTION: BOOL SetupDiGetHwProfileFriendlyNameExA ( DWORD HwProfile, PSTR FriendlyName, DWORD FriendlyNameSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiGetHwProfileFriendlyNameExW ( DWORD HwProfile, PWSTR FriendlyName, DWORD FriendlyNameSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved ) ;
+ALIAS: SetupDiGetHwProfileFriendlyNameEx SetupDiGetHwProfileFriendlyNameExW
+
+CONSTANT: SPWPT_SELECTDEVICE      HEX: 00000001
+CONSTANT: SPWP_USE_DEVINFO_DATA   HEX: 00000001
+
+FUNCTION: HPROPSHEETPAGE SetupDiGetWizardPage ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_INSTALLWIZARD_DATA InstallWizardData, DWORD PageType, DWORD Flags ) ;
+FUNCTION: BOOL SetupDiGetSelectedDevice ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+FUNCTION: BOOL SetupDiSetSelectedDevice ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData ) ;
+
+FUNCTION: BOOL SetupDiGetActualModelsSectionA ( PINFCONTEXT Context, PSP_ALTPLATFORM_INFO AlternatePlatformInfo, PSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiGetActualModelsSectionW ( PINFCONTEXT Context, PSP_ALTPLATFORM_INFO AlternatePlatformInfo, PWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PVOID Reserved ) ;
+
+ALIAS: SetupDiGetActualModelsSection SetupDiGetActualModelsSectionW
+
+FUNCTION: BOOL SetupDiGetActualSectionToInstallA ( HINF InfHandle, PCSTR InfSectionName, PSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PSTR* Extension ) ;
+FUNCTION: BOOL SetupDiGetActualSectionToInstallW ( HINF InfHandle, PCWSTR InfSectionName, PWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PWSTR* Extension ) ;
+ALIAS: SetupDiGetActualSectionToInstall SetupDiGetActualSectionToInstallW
+
+FUNCTION: BOOL SetupDiGetActualSectionToInstallExA ( HINF InfHandle, PCSTR InfSectionName, PSP_ALTPLATFORM_INFO AlternatePlatformInfo, PSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PSTR* Extension, PVOID Reserved ) ;
+FUNCTION: BOOL SetupDiGetActualSectionToInstallExW ( HINF InfHandle, PCWSTR InfSectionName, PSP_ALTPLATFORM_INFO AlternatePlatformInfo, PWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PWSTR* Extension, PVOID Reserved ) ;
+ALIAS: SetupDiGetActualSectionToInstallEx SetupDiGetActualSectionToInstallExW
+
+FUNCTION: BOOL SetupEnumInfSectionsA ( HINF InfHandle, UINT Index, PSTR Buffer, UINT Size, UINT* SizeNeeded ) ;
+FUNCTION: BOOL SetupEnumInfSectionsW ( HINF InfHandle, UINT Index, PWSTR Buffer, UINT Size, UINT* SizeNeeded ) ;
+ALIAS: SetupEnumInfSections SetupEnumInfSectionsW
+
+STRUCT: SP_INF_SIGNER_INFO_V1_A
+    { cbSize               DWORD          }
+    { CatalogFile          CHAR[MAX_PATH] }
+    { DigitalSigner        CHAR[MAX_PATH] }
+    { DigitalSignerVersion CHAR[MAX_PATH] } ;
+TYPEDEF: SP_INF_SIGNER_INFO_V1_A* PSP_INF_SIGNER_INFO_V1_A
+STRUCT: SP_INF_SIGNER_INFO_V1_W
+    { cbSize                DWORD           }
+    { CatalogFile           WCHAR[MAX_PATH] }
+    { DigitalSigner         WCHAR[MAX_PATH] }
+    { DigitalSignerVersion  WCHAR[MAX_PATH] } ;
+TYPEDEF: SP_INF_SIGNER_INFO_V1_W* PSP_INF_SIGNER_INFO_V1_W
+TYPEDEF: SP_INF_SIGNER_INFO_V1_W SP_INF_SIGNER_INFO_V1
+TYPEDEF: PSP_INF_SIGNER_INFO_V1_W PSP_INF_SIGNER_INFO_V1
+
+STRUCT: SP_INF_SIGNER_INFO_V2_A
+    { cbSize                 DWORD          }
+    { CatalogFile            CHAR[MAX_PATH] }
+    { DigitalSigner          CHAR[MAX_PATH] }
+    { DigitalSignerVersion   CHAR[MAX_PATH] }
+    { SignerScore            DWORD          } ;
+TYPEDEF: SP_INF_SIGNER_INFO_V2_A* PSP_INF_SIGNER_INFO_V2_A
+STRUCT: SP_INF_SIGNER_INFO_V2_W
+    { cbSize                DWORD           }
+    { CatalogFile           WCHAR[MAX_PATH] }
+    { DigitalSigner         WCHAR[MAX_PATH] }
+    { DigitalSignerVersion  WCHAR[MAX_PATH] }
+    { SignerScore           DWORD           } ;
+TYPEDEF: SP_INF_SIGNER_INFO_V2_W* PSP_INF_SIGNER_INFO_V2_W
+
+TYPEDEF: SP_INF_SIGNER_INFO_V2_W SP_INF_SIGNER_INFO_V2
+TYPEDEF: PSP_INF_SIGNER_INFO_V2_W PSP_INF_SIGNER_INFO_V2
+
+CONSTANT: SIGNERSCORE_UNKNOWN         HEX: FF000000
+CONSTANT: SIGNERSCORE_W9X_SUSPECT     HEX: C0000000
+CONSTANT: SIGNERSCORE_UNSIGNED        HEX: 80000000
+CONSTANT: SIGNERSCORE_AUTHENTICODE    HEX: 0F000000
+CONSTANT: SIGNERSCORE_WHQL            HEX: 0D000005
+CONSTANT: SIGNERSCORE_UNCLASSIFIED    HEX: 0D000004
+CONSTANT: SIGNERSCORE_INBOX           HEX: 0D000003
+CONSTANT: SIGNERSCORE_LOGO_STANDARD   HEX: 0D000002
+CONSTANT: SIGNERSCORE_LOGO_PREMIUM    HEX: 0D000001
+CONSTANT: SIGNERSCORE_MASK            HEX: FF000000
+CONSTANT: SIGNERSCORE_SIGNED_MASK     HEX: F0000000
+
+TYPEDEF: SP_INF_SIGNER_INFO_V2_A  SP_INF_SIGNER_INFO_A
+TYPEDEF: PSP_INF_SIGNER_INFO_V2_A PSP_INF_SIGNER_INFO_A
+TYPEDEF: SP_INF_SIGNER_INFO_V2_W  SP_INF_SIGNER_INFO_W
+TYPEDEF: PSP_INF_SIGNER_INFO_V2_W PSP_INF_SIGNER_INFO_W
+TYPEDEF: SP_INF_SIGNER_INFO_V2    SP_INF_SIGNER_INFO
+TYPEDEF: PSP_INF_SIGNER_INFO_V2   PSP_INF_SIGNER_INFO
+
+FUNCTION: BOOL SetupVerifyInfFileA ( PCSTR InfName, PSP_ALTPLATFORM_INFO AltPlatformInfo, PSP_INF_SIGNER_INFO_A InfSignerInfo ) ;
+FUNCTION: BOOL SetupVerifyInfFileW ( PCWSTR InfName, PSP_ALTPLATFORM_INFO AltPlatformInfo, PSP_INF_SIGNER_INFO_W InfSignerInfo ) ;
+ALIAS: SetupVerifyInfFile SetupVerifyInfFileW
+
+CONSTANT: DICUSTOMDEVPROP_MERGE_MULTISZ    HEX: 00000001
+FUNCTION: BOOL SetupDiGetCustomDevicePropertyA ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PCSTR CustomPropertyName, DWORD Flags, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize ) ;
+FUNCTION: BOOL SetupDiGetCustomDevicePropertyW ( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PCWSTR CustomPropertyName, DWORD Flags, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize ) ;
+ALIAS: SetupDiGetCustomDeviceProperty SetupDiGetCustomDevicePropertyW
+
+CONSTANT: SCWMI_CLOBBER_SECURITY  HEX: 00000001
+FUNCTION: BOOL SetupConfigureWmiFromInfSectionA ( HINF InfHandle, PCSTR SectionName, DWORD Flags ) ;
+FUNCTION: BOOL SetupConfigureWmiFromInfSectionW ( HINF InfHandle, PCWSTR SectionName, DWORD Flags ) ;
+ALIAS: SetupConfigureWmiFromInfSection SetupConfigureWmiFromInfSectionW
+
diff --git a/basis/windows/ddk/setupapi/summary.txt b/basis/windows/ddk/setupapi/summary.txt
new file mode 100644 (file)
index 0000000..3a6ad61
--- /dev/null
@@ -0,0 +1 @@
+Bindings to the SetupAPI section of the Windows DDK.\r
diff --git a/basis/windows/ddk/setupapi/tags.txt b/basis/windows/ddk/setupapi/tags.txt
new file mode 100644 (file)
index 0000000..024277a
--- /dev/null
@@ -0,0 +1 @@
+bindings\r
diff --git a/basis/windows/ddk/winusb/authors.txt b/basis/windows/ddk/winusb/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/basis/windows/ddk/winusb/platforms.txt b/basis/windows/ddk/winusb/platforms.txt
new file mode 100644 (file)
index 0000000..205e643
--- /dev/null
@@ -0,0 +1 @@
+winnt
diff --git a/basis/windows/ddk/winusb/summary.txt b/basis/windows/ddk/winusb/summary.txt
new file mode 100644 (file)
index 0000000..0d95f10
--- /dev/null
@@ -0,0 +1 @@
+Bindings to the USB section of the Windows DDK.
diff --git a/basis/windows/ddk/winusb/tags.txt b/basis/windows/ddk/winusb/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/basis/windows/ddk/winusb/winusb.factor b/basis/windows/ddk/winusb/winusb.factor
new file mode 100755 (executable)
index 0000000..d54cd93
--- /dev/null
@@ -0,0 +1,65 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.syntax classes.struct
+windows.kernel32 windows.types alien.libraries ;
+IN: windows.ddk.winusb
+
+<< "winusb" "winusb.dll" stdcall add-library >>
+LIBRARY: winusb
+
+TYPEDEF: PVOID WINUSB_INTERFACE_HANDLE
+TYPEDEF: WINUSB_INTERFACE_HANDLE* PWINUSB_INTERFACE_HANDLE
+
+STRUCT: USB_INTERFACE_DESCRIPTOR
+    { bLength            UCHAR }
+    { bDescriptorType    UCHAR }
+    { bInterfaceNumber   UCHAR }
+    { bAlternateSetting  UCHAR }
+    { bNumEndpoints      UCHAR }
+    { bInterfaceClass    UCHAR }
+    { bInterfaceSubClass UCHAR }
+    { bInterfaceProtocol UCHAR }
+    { iInterface         UCHAR } ;
+TYPEDEF: USB_INTERFACE_DESCRIPTOR* PUSB_INTERFACE_DESCRIPTOR
+
+ENUM: USBD_PIPE_TYPE
+    UsbdPipeTypeControl
+    UsbdPipeTypeIsochronous
+    UsbdPipeTypeBulk
+    UsbdPipeTypeInterrupt ;
+
+STRUCT: WINUSB_PIPE_INFORMATION
+    { PipeType                   USBD_PIPE_TYPE }
+    { PipeId                     UCHAR          }
+    { MaximumPacketSize          USHORT         }
+    { Interval                   UCHAR          } ;
+TYPEDEF: WINUSB_PIPE_INFORMATION* PWINUSB_PIPE_INFORMATION
+
+STRUCT: WINUSB_SETUP_PACKET
+    { RequestType   UCHAR  }
+    { Request       UCHAR  }
+    { Value         USHORT }
+    { Index         USHORT }
+    { Length        USHORT } ;
+TYPEDEF: WINUSB_SETUP_PACKET* PWINUSB_SETUP_PACKET
+
+FUNCTION: BOOL WinUsb_AbortPipe ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID ) ;
+FUNCTION: BOOL WinUsb_FlushPipe ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID ) ;
+FUNCTION: BOOL WinUsb_ControlTransfer ( WINUSB_INTERFACE_HANDLE InterfaceHandle, WINUSB_SETUP_PACKET SetupPacket, PUCHAR Buffer, ULONG BufferLength, PULONG LengthTransferred, LPOVERLAPPED Overlapped ) ;
+FUNCTION: BOOL WinUsb_Initialize ( HANDLE DeviceHandle, PWINUSB_INTERFACE_HANDLE InterfaceHandle ) ;
+FUNCTION: BOOL WinUsb_Free ( WINUSB_INTERFACE_HANDLE InterfaceHandle ) ;
+FUNCTION: BOOL WinUsb_GetAssociatedInterface ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR AssociatedInterfaceIndex, PWINUSB_INTERFACE_HANDLE AssociatedInterfaceHandle ) ;
+FUNCTION: BOOL WinUsb_GetCurrentAlternateSetting ( WINUSB_INTERFACE_HANDLE InterfaceHandle, PUCHAR SettingNumber ) ;
+FUNCTION: BOOL WinUsb_GetDescriptor ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR DescriptorType, UCHAR Index, USHORT LanguageID, PUCHAR Buffer, ULONG BufferLength, PULONG LengthTransferred ) ;
+FUNCTION: BOOL WinUsb_GetPowerPolicy ( WINUSB_INTERFACE_HANDLE InterfaceHandle, ULONG PolicyType, PULONG ValueLength, PVOID Value ) ;
+FUNCTION: BOOL WinUsb_GetOverlappedResult ( WINUSB_INTERFACE_HANDLE InterfaceHandle, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait ) ;
+FUNCTION: BOOL WinUsb_GetPipePolicy ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID, ULONG PolicyType, PULONG ValueLength, PVOID Value ) ;
+FUNCTION: BOOL WinUsb_QueryInterfaceSettings ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR AlternateInterfaceNumber, PUSB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor ) ;
+FUNCTION: BOOL WinUsb_QueryDeviceInformation ( WINUSB_INTERFACE_HANDLE InterfaceHandle, ULONG InformationType, PULONG BufferLength, PVOID Buffer ) ;
+FUNCTION: BOOL WinUsb_QueryPipe ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR AlternateInterfaceNumber, UCHAR PipeIndex, PWINUSB_PIPE_INFORMATION PipeInformation ) ;
+FUNCTION: BOOL WinUsb_ReadPipe ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID, PUCHAR Buffer, ULONG BufferLength, PULONG LengthTransferred, LPOVERLAPPED Overlapped ) ;
+FUNCTION: BOOL WinUsb_ResetPipe ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID ) ;
+FUNCTION: BOOL WinUsb_SetCurrentAlternateSetting ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR SettingNumber ) ;
+FUNCTION: BOOL WinUsb_SetPowerPolicy ( WINUSB_INTERFACE_HANDLE InterfaceHandle, ULONG PolicyType, ULONG ValueLength, PVOID Value ) ;
+FUNCTION: BOOL WinUsb_SetPipePolicy ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID, ULONG PolicyType, ULONG ValueLength, PVOID Value ) ;
+FUNCTION: BOOL WinUsb_WritePipe ( WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID, PUCHAR Buffer, ULONG BufferLength, PULONG LengthTransferred, LPOVERLAPPED Overlapped ) ;
index cf9e5a3a98c6236b9fab78356857acfb909b2713..4a8b44f63d0555f89ed92f7303f41cd90220af8b 100644 (file)
@@ -303,6 +303,9 @@ TYPEDEF: int D2D1_FACTORY_TYPE
 STRUCT: D2D1_FACTORY_OPTIONS
     { debugLevel D2D1_DEBUG_LEVEL } ;
 
+C-TYPE: ID2D1Factory
+C-TYPE: ID2D1BitmapRenderTarget 
+
 COM-INTERFACE: ID2D1Resource IUnknown {2cd90691-12e2-11dc-9fed-001143a055f9}
     void GetFactory ( ID2D1Factory** factory ) ;
 
index 561aa47acd6cc2ccd5c1612b1f8752711c7f601c..4f23d41218e4e23057cbba625002f48b10738424 100644 (file)
@@ -382,6 +382,7 @@ STRUCT: D3D10_BOX
     { bottom UINT }
     { back   UINT } ;
 
+C-TYPE: ID3D10Device
 COM-INTERFACE: ID3D10DeviceChild IUnknown {9B7E4C00-342C-4106-A19F-4F2704F689F0}
     void GetDevice ( ID3D10Device** ppDevice )
     HRESULT GetPrivateData ( LPGUID guid, UINT* pDataSize, void* pData )
index 5b4fbb4ca5bd341370002540dff840217b13a350..873f8e26e8a69acac1a87a8f4e738080015b5d7c 100644 (file)
@@ -1,5 +1,5 @@
 USING: alien.c-types alien.syntax classes.struct windows.com
-windows.com.syntax windows.directx.d3d10
+windows.com.syntax windows.directx.d3d10 windows.directx.d3d10misc
 windows.directx.d3d10shader windows.types ;
 IN: windows.directx.d3d10effect
 
@@ -113,6 +113,20 @@ STRUCT: D3D10_EFFECT_VARIABLE_DESC
     { BufferOffset         UINT   }
     { ExplicitBindPoint    UINT   } ;
 
+C-TYPE: ID3D10EffectConstantBuffer
+C-TYPE: ID3D10EffectScalarVariable
+C-TYPE: ID3D10EffectVectorVariable
+C-TYPE: ID3D10EffectMatrixVariable
+C-TYPE: ID3D10EffectStringVariable
+C-TYPE: ID3D10EffectShaderResourceVariable
+C-TYPE: ID3D10EffectRenderTargetViewVariable
+C-TYPE: ID3D10EffectDepthStencilViewVariable
+C-TYPE: ID3D10EffectShaderVariable
+C-TYPE: ID3D10EffectBlendVariable
+C-TYPE: ID3D10EffectDepthStencilVariable
+C-TYPE: ID3D10EffectRasterizerVariable
+C-TYPE: ID3D10EffectSamplerVariable
+
 COM-INTERFACE: ID3D10EffectVariable f {AE897105-00E6-45bf-BB8E-281DD6DB8E1B}
     BOOL IsValid ( )
     ID3D10EffectType* GetType ( )
index b6f5f12bcea4d5cbc2ede49e380443eab97b28cd..a5809009ea6f6041518c136986ee3e8ae2e05c97 100644 (file)
@@ -1,5 +1,5 @@
 USING: alien.c-types alien.syntax windows.com windows.com.syntax
-windows.directx.dxgi windows.types alien.libraries ;
+windows.directx.d3d10 windows.directx.dxgi windows.types ;
 IN: windows.directx.d3d10misc
 
 LIBRARY: d3d10
index 4507441fd0f92dfdbbc60b8d94bf3c0c635a2d5d..787698e5030dc1a6f189e758beb39a47f76aac1c 100644 (file)
@@ -1,5 +1,6 @@
-USING: alien.syntax alien.c-types classes.struct windows.types windows.com
-windows.com.syntax windows.directx.d3d10 ;
+USING: alien.c-types alien.syntax classes.struct windows.com
+windows.com.syntax windows.directx.d3d10 windows.directx.d3d10misc
+windows.types ;
 IN: windows.directx.d3d10shader
 
 LIBRARY: d3d10
index 505ac4bc6744c95dec4dad0f72dbece4993dbd73..8382c11dc28857f80196d3275c12067ff678c83a 100644 (file)
@@ -634,6 +634,9 @@ STRUCT: D3D11_BOX
     { bottom UINT }
     { back   UINT } ;
 
+C-TYPE: ID3D11Device
+C-TYPE: ID3D11ClassLinkage
+
 COM-INTERFACE: ID3D11DeviceChild IUnknown {1841e5c8-16b0-489b-bcc8-44cfb0d5deae}
     void GetDevice ( ID3D11Device** ppDevice )
     HRESULT GetPrivateData ( REFGUID guid, UINT* pDataSize, void* pData )
index a0437e3e6574f18c176a7cc84efe012527fef5ef..33544d4dc15dc95b671489fe5a16f1f03353cad8 100644 (file)
@@ -24,11 +24,11 @@ CONSTANT: D3D11_RETURN_TYPE_DOUBLE    7
 CONSTANT: D3D11_RETURN_TYPE_CONTINUED 8
 TYPEDEF: int D3D11_RESOURCE_RETURN_TYPE
 
-C-ENUM: D3D11_CT_CBUFFER
-        D3D11_CT_TBUFFER
-        D3D11_CT_INTERFACE_POINTERS
-        D3D11_CT_RESOURCE_BIND_INFO ;
-TYPEDEF: int D3D11_CBUFFER_TYPE
+ENUM: D3D11_CBUFFER_TYPE
+    D3D11_CT_CBUFFER
+    D3D11_CT_TBUFFER
+    D3D11_CT_INTERFACE_POINTERS
+    D3D11_CT_RESOURCE_BIND_INFO ;
 TYPEDEF: D3D11_CBUFFER_TYPE* LPD3D11_CBUFFER_TYPE
 
 STRUCT: D3D11_SIGNATURE_PARAMETER_DESC
@@ -152,6 +152,9 @@ COM-INTERFACE: ID3D11ShaderReflectionType f {6E6FFA6A-9BAE-4613-A51E-91652D508C2
     HRESULT IsOfType ( ID3D11ShaderReflectionType* pType )
     HRESULT ImplementsInterface ( ID3D11ShaderReflectionType* pBase ) ;
 
+C-TYPE: ID3D11ShaderReflectionType
+C-TYPE: ID3D11ShaderReflectionConstantBuffer
+
 COM-INTERFACE: ID3D11ShaderReflectionVariable f {51F23923-F3E5-4BD1-91CB-606177D8DB4C}
     HRESULT GetDesc ( D3D11_SHADER_VARIABLE_DESC* pDesc )
     ID3D11ShaderReflectionType* GetType ( )
index cedfefc103838baa13f56b6b69ab55dcc6175d42..a612f72ccd7470f71bbf52b26d53552338a60f81 100644 (file)
@@ -23,6 +23,8 @@ FUNCTION: BOOL D3DPERF_QueryRepeatFrame ( ) ;
 FUNCTION: void D3DPERF_SetOptions ( DWORD dwOptions ) ;
 FUNCTION: DWORD D3DPERF_GetStatus ( ) ;
 
+C-TYPE: IDirect3DDevice9
+
 COM-INTERFACE: IDirect3D9 IUnknown {81BDCBCA-64D4-426d-AE8D-AD0147F4275C}
     HRESULT RegisterSoftwareDevice ( void* pInitializeFunction )
     UINT GetAdapterCount ( )
@@ -51,6 +53,17 @@ C-TYPE: IDirect3DVertexDeclaration9
 C-TYPE: IDirect3DVertexShader9
 C-TYPE: IDirect3DIndexBuffer9
 C-TYPE: IDirect3DPixelShader9
+C-TYPE: IDirect3DSwapChain9
+C-TYPE: IDirect3DTexture9
+C-TYPE: IDirect3DVolumeTexture9
+C-TYPE: IDirect3DCubeTexture9
+C-TYPE: IDirect3DStateBlock9
+C-TYPE: IDirect3DQuery9
+C-TYPE: IDirect3DVolume9
+C-TYPE: IDirect3D9Ex
+C-TYPE: IDirect3DDevice9Ex
+C-TYPE: IDirect3DAuthenticatedChannel9
+C-TYPE: IDirect3DCryptoSession9
 
 COM-INTERFACE: IDirect3DDevice9 IUnknown {D0223B96-BF7A-43fd-92BD-A43B0D82B9EB}
     HRESULT TestCooperativeLevel ( )
@@ -96,7 +109,7 @@ COM-INTERFACE: IDirect3DDevice9 IUnknown {D0223B96-BF7A-43fd-92BD-A43B0D82B9EB}
     HRESULT Clear ( DWORD Count, D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil )
     HRESULT SetTransform ( D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix )
     HRESULT GetTransform ( D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix )
-    HRESULT MultiplyTransform ( D3DTRANSFORMSTATETYPE, D3DMATRIX* )
+    HRESULT MultiplyTransform ( D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix )
     HRESULT SetViewport ( D3DVIEWPORT9* pViewport )
     HRESULT GetViewport ( D3DVIEWPORT9* pViewport )
     HRESULT SetMaterial ( D3DMATERIAL9* pMaterial )
index dc0284955309d6279cb592a2db8ff06b6cea61be..ff5953b3f4ced3cc75902a9685028751f97128bd 100644 (file)
@@ -1,5 +1,5 @@
 USING: alien.syntax windows.types classes.struct math alien.c-types
-math.bitwise kernel locals windows.kernel32 ;
+math.bitwise kernel locals windows.kernel32 literals ;
 IN: windows.directx.d3d9types
 
 TYPEDEF: DWORD D3DCOLOR
@@ -54,19 +54,21 @@ CONSTANT: D3DCS_PLANE3      HEX: 00000200
 CONSTANT: D3DCS_PLANE4      HEX: 00000400
 CONSTANT: D3DCS_PLANE5      HEX: 00000800
 
-: D3DCS_ALL ( -- n )
-    { D3DCS_LEFT
-      D3DCS_RIGHT
-      D3DCS_TOP
-      D3DCS_BOTTOM
-      D3DCS_FRONT
-      D3DCS_BACK
-      D3DCS_PLANE0
-      D3DCS_PLANE1
-      D3DCS_PLANE2
-      D3DCS_PLANE3
-      D3DCS_PLANE4
-      D3DCS_PLANE5 } flags ; inline
+CONSTANT: D3DCS_ALL
+    flags{
+        D3DCS_LEFT
+        D3DCS_RIGHT
+        D3DCS_TOP
+        D3DCS_BOTTOM
+        D3DCS_FRONT
+        D3DCS_BACK
+        D3DCS_PLANE0
+        D3DCS_PLANE1
+        D3DCS_PLANE2
+        D3DCS_PLANE3
+        D3DCS_PLANE4
+        D3DCS_PLANE5
+    }
 
 STRUCT: D3DCLIPSTATUS9
     { ClipUnion        DWORD }
@@ -500,8 +502,7 @@ CONSTANT: MAXD3DDECLUSAGE         13
 CONSTANT: MAXD3DDECLUSAGEINDEX    15
 CONSTANT: MAXD3DDECLLENGTH        64
 
-TYPEDEF: int D3DDECLMETHOD
-C-ENUM:
+ENUM: D3DDECLMETHOD
     D3DDECLMETHOD_DEFAULT
     D3DDECLMETHOD_PARTIALU
     D3DDECLMETHOD_PARTIALV
@@ -757,28 +758,27 @@ CONSTANT: D3DSHADER_ADDRMODE_FORCE_DWORD HEX: 7fffffff
 CONSTANT: D3DVS_SWIZZLE_SHIFT     16
 CONSTANT: D3DVS_SWIZZLE_MASK      HEX: 00FF0000
 
-: D3DVS_X_X ( -- n ) 0 D3DVS_SWIZZLE_SHIFT shift ; inline
-: D3DVS_X_Y ( -- n ) 1 D3DVS_SWIZZLE_SHIFT shift ; inline
-: D3DVS_X_Z ( -- n ) 2 D3DVS_SWIZZLE_SHIFT shift ; inline
-: D3DVS_X_W ( -- n ) 3 D3DVS_SWIZZLE_SHIFT shift ; inline
+CONSTANT: D3DVS_X_X $[ 0 16 shift ]
+CONSTANT: D3DVS_X_Y $[ 1 16 shift ]
+CONSTANT: D3DVS_X_Z $[ 2 16 shift ]
+CONSTANT: D3DVS_X_W $[ 3 16 shift ]
 
-: D3DVS_Y_X ( -- n ) 0 D3DVS_SWIZZLE_SHIFT 2 + shift ; inline
-: D3DVS_Y_Y ( -- n ) 1 D3DVS_SWIZZLE_SHIFT 2 + shift ; inline
-: D3DVS_Y_Z ( -- n ) 2 D3DVS_SWIZZLE_SHIFT 2 + shift ; inline
-: D3DVS_Y_W ( -- n ) 3 D3DVS_SWIZZLE_SHIFT 2 + shift ; inline
+CONSTANT: D3DVS_Y_X $[ 0 16 2 + shift ]
+CONSTANT: D3DVS_Y_Y $[ 1 16 2 + shift ]
+CONSTANT: D3DVS_Y_Z $[ 2 16 2 + shift ]
+CONSTANT: D3DVS_Y_W $[ 3 16 2 + shift ]
 
-: D3DVS_Z_X ( -- n ) 0 D3DVS_SWIZZLE_SHIFT 4 + shift ; inline
-: D3DVS_Z_Y ( -- n ) 1 D3DVS_SWIZZLE_SHIFT 4 + shift ; inline
-: D3DVS_Z_Z ( -- n ) 2 D3DVS_SWIZZLE_SHIFT 4 + shift ; inline
-: D3DVS_Z_W ( -- n ) 3 D3DVS_SWIZZLE_SHIFT 4 + shift ; inline
+CONSTANT: D3DVS_Z_X $[ 0 16 4 + shift ]
+CONSTANT: D3DVS_Z_Y $[ 1 16 4 + shift ]
+CONSTANT: D3DVS_Z_Z $[ 2 16 4 + shift ]
+CONSTANT: D3DVS_Z_W $[ 3 16 4 + shift ]
 
-: D3DVS_W_X ( -- n ) 0 D3DVS_SWIZZLE_SHIFT 6 + shift ; inline
-: D3DVS_W_Y ( -- n ) 1 D3DVS_SWIZZLE_SHIFT 6 + shift ; inline
-: D3DVS_W_Z ( -- n ) 2 D3DVS_SWIZZLE_SHIFT 6 + shift ; inline
-: D3DVS_W_W ( -- n ) 3 D3DVS_SWIZZLE_SHIFT 6 + shift ; inline
+CONSTANT: D3DVS_W_X $[ 0 16 6 + shift ]
+CONSTANT: D3DVS_W_Y $[ 1 16 6 + shift ]
+CONSTANT: D3DVS_W_Z $[ 2 16 6 + shift ]
+CONSTANT: D3DVS_W_W $[ 3 16 6 + shift ]
 
-: D3DVS_NOSWIZZLE ( -- n )
-    { D3DVS_X_X D3DVS_Y_Y D3DVS_Z_Z D3DVS_W_W } flags ; inline
+CONSTANT: D3DVS_NOSWIZZLE flags{ D3DVS_X_X D3DVS_Y_Y D3DVS_Z_Z D3DVS_W_W }
 
 CONSTANT: D3DSP_SWIZZLE_SHIFT     16
 CONSTANT: D3DSP_SWIZZLE_MASK      HEX: 00FF0000
@@ -786,20 +786,20 @@ CONSTANT: D3DSP_SRCMOD_SHIFT      24
 CONSTANT: D3DSP_SRCMOD_MASK       HEX: 0F000000
 
 TYPEDEF: int D3DSHADER_PARAM_SRCMOD_TYPE
-: D3DSPSM_NONE    ( -- n ) 0 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_NEG     ( -- n ) 1 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_BIAS    ( -- n ) 2 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_BIASNEG ( -- n ) 3 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_SIGN    ( -- n ) 4 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_SIGNNEG ( -- n ) 5 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_COMP    ( -- n ) 6 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_X2      ( -- n ) 7 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_X2NEG   ( -- n ) 8 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_DZ      ( -- n ) 9 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_DW      ( -- n ) 10 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_ABS     ( -- n ) 11 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_ABSNEG  ( -- n ) 12 D3DSP_SRCMOD_SHIFT shift ; inline
-: D3DSPSM_NOT     ( -- n ) 13 D3DSP_SRCMOD_SHIFT shift ; inline
+CONSTANT: D3DSPSM_NONE    $[ 0 24 shift ]
+CONSTANT: D3DSPSM_NEG     $[ 1 24 shift ]
+CONSTANT: D3DSPSM_BIAS    $[ 2 24 shift ]
+CONSTANT: D3DSPSM_BIASNEG $[ 3 24 shift ]
+CONSTANT: D3DSPSM_SIGN    $[ 4 24 shift ]
+CONSTANT: D3DSPSM_SIGNNEG $[ 5 24 shift ]
+CONSTANT: D3DSPSM_COMP    $[ 6 24 shift ]
+CONSTANT: D3DSPSM_X2      $[ 7 24 shift ]
+CONSTANT: D3DSPSM_X2NEG   $[ 8 24 shift ]
+CONSTANT: D3DSPSM_DZ      $[ 9 24 shift ]
+CONSTANT: D3DSPSM_DW      $[ 10 24 shift ]
+CONSTANT: D3DSPSM_ABS     $[ 11 24 shift ]
+CONSTANT: D3DSPSM_ABSNEG  $[ 12 24 shift ]
+CONSTANT: D3DSPSM_NOT     $[ 13 24 shift ]
 CONSTANT: D3DSPSM_FORCE_DWORD HEX: 7fffffff
 
 : D3DPS_VERSION ( major minor -- n )
index c2d3af8cf34399b3b869317b153cf08c593708eb..86b804dd1936ccc50e0016b039bc160d6636c0ad 100644 (file)
@@ -48,10 +48,9 @@ COM-INTERFACE: ID3DX11FFT IUnknown {b3f7a938-4c93-4310-a675-b30d6de50553}
     HRESULT ForwardTransform ( ID3D11UnorderedAccessView* pInputBuffer, ID3D11UnorderedAccessView** ppOutputBuffer )
     HRESULT InverseTransform ( ID3D11UnorderedAccessView* pInputBuffer, ID3D11UnorderedAccessView** ppOutputBuffer ) ;
 
-C-ENUM:
+ENUM: D3DX11_FFT_DATA_TYPE
     D3DX11_FFT_DATA_TYPE_REAL
     D3DX11_FFT_DATA_TYPE_COMPLEX ;
-TYPEDEF: int D3DX11_FFT_DATA_TYPE
 
 CONSTANT: D3DX11_FFT_DIM_MASK_1D 1
 CONSTANT: D3DX11_FFT_DIM_MASK_2D 3
index e2165302f47fde1e1d9f2d986936c9d25a36b3f1..e7fbcf573e63fb054e2ad3556f58d62649933d27 100644 (file)
@@ -1,5 +1,5 @@
-USING: alien.syntax windows.directx.d3d10 windows.directx.d3d10shader
-windows.types ;
+USING: alien.syntax windows.directx.d3d10 windows.directx.d3d10misc
+windows.directx.d3d10shader windows.directx.d3dx10core windows.types ;
 IN: windows.directx.d3dx10async
 
 LIBRARY: d3dx10
@@ -8,6 +8,7 @@ C-TYPE: ID3DX10ThreadPump
 C-TYPE: ID3D10EffectPool
 C-TYPE: D3DX10_IMAGE_LOAD_INFO
 C-TYPE: D3DX10_IMAGE_INFO
+C-TYPE: ID3D10Effect
 
 FUNCTION: HRESULT D3DX10CompileFromFileA ( LPCSTR pSrcFile, D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult ) ;
index 369ffd6683e15ce7d89079613471ae43f56e7859..bea30ecb1a07acfba323fd6b3f889c7054834059 100644 (file)
@@ -1,6 +1,6 @@
-USING: alien.syntax alien.c-types classes.struct windows.types
-windows.directx.d3d10shader windows.directx.d3dx11core
-windows.directx.d3d11 windows.directx.d3dx11tex ;
+USING: alien.syntax windows.directx.d3d10misc
+windows.directx.d3d10shader windows.directx.d3d11
+windows.directx.d3dx11core windows.directx.d3dx11tex windows.types ;
 IN: windows.directx.d3dx11async
 
 LIBRARY: d3dx11
index d21fa0c72acc28449f1539a2abea661d96169b99..19425535e890c63c16b43b31229268a6d4e0c7ae 100644 (file)
@@ -1,6 +1,6 @@
-USING: alien.syntax alien.c-types classes.struct windows.types
-windows.directx.dxgiformat windows.directx.d3d11
-windows.directx.d3dx11core ;
+USING: alien.c-types alien.syntax classes.struct
+windows.directx.d3d10misc windows.directx.d3d11
+windows.directx.d3dx11core windows.directx.dxgiformat windows.types ;
 IN: windows.directx.d3dx11tex
 
 LIBRARY: d3dx11
index 12ba902fc5639548debc4eedd6cc463482fac8dd..b6e455b57f539b63170a7ccad7c62a0bf63cef7a 100644 (file)
@@ -41,25 +41,23 @@ STRUCT: D3DXSEMANTIC
     { UsageIndex UINT } ;
 TYPEDEF: D3DXSEMANTIC* LPD3DXSEMANTIC
 
-C-ENUM:
+ENUM: D3DXREGISTER_SET
     D3DXRS_BOOL
     D3DXRS_INT4
     D3DXRS_FLOAT4
     D3DXRS_SAMPLER ;
-TYPEDEF: int D3DXREGISTER_SET
 TYPEDEF: D3DXREGISTER_SET* LPD3DXREGISTER_SET
 
-C-ENUM:
+ENUM: D3DXPARAMETER_CLASS
     D3DXPC_SCALAR
     D3DXPC_VECTOR
     D3DXPC_MATRIX_ROWS
     D3DXPC_MATRIX_COLUMNS
     D3DXPC_OBJECT
     D3DXPC_STRUCT ;
-TYPEDEF: int D3DXPARAMETER_CLASS
 TYPEDEF: D3DXPARAMETER_CLASS* LPD3DXPARAMETER_CLASS
 
-C-ENUM:
+ENUM: D3DXPARAMETER_TYPE
     D3DXPT_VOID
     D3DXPT_BOOL
     D3DXPT_INT
@@ -80,7 +78,6 @@ C-ENUM:
     D3DXPT_PIXELFRAGMENT
     D3DXPT_VERTEXFRAGMENT
     D3DXPT_UNSUPPORTED ;
-TYPEDEF: int D3DXPARAMETER_TYPE
 TYPEDEF: D3DXPARAMETER_TYPE* LPD3DXPARAMETER_TYPE
 
 STRUCT: D3DXCONSTANTTABLE_DESC
@@ -161,10 +158,9 @@ COM-INTERFACE: ID3DXTextureShader IUnknown {3E3D67F8-AA7A-405d-A857-BA01D4758426
     HRESULT SetMatrixTransposeArray ( D3DXHANDLE hConstant, D3DXMATRIX* pMatrix, UINT Count )
     HRESULT SetMatrixTransposePointerArray ( D3DXHANDLE hConstant, D3DXMATRIX** ppMatrix, UINT Count ) ;
 
-C-ENUM:
+ENUM: D3DXINCLUDE_TYPE
     D3DXINC_LOCAL
     D3DXINC_SYSTEM ;
-TYPEDEF: int D3DXINCLUDE_TYPE
 TYPEDEF: D3DXINCLUDE_TYPE* LPD3DXINCLUDE_TYPE
 
 C-TYPE: ID3DXInclude
index 3b80bd450957b486d10f1ce88136b6f2ccccff28..7e74dc0f81fcb9aabbf4f0cee360c035457f0b4e 100644 (file)
@@ -1,7 +1,7 @@
 USING: alien.c-types alien.syntax ;
 IN: windows.directx.dcommon
 
-C-ENUM: DWRITE_MEASURING_MODE_NATURAL
-        DWRITE_MEASURING_MODE_GDI_CLASSIC
-        DWRITE_MEASURING_MODE_GDI_NATURAL ;
-TYPEDEF: int DWRITE_MEASURING_MODE
+ENUM: DWRITE_MEASURING_MODE
+    DWRITE_MEASURING_MODE_NATURAL
+    DWRITE_MEASURING_MODE_GDI_CLASSIC
+    DWRITE_MEASURING_MODE_GDI_NATURAL ;
old mode 100644 (file)
new mode 100755 (executable)
index 26f9da0..bd4ac93
@@ -1,9 +1,9 @@
-USING: windows.directx.dinput windows.kernel32 windows.ole32 windows.com
-windows.com.syntax alien alien.c-types alien.data alien.syntax
-kernel system namespaces combinators sequences fry math accessors
-macros words quotations libc continuations generalizations
-splitting locals assocs init specialized-arrays memoize
-classes.struct strings arrays ;
+USING: windows.directx.dinput windows.kernel32 windows.ole32
+windows.com windows.com.syntax alien alien.c-types alien.data
+alien.syntax kernel system namespaces combinators sequences fry
+math accessors macros words quotations libc continuations
+generalizations splitting locals assocs init specialized-arrays
+classes.struct strings arrays literals sequences.generalizations ;
 SPECIALIZED-ARRAY: DIOBJECTDATAFORMAT
 IN: windows.directx.dinput.constants
 
@@ -20,20 +20,21 @@ SYMBOLS:
 
 <PRIVATE
 
-MEMO: c-type* ( name -- c-type ) c-type ;
-MEMO: heap-size* ( c-type -- n ) heap-size ;
+: initialize ( variable quot -- )
+    call swap set-global ; inline
+
+<<
 
 GENERIC: array-base-type ( c-type -- c-type' )
 M: object array-base-type ;
-M: string array-base-type "[" split1 drop ;
 M: array array-base-type first ;
 
 : (field-spec-of) ( field struct -- field-spec )
-    c-type* fields>> [ name>> = ] with find nip ;
+    c-type fields>> [ name>> = ] with find nip ;
 : (offsetof) ( field struct -- offset )
     [ (field-spec-of) offset>> ] [ drop 0 ] if* ;
 : (sizeof) ( field struct -- size )
-    [ (field-spec-of) type>> array-base-type heap-size* ] [ drop 1 ] if* ;
+    [ (field-spec-of) type>> array-base-type heap-size ] [ drop 1 ] if* ;
 
 : (flag) ( thing -- integer )
     {
@@ -45,9 +46,9 @@ M: array array-base-type first ;
 : (flags) ( array -- n )
     0 [ (flag) bitor ] reduce ;
 
-: <DIOBJECTDATAFORMAT> ( struct {pguid-var,field,index,dwType-flags,dwFlags} -- alien )
+: <DIOBJECTDATAFORMAT> ( struct {pguid-var,field,index,dwType-flags,dwFlags} -- object )
     {
-        [ first dup word? [ get ] when ]
+        [ drop f ]
         [ second rot [ (offsetof) ] [ (sizeof) ] 2bi ]
         [ third * + ]
         [ fourth (flags) ]
@@ -55,54 +56,54 @@ M: array array-base-type first ;
     } cleave
     DIOBJECTDATAFORMAT <struct-boa> ;
 
-:: make-DIOBJECTDATAFORMAT-array ( struct array -- alien )
-    array length malloc-DIOBJECTDATAFORMAT-array :> alien
-    array [| args i |
-        struct args <DIOBJECTDATAFORMAT>
-        i alien set-nth
-    ] each-index
-    alien ;
+: make-DIOBJECTDATAFORMAT-arrays ( struct array -- values vars )
+    [ [ <DIOBJECTDATAFORMAT> ] [ first ] bi ] with
+    DIOBJECTDATAFORMAT-array{ } { } 1 2 mnmap-as ;
 
-: <DIDATAFORMAT> ( dwFlags dwDataSize struct rgodf-array -- alien )
-    [ DIDATAFORMAT heap-size DIOBJECTDATAFORMAT heap-size ] 4 ndip
-    [ nip length ] [ make-DIOBJECTDATAFORMAT-array ] 2bi
-    DIDATAFORMAT <struct-boa> ;
+: make-DIOBJECTDATAFORMAT-array-quot ( struct arr -- quot )
+    [ nip length ] [ make-DIOBJECTDATAFORMAT-arrays ] 2bi '[
+        _ malloc-DIOBJECTDATAFORMAT-array
+        [ _ dup byte-length memcpy ]
+        [ _ [ get >>pguid drop ] 2each ]
+        [ ] tri
+    ] ;
 
-: initialize ( symbol quot -- )
-    call swap set-global ; inline
+>>
+
+MACRO: <DIDATAFORMAT> ( dwFlags dwDataSize struct rgodf-array -- alien )
+    [ DIDATAFORMAT heap-size DIOBJECTDATAFORMAT heap-size ] 4 ndip
+    [ nip length ] [ make-DIOBJECTDATAFORMAT-array-quot ] 2bi
+    '[ _ _ _ _ _ @ DIDATAFORMAT <struct-boa> ] ;
 
 : (malloc-guid-symbol) ( symbol guid -- )
-    '[
-        _ execute( -- value )
-        [ byte-length malloc ] [ over byte-array>memory ] bi
-    ] initialize ;
+    '[ _ malloc-byte-array ] initialize ;
 
 : define-guid-constants ( -- )
     {
-        { GUID_XAxis_malloced          GUID_XAxis }
-        { GUID_YAxis_malloced          GUID_YAxis }
-        { GUID_ZAxis_malloced          GUID_ZAxis }
-        { GUID_RxAxis_malloced         GUID_RxAxis }
-        { GUID_RyAxis_malloced         GUID_RyAxis }
-        { GUID_RzAxis_malloced         GUID_RzAxis }
-        { GUID_Slider_malloced         GUID_Slider }
-        { GUID_Button_malloced         GUID_Button }
-        { GUID_Key_malloced            GUID_Key }
-        { GUID_POV_malloced            GUID_POV }
-        { GUID_Unknown_malloced        GUID_Unknown }
-        { GUID_SysMouse_malloced       GUID_SysMouse }
-        { GUID_SysKeyboard_malloced    GUID_SysKeyboard }
-        { GUID_Joystick_malloced       GUID_Joystick }
-        { GUID_SysMouseEm_malloced     GUID_SysMouseEm }
-        { GUID_SysMouseEm2_malloced    GUID_SysMouseEm2 }
-        { GUID_SysKeyboardEm_malloced  GUID_SysKeyboardEm }
-        { GUID_SysKeyboardEm2_malloced GUID_SysKeyboardEm2 }
+        { GUID_XAxis_malloced          GUID_XAxis }
+        { GUID_YAxis_malloced          GUID_YAxis }
+        { GUID_ZAxis_malloced          GUID_ZAxis }
+        { GUID_RxAxis_malloced         GUID_RxAxis }
+        { GUID_RyAxis_malloced         GUID_RyAxis }
+        { GUID_RzAxis_malloced         GUID_RzAxis }
+        { GUID_Slider_malloced         GUID_Slider }
+        { GUID_Button_malloced         GUID_Button }
+        { GUID_Key_malloced            GUID_Key }
+        { GUID_POV_malloced            GUID_POV }
+        { GUID_Unknown_malloced        GUID_Unknown }
+        { GUID_SysMouse_malloced       GUID_SysMouse }
+        { GUID_SysKeyboard_malloced    GUID_SysKeyboard }
+        { GUID_Joystick_malloced       GUID_Joystick }
+        { GUID_SysMouseEm_malloced     GUID_SysMouseEm }
+        { GUID_SysMouseEm2_malloced    GUID_SysMouseEm2 }
+        { GUID_SysKeyboardEm_malloced  GUID_SysKeyboardEm }
+        { GUID_SysKeyboardEm2_malloced GUID_SysKeyboardEm2 }
     } [ first2 (malloc-guid-symbol) ] each ;
 
 : define-joystick-format-constant ( -- )
     c_dfDIJoystick2 [
         DIDF_ABSAXIS
-        DIJOYSTATE2 heap-size
+        $[ DIJOYSTATE2 heap-size ]
         DIJOYSTATE2 {
             { GUID_XAxis_malloced  "lX"           0 { DIDFT_OPTIONAL DIDFT_AXIS   DIDFT_ANYINSTANCE } 0 }
             { GUID_YAxis_malloced  "lY"           0 { DIDFT_OPTIONAL DIDFT_AXIS   DIDFT_ANYINSTANCE } 0 }
@@ -274,7 +275,7 @@ M: array array-base-type first ;
 : define-mouse-format-constant ( -- )
     c_dfDIMouse2 [
         DIDF_RELAXIS
-        DIMOUSESTATE2 heap-size
+        $[ DIMOUSESTATE2 heap-size ]
         DIMOUSESTATE2 {
             { GUID_XAxis_malloced  "lX"         0 {                DIDFT_ANYINSTANCE DIDFT_AXIS   } 0 }
             { GUID_YAxis_malloced  "lY"         0 {                DIDFT_ANYINSTANCE DIDFT_AXIS   } 0 }
@@ -834,7 +835,7 @@ M: array array-base-type first ;
 [ define-constants ] "windows.directx.dinput.constants" add-startup-hook
 
 : uninitialize ( variable quot -- )
-    '[ _ when* f ] change-global ; inline
+    [ [ get-global ] dip when* ] [ drop global delete-at ] 2bi ; inline
 
 : free-dinput-constants ( -- )
     {
old mode 100644 (file)
new mode 100755 (executable)
index 3e4167e..b538f5b
@@ -5,7 +5,7 @@ IN: windows.directx.dwrite
 
 LIBRARY: dwrite
 
-C-ENUM:
+ENUM: DWRITE_FONT_FILE_TYPE
     DWRITE_FONT_FILE_TYPE_UNKNOWN
     DWRITE_FONT_FILE_TYPE_CFF
     DWRITE_FONT_FILE_TYPE_TRUETYPE
@@ -14,9 +14,8 @@ C-ENUM:
     DWRITE_FONT_FILE_TYPE_TYPE1_PFB
     DWRITE_FONT_FILE_TYPE_VECTOR
     DWRITE_FONT_FILE_TYPE_BITMAP ;
-TYPEDEF: int DWRITE_FONT_FILE_TYPE
 
-C-ENUM:
+ENUM: DWRITE_FONT_FACE_TYPE
     DWRITE_FONT_FACE_TYPE_CFF
     DWRITE_FONT_FACE_TYPE_TRUETYPE
     DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION
@@ -24,51 +23,49 @@ C-ENUM:
     DWRITE_FONT_FACE_TYPE_VECTOR
     DWRITE_FONT_FACE_TYPE_BITMAP
     DWRITE_FONT_FACE_TYPE_UNKNOWN ;
-TYPEDEF: int DWRITE_FONT_FACE_TYPE
-
-CONSTANT: DWRITE_FONT_SIMULATIONS_NONE    0
-CONSTANT: DWRITE_FONT_SIMULATIONS_BOLD    1
-CONSTANT: DWRITE_FONT_SIMULATIONS_OBLIQUE 2
-TYPEDEF: int DWRITE_FONT_SIMULATIONS
-
-CONSTANT: DWRITE_FONT_WEIGHT_THIN        100
-CONSTANT: DWRITE_FONT_WEIGHT_EXTRA_LIGHT 200
-CONSTANT: DWRITE_FONT_WEIGHT_ULTRA_LIGHT 200
-CONSTANT: DWRITE_FONT_WEIGHT_LIGHT       300
-CONSTANT: DWRITE_FONT_WEIGHT_NORMAL      400
-CONSTANT: DWRITE_FONT_WEIGHT_REGULAR     400
-CONSTANT: DWRITE_FONT_WEIGHT_MEDIUM      500
-CONSTANT: DWRITE_FONT_WEIGHT_DEMI_BOLD   600
-CONSTANT: DWRITE_FONT_WEIGHT_SEMI_BOLD   600
-CONSTANT: DWRITE_FONT_WEIGHT_BOLD        700
-CONSTANT: DWRITE_FONT_WEIGHT_EXTRA_BOLD  800
-CONSTANT: DWRITE_FONT_WEIGHT_ULTRA_BOLD  800
-CONSTANT: DWRITE_FONT_WEIGHT_BLACK       900
-CONSTANT: DWRITE_FONT_WEIGHT_HEAVY       900
-CONSTANT: DWRITE_FONT_WEIGHT_EXTRA_BLACK 950
-CONSTANT: DWRITE_FONT_WEIGHT_ULTRA_BLACK 950
-TYPEDEF: int DWRITE_FONT_WEIGHT
-
-CONSTANT: DWRITE_FONT_STRETCH_UNDEFINED       0
-CONSTANT: DWRITE_FONT_STRETCH_ULTRA_CONDENSED 1
-CONSTANT: DWRITE_FONT_STRETCH_EXTRA_CONDENSED 2
-CONSTANT: DWRITE_FONT_STRETCH_CONDENSED       3
-CONSTANT: DWRITE_FONT_STRETCH_SEMI_CONDENSED  4
-CONSTANT: DWRITE_FONT_STRETCH_NORMAL          5
-CONSTANT: DWRITE_FONT_STRETCH_MEDIUM          5
-CONSTANT: DWRITE_FONT_STRETCH_SEMI_EXPANDED   6
-CONSTANT: DWRITE_FONT_STRETCH_EXPANDED        7
-CONSTANT: DWRITE_FONT_STRETCH_EXTRA_EXPANDED  8
-CONSTANT: DWRITE_FONT_STRETCH_ULTRA_EXPANDED  9
-TYPEDEF: int DWRITE_FONT_STRETCH
-
-C-ENUM:
+
+ENUM: DWRITE_FONT_SIMULATIONS
+    DWRITE_FONT_SIMULATIONS_NONE
+    DWRITE_FONT_SIMULATIONS_BOLD
+    DWRITE_FONT_SIMULATIONS_OBLIQUE ;
+
+ENUM: DWRITE_FONT_WEIGHT
+    { DWRITE_FONT_WEIGHT_THIN        100 }
+    { DWRITE_FONT_WEIGHT_EXTRA_LIGHT 200 }
+    { DWRITE_FONT_WEIGHT_ULTRA_LIGHT 200 }
+    { DWRITE_FONT_WEIGHT_LIGHT       300 }
+    { DWRITE_FONT_WEIGHT_NORMAL      400 }
+    { DWRITE_FONT_WEIGHT_REGULAR     400 }
+    { DWRITE_FONT_WEIGHT_MEDIUM      500 }
+    { DWRITE_FONT_WEIGHT_DEMI_BOLD   600 }
+    { DWRITE_FONT_WEIGHT_SEMI_BOLD   600 }
+    { DWRITE_FONT_WEIGHT_BOLD        700 }
+    { DWRITE_FONT_WEIGHT_EXTRA_BOLD  800 }
+    { DWRITE_FONT_WEIGHT_ULTRA_BOLD  800 }
+    { DWRITE_FONT_WEIGHT_BLACK       900 }
+    { DWRITE_FONT_WEIGHT_HEAVY       900 }
+    { DWRITE_FONT_WEIGHT_EXTRA_BLACK 950 }
+    { DWRITE_FONT_WEIGHT_ULTRA_BLACK 950 } ;
+
+ENUM: DWRITE_FONT_STRETCH
+    { DWRITE_FONT_STRETCH_UNDEFINED       0 }
+    { DWRITE_FONT_STRETCH_ULTRA_CONDENSED 1 }
+    { DWRITE_FONT_STRETCH_EXTRA_CONDENSED 2 }
+    { DWRITE_FONT_STRETCH_CONDENSED       3 }
+    { DWRITE_FONT_STRETCH_SEMI_CONDENSED  4 }
+    { DWRITE_FONT_STRETCH_NORMAL          5 }
+    { DWRITE_FONT_STRETCH_MEDIUM          5 }
+    { DWRITE_FONT_STRETCH_SEMI_EXPANDED   6 }
+    { DWRITE_FONT_STRETCH_EXPANDED        7 }
+    { DWRITE_FONT_STRETCH_EXTRA_EXPANDED  8 }
+    { DWRITE_FONT_STRETCH_ULTRA_EXPANDED  9 } ;
+
+ENUM: DWRITE_FONT_STYLE
     DWRITE_FONT_STYLE_NORMAL
     DWRITE_FONT_STYLE_OBLIQUE
     DWRITE_FONT_STYLE_ITALIC ;
-TYPEDEF: int DWRITE_FONT_STYLE
 
-C-ENUM:
+ENUM: DWRITE_INFORMATIONAL_STRING_ID
     DWRITE_INFORMATIONAL_STRING_NONE
     DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE
     DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS
@@ -85,7 +82,6 @@ C-ENUM:
     DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES
     DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES
     DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT ;
-TYPEDEF: int DWRITE_INFORMATIONAL_STRING_ID
 
 STRUCT: DWRITE_FONT_METRICS
     { designUnitsPerEm       USHORT }
@@ -112,10 +108,9 @@ STRUCT: DWRITE_GLYPH_OFFSET
     { advanceOffset  FLOAT }
     { ascenderOffset FLOAT } ;
 
-C-ENUM:
+ENUM: DWRITE_FACTORY_TYPE
     DWRITE_FACTORY_TYPE_SHARED
     DWRITE_FACTORY_TYPE_ISOLATED ;
-TYPEDEF: int DWRITE_FACTORY_TYPE
 
 C-TYPE: IDWriteFontFileStream
 
@@ -138,14 +133,12 @@ COM-INTERFACE: IDWriteFontFile IUnknown {739d886a-cef5-47dc-8769-1a8b41bebbb0}
     HRESULT GetLoader ( IDWriteFontFileLoader** fontFileLoader )
     HRESULT Analyze ( BOOL* isSupportedFontType, DWRITE_FONT_FILE_TYPE* fontFileType, DWRITE_FONT_FACE_TYPE* fontFaceType, UINT32* numberOfFaces ) ;
 
-TYPEDEF: int DWRITE_PIXEL_GEOMETRY
-C-ENUM:
+ENUM: DWRITE_PIXEL_GEOMETRY
     DWRITE_PIXEL_GEOMETRY_FLAT
     DWRITE_PIXEL_GEOMETRY_RGB
     DWRITE_PIXEL_GEOMETRY_BGR ;
 
-TYPEDEF: int DWRITE_RENDERING_MODE
-C-ENUM:
+ENUM: DWRITE_RENDERING_MODE
     DWRITE_RENDERING_MODE_DEFAULT
     DWRITE_RENDERING_MODE_ALIASED
     DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC
@@ -240,39 +233,32 @@ COM-INTERFACE: IDWriteFont IUnknown {acd16696-8c14-4f5d-877e-fe3fc1d32737}
     HRESULT HasCharacter ( UINT32 unicodeValue, BOOL* exists )
     HRESULT CreateFontFace ( IDWriteFontFace** fontFace ) ;
 
-TYPEDEF: int DWRITE_READING_DIRECTION
-C-ENUM:
+ENUM: DWRITE_READING_DIRECTION
     DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
     DWRITE_READING_DIRECTION_RIGHT_TO_LEFT ;
 
-TYPEDEF: int DWRITE_FLOW_DIRECTION
-C-ENUM:
+ENUM: DWRITE_FLOW_DIRECTION
     DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM ;
 
-TYPEDEF: int DWRITE_TEXT_ALIGNMENT
-C-ENUM:
+ENUM: DWRITE_TEXT_ALIGNMENT
     DWRITE_TEXT_ALIGNMENT_LEADING
     DWRITE_TEXT_ALIGNMENT_TRAILING
     DWRITE_TEXT_ALIGNMENT_CENTER ;
 
-TYPEDEF: int DWRITE_PARAGRAPH_ALIGNMENT
-C-ENUM:
+ENUM: DWRITE_PARAGRAPH_ALIGNMENT
     DWRITE_PARAGRAPH_ALIGNMENT_NEAR
     DWRITE_PARAGRAPH_ALIGNMENT_FAR
     DWRITE_PARAGRAPH_ALIGNMENT_CENTER ;
 
-TYPEDEF: int DWRITE_WORD_WRAPPING
-C-ENUM:
+ENUM: DWRITE_WORD_WRAPPING
     DWRITE_WORD_WRAPPING_WRAP
     DWRITE_WORD_WRAPPING_NO_WRAP ;
 
-TYPEDEF: int DWRITE_LINE_SPACING_METHOD
-C-ENUM:
+ENUM: DWRITE_LINE_SPACING_METHOD
     DWRITE_LINE_SPACING_METHOD_DEFAULT
     DWRITE_LINE_SPACING_METHOD_UNIFORM ;
 
-TYPEDEF: int DWRITE_TRIMMING_GRANULARITY
-C-ENUM:
+ENUM: DWRITE_TRIMMING_GRANULARITY
     DWRITE_TRIMMING_GRANULARITY_NONE
     DWRITE_TRIMMING_GRANULARITY_CHARACTER
     DWRITE_TRIMMING_GRANULARITY_WORD ;
@@ -410,31 +396,29 @@ COM-INTERFACE: IDWriteTypography IUnknown {55f1112b-1dc2-4b3c-9541-f46894ed85b6}
     UINT32 GetFontFeatureCount ( )
     HRESULT GetFontFeature ( UINT32 fontFeatureIndex, DWRITE_FONT_FEATURE* fontFeature ) ;
 
-CONSTANT: DWRITE_SCRIPT_SHAPES_DEFAULT   0
-CONSTANT: DWRITE_SCRIPT_SHAPES_NO_VISUAL 1
-TYPEDEF: int DWRITE_SCRIPT_SHAPES
+ENUM: DWRITE_SCRIPT_SHAPES
+    DWRITE_SCRIPT_SHAPES_DEFAULT
+    DWRITE_SCRIPT_SHAPES_NO_VISUAL ;
 
 STRUCT: DWRITE_SCRIPT_ANALYSIS
     { script USHORT               }
     { shapes DWRITE_SCRIPT_SHAPES } ;
 
-C-ENUM:
+ENUM: DWRITE_BREAK_CONDITION
     DWRITE_BREAK_CONDITION_NEUTRAL
     DWRITE_BREAK_CONDITION_CAN_BREAK
     DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
     DWRITE_BREAK_CONDITION_MUST_BREAK ;
-TYPEDEF: int DWRITE_BREAK_CONDITION
 
 STRUCT: DWRITE_LINE_BREAKPOINT
     { data BYTE } ;
 
-C-ENUM:
+ENUM: DWRITE_NUMBER_SUBSTITUTION_METHOD
     DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE
     DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL
     DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE
     DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL
     DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL ;
-TYPEDEF: int DWRITE_NUMBER_SUBSTITUTION_METHOD
 
 COM-INTERFACE: IDWriteNumberSubstitution IUnknown {14885CC9-BAB0-4f90-B6ED-5C366A2CD03D} ;
 
@@ -628,9 +612,9 @@ COM-INTERFACE: IDWriteGdiInterop IUnknown {1edd9491-9853-4299-898f-6432983b6f3a}
     HRESULT CreateFontFaceFromHdc ( HDC hdc, IDWriteFontFace** fontFace )
     HRESULT CreateBitmapRenderTarget ( HDC hdc, UINT32 width, UINT32 height, IDWriteBitmapRenderTarget** renderTarget ) ;
 
-C-ENUM: DWRITE_TEXTURE_ALIASED_1x1
-        DWRITE_TEXTURE_CLEARTYPE_3x1 ;
-TYPEDEF: int DWRITE_TEXTURE_TYPE
+ENUM: DWRITE_TEXTURE_TYPE
+    DWRITE_TEXTURE_ALIASED_1x1
+    DWRITE_TEXTURE_CLEARTYPE_3x1 ;
 
 CONSTANT: DWRITE_ALPHA_MAX 255
 
index 6537de885f52db8bd06bd2ec2278c0ca19eddcd8..5d2ae5b990a3a1b6cdddebd4ec9a4895df5e6c42 100644 (file)
@@ -119,6 +119,7 @@ COM-INTERFACE: IDXGISurface1 IDXGISurface {4AE63092-6327-4c1b-80AE-BFE12EA32B86}
 HRESULT GetDC ( BOOL Discard, HDC* phdc )
 HRESULT ReleaseDC ( RECT* pDirtyRect ) ;
 
+C-TYPE: IDXGIOutput 
 COM-INTERFACE: IDXGIAdapter IDXGIObject {2411e7e1-12ac-4ccf-bd14-9798e8534dc0}
 HRESULT EnumOutputs ( UINT Output, IDXGIOutput** ppOutput )
 HRESULT GetDesc ( DXGI_ADAPTER_DESC* pDesc )
@@ -201,13 +202,13 @@ STRUCT: DXGI_DISPLAY_COLOR_SPACE
 { PrimaryCoordinates FLOAT[8][2] }
 { WhitePoints FLOAT[16][2] } ;
 
+COM-INTERFACE: IDXGIAdapter1 IDXGIAdapter {29038f61-3839-4626-91fd-086879011a05}
+HRESULT GetDesc1 ( DXGI_ADAPTER_DESC1* pDesc ) ;
+
 COM-INTERFACE: IDXGIFactory1 IDXGIFactory {770aae78-f26f-4dba-a829-253c83d1b387}
 HRESULT EnumAdapters1 ( UINT Adapter, IDXGIAdapter1** ppAdapter )
 BOOL IsCurrent ( ) ;
 
-COM-INTERFACE: IDXGIAdapter1 IDXGIAdapter {29038f61-3839-4626-91fd-086879011a05}
-HRESULT GetDesc1 ( DXGI_ADAPTER_DESC1* pDesc ) ;
-
 COM-INTERFACE: IDXGIDevice1 IDXGIDevice {77db970f-6276-48ba-ba28-070143b4392c}
 HRESULT SetMaximumFrameLatency ( UINT MaxLatency )
 HRESULT GetMaximumFrameLatency ( UINT* pMaxLatency ) ;
index 0b318f7af13e484c4a8469329c4fe65180e8c1ed..d0eda4885cc331dc5fef130b3d9973be86264220 100644 (file)
@@ -47,23 +47,23 @@ STRUCT: DXGI_RATIONAL
 { Numerator UINT }
 { Denominator UINT } ;
 
-C-ENUM: DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED
-        DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE
-        DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST
-        DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST ;
-TYPEDEF: int DXGI_MODE_SCANLINE_ORDER
+ENUM: DXGI_MODE_SCANLINE_ORDER
+    DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED
+    DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE
+    DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST
+    DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST ;
 
-C-ENUM: DXGI_MODE_SCALING_UNSPECIFIED
-        DXGI_MODE_SCALING_CENTERED
-        DXGI_MODE_SCALING_STRETCHED ;
-TYPEDEF: int DXGI_MODE_SCALING
+ENUM: DXGI_MODE_SCALING
+    DXGI_MODE_SCALING_UNSPECIFIED
+    DXGI_MODE_SCALING_CENTERED
+    DXGI_MODE_SCALING_STRETCHED ;
 
-C-ENUM: DXGI_MODE_ROTATION_UNSPECIFIED
-        DXGI_MODE_ROTATION_IDENTITY
-        DXGI_MODE_ROTATION_ROTATE90
-        DXGI_MODE_ROTATION_ROTATE180
-        DXGI_MODE_ROTATION_ROTATE270 ;
-TYPEDEF: int DXGI_MODE_ROTATION
+ENUM: DXGI_MODE_ROTATION
+    DXGI_MODE_ROTATION_UNSPECIFIED
+    DXGI_MODE_ROTATION_IDENTITY
+    DXGI_MODE_ROTATION_ROTATE90
+    DXGI_MODE_ROTATION_ROTATE180
+    DXGI_MODE_ROTATION_ROTATE270 ;
 
 STRUCT: DXGI_MODE_DESC
 { Width UINT }
index 5878af80e02a9ffce25f824bc9499ab9459ed495..2f61ade8f51308230fa53937192f6dc65f112520 100644 (file)
@@ -39,10 +39,9 @@ STRUCT: XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
     { pFormat                    WAVEFORMATEX* }
     { MaxFrameCount              UINT32        } ;
 
-C-ENUM:
-        XAPO_BUFFER_SILENT
-        XAPO_BUFFER_VALID ;
-TYPEDEF: int XAPO_BUFFER_FLAGS
+ENUM: XAPO_BUFFER_FLAGS
+    XAPO_BUFFER_SILENT
+    XAPO_BUFFER_VALID ;
 
 STRUCT: XAPO_PROCESS_BUFFER_PARAMETERS
     { pBuffer                    void*             }
index 1255880c4c844db85ac37760d2a0877f48e6e5f1..594ad9ecbeb03f232f816dd8762919aab65529b0 100644 (file)
@@ -1,5 +1,5 @@
-USING: alien.c-types alien.syntax classes.struct windows.ole32
-windows.types ;
+USING: alien.c-types alien.syntax classes.struct windows.com
+windows.ole32 windows.types ;
 IN: windows.directx.xapofx
 
 LIBRARY: xapofx
index 67a9234367a3432d3f07be0a425283eb76bab1e7..a9b2a63f8183e700e1d3ff6da6853b864a1b9f21 100644 (file)
@@ -133,12 +133,11 @@ STRUCT: XAUDIO2_EFFECT_CHAIN
     { EffectCount        UINT32                     }
     { pEffectDescriptors XAUDIO2_EFFECT_DESCRIPTOR* } ;
 
-C-ENUM:
+ENUM: XAUDIO2_FILTER_TYPE
     LowPassFilter
     BandPassFilter
     HighPassFilter
     NotchFilter ;
-TYPEDEF: int XAUDIO2_FILTER_TYPE
 
 STRUCT: XAUDIO2_FILTER_PARAMETERS
     { Type      XAUDIO2_FILTER_TYPE }
@@ -203,6 +202,9 @@ CONSTANT: XAUDIO2_LOG_STREAMING  HEX: 1000
 
 C-TYPE: IXAudio2EngineCallback
 C-TYPE: IXAudio2VoiceCallback
+C-TYPE: IXAudio2SourceVoice
+C-TYPE: IXAudio2SubmixVoice
+C-TYPE: IXAudio2MasteringVoice
 
 COM-INTERFACE: IXAudio2 IUnknown {8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb}
     HRESULT GetDeviceCount ( UINT32* pCount )
old mode 100644 (file)
new mode 100755 (executable)
index 998846e..b9830a5
@@ -1,6 +1,7 @@
 ! (c)2009 Joe Groff bsd license
-USING: alien.c-types alien.data alien.libraries alien.syntax
-classes.struct kernel math system-info.windows windows.types ;
+USING: alien alien.c-types alien.data alien.libraries
+alien.syntax classes.struct kernel math system-info.windows
+windows.types ;
 IN: windows.dwmapi
 
 STRUCT: MARGINS
@@ -21,7 +22,7 @@ STRUCT: DWM_BLURBEHIND
 : full-window-margins ( -- MARGINS )
     -1 -1 -1 -1 <MARGINS> ; inline
 
-<< "dwmapi" "dwmapi.dll" "stdcall" add-library >>
+<< "dwmapi" "dwmapi.dll" stdcall add-library >>
 
 LIBRARY: dwmapi
 
@@ -33,5 +34,5 @@ CONSTANT: WM_DWMCOMPOSITIONCHANGED HEX: 31E
 
 : composition-enabled? ( -- ? )
     windows-major 6 >=
-    [ 0 <int> [ DwmIsCompositionEnabled drop ] keep *int c-bool> ]
+    [ { bool } [ DwmIsCompositionEnabled drop ] [ ] with-out-parameters ]
     [ f ] if ;
old mode 100644 (file)
new mode 100755 (executable)
index a7a4143..a4943ef
@@ -1,10 +1,17 @@
 USING: alien.data kernel locals math math.bitwise
 windows.kernel32 sequences byte-arrays unicode.categories
 io.encodings.string io.encodings.utf16n alien.strings
-arrays literals windows.types specialized-arrays ;
+arrays literals windows.types specialized-arrays
+math.parser ;
 SPECIALIZED-ARRAY: TCHAR
 IN: windows.errors
 
+CONSTANT: APPLICATION_ERROR_MASK       HEX: 20000000
+CONSTANT: ERROR_SEVERITY_SUCCESS       HEX: 00000000
+CONSTANT: ERROR_SEVERITY_INFORMATIONAL HEX: 40000000
+CONSTANT: ERROR_SEVERITY_WARNING       HEX: 80000000
+CONSTANT: ERROR_SEVERITY_ERROR         HEX: C0000000
+
 CONSTANT: ERROR_SUCCESS                               0
 CONSTANT: ERROR_INVALID_FUNCTION                      1
 CONSTANT: ERROR_FILE_NOT_FOUND                        2
@@ -697,24 +704,27 @@ CONSTANT: FORMAT_MESSAGE_MAX_WIDTH_MASK   HEX: 000000FF
 : make-lang-id ( lang1 lang2 -- n )
     10 shift bitor ; inline
 
-ERROR: error-message-failed id ;
 :: n>win32-error-string ( id -- string )
-    {
+    flags{
         FORMAT_MESSAGE_FROM_SYSTEM
         FORMAT_MESSAGE_ARGUMENT_ARRAY
-    } flags
+    }
     f
     id
     LANG_NEUTRAL SUBLANG_DEFAULT make-lang-id
     32768 [ TCHAR <c-array> ] [ ] bi
-    f pick [ FormatMessage 0 = [ id error-message-failed ] when ] dip
-    utf16n alien>string [ blank? ] trim ;
+    f pick [ FormatMessage ] dip
+    swap zero?
+    [ drop "Unknown error 0x" id HEX: ffff,ffff bitand >hex append ]
+    [ utf16n alien>string [ blank? ] trim ] if ;
 
 : win32-error-string ( -- str )
     GetLastError n>win32-error-string ;
 
+ERROR: windows-error n string ;
+
 : (win32-error) ( n -- )
-    [ win32-error-string throw ] unless-zero ;
+    [ dup win32-error-string windows-error ] unless-zero ;
 
 : win32-error ( -- )
     GetLastError (win32-error) ;
index 43307cb6bac99561b4cb939761724fe07fc516d5..93784ea3708aaab2ab7c9e646c4031e10d65c12e 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2005, 2006 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.syntax alien.destructors
-kernel windows.types math.bitwise ;
+kernel windows.types math.bitwise literals ;
 IN: windows.gdi32
 
 CONSTANT: BI_RGB 0
@@ -818,7 +818,7 @@ CONSTANT: TA_RIGHT 2
 CONSTANT: TA_RTLREADING 256
 CONSTANT: TA_NOUPDATECP 0
 CONSTANT: TA_UPDATECP 1
-: TA_MASK ( -- n ) { TA_BASELINE TA_CENTER TA_UPDATECP TA_RTLREADING } flags ; foldable
+CONSTANT: TA_MASK flags{ TA_BASELINE TA_CENTER TA_UPDATECP TA_RTLREADING }
 CONSTANT: VTA_BASELINE 24
 CONSTANT: VTA_CENTER 6
 ALIAS: VTA_LEFT TA_BOTTOM
index db0005e21956733a80dc8211f460f6fed3d9da9f..94cedef38aa0dafef003f5d010b7571b982fff73 100644 (file)
@@ -199,7 +199,7 @@ CONSTANT: THREAD_PRIORITY_LOWEST -2
 CONSTANT: THREAD_PRIORITY_NORMAL 0
 CONSTANT: THREAD_PRIORITY_TIME_CRITICAL 15
 
-C-ENUM:
+ENUM: COMPUTER_NAME_FORMAT
     ComputerNameNetBIOS
     ComputerNameDnsHostname
     ComputerNameDnsDomain
@@ -210,8 +210,6 @@ C-ENUM:
     ComputerNamePhysicalDnsFullyQualified
     ComputerNameMax ;
 
-TYPEDEF: uint COMPUTER_NAME_FORMAT
-
 STRUCT: OVERLAPPED
     { internal UINT_PTR }
     { internal-high UINT_PTR }
@@ -1352,7 +1350,7 @@ FUNCTION: DWORD GetPriorityClass ( HANDLE hProcess ) ;
 ! FUNCTION: GetPrivateProfileStringW
 ! FUNCTION: GetPrivateProfileStructA
 ! FUNCTION: GetPrivateProfileStructW
-FUNCTION: LPVOID GetProcAddress ( HMODULE hModule, char* lpProcName ) ;
+FUNCTION: LPVOID GetProcAddress ( HMODULE hModule, c-string lpProcName ) ;
 ! FUNCTION: GetProcessAffinityMask
 ! FUNCTION: GetProcessHandleCount
 ! FUNCTION: GetProcessHeap
index 8e831e153e0cf7f9399fb829efc4081e0f2cda39..4b119ba5faced6e1fbd3b6a678bd43d71345c9ca 100644 (file)
@@ -1,35 +1,35 @@
 USING: alien sequences alien.libraries ;
 {
-    { "advapi32"    "advapi32.dll"       "stdcall" }
-    { "dinput"      "dinput8.dll"        "stdcall" }
-    { "gdi32"       "gdi32.dll"          "stdcall" }
-    { "user32"      "user32.dll"         "stdcall" }
-    { "kernel32"    "kernel32.dll"       "stdcall" }
-    { "winsock"     "ws2_32.dll"         "stdcall" }
-    { "mswsock"     "mswsock.dll"        "stdcall" }
-    { "shell32"     "shell32.dll"        "stdcall" }
-    { "libc"        "msvcrt.dll"         "cdecl"   }
-    { "libm"        "msvcrt.dll"         "cdecl"   }
-    { "gl"          "opengl32.dll"       "stdcall" }
-    { "glu"         "glu32.dll"          "stdcall" }
-    { "ole32"       "ole32.dll"          "stdcall" }
-    { "usp10"       "usp10.dll"          "stdcall" }
-    { "psapi"       "psapi.dll"          "stdcall" }
-    { "xinput"      "xinput1_3.dll"      "stdcall" }
-    { "dxgi"        "dxgi.dll"           "stdcall" }
-    { "d2d1"        "d2d1.dll"           "stdcall" }
-    { "d3d9"        "d3d9.dll"           "stdcall" }
-    { "d3d10"       "d3d10.dll"          "stdcall" }
-    { "d3d10_1"     "d3d10_1.dll"        "stdcall" }
-    { "d3d11"       "d3d11.dll"          "stdcall" }
-    { "d3dcompiler" "d3dcompiler_42.dll" "stdcall" } 
-    { "d3dcsx"      "d3dcsx_42.dll"      "stdcall" }
-    { "d3dx9"       "d3dx9_42.dll"       "stdcall" }
-    { "d3dx10"      "d3dx10_42.dll"      "stdcall" }
-    { "d3dx11"      "d3dx11_42.dll"      "stdcall" }
-    { "dwrite"      "dwrite.dll"         "stdcall" }
-    { "x3daudio"    "x3daudio1_6.dll"    "stdcall" }
-    { "xactengine"  "xactengine3_5.dll"  "stdcall" }
-    { "xapofx"      "xapofx1_3.dll"      "stdcall" }
-    { "xaudio2"     "xaudio2_5.dll"      "stdcall" }
+    { "advapi32"    "advapi32.dll"       stdcall }
+    { "dinput"      "dinput8.dll"        stdcall }
+    { "gdi32"       "gdi32.dll"          stdcall }
+    { "user32"      "user32.dll"         stdcall }
+    { "kernel32"    "kernel32.dll"       stdcall }
+    { "winsock"     "ws2_32.dll"         stdcall }
+    { "mswsock"     "mswsock.dll"        stdcall }
+    { "shell32"     "shell32.dll"        stdcall }
+    { "libc"        "msvcrt.dll"         cdecl   }
+    { "libm"        "msvcrt.dll"         cdecl   }
+    { "gl"          "opengl32.dll"       stdcall }
+    { "glu"         "glu32.dll"          stdcall }
+    { "ole32"       "ole32.dll"          stdcall }
+    { "usp10"       "usp10.dll"          stdcall }
+    { "psapi"       "psapi.dll"          stdcall }
+    { "xinput"      "xinput1_3.dll"      stdcall }
+    { "dxgi"        "dxgi.dll"           stdcall }
+    { "d2d1"        "d2d1.dll"           stdcall }
+    { "d3d9"        "d3d9.dll"           stdcall }
+    { "d3d10"       "d3d10.dll"          stdcall }
+    { "d3d10_1"     "d3d10_1.dll"        stdcall }
+    { "d3d11"       "d3d11.dll"          stdcall }
+    { "d3dcompiler" "d3dcompiler_42.dll" stdcall } 
+    { "d3dcsx"      "d3dcsx_42.dll"      stdcall }
+    { "d3dx9"       "d3dx9_42.dll"       stdcall }
+    { "d3dx10"      "d3dx10_42.dll"      stdcall }
+    { "d3dx11"      "d3dx11_42.dll"      stdcall }
+    { "dwrite"      "dwrite.dll"         stdcall }
+    { "x3daudio"    "x3daudio1_6.dll"    stdcall }
+    { "xactengine"  "xactengine3_5.dll"  stdcall }
+    { "xapofx"      "xapofx1_3.dll"      stdcall }
+    { "xaudio2"     "xaudio2_5.dll"      stdcall }
 } [ first3 add-library ] each
index e38477c98c7bdf60ca018da592ba93b1da9dec53..c2587698d0f53e5d97394d36e7e5247dcfb6537e 100644 (file)
@@ -26,8 +26,8 @@ IN: windows.offscreen
 : make-bitmap ( dim dc -- hBitmap bits )
     [ nip ]
     [
-        swap (bitmap-info) DIB_RGB_COLORS f <void*>
-        [ f 0 CreateDIBSection ] keep *void*
+        swap (bitmap-info) DIB_RGB_COLORS { void* }
+        [ f 0 CreateDIBSection ] [ ] with-out-parameters
     ] 2bi
     [ [ SelectObject drop ] keep ] dip ;
 
@@ -46,7 +46,7 @@ IN: windows.offscreen
         ubyte-components >>component-type
         t >>upside-down? ;
 
-: with-memory-dc ( quot: ( hDC -- ) -- )
+: with-memory-dc ( ..a quot: ( ..a hDC -- ..b ) -- ..b )
     [ [ f CreateCompatibleDC &DeleteDC ] dip call ] with-destructors ; inline
 
 :: make-bitmap-image ( dim dc quot -- image )
index 6e90cae89a77a70ab544f2967664cf3c031bc413..538a1428786694969ac5bda6855f3b21f9b784b6 100644 (file)
@@ -10,8 +10,8 @@ LIBRARY: ole32
 
 TYPEDEF: GUID* REFGUID
 TYPEDEF: void* LPUNKNOWN
-TYPEDEF: wchar_t* LPOLESTR
-TYPEDEF: wchar_t* LPCOLESTR
+TYPEDEF: LPWSTR LPOLESTR
+TYPEDEF: LPWSTR LPCOLESTR
 
 TYPEDEF: REFGUID LPGUID
 TYPEDEF: REFGUID REFIID
index 63f705263cef449b91f0d0e6cee0fb7c5a12e1f5..32e067a2001cc0646a0e037d297d0f165182c6fd 100644 (file)
@@ -57,7 +57,7 @@ FUNCTION: BOOL wglMakeCurrent ( HDC hDC, HGLRC hglrc ) ;
 
 ! WGL_ARB_extensions_string extension
 
-GL-FUNCTION: char* wglGetExtensionsStringARB { } ( HDC hDC ) ;
+GL-FUNCTION: c-string wglGetExtensionsStringARB { } ( HDC hDC ) ;
 
 ! WGL_ARB_pixel_format extension
 
index 9e322d9cde2bc2f89e6bb54541b9c284c0b48d8e..e2e4b113a4156b2d41f06a7b262da6b1cb25767f 100644 (file)
@@ -11,11 +11,6 @@ TYPEDEF: uchar               UCHAR
 TYPEDEF: uchar               BYTE
 
 TYPEDEF: ushort              wchar_t
-SYMBOL: wchar_t*
-<<
-{ char* utf16n } \ wchar_t* typedef
-\ wchar_t \ wchar_t* "pointer-c-type" set-word-prop
->>
 
 TYPEDEF: wchar_t             WCHAR
 
@@ -74,8 +69,8 @@ TYPEDEF: ULARGE_INTEGER* PULARGE_INTEGER
 TYPEDEF: size_t SIZE_T
 TYPEDEF: ptrdiff_t SSIZE_T
 
-TYPEDEF: wchar_t*  LPCSTR
-TYPEDEF: wchar_t*  LPWSTR
+TYPEDEF: { c-string utf16n } LPCSTR
+TYPEDEF: { c-string utf16n } LPWSTR
 TYPEDEF: WCHAR       TCHAR
 TYPEDEF: LPWSTR      LPTCH
 TYPEDEF: LPWSTR      PTCH
@@ -129,14 +124,14 @@ TYPEDEF: DWORD               LGRPID
 TYPEDEF: LONG_PTR            LPARAM
 TYPEDEF: BOOL*               LPBOOL
 TYPEDEF: BYTE*               LPBYTE
-TYPEDEF: WCHAR*              LPCWSTR
+TYPEDEF: { c-string utf16n } LPCWSTR
 ! TYPEDEF: WCHAR*              LPWSTR
 
-TYPEDEF: WCHAR*               LPSTR
-TYPEDEF: wchar_t* LPCTSTR
-TYPEDEF: wchar_t* LPWTSTR
+TYPEDEF: { c-string utf16n } LPSTR
+TYPEDEF: { c-string utf16n } LPCTSTR
+TYPEDEF: { c-string utf16n } LPWTSTR
 
-TYPEDEF: wchar_t*       LPTSTR
+TYPEDEF: { c-string utf16n } LPTSTR
 TYPEDEF: LPCSTR      PCTSTR
 TYPEDEF: LPSTR       PTSTR
 
@@ -149,7 +144,7 @@ TYPEDEF: BOOLEAN*            PBOOLEAN
 TYPEDEF: BYTE*               PBYTE
 TYPEDEF: CHAR*               PCHAR
 TYPEDEF: CHAR*               PCSTR
-TYPEDEF: WCHAR*              PCWSTR
+TYPEDEF: { c-string utf16n } PCWSTR
 TYPEDEF: DWORD*              PDWORD
 TYPEDEF: DWORDLONG*          PDWORDLONG
 TYPEDEF: DWORD_PTR*          PDWORD_PTR
@@ -186,9 +181,9 @@ TYPEDEF: ULONG_PTR*          PULONG_PTR
 TYPEDEF: ULONG32*            PULONG32
 TYPEDEF: ULONG64*            PULONG64
 TYPEDEF: USHORT*             PUSHORT
-TYPEDEF: WCHAR*              PWCHAR
+TYPEDEF: { c-string utf16n } PWCHAR
 TYPEDEF: WORD*               PWORD
-TYPEDEF: WCHAR*              PWSTR
+TYPEDEF: { c-string utf16n } PWSTR
 TYPEDEF: HANDLE              SC_HANDLE
 TYPEDEF: LPVOID              SC_LOCK
 TYPEDEF: HANDLE              SERVICE_STATUS_HANDLE
@@ -354,7 +349,7 @@ STRUCT: LVITEM
 
 STRUCT: LVFINDINFO
     { flags uint }
-    { psz char* }
+    { psz c-string }
     { lParam long }
     { pt POINT }
     { vkDirection uint } ;
old mode 100644 (file)
new mode 100755 (executable)
index 87540dc..92fec0a
@@ -2,10 +2,10 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel assocs math sequences fry io.encodings.string
 io.encodings.utf16n accessors arrays combinators destructors
-cache namespaces init fonts alien.c-types windows.usp10
-windows.offscreen windows.gdi32 windows.ole32 windows.types
-windows.fonts opengl.textures locals windows.errors
-classes.struct ;
+cache namespaces init fonts alien.c-types alien.data
+windows.usp10 windows.offscreen windows.gdi32 windows.ole32
+windows.types windows.fonts opengl.textures locals
+windows.errors classes.struct ;
 IN: windows.uniscribe
 
 TUPLE: script-string < disposable font string metrics ssa size image ;
@@ -20,14 +20,12 @@ TUPLE: script-string < disposable font string metrics ssa size image ;
         swap ! icp
         FALSE ! fTrailing
     ] if
-    0 <int> [ ScriptStringCPtoX ole32-error ] keep *int ;
+    { int } [ ScriptStringCPtoX ole32-error ] [ ] with-out-parameters ;
 
 : x>line-offset ( x script-string -- n trailing )
     ssa>> ! ssa
     swap ! iX
-    0 <int> ! pCh
-    0 <int> ! piTrailing
-    [ ScriptStringXtoCP ole32-error ] 2keep [ *int ] bi@ ;
+    { int int } [ ScriptStringXtoCP ole32-error ] [ ] with-out-parameters ;
 
 <PRIVATE
 
@@ -82,7 +80,6 @@ TUPLE: script-string < disposable font string metrics ssa size image ;
 : script-string-size ( script-string -- dim )
     ssa>> ScriptString_pSize
     dup win32-error=0/f
-    SIZE memory>struct
     [ cx>> ] [ cy>> ] bi 2array ;
 
 : dc-metrics ( dc -- metrics )
index 27636271cb7f4a2dcb2572fe3f83f90b385854a1..54d31bb12b97927113760aa9e41c8a0e9ab2c6f1 100644 (file)
@@ -33,18 +33,17 @@ CONSTANT: WS_MINIMIZEBOX      HEX: 00020000
 CONSTANT: WS_MAXIMIZEBOX      HEX: 00010000
 
 ! Common window styles
-: WS_OVERLAPPEDWINDOW ( -- n )
-    {
+CONSTANT: WS_OVERLAPPEDWINDOW
+    flags{
         WS_OVERLAPPED
         WS_CAPTION
         WS_SYSMENU
         WS_THICKFRAME
         WS_MINIMIZEBOX
         WS_MAXIMIZEBOX
-    } flags ; foldable
+    }
 
-: WS_POPUPWINDOW ( -- n )
-    { WS_POPUP WS_BORDER WS_SYSMENU } flags ; foldable
+CONSTANT: WS_POPUPWINDOW flags{ WS_POPUP WS_BORDER WS_SYSMENU }
 
 ALIAS: WS_CHILDWINDOW      WS_CHILD
 
@@ -76,11 +75,11 @@ CONSTANT: WS_EX_CONTROLPARENT     HEX: 00010000
 CONSTANT: WS_EX_STATICEDGE        HEX: 00020000
 CONSTANT: WS_EX_APPWINDOW         HEX: 00040000
 
-: WS_EX_OVERLAPPEDWINDOW ( -- n )
-    WS_EX_WINDOWEDGE WS_EX_CLIENTEDGE bitor ; foldable
+CONSTANT: WS_EX_OVERLAPPEDWINDOW
+    flags{ WS_EX_WINDOWEDGE WS_EX_CLIENTEDGE }
 
-: WS_EX_PALETTEWINDOW ( -- n )
-    { WS_EX_WINDOWEDGE WS_EX_TOOLWINDOW WS_EX_TOPMOST } flags ; foldable
+CONSTANT: WS_EX_PALETTEWINDOW 
+    flags{ WS_EX_WINDOWEDGE WS_EX_TOOLWINDOW WS_EX_TOPMOST }
 
 CONSTANT: CS_VREDRAW          HEX: 0001
 CONSTANT: CS_HREDRAW          HEX: 0002
@@ -580,8 +579,8 @@ CONSTANT: SWP_HIDEWINDOW 128
 CONSTANT: SWP_NOCOPYBITS 256
 CONSTANT: SWP_NOOWNERZORDER 512
 CONSTANT: SWP_NOSENDCHANGING 1024
-CONSTANT: SWP_DRAWFRAME SWP_FRAMECHANGED
-CONSTANT: SWP_NOREPOSITION SWP_NOOWNERZORDER
+ALIAS: SWP_DRAWFRAME SWP_FRAMECHANGED
+ALIAS: SWP_NOREPOSITION SWP_NOOWNERZORDER
 CONSTANT: SWP_DEFERERASE 8192
 CONSTANT: SWP_ASYNCWINDOWPOS 16384
 
@@ -927,6 +926,87 @@ STRUCT: RAWINPUTDEVICELIST
     { dwType  DWORD  } ;
 TYPEDEF: RAWINPUTDEVICELIST* PRAWINPUTDEVICELIST
 
+CONSTANT: CCHFORMNAME 32
+
+CONSTANT: CDS_UPDATEREGISTRY      HEX: 00000001
+CONSTANT: CDS_TEST                HEX: 00000002
+CONSTANT: CDS_FULLSCREEN          HEX: 00000004
+CONSTANT: CDS_GLOBAL              HEX: 00000008
+CONSTANT: CDS_SET_PRIMARY         HEX: 00000010
+CONSTANT: CDS_RESET               HEX: 40000000
+CONSTANT: CDS_SETRECT             HEX: 20000000
+CONSTANT: CDS_NORESET             HEX: 10000000
+
+CONSTANT: DISP_CHANGE_SUCCESSFUL 0
+CONSTANT: DISP_CHANGE_RESTART 1
+CONSTANT: DISP_CHANGE_FAILED     -1
+CONSTANT: DISP_CHANGE_BADMODE    -2
+CONSTANT: DISP_CHANGE_NOTUPDATED -3
+CONSTANT: DISP_CHANGE_BADFLAGS   -4
+CONSTANT: DISP_CHANGE_BADPARAM   -5
+
+
+
+STRUCT: DEVMODE
+    { dmDeviceName TCHAR[CCHDEVICENAME] }
+    { dmSpecVersion WORD }
+    { dmDriverVersion WORD }
+    { dmSize WORD }
+    { dmDriverExtra WORD }
+    { dmFields DWORD }
+
+    { dmOrientation short }
+    { dmPaperSize short }
+    { dmPaperLength short }
+    { dmPaperWidth short }
+    { dmScale short }
+    { dmCopies short }
+    { dmDefaultSource short }
+    { dmPrintQuality short }
+
+    { dmColor short }
+    { dmDuplex short }
+    { dmYResolution short }
+    { dmTTOption short }
+    { dmCollate short }
+    { dmFormName TCHAR[CCHFORMNAME] }
+    { dmLogPixels WORD }
+    { dmBitsPerPel DWORD }
+    { dmPelsWidth DWORD }
+    { dmPelsHeight DWORD }
+    { dmDisplayFlags DWORD }
+    { dmDisplayFrequency DWORD }
+    { dmiCMMethod DWORD }
+    { dmICMIntent DWORD }
+
+    { dmMediaType DWORD }
+    { dmDitherType DWORD }
+    { dmReserved1 DWORD }
+    { dmReserved2 DWORD }
+    { dmPanningWidth DWORD } ;
+
+! union { DWORD dmDisplayFlags; DWORD dmNup; } ;
+  ! union {
+    ! struct {
+      ! short dmOrientation;
+      ! short dmPaperSize;
+      ! short dmPaperLength;
+      ! short dmPaperWidth;
+      ! short dmScale;
+      ! short dmCopies;
+      ! short dmDefaultSource;
+      ! short dmPrintQuality;
+    ! } ;
+    ! struct {
+      ! POINTL dmPosition;
+      ! DWORD dmDisplayOrientation;
+      ! DWORD dmDisplayFixedOutput;
+    ! } ;
+  ! } ;
+
+TYPEDEF: DEVMODE* PDEVMODE
+TYPEDEF: DEVMODE* LPDEVMODE
+
 LIBRARY: user32
 
 FUNCTION: HKL ActivateKeyboardLayout ( HKL hkl, UINT Flags ) ;
@@ -965,10 +1045,10 @@ FUNCTION: HDC BeginPaint ( HWND hwnd, LPPAINTSTRUCT lpPaint ) ;
 ! FUNCTION: CascadeChildWindows
 ! FUNCTION: CascadeWindows
 ! FUNCTION: ChangeClipboardChain
-! FUNCTION: ChangeDisplaySettingsA
-! FUNCTION: ChangeDisplaySettingsExA
-! FUNCTION: ChangeDisplaySettingsExW
-! FUNCTION: ChangeDisplaySettingsW
+FUNCTION: LONG ChangeDisplaySettingsExW ( LPCTSTR lpszDeviceName, DEVMODE *lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam ) ;
+FUNCTION: LONG ChangeDisplaySettingsW ( DEVMODE *lpDevMode, DWORD dwFlags ) ;
+ALIAS: ChangeDisplaySettingsEx ChangeDisplaySettingsExW
+ALIAS: ChangeDisplaySettings ChangeDisplaySettingsW
 ! FUNCTION: ChangeMenuA
 ! FUNCTION: ChangeMenuW
 ! FUNCTION: CharLowerA
@@ -1169,11 +1249,12 @@ FUNCTION: UINT EnumClipboardFormats ( UINT format ) ;
 ! FUNCTION: EnumDesktopWindows
 ! FUNCTION: EnumDisplayDevicesA
 ! FUNCTION: EnumDisplayDevicesW
-! FUNCTION: EnumDisplayMonitors
+! FUNCTION: BOOL EnumDisplayMonitors ( HDC hdc, LPCRECT lprcClip, MONITORENUMPROC lpfnEnum, LPARAM dwData ) ;
 ! FUNCTION: EnumDisplaySettingsA
 ! FUNCTION: EnumDisplaySettingsExA
 ! FUNCTION: EnumDisplaySettingsExW
-! FUNCTION: EnumDisplaySettingsW
+FUNCTION: BOOL EnumDisplaySettingsW ( LPCTSTR lpszDeviceName, DWORD iModeNum, DEVMODE *lpDevMode ) ;
+ALIAS: EnumDisplaySettings EnumDisplaySettingsW
 ! FUNCTION: EnumPropsA
 ! FUNCTION: EnumPropsExA
 ! FUNCTION: EnumPropsExW
@@ -1186,8 +1267,8 @@ FUNCTION: UINT EnumClipboardFormats ( UINT format ) ;
 ! FUNCTION: ExcludeUpdateRgn
 ! FUNCTION: ExitWindowsEx
 FUNCTION: int FillRect ( HDC hDC, RECT* lprc, HBRUSH hbr ) ;
-FUNCTION: HWND FindWindowA ( char* lpClassName, char* lpWindowName ) ;
-FUNCTION: HWND FindWindowExA ( HWND hwndParent, HWND childAfter, char* lpClassName, char* lpWindowName ) ;
+FUNCTION: HWND FindWindowA ( c-string lpClassName, c-string lpWindowName ) ;
+FUNCTION: HWND FindWindowExA ( HWND hwndParent, HWND childAfter, c-string lpClassName, c-string lpWindowName ) ;
 ! FUNCTION: FindWindowExW
 ! FUNCTION: FindWindowW
 ! FUNCTION: FlashWindow
@@ -1236,7 +1317,7 @@ FUNCTION: DWORD GetClipboardSequenceNumber ( ) ;
 ! FUNCTION: GetCursorPos
 FUNCTION: HDC GetDC ( HWND hWnd ) ;
 FUNCTION: HDC GetDCEx ( HWND hWnd, HRGN hrgnClip, DWORD flags ) ;
-! FUNCTION: GetDesktopWindow
+FUNCTION: HWND GetDesktopWindow ( ) ;
 ! FUNCTION: GetDialogBaseUnits
 ! FUNCTION: GetDlgCtrlID
 ! FUNCTION: GetDlgItem
@@ -1245,7 +1326,7 @@ FUNCTION: HDC GetDCEx ( HWND hWnd, HRGN hrgnClip, DWORD flags ) ;
 ! FUNCTION: GetDlgItemTextW
 FUNCTION: uint GetDoubleClickTime ( ) ;
 FUNCTION: HWND GetFocus ( ) ;
-! FUNCTION: GetForegroundWindow
+FUNCTION: HWND GetForegroundWindow ( ) ;
 ! FUNCTION: GetGuiResources
 ! FUNCTION: GetGUIThreadInfo
 ! FUNCTION: GetIconInfo
@@ -1345,6 +1426,9 @@ FUNCTION: HWND GetWindow ( HWND hWnd, UINT uCmd ) ;
 ! FUNCTION: GetWindowLongW
 FUNCTION: LONG_PTR GetWindowLongW ( HANDLE hWnd, int index ) ;
 ALIAS: GetWindowLong GetWindowLongW
+
+FUNCTION: LONG_PTR GetWindowLongPtrW ( HWND hWnd, int nIndex ) ;
+ALIAS: GetWindowLongPtr GetWindowLongPtrW
 ! FUNCTION: GetWindowModuleFileName
 ! FUNCTION: GetWindowModuleFileNameA
 ! FUNCTION: GetWindowModuleFileNameW
@@ -1692,6 +1776,9 @@ ALIAS: SetWindowLong SetWindowLongW
 ! FUNCTION: SetWindowPlacement
 FUNCTION: BOOL SetWindowPos ( HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags ) ;
 
+FUNCTION: LONG_PTR SetWindowLongPtrW ( HWND hWnd, int nIndex, LONG_PTR dwNewLong ) ;
+ALIAS: SetWindowLongPtr SetWindowLongPtrW
+
 : HWND_BOTTOM ( -- alien ) 1 <alien> ;
 : HWND_NOTOPMOST ( -- alien ) -2 <alien> ;
 CONSTANT: HWND_TOP f
index 57702d8780f53084f788dc636bb50e298fdf01de..7a103a91b4552e1a0dc3de3b528139a21e219cd7 100644 (file)
@@ -37,27 +37,27 @@ FUNCTION: HRESULT ScriptLayout (
     int* piLogicalToVisual
 ) ;
 
-C-ENUM: SCRIPT_JUSTIFY_NONE
-SCRIPT_JUSTIFY_ARABIC_BLANK
-SCRIPT_JUSTIFY_CHARACTER
-SCRIPT_JUSTIFY_RESERVED1
-SCRIPT_JUSTIFY_BLANK
-SCRIPT_JUSTIFY_RESERVED2
-SCRIPT_JUSTIFY_RESERVED3
-SCRIPT_JUSTIFY_ARABIC_NORMAL
-SCRIPT_JUSTIFY_ARABIC_KASHIDA
-SCRIPT_JUSTIFY_ALEF
-SCRIPT_JUSTIFY_HA
-SCRIPT_JUSTIFY_RA
-SCRIPT_JUSTIFY_BA
-SCRIPT_JUSTIFY_BARA
-SCRIPT_JUSTIFY_SEEN
-SCRIPT_JUSTIFFY_RESERVED4 ;
+CONSTANT: SCRIPT_JUSTIFY_NONE 0
+CONSTANT: SCRIPT_JUSTIFY_ARABIC_BLANK 1
+CONSTANT: SCRIPT_JUSTIFY_CHARACTER 2
+CONSTANT: SCRIPT_JUSTIFY_RESERVED1 3
+CONSTANT: SCRIPT_JUSTIFY_BLANK 4
+CONSTANT: SCRIPT_JUSTIFY_RESERVED2 5
+CONSTANT: SCRIPT_JUSTIFY_RESERVED3 6
+CONSTANT: SCRIPT_JUSTIFY_ARABIC_NORMAL 7
+CONSTANT: SCRIPT_JUSTIFY_ARABIC_KASHIDA 8
+CONSTANT: SCRIPT_JUSTIFY_ALEF 9
+CONSTANT: SCRIPT_JUSTIFY_HA 10
+CONSTANT: SCRIPT_JUSTIFY_RA 11
+CONSTANT: SCRIPT_JUSTIFY_BA 12
+CONSTANT: SCRIPT_JUSTIFY_BARA 13
+CONSTANT: SCRIPT_JUSTIFY_SEEN 14
+CONSTANT: SCRIPT_JUSTIFFY_RESERVED4 15
 
 STRUCT: SCRIPT_VISATTR
     { flags WORD } ;
 
-TYPEDEF: void* SCRIPT_CACHE*
+C-TYPE: SCRIPT_CACHE
 C-TYPE: ABC
 
 FUNCTION: HRESULT ScriptShape (
index b8d1f099d20ce7bc6db9fb9e17a26372fb9dbfdb..4dd7d7385c9ee94d3ead654665497c4abd9aefdd 100644 (file)
@@ -73,8 +73,7 @@ CONSTANT: AI_PASSIVE     1
 CONSTANT: AI_CANONNAME   2
 CONSTANT: AI_NUMERICHOST 4
 
-: AI_MASK ( -- n )
-    { AI_PASSIVE AI_CANONNAME AI_NUMERICHOST } flags ; inline
+CONSTANT: AI_MASK flags{ AI_PASSIVE AI_CANONNAME AI_NUMERICHOST }
 
 CONSTANT: NI_NUMERICHOST 1
 CONSTANT: NI_NUMERICSERV 2
@@ -121,7 +120,7 @@ STRUCT: sockaddr-in6
     { scopeid uint } ;
 
 STRUCT: hostent
-    { name char* }
+    { name c-string }
     { aliases void* }
     { addrtype short }
     { length short }
@@ -133,7 +132,7 @@ STRUCT: addrinfo
     { socktype int }
     { protocol int }
     { addrlen size_t }
-    { canonname char* }
+    { canonname c-string }
     { addr sockaddr* }
     { next addrinfo* } ;
 
@@ -141,33 +140,33 @@ STRUCT: timeval
     { sec long }
     { usec long } ;
 
-TYPEDEF: void* fd_set*
+C-TYPE: fd_set
 
 LIBRARY: winsock
 
-FUNCTION: int setsockopt ( SOCKET s, int level, int optname, char* optval, int optlen ) ;
+FUNCTION: int setsockopt ( SOCKET s, int level, int optname, c-string optval, int optlen ) ;
 
 FUNCTION: ushort htons ( ushort n ) ;
 FUNCTION: ushort ntohs ( ushort n ) ;
 FUNCTION: int bind ( void* socket, sockaddr-in* sockaddr, int len ) ;
 FUNCTION: int listen ( void* socket, int backlog ) ;
-FUNCTION: char* inet_ntoa ( int in-addr ) ;
-FUNCTION: int getaddrinfo ( char* nodename,
-                            char* servername,
+FUNCTION: c-string inet_ntoa ( int in-addr ) ;
+FUNCTION: int getaddrinfo ( c-string nodename,
+                            c-string servername,
                             addrinfo* hints,
                             addrinfo** res ) ;
 
 FUNCTION: void freeaddrinfo ( addrinfo* ai ) ;
 
 
-FUNCTION: hostent* gethostbyname ( char* name ) ;
-FUNCTION: int gethostname ( char* name, int len ) ;
+FUNCTION: hostent* gethostbyname ( c-string name ) ;
+FUNCTION: int gethostname ( c-string name, int len ) ;
 FUNCTION: int connect ( void* socket, sockaddr-in* sockaddr, int addrlen ) ;
 FUNCTION: int select ( int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timeval* timeout ) ;
 FUNCTION: int closesocket ( SOCKET s ) ;
 FUNCTION: int shutdown ( SOCKET s, int how ) ;
-FUNCTION: int send ( SOCKET s, char* buf, int len, int flags ) ;
-FUNCTION: int recv ( SOCKET s, char* buf, int len, int flags ) ;
+FUNCTION: int send ( SOCKET s, c-string buf, int len, int flags ) ;
+FUNCTION: int recv ( SOCKET s, c-string buf, int len, int flags ) ;
 
 FUNCTION: int getsockname ( SOCKET s, sockaddr-in* address, int* addrlen ) ;
 FUNCTION: int getpeername ( SOCKET s, sockaddr-in* address, int* addrlen ) ;
index c08ff1d1768989bc4436f7967001d0338ce07d0f..496b9d688c3ea9ee381e4f6bcf836a59d1d2b69f 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2006, 2007 Slava Pestov
+! Copyright (C) 2006, 2010 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types alien.strings classes.struct
 io.encodings.utf8 kernel namespaces sequences
@@ -10,8 +10,10 @@ IN: x11.clipboard
 ! and http://common-lisp.net/~crhodes/clx/demo/clipboard.lisp.
 
 : XA_CLIPBOARD ( -- atom ) "CLIPBOARD" x-atom ;
-
 : XA_UTF8_STRING ( -- atom ) "UTF8_STRING" x-atom ;
+: XA_TARGETS ( -- atom ) "TARGETS" x-atom ;
+: XA_TIMESTAMP ( -- atom ) "TIMESTAMP" x-atom ;
+: XA_TEXT ( -- atom ) "TEXT" x-atom ;
 
 TUPLE: x-clipboard atom contents ;
 
@@ -43,16 +45,14 @@ TUPLE: x-clipboard atom contents ;
 
 : set-targets-prop ( evt -- )
     [ dpy get ] dip [ requestor>> ] [ property>> ] bi
-    "TARGETS" x-atom 32 PropModeReplace
-    {
-        "UTF8_STRING" "STRING" "TARGETS" "TIMESTAMP"
-    } [ x-atom ] int-array{ } map-as
+    XA_TARGETS 32 PropModeReplace
+    XA_UTF8_STRING XA_STRING XA_TARGETS XA_TIMESTAMP int-array{ } 4sequence
     4 XChangeProperty drop ;
 
 : set-timestamp-prop ( evt -- )
     [ dpy get ] dip
     [ requestor>> ]
-    [ property>> "TIMESTAMP" x-atom 32 PropModeReplace ]
+    [ property>> XA_TIMESTAMP 32 PropModeReplace ]
     [ time>> <int> ] tri
     1 XChangeProperty drop ;
 
index 763cddaaf10877f581eafc14d8bbe7f501bbbc7e..e0b040211e9a58e3daa609c8061d591c98ba7803 100644 (file)
@@ -406,4 +406,6 @@ CONSTANT: MSBFirst 1
 ! * EXTENDED WINDOW MANAGER HINTS
 ! *****************************************************************
 
-C-ENUM: _NET_WM_STATE_REMOVE _NET_WM_STATE_ADD _NET_WM_STATE_TOGGLE ;
+CONSTANT: _NET_WM_STATE_REMOVE 0
+CONSTANT: _NET_WM_STATE_ADD 1
+CONSTANT: _NET_WM_STATE_TOGGLE 2
index febbbfa13505b4ab4fbc27714153c2082ff2cea9..949c751de5ab30f5ae37602eba270a22c8c5bca7 100644 (file)
@@ -1,7 +1,8 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
+! Copyright (C) 2005, 2010 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays classes.struct combinators kernel
-math.order namespaces x11 x11.xlib ;
+USING: accessors arrays classes.struct combinators
+combinators.short-circuit kernel math.order namespaces
+x11 x11.xlib ;
 IN: x11.events
 
 GENERIC: expose-event ( event window -- )
@@ -16,7 +17,7 @@ GENERIC: enter-event ( event window -- )
 
 GENERIC: leave-event ( event window -- )
 
-GENERIC: wheel-event ( event window -- )
+GENERIC: scroll-event ( event window -- )
 
 GENERIC: motion-event ( event window -- )
 
@@ -42,13 +43,13 @@ GENERIC: client-event ( event window -- )
 
 : events-queued ( mode -- n ) [ dpy get ] dip XEventsQueued ;
 
-: wheel? ( event -- ? ) button>> 4 7 between? ;
+: mouse-scroll? ( event -- ? ) button>> 4 7 between? ;
 
 : button-down-event$ ( event window -- )
-    over wheel? [ wheel-event ] [ button-down-event ] if ;
+    over mouse-scroll? [ scroll-event ] [ button-down-event ] if ;
 
 : button-up-event$ ( event window -- )
-    over wheel? [ 2drop ] [ button-up-event ] if ;
+    over mouse-scroll? [ 2drop ] [ button-up-event ] if ;
 
 : handle-event ( event window -- )
     swap dup XAnyEvent>> type>> {
@@ -75,7 +76,11 @@ GENERIC: client-event ( event window -- )
 : event-dim ( event -- dim )
     [ width>> ] [ height>> ] bi 2array ;
 
+: XA_WM_PROTOCOLS ( -- atom ) "WM_PROTOCOLS" x-atom ;
+: XA_WM_DELETE_WINDOW ( -- atom ) "WM_DELETE_WINDOW" x-atom ;
+
 : close-box? ( event -- ? )
-    [ message_type>> "WM_PROTOCOLS" x-atom = ]
-    [ data0>> "WM_DELETE_WINDOW" x-atom = ]
-    bi and ;
+    {
+        [ message_type>> XA_WM_PROTOCOLS = ]
+        [ data0>> XA_WM_DELETE_WINDOW = ]
+    } 1&& ;
index 5bc58e5f0aa5961cd8ead8d54b3e9cd01d3cccc6..d095853913b2ddd1795a4d9d6b7098f83ac3a363 100644 (file)
@@ -55,9 +55,9 @@ X-FUNCTION: void glXSwapBuffers ( Display* dpy, GLXDrawable drawable ) ;
 X-FUNCTION: void glXUseXFont ( Font font, int first, int count, int listBase ) ;
 X-FUNCTION: void glXWaitGL ( ) ;
 X-FUNCTION: void glXWaitX ( ) ;
-X-FUNCTION: char* glXGetClientString ( Display* dpy, int name ) ;
-X-FUNCTION: char* glXQueryServerString ( Display* dpy, int screen, int name ) ;
-X-FUNCTION: char* glXQueryExtensionsString ( Display* dpy, int screen ) ;
+X-FUNCTION: c-string glXGetClientString ( Display* dpy, int name ) ;
+X-FUNCTION: c-string glXQueryServerString ( Display* dpy, int screen, int name ) ;
+X-FUNCTION: c-string glXQueryExtensionsString ( Display* dpy, int screen ) ;
 
 ! New for GLX 1.3
 X-FUNCTION: GLXFBConfig* glXGetFBConfigs ( Display* dpy, int screen, int* nelements ) ;
@@ -80,10 +80,10 @@ X-FUNCTION: void glXSelectEvent ( Display* dpy, GLXDrawable draw, ulong event_ma
 X-FUNCTION: void glXGetSelectedEvent ( Display* dpy, GLXDrawable draw, ulong* event_mask ) ;
 
 ! GLX 1.4 and later
-X-FUNCTION: void* glXGetProcAddress ( char* procname ) ;
+X-FUNCTION: void* glXGetProcAddress ( c-string procname ) ;
 
 ! GLX_ARB_get_proc_address extension
-X-FUNCTION: void* glXGetProcAddressARB ( char* procname ) ;
+X-FUNCTION: void* glXGetProcAddressARB ( c-string procname ) ;
 
 ! GLX_ARB_multisample
 CONSTANT: GLX_SAMPLE_BUFFERS 100000
index db2adab5dcef4863e50ab0c6e9b30a39c1f351ae..5e368f79cbd07ac27313e02c674befa66695458f 100644 (file)
@@ -4,6 +4,6 @@ USING: alien.syntax alien.parser words x11.io sequences kernel ;
 IN: x11.syntax
 
 SYNTAX: X-FUNCTION:
-    (FUNCTION:)
+    (FUNCTION:) make-function
     [ \ awaken-event-loop suffix ] dip
-    define-declared ;
\ No newline at end of file
+    define-declared ;
diff --git a/basis/x11/windows/platforms.txt b/basis/x11/windows/platforms.txt
deleted file mode 100644 (file)
index 509143d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unix
index ad0a8b11a67e06aef97f7add0082c4b8864056b4..1becb30f45f352bee99b62a50b2511729226d3bb 100644 (file)
@@ -1,19 +1,20 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
+! Copyright (C) 2005, 2010 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel math math.bitwise math.vectors
-namespaces sequences x11 x11.xlib x11.constants x11.glx arrays
-fry classes.struct ;
+namespaces sequences arrays fry classes.struct literals
+x11 x11.xlib x11.constants x11.events
+x11.glx ;
 IN: x11.windows
 
-: create-window-mask ( -- n )
-    { CWBackPixel CWBorderPixel CWColormap CWEventMask } flags ;
+CONSTANT: create-window-mask
+    flags{ CWBackPixel CWBorderPixel CWColormap CWEventMask }
 
 : create-colormap ( visinfo -- colormap )
     [ dpy get root get ] dip visual>> AllocNone
     XCreateColormap ;
 
-: event-mask ( -- n )
-    {
+CONSTANT: event-mask
+    flags{
         ExposureMask
         StructureNotifyMask
         KeyPressMask
@@ -25,7 +26,7 @@ IN: x11.windows
         EnterWindowMask
         LeaveWindowMask
         PropertyChangeMask
-    } flags ;
+    }
 
 : window-attributes ( visinfo -- attributes )
     XSetWindowAttributes <struct>
@@ -78,7 +79,7 @@ IN: x11.windows
     dpy get swap XDestroyWindow drop ;
 
 : set-closable ( win -- )
-    dpy get swap "WM_DELETE_WINDOW" x-atom <Atom> 1
+    dpy get swap XA_WM_DELETE_WINDOW <Atom> 1
     XSetWMProtocols drop ;
 
 : map-window ( win -- ) dpy get swap XMapWindow drop ;
index 09328c6f6ea895a6b13a087b6fd6b0799961da1b..d32eaca47e8e518d7ded11220f957380605be9ed 100644 (file)
@@ -3,6 +3,7 @@
 USING: alien.strings continuations io
 io.encodings.ascii kernel namespaces x11.xlib x11.io
 vocabs vocabs.loader ;
+FROM: alien.c-types => c-bool> ;
 IN: x11
 
 SYMBOL: dpy
@@ -11,7 +12,7 @@ SYMBOL: root
 
 : init-locale ( -- )
    LC_ALL "" setlocale [ "setlocale() failed" print flush ] unless
-   XSupportsLocale [ "XSupportsLocale() failed" print flush ] unless ;
+   XSupportsLocale c-bool> [ "XSupportsLocale() failed" print flush ] unless ;
 
 : flush-dpy ( -- ) dpy get XFlush drop ;
 
@@ -33,4 +34,4 @@ SYMBOL: root
 : with-x ( display-string quot -- )
     [ init-x ] dip [ close-x ] [ ] cleanup ; inline
 
-"io.backend.unix" vocab [ "x11.io.unix" require ] when
\ No newline at end of file
+{ "x11" "io.backend.unix" } "x11.io.unix" require-when
diff --git a/basis/x11/xinput2/authors.txt b/basis/x11/xinput2/authors.txt
new file mode 100644 (file)
index 0000000..8e15658
--- /dev/null
@@ -0,0 +1 @@
+Niklas Waern
diff --git a/basis/x11/xinput2/constants/authors.txt b/basis/x11/xinput2/constants/authors.txt
new file mode 100644 (file)
index 0000000..8e15658
--- /dev/null
@@ -0,0 +1 @@
+Niklas Waern
diff --git a/basis/x11/xinput2/constants/constants.factor b/basis/x11/xinput2/constants/constants.factor
new file mode 100644 (file)
index 0000000..e58928f
--- /dev/null
@@ -0,0 +1,141 @@
+! Copyright (C) 2010 Niklas Waern.
+! See http://factorcode.org/license.txt for BSD license.
+USING: math ;
+IN: x11.xinput2.constants
+
+! From XI2.h
+
+CONSTANT: XInput_2_0               7
+
+CONSTANT: XI_2_Major               2
+CONSTANT: XI_2_Minor               0
+
+! Property event flags
+CONSTANT: XIPropertyDeleted        0
+CONSTANT: XIPropertyCreated        1
+CONSTANT: XIPropertyModified       2
+
+! Enter/Leave and Focus In/Out modes
+CONSTANT: XINotifyNormal           0
+CONSTANT: XINotifyGrab             1
+CONSTANT: XINotifyUngrab           2
+CONSTANT: XINotifyWhileGrabbed     3
+CONSTANT: XINotifyPassiveGrab      4
+CONSTANT: XINotifyPassiveUngrab    5
+
+! Enter/Leave and Focus In/Out detail
+CONSTANT: XINotifyAncestor         0
+CONSTANT: XINotifyVirtual          1
+CONSTANT: XINotifyInferior         2
+CONSTANT: XINotifyNonlinear        3
+CONSTANT: XINotifyNonlinearVirtual 4
+CONSTANT: XINotifyPointer          5
+CONSTANT: XINotifyPointerRoot      6
+CONSTANT: XINotifyDetailNone       7
+
+! Passive grab types
+CONSTANT: XIGrabtypeButton         0
+CONSTANT: XIGrabtypeKeycode        1
+CONSTANT: XIGrabtypeEnter          2
+CONSTANT: XIGrabtypeFocusIn        3
+
+! Passive grab modifier
+: XIAnyModifier ( -- n )           31 2^ ; inline
+: XIAnyButton   ( -- n )           0     ; inline
+: XIAnyKeycode  ( -- n )           0     ; inline
+
+! XIAllowEvents event-modes
+CONSTANT: XIAsyncDevice            0
+CONSTANT: XISyncDevice             1
+CONSTANT: XIReplayDevice           2
+CONSTANT: XIAsyncPairedDevice      3
+CONSTANT: XIAsyncPair              4
+CONSTANT: XISyncPair               5
+
+! DeviceChangedEvent change reasons
+CONSTANT: XISlaveSwitch            1
+CONSTANT: XIDeviceChange           2
+
+! Hierarchy flags
+: XIMasterAdded    ( -- n )        0 2^ ; inline
+: XIMasterRemoved  ( -- n )        1 2^ ; inline
+: XISlaveAdded     ( -- n )        2 2^ ; inline
+: XISlaveRemoved   ( -- n )        3 2^ ; inline
+: XISlaveAttached  ( -- n )        4 2^ ; inline
+: XISlaveDetached  ( -- n )        5 2^ ; inline
+: XIDeviceEnabled  ( -- n )        6 2^ ; inline
+: XIDeviceDisabled ( -- n )        7 2^ ; inline
+
+! ChangeHierarchy constants
+CONSTANT: XIAddMaster              1
+CONSTANT: XIRemoveMaster           2
+CONSTANT: XIAttachSlave            3
+CONSTANT: XIDetachSlave            4
+
+CONSTANT: XIAttachToMaster         1
+CONSTANT: XIFloating               2
+
+! Valuator modes
+CONSTANT: XIModeRelative           0
+CONSTANT: XIModeAbsolute           1
+
+! Device types
+CONSTANT: XIMasterPointer          1
+CONSTANT: XIMasterKeyboard         2
+CONSTANT: XISlavePointer           3
+CONSTANT: XISlaveKeyboard          4
+CONSTANT: XIFloatingSlave          5
+
+! Device classes
+CONSTANT: XIKeyClass               0
+CONSTANT: XIButtonClass            1
+CONSTANT: XIValuatorClass          2
+
+! Device event flags (common)
+! Device event flags (key events only)
+: XIKeyRepeat ( -- n )             16 2^ ; inline
+! Device event flags (pointer events only)
+
+! Fake device ID's for event selection
+CONSTANT: XIAllDevices             0
+CONSTANT: XIAllMasterDevices       1
+
+! Event types
+CONSTANT: XI_DeviceChanged         1
+CONSTANT: XI_KeyPress              2
+CONSTANT: XI_KeyRelease            3
+CONSTANT: XI_ButtonPress           4
+CONSTANT: XI_ButtonRelease         5
+CONSTANT: XI_Motion                6
+CONSTANT: XI_Enter                 7
+CONSTANT: XI_Leave                 8
+CONSTANT: XI_FocusIn               9
+CONSTANT: XI_FocusOut              10
+CONSTANT: XI_HierarchyChanged      11
+CONSTANT: XI_PropertyEvent         12
+CONSTANT: XI_RawKeyPress           13
+CONSTANT: XI_RawKeyRelease         14
+CONSTANT: XI_RawButtonPress        15
+CONSTANT: XI_RawButtonRelease      16
+CONSTANT: XI_RawMotion             17
+: XI_LASTEVENT ( -- n )            XI_RawMotion ; inline
+
+! Event masks
+: XI_DeviceChangedMask    ( -- n ) XI_DeviceChanged    2^ ; inline
+: XI_KeyPressMask         ( -- n ) XI_KeyPress         2^ ; inline
+: XI_KeyReleaseMask       ( -- n ) XI_KeyRelease       2^ ; inline
+: XI_ButtonPressMask      ( -- n ) XI_ButtonPress      2^ ; inline
+: XI_ButtonReleaseMask    ( -- n ) XI_ButtonRelease    2^ ; inline
+: XI_MotionMask           ( -- n ) XI_Motion           2^ ; inline
+: XI_EnterMask            ( -- n ) XI_Enter            2^ ; inline
+: XI_LeaveMask            ( -- n ) XI_Leave            2^ ; inline
+: XI_FocusInMask          ( -- n ) XI_FocusIn          2^ ; inline
+: XI_FocusOutMask         ( -- n ) XI_FocusOut         2^ ; inline
+: XI_HierarchyChangedMask ( -- n ) XI_HierarchyChanged 2^ ; inline
+: XI_PropertyEventMask    ( -- n ) XI_PropertyEvent    2^ ; inline
+: XI_RawKeyPressMask      ( -- n ) XI_RawKeyPress      2^ ; inline
+: XI_RawKeyReleaseMask    ( -- n ) XI_RawKeyRelease    2^ ; inline
+: XI_RawButtonPressMask   ( -- n ) XI_RawButtonPress   2^ ; inline
+: XI_RawButtonReleaseMask ( -- n ) XI_RawButtonRelease 2^ ; inline
+: XI_RawMotionMask        ( -- n ) XI_RawMotion        2^ ; inline
+
diff --git a/basis/x11/xinput2/ffi/authors.txt b/basis/x11/xinput2/ffi/authors.txt
new file mode 100644 (file)
index 0000000..8e15658
--- /dev/null
@@ -0,0 +1 @@
+Niklas Waern
diff --git a/basis/x11/xinput2/ffi/ffi.factor b/basis/x11/xinput2/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..c2a03b6
--- /dev/null
@@ -0,0 +1,484 @@
+! Copyright (C) 2010 Niklas Waern.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.libraries alien.syntax
+classes.struct locals sequences x11.syntax x11.xlib ;
+EXCLUDE: math => float ;
+IN: x11.xinput2.ffi
+
+<< "xinput2" "libXi.so" cdecl add-library >>
+
+LIBRARY: xinput2
+
+
+! *********
+! * XI2.h *
+! *********
+<PRIVATE
+: mask-index   ( event -- n ) -3 shift ;
+: bitmask ( event -- n ) 7 bitand 2^ ;
+PRIVATE>
+
+:: XISetMask ( mask event -- )
+    event mask-index :> index
+    event bitmask index mask nth bitor
+    index mask set-nth ; inline
+
+:: XIClearMask ( mask event -- )
+    event mask-index :> index
+    event bitmask bitnot index mask nth bitand
+    index mask set-nth ; inline
+
+:: XIMaskIsSet ( mask event -- n )
+    event mask-index :> index
+    event bitmask index mask nth bitand ;
+
+: XIMaskLen ( event -- n ) 7 + -3 shift ;
+
+
+! *************
+! * XInput2.h *
+! *************
+STRUCT: XIAddMasterInfo
+    { type      int }
+    { name      c-string }
+    { send_core Bool }
+    { enable    Bool } ;
+
+STRUCT: XIRemoveMasterInfo
+    { type            int }
+    { deviceid        int }
+    { return_mode     int }
+    { return_pointer  int }
+    { return_keyboard int } ;
+
+STRUCT: XIAttachSlaveInfo
+    { type       int }
+    { deviceid   int }
+    { new_master int } ;
+
+STRUCT: XIDetachSlaveInfo
+    { type     int }
+    { deviceid int } ;
+
+UNION-STRUCT: XIAnyHierarchyChangeInfo
+    { type   int }
+    { add    XIAddMasterInfo }
+    { remove XIRemoveMasterInfo }
+    { attach XIAttachSlaveInfo }
+    { detach XIDetachSlaveInfo } ;
+
+STRUCT: XIModifierState
+    { base      int }
+    { latched   int }
+    { locked    int }
+    { effective int } ;
+
+TYPEDEF: XIModifierState XIGroupState
+
+STRUCT: XIButtonState
+    { mask_len int }
+    { mask     uchar* } ;
+
+STRUCT: XIValuatorState
+    { mask_len int }
+    { mask     uchar* }
+    { values   double* } ;
+
+STRUCT: XIEventMask
+    { deviceid int }
+    { mask_len int }
+    { mask     uchar* } ;
+
+STRUCT: XIAnyClassInfo
+    { type     int }
+    { sourceid int } ;
+
+STRUCT: XIButtonClassInfo
+    { type        int }
+    { sourceid    int }
+    { num_buttons int }
+    { labels      Atom* }
+    { state       XIButtonState } ;
+
+STRUCT: XIKeyClassInfo
+    { type         int }
+    { sourceid     int }
+    { num_keycodes int }
+    { keycodes     int* } ;
+
+STRUCT: XIValuatorClassInfo
+    { type       int }
+    { sourceid   int }
+    { number     int }
+    { label      Atom }
+    { min        double }
+    { max        double }
+    { value      double }
+    { resolution int }
+    { mode       int } ;
+
+STRUCT: XIDeviceInfo
+    { deviceid    int }
+    { name        c-string }
+    { use         int }
+    { attachment  int }
+    { enabled     Bool }
+    { num_classes int }
+    { classes     XIAnyClassInfo** } ;
+
+STRUCT: XIGrabModifiers
+    { modifiers int }
+    { status    int } ;
+
+
+! Generic XI2 event. All XI2 events have the same header.
+STRUCT: XIEvent
+    { type       int }
+    { serial     ulong }
+    { send_event Bool }
+    { display    Display* }
+    { extension  int }
+    { evtype     int }
+    { time       Time } ;
+
+STRUCT: XIHierarchyInfo
+    { deviceid   int }
+    { attachment int }
+    { use        int }
+    { enabled    Bool }
+    { flags      int } ;
+
+! Notifies the client that the device hierarcy has been changed
+! The client is expected to re-query the server for the device
+! hierarchy.
+STRUCT: XIHierarchyEvent
+    { type       int }
+    { serial     ulong }
+    { send_event Bool }
+    { display    Display }
+    { extension  int }
+    { evtype     int }
+    { time       Time }
+    { flags      int }
+    { num_info   int }
+    { info       XIHierarchyInfo* } ;
+
+! Notifies the client that the classes have been changed.
+! This happens when the slave device that sends through the
+! master changes.
+STRUCT: XIDeviceChangedEvent
+    { type        int }
+    { serial      ulong }
+    { send_event  Bool }
+    { display     Display* }
+    { extension   int }
+    { evtype      int }
+    { time        Time }
+    { deviceid    int }
+    { sourceid    int }
+    { reason      int }
+    { num_classes int }
+    { classes     XIAnyClassInfo** } ;
+
+STRUCT: XIDeviceEvent
+    { type       int }
+    { serial     ulong }
+    { send_event Bool }
+    { display    Display* }
+    { extension  int }
+    { evtype     int }
+    { time       Time }
+    { deviceid   int }
+    { sourceid   int }
+    { detail     int }
+    { root       Window }
+    { event      Window }
+    { child      Window }
+    { root_x     double }
+    { root_y     double }
+    { event_x    double }
+    { event_y    double }
+    { flags      int }
+    { buttons    XIButtonState }
+    { valuators  XIValuatorState }
+    { mods       XIModifierState }
+    { group      XIGroupState } ;
+
+STRUCT: XIRawEvent
+    { type       int }
+    { serial     ulong }
+    { send_event Bool }
+    { display    Display* }
+    { extension  int }
+    { evtype     int }
+    { time       Time }
+    { deviceid   int }
+    { sourceid   int }
+    { detail     int }
+    { flags      int }
+    { valuators  XIValuatorState }
+    { raw_values double* } ;
+
+STRUCT: XIEnterEvent
+    { type        int }
+    { serial      ulong }
+    { send_event  Bool }
+    { display     Display* }
+    { extension   int }
+    { evtype      int }
+    { time        Time }
+    { deviceid    int }
+    { sourceid    int }
+    { detail      int }
+    { root        Window }
+    { event       Window }
+    { child       Window }
+    { root_x      double }
+    { root_y      double }
+    { event_x     double }
+    { event_y     double }
+    { mode        int }
+    { focus       Bool }
+    { same_screen Bool }
+    { buttons     XIButtonState }
+    { mods        XIModifierState }
+    { group       XIGroupState } ;
+
+TYPEDEF: XIEnterEvent XILeaveEvent
+TYPEDEF: XIEnterEvent XIFocusInEvent
+TYPEDEF: XIEnterEvent XIFocusOutEvent
+
+STRUCT: XIPropertyEvent
+    { type       int }
+    { serial     ulong }
+    { send_event Bool }
+    { display    Display* }
+    { extension  int }
+    { evtype     int }
+    { time       Time }
+    { deviceid   int }
+    { property   Atom }
+    { what       int } ;
+
+
+
+X-FUNCTION: Bool XIQueryPointer (
+    Display*         display,
+    int              deviceid,
+    Window           win,
+    Window*          root,
+    Window*          child,
+    double*          root_x,
+    double*          root_y,
+    double*          win_x,
+    double*          win_y,
+    XIButtonState*   buttons,
+    XIModifierState* mods,
+    XIGroupState*    group ) ;
+
+X-FUNCTION: Bool XIWarpPointer (
+    Display* display,
+    int      deviceid,
+    Window   src_win,
+    Window   dst_win,
+    double   src_x,
+    double   src_y,
+    uint     src_width,
+    uint     src_height,
+    double   dst_x,
+    double   dst_y ) ;
+
+X-FUNCTION: Status XIDefineCursor (
+    Display* display,
+    int      deviceid,
+    Window   win,
+    Cursor   cursor ) ;
+
+X-FUNCTION: Status XIUndefineCursor (
+    Display* display,
+    int      deviceid,
+    Window   win ) ;
+
+X-FUNCTION: Status XIChangeHierarchy (
+    Display*                  display,
+    XIAnyHierarchyChangeInfo* changes,
+    int                       num_changes ) ;
+
+X-FUNCTION: Status XISetClientPointer (
+    Display* dpy,
+    Window   win,
+    int      deviceid ) ;
+
+X-FUNCTION: Bool XIGetClientPointer (
+    Display* dpy,
+    Window   win,
+    int*     deviceid ) ;
+
+X-FUNCTION: int XISelectEvents (
+    Display*     dpy,
+    Window       win,
+    XIEventMask* masks,
+    int          num_masks ) ;
+
+X-FUNCTION: XIEventMask* XIGetSelectedEvents (
+    Display* dpy,
+    Window   win,
+    int*     num_masks_return ) ;
+
+X-FUNCTION: Status XIQueryVersion (
+    Display* display,
+    int*     major_version_inout,
+    int*     minor_version_inout ) ;
+
+X-FUNCTION: XIDeviceInfo* XIQueryDevice (
+    Display* dpy,
+    int      deviceid,
+    int*     ndevices_return ) ;
+
+X-FUNCTION: Status XISetFocus (
+    Display* dpy,
+    int      deviceid,
+    Window   focus,
+    Time     time ) ;
+
+X-FUNCTION: Status XIGetFocus (
+    Display* dpy,
+    int      deviceid,
+    Window*  focus_return ) ;
+
+X-FUNCTION: Status XIGrabDevice (
+    Display*     dpy,
+    int          deviceid,
+    Window       grab_window,
+    Time         time,
+    Cursor       cursor,
+    int          grab_mode,
+    int          paired_device_mode,
+    Bool         owner_events,
+    XIEventMask* mask ) ;
+
+X-FUNCTION: Status XIUngrabDevice (
+    Display* dpy,
+    int      deviceid,
+    Time     time ) ;
+
+X-FUNCTION: Status XIAllowEvents (
+    Display* display,
+    int      deviceid,
+    int      event_mode,
+    Time     time ) ;
+
+X-FUNCTION: int XIGrabButton (
+    Display*         display,
+    int              deviceid,
+    int              button,
+    Window           grab_window,
+    Cursor           cursor,
+    int              grab_mode,
+    int              paired_device_mode,
+    int              owner_events,
+    XIEventMask*     mask,
+    int              num_modifiers,
+    XIGrabModifiers* modifiers_inout ) ;
+
+X-FUNCTION: int XIGrabKeycode (
+    Display*         display,
+    int              deviceid,
+    int              keycode,
+    Window           grab_window,
+    int              grab_mode,
+    int              paired_device_mode,
+    int              owner_events,
+    XIEventMask*     mask,
+    int              num_modifiers,
+    XIGrabModifiers* modifiers_inout ) ;
+
+X-FUNCTION: int XIGrabEnter (
+    Display*         display,
+    int              deviceid,
+    Window           grab_window,
+    Cursor           cursor,
+    int              grab_mode,
+    int              paired_device_mode,
+    int              owner_events,
+    XIEventMask*     mask,
+    int              num_modifiers,
+    XIGrabModifiers* modifiers_inout ) ;
+
+X-FUNCTION: int XIGrabFocusIn (
+    Display*         display,
+    int              deviceid,
+    Window           grab_window,
+    int              grab_mode,
+    int              paired_device_mode,
+    int              owner_events,
+    XIEventMask*     mask,
+    int              num_modifiers,
+    XIGrabModifiers* modifiers_inout ) ;
+
+X-FUNCTION: Status XIUngrabButton (
+    Display*         display,
+    int              deviceid,
+    int              button,
+    Window           grab_window,
+    int              num_modifiers,
+    XIGrabModifiers* modifiers ) ;
+
+X-FUNCTION: Status XIUngrabKeycode (
+    Display*         display,
+    int              deviceid,
+    int              keycode,
+    Window           grab_window,
+    int              num_modifiers,
+    XIGrabModifiers* modifiers ) ;
+
+X-FUNCTION: Status XIUngrabEnter (
+    Display*         display,
+    int              deviceid,
+    Window           grab_window,
+    int              num_modifiers,
+    XIGrabModifiers* modifiers ) ;
+
+X-FUNCTION: Status XIUngrabFocusIn (
+    Display*         display,
+    int              deviceid,
+    Window           grab_window,
+    int              num_modifiers,
+    XIGrabModifiers* modifiers ) ;
+
+X-FUNCTION: Atom* XIListProperties (
+    Display* display,
+    int      deviceid,
+    int*     num_props_return ) ;
+
+X-FUNCTION: void XIChangeProperty (
+    Display* display,
+    int      deviceid,
+    Atom     property,
+    Atom     type,
+    int      format,
+    int      mode,
+    uchar*   data,
+    int      num_items ) ;
+
+X-FUNCTION: void XIDeleteProperty (
+    Display* display,
+    int      deviceid,
+    Atom     property ) ;
+
+X-FUNCTION: Status XIGetProperty (
+    Display* display,
+    int      deviceid,
+    Atom     property,
+    long     offset,
+    long     length,
+    Bool     delete_property,
+    Atom     type,
+    Atom*    type_return,
+    int*     format_return,
+    ulong*   num_items_return,
+    ulong*   bytes_after_return,
+    uchar**  data ) ;
+
+X-FUNCTION: void XIFreeDeviceInfo ( XIDeviceInfo* info ) ;
+
diff --git a/basis/x11/xinput2/xinput2.factor b/basis/x11/xinput2/xinput2.factor
new file mode 100644 (file)
index 0000000..80aaf95
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2010 Niklas Waern.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types combinators kernel namespaces x11
+x11.constants x11.xinput2.ffi ;
+IN: x11.xinput2
+
+: (xi2-available?) ( display -- ? )
+    2 0 [ <int> ] bi@
+    XIQueryVersion
+    {
+        { BadRequest [ f ] }
+        { Success    [ t ] }
+        [ "Internal Xlib error." throw ]
+    } case ;
+
+: xi2-available? ( -- ? ) dpy get (xi2-available?) ; inline
+
index 7235aaf67960dce7a68cb43ae4124f5ad3059525..e20314bf11ac7b9c8a78d37bfeb79e5e14747b24 100644 (file)
@@ -12,7 +12,8 @@
 ! and note the section.
 USING: accessors kernel arrays alien alien.c-types alien.data
 alien.strings alien.syntax classes.struct math math.bitwise words
-sequences namespaces continuations io io.encodings.ascii x11.syntax ;
+sequences namespaces continuations io io.encodings.ascii x11.syntax
+literals ;
 FROM: alien.c-types => short ;
 IN: x11.xlib
 
@@ -30,7 +31,7 @@ TYPEDEF: XID KeySym
 
 TYPEDEF: ulong Atom
 
-TYPEDEF: char* XPointer
+TYPEDEF: c-string XPointer
 C-TYPE: Screen
 TYPEDEF: void* GC
 C-TYPE: Visual
@@ -256,13 +257,13 @@ X-FUNCTION: Bool XQueryPointer ( Display* display, Window w, Window* root_return
 
 ! 4.3 - Properties and Atoms
 
-X-FUNCTION: Atom XInternAtom ( Display* display, char* atom_name, Bool only_if_exists ) ;
+X-FUNCTION: Atom XInternAtom ( Display* display, c-string atom_name, Bool only_if_exists ) ;
 
-X-FUNCTION: char* XGetAtomName ( Display* display, Atom atom ) ;
+X-FUNCTION: c-string XGetAtomName ( Display* display, Atom atom ) ;
 
 ! 4.4 - Obtaining and Changing Window Properties
 
-X-FUNCTION: int XGetWindowProperty ( Display* display, Window w, Atom property, long long_offset, long long_length, Bool delete, Atom req_type, Atom* actual_type_return, int* actual_format_return, ulong* nitems_return, ulong* bytes_after_return, char** prop_return ) ;
+X-FUNCTION: int XGetWindowProperty ( Display* display, Window w, Atom property, long long_offset, long long_length, Bool delete, Atom req_type, Atom* actual_type_return, int* actual_format_return, ulong* nitems_return, ulong* bytes_after_return, c-string* prop_return ) ;
 
 X-FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property, Atom type, int format, int mode, void* data, int nelements ) ;
 
@@ -302,7 +303,7 @@ STRUCT: XColor
 { flags char }
 { pad char } ;
 
-X-FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, char* color_name, XColor* exact_def_return, XColor* screen_def_return ) ;
+X-FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, c-string color_name, XColor* exact_def_return, XColor* screen_def_return ) ;
 X-FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out ) ;
 X-FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out ) ;
 
@@ -430,11 +431,11 @@ STRUCT: XFontStruct
 { ascent int }
 { descent int } ;
 
-X-FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
+X-FUNCTION: Font XLoadFont ( Display* display, c-string name ) ;
 X-FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
-X-FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
+X-FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, c-string name ) ;
 
-X-FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
+X-FUNCTION: int XTextWidth ( XFontStruct* font_struct, c-string string, int count ) ;
 
 ! 8.6 - Drawing Text
 
@@ -444,7 +445,7 @@ X-FUNCTION: Status XDrawString (
         GC gc,
         int x,
         int y,
-        char* string,
+        c-string string,
         int length ) ;
 
 ! 8.7 - Transferring Images between Client and Server
@@ -464,7 +465,7 @@ STRUCT: XImage
 { height int }
 { xoffset int }
 { format int }
-{ data char* }
+{ data uchar* }
 { byte_order int }
 { bitmap_unit int }
 { bitmap_bit_order int }
@@ -564,7 +565,8 @@ CONSTANT: SelectionNotify       31
 CONSTANT: ColormapNotify        32
 CONSTANT: ClientMessage         33
 CONSTANT: MappingNotify         34
-CONSTANT: LASTEvent             35
+CONSTANT: GenericEvent          35
+CONSTANT: LASTEvent             36
 
 STRUCT: XAnyEvent
 { type int }
@@ -1010,14 +1012,35 @@ STRUCT: XKeymapEvent
 { send_event Bool }
 { display Display* }
 { window Window }
-{ pad int }
-{ pad int }
-{ pad int }
-{ pad int }
-{ pad int }
-{ pad int }
-{ pad int }
-{ pad int } ;
+{ pad int[8] } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! Newer things, needed for XInput2 support. Not in the book.
+
+! GenericEvent is the standard event for all newer extensions.
+STRUCT: XGenericEvent
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ extension int }
+{ evtype int } ;
+
+STRUCT: XGenericEventCookie
+{ type int }
+{ serial ulong }
+{ send_event Bool }
+{ display Display* }
+{ extension int }
+{ evtype int }
+{ cookie uint }
+{ data void* } ;
+
+X-FUNCTION: Bool XGetEventData ( Display* dpy, XGenericEventCookie* cookie ) ;
+X-FUNCTION: void XFreeEventData ( Display* dpy, XGenericEventCookie* cookie ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 UNION-STRUCT: XEvent
 { int int }
@@ -1052,6 +1075,8 @@ UNION-STRUCT: XEvent
 { XMappingEvent XMappingEvent }
 { XErrorEvent XErrorEvent }
 { XKeymapEvent XKeymapEvent }
+{ XGenericEvent XGenericEvent }
+{ XGenericEventCookie XGenericEventCookie }
 { padding long[24] } ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -1116,7 +1141,7 @@ X-FUNCTION: Status XWarpPointer ( Display* display, Window src_w, Window dest_w,
 
 ! 14.1 Client to Window Manager Communication
 
-X-FUNCTION: Status XFetchName ( Display* display, Window w, char** window_name_return ) ;
+X-FUNCTION: Status XFetchName ( Display* display, Window w, c-string* window_name_return ) ;
 X-FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return ) ;
 
 ! 14.1.1.  Manipulating Top-Level Windows
@@ -1141,8 +1166,8 @@ X-FUNCTION: Status XWithdrawWindow (
 : PAspect      ( -- n ) 7 2^ ; inline
 : PBaseSize    ( -- n ) 8 2^ ; inline
 : PWinGravity  ( -- n ) 9 2^ ; inline
-: PAllHints    ( -- n )
-    { PPosition PSize PMinSize PMaxSize PResizeInc PAspect } flags ; foldable
+CONSTANT: PAllHints
+    flags{ PPosition PSize PMinSize PMaxSize PResizeInc PAspect }
 
 STRUCT: XSizeHints
     { flags long }
@@ -1220,10 +1245,20 @@ STRUCT: XVisualInfo
 X-FUNCTION: Pixmap XCreateBitmapFromData (
     Display* display,
     Drawable d,
-    char* data,
+    c-string data,
     uint width,
     uint height ) ;
 
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Appendix C - Extensions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+X-FUNCTION: Bool XQueryExtension (
+        Display* display,
+        c-string name,
+        int* major_opcode_return,
+        int* first_event_return,
+        int* first_error_return ) ;
+
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 ! Appendix D - Compatibility Functions
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -1231,10 +1266,10 @@ X-FUNCTION: Pixmap XCreateBitmapFromData (
 X-FUNCTION: Status XSetStandardProperties (
         Display* display,
         Window w,
-        char* window_name,
-        char* icon_name,
+        c-string window_name,
+        c-string icon_name,
         Pixmap icon_pixmap,
-        char** argv,
+        c-string* argv,
         int argc,
         XSizeHints* hints ) ;
 
@@ -1316,7 +1351,7 @@ CONSTANT: XA_LAST_PREDEFINED 68
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 X-FUNCTION: void XFree ( void* data ) ;
-X-FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ;
+X-FUNCTION: int XStoreName ( Display* display, Window w, c-string window_name ) ;
 X-FUNCTION: void XSetWMNormalHints ( Display* display, Window w, XSizeHints* hints ) ;
 X-FUNCTION: int XBell ( Display* display, int percent ) ;
 
@@ -1384,11 +1419,11 @@ CONSTANT: XLookupBoth      4
 
 X-FUNCTION: Bool XFilterEvent ( XEvent* event, Window w ) ;
 
-X-FUNCTION: XIM XOpenIM ( Display* dpy, void* rdb, char* res_name, char* res_class ) ;
+X-FUNCTION: XIM XOpenIM ( Display* dpy, void* rdb, c-string res_name, c-string res_class ) ;
 
 X-FUNCTION: Status XCloseIM ( XIM im ) ;
 
-X-FUNCTION: XIC XCreateIC ( XIM im, char* key1, Window value1, char* key2, Window value2, char* key3, int value3, char* key4, char* value4, char* key5, char* value5, int key6 ) ;
+X-FUNCTION: XIC XCreateIC ( XIM im, c-string key1, Window value1, c-string key2, Window value2, c-string key3, int value3, c-string key4, c-string value4, c-string key5, c-string value5, int key6 ) ;
 
 X-FUNCTION: void XDestroyIC ( XIC ic ) ;
 
@@ -1398,7 +1433,7 @@ X-FUNCTION: void XUnsetICFocus ( XIC ic ) ;
 
 X-FUNCTION: int XwcLookupString ( XIC ic, XKeyPressedEvent* event, ulong* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
 
-X-FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
+X-FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, c-string buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
 
 ! !!! category of setlocale
 CONSTANT: LC_ALL      0
@@ -1408,8 +1443,13 @@ CONSTANT: LC_MONETARY 3
 CONSTANT: LC_NUMERIC  4
 CONSTANT: LC_TIME     5
 
-X-FUNCTION: char* setlocale ( int category, char* name ) ;
+X-FUNCTION: c-string setlocale ( int category, c-string name ) ;
 
 X-FUNCTION: Bool XSupportsLocale ( ) ;
 
-X-FUNCTION: char* XSetLocaleModifiers ( char* modifier_list ) ;
+X-FUNCTION: c-string XSetLocaleModifiers ( c-string modifier_list ) ;
+
+! uncategorized xlib bindings
+
+X-FUNCTION: int XQueryKeymap ( Display* display, char[32] keys_return ) ;
+
index 419dfbba53bfbcd3ec13512d5063380982bfa26e..1ca0979ca386d4fbd3dded40a980ab5cdc32f3ee 100644 (file)
@@ -47,7 +47,7 @@ M: attrs set-at
         2nip set-second
     ] [
         [ assure-name swap 2array ] dip
-        [ alist>> ?push ] keep (>>alist)
+        [ alist>> ?push ] keep alist<<
     ] if* ;
 
 M: attrs assoc-size alist>> length ;
index b927947329a49388bd8c859f0d045ae36195b9e4..1e59c199091ce90705359a5640c63c23c7a9ce33 100644 (file)
@@ -4,6 +4,7 @@ USING: kernel namespaces xml.tokenize xml.state xml.name
 xml.data accessors arrays make xml.char-classes fry assocs sequences
 math xml.errors sets combinators io.encodings io.encodings.iana
 unicode.case xml.dtd strings xml.entities unicode.categories ;
+FROM: namespaces => set ;
 IN: xml.elements
 
 : take-interpolated ( quot -- interpolated )
diff --git a/basis/xml/syntax/inverse/inverse.factor b/basis/xml/syntax/inverse/inverse.factor
new file mode 100644 (file)
index 0000000..1d37a8d
--- /dev/null
@@ -0,0 +1,75 @@
+! Copyright (C) 2005, 2009 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays assocs combinators
+combinators.short-circuit fry generalizations inverse kernel
+namespaces sequences sequences.generalizations sorting strings
+unicode.categories xml.data xml.syntax xml.syntax.private ;
+IN: xml.syntax.inverse
+
+: remove-blanks ( seq -- newseq )
+    [ { [ string? not ] [ [ blank? ] all? not ] } 1|| ] filter ;
+
+GENERIC: >xml ( xml -- tag )
+M: xml >xml body>> ;
+M: tag >xml ;
+M: xml-chunk >xml
+    remove-blanks
+    [ length 1 =/fail ]
+    [ first dup tag? [ fail ] unless ] bi ;
+M: object >xml fail ;
+
+: 1chunk ( object -- xml-chunk )
+    1array <xml-chunk> ;
+
+GENERIC: >xml-chunk ( xml -- chunk )
+M: xml >xml-chunk body>> 1chunk ;
+M: xml-chunk >xml-chunk ;
+M: object >xml-chunk 1chunk ;
+
+GENERIC: [undo-xml] ( xml -- quot )
+
+M: xml [undo-xml]
+    body>> [undo-xml] '[ >xml @ ] ;
+
+M: xml-chunk [undo-xml]
+    seq>> [undo-xml] '[ >xml-chunk @ ] ;
+
+: undo-attrs ( attrs -- quot: ( attrs -- ) )
+    [
+        [ main>> ] dip dup interpolated?
+        [ var>> '[ _ attr _ set ] ]
+        [ '[ _ attr _ =/fail ] ] if
+    ] { } assoc>map '[ _ cleave ] ;
+
+M: tag [undo-xml] ( tag -- quot: ( tag -- ) )
+    {
+        [ name>> main>> '[ name>> main>> _ =/fail ] ]
+        [ attrs>> undo-attrs ] 
+        [ children>> [undo-xml] '[ children>> @ ] ]
+    } cleave '[ _ _ _ tri ] ;
+
+: firstn-strong ( seq n -- ... )
+    [ swap length =/fail ]
+    [ firstn ] 2bi ; inline
+
+M: sequence [undo-xml] ( sequence -- quot: ( seq -- ) )
+    remove-blanks [ length ] [ [ [undo-xml] ] { } map-as ] bi
+    '[ remove-blanks _ firstn-strong _ spread ] ;
+
+M: string [undo-xml] ( string -- quot: ( string -- ) )
+    '[ _ =/fail ] ;
+
+M: xml-data [undo-xml] ( datum -- quot: ( datum -- ) )
+    '[ _ =/fail ] ;
+
+M: interpolated [undo-xml]
+    var>> '[ _ set ] ;
+
+: >enum ( assoc -- enum )
+    ! Assumes keys are 0..n
+    >alist sort-keys values <enum> ;
+
+: undo-xml ( xml -- quot )
+    [undo-xml] '[ H{ } clone [ _ bind ] keep >enum ] ;
+
+\ interpolate-xml 1 [ undo-xml ] define-pop-inverse
index 4b9900d3b0c4acc18750b4ed22748be505c3ab38..92f3cd7a897733e5434ffb0e113991ac66f0cfe3 100644 (file)
@@ -1,11 +1,11 @@
 ! Copyright (C) 2005, 2009 Daniel Ehrenberg
 ! See http://factorcode.org/license.txt for BSD license.
-USING: words assocs kernel accessors parser vocabs.parser effects.parser
-sequences summary lexer splitting combinators locals
-memoize sequences.deep xml.data xml.state xml namespaces present
-arrays generalizations strings make math macros multiline
-inverse combinators.short-circuit sorting fry unicode.categories
-effects ;
+USING: words assocs kernel accessors parser vocabs.parser
+effects.parser sequences summary lexer splitting combinators
+locals memoize sequences.deep xml.data xml.state xml namespaces
+present arrays generalizations sequences.generalizations strings
+make math macros multiline combinators.short-circuit sorting fry
+unicode.categories effects ;
 IN: xml.syntax
 
 <PRIVATE
@@ -44,7 +44,7 @@ SYNTAX: XML-NS:
 : each-attrs ( attrs quot -- )
     [ values [ interpolated? ] filter ] dip each ; inline
 
-: (each-interpolated) ( item quot: ( interpolated -- ) -- )
+: (each-interpolated) ( ... item quot: ( ... interpolated -- ... ) -- ... )
      {
         { [ over interpolated? ] [ call ] }
         { [ over tag? ] [ [ attrs>> ] dip each-attrs ] }
@@ -175,74 +175,6 @@ SYNTAX: <XML
 SYNTAX: [XML
     "XML]" [ string>chunk ] parse-def ;
 
-<PRIVATE
-
-: remove-blanks ( seq -- newseq )
-    [ { [ string? not ] [ [ blank? ] all? not ] } 1|| ] filter ;
-
-GENERIC: >xml ( xml -- tag )
-M: xml >xml body>> ;
-M: tag >xml ;
-M: xml-chunk >xml
-    remove-blanks
-    [ length 1 =/fail ]
-    [ first dup tag? [ fail ] unless ] bi ;
-M: object >xml fail ;
-
-: 1chunk ( object -- xml-chunk )
-    1array <xml-chunk> ;
-
-GENERIC: >xml-chunk ( xml -- chunk )
-M: xml >xml-chunk body>> 1chunk ;
-M: xml-chunk >xml-chunk ;
-M: object >xml-chunk 1chunk ;
-
-GENERIC: [undo-xml] ( xml -- quot )
+USE: vocabs.loader
 
-M: xml [undo-xml]
-    body>> [undo-xml] '[ >xml @ ] ;
-
-M: xml-chunk [undo-xml]
-    seq>> [undo-xml] '[ >xml-chunk @ ] ;
-
-: undo-attrs ( attrs -- quot: ( attrs -- ) )
-    [
-        [ main>> ] dip dup interpolated?
-        [ var>> '[ _ attr _ set ] ]
-        [ '[ _ attr _ =/fail ] ] if
-    ] { } assoc>map '[ _ cleave ] ;
-
-M: tag [undo-xml] ( tag -- quot: ( tag -- ) )
-    {
-        [ name>> main>> '[ name>> main>> _ =/fail ] ]
-        [ attrs>> undo-attrs ] 
-        [ children>> [undo-xml] '[ children>> @ ] ]
-    } cleave '[ _ _ _ tri ] ;
-
-: firstn-strong ( seq n -- ... )
-    [ swap length =/fail ]
-    [ firstn ] 2bi ; inline
-
-M: sequence [undo-xml] ( sequence -- quot: ( seq -- ) )
-    remove-blanks [ length ] [ [ [undo-xml] ] { } map-as ] bi
-    '[ remove-blanks _ firstn-strong _ spread ] ;
-
-M: string [undo-xml] ( string -- quot: ( string -- ) )
-    '[ _ =/fail ] ;
-
-M: xml-data [undo-xml] ( datum -- quot: ( datum -- ) )
-    '[ _ =/fail ] ;
-
-M: interpolated [undo-xml]
-    var>> '[ _ set ] ;
-
-: >enum ( assoc -- enum )
-    ! Assumes keys are 0..n
-    >alist sort-keys values <enum> ;
-
-: undo-xml ( xml -- quot )
-    [undo-xml] '[ H{ } clone [ _ bind ] keep >enum ] ;
-
-\ interpolate-xml 1 [ undo-xml ] define-pop-inverse
-
-PRIVATE>
+{ "xml.syntax" "inverse" } "xml.syntax.inverse" require-when
index ef8420d66c8012199bf001a55c9069ad63749e87..8978c660f40c97d334fda41148f68beccce314b7 100644 (file)
@@ -59,14 +59,14 @@ HINTS: next* { spot } ;
     ! with-input-stream implicitly creates a new scope which we use
     swap [ init-parser call ] with-input-stream ; inline
 
-:: (skip-until) ( quot: ( -- ? ) spot -- )
+:: (skip-until) ( ... quot: ( ... -- ... ? ) spot -- ... )
     spot char>> [
         quot call [
             spot next* quot spot (skip-until)
         ] unless
     ] when ; inline recursive
 
-: skip-until ( quot: ( -- ? ) -- )
+: skip-until ( ... quot: ( ... -- ... ? ) -- ... )
     spot get (skip-until) ; inline
 
 : take-until ( quot -- string )
index 5d0f7f0ea487e7aa1ea1c760fedcb3df207ca6df..e576a672c2f35d4ac8296543d044e5fca61cbe91 100644 (file)
@@ -11,9 +11,9 @@ TAGS: parse-mode-tag ( modes tag -- )
 TAG: MODE parse-mode-tag
     dup "NAME" attr [
         mode new {
-            { "FILE" f (>>file) }
-            { "FILE_NAME_GLOB" f (>>file-name-glob) }
-            { "FIRST_LINE_GLOB" f (>>first-line-glob) }
+            { "FILE" f file<< }
+            { "FILE_NAME_GLOB" f file-name-glob<< }
+            { "FIRST_LINE_GLOB" f first-line-glob<< }
         } init-from-tag
     ] dip
     rot set-at ;
@@ -70,7 +70,7 @@ DEFER: finalize-rule-set
     over [ assoc-union! ] [ nip clone ] if ;
 
 : import-keywords ( parent child -- )
-    over [ [ keywords>> ] bi@ ?update ] dip (>>keywords) ;
+    over [ [ keywords>> ] bi@ ?update ] dip keywords<< ;
 
 : import-rules ( parent child -- )
     swap [ add-rule ] curry each-rule ;
index 877eda44aa1f0d7da80f9fe4c6449f36bcac4479..402dd974b1eba8b86d01239226aa734bdd68a350 100644 (file)
@@ -32,7 +32,7 @@ M: keyword-map >alist
     assoc>> >alist ;
 
 : (keyword-map-no-word-sep) ( assoc -- str )
-    keys concat [ alpha? not ] filter prune natural-sort ;
+    keys combine [ alpha? not ] filter natural-sort ;
 
 : keyword-map-no-word-sep* ( keyword-map -- str )
     dup no-word-sep>> [ ] [
index e5d5112a275b45c406d5c4261612b686c887f187..43fe47a650643b4229cdc2a683540c6ef2c4d75f 100644 (file)
@@ -45,7 +45,7 @@ RULE: MARK_PREVIOUS mark-previous-rule parse-rule-tag
 TAG: KEYWORDS parse-rule-tag
     rule-set get ignore-case?>> <keyword-map>
     swap children-tags [ over parse-keyword-tag ] each
-    swap (>>keywords) ;
+    swap keywords<< ;
 
 : ?<regexp> ( string/f -- regexp/f )
     dup [ rule-set get ignore-case?>> <?insensitive-regexp> ] when ;
@@ -53,13 +53,13 @@ TAG: KEYWORDS parse-rule-tag
 : (parse-rules-tag) ( tag -- rule-set )
     <rule-set> dup rule-set set
     {
-        { "SET" string>rule-set-name (>>name) }
-        { "IGNORE_CASE" string>boolean (>>ignore-case?) }
-        { "HIGHLIGHT_DIGITS" string>boolean (>>highlight-digits?) }
-        { "DIGIT_RE" ?<regexp> (>>digit-re) }
+        { "SET" string>rule-set-name name<< }
+        { "IGNORE_CASE" string>boolean ignore-case?<< }
+        { "HIGHLIGHT_DIGITS" string>boolean highlight-digits?<< }
+        { "DIGIT_RE" ?<regexp> digit-re<< }
         { "ESCAPE" f add-escape-rule }
-        { "DEFAULT" string>token (>>default) }
-        { "NO_WORD_SEP" f (>>no-word-sep) }
+        { "DEFAULT" string>token default<< }
+        { "NO_WORD_SEP" f no-word-sep<< }
     } init-from-tag ;
 
 : parse-rules-tag ( tag -- rule-set )
index d2e1d997216dd73bb161607fabe8768509e8f052..5f093b0ccb0de0d7b866bd7df647418bb64d55ce 100644 (file)
@@ -52,24 +52,24 @@ SYNTAX: RULE:
     swap position-attrs <matcher> ;
 
 : shared-tag-attrs ( -- )
-    { "TYPE" string>token (>>body-token) } , ; inline
+    { "TYPE" string>token body-token<< } , ; inline
 
 : parse-delegate ( string -- pair )
     "::" split1 [ rule-set get swap ] unless* 2array ;
 
 : delegate-attr ( -- )
-    { "DELEGATE" f (>>delegate) } , ;
+    { "DELEGATE" f delegate<< } , ;
 
 : regexp-attr ( -- )
-    { "HASH_CHAR" f (>>chars) } , ;
+    { "HASH_CHAR" f chars<< } , ;
 
 : match-type-attr ( -- )
-    { "MATCH_TYPE" string>match-type (>>match-token) } , ;
+    { "MATCH_TYPE" string>match-type match-token<< } , ;
 
 : span-attrs ( -- )
-    { "NO_LINE_BREAK" string>boolean (>>no-line-break?) } ,
-    { "NO_WORD_BREAK" string>boolean (>>no-word-break?) } ,
-    { "NO_ESCAPE" string>boolean (>>no-escape?) } , ;
+    { "NO_LINE_BREAK" string>boolean no-line-break?<< } ,
+    { "NO_WORD_BREAK" string>boolean no-word-break?<< } ,
+    { "NO_ESCAPE" string>boolean no-escape?<< } , ;
 
 : literal-start ( -- )
     [ parse-literal-matcher >>start drop ] , ;
index 6b8db76ac97e88186280949eb8c9855a38563851..73519e105c396a53ba0affaaac40012213a79d2b 100644 (file)
@@ -181,7 +181,7 @@ M: abstract-span-rule handle-rule-start
     add-remaining-token
     [ rule-match-token* next-token, ] keep
     ! ... end subst ...
-    dup context get (>>in-rule)
+    dup context get in-rule<<
     delegate>> push-context ;
 
 M: span-rule handle-rule-end
@@ -191,12 +191,12 @@ M: mark-following-rule handle-rule-start
     ?end-rule
     mark-token add-remaining-token
     [ rule-match-token* next-token, ] keep
-    f context get (>>end)
-    context get (>>in-rule) ;
+    f context get end<<
+    context get in-rule<< ;
 
 M: mark-following-rule handle-rule-end
     nip rule-match-token* prev-token,
-    f context get (>>in-rule) ;
+    f context get in-rule<< ;
 
 M: mark-previous-rule handle-rule-start
     ?end-rule
index ffe6db3b4696f9cf32a5df17d273ab6f084293ae..7a67dc9f9b0b2e8bcb3046180681d59a978632dd 100644 (file)
@@ -79,7 +79,7 @@ TUPLE: eol-span-rule < rule ;
 : init-span ( rule -- )
     dup delegate>> [ drop ] [
         dup body-token>> standard-rule-set
-        swap (>>delegate)
+        swap delegate<<
     ] if ;
 
 : init-eol-span ( rule -- )
@@ -114,7 +114,7 @@ M: regexp text-hash-char drop f ;
 : add-escape-rule ( string ruleset -- )
     over [
         [ <escape-rule> ] dip
-        2dup (>>escape-rule)
+        2dup escape-rule<<
         add-rule
     ] [
         2drop
index 06cb09a4ddf8b645f7f304ffc0f327e5174d2b07..b52a942eb109f9cf4b1d95132048a36f76bb91f7 100644 (file)
@@ -8,3 +8,9 @@ Nmakefile
 unmaintained
 build-support
 images
+factor.dll.exp
+factor.dll.lib
+factor.exp
+factor.lib
+libfactor-ffi-test.exp
+libfactor-ffi-test.lib
diff --git a/build-support/factor.cmd b/build-support/factor.cmd
new file mode 100644 (file)
index 0000000..57a41f2
--- /dev/null
@@ -0,0 +1,87 @@
+@echo off\r
+setlocal\r
+\r
+if "%1"=="/?" (\r
+    goto usage\r
+) else if "%1"=="" (\r
+    set _bootimage_version=latest\r
+) else if "%1"=="latest" (\r
+    set _bootimage_version=latest\r
+) else if "%1"=="clean" (\r
+    set _bootimage_version=clean\r
+) else goto usage\r
+\r
+if not exist Nmakefile goto wrongdir\r
+\r
+call cl 2>&1 | find "x86" >nul\r
+if not errorlevel 1 (\r
+    echo x86-32 cl.exe detected.\r
+    set _target=x86-32\r
+    set _bootimage=boot.winnt-x86.32.image\r
+) else (\r
+    call cl 2>&1 | find "x64" >nul\r
+    if not errorlevel 1 (\r
+        echo x86-64 cl.exe detected.\r
+        set _target=x86-64\r
+        set _bootimage=boot.winnt-x86.64.image\r
+    ) else goto nocl\r
+)\r
+\r
+if %_bootimage_version%==clean (\r
+    set _git_branch=clean-winnt-%_target%\r
+    set _bootimage_path=clean/winnt-%_target%\r
+) else (\r
+    set _git_branch=master\r
+    set _bootimage_path=latest\r
+)\r
+\r
+echo Updating working copy from %_git_branch%...\r
+call git pull http://factorcode.org/git/factor.git %_git_branch%\r
+if errorlevel 1 goto fail\r
+\r
+echo Building vm...\r
+nmake /nologo /f Nmakefile clean\r
+if errorlevel 1 goto fail\r
+nmake /nologo /f Nmakefile %_target%\r
+if errorlevel 1 goto fail\r
+\r
+echo Fetching %_bootimage_version% boot image...\r
+cscript /nologo build-support\http-get.vbs http://factorcode.org/images/%_bootimage_path%/%_bootimage% %_bootimage%\r
+if errorlevel 1 goto fail\r
+\r
+echo Bootstrapping...\r
+.\factor.com -i=%_bootimage%\r
+if errorlevel 1 goto fail\r
+\r
+echo Copying fresh factor.image to factor.image.fresh.\r
+copy factor.image factor.image.fresh\r
+if errorlevel 1 goto fail\r
+\r
+echo Build complete.\r
+goto :EOF\r
+\r
+:fail\r
+echo Build failed.\r
+goto :EOF\r
+\r
+:wrongdir\r
+echo build-support\factor.cmd must be run from the root of the Factor source tree.\r
+goto :EOF\r
+\r
+:nocl\r
+echo Unable to detect cl.exe target platform.\r
+echo Make sure you're running within the Visual Studio or Windows SDK environment.\r
+goto :EOF\r
+\r
+:usage\r
+echo Usage: build-support\factor.cmd [latest/clean]\r
+echo     Updates the working copy, cleans and builds the vm using nmake,\r
+echo     fetches a boot image, and bootstraps factor.\r
+echo     If latest is specified, then the working copy is updated to the\r
+echo     upstream "master" branch and the boot image corresponding to the\r
+echo     most recent factor build is downloaded. This is the default.\r
+echo     If clean is specified, then the working copy is updated to the\r
+echo     upstream "clean-winnt-*" branch corresponding to the current\r
+echo     platform and the corresponding boot image is downloaded.\r
+goto :EOF\r
+\r
index 3a5fb4e253eb0819d4d28c2ee480ee42f164bb60..9da4ae295a0b86e15492fd0960e1776e59a2087d 100755 (executable)
@@ -25,6 +25,7 @@ test_program_installed() {
 
 exit_script() {
     if [[ $FIND_MAKE_TARGET -eq true ]] ; then
+               # Must be echo not $ECHO
         echo $MAKE_TARGET;
     fi
     exit $1
@@ -37,7 +38,7 @@ ensure_program_installed() {
         $ECHO -n "Checking for $i..."
         test_program_installed $i
         if [[ $? -eq 0 ]]; then
-            echo -n "not "
+            $ECHO -n "not "
         else    
             installed=$(( $installed + 1 ))
         fi
@@ -68,7 +69,7 @@ set_downloader() {
     if [[ $? -ne 0 ]] ; then
         DOWNLOADER=wget
     else
-        DOWNLOADER="curl -O"
+        DOWNLOADER="curl -f -O"
     fi
 }
 
@@ -194,6 +195,7 @@ find_architecture() {
 }
 
 write_test_program() {
+    #! Must be 'echo'
     echo "#include <stdio.h>" > $C_WORD.c
     echo "int main(){printf(\"%ld\", (long)(8*sizeof(void*))); return 0; }" >> $C_WORD.c
 }
@@ -247,6 +249,7 @@ set_factor_library() {
 
 set_factor_image() {
     FACTOR_IMAGE=factor.image
+    FACTOR_IMAGE_FRESH=factor.image.fresh
 }
 
 echo_build_info() {
@@ -275,7 +278,7 @@ check_os_arch_word() {
         $ECHO "WORD: $WORD"
         $ECHO "OS, ARCH, or WORD is empty.  Please report this."
 
-        echo $MAKE_TARGET
+        $ECHO $MAKE_TARGET
         exit_script 5
     fi
 }
@@ -291,9 +294,15 @@ set_build_info() {
     elif [[ $OS == winnt && $ARCH == x86 && $WORD == 64 ]] ; then
         MAKE_IMAGE_TARGET=winnt-x86.64
         MAKE_TARGET=winnt-x86-64
+    elif [[ $OS == winnt && $ARCH == x86 && $WORD == 32 ]] ; then
+        MAKE_IMAGE_TARGET=winnt-x86.32
+        MAKE_TARGET=winnt-x86-32
     elif [[ $ARCH == x86 && $WORD == 64 ]] ; then
         MAKE_IMAGE_TARGET=unix-x86.64
         MAKE_TARGET=$OS-x86-64
+    elif [[ $ARCH == x86 && $WORD == 32 ]] ; then
+        MAKE_IMAGE_TARGET=unix-x86.32
+        MAKE_TARGET=$OS-x86-32
     else
         MAKE_IMAGE_TARGET=$ARCH.$WORD
         MAKE_TARGET=$OS-$ARCH-$WORD
@@ -338,22 +347,22 @@ invoke_git() {
 }
 
 git_clone() {
-    echo "Downloading the git repository from factorcode.org..."
+    $ECHO "Downloading the git repository from factorcode.org..."
     invoke_git clone $GIT_URL
 }
 
 update_script_name() {
-    echo `dirname $0`/_update.sh
+    $ECHO `dirname $0`/_update.sh
 }
 
 update_script() {
     update_script=`update_script_name`
     bash_path=`which bash`
-    echo "#!$bash_path" >"$update_script"
-    echo "git pull \"$GIT_URL\" master" >>"$update_script"
-    echo "if [[ \$? -eq 0 ]]; then exec \"$0\" $SCRIPT_ARGS; else echo \"git pull failed\"; exit 2; fi" \
+    $ECHO "#!$bash_path" >"$update_script"
+    $ECHO "git pull \"$GIT_URL\" master" >>"$update_script"
+    $ECHO "if [[ \$? -eq 0 ]]; then exec \"$0\" $SCRIPT_ARGS; else echo \"git pull failed\"; exit 2; fi" \
         >>"$update_script"
-    echo "exit 0" >>"$update_script"
+    $ECHO "exit 0" >>"$update_script"
 
     chmod 755 "$update_script"
     exec "$update_script"
@@ -364,16 +373,16 @@ update_script_changed() {
 }
 
 git_fetch_factorcode() {
-    echo "Fetching the git repository from factorcode.org..."
+    $ECHO "Fetching the git repository from factorcode.org..."
 
     rm -f `update_script_name`
     invoke_git fetch "$GIT_URL" master
 
     if update_script_changed; then
-        echo "Updating and restarting the factor.sh script..."
+        $ECHO "Updating and restarting the factor.sh script..."
         update_script
     else
-        echo "Updating the working tree..."
+        $ECHO "Updating the working tree..."
         invoke_git pull "$GIT_URL" master
     fi
 }
@@ -408,11 +417,11 @@ backup_factor() {
 
 check_makefile_exists() {
     if [[ ! -e "GNUmakefile" ]] ; then
-        echo ""
-        echo "***GNUmakefile not found***"
-        echo "You are likely in the wrong directory."
-        echo "Run this script from your factor directory:"
-        echo "     ./build-support/factor.sh"
+        $ECHO ""
+        $ECHO "***GNUmakefile not found***"
+        $ECHO "You are likely in the wrong directory."
+        $ECHO "Run this script from your factor directory:"
+        $ECHO "     ./build-support/factor.sh"
         exit_script 6
     fi
 }
@@ -432,7 +441,7 @@ make_factor() {
 }
 
 update_boot_images() {
-    echo "Deleting old images..."
+    $ECHO "Deleting old images..."
     $DELETE checksums.txt* > /dev/null 2>&1
     # delete boot images with one or two characters after the dot
     $DELETE $BOOT_IMAGE.{?,??} > /dev/null 2>&1
@@ -445,10 +454,10 @@ update_boot_images() {
              netbsd) disk_md5=`md5 $BOOT_IMAGE | cut -f4 -d' '`;;
              *) disk_md5=`$MD5SUM $BOOT_IMAGE|cut -f1 -d' '` ;;
         esac
-        echo "Factorcode md5: $factorcode_md5";
-        echo "Disk md5: $disk_md5";
+        $ECHO "Factorcode md5: $factorcode_md5";
+        $ECHO "Disk md5: $disk_md5";
         if [[ "$factorcode_md5" == "$disk_md5" ]] ; then
-            echo "Your disk boot image matches the one on factorcode.org."
+            $ECHO "Your disk boot image matches the one on factorcode.org."
         else
             $DELETE $BOOT_IMAGE > /dev/null 2>&1
             get_boot_image;
@@ -459,7 +468,7 @@ update_boot_images() {
 }
 
 get_boot_image() {
-    echo "Downloading boot image $BOOT_IMAGE."
+    $ECHO "Downloading boot image $BOOT_IMAGE."
     get_url http://factorcode.org/images/latest/$BOOT_IMAGE
 }
 
@@ -467,7 +476,7 @@ get_url() {
     if [[ $DOWNLOADER -eq "" ]] ; then
         set_downloader;
     fi
-    echo $DOWNLOADER $1 ;
+    $ECHO $DOWNLOADER $1 ;
     $DOWNLOADER $1
     check_ret $DOWNLOADER
 }
@@ -478,8 +487,14 @@ get_config_info() {
     check_libraries
 }
 
+copy_fresh_image() {
+    $ECHO "Copying $FACTOR_IMAGE to $FACTOR_IMAGE_FRESH..."
+    $COPY $FACTOR_IMAGE $FACTOR_IMAGE_FRESH
+}
+
 bootstrap() {
     ./$FACTOR_BINARY -i=$BOOT_IMAGE
+       copy_fresh_image
 }
 
 install() {
@@ -526,22 +541,22 @@ install_build_system_port() {
     test_program_installed git
     if [[ $? -ne 1 ]] ; then
         ensure_program_installed yes
-        echo "git not found."
-        echo "This script requires either git-core or port."
-        echo "If it fails, install git-core or port and try again."
+        $ECHO "git not found."
+        $ECHO "This script requires either git-core or port."
+        $ECHO "If it fails, install git-core or port and try again."
         ensure_program_installed port
-        echo "Installing git-core with port...this will take awhile."
+        $ECHO "Installing git-core with port...this will take awhile."
         yes | sudo port install git-core
     fi
 }
 
 usage() {
-    echo "usage: $0 install|install-x11|install-macosx|self-update|quick-update|update|bootstrap|dlls|net-bootstrap|make-target|report [optional-target]"
-    echo "If you are behind a firewall, invoke as:"
-    echo "env GIT_PROTOCOL=http $0 <command>"
-    echo ""
-    echo "Example for overriding the default target:"
-    echo "    $0 update macosx-x86-32"
+    $ECHO "usage: $0 install|install-x11|install-macosx|self-update|quick-update|update|bootstrap|dlls|net-bootstrap|make-target|report [optional-target]"
+    $ECHO "If you are behind a firewall, invoke as:"
+    $ECHO "env GIT_PROTOCOL=http $0 <command>"
+    $ECHO ""
+    $ECHO "Example for overriding the default target:"
+    $ECHO "    $0 update macosx-x86-32"
 }
 
 MAKE_TARGET=unknown
diff --git a/build-support/http-get.vbs b/build-support/http-get.vbs
new file mode 100644 (file)
index 0000000..e6e49d8
--- /dev/null
@@ -0,0 +1,41 @@
+on error resume next\r
+\r
+if WScript.Arguments.Count < 2 then\r
+    WScript.Echo "usage: http-get.vbs source-url dest-file"\r
+    WScript.Quit 1\r
+else\r
+    source_url = WScript.Arguments.Item(0)\r
+    dest_filename = WScript.Arguments.Item(1)\r
+\r
+    dim http, source_data\r
+    set http = CreateObject("WinHttp.WinHttpRequest.5.1")\r
+\r
+    Err.Clear\r
+    http.Open "GET", source_url, false\r
+    http.Send\r
+\r
+    if Err.Number = 0 then\r
+        if http.Status = 200 then\r
+            dim dest_stream\r
+            set dest_stream = CreateObject("ADODB.Stream")\r
+\r
+            Err.Clear\r
+            dest_stream.Type = 1 ' adTypeBinary\r
+            dest_stream.Open\r
+            dest_stream.Write http.ResponseBody\r
+            dest_stream.SaveToFile dest_filename, 2 ' adSaveCreateOverWrite\r
+            if Err.Number <> 0 then\r
+                WScript.Echo "Error " + CStr(Err.Number) + " when writing " + dest_filename + ":"\r
+                WScript.Echo Err.Description\r
+                WScript.Quit 1\r
+            end if\r
+        else\r
+            WScript.Echo CStr(http.Status) + " " + http.StatusText + " when fetching " + source_url\r
+            WScript.Quit 1\r
+        end if\r
+    else\r
+        WScript.Echo "Error " + CStr(Err.Number) + " when fetching " + source_url + ":"\r
+        WScript.Echo Err.Description\r
+        WScript.Quit 1\r
+    end if\r
+end if\r
index 98292b8728b4b6ee2a190716c5c98b81ee83f340..178e8a6f71f829f72cfc7d22b937fc2a1e65b040 100644 (file)
@@ -1,9 +1,40 @@
 USING: byte-arrays arrays help.syntax help.markup
 alien.syntax compiler definitions math libc eval
 debugger parser io io.backend system alien.accessors
-alien.libraries alien.c-types quotations ;
+alien.libraries alien.c-types quotations kernel
+sequences ;
 IN: alien
 
+HELP: cdecl
+{ $description "This symbol is passed as the " { $snippet "abi" } " argument to " { $link alien-indirect } ", " { $link alien-callback } ", " { $link alien-assembly } ", and " { $link add-library } " to indicate that the standard C calling convention should be used, where the caller cleans up the stack frame after calling the function. This symbol only has meaning on 32-bit x86 platforms." } ;
+
+HELP: stdcall
+{ $description "This symbol is passed as the " { $snippet "abi" } " argument to " { $link alien-indirect } ", " { $link alien-callback } ", " { $link alien-assembly } ", and " { $link add-library } " to indicate that the Windows API calling convention should be used, where the called function cleans up its own stack frame before returning to the caller. This symbol only has meaning on 32-bit x86 platforms." } ;
+
+HELP: fastcall
+{ $warning "In the current implementation this ABI only works for functions that take only integer and pointer arguments." }
+{ $description "This symbol is passed as the " { $snippet "abi" } " argument to " { $link alien-indirect } ", " { $link alien-callback } ", " { $link alien-assembly } ", and " { $link add-library } " to indicate that the \"fast call\" calling convention should be used, where the first two integer or pointer arguments are passed in registers and the function cleans up its own stack frame before returning to the caller. This symbol only has meaning on 32-bit x86 platforms." } ;
+
+HELP: thiscall
+{ $description "This symbol is passed as the " { $snippet "abi" } " argument to " { $link alien-indirect } ", " { $link alien-callback } ", " { $link alien-assembly } ", and " { $link add-library } " to indicate that Microsoft Visual C++ calling convention should be used, where the first argument (which must be a \"this\" pointer) is passed in a register and the function cleans up its own stack frame before returning to the caller. This symbol only has meaning on 32-bit x86 platforms." } ;
+
+{ cdecl stdcall fastcall thiscall } related-words
+
+HELP: >c-ptr
+{ $values { "obj" object } { "c-ptr" c-ptr } }
+{ $contract "Outputs a pointer to the binary data of this object." } ;
+
+HELP: byte-length
+{ $values { "obj" object } { "n" "a non-negative integer" } }
+{ $contract "Outputs the number of bytes of binary data that will be output by " { $link >c-ptr } "." } ;
+
+HELP: element-size
+{ $values { "seq" sequence } { "n" "a non-negative integer" } }
+{ $contract "Outputs the number of bytes used for each element of the sequence." }
+{ $notes "If a sequence class implements " { $link element-size } " and " { $link >c-ptr } ", then instances of this sequence, as well as slices of this sequence, can be used as binary objects." } ;
+
+{ >c-ptr element-size byte-length } related-words
+
 HELP: alien
 { $class-description "The class of alien pointers. See " { $link "syntax-aliens" } " for syntax and " { $link "c-data" } " for general information." } ;
 
@@ -42,7 +73,7 @@ HELP: <alien>
 { $notes "Alien objects are invalidated between image saves and loads." } ;
 
 HELP: c-ptr
-{ $class-description "Class of objects consisting of aliens, byte arrays and " { $link f } ". These objects can convert to pointer C types, which are all aliases of " { $snippet "void*" } "." } ;
+{ $class-description "Class of objects consisting of aliens, byte arrays and " { $link f } ". These objects all can be used as values of " { $link pointer } " C types." } ;
 
 HELP: alien-invoke-error
 { $error-description "Thrown if the word calling " { $link alien-invoke } " was not compiled with the optimizing compiler. This may be a result of one of several failure conditions:"
@@ -55,7 +86,7 @@ HELP: alien-invoke-error
 } ;
 
 HELP: alien-invoke
-{ $values { "..." "zero or more objects passed to the C function" } { "return" "a C return type" } { "library" "a logical library name" } { "function" "a C function name" } { "parameters" "a sequence of C parameter types" } }
+{ $values { "args..." "zero or more objects passed to the C function" } { "return" "a C return type" } { "library" "a logical library name" } { "function" "a C function name" } { "parameters" "a sequence of C parameter types" } { "return..." "the return value of the function, if not " { $link void } } }
 { $description "Calls a C library function with the given name. Input parameters are taken from the data stack, and the return value is pushed on the data stack after the function returns. A return type of " { $link void } " indicates that no value is to be expected." }
 { $notes "C type names are documented in " { $link "c-types-specs" } "." }
 { $errors "Throws an " { $link alien-invoke-error } " if the word calling " { $link alien-invoke } " was not compiled with the optimizing compiler." } ;
@@ -69,7 +100,7 @@ HELP: alien-indirect-error
 } ;
 
 HELP: alien-indirect
-{ $values { "..." "zero or more objects passed to the C function" } { "funcptr" "a C function pointer" } { "return" "a C return type" } { "parameters" "a sequence of C parameter types" } { "abi" "one of " { $snippet "\"cdecl\"" } " or " { $snippet "\"stdcall\"" } } }
+{ $values { "args..." "zero or more objects passed to the C function" } { "funcptr" "a C function pointer" } { "return" "a C return type" } { "parameters" "a sequence of C parameter types" } { "abi" "one of " { $link cdecl } " or " { $link stdcall } } { "return..." "the return value of the function, if not " { $link void } } }
 { $description
     "Invokes a C function pointer passed on the data stack. Input parameters are taken from the data stack following the function pointer, and the return value is pushed on the data stack after the function returns. A return type of " { $link void } " indicates that no value is to be expected."
 }
@@ -85,7 +116,7 @@ HELP: alien-callback-error
 } ;
 
 HELP: alien-callback
-{ $values { "return" "a C return type" } { "parameters" "a sequence of C parameter types" } { "abi" "one of " { $snippet "\"cdecl\"" } " or " { $snippet "\"stdcall\"" } } { "quot" quotation } { "alien" alien } }
+{ $values { "return" "a C return type" } { "parameters" "a sequence of C parameter types" } { "abi" "one of " { $link cdecl } " or " { $link stdcall } } { "quot" quotation } { "alien" alien } }
 { $description
     "Defines a callback from C to Factor which accepts the given set of parameters from the C caller, pushes them on the data stack, calls the quotation, and passes a return value back to the C caller. A return type of " { $snippet "void" } " indicates that no value is to be returned."
     $nl
@@ -98,7 +129,7 @@ HELP: alien-callback
     "A simple example, showing a C function which returns the difference of two given integers:"
     { $code
         ": difference-callback ( -- alien )"
-        "    int { int int } \"cdecl\" [ - ] alien-callback ;"
+        "    int { int int } cdecl [ - ] alien-callback ;"
     }
 }
 { $errors "Throws an " { $link alien-callback-error } " if the word calling " { $link alien-callback } " is not compiled." } ;
@@ -112,7 +143,7 @@ HELP: alien-assembly-error
 } ;
 
 HELP: alien-assembly
-{ $values { "..." "zero or more objects passed to the C function" } { "return" "a C return type" } { "parameters" "a sequence of C parameter types" } { "abi" "one of " { $snippet "\"cdecl\"" } " or " { $snippet "\"stdcall\"" } } { "quot" quotation } }
+{ $values { "args..." "zero or more objects passed to the C function" } { "return" "a C return type" } { "parameters" "a sequence of C parameter types" } { "abi" "one of " { $link cdecl } " or " { $link stdcall } } { "quot" quotation } { "return..." "the return value of the function, if not " { $link void } } }
 { $description
     "Invokes arbitrary machine code, generated at compile-time by the quotation. Input parameters are taken from the data stack, and the return value is pushed on the data stack after the function returns. A return type of " { $link void } " indicates that no value is to be expected."
 }
@@ -136,7 +167,7 @@ ARTICLE: "aliens" "Alien addresses"
 }
 "Anywhere that a " { $link alien } " instance is accepted, the " { $link f } " singleton may be passed in to denote a null pointer."
 $nl
-"Usually alien objects do not have to created and dereferenced directly; instead declaring C function parameters and return values as having a pointer type such as " { $snippet "void*" } " takes care of the details."
+"Usually alien objects do not have to created and dereferenced directly; instead declaring C function parameters and return values as having a " { $link pointer } " type such as " { $snippet "void*" } " takes care of the details."
 { $subsections
     "syntax-aliens"
     "alien-expiry"
@@ -182,6 +213,7 @@ ARTICLE: "alien-invoke" "Calling C from Factor"
 { $subsections
     POSTPONE: LIBRARY:
     POSTPONE: FUNCTION:
+    POSTPONE: FUNCTION-ALIAS:
 }
 "The above parsing words create word definitions which call a lower-level word; you can use it directly, too:"
 { $subsections alien-invoke }
index 7eaa5cc50b5a8c771347d4a1a42e565f4e7a9c3f..100908123663db93121ac9227a5759dca61bae57 100644 (file)
@@ -1,6 +1,7 @@
 USING: accessors alien alien.accessors alien.syntax byte-arrays arrays
 kernel kernel.private namespaces tools.test sequences libc math
 system prettyprint layouts alien.libraries sets ;
+FROM: namespaces => set ;
 IN: alien.tests
 
 [ t ] [ -1 <alien> alien-address 0 > ] unit-test
@@ -63,13 +64,13 @@ cell 8 = [
 
 [ 1 1 <displaced-alien> ] must-fail
 
-[ f ] [ 0 B{ 1 2 3 } <displaced-alien> pinned-c-ptr? ] unit-test
+[ f ] [ 1 B{ 1 2 3 } <displaced-alien> pinned-c-ptr? ] unit-test
 
-[ f ] [ 0 B{ 1 2 3 } <displaced-alien> 1 swap <displaced-alien> pinned-c-ptr? ] unit-test
+[ f ] [ 2 B{ 1 2 3 } <displaced-alien> 1 swap <displaced-alien> pinned-c-ptr? ] unit-test
 
 [ t ] [ 0 B{ 1 2 3 } <displaced-alien> 1 swap <displaced-alien> underlying>> byte-array? ] unit-test
 
-[ "( displaced alien )" ] [ 0 B{ 1 2 3 } <displaced-alien> unparse ] unit-test
+[ "( displaced alien )" ] [ 1 B{ 1 2 3 } <displaced-alien> unparse ] unit-test
 
 SYMBOL: initialize-test
 
@@ -83,4 +84,4 @@ f initialize-test set-global
 
 [ 7575 ] [ initialize-test [ 7575 ] initialize-alien ] unit-test
 
-[ V{ BAD-ALIEN } ] [ { BAD-ALIEN BAD-ALIEN BAD-ALIEN } prune ] unit-test
\ No newline at end of file
+[ { BAD-ALIEN } ] [ { BAD-ALIEN BAD-ALIEN BAD-ALIEN } members ] unit-test
old mode 100644 (file)
new mode 100755 (executable)
index 16c33fc..d67e0a1
@@ -1,21 +1,43 @@
 ! Copyright (C) 2004, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs kernel math namespaces sequences system
-kernel.private byte-arrays arrays init ;
+kernel.private byte-arrays byte-vectors arrays init
+continuations.private ;
 IN: alien
 
 PREDICATE: pinned-alien < alien underlying>> not ;
 
 UNION: pinned-c-ptr pinned-alien POSTPONE: f ;
 
-GENERIC: >c-ptr ( obj -- c-ptr )
+GENERIC: element-size ( seq -- n ) flushable
+
+M: byte-array element-size drop 1 ; inline
+
+M: byte-vector element-size drop 1 ; inline
+
+M: slice element-size seq>> element-size ; inline
+
+M: f element-size drop 1 ; inline
+
+GENERIC: byte-length ( obj -- n ) flushable
+
+M: object byte-length [ length ] [ element-size ] bi * ; inline
+
+GENERIC: >c-ptr ( obj -- c-ptr ) flushable
 
 M: c-ptr >c-ptr ; inline
 
+M: slice >c-ptr
+    [ [ from>> ] [ element-size ] bi * ] [ seq>> >c-ptr ] bi
+    <displaced-alien> ; inline
+
 SLOT: underlying
 
 M: object >c-ptr underlying>> ; inline
 
+: binary-object ( obj -- c-ptr n )
+    [ >c-ptr ] [ byte-length ] bi ; inline
+
 GENERIC: expired? ( c-ptr -- ? ) flushable
 
 M: alien expired? expired>> ;
@@ -42,6 +64,13 @@ M: alien equal?
 M: pinned-alien hashcode*
     nip dup expired>> [ drop 1234 ] [ alien-address ] if ;
 
+SINGLETONS: stdcall thiscall fastcall cdecl mingw ;
+
+UNION: abi stdcall thiscall fastcall cdecl mingw ;
+
+: callee-cleanup? ( abi -- ? )
+    { stdcall fastcall thiscall } member? ;
+
 ERROR: alien-callback-error ;
 
 : alien-callback ( return parameters abi quot -- alien )
@@ -49,19 +78,21 @@ ERROR: alien-callback-error ;
 
 ERROR: alien-indirect-error ;
 
-: alien-indirect ( ... funcptr return parameters abi -- ... )
+: alien-indirect ( args... funcptr return parameters abi -- return... )
     alien-indirect-error ;
 
 ERROR: alien-invoke-error library symbol ;
 
-: alien-invoke ( ... return library function parameters -- ... )
+: alien-invoke ( args... return library function parameters -- return... )
     2over alien-invoke-error ;
 
 ERROR: alien-assembly-error code ;
 
-: alien-assembly ( ... return parameters abi quot -- ... )
+: alien-assembly ( args... return parameters abi quot -- return... )
     dup alien-assembly-error ;
 
+<PRIVATE
+
 ! Callbacks are registered in a global hashtable. Note that they
 ! are also pinned in a special callback area, so clearing this
 ! hashtable will not reclaim callbacks. It should only be
@@ -70,8 +101,24 @@ SYMBOL: callbacks
 
 [ H{ } clone callbacks set-global ] "alien" add-startup-hook
 
-<PRIVATE
-
+! Every callback invocation has a unique identifier in the VM.
+! We make sure that the current callback is the right one before
+! returning from it, to avoid a bad interaction between threads
+! and callbacks. See basis/compiler/tests/alien.factor for a
+! test case.
+: wait-to-return ( yield-quot callback-id -- )
+    dup current-callback eq?
+    [ 2drop ] [ over call( -- ) wait-to-return ] if ;
+
+! Used by compiler.codegen to wrap callback bodies
+: do-callback ( callback-quot yield-quot -- )
+    init-namespaces
+    init-catchstack
+    current-callback
+    [ 2drop call ] [ wait-to-return drop ] 3bi ; inline
+
+! A utility for defining global variables that are recompiled in
+! every session
 TUPLE: expiry-check object alien ;
 
 : recompute-value? ( check -- ? )
index 0ad4f6c85ad3db2498190977cc8a6699150adfb8..435ceb2a96b470419f0625f0c25f3844dd9013f7 100644 (file)
@@ -66,6 +66,7 @@ M: string string>symbol string>symbol* ;
 M: sequence string>symbol [ string>symbol* ] map ;
 
 [
-    8 special-object utf8 alien>string string>cpu \ cpu set-global
-    9 special-object utf8 alien>string string>os \ os set-global
+     8 special-object utf8 alien>string string>cpu \ cpu set-global
+     9 special-object utf8 alien>string string>os \ os set-global
+    67 special-object utf8 alien>string \ vm-compiler set-global
 ] "alien.strings" add-startup-hook
index 8f93c5a9d1ee650bdfe712b83ae58b997d3f18ac..2439f03aac33468ba38247b984d0ced53c302e94 100644 (file)
@@ -202,7 +202,7 @@ HELP: new-assoc
 { $contract "Creates a new assoc of the same size as " { $snippet "exemplar" } " which can hold " { $snippet "capacity" } " entries before growing." } ;
 
 HELP: assoc-find
-{ $values { "assoc" assoc } { "quot" { $quotation "( key value -- ? )" } } { "key" "the successful key, or f" } { "value" "the successful value, or f" } { "?" "a boolean" } }
+{ $values { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... ? )" } } { "key" "the successful key, or f" } { "value" "the successful value, or f" } { "?" "a boolean" } }
 { $description "Applies a predicate quotation to each entry in the assoc. Returns the key and value that the quotation succeeds on, or " { $link f } " for both if the quotation fails. It also returns a boolean describing whether there was anything found; this can be used to distinguish between a key and a value equal to " { $link f } ", or nothing being found." } ;
 
 HELP: clear-assoc
@@ -242,7 +242,7 @@ HELP: ?at
 { $description "Looks up the value associated with a key. If the key was not present, an error can be thrown without extra stack shuffling. This word handles assocs that store " { $link f } "." } ;
 
 HELP: assoc-each
-{ $values { "assoc" assoc } { "quot" { $quotation "( key value -- )" } } }
+{ $values { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... )" } } }
 { $description "Applies a quotation to each entry in the assoc." }
 { $examples
     { $example
@@ -254,7 +254,7 @@ HELP: assoc-each
 } ;
 
 HELP: assoc-map
-{ $values { "assoc" assoc } { "quot" { $quotation "( key value -- newkey newvalue )" } } { "newassoc" "a new assoc" } }
+{ $values { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... newkey newvalue )" } } { "newassoc" "a new assoc" } }
 { $description "Applies the quotation to each entry in the input assoc and collects the results in a new assoc of the same type as the input." }
 { $examples
     { $unchecked-example
@@ -269,15 +269,15 @@ HELP: assoc-map
 { assoc-map assoc-map-as } related-words
 
 HELP: assoc-filter
-{ $values { "assoc" assoc } { "quot" { $quotation "( key value -- ? )" } } { "subassoc" "a new assoc" } }
+{ $values { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... ? )" } } { "subassoc" "a new assoc" } }
 { $description "Outputs an assoc of the same type as " { $snippet "assoc" } " consisting of all entries for which the predicate quotation yields true." } ;
 
 HELP: assoc-filter-as
-{ $values { "assoc" assoc } { "quot" { $quotation "( key value -- ? )" } } { "exemplar" assoc } { "subassoc" "a new assoc" } }
+{ $values { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... ? )" } } { "exemplar" assoc } { "subassoc" "a new assoc" } }
 { $description "Outputs an assoc of the same type as " { $snippet "exemplar" } " consisting of all entries for which the predicate quotation yields true." } ;
 
 HELP: assoc-filter!
-{ $values { "assoc" assoc } { "quot" { $quotation "( key value -- ? )" } } }
+{ $values { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... ? )" } } }
 { $description "Removes all entries for which the predicate quotation yields true." }
 { $side-effects "assoc" } ;
 
@@ -291,11 +291,11 @@ HELP: assoc-partition
 { $description "Calls a predicate quotation on each key of the input assoc. If the test yields true, the key/value pair is added to " { $snippet "true-assoc" } "; if false, it's added to " { $snippet "false-assoc" } "." } ;
 
 HELP: assoc-any?
-{ $values { "assoc" assoc } { "quot" { $quotation "( key value -- ? )" } } { "?" "a boolean" } }
+{ $values { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... ? )" } } { "?" "a boolean" } }
 { $description "Tests if the assoc contains an entry satisfying a predicate by applying the quotation to each entry in turn. Iteration stops if an entry is found for which the quotation outputs a true value." } ;
 
 HELP: assoc-all?
-{ $values { "assoc" assoc } { "quot" { $quotation "( key value -- ? )" } } { "?" "a boolean" } }
+{ $values { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... ? )" } } { "?" "a boolean" } }
 { $description "Tests if all entries in the assoc satisfy a predicate by applying the quotation to each entry in turn. a predicate quotation to entry in the assoc. Iteration stops if an entry is found for which the quotation outputs " { $link f } ". If the assoc is empty, always outputs " { $link t } "." } ;
 
 HELP: assoc-subset?
@@ -378,25 +378,25 @@ HELP: substitute
 { $description "Creates a new sequence where elements of " { $snippet "seq" } " which appear as keys in " { $snippet "assoc" } " are replaced by the corresponding values, and all other elements are unchanged." } ;
 
 HELP: cache
-{ $values { "key" "a key" } { "assoc" assoc } { "quot" { $quotation "( key -- value )" } } { "value" "a previously-retained or freshly-computed value" } }
+{ $values { "key" "a key" } { "assoc" assoc } { "quot" { $quotation "( ... key -- ... value )" } } { "value" "a previously-retained or freshly-computed value" } }
 { $description "If the key is present in the assoc, outputs the associated value, otherwise calls the quotation to produce a value and stores the key/value pair into the assoc. Returns a value either looked up or newly stored in the assoc." }
 { $side-effects "assoc" } ;
 
 HELP: 2cache
-{ $values { "key1" "a key" } { "key2" "a key" } { "assoc" assoc } { "quot" { $quotation "( key1 key2 -- value )" } } { "value" "a previously-retained or freshly-computed value" } }
+{ $values { "key1" "a key" } { "key2" "a key" } { "assoc" assoc } { "quot" { $quotation "( ... key1 key2 -- ... value )" } } { "value" "a previously-retained or freshly-computed value" } }
 { $description "If a single key composed of the input keys is present in the assoc, outputs the associated value, otherwise calls the quotation to produce a value and stores the keys/value pair into the assoc. Returns the value stored in the assoc. Returns a value either looked up or newly stored in the assoc." }
 { $side-effects "assoc" } ;
 
 HELP: map>assoc
-{ $values { "seq" "a sequence" } { "quot" { $quotation "( elt -- key value )" } } { "exemplar" assoc } { "assoc" "a new assoc" } }
+{ $values { "seq" "a sequence" } { "quot" { $quotation "( ... elt -- ... key value )" } } { "exemplar" assoc } { "assoc" "a new assoc" } }
 { $description "Applies the quotation to each element of the sequence, and collects the keys and values into a new assoc having the same type as " { $snippet "exemplar" } "." } ;
 
 HELP: assoc>map
-{ $values { "assoc" assoc } { "quot" { $quotation "( key value -- elt )" } } { "exemplar" "a sequence" } { "seq" "a new sequence" } }
+{ $values { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... elt )" } } { "exemplar" "a sequence" } { "seq" "a new sequence" } }
 { $description "Applies the quotation to each entry of the assoc and collects the results into a new sequence of the same type as the exemplar." } ;
 
 HELP: change-at
-{ $values { "key" object } { "assoc" assoc } { "quot" { $quotation "( value -- newvalue )" } } }
+{ $values { "key" object } { "assoc" assoc } { "quot" { $quotation "( ..a value -- ..b newvalue )" } } }
 { $description "Applies the quotation to the value associated with " { $snippet "key" } ", storing the new value back in the assoc." }
 { $side-effects "assoc" } ;
 
@@ -432,7 +432,7 @@ HELP: assoc-combine
 
 HELP: assoc-map-as
 { $values
-     { "assoc" assoc } { "quot" { $quotation "( key value -- newkey newvalue )" } } { "exemplar" assoc }
+     { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... newkey newvalue )" } } { "exemplar" assoc }
      { "newassoc" assoc } }
 { $description "Applies the quotation to each entry in the input assoc and collects the results in a new assoc of the stame type as the exemplar." }
 { $examples { $example "USING: prettyprint assocs hashtables math ;" " H{ { 1 2 } { 3 4 } } [ sq ] { } assoc-map-as ." "{ { 1 4 } { 3 16 } }" } } ;
index e8ed1637e6a9d6444e07d39107b0af620baf8f18..58a2a29eb10bdb3d135aa485b331905068a794a6 100644 (file)
@@ -44,48 +44,48 @@ M: assoc assoc-like drop ; inline
 : substituter ( assoc -- quot )
     [ ?at drop ] curry ; inline
 
-: with-assoc ( assoc quot: ( value key assoc -- ) -- quot: ( key value -- ) )
+: with-assoc ( assoc quot: ( ..a value key assoc -- ..b ) -- quot: ( ..a key value -- ..b ) )
     curry [ swap ] prepose ; inline
 
 PRIVATE>
 
-: assoc-find ( assoc quot -- key value ? )
+: assoc-find ( ... assoc quot: ( ... key value -- ... ? ) -- ... key value ? )
     (assoc-each) find swap [ first2 t ] [ drop f f f ] if ; inline
 
 : key? ( key assoc -- ? ) at* nip ; inline
 
-: assoc-each ( assoc quot -- )
+: assoc-each ( ... assoc quot: ( ... key value -- ... ) -- ... )
     (assoc-each) each ; inline
 
-: assoc>map ( assoc quot exemplar -- seq )
+: assoc>map ( ... assoc quot: ( ... key value -- ... elt ) exemplar -- ... seq )
     [ collector-for [ assoc-each ] dip ] [ like ] bi ; inline
 
-: assoc-map-as ( assoc quot exemplar -- newassoc )
+: assoc-map-as ( ... assoc quot: ( ... key value -- ... newkey newvalue ) exemplar -- ... newassoc )
     [ [ 2array ] compose V{ } assoc>map ] dip assoc-like ; inline
 
-: assoc-map ( assoc quot -- newassoc )
+: assoc-map ( ... assoc quot: ( ... key value -- ... newkey newvalue ) -- ... newassoc )
     over assoc-map-as ; inline
 
-: assoc-filter-as ( assoc quot exemplar -- subassoc )
+: assoc-filter-as ( ... assoc quot: ( ... key value -- ... ? ) exemplar -- ... subassoc )
     [ (assoc-each) filter ] dip assoc-like ; inline
 
-: assoc-filter ( assoc quot -- subassoc )
+: assoc-filter ( ... assoc quot: ( ... key value -- ... ? ) -- ... subassoc )
     over assoc-filter-as ; inline
 
-: assoc-filter! ( assoc quot -- assoc )
+: assoc-filter! ( ... assoc quot: ( ... key value -- ... ? ) -- ... assoc )
     [
         over [ [ [ drop ] 2bi ] dip [ delete-at ] 2curry unless ] 2curry
         assoc-each
     ] [ drop ] 2bi ; inline
 
-: assoc-partition ( assoc quot -- true-assoc false-assoc )
+: assoc-partition ( ... assoc quot: ( ... key value -- ... ? ) -- ... true-assoc false-assoc )
     [ (assoc-each) partition ] [ drop ] 2bi
     [ assoc-like ] curry bi@ ; inline
 
-: assoc-any? ( assoc quot -- ? )
+: assoc-any? ( ... assoc quot: ( ... key value -- ... ? ) -- ... ? )
     assoc-find 2nip ; inline
 
-: assoc-all? ( assoc quot -- ? )
+: assoc-all? ( ... assoc quot: ( ... key value -- ... ? ) -- ... ? )
     [ not ] compose assoc-any? not ; inline
 
 : at ( key assoc -- value/f )
@@ -150,23 +150,23 @@ M: assoc assoc-clone-like ( assoc exemplar -- newassoc )
 : substitute ( seq assoc -- newseq )
     substituter map ;
 
-: cache ( key assoc quot -- value )
+: cache ( ... key assoc quot: ( ... key -- ... value ) -- ... value )
     [ [ at* ] 2keep ] dip
     [ [ nip call dup ] [ drop ] 3bi set-at ] 3curry
     [ drop ] prepose
     unless ; inline
 
-: 2cache ( key1 key2 assoc quot -- value )
+: 2cache ( ... key1 key2 assoc quot: ( ... key1 key2 -- ... value ) -- ... value )
     [ 2array ] 2dip [ first2 ] prepose cache ; inline
 
-: change-at ( key assoc quot -- )
+: change-at ( ..a key assoc quot: ( ..a value -- ..b newvalue ) -- ..b )
     [ [ at ] dip call ] [ drop ] 3bi set-at ; inline
 
 : at+ ( n key assoc -- ) [ 0 or + ] change-at ; inline
 
 : inc-at ( key assoc -- ) [ 1 ] 2dip at+ ; inline
 
-: map>assoc ( seq quot exemplar -- assoc )
+: map>assoc ( ... seq quot: ( ... elt -- ... key value ) exemplar -- ... assoc )
     [ [ 2array ] compose { } map-as ] dip assoc-like ; inline
 
 : extract-keys ( seq assoc -- subassoc )
index 367dc4d942331aaaf26604b53c61b7f0a6018f0c..c00199e9b3dbecc4da406fc929db39a00704cb33 100644 (file)
@@ -18,7 +18,8 @@ H{ } clone sub-primitives set
 "vocab:bootstrap/syntax.factor" parse-file
 
 architecture get {
-    { "x86.32" "x86/32" }
+    { "winnt-x86.32" "x86/32/winnt" }
+    { "unix-x86.32" "x86/32/unix" }
     { "winnt-x86.64" "x86/64/winnt" }
     { "unix-x86.64" "x86/64/unix" }
     { "linux-ppc" "ppc/linux" }
@@ -63,6 +64,7 @@ call( -- )
     "alien"
     "alien.accessors"
     "alien.libraries"
+    "alien.private"
     "arrays"
     "byte-arrays"
     "classes.private"
@@ -342,7 +344,7 @@ tuple
     { "(execute)" "kernel.private" (( word -- )) }
     { "(call)" "kernel.private" (( quot -- )) }
     { "unwind-native-frames" "kernel.private" (( -- )) }
-    { "set-callstack" "kernel.private" (( cs -- * )) }
+    { "set-callstack" "kernel.private" (( callstack -- * )) }
     { "lazy-jit-compile" "kernel.private" (( -- )) }
     { "c-to-factor" "kernel.private" (( -- )) }
     { "slot" "slots.private" (( obj m -- value )) }
@@ -368,6 +370,11 @@ tuple
     { "fixnum<=" "math.private" (( x y -- z )) }
     { "fixnum>" "math.private" (( x y -- ? )) }
     { "fixnum>=" "math.private" (( x y -- ? )) }
+    { "string-nth-fast" "strings.private" (( n string -- ch )) }
+    { "(set-context)" "threads.private" (( obj context -- obj' )) }
+    { "(set-context-and-delete)" "threads.private" (( obj context -- * )) }
+    { "(start-context)" "threads.private" (( obj quot -- obj' )) }
+    { "(start-context-and-delete)" "threads.private" (( obj quot -- * )) }
 } [ first3 make-sub-primitive ] each
 
 ! Primitive words
@@ -415,12 +422,13 @@ tuple
     { "(dlsym)" "alien.libraries" "primitive_dlsym" (( name dll -- alien )) }
     { "dlclose" "alien.libraries" "primitive_dlclose" (( dll -- )) }
     { "dll-valid?" "alien.libraries" "primitive_dll_validp" (( dll -- ? )) }
+    { "current-callback" "alien.private" "primitive_current_callback" (( -- n )) }
     { "<array>" "arrays" "primitive_array" (( n elt -- array )) }
     { "resize-array" "arrays" "primitive_resize_array" (( n array -- newarray )) }
     { "(byte-array)" "byte-arrays" "primitive_uninitialized_byte_array" (( n -- byte-array )) }
     { "<byte-array>" "byte-arrays" "primitive_byte_array" (( n -- byte-array )) }
     { "resize-byte-array" "byte-arrays" "primitive_resize_byte_array" (( n byte-array -- newbyte-array )) }
-    { "<tuple-boa>" "classes.tuple.private" "primitive_tuple_boa" (( ... layout -- tuple )) }
+    { "<tuple-boa>" "classes.tuple.private" "primitive_tuple_boa" (( slots... layout -- tuple )) }
     { "<tuple>" "classes.tuple.private" "primitive_tuple" (( layout -- tuple )) }
     { "modify-code-heap" "compiler.units" "primitive_modify_code_heap" (( alist update-existing? reset-pics? -- )) }
     { "lookup-method" "generic.single.private" "primitive_lookup_method" (( object methods -- method )) }
@@ -434,24 +442,26 @@ tuple
     { "fread" "io.streams.c" "primitive_fread" (( n alien -- str/f )) }
     { "fseek" "io.streams.c" "primitive_fseek" (( alien offset whence -- )) }
     { "ftell" "io.streams.c" "primitive_ftell" (( alien -- n )) }
-    { "fwrite" "io.streams.c" "primitive_fwrite" (( string alien -- )) }
+    { "fwrite" "io.streams.c" "primitive_fwrite" (( data length alien -- )) }
     { "(clone)" "kernel" "primitive_clone" (( obj -- newobj )) }
     { "<wrapper>" "kernel" "primitive_wrapper" (( obj -- wrapper )) }
-    { "callstack" "kernel" "primitive_callstack" (( -- cs )) }
+    { "callstack" "kernel" "primitive_callstack" (( -- callstack )) }
     { "callstack>array" "kernel" "primitive_callstack_to_array" (( callstack -- array )) }
-    { "datastack" "kernel" "primitive_datastack" (( -- ds )) }
+    { "datastack" "kernel" "primitive_datastack" (( -- array )) }
     { "die" "kernel" "primitive_die" (( -- )) }
-    { "retainstack" "kernel" "primitive_retainstack" (( -- rs )) }
+    { "retainstack" "kernel" "primitive_retainstack" (( -- array )) }
     { "(identity-hashcode)" "kernel.private" "primitive_identity_hashcode" (( obj -- code )) }
     { "become" "kernel.private" "primitive_become" (( old new -- )) }
-    { "call-clear" "kernel.private" "primitive_call_clear" (( quot -- * )) }
+    { "callstack-bounds" "kernel.private" "primitive_callstack_bounds" (( -- start end )) }
     { "check-datastack" "kernel.private" "primitive_check_datastack" (( array in# out# -- ? )) }
     { "compute-identity-hashcode" "kernel.private" "primitive_compute_identity_hashcode" (( obj -- )) }
+    { "context-object" "kernel.private" "primitive_context_object" (( n -- obj )) }
     { "innermost-frame-executing" "kernel.private" "primitive_innermost_stack_frame_executing" (( callstack -- obj )) }
     { "innermost-frame-scan" "kernel.private" "primitive_innermost_stack_frame_scan" (( callstack -- n )) }
-    { "set-datastack" "kernel.private" "primitive_set_datastack" (( ds -- )) }
+    { "set-context-object" "kernel.private" "primitive_set_context_object" (( obj n -- )) }
+    { "set-datastack" "kernel.private" "primitive_set_datastack" (( array -- )) }
     { "set-innermost-frame-quot" "kernel.private" "primitive_set_innermost_stack_frame_quot" (( n callstack -- )) }
-    { "set-retainstack" "kernel.private" "primitive_set_retainstack" (( rs -- )) }
+    { "set-retainstack" "kernel.private" "primitive_set_retainstack" (( array -- )) }
     { "set-special-object" "kernel.private" "primitive_set_special_object" (( obj n -- )) }
     { "special-object" "kernel.private" "primitive_special_object" (( n -- obj )) }
     { "strip-stack-traces" "kernel.private" "primitive_strip_stack_traces" (( -- )) }
@@ -462,7 +472,7 @@ tuple
     { "byte-array>bignum" "math" "primitive_byte_array_to_bignum" (( x -- y )) }
     { "double>bits" "math" "primitive_double_bits" (( x -- n )) }
     { "float>bits" "math" "primitive_float_bits" (( x -- n )) }
-    { "(float>string)" "math.parser.private" "primitive_float_to_str" (( n -- str )) }
+    { "(format-float)" "math.parser.private" "primitive_format_float" (( n format -- byte-array )) }
     { "bignum*" "math.private" "primitive_bignum_multiply" (( x y -- z )) }
     { "bignum+" "math.private" "primitive_bignum_add" (( x y -- z )) }
     { "bignum-" "math.private" "primitive_bignum_subtract" (( x y -- z )) }
@@ -524,18 +534,20 @@ tuple
     { "<string>" "strings" "primitive_string" (( n ch -- string )) }
     { "resize-string" "strings" "primitive_resize_string" (( n str -- newstr )) }
     { "set-string-nth-fast" "strings.private" "primitive_set_string_nth_fast" (( ch n string -- )) }
-    { "set-string-nth-slow" "strings.private" "primitive_set_string_nth_slow" (( ch n string -- )) }
-    { "string-nth" "strings.private" "primitive_string_nth" (( n string -- ch )) }
-    { "(exit)" "system" "primitive_exit" (( n -- )) }
+    { "(exit)" "system" "primitive_exit" (( n -- * )) }
     { "nano-count" "system" "primitive_nano_count" (( -- ns )) }
     { "system-micros" "system" "primitive_system_micros" (( -- us )) }
     { "(sleep)" "threads.private" "primitive_sleep" (( nanos -- )) }
+    { "callstack-for" "threads.private" "primitive_callstack_for" (( context -- array )) }
+    { "context-object-for" "threads.private" "primitive_context_object_for" (( n context -- obj )) }
+    { "datastack-for" "threads.private" "primitive_datastack_for" (( context -- array )) }
+    { "retainstack-for" "threads.private" "primitive_retainstack_for" (( context -- array )) }
     { "dispatch-stats" "tools.dispatch.private" "primitive_dispatch_stats" (( -- stats )) }
     { "reset-dispatch-stats" "tools.dispatch.private" "primitive_reset_dispatch_stats" (( -- )) }
     { "profiling" "tools.profiler.private" "primitive_profiling" (( ? -- )) }
     { "optimized?" "words" "primitive_optimized_p" (( word -- ? )) }
     { "word-code" "words" "primitive_word_code" (( word -- start end )) }
-    { "(word)" "words.private" "primitive_word" (( name vocab -- word )) }
+    { "(word)" "words.private" "primitive_word" (( name vocab hashcode -- word )) }
 } [ first4 make-primitive ] each
 
 ! Bump build number
index 78658206de42af07531195fa573d21ab40a63634..41218fff6d395041587ae96ee98aa3fb14e96c63 100644 (file)
@@ -40,7 +40,7 @@ load-help? off
             run-file
         ] [
             "Cannot find " write write "." print
-            "Please move " write image write " to the same directory as the Factor sources," print
+            "Please move " write image write " into the same directory as the Factor sources," print
             "and try again." print
             1 (exit)
         ] if
index 1870f4ac1bc5ad5e2a1ed33cddd20601a0c2f99b..9395447aa6ffaf2b4e75f32da0c950cce04a42a3 100644 (file)
@@ -29,6 +29,7 @@ IN: bootstrap.syntax
         "HEX:"
         "HOOK:"
         "H{"
+        "HS{"
         "IN:"
         "INSTANCE:"
         "M:"
@@ -88,6 +89,12 @@ IN: bootstrap.syntax
         "read-only"
         "call("
         "execute("
+        "<<<<<<"
+        "======"
+        ">>>>>>"
+        "<<<<<<<"
+        "======="
+        ">>>>>>>"
     } [ "syntax" create drop ] each
 
     "t" "syntax" lookup define-symbol
index f9aaf3eaa571ffec708c393ffa995232ba1d023c..ae217904b75bc612df69a8faf1d69843e02de90b 100644 (file)
@@ -3,6 +3,8 @@
 USING: kernel classes classes.private combinators accessors
 sequences arrays vectors assocs namespaces words sorting layouts
 math hashtables kernel.private sets math.order ;
+FROM: classes => members ;
+RENAME: members sets => set-members
 IN: classes.algebra
 
 <PRIVATE
@@ -10,13 +12,14 @@ IN: classes.algebra
 TUPLE: anonymous-union { members read-only } ;
 
 : <anonymous-union> ( members -- class )
-    [ null eq? not ] filter prune
+    [ null eq? not ] filter set-members
     dup length 1 = [ first ] [ anonymous-union boa ] if ;
 
 TUPLE: anonymous-intersection { participants read-only } ;
 
 : <anonymous-intersection> ( participants -- class )
-    prune dup length 1 = [ first ] [ anonymous-intersection boa ] if ;
+    set-members dup length 1 =
+    [ first ] [ anonymous-intersection boa ] if ;
 
 TUPLE: anonymous-complement { class read-only } ;
 
index 28f0b192ee209dba6d286f4d6dc8d554349e75de..623368d6fbe8e987484e800ebef6044770770e40 100644 (file)
@@ -4,6 +4,7 @@ USING: accessors arrays definitions assocs kernel kernel.private
 slots.private namespaces make sequences strings words words.symbol
 vectors math quotations combinators sorting effects graphs
 vocabs sets ;
+FROM: namespaces => set ;
 IN: classes
 
 ERROR: bad-inheritance class superclass ;
index 7482cce048b1620b5cf046cd6a4778fcb22330bd..5016bb38f620553d84fa161da8db98ea41daa1dd 100644 (file)
@@ -68,23 +68,28 @@ ERROR: invalid-slot-name name ;
 
 ERROR: bad-literal-tuple ;
 
-: parse-slot-value ( -- )
-    scan scan-object 2array , scan {
+ERROR: bad-slot-name class slot ;
+
+: check-slot-name ( class slots name -- name )
+    2dup swap slot-named* nip [ 2nip ] [ nip bad-slot-name ] if ;
+
+: parse-slot-value ( class slots -- )
+    scan check-slot-name scan-object 2array , scan {
         { f [ \ } unexpected-eof ] }
         { "}" [ ] }
         [ bad-literal-tuple ]
     } case ;
 
-: (parse-slot-values) ( -- )
-    parse-slot-value
+: (parse-slot-values) ( class slots -- )
+    2dup parse-slot-value
     scan {
-        { f [ \ } unexpected-eof ] }
+        { f [ 2drop \ } unexpected-eof ] }
         { "{" [ (parse-slot-values) ] }
-        { "}" [ ] }
-        [ bad-literal-tuple ]
+        { "}" [ 2drop ] }
+        [ 2nip bad-literal-tuple ]
     } case ;
 
-: parse-slot-values ( -- values )
+: parse-slot-values ( class slots -- values )
     [ (parse-slot-values) ] { } make ;
 
 GENERIC# boa>object 1 ( class slots -- tuple )
@@ -92,8 +97,6 @@ GENERIC# boa>object 1 ( class slots -- tuple )
 M: tuple-class boa>object
     swap prefix >tuple ;
 
-ERROR: bad-slot-name class slot ;
-
 : check-slot-exists ( class initials slot-spec/f index/f name -- class initials slot-spec index )
     over [ drop ] [ nip nip nip bad-slot-name ] if ;
 
@@ -109,7 +112,7 @@ ERROR: bad-slot-name class slot ;
     scan {
         { f [ unexpected-eof ] }
         { "f" [ drop \ } parse-until boa>object ] }
-        { "{" [ parse-slot-values assoc>object ] }
+        { "{" [ 2dup parse-slot-values assoc>object ] }
         { "}" [ drop new ] }
         [ bad-literal-tuple ]
     } case ;
index 7f6078e321f72f9e194dfa2da258c24e14cc428c..037ecf8715f98f18923fcf04d1caeaf06e275549 100644 (file)
@@ -214,9 +214,9 @@ ARTICLE: "tuple-examples" "Tuple examples"
 "This defines a class word named " { $snippet "employee" } ", a predicate " { $snippet "employee?" } ", and the following slot accessors:"
 { $table
     { "Reader" "Writer" "Setter" "Changer" }
-    { { $snippet "name>>" }    { $snippet "(>>name)" }    { $snippet ">>name" }    { $snippet "change-name" }    }
-    { { $snippet "salary>>" } { $snippet "(>>salary)" } { $snippet ">>salary" } { $snippet "change-salary" } }
-    { { $snippet "position>>" }   { $snippet "(>>position)" }   { $snippet ">>position" }   { $snippet "change-position" }   }
+    { { $snippet "name>>" } { $snippet "name<<" } { $snippet ">>name" } { $snippet "change-name" } }
+    { { $snippet "salary>>" } { $snippet "salary<<" } { $snippet ">>salary" } { $snippet "change-salary" } }
+    { { $snippet "position>>" } { $snippet "position<<" } { $snippet ">>position" } { $snippet "change-position" }   }
 }
 "We can define a constructor which makes an empty employee:"
 { $code ": <employee> ( -- employee )"
@@ -421,8 +421,8 @@ HELP: <tuple> ( layout -- tuple )
 { $values { "layout" "a tuple layout array" } { "tuple" tuple } }
 { $description "Low-level tuple constructor. User code should never call this directly, and instead use " { $link new } "." } ;
 
-HELP: <tuple-boa> ( ... layout -- tuple )
-{ $values { "..." "values" } { "layout" "a tuple layout array" } { "tuple" tuple } }
+HELP: <tuple-boa> ( slots... layout -- tuple )
+{ $values { "slots..." "values" } { "layout" "a tuple layout array" } { "tuple" tuple } }
 { $description "Low-level tuple constructor. User code should never call this directly, and instead use " { $link boa } "." } ;
 
 HELP: new
@@ -439,7 +439,7 @@ HELP: new
 } ;
 
 HELP: boa
-{ $values { "..." "slot values" } { "class" tuple-class } { "tuple" tuple } }
+{ $values { "slots..." "slot values" } { "class" tuple-class } { "tuple" tuple } }
 { $description "Creates a new instance of " { $snippet "class" } " and fill in the slots from the stack, with the top-most stack element being stored in the right-most slot." }
 { $notes "The name " { $snippet "boa" } " is shorthand for “by order of arguments”, and “BOA constructor” is a pun on “boa constrictor”." }
 { $errors "Throws an error if the slot values do not match class declarations on slots (see" { $link "tuple-declarations" } ")." } ;
index 276c6b407c1c7fecca57b00427203954dc7ad1c2..5aec400fbe1eae4c71c3a86113486e7c4a2b6725 100644 (file)
@@ -267,7 +267,7 @@ test-server-slot-values
 ] unit-test
 
 [
-    "IN: classes.tuple.tests TUPLE: bad-superclass < word ;" eval( -- )
+    "IN: classes.tuple.tests TUPLE: invalid-superclass < word ;" eval( -- )
 ] must-fail
 
 ! Dynamically changing inheritance hierarchy
@@ -588,7 +588,7 @@ T{ reshape-test f "hi" } "tuple" set
 
 [ ] [ "IN: classes.tuple.tests TUPLE: reshape-test { x read-only } ;" eval( -- ) ] unit-test
 
-[ f ] [ \ reshape-test \ (>>x) method ] unit-test
+[ f ] [ \ reshape-test \ x<< method ] unit-test
 
 [ "tuple" get 5 >>x ] must-fail
 
index 31183a629e2f2540ef455257f2664064c2bc089a..5b1ce8e80cd1828728f729bd4b948c6f48633429 100644 (file)
@@ -295,7 +295,7 @@ HELP: spread
 { bi* tri* spread } related-words
 
 HELP: to-fixed-point
-{ $values { "object" object } { "quot" { $quotation "( object(n) -- object(n+1) )" } } { "object(n)" object } }
+{ $values { "object" object } { "quot" { $quotation "( ... object(n) -- ... object(n+1) )" } } { "object(n)" object } }
 { $description "Applies the quotation repeatedly with " { $snippet "object" } " as the initial input until the output of the quotation equals the input." }
 { $examples
     { $example
index b239b1eac9a2ab28ee034d0b8ec2889a8ab297f0..1e7a61daaaca52bbd725eaa88f4ea2becb20563d 100644 (file)
@@ -35,6 +35,24 @@ IN: combinators.tests
 [ 7 ] [ 1 3 [ 2 * ] [ + ] compose compile-call(-test-1 ] unit-test
 [ 4 ] [ 1 3 [ { + } [ ] like call ] compile-call(-test-1 ] unit-test
 
+[ [ ] call( -- * ) ] must-fail
+
+: compile-call(-test-2 ( -- ) [ ] call( -- * ) ;
+
+[ compile-call(-test-2 ] [ wrong-values? ] must-fail-with
+
+: compile-call(-test-3 ( quot -- ) call( -- * ) ;
+
+[ [ ] compile-call(-test-3 ] [ wrong-values? ] must-fail-with
+
+: compile-execute(-test-3 ( a -- ) \ . execute( value -- * ) ;
+
+[ 10 compile-execute(-test-3 ] [ wrong-values? ] must-fail-with
+
+: compile-execute(-test-4 ( a word -- ) execute( value -- * ) ;
+
+[ 10 \ . compile-execute(-test-4 ] [ wrong-values? ] must-fail-with
+
 ! Compiled
 : cond-test-1 ( obj -- str )
     {
index 7b9481825bdd8a68cbb08822bd8ed9ad59d54bfa..bbfee30b3deceabcde0c0fa7967aea48871896b0 100644 (file)
@@ -26,15 +26,17 @@ ERROR: wrong-values quot call-site ;
 ! We can't USE: effects here so we forward reference slots instead
 SLOT: in
 SLOT: out
+SLOT: terminated?
 
 : call-effect ( quot effect -- )
     ! Don't use fancy combinators here, since this word always
     ! runs unoptimized
-    [ datastack ] 2dip
     2dup [
-        [ dip ] dip
-        dup in>> length swap out>> length
-        check-datastack
+        [ [ datastack ] dip dip ] dip
+        dup terminated?>> [ 2drop f ] [
+            dup in>> length swap out>> length
+            check-datastack
+        ] if
     ] 2dip rot
     [ 2drop ] [ wrong-values ] if ;
 
@@ -147,7 +149,7 @@ ERROR: no-case object ;
 : contiguous-range? ( keys -- ? )
     dup [ fixnum? ] all? [
         dup all-unique? [
-            [ prune length ]
+            [ length ]
             [ [ supremum ] [ infimum ] bi - ]
             bi - 1 =
         ] [ drop f ] if
@@ -193,5 +195,5 @@ M: hashtable hashcode*
         [ assoc-hashcode ] [ nip assoc-size ] if
     ] recursive-hashcode ;
 
-: to-fixed-point ( object quot: ( object(n) -- object(n+1) ) -- object(n) )
+: to-fixed-point ( ... object quot: ( ... object(n) -- ... object(n+1) ) -- ... object(n) )
     [ keep over = ] keep [ to-fixed-point ] curry unless ; inline recursive
index b024ed2c65c4b7843c176d28d845a085c7dc8d75..ffbdbefbf2806a4b9dfd64d318603fb68ca73699 100644 (file)
@@ -4,6 +4,7 @@ USING: accessors arrays kernel continuations assocs namespaces
 sequences words vocabs definitions hashtables init sets math
 math.order classes classes.private classes.algebra classes.tuple
 classes.tuple.private generic source-files.errors kernel.private ;
+FROM: namespaces => set ;
 IN: compiler.units
 
 SYMBOL: old-definitions
index 766a78c483970d47b40bc57f1f1f04e447a7ee8e..8775e599a6cdc19f207a911beeac9e04353c27be 100644 (file)
@@ -182,7 +182,7 @@ HELP: cleanup
 { $description "Calls the " { $snippet "try" } " quotation. If no error is thrown, calls " { $snippet "cleanup-always" } " without restoring the data stack. If an error is thrown, restores the data stack, calls " { $snippet "cleanup-always" } " followed by " { $snippet "cleanup-error" } ", and rethrows the error." } ;
 
 HELP: recover
-{ $values { "try" quotation } { "recovery" { $quotation "( error -- )" } } }
+{ $values { "try" { $quotation "( ..a -- ..b )" } } { "recovery" { $quotation "( ..a error -- ..b )" } } }
 { $description "Calls the " { $snippet "try" } " quotation. If an exception is thrown in the dynamic extent of the " { $snippet "try" } " quotation, restores the data stack and calls the " { $snippet "recovery" } " quotation to handle the error." } ;
 
 HELP: ignore-errors
@@ -235,7 +235,7 @@ HELP: save-error
 $low-level-note ;
 
 HELP: with-datastack
-{ $values { "stack" sequence } { "quot" quotation } { "newstack" sequence } }
+{ $values { "stack" sequence } { "quot" quotation } { "new-stack" sequence } }
 { $description "Executes the quotation with the given data stack contents, and outputs the new data stack after the word returns. The input sequence is not modified; a new sequence is produced. Does not affect the data stack in surrounding code, other than consuming the two inputs and pushing the output." }
 { $examples
     { $example "USING: continuations math prettyprint ;" "{ 3 7 } [ + ] with-datastack ." "{ 10 }" }
index 332354e302ed706b0f938057a8c4ae359cd8d08c..896a4b982d3934ac5b0aab3f394fb2e79e03cade 100644 (file)
@@ -1,10 +1,18 @@
-! Copyright (C) 2003, 2009 Slava Pestov.
+! Copyright (C) 2003, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays vectors kernel kernel.private sequences
 namespaces make math splitting sorting quotations assocs
 combinators combinators.private accessors words ;
 IN: continuations
 
+: with-datastack ( stack quot -- new-stack )
+    [
+        [ [ datastack ] dip swap [ { } like set-datastack ] dip ] dip
+        swap [ call datastack ] dip
+        swap [ set-datastack ] dip
+    ] (( stack quot -- new-stack )) call-effect-unsafe ;
+
+SYMBOL: original-error
 SYMBOL: error
 SYMBOL: error-continuation
 SYMBOL: error-thread
@@ -13,7 +21,7 @@ SYMBOL: restarts
 <PRIVATE
 
 : catchstack* ( -- catchstack )
-    1 special-object { vector } declare ; inline
+    1 context-object { vector } declare ; inline
 
 : >c ( continuation -- ) catchstack* push ;
 
@@ -23,13 +31,14 @@ SYMBOL: restarts
 : dummy-1 ( -- obj ) f ;
 : dummy-2 ( obj -- obj ) dup drop ;
 
-: init-catchstack ( -- ) V{ } clone 1 set-special-object ;
+: catchstack ( -- catchstack ) catchstack* clone ; inline
 
-PRIVATE>
+: set-catchstack ( catchstack -- )
+    >vector 1 set-context-object ; inline
 
-: catchstack ( -- catchstack ) catchstack* clone ; inline
+: init-catchstack ( -- ) f set-catchstack ;
 
-: set-catchstack ( catchstack -- ) >vector 1 set-special-object ; inline
+PRIVATE>
 
 TUPLE: continuation data call retain name catch ;
 
@@ -39,14 +48,12 @@ C: <continuation> continuation
     datastack callstack retainstack namestack catchstack
     <continuation> ;
 
+<PRIVATE
+
 : >continuation< ( continuation -- data call retain name catch )
-    {
-        [ data>>   ]
-        [ call>>   ]
-        [ retain>> ]
-        [ name>>   ]
-        [ catch>>  ]
-    } cleave ;
+    { [ data>> ] [ call>> ] [ retain>> ] [ name>> ] [ catch>> ] } cleave ;
+
+PRIVATE>
 
 : ifcc ( capture restore -- )
     [ dummy-1 continuation ] 2dip [ dummy-2 ] prepose ?if ; inline
@@ -91,21 +98,13 @@ SYMBOL: return-continuation
 : return ( -- * )
     return-continuation get continue ;
 
-: with-datastack ( stack quot -- newstack )
-    [
-        [
-            [ [ { } like set-datastack ] dip call datastack ] dip
-            continue-with
-        ] (( stack quot continuation -- * )) call-effect-unsafe
-    ] callcc1 2nip ;
-
 GENERIC: compute-restarts ( error -- seq )
 
 <PRIVATE
 
 : save-error ( error -- )
-    dup error set-global
-    compute-restarts restarts set-global ;
+    [ error set-global ]
+    [ compute-restarts restarts set-global ] bi ;
 
 PRIVATE>
 
@@ -115,11 +114,12 @@ SYMBOL: thread-error-hook
     dup save-error
     catchstack* empty? [
         thread-error-hook get-global
-        [ (( error -- * )) call-effect-unsafe ] [ die ] if*
+        [ original-error get-global die ] or
+        (( error -- * )) call-effect-unsafe
     ] when
     c> continue-with ;
 
-: recover ( try recovery -- )
+: recover ( ..a try: ( ..a -- ..b ) recovery: ( ..a error -- ..b ) -- ..b )
     [ [ swap >c call c> drop ] curry ] dip ifcc ; inline
 
 : ignore-errors ( quot -- )
@@ -130,7 +130,7 @@ SYMBOL: thread-error-hook
 
 ERROR: attempt-all-error ;
 
-: attempt-all ( seq quot -- obj )
+: attempt-all ( ... seq quot: ( ... elt -- ... obj ) -- ... obj )
     over empty? [
         attempt-all-error
     ] [
@@ -172,13 +172,13 @@ M: condition compute-restarts
 <PRIVATE
 
 : init-error-handler ( -- )
-    V{ } clone set-catchstack
+    init-catchstack
     ! VM calls on error
     [
         ! 63 = self
         63 special-object error-thread set-global
         continuation error-continuation set-global
-        rethrow
+        [ original-error set-global ] [ rethrow ] bi
     ] 5 set-special-object
     ! VM adds this to kernel errors, so that user-space
     ! can identify them
index ac3751e32ed8bf40fc96656de69ab7b935f5e701..e6d78fa03e393cf5afc96ae863679520de80b4fe 100644 (file)
@@ -2,6 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors continuations kernel namespaces make
 sequences vectors sets assocs init math ;
+FROM: namespaces => set ;
 IN: destructors
 
 SYMBOL: disposables
index 134faea0270bc5f10adeb087e2d828f4d2e41d8c..db33aaa2440491aa513c864194f8a00ee6690721 100644 (file)
@@ -1,4 +1,4 @@
-USING: help.markup help.syntax math strings words kernel combinators ;
+USING: arrays classes help.markup help.syntax math strings words kernel combinators sequences ;
 IN: effects
 
 ARTICLE: "effects" "Stack effect declarations"
@@ -6,11 +6,13 @@ ARTICLE: "effects" "Stack effect declarations"
 { $code "( input1 input2 ... -- output1 ... )" }
 "Stack elements in a stack effect are ordered so that the top of the stack is on the right side. Here is an example:"
 { $synopsis + }
-"Parameters which are quotations can be declared by suffixing the parameter name with " { $snippet ":" } " and then writing a nested stack effect declaration:"
+"Parameters which are quotations can be declared by suffixing the parameter name with " { $snippet ":" } " and then writing a nested stack effect declaration. If the number of inputs or outputs depends on the stack effects of quotation parameters, row variables can be declared:"
+{ $subsection "effects-variables" }
+"Some examples of row-polymorphic combinators:"
 { $synopsis while }
-"Only the number of inputs and outputs carries semantic meaning."
-$nl
-"Nested quotation declaration only has semantic meaning for " { $link POSTPONE: inline } " " { $link POSTPONE: recursive } " words. See " { $link "inference-recursive-combinators" } "."
+{ $synopsis if* }
+{ $synopsis each }
+"For words that are not " { $link POSTPONE: inline } ", only the number of inputs and outputs carries semantic meaning, and effect variables are ignored. However, nested quotation declarations are enforced for inline words. Nested quotation declarations are optional for non-recursive inline combinators and only provide better error messages. However, quotation inputs to " { $link POSTPONE: recursive } " combinators must have an effect declared. See " { $link "inference-recursive-combinators" } "."
 $nl
 "In concatenative code, input and output names are for documentation purposes only and certain conventions have been established to make them more descriptive. For code written with " { $link "locals" } ", stack values are bound to local variables named by the stack effect's input parameters."
 $nl
@@ -30,8 +32,88 @@ $nl
     { { $snippet "dim" } "a screen dimension specified as a two-element array holding width and height values" }
     { { $snippet "*" } "when this symbol appears by itself in the list of outputs, it means the word unconditionally throws an error" }
 }
+"For reflection and metaprogramming, you can use " { $link "syntax-effects" } " to include literal stack effects in your code, or these constructor words to construct stack effect objects at runtime:"
+{ $subsections
+    <effect>
+    <terminated-effect>
+    <variable-effect>
+}
 { $see-also "inference" } ;
 
+HELP: <effect>
+{ $values
+    { "in" "a sequence of strings or string–type pairs" }
+    { "out" "a sequence of strings or string–type pairs" }
+    { "effect" effect }
+}
+{ $description "Constructs an " { $link effect } " object. Each element of " { $snippet "in" } " and " { $snippet "out" } " must be either a string, which is equivalent to a " { $snippet "name" } " in literal stack effect syntax, or a " { $link pair } " where the first element is a string and the second is either a " { $link class } " or effect, which is equivalent to " { $snippet "name: class" } " or " { $snippet "name: ( nested -- effect )" } " in the literal syntax. If the " { $snippet "out" } " array consists of a single string element " { $snippet "\"*\"" } ", a terminating stack effect will be constructed." }
+{ $notes "This word cannot construct effects with " { $link "effects-variables" } ". Use " { $link <variable-effect> } " to construct variable stack effects." }
+{ $examples
+{ $example """USING: effects prettyprint ;
+{ "a" "b" } { "c" } <effect> .""" """(( a b -- c ))""" }
+{ $example """USING: arrays effects prettyprint ;
+{ "a" { "b" array } } { "c" } <effect> .""" """(( a b: array -- c ))""" }
+{ $example """USING: effects prettyprint ;
+{ "a" { "b" (( x y -- z )) } } { "c" } <effect> .""" """(( a b: ( x y -- z ) -- c ))""" }
+{ $example """USING: effects prettyprint ;
+{ "a" { "b" (( x y -- z )) } } { "*" } <effect> .""" """(( a b: ( x y -- z ) -- * ))""" }
+} ;
+
+HELP: <terminated-effect>
+{ $values
+    { "in" "a sequence of strings or string–type pairs" }
+    { "out" "a sequence of strings or string–type pairs" }
+    { "terminated?" boolean }
+    { "effect" effect }
+}
+{ $description "Constructs an " { $link effect } " object like " { $link <effect> } ". If " { $snippet "terminated?" } " is true, the value of " { $snippet "out" } " is ignored, and a terminating stack effect is constructed." }
+{ $notes "This word cannot construct effects with " { $link "effects-variables" } ". Use " { $link <variable-effect> } " to construct variable stack effects." }
+{ $examples
+{ $example """USING: effects prettyprint ;
+{ "a" { "b" (( x y -- z )) } } { "c" } f <terminated-effect> .""" """(( a b: ( x y -- z ) -- c ))""" }
+{ $example """USING: effects prettyprint ;
+{ "a" { "b" (( x y -- z )) } } { } t <terminated-effect> .""" """(( a b: ( x y -- z ) -- * ))""" }
+} ;
+
+HELP: <variable-effect>
+{ $values
+    { "in-var" { $maybe string } }
+    { "in" "a sequence of strings or string–type pairs" }
+    { "out-var" { $maybe string } }
+    { "out" "a sequence of strings or string–type pairs" }
+    { "effect" effect }
+}
+{ $description "Constructs an " { $link effect } " object like " { $link <effect> } ". If " { $snippet "in-var" } " or " { $snippet "out-var" } " are not " { $link f } ", they are used as the names of the " { $link "effects-variables" } " for the inputs and outputs of the effect object." }
+{ $examples
+{ $example """USING: effects prettyprint ;
+f { "a" "b" } f { "c" } <variable-effect> .""" """(( a b -- c ))""" }
+{ $example """USING: effects prettyprint ;
+"x" { "a" "b" } "y" { "c" } <variable-effect> .""" """(( ..x a b -- ..y c ))""" }
+{ $example """USING: arrays effects prettyprint ;
+"y" { "a" { "b" (( ..x -- ..y )) } } "x" { "c" } <variable-effect> .""" """(( ..y a b: ( ..x -- ..y ) -- ..x c ))""" }
+{ $example """USING: effects prettyprint ;
+"." { "a" "b" } f { "*" } <variable-effect> .""" """(( ... a b -- * ))""" }
+} ;
+
+
+{ <effect> <terminated-effect> <variable-effect> } related-words
+
+ARTICLE: "effects-variables" "Stack effect row variables"
+"The stack effect of many " { $link POSTPONE: inline } " combinators can have variable stack effects, depending on the effect of the quotation they call. For example, the quotation parameter to " { $link each } " receives an element from the input sequence each time it is called, but it can also manipulate values on the stack below the element as long as it leaves the same number of elements on the stack. (This is how " { $link reduce } " is implemented in terms of " { $snippet "each" } ".) The stack effect of an " { $snippet "each" } " expression thus depends on the stack effect of its input quotation:"
+{ $example
+ """USING: io sequences stack-checker ;
+[ [ write ] each ] infer."""
+"""( x -- )""" }
+{ $example
+"""USING: sequences stack-checker ;
+[ [ append ] each ] infer."""
+"""( x x -- x )""" }
+"This feature is referred to as row polymorphism. Row-polymorphic combinators are declared by including row variables in their stack effect, which are indicated by names starting with " { $snippet ".." } ":"
+{ $synopsis each }
+"Using the same variable name in both the inputs and outputs (in the above case of " { $snippet "each" } ", " { $snippet "..." } ") indicates that the number of additional inputs and outputs must be the same. Using different variable names indicates that they can be independent. In combinators with multiple quotation inputs, the number of inputs or outputs represented by a particular " { $snippet ".." } " name must match among all of the quotations. For example, the branches of " { $link if* } " can take a different number of inputs from outputs, as long as they both have the same stack height. The true branch receives the test value as an added input. This is declared as follows:"
+{ $synopsis if* }
+"Stack effect variables can only occur as the first input or first output of a stack effect; names starting in " { $snippet ".." } " cause a syntax error if they occur elsewhere in the effect. For words that are not " { $link POSTPONE: inline } ", effect variables are currently ignored by the stack checker." ;
+
 ABOUT: "effects"
 
 HELP: effect
index ffc0c9780b27daeeb35dca386d6fa3112607bd32..0afc61047dfb0c32d336aef9b4f57e9a6982da52 100644 (file)
@@ -1,4 +1,4 @@
-USING: effects kernel tools.test prettyprint accessors
+USING: effects effects.parser eval kernel tools.test prettyprint accessors
 quotations sequences ;
 IN: effects.tests
 
@@ -10,6 +10,13 @@ IN: effects.tests
 [ 2 ] [ (( a b -- c )) in>> length ] unit-test
 [ 1 ] [ (( a b -- c )) out>> length ] unit-test
 
+[ t ] [ (( a b -- c )) (( ... a b -- ... c )) effect<= ] unit-test
+[ t ] [ (( b -- )) (( ... a b -- ... c )) effect<= ] unit-test
+[ f ] [ (( ... a b -- ... c )) (( a b -- c )) effect<= ] unit-test
+[ f ] [ (( ... b -- ... )) (( a b -- c )) effect<= ] unit-test
+[ f ] [ (( a b -- c )) (( ... a b -- c )) effect<= ] unit-test
+[ f ] [ (( a b -- c )) (( ..x a b -- ..y c )) effect<= ] unit-test
+
 [ "(( object -- object ))" ] [ { f } { f } <effect> unparse ] unit-test
 [ "(( a b -- c d ))" ] [ { "a" "b" } { "c" "d" } <effect> unparse ] unit-test
 [ "(( -- c d ))" ] [ { } { "c" "d" } <effect> unparse ] unit-test
@@ -27,3 +34,18 @@ IN: effects.tests
 
 [ { object object } ] [ (( a b -- )) effect-in-types ] unit-test
 [ { object sequence } ] [ (( a b: sequence -- )) effect-in-types ] unit-test
+
+[ f   ] [ (( a b c -- d )) in-var>> ] unit-test
+[ f   ] [ (( -- d )) in-var>> ] unit-test
+[ "a" ] [ (( ..a b c -- d )) in-var>> ] unit-test
+[ { "b" "c" } ] [ (( ..a b c -- d )) in>> ] unit-test
+
+[ f   ] [ (( ..a b c -- e )) out-var>> ] unit-test
+[ "d" ] [ (( ..a b c -- ..d e )) out-var>> ] unit-test
+[ { "e" } ] [ (( ..a b c -- ..d e )) out>> ] unit-test
+
+[ "(( a ..b c -- d ))" eval( -- effect ) ]
+[ error>> invalid-row-variable? ] must-fail-with
+
+[ "(( ..a: integer b c -- d ))" eval( -- effect ) ]
+[ error>> row-variable-can't-have-type? ] must-fail-with
index 1790399e04d2c47a964f98c52a8c608a98be2c99..216f50dd8e6ccd4f76788e18d31e3cb086bbe016 100644 (file)
@@ -1,25 +1,43 @@
 ! Copyright (C) 2006, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel math math.parser math.order namespaces make sequences strings
-words assocs combinators accessors arrays quotations ;
+USING: kernel math math.parser math.order namespaces make
+sequences strings words assocs combinators accessors arrays
+quotations ;
 IN: effects
 
 TUPLE: effect
 { in array read-only }
 { out array read-only }
-{ terminated? read-only } ;
+{ terminated? read-only }
+{ in-var read-only }
+{ out-var read-only } ;
+
+: ?terminated ( out -- out terminated? )
+    dup { "*" } = [ drop { } t ] [ f ] if ;
 
 : <effect> ( in out -- effect )
-    dup { "*" } = [ drop { } t ] [ f ] if
-    effect boa ;
+    ?terminated f f effect boa ;
+
+: <terminated-effect> ( in out terminated? -- effect )
+    f f effect boa ; inline
+
+: <variable-effect> ( in-var in out-var out -- effect )
+    swap [ rot ] dip [ ?terminated ] 2dip effect boa ;
 
 : effect-height ( effect -- n )
     [ out>> length ] [ in>> length ] bi - ; inline
 
+: variable-effect? ( effect -- ? )
+    [ in-var>> ] [ out-var>> ] bi or ;
+: bivariable-effect? ( effect -- ? )
+    [ in-var>> ] [ out-var>> ] bi = not ;
+
 : effect<= ( effect1 effect2 -- ? )
     {
         { [ over terminated?>> ] [ t ] }
         { [ dup terminated?>> ] [ f ] }
+        { [ 2dup [ bivariable-effect? ] either? ] [ f ] }
+        { [ 2dup [ variable-effect? ] [ variable-effect? not ] bi* and ] [ f ] }
         { [ 2dup [ in>> length ] bi@ > ] [ f ] }
         { [ 2dup [ effect-height ] bi@ = not ] [ f ] }
         [ t ]
@@ -41,13 +59,19 @@ M: pair effect>string first2 [ effect>string ] bi@ ": " glue ;
 : stack-picture ( seq -- string )
     [ [ effect>string % CHAR: \s , ] each ] "" make ;
 
+: var-picture ( var -- string )
+    [ ".." " " surround ]
+    [ "" ] if* ;
+
 M: effect effect>string ( effect -- string )
     [
         "( " %
-        [ in>> stack-picture % "-- " % ]
-        [ out>> stack-picture % ]
-        [ terminated?>> [ "* " % ] when ]
-        tri
+        dup in-var>> var-picture %
+        dup in>> stack-picture % "-- " %
+        dup out-var>> var-picture %
+        dup out>> stack-picture %
+        dup terminated?>> [ "* " % ] when
+        drop
         ")" %
     ] "" make ;
 
@@ -64,7 +88,9 @@ M: pair effect>type second effect>type ;
 
 GENERIC: stack-effect ( word -- effect/f )
 
-M: word stack-effect "declared-effect" word-prop ;
+M: word stack-effect
+    [ "declared-effect" word-prop ]
+    [ parent-word dup [ stack-effect ] when ] bi or ;
 
 M: deferred stack-effect call-next-method (( -- * )) or ;
 
@@ -84,7 +110,7 @@ M: effect clone
     shuffle-mapping swap nths ;
 
 : add-effect-input ( effect -- effect' )
-    [ in>> "obj" suffix ] [ out>> ] [ terminated?>> ] tri effect boa ;
+    [ in>> "obj" suffix ] [ out>> ] [ terminated?>> ] tri <terminated-effect> ;
 
 : compose-effects ( effect1 effect2 -- effect' )
     over terminated?>> [
@@ -94,5 +120,5 @@ M: effect clone
         [ [ out>> length ] [ [ in>> length ] [ out>> length ] bi ] bi* [ [-] ] dip + ]
         [ nip terminated?>> ] 2tri
         [ [ "x" <array> ] bi@ ] dip
-        effect boa
+        <terminated-effect>
     ] if ; inline
index a77ea34c30c8d9230e5ca8de30b881499cff9168..cd484ddd2e6113dd8636889d6fe0775eb3129ba2 100644 (file)
@@ -1,38 +1,64 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: lexer sets sequences kernel splitting effects
-combinators arrays vocabs.parser classes ;
+combinators arrays make vocabs.parser classes parser ;
 IN: effects.parser
 
 DEFER: parse-effect
 
 ERROR: bad-effect ;
+ERROR: invalid-row-variable ;
+ERROR: row-variable-can't-have-type ;
+ERROR: stack-effect-omits-dashes ;
 
-: parse-effect-token ( end -- token/f )
-    scan [ nip ] [ = ] 2bi [ drop f ] [
-        dup { f "(" "((" } member? [ bad-effect ] [
-            ":" ?tail [
-                scan {
-                    { [ dup "(" = ] [ drop ")" parse-effect ] }
-                    { [ dup search class? ] [ search ] }
-                    { [ dup f = ] [ ")" unexpected-eof ] }
-                    [ bad-effect ]
-                } cond 2array
-            ] when
-        ] if
-    ] if ;
-
-: parse-effect-tokens ( end -- tokens )
-    [ parse-effect-token dup ] curry [ ] produce nip ;
-
-ERROR: stack-effect-omits-dashes tokens ;
+SYMBOL: effect-var
+
+<PRIVATE
+: end-token? ( end token -- token ? ) [ nip ] [ = ] 2bi ; inline
+: effect-opener? ( token -- token ? ) dup { f "(" "((" "--" } member? ; inline
+: effect-closer? ( token -- token ? ) dup { ")" "))" } member? ; inline
+: row-variable? ( token -- token' ? ) ".." ?head ; inline
+
+: parse-effect-var ( first? var name -- var )
+    nip
+    [ ":" ?tail [ row-variable-can't-have-type ] when ] curry
+    [ invalid-row-variable ] if ;
+
+: parse-effect-value ( token -- value )
+    ":" ?tail [
+        scan {
+            { [ dup "(" = ] [ drop ")" parse-effect ] }
+            { [ dup f = ] [ ")" unexpected-eof ] }
+            [ parse-word dup class? [ bad-effect ] unless ]
+        } cond 2array
+    ] when ;
+PRIVATE>
+
+: parse-effect-token ( first? var end -- var more? )
+    scan {
+        { [ end-token? ] [ drop nip f ] }
+        { [ effect-opener? ] [ bad-effect ] }
+        { [ effect-closer? ] [ stack-effect-omits-dashes ] }
+        { [ row-variable? ] [ parse-effect-var t ] }
+        [ [ drop ] 2dip parse-effect-value , t ]
+    } cond ;
+
+: parse-effect-tokens ( end -- var tokens )
+    [
+        [ t f ] dip [ parse-effect-token [ f ] 2dip ] curry [ ] while nip
+    ] { } make ;
 
 : parse-effect ( end -- effect )
-    parse-effect-tokens { "--" } split1 dup
-    [ <effect> ] [ drop stack-effect-omits-dashes ] if ;
+    [ "--" parse-effect-tokens ] dip parse-effect-tokens
+    <variable-effect> ;
 
 : complete-effect ( -- effect )
     "(" expect ")" parse-effect ;
 
 : parse-call( ( accum word -- accum )
     [ ")" parse-effect ] dip 2array append! ;
+
+: (:) ( -- word def effect )
+    CREATE-WORD
+    complete-effect
+    parse-definition swap ;
index 700448805c0022f505f9c11ee6edc358c464c6f8..805c3a4be42b7b9d6553eeb5d6c6c8b7a5bf1d59 100644 (file)
@@ -212,3 +212,16 @@ M: integer forget-test 3 + ;
 ] unit-test
 
 [ 10 forget-test ] [ no-method? ] must-fail-with
+
+! Declarations on methods
+GENERIC: flushable-generic ( a -- b ) flushable
+M: integer flushable-generic ;
+
+[ t ] [ \ flushable-generic flushable? ] unit-test
+[ t ] [ M\ integer flushable-generic flushable? ] unit-test
+
+GENERIC: non-flushable-generic ( a -- b )
+M: integer non-flushable-generic ; flushable
+
+[ f ] [ \ non-flushable-generic flushable? ] unit-test
+[ t ] [ M\ integer non-flushable-generic flushable? ] unit-test
index 9fd7a5be853e0ba9fc06d05319681327b08d9912..a733ac90fa3133a16ba24d600ebf722f0e49870a 100644 (file)
@@ -1,9 +1,10 @@
-! Copyright (C) 2006, 2009 Slava Pestov.
+! Copyright (C) 2006, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors words kernel sequences namespaces make assocs
 hashtables definitions kernel.private classes classes.private
 classes.algebra quotations arrays vocabs effects combinators
 sets ;
+FROM: namespaces => set ;
 IN: generic
 
 ! Method combination protocol
@@ -104,11 +105,8 @@ GENERIC: update-generic ( class generic -- )
 : method-word-name ( class generic -- string )
     [ name>> ] bi@ "=>" glue ;
 
-M: method flushable?
-    "method-generic" word-prop flushable? ;
-
-M: method stack-effect
-    "method-generic" word-prop stack-effect ;
+M: method parent-word
+    "method-generic" word-prop ;
 
 M: method crossref?
     "forgotten" word-prop not ;
@@ -196,8 +194,5 @@ M: generic subwords
         tri
     ] { } make ;
 
-M: generic forget*
-    [ subwords forget-all ] [ call-next-method ] bi ;
-
 M: class forget-methods
     [ implementors ] [ [ swap method ] curry ] bi map forget-all ;
index 297684014bb9a281297600d034b6092440e4db58..277f40c34fc673a07c8dc4c1e38c6f4c57ffd846 100644 (file)
@@ -74,7 +74,7 @@ PRIVATE>
 
 SYMBOL: generic-word
 
-: make-math-method-table ( classes quot: ( class -- quot ) -- alist )
+: make-math-method-table ( classes quot: ( ... class -- ... quot ) -- alist )
     [ bootstrap-words ] dip
     [ [ drop ] [ call ] 2bi ] curry { } map>assoc ; inline
 
@@ -93,7 +93,7 @@ SYMBOL: generic-word
 : tuple-dispatch ( picker alist -- alist' )
     swap [ [ tuple-dispatch-entry ] curry dip ] curry assoc-map math-alist>quot ;
 
-: math-dispatch-step ( picker quot: ( class -- quot ) -- quot )
+: math-dispatch-step ( picker quot: ( ... class -- ... quot ) -- quot )
     [ [ { bignum float fixnum } ] dip make-math-method-table ]
     [ [ { ratio complex } ] dip make-math-method-table tuple-dispatch ] 2bi
     tuple swap 2array prefix tag-dispatch ; inline
index cee99a828e4bd1cfdba32b278c92dd2b571616b4..6be03042cbc8e9d78de0000b11ba947d752a5e96 100644 (file)
@@ -5,6 +5,7 @@ quotations stack-checker vectors growable hashtables sbufs
 prettyprint byte-vectors bit-vectors specialized-vectors
 definitions generic sets graphs assocs grouping see eval ;
 QUALIFIED-WITH: alien.c-types c
+FROM: namespaces => set ;
 SPECIALIZED-VECTOR: c:double
 IN: generic.single.tests
 
index 3d5f16d7f14bf34e03eb33d5b10c22707a3e180c..8d52c98c71008a545d1499ffc87de1f5a65adb9f 100644 (file)
@@ -35,7 +35,7 @@ M: growable set-length ( n seq -- )
     ] [
         2dup capacity > [ 2dup expand ] when
     ] if
-    (>>length) ;
+    length<< ;
 
 : new-size ( old -- new ) 1 + 3 * ; inline
 
@@ -44,7 +44,7 @@ M: growable set-length ( n seq -- )
     2dup length >= [
         2dup capacity >= [ over new-size over expand ] when
         [ >fixnum ] dip
-        over 1 fixnum+fast over (>>length)
+        over 1 fixnum+fast over length<<
     ] [
         [ >fixnum ] dip
     ] if ; inline
@@ -56,14 +56,14 @@ M: growable clone (clone) [ clone ] change-underlying ; inline
 M: growable lengthen ( n seq -- )
     2dup length > [
         2dup capacity > [ over new-size over expand ] when
-        2dup (>>length)
+        2dup length<<
     ] when 2drop ; inline
 
 M: growable shorten ( n seq -- )
     growable-check
     2dup length < [
         2dup contract
-        2dup (>>length)
+        2dup length<<
     ] when 2drop ; inline
 
 M: growable new-resizable new-sequence 0 over set-length ; inline
diff --git a/core/hash-sets/hash-sets-docs.factor b/core/hash-sets/hash-sets-docs.factor
new file mode 100644 (file)
index 0000000..d59ebec
--- /dev/null
@@ -0,0 +1,18 @@
+USING: help.markup help.syntax sequences ;
+IN: hash-sets
+
+ARTICLE: "hash-sets" "Hash sets"
+"The " { $vocab-link "hash-sets" } " vocabulary implements hashtable-backed sets. Hash sets form a class:"
+{ $subsection hash-set }
+"Constructing new hash sets:"
+{ $subsection <hash-set> }
+"The syntax for hash sets is described in " { $link "syntax-hash-sets" } "." ;
+
+ABOUT: "hash-sets"
+
+HELP: hash-set
+{ $class-description "The class of hashtable-based sets. These implement the " { $link "sets" } "." } ;
+
+HELP: <hash-set>
+{ $values { "members" sequence } { "hash-set" hash-set } }
+{ $description "Creates a new hash set with the given members." } ;
diff --git a/core/hash-sets/hash-sets-tests.factor b/core/hash-sets/hash-sets-tests.factor
new file mode 100644 (file)
index 0000000..ca995a3
--- /dev/null
@@ -0,0 +1,36 @@
+! Copyright (C) 2010 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: sets tools.test kernel sorting prettyprint hash-sets ;
+IN: hash-sets.tests
+
+[ { 1 2 3 } ] [ HS{ 1 2 3 } members natural-sort ] unit-test
+
+[ "HS{ 1 2 3 4 }" ] [ HS{ 1 2 3 4 } unparse ] unit-test
+
+[ t ] [ 1 HS{ 0 1 2 } in? ] unit-test
+[ f ] [ 3 HS{ 0 1 2 } in? ] unit-test
+[ HS{ 1 2 3 } ] [ 3 HS{ 1 2 } clone [ adjoin ] keep ] unit-test
+[ HS{ 1 2 } ] [ 2 HS{ 1 2 } clone [ adjoin ] keep ] unit-test
+[ HS{ 1 2 3 } ] [ 4 HS{ 1 2 3 } clone [ delete ] keep ] unit-test
+[ HS{ 1 2 } ] [ 3 HS{ 1 2 3 } clone [ delete ] keep ] unit-test
+[ HS{ 1 2 } ] [ HS{ 1 2 } fast-set ] unit-test
+[ { 1 2 } ] [ HS{ 1 2 } members natural-sort ] unit-test
+
+[ HS{ 1 2 3 4 } ] [ HS{ 1 2 3 } HS{ 2 3 4 } union ] unit-test
+[ HS{ 2 3 } ] [ HS{ 1 2 3 } HS{ 2 3 4 } intersect ] unit-test
+[ t ] [ HS{ 1 2 3 } HS{ 2 3 4 } intersects? ] unit-test
+[ f ] [ HS{ 1 } HS{ 2 3 4 } intersects? ] unit-test
+[ f ] [ HS{ 1 } HS{ 2 3 4 } subset? ] unit-test
+[ f ] [ HS{ 1 2 3 } HS{ 2 3 4 } subset? ] unit-test
+[ t ] [ HS{ 2 3 } HS{ 2 3 4 } subset? ] unit-test
+[ t ] [ HS{ } HS{ 2 3 4 } subset? ] unit-test
+[ HS{ 1 } ] [ HS{ 1 2 3 } HS{ 2 3 4 } diff ] unit-test
+[ t ] [ HS{ 1 2 3 } HS{ 2 1 3 } set= ] unit-test
+[ t ] [ HS{ 1 2 3 } HS{ 2 1 3 } = ] unit-test
+[ f ] [ HS{ 2 3 } HS{ 2 1 3 } set= ] unit-test
+[ f ] [ HS{ 1 2 3 } HS{ 2 3 } set= ] unit-test
+
+[ HS{ 1 2 } HS{ 1 2 3 } ] [ HS{ 1 2 } clone dup clone [ 3 swap adjoin ] keep ] unit-test
+
+[ t ] [ HS{ } null? ] unit-test
+[ f ] [ HS{ 1 } null? ] unit-test
diff --git a/core/hash-sets/hash-sets.factor b/core/hash-sets/hash-sets.factor
new file mode 100644 (file)
index 0000000..ac198a2
--- /dev/null
@@ -0,0 +1,38 @@
+! Copyright (C) 2010 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors assocs hashtables kernel sets
+sequences parser ;
+QUALIFIED: sets
+IN: hash-sets
+
+! In a better implementation, less memory would be used
+TUPLE: hash-set { table hashtable read-only } ;
+
+: <hash-set> ( members -- hash-set )
+    H{ } clone [ [ dupd set-at ] curry each ] keep hash-set boa ;
+
+INSTANCE: hash-set set
+M: hash-set in? table>> key? ; inline
+M: hash-set adjoin table>> dupd set-at ; inline
+M: hash-set delete table>> delete-at ; inline
+M: hash-set members table>> keys ; inline
+M: hash-set set-like drop dup hash-set? [ members <hash-set> ] unless ;
+M: hash-set clone table>> clone hash-set boa ;
+M: hash-set null? table>> assoc-empty? ;
+
+M: sequence fast-set <hash-set> ;
+M: f fast-set drop H{ } clone hash-set boa ;
+
+M: sequence duplicates
+    f fast-set [ [ in? ] [ adjoin ] 2bi ] curry filter ;
+
+<PRIVATE
+
+: (all-unique?) ( elt hash -- ? )
+    2dup in? [ 2drop f ] [ adjoin t ] if ; inline
+
+PRIVATE>
+
+M: sequence all-unique?
+    dup length <hashtable> hash-set boa
+    [ (all-unique?) ] curry all? ;
index e31ed925d15e55672974c115833368181f52c73f..be5aa97634e02423ffff8382fa9ad96f14d3ebd4 100644 (file)
@@ -131,7 +131,7 @@ M: hashtable set-at ( value key hash -- )
 : push-unsafe ( elt seq -- )
     [ length ] keep
     [ underlying>> set-array-nth ]
-    [ [ 1 fixnum+fast { array-capacity } declare ] dip (>>length) ]
+    [ [ 1 fixnum+fast { array-capacity } declare ] dip length<< ]
     2bi ; inline
 
 PRIVATE>
index 03e8723d2078a865d91ffd9b7fc3af8564d8d3ee..1880859db19d484d6eee6c8e4b006a56f0fd554b 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Daniel Ehrenberg.
+! Copyright (C) 2008, 2010 Daniel Ehrenberg, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: math kernel sequences sbufs vectors namespaces growable
 strings io classes continuations destructors combinators
@@ -12,6 +12,10 @@ GENERIC: decode-char ( stream encoding -- char/f )
 
 GENERIC: encode-char ( char stream encoding -- )
 
+GENERIC: encode-string ( string stream encoding -- )
+
+M: object encode-string [ encode-char ] 2curry each ; inline
+
 GENERIC: <decoder> ( stream encoding -- newstream )
 
 CONSTANT: replacement-char HEX: fffd
@@ -134,13 +138,8 @@ M: encoder stream-element-type
 M: encoder stream-write1
     >encoder< encode-char ;
 
-GENERIC# encoder-write 2 ( string stream encoding -- )
-
-M: string encoder-write
-    [ encode-char ] 2curry each ;
-
 M: encoder stream-write
-    >encoder< encoder-write ;
+    >encoder< encode-string ;
 
 M: encoder dispose stream>> dispose ;
 
index 2911385c0990afd1f832108ba0282e5260d0bfe7..c78a86c072703a3815aa9dea10eeff6ac7813fac 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2006, 2008 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: math math.order kernel sequences sbufs vectors growable io
-continuations namespaces io.encodings combinators strings ;
+USING: accessors byte-arrays math math.order kernel sequences
+sbufs vectors growable io continuations namespaces io.encodings
+combinators strings ;
 IN: io.encodings.utf8
 
 ! Decoding UTF-8
@@ -45,10 +46,10 @@ M: utf8 decode-char
 ! Encoding UTF-8
 
 : encoded ( stream char -- )
-    BIN: 111111 bitand BIN: 10000000 bitor swap stream-write1 ;
+    BIN: 111111 bitand BIN: 10000000 bitor swap stream-write1 ; inline
 
-: char>utf8 ( stream char -- )
-    {
+: char>utf8 ( char stream -- )
+    swap {
         { [ dup -7 shift zero? ] [ swap stream-write1 ] }
         { [ dup -11 shift zero? ] [
             2dup -6 shift BIN: 11000000 bitor swap stream-write1
@@ -65,10 +66,16 @@ M: utf8 decode-char
             2dup -6 shift encoded
             encoded
         ]
-    } cond ;
+    } cond ; inline
 
 M: utf8 encode-char
-    drop swap char>utf8 ;
+    drop char>utf8 ;
+
+M: utf8 encode-string
+    drop
+    over aux>>
+    [ [ char>utf8 ] curry each ]
+    [ [ >byte-array ] dip stream-write ] if ;
 
 PRIVATE>
 
index da5d67065908a075f2fc24ea52530d8959b05866..ff6eed451423125d0cb2dae93f035072edeb4900 100644 (file)
@@ -1,8 +1,12 @@
-USING: arrays debugger.threads destructors io io.directories
-io.encodings.ascii io.encodings.binary io.encodings.string
-io.encodings.8-bit.latin1 io.files io.files.private
-io.files.temp io.files.unique kernel make math sequences system
-threads tools.test generic.single ;
+USING: alien alien.c-types arrays classes.struct
+debugger.threads destructors generic.single io io.directories
+io.encodings.8-bit.latin1 io.encodings.ascii
+io.encodings.binary io.encodings.string io.files
+io.files.private io.files.temp io.files.unique kernel make math
+sequences specialized-arrays system threads tools.test vocabs
+compiler.units ;
+FROM: specialized-arrays.private => specialized-array-vocab ;
+SPECIALIZED-ARRAY: int
 IN: io.files.tests
 
 [ ] [ "append-test" temp-file dup exists? [ delete-file ] [ drop ] if ] unit-test
@@ -65,6 +69,71 @@ IN: io.files.tests
     ] with-file-reader
 ] unit-test
 
+! Writing specialized arrays to binary streams should work
+[ ] [
+    "test.txt" temp-file binary [
+        int-array{ 1 2 3 } write
+    ] with-file-writer
+] unit-test
+
+[ int-array{ 1 2 3 } ] [
+    "test.txt" temp-file binary [
+        3 4 * read
+    ] with-file-reader
+    int-array-cast
+] unit-test
+
+[ ] [
+    BV{ 0 1 2 } "test.txt" temp-file binary set-file-contents
+] unit-test
+
+[ t ] [
+    "test.txt" temp-file binary file-contents
+    B{ 0 1 2 } =
+] unit-test
+
+STRUCT: pt { x uint } { y uint } ;
+SPECIALIZED-ARRAY: pt
+
+CONSTANT: pt-array-1
+    pt-array{ S{ pt f 1 1 } S{ pt f 2 2 } S{ pt f 3 3 } }
+
+[ ] [
+    pt-array-1
+    "test.txt" temp-file binary set-file-contents
+] unit-test
+
+[ t ] [
+    "test.txt" temp-file binary file-contents
+    pt-array-1 >c-ptr sequence=
+] unit-test
+
+! Slices should support >c-ptr and byte-length
+
+[ ] [
+    pt-array-1 rest-slice
+    "test.txt" temp-file binary set-file-contents
+] unit-test
+
+[ t ] [
+    "test.txt" temp-file binary file-contents
+    pt-array-cast
+    pt-array-1 rest-slice sequence=
+] unit-test
+
+[ ] [
+    [
+        pt specialized-array-vocab forget-vocab
+    ] with-compilation-unit
+] unit-test
+
+! Writing strings to binary streams should fail
+[
+    "test.txt" temp-file binary [
+        "OMGFAIL" write
+    ] with-file-writer
+] must-fail
+
 ! Test EOF behavior
 [ 10 ] [
     image binary [
@@ -73,8 +142,7 @@ IN: io.files.tests
     ] with-file-reader
 ] unit-test
 
-USE: debugger.threads
-
+! Make sure that writing to a closed stream from another thread doesn't crash
 [ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
 
 [ ] [ "test-quux.txt" temp-file delete-file ] unit-test
index aa6e087442c263fa6abd97e9fedc74e649cd7173..11848cfa0369fbd1792dae53b661ee9a70c68701 100644 (file)
@@ -1,7 +1,21 @@
 USING: help.markup help.syntax quotations hashtables kernel
-classes strings continuations destructors math byte-arrays ;
+classes strings continuations destructors math byte-arrays
+alien ;
 IN: io
 
+ARTICLE: "stream-types" "Binary and text streams"
+"A word which outputs the stream element type:"
+{ $subsections stream-element-type }
+"Stream element types:"
+{ $subsections +byte+ +character+ }
+"The stream element type is the data type read and written by " { $link stream-read1 } " and " { $link stream-write1 } "."
+$nl
+"Binary streams have an element type of " { $link +byte+ } ". Elements are integers in the range " { $snippet "[0,255]" } ", representing bytes. Reading a sequence of elements produces a " { $link byte-array } ". Any object implementing the " { $link >c-ptr } " and " { $link byte-length } " generic words can be written to a binary stream."
+$nl
+"Character streams have an element tye of " { $link +character+ } ". Elements are non-negative integers, representing Unicode code points. Only instances of the " { $link string } " class can be read or written on a character stream."
+$nl
+"Most external streams are binary streams, and can be wrapped in string streams once a suitable encoding has been provided; see " { $link "io.encodings" } "." ;
+
 HELP: +byte+
 { $description "A stream element type. See " { $link stream-element-type } " for explanation." } ;
 
@@ -10,15 +24,7 @@ HELP: +character+
 
 HELP: stream-element-type
 { $values { "stream" "a stream" } { "type" { $link +byte+ } " or " { $link +character+ } } }
-{ $description
-  "Outputs one of the following two values:"
-  { $list
-    { { $link +byte+ } " - indicates that stream elements are integers in the range " { $snippet "[0,255]" } "; they represent bytes. Reading a sequence of elements produces a " { $link byte-array } "." }
-    { { $link +character+ } " - indicates that stream elements are non-negative integers, representing Unicode code points. Reading a sequence of elements produces a " { $link string } "." }
-  }
-  "Most external streams are binary streams, and can be wrapped in string streams once a suitable encoding has been provided; see " { $link "io.encodings" } "."
-  
-} ;
+{ $contract "Outputs one of " { $link +byte+ } " or " { $link +character+ } "." } ;
 
 HELP: stream-readln
 { $values { "stream" "an input stream" } { "str/f" "a string or " { $link f } } }
@@ -57,8 +63,8 @@ HELP: stream-write1
 $io-error ;
 
 HELP: stream-write
-{ $values { "seq" "a byte array or string" } { "stream" "an output stream" } }
-{ $contract "Writes a sequence of elements to the stream. If the stream does buffering, output may not be performed immediately; use " { $link stream-flush } " to force output." }
+{ $values { "data" "binary data or a string" } { "stream" "an output stream" } }
+{ $contract "Writes a piece of data to the stream. If the stream performs buffering, output may not be performed immediately; use " { $link stream-flush } " to force output." }
 { $notes "Most code only works on one stream at a time and should instead use " { $link write } "; see " { $link "stdio" } "." }
 $io-error ;
 
@@ -262,9 +268,7 @@ $nl
 "Stream protocol words are rarely called directly, since code which only works with one stream at a time should be written to use " { $link "stdio" } " instead, wrapping I/O operations such as " { $link read } " and " { $link write } " in " { $link with-input-stream } " and " { $link with-output-stream } "."
 $nl
 "All streams must implement the " { $link dispose } " word in addition to the stream protocol."
-$nl
-"The following word is required for all input and output streams:"
-{ $subsections stream-element-type }
+{ $subsections "stream-types" }
 "These words are required for binary and string input streams:"
 { $subsections
     stream-read1
index 48d7f413b8723bb86a14b41ae7f2f4e36f86bb55..cb6786fe1ceccebdb7ae531b33f3ed37b2b4cbc2 100644 (file)
@@ -15,7 +15,7 @@ GENERIC: stream-read-partial ( n stream -- seq )
 GENERIC: stream-readln ( stream -- str/f )
 
 GENERIC: stream-write1 ( elt stream -- )
-GENERIC: stream-write ( seq stream -- )
+GENERIC: stream-write ( data stream -- )
 GENERIC: stream-flush ( stream -- )
 GENERIC: stream-nl ( stream -- )
 
@@ -32,9 +32,9 @@ SLOT: i
 
 : (stream-seek) ( n seek-type stream -- )
     swap {
-        { seek-absolute [ (>>i) ] }
+        { seek-absolute [ i<< ] }
         { seek-relative [ [ + ] change-i drop ] }
-        { seek-end [ [ underlying>> length + ] [ (>>i) ] bi ] }
+        { seek-end [ [ underlying>> length + ] [ i<< ] bi ] }
         [ bad-seek-type ]
     } case ;
 
@@ -87,7 +87,7 @@ SYMBOL: error-stream
 
 : bl ( -- ) " " write ;
 
-: each-morsel ( handler: ( data -- ) reader: ( -- data ) -- )
+: each-morsel ( ..a handler: ( ..a data -- ..b ) reader: ( ..b -- ..a data ) -- ..a )
     [ dup ] compose swap while drop ; inline
 
 <PRIVATE
index 96b122549d840ce9a8f926742f4a589a581a26a0..9772de6262b5d998e285943775352c946bc2ff26 100644 (file)
@@ -1,8 +1,12 @@
 USING: tools.test io.streams.byte-array io.encodings.binary
-io.encodings.utf8 io kernel arrays strings namespaces math ;
+io.encodings.utf8 io kernel arrays strings namespaces math
+specialized-arrays alien.c-types ;
+SPECIALIZED-ARRAY: int
+IN: io.streams.byte-array.tests
 
 [ B{ } ] [ B{ } binary [ contents ] with-byte-reader ] unit-test
 [ B{ 1 2 3 } ] [ binary [ B{ 1 2 3 } write ] with-byte-writer ] unit-test
+[ B{ 1 2 3 4 5 6 } ] [ binary [ B{ 1 2 3 } write B{ 4 5 6 } write ] with-byte-writer ] unit-test
 [ B{ 1 2 3 } ] [ { 1 2 3 } binary [ 3 read ] with-byte-reader ] unit-test
 
 [ B{ BIN: 11110101 BIN: 10111111 BIN: 10000000 BIN: 10111111 BIN: 11101111 BIN: 10000000 BIN: 10111111 BIN: 11011111 BIN: 10000000 CHAR: x } ]
@@ -37,3 +41,9 @@ io.encodings.utf8 io kernel arrays strings namespaces math ;
 [ B{ 123 } ] [
     binary [ 123 >bignum write1 ] with-byte-writer
 ] unit-test
+
+! Writing specialized arrays to byte writers
+[ int-array{ 1 2 3 } ] [
+    binary [ int-array{ 1 2 3 } write ] with-byte-writer
+    int-array-cast
+] unit-test
index 7103e49f4ab71208a9f17d2a80984b0d039421b1..246f65de9877bfac9e211096b17a082e6bbfcb38 100644 (file)
@@ -1,5 +1,5 @@
 USING: help.markup help.syntax io io.files threads
-strings byte-arrays io.streams.plain ;
+strings byte-arrays io.streams.plain alien math ;
 IN: io.streams.c
 
 ARTICLE: "io.streams.c" "ANSI C streams"
@@ -42,9 +42,9 @@ HELP: fopen
 { $errors "Throws an error if the file could not be opened." }
 { $notes "User code should call " { $link <file-reader> } " or " { $link <file-writer> } " to get a high level stream." } ;
 
-HELP: fwrite ( string alien -- )
-{ $values { "string" "a string" } { "alien" "a C FILE* handle" } }
-{ $description "Writes a string of text to a C FILE* handle." }
+HELP: fwrite
+{ $values { "data" c-ptr } { "length" integer } { "alien" "a C FILE* handle" } }
+{ $description "Writes some bytes to a C FILE* handle." }
 { $errors "Throws an error if the output operation failed." } ;
 
 HELP: fflush ( alien -- )
@@ -62,7 +62,7 @@ HELP: fgetc ( alien -- ch/f )
 { $errors "Throws an error if the input operation failed." } ;
 
 HELP: fread ( n alien -- str/f )
-{ $values { "n" "a positive integer" } { "alien" "a C FILE* handle" } { "str/f" "a string or " { $link f } } }
+{ $values { "n" "a positive integer" } { "alien" "a C FILE* handle" } { "str/f" { $maybe string } } }
 { $description "Reads a sequence of characters from a C FILE* handle, and outputs " { $link f } " on end of file." }
 { $errors "Throws an error if the input operation failed." } ;
 
index 657c6ccd75ad2404452e5b7ace4d12461abecf79..63a56b4af116f880e1caf3dcd3c1fd605754f2cf 100644 (file)
@@ -1,5 +1,7 @@
 USING: tools.test io.files io.files.temp io io.streams.c
-io.encodings.ascii strings destructors kernel ;
+io.encodings.ascii strings destructors kernel specialized-arrays
+alien.c-types math ;
+SPECIALIZED-ARRAY: int
 IN: io.streams.c.tests
 
 [ "hello world" ] [
@@ -17,3 +19,24 @@ IN: io.streams.c.tests
     3 over stream-read drop
     [ stream-tell ] [ dispose ] bi
 ] unit-test
+
+! Writing specialized arrays to binary streams
+[ ] [
+    "test.txt" temp-file "wb" fopen <c-writer> [
+        int-array{ 1 2 3 } write
+    ] with-output-stream
+] unit-test
+
+[ int-array{ 1 2 3 } ] [
+    "test.txt" temp-file "rb" fopen <c-reader> [
+        3 4 * read
+    ] with-input-stream
+    int-array-cast
+] unit-test
+
+! Writing strings to binary streams should fail
+[
+    "test.txt" temp-file "wb" fopen <c-writer> [
+        "OMGFAIL" write
+    ] with-output-stream
+] must-fail
index d26f03aa5ee80e9279cf5a6e8334585572dd95ae..9ebf7f701836ea99c4140f31306ad4db8c4d7ed1 100644 (file)
@@ -1,9 +1,9 @@
-! Copyright (C) 2004, 2009 Slava Pestov.
+! Copyright (C) 2004, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel kernel.private namespaces make io io.encodings sequences
-math generic threads.private classes io.backend io.files
-io.encodings.utf8 alien.strings continuations destructors byte-arrays
-accessors combinators ;
+USING: alien alien.strings kernel kernel.private namespaces make
+io io.encodings sequences math generic threads.private classes
+io.backend io.files io.encodings.utf8 continuations destructors
+byte-arrays accessors combinators ;
 IN: io.streams.c
 
 TUPLE: c-stream < disposable handle ;
@@ -16,12 +16,14 @@ M: c-stream dispose* handle>> fclose ;
 M: c-stream stream-tell handle>> ftell ;
 
 M: c-stream stream-seek
-    handle>> swap {
-        { seek-absolute [ 0 ] }
-        { seek-relative [ 1 ] }
-        { seek-end [ 2 ] }
-        [ bad-seek-type ]
-    } case fseek ;
+    [
+        {
+            { seek-absolute [ 0 ] }
+            { seek-relative [ 1 ] }
+            { seek-end [ 2 ] }
+            [ bad-seek-type ]
+        } case
+    ] [ handle>> ] bi* fseek ;
 
 TUPLE: c-writer < c-stream ;
 
@@ -31,7 +33,9 @@ M: c-writer stream-element-type drop +byte+ ;
 
 M: c-writer stream-write1 dup check-disposed handle>> fputc ;
 
-M: c-writer stream-write dup check-disposed handle>> fwrite ;
+M: c-writer stream-write
+    dup check-disposed
+    [ [ >c-ptr ] [ byte-length ] bi ] [ handle>> ] bi* fwrite ;
 
 M: c-writer stream-flush dup check-disposed handle>> fflush ;
 
@@ -93,6 +97,6 @@ M: c-io-backend (file-appender)
     #! print stuff from contexts where the I/O system would
     #! otherwise not work (tools.deploy.shaker, the I/O
     #! multiplexer thread).
-    "\n" append >byte-array
+    "\n" append >byte-array dup length
     stdout-handle fwrite
     stdout-handle fflush ;
index 8b9650fc31f9457b747e2a278dadf6db0e0f6700..8d63dfdf54aaca7de480b144b64e9a6973d5c009 100644 (file)
@@ -26,28 +26,28 @@ HELP: -rot  ( x y z -- z x y ) $complex-shuffle ;
 HELP: dupd  ( x y -- x x y )   $complex-shuffle ;
 HELP: swapd ( x y z -- y x z ) $complex-shuffle ;
 
-HELP: datastack ( -- ds )
-{ $values { "ds" array } }
+HELP: datastack ( -- array )
+{ $values { "array" array } }
 { $description "Outputs an array containing a copy of the data stack contents right before the call to this word, with the top of the stack at the end of the array." } ;
 
-HELP: set-datastack ( ds -- )
-{ $values { "ds" array } }
+HELP: set-datastack ( array -- )
+{ $values { "array" array } }
 { $description "Replaces the data stack contents with a copy of an array. The end of the array becomes the top of the stack." } ;
 
-HELP: retainstack ( -- rs )
-{ $values { "rs" array } }
+HELP: retainstack ( -- array )
+{ $values { "array" array } }
 { $description "Outputs an array containing a copy of the retain stack contents right before the call to this word, with the top of the stack at the end of the array." } ;
 
-HELP: set-retainstack ( rs -- )
-{ $values { "rs" array } }
+HELP: set-retainstack ( array -- )
+{ $values { "array" array } }
 { $description "Replaces the retain stack contents with a copy of an array. The end of the array becomes the top of the stack." } ;
 
-HELP: callstack ( -- cs )
-{ $values { "cs" callstack } }
+HELP: callstack ( -- callstack )
+{ $values { "callstack" callstack } }
 { $description "Outputs a copy of the call stack contents, with the top of the stack at the end of the vector. The stack frame of the caller word is " { $emphasis "not" } " included." } ;
 
-HELP: set-callstack ( cs -- * )
-{ $values { "cs" callstack } }
+HELP: set-callstack ( callstack -- * )
+{ $values { "callstack" callstack } }
 { $description "Replaces the call stack contents. Control flow is transferred immediately to the innermost frame of the new call stack." } ;
 
 HELP: clear
@@ -169,7 +169,7 @@ HELP: xor
 { $notes "This word implements boolean exclusive or, so applying it to integers will not yield useful results (all integers have a true value). Bitwise exclusive or is the " { $link bitxor } " word." } ;
 
 HELP: both?
-{ $values { "x" object } { "y" object } { "quot" { $quotation "( obj -- ? )" } } { "?" "a boolean" } }
+{ $values { "x" object } { "y" object } { "quot" { $quotation "( ... obj -- ... ? )" } } { "?" "a boolean" } }
 { $description "Tests if the quotation yields a true value when applied to both " { $snippet "x" } " and " { $snippet "y" } "." }
 { $examples
     { $example "USING: kernel math prettyprint ;" "3 5 [ odd? ] both? ." "t" }
@@ -177,7 +177,7 @@ HELP: both?
 } ;
 
 HELP: either?
-{ $values { "x" object } { "y" object } { "quot" { $quotation "( obj -- ? )" } } { "?" "a boolean" } }
+{ $values { "x" object } { "y" object } { "quot" { $quotation "( ... obj -- ... ? )" } } { "?" "a boolean" } }
 { $description "Tests if the quotation yields a true value when applied to either " { $snippet "x" } " or " { $snippet "y" } "." }
 { $examples
     { $example "USING: kernel math prettyprint ;" "3 6 [ odd? ] either? ." "t" }
@@ -208,28 +208,23 @@ HELP: call
 
 { call POSTPONE: call( } related-words
 
-HELP: call-clear ( quot -- * )
-{ $values { "quot" callable } }
-{ $description "Calls a quotation with an empty call stack. If the quotation returns, Factor will exit.." }
-{ $notes "Used to implement " { $link "threads" } "." } ;
-
 HELP: keep
-{ $values { "x" object } { "quot" { $quotation "( x -- ... )" } } }
+{ $values { "x" object } { "quot" { $quotation "( ..a x -- ..b )" } } }
 { $description "Call a quotation with a value on the stack, restoring the value when the quotation returns." }
 { $examples
     { $example "USING: arrays kernel prettyprint ;" "2 \"greetings\" [ <array> ] keep 2array ." "{ { \"greetings\" \"greetings\" } \"greetings\" }" }
 } ;
 
 HELP: 2keep
-{ $values { "x" object } { "y" object } { "quot" { $quotation "( x y -- ... )" } } }
+{ $values { "x" object } { "y" object } { "quot" { $quotation "( ..a x y -- ..b )" } } }
 { $description "Call a quotation with two values on the stack, restoring the values when the quotation returns." } ;
 
 HELP: 3keep
-{ $values { "x" object } { "y" object } { "z" object } { "quot" { $quotation "( x y z -- ... )" } } }
+{ $values { "x" object } { "y" object } { "z" object } { "quot" { $quotation "( ..a x y z -- ..b )" } } }
 { $description "Call a quotation with three values on the stack, restoring the values when the quotation returns." } ;
 
 HELP: bi
-{ $values { "x" object } { "p" { $quotation "( x -- ... )" } } { "q" { $quotation "( x -- ... )" } } }
+{ $values { "x" object } { "p" { $quotation "( ..a x -- ..b )" } } { "q" { $quotation "( ..c x -- ..d )" } } }
 { $description "Applies " { $snippet "p" } " to " { $snippet "x" } ", then applies " { $snippet "q" } " to " { $snippet "x" } "." }
 { $examples
     "If " { $snippet "[ p ]" } " and " { $snippet "[ q ]" } " have stack effect " { $snippet "( x -- )" } ", then the following two lines are equivalent:"
@@ -580,28 +575,84 @@ HELP: if
 { $values { "?" "a generalized boolean" } { "true" quotation } { "false" quotation } }
 { $description "If " { $snippet "cond" } " is " { $link f } ", calls the " { $snippet "false" } " quotation. Otherwise calls the " { $snippet "true" } " quotation."
 $nl
-"The " { $snippet "cond" } " value is removed from the stack before either quotation is called." } ;
+"The " { $snippet "cond" } " value is removed from the stack before either quotation is called." }
+{ $examples
+    { $example
+        "USING: io kernel math ;"
+        "10 3 < [ \"Math is broken\" print ] [ \"Math is good\" print ] if"
+        "Math is good"
+    }
+} ;
 
 HELP: when
 { $values { "?" "a generalized boolean" } { "true" quotation } }
 { $description "If " { $snippet "cond" } " is not " { $link f } ", calls the " { $snippet "true" } " quotation."
 $nl
-"The " { $snippet "cond" } " value is removed from the stack before the quotation is called." } ;
+"The " { $snippet "cond" } " value is removed from the stack before the quotation is called." }
+{ $examples
+    { $example
+        "USING: kernel math prettyprint ;"
+        "-5 dup 0 < [ 3 + ] when ."
+        "-2"
+    }
+} ;
 
 HELP: unless
 { $values { "?" "a generalized boolean" } { "false" quotation } }
 { $description "If " { $snippet "cond" } " is " { $link f } ", calls the " { $snippet "false" } " quotation."
 $nl
-"The " { $snippet "cond" } " value is removed from the stack before the quotation is called." } ;
+"The " { $snippet "cond" } " value is removed from the stack before the quotation is called." }
+{ $examples
+    { $example
+        "USING: kernel math prettyprint sequences ;"
+        "IN: scratchpad"
+        ""
+        "CONSTANT: american-cities {"
+        "    \"San Francisco\""
+        "    \"Los Angeles\""
+        "    \"New York\""
+        "}"
+        ""
+        ": add-tax ( price city -- price' )"
+        "    american-cities member? [ 1.1 * ] unless ;"
+        ""
+        "123 \"Ottawa\" add-tax ."
+        "135.3"
+    }
+} ;
 
 HELP: if*
-{ $values { "?" "a generalized boolean" } { "true" { $quotation "( cond -- ... )" } } { "false" quotation } }
+{ $values { "?" "a generalized boolean" } { "true" { $quotation "( ..a ? -- ..b )" } } { "false" { $quotation "( ..a -- ..b )" } } }
 { $description "Alternative conditional form that preserves the " { $snippet "cond" } " value if it is true."
 $nl
 "If the condition is true, it is retained on the stack before the " { $snippet "true" } " quotation is called. Otherwise, the condition is removed from the stack and the " { $snippet "false" } " quotation is called."
 $nl
 "The following two lines are equivalent:"
-{ $code "X [ Y ] [ Z ] if*" "X dup [ Y ] [ drop Z ] if" } } ;
+{ $code "X [ Y ] [ Z ] if*" "X dup [ Y ] [ drop Z ] if" } }
+{ $examples
+    "Notice how in this example, the same value is tested by the conditional, and then used in the true branch; the false branch does not need to drop the value because of how " { $link if* } " works:"
+    { $example
+        "USING: assocs io kernel math.parser ;"
+        "IN: scratchpad"
+        ""
+        ": curry-price ( meat -- price )
+    {
+        { \"Beef\" 10 }
+        { \"Chicken\" 12 }
+        { \"Lamb\" 13 }
+    } at ;
+
+: order-curry ( meat -- )
+    curry-price [
+        \"Your order will be \" write
+        number>string write
+        \" dollars.\" write
+    ] [ \"Invalid order.\" print ] if* ;"
+        ""
+        "\"Deer\" order-curry"
+        "Invalid order."
+    }
+} ;
 
 HELP: when*
 { $values { "?" "a generalized boolean" } { "true" { $quotation "( cond -- ... )" } } }
@@ -618,7 +669,7 @@ HELP: unless*
 { $code "X [ Y ] unless*" "X dup [ ] [ drop Y ] if" } } ;
 
 HELP: ?if
-{ $values { "default" object } { "cond" "a generalized boolean" } { "true" { $quotation "( cond -- ... )" } } { "false" { $quotation "( default -- ... )" } } }
+{ $values { "default" object } { "cond" "a generalized boolean" } { "true" { $quotation "( ..a cond -- ..b )" } } { "false" { $quotation "( ..a default -- ..b )" } } }
 { $description "If the condition is " { $link f } ", the " { $snippet "false" } " quotation is called with the " { $snippet "default" } " value on the stack. Otherwise, the " { $snippet "true" } " quotation is called with the condition on the stack." }
 { $notes
 "The following two lines are equivalent:"
@@ -741,14 +792,14 @@ HELP: prepose
 
 HELP: dip
 { $values { "x" object } { "quot" quotation } }
-{ $description "Calls " { $snippet "quot" } " with " { $snippet "obj" } " hidden on the retain stack." }
+{ $description "Removes " { $snippet "x" } " from the datastack, calls " { $snippet "quot" } ", and restores " { $snippet "x" } " to the top of the datastack when " { $snippet "quot" } " is finished." }
 { $examples
     { $example "USING: arrays kernel math prettyprint ;" "10 20 30 [ / ] dip 2array ." "{ 1/2 30 }" }
 } ;
 
 HELP: 2dip
 { $values { "x" object } { "y" object } { "quot" quotation } }
-{ $description "Calls " { $snippet "quot" } " with " { $snippet "x" } " and " { $snippet "y" } " hidden on the retain stack." }
+{ $description "Removes " { $snippet "x" } " and " { $snippet "y" } " from the datastack, calls " { $snippet "quot" } ", and restores the removed objects to the top of the datastack when " { $snippet "quot" } " is finished." }
 { $notes "The following are equivalent:"
     { $code "[ [ foo bar ] dip ] dip" }
     { $code "[ foo bar ] 2dip" }
@@ -756,7 +807,7 @@ HELP: 2dip
 
 HELP: 3dip
 { $values { "x" object } { "y" object } { "z" object } { "quot" quotation } }
-{ $description "Calls " { $snippet "quot" } " with " { $snippet "x" } ", " { $snippet "y" } " and " { $snippet "z" } " hidden on the retain stack." }
+{ $description "Removes " { $snippet "x" } ", " { $snippet "y" } ", and " { $snippet "z" } " from the datastack, calls " { $snippet "quot" } ", and restores the removed objects to the top of the datastack when " { $snippet "quot" } " is finished." }
 { $notes "The following are equivalent:"
     { $code "[ [ [ foo bar ] dip ] dip ] dip" }
     { $code "[ foo bar ] 3dip" }
@@ -764,22 +815,22 @@ HELP: 3dip
 
 HELP: 4dip
 { $values { "w" object } { "x" object } { "y" object } { "z" object } { "quot" quotation } }
-{ $description "Calls " { $snippet "quot" } " with " { $snippet "w" } ", " { $snippet "x" } ", " { $snippet "y" } " and " { $snippet "z" } " hidden on the retain stack." }
+{ $description "Removes " { $snippet "w" } ", " { $snippet "x" } ", " { $snippet "y" } ", and " { $snippet "z" } " from the datastack, calls " { $snippet "quot" } ", and restores the removed objects to the top of the datastack when " { $snippet "quot" } " is finished." }
 { $notes "The following are equivalent:"
     { $code "[ [ [ [ foo bar ] dip ] dip ] dip ] dip" }
     { $code "[ foo bar ] 4dip" }
 } ;
 
 HELP: while
-{ $values { "pred" { $quotation "( -- ? )" } } { "body" "a quotation" } }
+{ $values { "pred" { $quotation "( ..a -- ..b ? )" } } { "body" { $quotation "( ..b -- ..a )" } } }
 { $description "Calls " { $snippet "body" } " until " { $snippet "pred" } " returns " { $link f } "." } ;
 
 HELP: until
-{ $values { "pred" { $quotation "( -- ? )" } } { "body" "a quotation" } }
+{ $values { "pred" { $quotation "( ..a -- ..b ? )" } } { "body" { $quotation "( ..b -- ..a )" } } }
 { $description "Calls " { $snippet "body" } " until " { $snippet "pred" } " returns " { $link t } "." } ;
 
 HELP: do
-{ $values { "pred" { $quotation "( -- ? )" } } { "body" "a quotation" } }
+{ $values { "pred" { $quotation "( ..a -- ..b ? )" } } { "body" { $quotation "( ..b -- ..a )" } } }
 { $description "Executes one iteration of a " { $link while } " or " { $link until } " loop." } ;
 
 HELP: loop
index ca8aa8286b20e464e9c549b25ccce3ff90fd7028..7d5f7b538b875ca3c4f29d6ad27021ad997deb4a 100644 (file)
@@ -1,7 +1,8 @@
 USING: arrays byte-arrays kernel kernel.private math memory
 namespaces sequences tools.test math.private quotations
 continuations prettyprint io.streams.string debugger assocs
-sequences.private accessors locals.backend grouping words ;
+sequences.private accessors locals.backend grouping words
+system ;
 IN: kernel.tests
 
 [ 0 ] [ f size ] unit-test
@@ -46,6 +47,15 @@ IN: kernel.tests
 
 [ ] [ :c ] unit-test
 
+: overflow-c ( -- ) overflow-c overflow-c ;
+
+! The VM cannot recover from callstack overflow on Windows or
+! OpenBSD, because no facility exists to run memory protection
+! fault handlers on an alternate callstack.
+os [ windows? ] [ openbsd? ] bi or [
+    [ overflow-c ] [ { "kernel-error" 15 f f } = ] must-fail-with
+] unless
+
 [ -7 <byte-array> ] must-fail
 
 [ 3 ] [ t 3 and ] unit-test
index 69d082ed2f954f32fa9076059a520093af440c30..e506b7fc27b9f9fed26ce0fc18e3e24f987dcebc 100644 (file)
@@ -29,7 +29,7 @@ DEFER: if
     #! two literal quotations.
     rot [ drop ] [ nip ] if ; inline
 
-: if ( ? true false -- ) ? call ;
+: if ( ..a ? true: ( ..a -- ..b ) false: ( ..a -- ..b ) -- ..b ) ? call ;
 
 ! Single branch
 : unless ( ? false -- )
@@ -39,7 +39,7 @@ DEFER: if
     swap [ call ] [ drop ] if ; inline
 
 ! Anaphoric
-: if* ( ? true false -- )
+: if* ( ..a ? true: ( ..a ? -- ..b ) false: ( ..a -- ..b ) -- ..b )
     pick [ drop call ] [ 2nip call ] if ; inline
 
 : when* ( ? true -- )
@@ -49,7 +49,7 @@ DEFER: if
     over [ drop ] [ nip call ] if ; inline
 
 ! Default
-: ?if ( default cond true false -- )
+: ?if ( ..a default cond true: ( ..a cond -- ..b ) false: ( ..a default -- ..b ) -- ..b )
     pick [ drop [ drop ] 2dip call ] [ 2nip call ] if ; inline
 
 ! Dippers.
@@ -171,16 +171,16 @@ UNION: boolean POSTPONE: t POSTPONE: f ;
 : most ( x y quot -- z ) 2keep ? ; inline
 
 ! Loops
-: loop ( pred: ( -- ? ) -- )
+: loop ( ... pred: ( ... -- ... ? ) -- ... )
     [ call ] keep [ loop ] curry when ; inline recursive
 
 : do ( pred body -- pred body )
     dup 2dip ; inline
 
-: while ( pred: ( -- ? ) body: ( -- ) -- )
+: while ( ..a pred: ( ..a -- ..b ? ) body: ( ..b -- ..a ) -- ..b )
     swap do compose [ loop ] curry when ; inline
 
-: until ( pred: ( -- ? ) body: ( -- ) -- )
+: until ( ..a pred: ( ..a -- ..b ? ) body: ( ..b -- ..a ) -- ..b )
     [ [ not ] compose ] dip while ; inline
 
 ! Object protocol
@@ -226,7 +226,7 @@ M: callstack clone (clone) ; inline
 ! Tuple construction
 GENERIC: new ( class -- tuple )
 
-GENERIC: boa ( ... class -- tuple )
+GENERIC: boa ( slots... class -- tuple )
 
 ! Error handling -- defined early so that other files can
 ! throw errors before continuations are loaded
index 30888b76d831283168f131a60e840cc3a415c03b..3dc534cdfd8cd53697743830a9cb55977bcab09c 100644 (file)
@@ -66,10 +66,20 @@ HELP: still-parsing?
 { $values { "lexer" lexer } { "?" "a boolean" } }
 { $description "Outputs " { $link f } " if end of input has been reached, " { $link t } " otherwise." } ;
 
+HELP: each-token
+{ $values { "end" string } { "quot" { $quotation "( ... token -- ... )" } } }
+{ $description "Reads a sequence of tokens until the first occurrence of " { $snippet "end" } ". " { $snippet "quot" } " is called on each token as it is read." }
+{ $examples "This word is used to implement " { $link POSTPONE: USING: } "." }
+$parsing-note ;
+
+HELP: map-tokens
+{ $values { "end" string } { "quot" { $quotation "( ... token -- ... elt )" } } { "seq" "a new sequence of " { $snippet "object" } "s" } }
+{ $description "Reads a sequence of tokens until the first occurrence of " { $snippet "end" } ". " { $snippet "quot" } " is called on each token as it is read, and the results are collected into a new output sequence." }
+$parsing-note ;
+
 HELP: parse-tokens
 { $values { "end" string } { "seq" "a new sequence of strings" } }
-{ $description "Reads a sequence of tokens until the first occurrence of " { $snippet "end" } ". The tokens remain as strings and are not processed in any way." }
-{ $examples "This word is used to implement " { $link POSTPONE: USING: } "." }
+{ $description "Reads a sequence of tokens until the first occurrence of " { $snippet "end" } ". The tokens remain as strings and are not processed in any way. This word is equivalent to " { $link map-tokens } " with an empty quotation." }
 $parsing-note ;
 
 HELP: unexpected
index b3bd3cacdb7f49fe13762d53a6245b4880a35c9d..d5eecde1a2da219a5078fdf446ebf690de5b226e 100644 (file)
@@ -5,7 +5,9 @@ io vectors arrays math.parser combinators continuations
 source-files.errors ;
 IN: lexer
 
-TUPLE: lexer text line line-text line-length column ;
+TUPLE: lexer text line line-text line-length column parsing-words ;
+
+TUPLE: lexer-parsing-word word line line-text column ;
 
 : next-line ( lexer -- )
     dup [ line>> ] [ text>> ] bi ?nth >>line-text
@@ -14,10 +16,23 @@ TUPLE: lexer text line line-text line-length column ;
     0 >>column
     drop ;
 
+: push-parsing-word ( word -- )
+    lexer-parsing-word new
+        swap >>word
+        lexer get [
+            [ line>>      >>line      ]
+            [ line-text>> >>line-text ]
+            [ column>>    >>column    ] tri
+        ] [ parsing-words>> push ] bi ;
+
+: pop-parsing-word ( -- )
+    lexer get parsing-words>> pop drop ;
+
 : new-lexer ( text class -- lexer )
     new
         0 >>line
         swap >>text
+        V{ } clone >>parsing-words
     dup next-line ; inline
 
 : <lexer> ( text -- lexer )
@@ -34,7 +49,7 @@ ERROR: unexpected want got ;
 
 : change-lexer-column ( lexer quot -- )
     [ [ column>> ] [ line-text>> ] bi ] prepose keep
-    (>>column) ; inline
+    column<< ; inline
 
 GENERIC: skip-blank ( lexer -- )
 
@@ -71,8 +86,7 @@ M: lexer skip-word ( lexer -- )
 
 : scan ( -- str/f ) lexer get parse-token ;
 
-PREDICATE: unexpected-eof < unexpected
-    got>> not ;
+PREDICATE: unexpected-eof < unexpected got>> not ;
 
 : unexpected-eof ( word -- * ) f unexpected ;
 
@@ -82,37 +96,60 @@ PREDICATE: unexpected-eof < unexpected
     [ unexpected-eof ]
     if* ;
 
-: (parse-tokens) ( accum end -- accum )
-    scan 2dup = [
-        2drop
-    ] [
-        [ pick push (parse-tokens) ] [ unexpected-eof ] if*
-    ] if ;
+: each-token ( ... end quot: ( ... token -- ... ) -- ... )
+    [ scan ] 2dip {
+        { [ 2over = ] [ 3drop ] }
+        { [ pick not ] [ drop unexpected-eof ] }
+        [ [ nip call ] [ each-token ] 2bi ]
+    } cond ; inline recursive
+
+: map-tokens ( ... end quot: ( ... token -- ... elt ) -- ... seq )
+    collector [ each-token ] dip { } like ; inline
 
 : parse-tokens ( end -- seq )
-    100 <vector> swap (parse-tokens) >array ;
+    [ ] map-tokens ;
 
-TUPLE: lexer-error line column line-text error ;
+TUPLE: lexer-error line column line-text parsing-words error ;
 
 M: lexer-error error-file error>> error-file ;
+
 M: lexer-error error-line [ error>> error-line ] [ line>> ] bi or ;
 
 : <lexer-error> ( msg -- error )
     \ lexer-error new
-        lexer get
-        [ line>> >>line ]
-        [ column>> >>column ]
-        [ line-text>> >>line-text ]
-        tri
+        lexer get [
+            [ line>> >>line ]
+            [ column>> >>column ] bi
+        ] [ 
+            [ line-text>> >>line-text ]
+            [ parsing-words>> clone >>parsing-words ] bi
+        ] bi
         swap >>error ;
 
-: lexer-dump ( error -- )
+: simple-lexer-dump ( error -- )
     [ line>> number>string ": " append ]
     [ line-text>> dup string? [ drop "" ] unless ]
     [ column>> 0 or ] tri
     pick length + CHAR: \s <string>
     [ write ] [ print ] [ write "^" print ] tri* ;
 
+: (parsing-word-lexer-dump) ( error parsing-word -- )
+    [
+        line>> number>string
+        over line>> number>string length
+        CHAR: \s pad-head
+        ": " append write
+    ] [ line-text>> dup string? [ drop "" ] unless print ] bi
+    simple-lexer-dump ;
+
+: parsing-word-lexer-dump ( error parsing-word -- )
+    2dup [ line>> ] bi@ =
+    [ drop simple-lexer-dump ]
+    [ (parsing-word-lexer-dump) ] if ;
+
+: lexer-dump ( error -- )
+    dup parsing-words>> [ simple-lexer-dump ] [ last parsing-word-lexer-dump ] if-empty ;
+
 : with-lexer ( lexer quot -- newquot )
     [ lexer set ] dip [ <lexer-error> rethrow ] recover ; inline
 
index 6357c8bd98a97968cc4fc44c0ae45f34837055fd..1de443b0c547319b1851638fb1204b05722a497f 100644 (file)
@@ -385,14 +385,14 @@ HELP: prev-float
 HELP: real-part
 { $values { "z" number } { "x" real } }
 { $description "Outputs the real part of a complex number. This acts as the identity on real numbers." }
-{ $examples { $example "USING: math prettyprint ; C{ 1 2 } real-part ." "1" } } ;
+{ $examples { $example "USING: math prettyprint ;" "C{ 1 2 } real-part ." "1" } } ;
 
 HELP: imaginary-part
 { $values { "z" number } { "y" real } }
 { $description "Outputs the imaginary part of a complex number. This outputs zero for real numbers." }
 { $examples
-    { $example "USING: math prettyprint ; C{ 1 2 } imaginary-part ." "2" }
-    { $example "USING: math prettyprint ; 3 imaginary-part ." "0" }
+    { $example "USING: math prettyprint ;" "C{ 1 2 } imaginary-part ." "2" }
+    { $example "USING: math prettyprint ;" "3 imaginary-part ." "0" }
 } ;
 
 HELP: real
@@ -410,22 +410,22 @@ HELP: power-of-2?
 { $description "Tests if " { $snippet "n" } " is a power of 2." } ;
 
 HELP: each-integer
-{ $values { "n" integer } { "quot" { $quotation "( i -- )" } } }
+{ $values { "n" integer } { "quot" { $quotation "( ... i -- ... )" } } }
 { $description "Applies the quotation to each integer from 0 up to " { $snippet "n" } ", excluding " { $snippet "n" } "." }
 { $notes "This word is used to implement " { $link each } "." } ;
 
 HELP: all-integers?
-{ $values { "n" integer } { "quot" { $quotation "( i -- ? )" } } { "?" "a boolean" } }
+{ $values { "n" integer } { "quot" { $quotation "( ... i -- ... ? )" } } { "?" "a boolean" } }
 { $description "Applies the quotation to each integer from 0 up to " { $snippet "n" } ", excluding " { $snippet "n" } ". Iteration stops when the quotation outputs " { $link f } " or the end is reached. If the quotation yields a false value for some integer, this word outputs " { $link f } ". Otherwise, this word outputs " { $link t } "." }
 { $notes "This word is used to implement " { $link all? } "." } ;
 
 HELP: find-integer
-{ $values { "n" integer } { "quot" { $quotation "( i -- ? )" } } { "i" "an integer or " { $link f } } }
+{ $values { "n" integer } { "quot" { $quotation "( ... i -- ... ? )" } } { "i" "an integer or " { $link f } } }
 { $description "Applies the quotation to each integer from 0 up to " { $snippet "n" } ", excluding " { $snippet "n" } ". Iterationi stops when the quotation outputs a true value or the end is reached. If the quotation yields a true value for some integer, this word outputs that integer. Otherwise, this word outputs " { $link f } "." }
 { $notes "This word is used to implement " { $link find } "." } ;
 
 HELP: find-last-integer
-{ $values { "n" integer } { "quot" { $quotation "( i -- ? )" } } { "i" "an integer or " { $link f } } }
+{ $values { "n" integer } { "quot" { $quotation "( ... i -- ... ? )" } } { "i" "an integer or " { $link f } } }
 { $description "Applies the quotation to each integer from " { $snippet "n" } " down to 0, inclusive. Iteration stops when the quotation outputs a true value or 0 is reached. If the quotation yields a true value for some integer, the word outputs that integer. Otherwise, the word outputs " { $link f } "." }
 { $notes "This word is used to implement " { $link find-last } "." } ;
 
index c1a8ba32f7c86ada75c686ceea9330f8ae933bfc..bc7658feba439629e44aa846561f907db80bd75e 100644 (file)
@@ -77,7 +77,7 @@ ERROR: log2-expects-positive x ;
 : even? ( n -- ? ) 1 bitand zero? ;
 : odd? ( n -- ? ) 1 bitand 1 number= ;
 
-: if-zero ( n quot1 quot2 -- )
+: if-zero ( ..a n quot1: ( ..a -- ..b ) quot2: ( ..a n -- ..b ) -- ..b )
     [ dup zero? ] [ [ drop ] prepose ] [ ] tri* if ; inline
 
 : when-zero ( n quot -- ) [ ] if-zero ; inline
@@ -141,37 +141,37 @@ GENERIC: prev-float ( m -- n )
 
 PRIVATE>
 
-: (each-integer) ( i n quot: ( i -- ) -- )
+: (each-integer) ( ... i n quot: ( ... i -- ... ) -- ... )
     [ iterate-step iterate-next (each-integer) ]
     [ 3drop ] if-iterate? ; inline recursive
 
-: (find-integer) ( i n quot: ( i -- ? ) -- i )
+: (find-integer) ( ... i n quot: ( ... i -- ... ? ) -- ... i )
     [
         iterate-step
         [ [ ] ] 2dip
         [ iterate-next (find-integer) ] 2curry bi-curry if
     ] [ 3drop f ] if-iterate? ; inline recursive
 
-: (all-integers?) ( i n quot: ( i -- ? ) -- ? )
+: (all-integers?) ( ... i n quot: ( ... i -- ... ? ) -- ... ? )
     [
         iterate-step
         [ iterate-next (all-integers?) ] 3curry
         [ f ] if
     ] [ 3drop t ] if-iterate? ; inline recursive
 
-: each-integer ( n quot -- )
+: each-integer ( ... n quot: ( ... i -- ... ) -- ... )
     iterate-prep (each-integer) ; inline
 
-: times ( n quot -- )
+: times ( ... n quot: ( ... -- ... ) -- ... )
     [ drop ] prepose each-integer ; inline
 
-: find-integer ( n quot -- i )
+: find-integer ( ... n quot: ( ... i -- ... ? ) -- ... i )
     iterate-prep (find-integer) ; inline
 
-: all-integers? ( n quot -- ? )
+: all-integers? ( ... n quot: ( ... i -- ... ? ) -- ... ? )
     iterate-prep (all-integers?) ; inline
 
-: find-last-integer ( n quot: ( i -- ? ) -- i )
+: find-last-integer ( ... n quot: ( ... i -- ... ? ) -- ... i )
     over 0 < [
         2drop f
     ] [
index 418107fcd158f9bf23c1054d0fa48fdb152ab817..4c5bc381cc14f9c6932cf4cb395451428cc9cd4e 100644 (file)
@@ -58,7 +58,7 @@ HELP: clamp
 { $description "Outputs " { $snippet "x" } " if contained in the interval " { $snippet "[min,max]" } " or else outputs one of the endpoints." } ;
 
 HELP: between?
-{ $values { "x" object } { "y" object } { "z" real } { "?" "a boolean" } }
+{ $values { "x" object } { "y" object } { "z" object } { "?" "a boolean" } }
 { $description "Tests if " { $snippet "x" } " is in the interval " { $snippet "[y,z]" } "." }
 { $notes "As per the closed interval notation, the end-points are included in the interval." } ;
 
index 5bb024db9dd3c85cae95744c940f64e9232c88de..14fd6a298392451ad9749fe63dc998fa67eed173 100644 (file)
@@ -1,6 +1,7 @@
 ! (c)2009 Joe Groff bsd license
-USING: accessors combinators kernel kernel.private math
-namespaces sequences sequences.private splitting strings make ;
+USING: accessors byte-arrays combinators kernel kernel.private
+math namespaces sequences sequences.private splitting strings
+make ;
 IN: math.parser
 
 : digit> ( ch -- n )
@@ -356,15 +357,15 @@ M: ratio >base
         mantissa-expt [ float>hex-value ] [ float>hex-expt ] bi*
     ] bi 3append ;
 
-: float>decimal ( n -- str )
-    (float>string)
-    [ 0 = ] trim-tail >string
+: format-float ( n format -- string )
+    0 suffix >byte-array (format-float)
+    dup [ 0 = ] find drop head >string
     fix-float ;
 
 : float>base ( n base -- str )
     {
         { 16 [ float>hex ] }
-        [ drop float>decimal ]
+        [ drop "%.16g" format-float ]
     } case ; inline
 
 PRIVATE>
index 40b1db8a3f39a83fcfb1955cd85ce3aaf3ab23e8..a100c2d15fca015dafde904c4f8f7b9adb508fe6 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2003, 2008 Slava Pestov.
+! Copyright (C) 2003, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel vectors sequences hashtables
 arrays kernel.private math strings assocs ;
@@ -6,7 +6,7 @@ IN: namespaces
 
 <PRIVATE
 
-: namestack* ( -- namestack ) 0 special-object { vector } declare ; inline
+: namestack* ( -- namestack ) 0 context-object { vector } declare ; inline
 : >n ( namespace -- ) namestack* push ;
 : ndrop ( -- ) namestack* pop* ;
 
@@ -14,7 +14,7 @@ PRIVATE>
 
 : namespace ( -- namespace ) namestack* last ; inline
 : namestack ( -- namestack ) namestack* clone ;
-: set-namestack ( namestack -- ) >vector 0 set-special-object ;
+: set-namestack ( namestack -- ) >vector 0 set-context-object ;
 : global ( -- g ) 21 special-object { hashtable } declare ; inline
 : init-namespaces ( -- ) global 1array set-namestack ;
 : get ( variable -- value ) namestack* assoc-stack ; inline
index b024d1d9680df19c0fc36d562f252169eda9a467..c04a0f568ee0fa1091a6c0b8153cc0bce031281c 100644 (file)
@@ -52,8 +52,12 @@ ARTICLE: "parsing-tokens" "Parsing raw tokens"
 $nl
 "One example is the " { $link POSTPONE: USING: } " parsing word."
 { $see POSTPONE: USING: } 
-"It reads a list of vocabularies terminated by " { $link POSTPONE: ; } ". However, the vocabulary names do not name words, except by coincidence; so " { $link parse-until } " cannot be used here. Instead, a lower-level word is called:"
-{ $subsections parse-tokens } ;
+"It reads a list of vocabularies terminated by " { $link POSTPONE: ; } ". However, the vocabulary names do not name words, except by coincidence; so " { $link parse-until } " cannot be used here. Instead, a set of lower-level combinators can be used:"
+{ $subsections
+    each-token
+    map-tokens
+    parse-tokens
+} ;
 
 ARTICLE: "parsing-words" "Parsing words"
 "The Factor parser follows a simple recursive-descent design. The parser reads successive tokens from the input; if the token identifies a number or an ordinary word, it is added to an accumulator vector. Otherwise if the token identifies a parsing word, the parsing word is executed immediately."
@@ -164,7 +168,7 @@ HELP: parse-until
 { $examples "This word is used to implement " { $link POSTPONE: ARTICLE: } "." }
 $parsing-note ;
 
-{ parse-tokens (parse-until) parse-until } related-words
+{ parse-tokens each-token map-tokens (parse-until) parse-until } related-words
 
 HELP: (parse-lines)
 { $values { "lexer" lexer } { "quot" "a new " { $link quotation } } }
index 266a65b957b7cae55b02c158116dd4f72a2415cf..ac2310d3f989489ade42c99ac2abe1dfc9c78e96 100644 (file)
@@ -7,332 +7,334 @@ vocabs.parser words.symbol multiline source-files.errors
 tools.crossref grouping ;
 IN: parser.tests
 
+[ 1 [ 2 [ 3 ] 4 ] 5 ]
+[ "1\n[\n2\n[\n3\n]\n4\n]\n5" eval( -- a b c ) ]
+unit-test
+
+[ t t f f ]
+[ "t t f f" eval( -- ? ? ? ? ) ]
+unit-test
+
+[ "hello world" ]
+[ "\"hello world\"" eval( -- string ) ]
+unit-test
+
+[ "\n\r\t\\" ]
+[ "\"\\n\\r\\t\\\\\"" eval( -- string ) ]
+unit-test
+
+[ "hello world" ]
 [
-    [ 1 [ 2 [ 3 ] 4 ] 5 ]
-    [ "1\n[\n2\n[\n3\n]\n4\n]\n5" eval( -- a b c ) ]
-    unit-test
+    "IN: parser.tests : hello ( -- str ) \"hello world\" ;"
+    eval( -- ) "USE: parser.tests hello" eval( -- string )
+] unit-test
 
-    [ t t f f ]
-    [ "t t f f" eval( -- ? ? ? ? ) ]
-    unit-test
+[ ]
+[ "! This is a comment, people." eval( -- ) ]
+unit-test
 
-    [ "hello world" ]
-    [ "\"hello world\"" eval( -- string ) ]
-    unit-test
+! Test escapes
 
-    [ "\n\r\t\\" ]
-    [ "\"\\n\\r\\t\\\\\"" eval( -- string ) ]
-    unit-test
+[ " " ]
+[ "\"\\u000020\"" eval( -- string ) ]
+unit-test
 
-    [ "hello world" ]
-    [
-        "IN: parser.tests : hello ( -- str ) \"hello world\" ;"
-        eval( -- ) "USE: parser.tests hello" eval( -- string )
-    ] unit-test
+[ "'" ]
+[ "\"\\u000027\"" eval( -- string ) ]
+unit-test
 
-    [ ]
-    [ "! This is a comment, people." eval( -- ) ]
-    unit-test
+! Test EOL comments in multiline strings.
+[ "Hello" ] [ "#! This calls until-eol.\n\"Hello\"" eval( -- string ) ] unit-test
 
-    ! Test escapes
+[ word ] [ \ f class ] unit-test
 
-    [ " " ]
-    [ "\"\\u000020\"" eval( -- string ) ]
-    unit-test
+! Test stack effect parsing
 
-    [ "'" ]
-    [ "\"\\u000027\"" eval( -- string ) ]
-    unit-test
+: effect-parsing-test ( a b -- c ) + ;
 
-    ! Test EOL comments in multiline strings.
-    [ "Hello" ] [ "#! This calls until-eol.\n\"Hello\"" eval( -- string ) ] unit-test
+[ t ] [
+    "effect-parsing-test" "parser.tests" lookup
+    \ effect-parsing-test eq?
+] unit-test
 
-    [ word ] [ \ f class ] unit-test
+[ T{ effect f { "a" "b" } { "c" } f } ]
+[ \ effect-parsing-test "declared-effect" word-prop ] unit-test
 
-    ! Test stack effect parsing
+: baz ( a b -- * ) 2array throw ;
 
-    : effect-parsing-test ( a b -- c ) + ;
+[ t ]
+[ \ baz "declared-effect" word-prop terminated?>> ]
+unit-test
 
-    [ t ] [
-        "effect-parsing-test" "parser.tests" lookup
-        \ effect-parsing-test eq?
-    ] unit-test
+[ ] [ "IN: parser.tests USE: math : effect-parsing-test ( a b -- d ) - ;" eval( -- ) ] unit-test
 
-    [ T{ effect f { "a" "b" } { "c" } f } ]
-    [ \ effect-parsing-test "declared-effect" word-prop ] unit-test
+[ t ] [
+    "effect-parsing-test" "parser.tests" lookup
+    \ effect-parsing-test eq?
+] unit-test
 
-    : baz ( a b -- * ) 2array throw ;
+[ T{ effect f { "a" "b" } { "d" } f } ]
+[ \ effect-parsing-test "declared-effect" word-prop ] unit-test
 
-    [ t ]
-    [ \ baz "declared-effect" word-prop terminated?>> ]
-    unit-test
+[ "IN: parser.tests : missing-- ( a b ) ;" eval( -- ) ] must-fail
 
-    [ ] [ "IN: parser.tests USE: math : effect-parsing-test ( a b -- d ) - ;" eval( -- ) ] unit-test
+! Funny bug
+[ 2 ] [ "IN: parser.tests : \0. ( -- x ) 2 ; \0." eval( -- n ) ] unit-test
 
-    [ t ] [
-        "effect-parsing-test" "parser.tests" lookup
-        \ effect-parsing-test eq?
-    ] unit-test
+! These should throw errors
+[ "HEX: zzz" eval( -- obj ) ] must-fail
+[ "OCT: 999" eval( -- obj ) ] must-fail
+[ "BIN: --0" eval( -- obj ) ] must-fail
 
-    [ T{ effect f { "a" "b" } { "d" } f } ]
-    [ \ effect-parsing-test "declared-effect" word-prop ] unit-test
+DEFER: foo
 
-    ! Funny bug
-    [ 2 ] [ "IN: parser.tests : \0. ( -- x ) 2 ; \0." eval( -- n ) ] unit-test
+"IN: parser.tests USING: math prettyprint ; SYNTAX: foo 2 2 + . ;" eval( -- )
 
-    [ "IN: parser.tests : missing-- ( a b ) ;" eval( -- ) ] must-fail
+[ ] [ "USE: parser.tests foo" eval( -- ) ] unit-test
 
-    ! These should throw errors
-    [ "HEX: zzz" eval( -- obj ) ] must-fail
-    [ "OCT: 999" eval( -- obj ) ] must-fail
-    [ "BIN: --0" eval( -- obj ) ] must-fail
+"IN: parser.tests USING: math prettyprint ; : foo ( -- ) 2 2 + . ;" eval( -- )
 
-    DEFER: foo
+[ t ] [
+    "USE: parser.tests \\ foo" eval( -- word )
+    "foo" "parser.tests" lookup eq?
+] unit-test
 
-    "IN: parser.tests USING: math prettyprint ; SYNTAX: foo 2 2 + . ;" eval( -- )
+! parse-tokens should do the right thing on EOF
+[ "USING: kernel" eval( -- ) ]
+[ error>> T{ unexpected { want ";" } } = ] must-fail-with
 
-    [ ] [ "USE: parser.tests foo" eval( -- ) ] unit-test
+! Test smudging
 
-    "IN: parser.tests USING: math prettyprint ; : foo ( -- ) 2 2 + . ;" eval( -- )
+[ 1 ] [
+    "IN: parser.tests : smudge-me ( -- ) ;" <string-reader> "foo"
+    parse-stream drop
 
-    [ t ] [
-        "USE: parser.tests \\ foo" eval( -- word )
-        "foo" "parser.tests" lookup eq?
-    ] unit-test
+    "foo" source-file definitions>> first assoc-size
+] unit-test
 
-    ! Test smudging
+[ t ] [ "smudge-me" "parser.tests" lookup >boolean ] unit-test
 
-    [ 1 ] [
-        "IN: parser.tests : smudge-me ( -- ) ;" <string-reader> "foo"
-        parse-stream drop
+[ ] [
+    "IN: parser.tests : smudge-me-more ( -- ) ;" <string-reader> "foo"
+    parse-stream drop
+] unit-test
 
-        "foo" source-file definitions>> first assoc-size
-    ] unit-test
+[ t ] [ "smudge-me-more" "parser.tests" lookup >boolean ] unit-test
+[ f ] [ "smudge-me" "parser.tests" lookup >boolean ] unit-test
 
-    [ t ] [ "smudge-me" "parser.tests" lookup >boolean ] unit-test
+[ 3 ] [
+    "IN: parser.tests USING: math strings ; GENERIC: smudge-me ( a -- b ) M: integer smudge-me ; M: string smudge-me ;" <string-reader> "foo"
+    parse-stream drop
 
-    [ ] [
-        "IN: parser.tests : smudge-me-more ( -- ) ;" <string-reader> "foo"
-        parse-stream drop
-    ] unit-test
+    "foo" source-file definitions>> first assoc-size
+] unit-test
 
-    [ t ] [ "smudge-me-more" "parser.tests" lookup >boolean ] unit-test
-    [ f ] [ "smudge-me" "parser.tests" lookup >boolean ] unit-test
+[ 1 ] [
+    "IN: parser.tests USING: arrays ; M: array smudge-me ;" <string-reader> "bar"
+    parse-stream drop
 
-    [ 3 ] [
-        "IN: parser.tests USING: math strings ; GENERIC: smudge-me ( a -- b ) M: integer smudge-me ; M: string smudge-me ;" <string-reader> "foo"
-        parse-stream drop
+    "bar" source-file definitions>> first assoc-size
+] unit-test
 
-        "foo" source-file definitions>> first assoc-size
-    ] unit-test
+[ 2 ] [
+    "IN: parser.tests USING: math strings ; GENERIC: smudge-me ( a -- b ) M: integer smudge-me ;" <string-reader> "foo"
+    parse-stream drop
 
-    [ 1 ] [
-        "IN: parser.tests USING: arrays ; M: array smudge-me ;" <string-reader> "bar"
-        parse-stream drop
+    "foo" source-file definitions>> first assoc-size
+] unit-test
 
-        "bar" source-file definitions>> first assoc-size
-    ] unit-test
+[ t ] [
+    array "smudge-me" "parser.tests" lookup order member-eq?
+] unit-test
 
-    [ 2 ] [
-        "IN: parser.tests USING: math strings ; GENERIC: smudge-me ( a -- b ) M: integer smudge-me ;" <string-reader> "foo"
-        parse-stream drop
+[ t ] [
+    integer "smudge-me" "parser.tests" lookup order member-eq?
+] unit-test
 
-        "foo" source-file definitions>> first assoc-size
-    ] unit-test
-    
-    [ t ] [
-        array "smudge-me" "parser.tests" lookup order member-eq?
-    ] unit-test
-    
-    [ t ] [
-        integer "smudge-me" "parser.tests" lookup order member-eq?
-    ] unit-test
-    
-    [ f ] [
-        string "smudge-me" "parser.tests" lookup order member-eq?
-    ] unit-test
+[ f ] [
+    string "smudge-me" "parser.tests" lookup order member-eq?
+] unit-test
 
-    [ ] [
-        "IN: parser.tests USE: math 2 2 +" <string-reader> "a"
-        parse-stream drop
-    ] unit-test
-    
-    [ t ] [
-        "a" <pathname> \ + usage member?
-    ] unit-test
+[ ] [
+    "IN: parser.tests USE: math 2 2 +" <string-reader> "a"
+    parse-stream drop
+] unit-test
 
-    [ ] [
-        "IN: parser.tests USE: math 2 2 -" <string-reader> "a"
-        parse-stream drop
-    ] unit-test
-    
-    [ f ] [
-        "a" <pathname> \ + usage member?
-    ] unit-test
-    
-    [ ] [
-        "a" source-files get delete-at
-        2 [
-            "IN: parser.tests DEFER: x : y ( -- ) x ; : x ( -- ) y ;"
-            <string-reader> "a" parse-stream drop
-        ] times
-    ] unit-test
-    
-    "a" source-files get delete-at
+[ t ] [
+    "a" <pathname> \ + usage member?
+] unit-test
 
-    [
-        "IN: parser.tests : x ( -- ) ; : y ( -- * ) 3 throw ; this is an error"
-        <string-reader> "a" parse-stream
-    ] [ source-file-error? ] must-fail-with
+[ ] [
+    "IN: parser.tests USE: math 2 2 -" <string-reader> "a"
+    parse-stream drop
+] unit-test
 
-    [ t ] [
-        "y" "parser.tests" lookup >boolean
-    ] unit-test
+[ f ] [
+    "a" <pathname> \ + usage member?
+] unit-test
 
-    [ f ] [
-        "IN: parser.tests : x ( -- ) ;"
+[ ] [
+    "a" source-files get delete-at
+    2 [
+        "IN: parser.tests DEFER: x : y ( -- ) x ; : x ( -- ) y ;"
         <string-reader> "a" parse-stream drop
-        
-        "y" "parser.tests" lookup
-    ] unit-test
+    ] times
+] unit-test
 
-    ! Test new forward definition logic
-    [ ] [
-        "IN: axx : axx ( -- ) ;"
-        <string-reader> "axx" parse-stream drop
-    ] unit-test
+"a" source-files get delete-at
 
-    [ ] [
-        "USE: axx IN: bxx : bxx ( -- ) ; : cxx ( -- ) axx bxx ;"
-        <string-reader> "bxx" parse-stream drop
-    ] unit-test
-
-    ! So we move the bxx word to axx...
-    [ ] [
-        "IN: axx : axx ( -- ) ; : bxx ( -- ) ;"
-        <string-reader> "axx" parse-stream drop
-    ] unit-test
+[
+    "IN: parser.tests : x ( -- ) ; : y ( -- * ) 3 throw ; this is an error"
+    <string-reader> "a" parse-stream
+] [ source-file-error? ] must-fail-with
 
-    [ t ] [ "bxx" "axx" lookup >boolean ] unit-test
+[ t ] [
+    "y" "parser.tests" lookup >boolean
+] unit-test
 
-    ! And reload the file that uses it...
-    [ ] [
-        "USE: axx IN: bxx ( -- ) : cxx ( -- ) axx bxx ;"
-        <string-reader> "bxx" parse-stream drop
-    ] unit-test
+[ f ] [
+    "IN: parser.tests : x ( -- ) ;"
+    <string-reader> "a" parse-stream drop
     
-    ! And hope not to get a forward-error!
+    "y" "parser.tests" lookup
+] unit-test
 
-    ! Turning a generic into a non-generic could cause all
-    ! kinds of funnyness
-    [ ] [
-        "IN: ayy USE: kernel GENERIC: ayy ( a -- b ) M: object ayy ;"
-        <string-reader> "ayy" parse-stream drop
-    ] unit-test
+! Test new forward definition logic
+[ ] [
+    "IN: axx : axx ( -- ) ;"
+    <string-reader> "axx" parse-stream drop
+] unit-test
 
-    [ ] [
-        "IN: ayy USE: kernel : ayy ( -- ) ;"
-        <string-reader> "ayy" parse-stream drop
-    ] unit-test
+[ ] [
+    "USE: axx IN: bxx : bxx ( -- ) ; : cxx ( -- ) axx bxx ;"
+    <string-reader> "bxx" parse-stream drop
+] unit-test
 
-    [ ] [
-        "IN: azz TUPLE: my-class ; GENERIC: a-generic ( a -- b )"
-        <string-reader> "azz" parse-stream drop
-    ] unit-test
+! So we move the bxx word to axx...
+[ ] [
+    "IN: axx : axx ( -- ) ; : bxx ( -- ) ;"
+    <string-reader> "axx" parse-stream drop
+] unit-test
 
-    [ ] [
-        "USE: azz M: my-class a-generic ;"
-        <string-reader> "azz-2" parse-stream drop
-    ] unit-test
+[ t ] [ "bxx" "axx" lookup >boolean ] unit-test
 
-    [ ] [
-        "IN: azz GENERIC: a-generic ( a -- b )"
-        <string-reader> "azz" parse-stream drop
-    ] unit-test
+! And reload the file that uses it...
+[ ] [
+    "USE: axx IN: bxx ( -- ) : cxx ( -- ) axx bxx ;"
+    <string-reader> "bxx" parse-stream drop
+] unit-test
 
-    [ ] [
-        "USE: azz USE: math M: integer a-generic ;"
-        <string-reader> "azz-2" parse-stream drop
-    ] unit-test
+! And hope not to get a forward-error!
 
-    [ ] [
-        "IN: parser.tests : <bogus-error> ( -- ) ; : bogus ( -- error ) <bogus-error> ;"
-        <string-reader> "bogus-error" parse-stream drop
-    ] unit-test
+! Turning a generic into a non-generic could cause all
+! kinds of funnyness
+[ ] [
+    "IN: ayy USE: kernel GENERIC: ayy ( a -- b ) M: object ayy ;"
+    <string-reader> "ayy" parse-stream drop
+] unit-test
 
-    [ ] [
-        "IN: parser.tests TUPLE: bogus-error ; C: <bogus-error> bogus-error : bogus ( -- error ) <bogus-error> ;"
-        <string-reader> "bogus-error" parse-stream drop
-    ] unit-test
+[ ] [
+    "IN: ayy USE: kernel : ayy ( -- ) ;"
+    <string-reader> "ayy" parse-stream drop
+] unit-test
 
-    ! Problems with class predicates -vs- ordinary words
-    [ ] [
-        "IN: parser.tests TUPLE: killer ;"
-        <string-reader> "removing-the-predicate" parse-stream drop
-    ] unit-test
+[ ] [
+    "IN: azz TUPLE: my-class ; GENERIC: a-generic ( a -- b )"
+    <string-reader> "azz" parse-stream drop
+] unit-test
 
-    [ ] [
-        "IN: parser.tests GENERIC: killer? ( a -- b )"
-        <string-reader> "removing-the-predicate" parse-stream drop
-    ] unit-test
-    
-    [ t ] [
-        "killer?" "parser.tests" lookup >boolean
-    ] unit-test
+[ ] [
+    "USE: azz M: my-class a-generic ;"
+    <string-reader> "azz-2" parse-stream drop
+] unit-test
 
-    [
-        "IN: parser.tests TUPLE: another-pred-test ; GENERIC: another-pred-test? ( a -- b )"
-        <string-reader> "removing-the-predicate" parse-stream
-    ] [ error>> error>> error>> redefine-error? ] must-fail-with
+[ ] [
+    "IN: azz GENERIC: a-generic ( a -- b )"
+    <string-reader> "azz" parse-stream drop
+] unit-test
 
-    [
-        "IN: parser.tests TUPLE: class-redef-test ; TUPLE: class-redef-test ;"
-        <string-reader> "redefining-a-class-1" parse-stream
-    ] [ error>> error>> error>> redefine-error? ] must-fail-with
+[ ] [
+    "USE: azz USE: math M: integer a-generic ;"
+    <string-reader> "azz-2" parse-stream drop
+] unit-test
 
-    [ ] [
-        "IN: parser.tests TUPLE: class-redef-test ; SYMBOL: class-redef-test"
-        <string-reader> "redefining-a-class-2" parse-stream drop
-    ] unit-test
+[ ] [
+    "IN: parser.tests : <bogus-error> ( -- ) ; : bogus ( -- error ) <bogus-error> ;"
+    <string-reader> "bogus-error" parse-stream drop
+] unit-test
 
-    [
-        "IN: parser.tests TUPLE: class-redef-test ; SYMBOL: class-redef-test : class-redef-test ( -- ) ;"
-        <string-reader> "redefining-a-class-3" parse-stream drop
-    ] [ error>> error>> error>> redefine-error? ] must-fail-with
+[ ] [
+    "IN: parser.tests TUPLE: bogus-error ; C: <bogus-error> bogus-error : bogus ( -- error ) <bogus-error> ;"
+    <string-reader> "bogus-error" parse-stream drop
+] unit-test
 
-    [ ] [
-        "IN: parser.tests TUPLE: class-fwd-test ;"
-        <string-reader> "redefining-a-class-3" parse-stream drop
-    ] unit-test
+! Problems with class predicates -vs- ordinary words
+[ ] [
+    "IN: parser.tests TUPLE: killer ;"
+    <string-reader> "removing-the-predicate" parse-stream drop
+] unit-test
 
-    [
-        "IN: parser.tests \\ class-fwd-test"
-        <string-reader> "redefining-a-class-3" parse-stream drop
-    ] [ error>> error>> error>> no-word-error? ] must-fail-with
+[ ] [
+    "IN: parser.tests GENERIC: killer? ( a -- b )"
+    <string-reader> "removing-the-predicate" parse-stream drop
+] unit-test
 
-    [ ] [
-        "IN: parser.tests TUPLE: class-fwd-test ; SYMBOL: class-fwd-test"
-        <string-reader> "redefining-a-class-3" parse-stream drop
-    ] unit-test
+[ t ] [
+    "killer?" "parser.tests" lookup >boolean
+] unit-test
 
-    [
-        "IN: parser.tests \\ class-fwd-test"
-        <string-reader> "redefining-a-class-3" parse-stream drop
-    ] [ error>> error>> error>> no-word-error? ] must-fail-with
+[
+    "IN: parser.tests TUPLE: another-pred-test ; GENERIC: another-pred-test? ( a -- b )"
+    <string-reader> "removing-the-predicate" parse-stream
+] [ error>> error>> error>> redefine-error? ] must-fail-with
 
-    [
-        "IN: parser.tests : foo ( -- ) ; TUPLE: foo ;"
-        <string-reader> "redefining-a-class-4" parse-stream drop
-    ] [ error>> error>> error>> redefine-error? ] must-fail-with
+[
+    "IN: parser.tests TUPLE: class-redef-test ; TUPLE: class-redef-test ;"
+    <string-reader> "redefining-a-class-1" parse-stream
+] [ error>> error>> error>> redefine-error? ] must-fail-with
 
-    [ ] [
-        "IN: parser.tests : foo ( x y -- z ) 1 2 ; : bar ( a -- b ) ;" eval( -- )
-    ] unit-test
+[ ] [
+    "IN: parser.tests TUPLE: class-redef-test ; SYMBOL: class-redef-test"
+    <string-reader> "redefining-a-class-2" parse-stream drop
+] unit-test
 
-    [
-        "IN: parser.tests : foo ( x y -- z) 1 2 ; : bar ( a -- b ) ;" eval( -- )
-    ] must-fail
-] with-file-vocabs
+[
+    "IN: parser.tests TUPLE: class-redef-test ; SYMBOL: class-redef-test : class-redef-test ( -- ) ;"
+    <string-reader> "redefining-a-class-3" parse-stream drop
+] [ error>> error>> error>> redefine-error? ] must-fail-with
+
+[ ] [
+    "IN: parser.tests TUPLE: class-fwd-test ;"
+    <string-reader> "redefining-a-class-3" parse-stream drop
+] unit-test
+
+[
+    "IN: parser.tests \\ class-fwd-test"
+    <string-reader> "redefining-a-class-3" parse-stream drop
+] [ error>> error>> error>> no-word-error? ] must-fail-with
+
+[ ] [
+    "IN: parser.tests TUPLE: class-fwd-test ; SYMBOL: class-fwd-test"
+    <string-reader> "redefining-a-class-3" parse-stream drop
+] unit-test
+
+[
+    "IN: parser.tests \\ class-fwd-test"
+    <string-reader> "redefining-a-class-3" parse-stream drop
+] [ error>> error>> error>> no-word-error? ] must-fail-with
+
+[
+    "IN: parser.tests : foo ( -- ) ; TUPLE: foo ;"
+    <string-reader> "redefining-a-class-4" parse-stream drop
+] [ error>> error>> error>> redefine-error? ] must-fail-with
+
+[ ] [
+    "IN: parser.tests : foo ( x y -- z ) 1 2 ; : bar ( a -- b ) ;" eval( -- )
+] unit-test
+
+[
+    "IN: parser.tests : foo ( x y -- z) 1 2 ; : bar ( a -- b ) ;" eval( -- )
+] must-fail
 
 [ ] [
     "IN: parser.tests USE: kernel PREDICATE: foo < object ( x -- y ) ;" eval( -- )
index 544d75b244a756d02293aa9ec22ffce1a94b099a..be43979b31a6181b9f89cf5ab1096cfc89acad47 100644 (file)
@@ -5,7 +5,7 @@ sequences strings vectors words words.symbol quotations io
 combinators sorting splitting math.parser effects continuations
 io.files vocabs io.encodings.utf8 source-files classes
 hashtables compiler.units accessors sets lexer vocabs.parser
-effects.parser slots parser.notes ;
+ slots parser.notes ;
 IN: parser
 
 : location ( -- loc )
@@ -58,9 +58,14 @@ SYMBOL: auto-use?
 
 ERROR: staging-violation word ;
 
+: (execute-parsing) ( accum word -- accum )
+    dup push-parsing-word
+    execute( accum -- accum )
+    pop-parsing-word ; inline
+
 : execute-parsing ( accum word -- accum )
     dup changed-definitions get key? [ staging-violation ] when
-    execute( accum -- accum ) ;
+    (execute-parsing) ;
 
 : scan-object ( -- object )
     scan-word {
@@ -102,11 +107,6 @@ M: f parse-quotation \ ] parse-until >quotation ;
 : parse-definition ( -- quot )
     \ ; parse-until >quotation ;
 
-: (:) ( -- word def effect )
-    CREATE-WORD
-    complete-effect
-    parse-definition swap ;
-
 ERROR: bad-number ;
 
 : scan-base ( base -- n )
@@ -207,3 +207,5 @@ print-use-hook [ [ ] ] initialize
 
 : ?run-file ( path -- )
     dup exists? [ run-file ] [ drop ] if ;
+
+ERROR: version-control-merge-conflict ;
index dc26933af41150fe739f7ffe16ada414bd9ae4a9..55938f5888ab10c20032c977a42dafab20071d1b 100644 (file)
@@ -253,15 +253,15 @@ HELP: set-array-nth
 { $warning "This word is in the " { $vocab-link "sequences.private" } " vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory. User code must use " { $link set-nth } " instead." } ;
 
 HELP: collect
-{ $values { "n" "a non-negative integer" } { "quot" { $quotation "( n -- value )" } } { "into" "a sequence of length at least " { $snippet "n" } } }
+{ $values { "n" "a non-negative integer" } { "quot" { $quotation "( ... n -- ... value )" } } { "into" "a sequence of length at least " { $snippet "n" } } }
 { $description "A primitive mapping operation that applies a quotation to all integers from 0 up to but not including " { $snippet "n" } ", and collects the results in a new array. User code should use " { $link map } " instead." } ;
 
 HELP: each
-{ $values { "seq" sequence } { "quot" { $quotation "( elt -- )" } } }
+{ $values { "seq" sequence } { "quot" { $quotation "( ... x -- ... )" } } }
 { $description "Applies the quotation to each element of the sequence in order." } ;
 
 HELP: reduce
-{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation "( prev elt -- next )" } } { "result" "the final result" } }
+{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation "( ... prev elt -- ... next )" } } { "result" "the final result" } }
 { $description "Combines successive elements of the sequence using a binary operation, and outputs the final result. On the first iteration, the two inputs to the quotation are " { $snippet "identity" } ", and the first element of the sequence. On successive iterations, the first input is the result of the previous iteration, and the second input is the corresponding element of the sequence." }
 { $examples
     { $example "USING: math prettyprint sequences ;" "{ 1 5 3 } 0 [ + ] reduce ." "9" }
@@ -269,7 +269,7 @@ HELP: reduce
 
 HELP: reduce-index
 { $values
-     { "seq" sequence } { "identity" object } { "quot" { $quotation "( prev elt index -- result )" } } }
+     { "seq" sequence } { "identity" object } { "quot" { $quotation "( ... prev elt index -- ... next )" } } { "result" object } }
 { $description "Combines successive elements of the sequence and their indices binary operations, and outputs the final result. On the first iteration, the three inputs to the quotation are " { $snippet "identity" } ", the first element of the sequence, and its index, 0. On successive iterations, the first input is the result of the previous iteration, the second input is the corresponding element of the sequence, and the third is its index." }
 { $examples { $example "USING: sequences prettyprint math ;"
     "{ 10 50 90 } 0 [ + + ] reduce-index ."
@@ -277,7 +277,7 @@ HELP: reduce-index
 } } ;
 
 HELP: accumulate-as
-{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation "( prev elt -- next )" } } { "exemplar" sequence } { "final" "the final result" } { "newseq" "a new sequence" } }
+{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation "( ... prev elt -- ... next )" } } { "exemplar" sequence } { "final" "the final result" } { "newseq" "a new sequence" } }
 { $description "Combines successive elements of the sequence using a binary operation, and outputs a sequence of the same type as " { $snippet "exemplar" } " containing intermediate results, together with the final result."
 $nl
 "The first element of the new sequence is " { $snippet "identity" } ". Then, on the first iteration, the two inputs to the quotation are " { $snippet "identity" } ", and the first element of the old sequence. On successive iterations, the first input is the result of the previous iteration, and the second input is the corresponding element of the old sequence."
@@ -285,8 +285,8 @@ $nl
 "When given the empty sequence, outputs an empty sequence together with the " { $snippet "identity" } "." } ;
 
 HELP: accumulate
-{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation "( prev elt -- next )" } } { "final" "the final result" } { "newseq" "a new array" } }
-{ $description "Combines successive elements of the sequence using a binary operation, and outputs an array of intermediate results, together with the final result."
+{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation "( ... prev elt -- ... next )" } } { "final" "the final result" } { "newseq" "a new array" } }
+{ $description "Combines successive elements of the sequence using a binary operation, and outputs a sequence of intermediate results, together with the final result."
 $nl
 "The first element of the new sequence is " { $snippet "identity" } ". Then, on the first iteration, the two inputs to the quotation are " { $snippet "identity" } ", and the first element of the old sequence. On successive iterations, the first input is the result of the previous iteration, and the second input is the corresponding element of the old sequence."
 $nl
@@ -296,7 +296,7 @@ $nl
 } ;
 
 HELP: accumulate!
-{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation "( prev elt -- next )" } } { "final" "the final result" } }
+{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation "( ... prev elt -- ... next )" } } { "final" "the final result" } }
 { $description "Combines successive elements of the sequence using a binary operation, and outputs the original sequence of intermediate results, together with the final result."
 $nl
 "The first element of the new sequence is " { $snippet "identity" } ". Then, on the first iteration, the two inputs to the quotation are " { $snippet "identity" } ", and the first element of the old sequence. On successive iterations, the first input is the result of the previous iteration, and the second input is the corresponding element of the old sequence."
@@ -307,11 +307,11 @@ $nl
 } ;
 
 HELP: map
-{ $values { "seq" sequence } { "quot" { $quotation "( old -- new )" } } { "newseq" "a new sequence" } }
+{ $values { "seq" sequence } { "quot" { $quotation "( ... elt -- ... newelt )" } } { "newseq" "a new sequence" } }
 { $description "Applies the quotation to each element of the sequence in order. The new elements are collected into a sequence of the same class as the input sequence." } ;
 
 HELP: map-as
-{ $values { "seq" sequence } { "quot" { $quotation "( old -- new )" } } { "exemplar" sequence } { "newseq" "a new sequence" } }
+{ $values { "seq" sequence } { "quot" { $quotation "( ... elt -- ... newelt )" } } { "exemplar" sequence } { "newseq" "a new sequence" } }
 { $description "Applies the quotation to each element of the sequence in order. The new elements are collected into a sequence of the same class as " { $snippet "exemplar" } "." }
 { $examples
     "The following example converts a string into an array of one-element strings:"
@@ -321,7 +321,7 @@ HELP: map-as
 
 HELP: each-index
 { $values
-     { "seq" sequence } { "quot" { $quotation "( elt index -- )" } } }
+     { "seq" sequence } { "quot" { $quotation "( ... elt index -- ... )" } } }
 { $description "Calls the quotation with the element of the sequence and its index on the stack, with the index on the top of the stack." }
 { $examples { $example "USING: arrays sequences prettyprint ;"
 "{ 10 20 30 } [ 2array . ] each-index"
@@ -330,7 +330,7 @@ HELP: each-index
 
 HELP: map-index
 { $values
-  { "seq" sequence } { "quot" { $quotation "( elt index -- result )" } } { "newseq" sequence } }
+  { "seq" sequence } { "quot" { $quotation "( ... elt index -- ... newelt )" } } { "newseq" sequence } }
 { $description "Calls the quotation with the element of the sequence and its index on the stack, with the index on the top of the stack. Collects the outputs of the quotation and outputs them in a sequence of the same type as the input sequence." }
 { $examples { $example "USING: arrays sequences prettyprint ;"
 "{ 10 20 30 } [ 2array ] map-index ."
@@ -338,13 +338,13 @@ HELP: map-index
 } } ;
 
 HELP: change-nth
-{ $values { "i" "a non-negative integer" } { "seq" "a mutable sequence" } { "quot" { $quotation "( elt -- newelt )" } } }
+{ $values { "i" "a non-negative integer" } { "seq" "a mutable sequence" } { "quot" { $quotation "( ... elt -- ... newelt )" } } }
 { $description "Applies the quotation to the " { $snippet "i" } "th element of the sequence, storing the result back into the sequence." }
 { $errors "Throws an error if the sequence is immutable, if the index is out of bounds, or the sequence cannot hold elements of the type output by " { $snippet "quot" } "." }
 { $side-effects "seq" } ;
 
 HELP: map!
-{ $values { "seq" "a mutable sequence" } { "quot" { $quotation "( old -- new )" } } }
+{ $values { "seq" "a mutable sequence" } { "quot" { $quotation "( ... elt -- ... newelt )" } } }
 { $description "Applies the quotation to each element yielding a new element, storing the new elements back in the original sequence. Returns the original sequence." }
 { $errors "Throws an error if the sequence is immutable, or the sequence cannot hold elements of the type output by " { $snippet "quot" } "." }
 { $side-effects "seq" } ;
@@ -358,44 +358,44 @@ HELP: max-length
 { $description "Outputs the maximum of the lengths of the two sequences." } ;
 
 HELP: 2each
-{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( elt1 elt2 -- )" } } }
+{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( ... elt1 elt2 -- ... )" } } }
 { $description "Applies the quotation to pairs of elements from " { $snippet "seq1" } " and " { $snippet "seq2" } "." } ;
 
 HELP: 3each
-{ $values { "seq1" sequence } { "seq2" sequence } { "seq3" sequence } { "quot" { $quotation "( elt1 elt2 elt3 -- )" } } }
+{ $values { "seq1" sequence } { "seq2" sequence } { "seq3" sequence } { "quot" { $quotation "( ... elt1 elt2 elt3 -- ... )" } } }
 { $description "Applies the quotation to triples of elements from " { $snippet "seq1" } ", " { $snippet "seq2" } " and " { $snippet "seq3" } "." } ;
 
 HELP: 2reduce
 { $values { "seq1" sequence }
           { "seq2" sequence }
           { "identity" object }
-          { "quot" { $quotation "( prev elt1 elt2 -- next )" } }
+          { "quot" { $quotation "( ... prev elt1 elt2 -- ... next )" } }
           { "result" "the final result" } }
 { $description "Combines successive pairs of elements from the two sequences using a ternary operation. The first input value at each iteration except the first one is the result of the previous iteration. The first input value at the first iteration is " { $snippet "identity" } "." } ;
 
 HELP: 2map
-{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( elt1 elt2 -- new )" } } { "newseq" "a new sequence" } }
+{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( ... elt1 elt2 -- ... newelt )" } } { "newseq" "a new sequence" } }
 { $description "Applies the quotation to each pair of elements in turn, yielding new elements which are collected into a new sequence having the same class as " { $snippet "seq1" } "." } ;
 
 HELP: 3map
-{ $values { "seq1" sequence } { "seq2" sequence } { "seq3" sequence } { "quot" { $quotation "( elt1 elt2 elt3 -- new )" } } { "newseq" "a new sequence" } }
+{ $values { "seq1" sequence } { "seq2" sequence } { "seq3" sequence } { "quot" { $quotation "( ... elt1 elt2 elt3 -- ... newelt )" } } { "newseq" "a new sequence" } }
 { $description "Applies the quotation to each triple of elements in turn, yielding new elements which are collected into a new sequence having the same class as " { $snippet "seq1" } "." } ;
 
 HELP: 2map-as
-{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( elt1 elt2 -- new )" } } { "exemplar" sequence } { "newseq" "a new sequence" } }
+{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( ... elt1 elt2 -- ... newelt )" } } { "exemplar" sequence } { "newseq" "a new sequence" } }
 { $description "Applies the quotation to each pair of elements in turn, yielding new elements which are collected into a new sequence having the same class as " { $snippet "exemplar" } "." } ;
 
 HELP: 3map-as
-{ $values { "seq1" sequence } { "seq2" sequence } { "seq3" sequence } { "quot" { $quotation "( elt1 elt2 elt3 -- new )" } } { "exemplar" sequence } { "newseq" "a new sequence" } }
+{ $values { "seq1" sequence } { "seq2" sequence } { "seq3" sequence } { "quot" { $quotation "( ... elt1 elt2 elt3 -- ... newelt )" } } { "exemplar" sequence } { "newseq" "a new sequence" } }
 { $description "Applies the quotation to each triple of elements in turn, yielding new elements which are collected into a new sequence having the same class as " { $snippet "exemplar" } "." } ;
 
 HELP: 2all?
-{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( elt1 elt2 -- ? )" } } { "?" "a boolean" } }
+{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( ... elt1 elt2 -- ... ? )" } } { "?" "a boolean" } }
 { $description "Tests the predicate pairwise against elements of " { $snippet "seq1" } " and " { $snippet "seq2" } "." } ;
 
 HELP: find
 { $values { "seq" sequence }
-          { "quot" { $quotation "( elt -- ? )" } }
+          { "quot" { $quotation "( ... elt -- ... ? )" } }
           { "i" "the index of the first match, or " { $link f } }
           { "elt" "the first matching element, or " { $link f } } }
 { $description "A simpler variant of " { $link find-from } " where the starting index is 0." } ;
@@ -403,51 +403,51 @@ HELP: find
 HELP: find-from
 { $values { "n" "a starting index" }
           { "seq" sequence }
-          { "quot" { $quotation "( elt -- ? )" } }
+          { "quot" { $quotation "( ... elt -- ... ? )" } }
           { "i" "the index of the first match, or " { $link f } }
           { "elt" "the first matching element, or " { $link f } } }
 { $description "Applies the quotation to each element of the sequence in turn, until it outputs a true value or the end of the sequence is reached. If the quotation yields a true value for some sequence element, the word outputs the element index and the element itself. Otherwise, the word outputs an index of f and " { $link f } " as the element." } ;
 
 HELP: find-last
-{ $values { "seq" sequence } { "quot" { $quotation "( elt -- ? )" } } { "i" "the index of the first match, or f" } { "elt" "the first matching element, or " { $link f } } }
+{ $values { "seq" sequence } { "quot" { $quotation "( ... elt -- ... ? )" } } { "i" "the index of the first match, or f" } { "elt" "the first matching element, or " { $link f } } }
 { $description "A simpler variant of " { $link find-last-from } " where the starting index is one less than the length of the sequence." } ;
 
 HELP: find-last-from
-{ $values { "n" "a starting index" } { "seq" sequence } { "quot" { $quotation "( elt -- ? )" } } { "i" "the index of the first match, or f" } { "elt" "the first matching element, or " { $link f } } }
+{ $values { "n" "a starting index" } { "seq" sequence } { "quot" { $quotation "( ... elt -- ... ? )" } } { "i" "the index of the first match, or f" } { "elt" "the first matching element, or " { $link f } } }
 { $description "Applies the quotation to each element of the sequence in reverse order, until it outputs a true value or the start of the sequence is reached. If the quotation yields a true value for some sequence element, the word outputs the element index and the element itself. Otherwise, the word outputs an index of f and " { $link f } " as the element." } ;
 
 HELP: map-find
-{ $values { "seq" sequence } { "quot" { $quotation "( elt -- result/f )" } } { "result" "the first non-false result of the quotation" } { "elt" "the first matching element, or " { $link f } } }
+{ $values { "seq" sequence } { "quot" { $quotation "( ... elt -- ... result/f )" } } { "result" "the first non-false result of the quotation" } { "elt" "the first matching element, or " { $link f } } }
 { $description "Applies the quotation to each element of the sequence, until the quotation outputs a true value. If the quotation ever yields a result which is not " { $link f } ", then the value is output, along with the element of the sequence which yielded this." } ;
 
 HELP: any?
-{ $values { "seq" sequence } { "quot" { $quotation "( elt -- ? )" } } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "quot" { $quotation "( ... elt -- ... ? )" } } { "?" "a boolean" } }
 { $description "Tests if the sequence contains an element satisfying the predicate, by applying the predicate to each element in turn until a true value is found. If the sequence is empty or if the end of the sequence is reached, outputs " { $link f } "." } ;
 
 HELP: all?
-{ $values { "seq" sequence } { "quot" { $quotation "( elt -- ? )" } } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "quot" { $quotation "( ... elt -- ... ? )" } } { "?" "a boolean" } }
 { $description "Tests if all elements in the sequence satisfy the predicate by checking each element in turn. Given an empty sequence, vacuously outputs " { $link t } "." } ;
 
 HELP: push-if
-{ $values { "elt" object } { "quot" { $quotation "( elt -- ? )" } } { "accum" "a resizable mutable sequence" } }
+{ $values { "elt" object } { "quot" { $quotation "( ..a elt -- ..b ? )" } } { "accum" "a resizable mutable sequence" } }
 { $description "Adds the element at the end of the sequence if the quotation yields a true value." } 
 { $notes "This word is a factor of " { $link filter } "." } ;
 
 HELP: filter
-{ $values { "seq" sequence } { "quot" { $quotation "( elt -- ? )" } } { "subseq" "a new sequence" } }
+{ $values { "seq" sequence } { "quot" { $quotation "( ... elt -- ... ? )" } } { "subseq" "a new sequence" } }
 { $description "Applies the quotation to each element in turn, and outputs a new sequence containing the elements of the original sequence for which the quotation output a true value." } ;
 
 HELP: filter-as
-{ $values { "seq" sequence } { "quot" { $quotation "( elt -- ? )" } } { "exemplar" sequence } { "subseq" "a new sequence" } }
+{ $values { "seq" sequence } { "quot" { $quotation "( ... elt -- ... ? )" } } { "exemplar" sequence } { "subseq" "a new sequence" } }
 { $description "Applies the quotation to each element in turn, and outputs a new sequence of the same type as " { $snippet "exemplar" } " containing the elements of the original sequence for which the quotation output a true value." } ;
 
 HELP: filter!
-{ $values { "seq" "a resizable mutable sequence" } { "quot" { $quotation "( elt -- ? )" } } }
+{ $values { "seq" "a resizable mutable sequence" } { "quot" { $quotation "( ... elt -- ... ? )" } } }
 { $description "Applies the quotation to each element in turn, and removes elements for which the quotation outputs a false value." }
 { $side-effects "seq" } ;
 
 HELP: interleave
-{ $values { "seq" sequence } { "between" "a quotation" } { "quot" { $quotation "( elt -- )" } } }
+{ $values { "seq" sequence } { "between" "a quotation" } { "quot" { $quotation "( ... elt -- ... )" } } }
 { $description "Applies " { $snippet "quot" } " to each element in turn, also invoking " { $snippet "between" } " in-between each pair of elements." }
 { $example "USING: io sequences ;" "{ \"a\" \"b\" \"c\" } [ \"X\" write ] [ write ] interleave" "aXbXc" } ;
 
@@ -622,7 +622,7 @@ HELP: reverse!
 { $side-effects "seq" } ;
 
 HELP: padding
-{ $values { "seq" sequence } { "n" "a non-negative integer" } { "elt" object } { "quot" { $quotation "( seq1 seq2 -- newseq )" } } { "newseq" "a new sequence" } }
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "elt" object } { "quot" { $quotation "( ... seq1 seq2 -- ... newseq )" } } { "newseq" "a new sequence" } }
 { $description "Outputs a new string sequence of " { $snippet "elt" } " repeated, that when appended to " { $snippet "seq" } ", yields a sequence of length " { $snippet "n" } ". If the length of " { $snippet "seq" } " is greater than " { $snippet "n" } ", this word outputs an empty sequence." } ;
 
 HELP: pad-head
@@ -679,16 +679,11 @@ HELP: collapse-slice
 { $description "Prepares to take the slice of a slice by adjusting the start and end indices accordingly, and replacing the slice with its underlying sequence." }
 ;
 
-HELP: <flat-slice>
-{ $values { "seq" sequence } { "slice" slice } }
-{ $description "Outputs a slice with the same elements as " { $snippet "seq" } ", and " { $snippet "from" } " equal to 0 and " { $snippet "to" } " equal to the length of " { $snippet "seq" } "." }
-{ $notes "Some words create slices then proceed to read the " { $snippet "to" } " and " { $snippet "from" } " slots of the slice. To behave predictably when they are themselves given a slice as input, they apply this word first to get a canonical slice." } ;
-
 HELP: <slice>
 { $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "seq" sequence } { "slice" slice } }
 { $description "Outputs a new virtual sequence sharing storage with the subrange of elements in " { $snippet "seq" } " with indices starting from and including " { $snippet "m" } ", and up to but not including " { $snippet "n" } "." }
 { $errors "Throws an error if " { $snippet "m" } " or " { $snippet "n" } " is out of bounds." }
-{ $notes "Taking the slice of a slice outputs a slice of the underlying sequence of the original slice. Keep this in mind when writing code which depends on the values of " { $snippet "from" } " and " { $snippet "to" } " being equal to the inputs to this word. The " { $link <flat-slice> } " word might be helpful in such situations." } ;
+{ $notes "Taking the slice of a slice outputs a slice of the underlying sequence, instead of a slice of a slice. This means that you cannot assume that the " { $snippet "from" } " and " { $snippet "to" } " slots of the resulting slice will be equal to the values you passed to " { $link <slice> } "." } ;
 
 { <slice> subseq } related-words
 
@@ -961,7 +956,7 @@ HELP: supremum
 { $errors "Throws an error if the sequence is empty." } ;
 
 HELP: produce
-{ $values { "pred" { $quotation "( -- ? )" } } { "quot" { $quotation "( -- obj )" } } { "seq" "a sequence" } }
+{ $values { "pred" { $quotation "( ..a -- ..b ? )" } } { "quot" { $quotation "( ..b -- ..a obj )" } } { "seq" "a sequence" } }
 { $description "Calls " { $snippet "pred" } " repeatedly. If the predicate yields " { $link f } ", stops, otherwise, calls " { $snippet "quot" } " to yield a value. Values are accumulated and returned in a sequence at the end." }
 { $examples
     "The following example divides a number by two until we reach zero, and accumulates intermediate results:"
@@ -971,7 +966,7 @@ HELP: produce
 } ;
 
 HELP: produce-as
-{ $values { "pred" { $quotation "( -- ? )" } } { "quot" { $quotation "( -- obj )" } } { "exemplar" sequence } { "seq" "a sequence" } }
+{ $values { "pred" { $quotation "( ..a -- ..b ? )" } } { "quot" { $quotation "( ..b -- ..a obj )" } } { "exemplar" sequence } { "seq" "a sequence" } }
 { $description "Calls " { $snippet "pred" } " repeatedly. If the predicate yields " { $link f } ", stops, otherwise, calls " { $snippet "quot" } " to yield a value. Values are accumulated and returned in a sequence of type " { $snippet "exemplar" } " at the end." }
 { $examples "See " { $link produce } " for examples." } ;
 
@@ -995,8 +990,8 @@ HELP: count
 
 HELP: selector
 { $values
-     { "quot" { $quotation "( elt -- ? )" } }
-     { "selector" { $quotation "( elt -- )" } } { "accum" vector } }
+     { "quot" { $quotation "( ... elt -- ... ? )" } }
+     { "selector" { $quotation "( ... elt -- ... )" } } { "accum" vector } }
 { $description "Creates a new vector to accumulate the values which return true for a predicate.  Returns a new quotation which accepts an object to be tested and stored in the collector if the test yields true. The collector is left on the stack for convenience." }
 { $example "! Find all the even numbers:" "USING: prettyprint sequences math kernel ;"
            "10 iota [ even? ] selector [ each ] dip ."
@@ -1140,7 +1135,7 @@ HELP: set-fourth
 
 HELP: replicate
 { $values
-     { "len" integer } { "quot" { $quotation "( -- elt )" } }
+     { "len" integer } { "quot" { $quotation "( ... -- ... newelt )" } }
      { "newseq" sequence } }
      { $description "Calls the quotation " { $snippet "len" } " times, collecting results into a new array." }
 { $examples 
@@ -1152,7 +1147,7 @@ HELP: replicate
 
 HELP: replicate-as
 { $values
-     { "len" integer } { "quot" { $quotation "( -- elt )" } } { "exemplar" sequence }
+     { "len" integer } { "quot" { $quotation "( ... -- ... newelt )" } } { "exemplar" sequence }
      { "newseq" sequence } }
  { $description "Calls the quotation " { $snippet "len" } " times, collecting results into a new sequence of the same type as the exemplar sequence." }
 { $examples 
@@ -1190,7 +1185,7 @@ HELP: virtual@
 
 HELP: 2map-reduce
 { $values
-     { "seq1" sequence } { "seq2" sequence } { "map-quot" { $quotation "( elt1 elt2 -- intermediate )" } } { "reduce-quot" { $quotation "( prev intermediate -- result )" } }
+     { "seq1" sequence } { "seq2" sequence } { "map-quot" { $quotation "( ..a elt1 elt2 -- ..b intermediate )" } } { "reduce-quot" { $quotation "( ..b prev intermediate -- ..a next )" } }
      { "result" object } }
  { $description "Calls " { $snippet "map-quot" } " on each pair of elements from " { $snippet "seq1" } " and " { $snippet "seq2" } " and combines the results using " { $snippet "reduce-quot" } " in the same manner as " { $link reduce } ", except that there is no identity element, and the sequence must have a length of at least 1." }
 { $errors "Throws an error if the sequence is empty." }
@@ -1205,15 +1200,6 @@ HELP: 2selector
      { "selector" quotation } { "accum1" vector } { "accum2" vector } }
 { $description "Creates two new vectors to accumultate values based on a predicate. The first vector accumulates values for which the predicate yields true; the second for false." } ;
 
-HELP: 2reverse-each
-{ $values
-     { "seq1" sequence } { "seq2" sequence } { "quot" quotation } }
-{ $description "Reverse the sequences using the " { $link <reversed> } " word and calls " { $link 2each } " on the reversed sequences." }
-{ $examples { $example "USING: sequences math prettyprint ;"
-    "{ 10 20 30 } { 1 2 3 } [ + . ] 2reverse-each"
-    "33\n22\n11"
-} } ;
-
 HELP: 2unclip-slice
 { $values
      { "seq1" sequence } { "seq2" sequence }
@@ -1236,7 +1222,7 @@ HELP: collector
 
 HELP: binary-reduce
 { $values
-     { "seq" sequence } { "start" integer } { "quot" { $quotation "( elt1 elt2 -- newelt )" } }
+     { "seq" sequence } { "start" integer } { "quot" { $quotation "( ... elt1 elt2 -- ... newelt )" } }
      { "value" object } }
 { $description "Like " { $link reduce } ", but splits the sequence in half recursively until each sequence is small enough, and calls the quotation on these smaller sequences. If the quotation computes values that depend on the size of their input, such as bignum arithmetic, then this algorithm can be more efficient than using " { $link reduce } "." }
 { $examples "Computing factorial:"
@@ -1247,7 +1233,7 @@ HELP: binary-reduce
 
 HELP: follow
 { $values
-     { "obj" object } { "quot" { $quotation "( prev -- result/f )" } }
+     { "obj" object } { "quot" { $quotation "( ... prev -- ... result/f )" } }
      { "seq" sequence } }
 { $description "Outputs a sequence containing the input object and all of the objects generated by successively feeding the result of the quotation called on the input object to the quotation recursuively. Objects yielded by the quotation are added to the output sequence until the quotation yields " { $link f } ", at which point the recursion terminates." }
 { $examples "Get random numbers until zero is reached:"
@@ -1364,6 +1350,25 @@ HELP: assert-sequence=
   }
 } ;
 
+HELP: cartesian-each
+{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( ... elt1 elt2 -- ... )" } } }
+{ $description "Applies the quotation to every possible pairing of elements from the two sequences." } ;
+
+HELP: cartesian-map
+{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( ... elt1 elt2 -- ... newelt )" } } { "newseq" "a new sequence of sequences" } }
+{ $description "Applies the quotation to every possible pairing of elements from the two sequences, collecting results into a new sequence of sequences." } ;
+
+HELP: cartesian-product
+{ $values { "seq1" sequence } { "seq2" sequence } { "newseq" "a new sequence of sequences of pairs" } }
+{ $description "Outputs a sequence of all possible pairings of elements from the two sequences." }
+{ $examples
+    { $example
+        "USING: prettyprint sequences ;"
+        "{ 1 2 } { 3 4 } cartesian-product ."
+        "{ { { 1 3 } { 1 4 } } { { 2 3 } { 2 4 } } }"
+    }
+} ;
+
 ARTICLE: "sequences-unsafe" "Unsafe sequence operations"
 "The " { $link nth-unsafe } " and " { $link set-nth-unsafe } " sequence protocol bypasses bounds checks for increased performance."
 $nl
@@ -1515,8 +1520,6 @@ $nl
 { $subsections rest-slice but-last-slice }
 "Taking a sequence apart into a head and a tail:"
 { $subsections unclip-slice unclip-last-slice cut-slice }
-"A utility for words which use slices as iterators:"
-{ $subsections <flat-slice> }
 "Replacing slices with new elements:"
 { $subsections replace-slice } ;
 
@@ -1617,8 +1620,8 @@ ARTICLE: "sequences-destructive-discussion" "When to use destructive operations"
 }
 "The second reason is much weaker than the first one. In particular, many combinators (see " { $link map } ", " { $link produce } " and " { $link "namespaces-make" } ") as well as more advanced data structures (such as " { $vocab-link "persistent.vectors" } ") alleviate the need for explicit use of side effects." ;
 
-ARTICLE: "sequences-destructive" "Destructive operations"
-"Many operations have constructive and destructive variants:"
+ARTICLE: "sequences-destructive" "Destructive sequence operations"
+"Many operations have destructive variants that side effect an input sequence, instead of creating a new sequence:"
 { $table
     { "Constructive" "Destructive" }
     { { $link suffix } { $link suffix! } }
@@ -1641,10 +1644,14 @@ ARTICLE: "sequences-destructive" "Destructive operations"
     delete-all
     filter!
 }
+"Adding elements:"
+{ $subsections
+    suffix!
+    append!
+}
 "Other destructive words:"
 { $subsections
     reverse!
-    append!
     move
     exchange
     copy
@@ -1687,6 +1694,19 @@ ARTICLE: "sequences-combinator-implementation" "Implementing sequence combinator
     2selector
 } ;
 
+ARTICLE: "sequences-cartesian" "Cartesian product operations"
+"The cartesian product of two sequences is a sequence of all pairs where the first element of each pair is from the first sequence, and the second element of each pair is from the second sequence. The number of elements in the cartesian product is the product of the lengths of the two sequences."
+$nl
+"Combinators which pair every element of the first sequence with every element of the second:"
+{ $subsections
+    cartesian-each
+    cartesian-map
+}
+"Computing the cartesian product of two sequences:"
+{ $subsections
+    cartesian-product
+} ;
+
 ARTICLE: "sequences" "Sequence operations"
 "A " { $emphasis "sequence" } " is a finite, linearly-ordered collection of elements. Words for working with sequences are in the " { $vocab-link "sequences" } " vocabulary."
 $nl
@@ -1714,6 +1734,7 @@ $nl
     "binary-search"
     "sets"
     "sequences-trimming"
+    "sequences-cartesian"
     "sequences.deep"
 }
 "Using sequences for looping:"
index be1111b826f7f585f324006a3246e6e2862c0e3f..175ab252e13af9c1d62658e1b304c0d200d3458b 100644 (file)
@@ -24,6 +24,9 @@ IN: sequences.tests
 [ 5040 { 1 1 2 6 24 120 720 } ]
 [ { 1 2 3 4 5 6 7 } 1 [ * ] accumulate ] unit-test
 
+[ 64 B{ 1 2 4 16 } ]
+[ B{ 2 2 4 4 } 1 [ * ] accumulate ] unit-test
+
 [ 5040 { 1 1 2 6 24 120 720 } ]
 [ { 1 2 3 4 5 6 7 } 1 [ * ] accumulate! ] unit-test
 
@@ -309,3 +312,6 @@ USE: make
 [ +gt+ ] [ { 0 0 0 0 } { 0 0 0 } <=> ] unit-test
 [ +eq+ ] [ { } { } <=> ] unit-test
 [ +eq+ ] [ { 1 2 3 } { 1 2 3 } <=> ] unit-test
+
+[ { { { 1 "a" } { 1 "b" } } { { 2 "a" } { 2 "b" } } } ]
+[ { 1 2 } { "a" "b" } cartesian-product ] unit-test
index 2eafe2ceb8f8096dfb93b9fe306f7f3d0db19b12..55398ff02bedc45b6a02d5ab0b0d015295a8a954 100644 (file)
@@ -29,7 +29,7 @@ M: sequence shorten 2dup length < [ set-length ] [ 2drop ] if ; inline
 
 : empty? ( seq -- ? ) length 0 = ; inline
 
-: if-empty ( seq quot1 quot2 -- )
+: if-empty ( ..a seq quot1: ( ..a -- ..b ) quot2: ( ..a seq -- ..b ) -- ..b )
     [ dup empty? ] [ [ drop ] prepose ] [ ] tri* if ; inline
 
 : when-empty ( seq quot -- ) [ ] if-empty ; inline
@@ -408,82 +408,79 @@ PRIVATE>
 
 PRIVATE>
 
-: each ( seq quot -- )
+: each ( ... seq quot: ( ... x -- ... ) -- ... )
     (each) each-integer ; inline
 
-: reduce ( seq identity quot -- result )
+: reduce ( ... seq identity quot: ( ... prev elt -- ... next ) -- ... result )
     swapd each ; inline
 
 : map-integers ( len quot exemplar -- newseq )
     [ over ] dip [ [ collect ] keep ] new-like ; inline
 
-: map-as ( seq quot exemplar -- newseq )
+: map-as ( ... seq quot: ( ... elt -- ... newelt ) exemplar -- ... newseq )
     [ (each) ] dip map-integers ; inline
 
-: map ( seq quot -- newseq )
+: map ( ... seq quot: ( ... elt -- ... newelt ) -- ... newseq )
     over map-as ; inline
 
-: replicate-as ( len quot exemplar -- newseq )
+: replicate-as ( ... len quot: ( ... -- ... newelt ) exemplar -- ... newseq )
     [ [ drop ] prepose ] dip map-integers ; inline
 
-: replicate ( len quot -- newseq )
+: replicate ( ... len quot: ( ... -- ... newelt ) -- ... newseq )
     { } replicate-as ; inline
 
-: map! ( seq quot -- seq )
+: map! ( ... seq quot: ( ... elt -- ... newelt ) -- ... seq )
     over [ map-into ] keep ; inline
 
-: accumulate-as ( seq identity quot exemplar -- final newseq )
+: accumulate-as ( ... seq identity quot: ( ... prev elt -- ... next ) exemplar -- ... final newseq )
     [ (accumulate) ] dip map-as ; inline
 
-: accumulate ( seq identity quot -- final newseq )
-    { } accumulate-as ; inline
+: accumulate ( ... seq identity quot: ( ... prev elt -- ... next ) -- ... final newseq )
+    pick accumulate-as ; inline
 
-: accumulate! ( seq identity quot -- final seq )
+: accumulate! ( ... seq identity quot: ( ... prev elt -- ... next ) -- ... final seq )
     (accumulate) map! ; inline
 
-: 2each ( seq1 seq2 quot -- )
+: 2each ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... ) -- ... )
     (2each) each-integer ; inline
 
-: 2reverse-each ( seq1 seq2 quot -- )
-    [ [ <reversed> ] bi@ ] dip 2each ; inline
-
-: 2reduce ( seq1 seq2 identity quot -- result )
+: 2reduce ( ... seq1 seq2 identity quot: ( ... prev elt1 elt2 -- ... next ) -- ... result )
     [ -rot ] dip 2each ; inline
 
-: 2map-as ( seq1 seq2 quot exemplar -- newseq )
+: 2map-as ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) exemplar -- ... newseq )
     [ (2each) ] dip map-integers ; inline
 
-: 2map ( seq1 seq2 quot -- newseq )
+: 2map ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) -- ... newseq )
     pick 2map-as ; inline
 
-: 2all? ( seq1 seq2 quot -- ? )
+: 2all? ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... ? ) -- ... ? )
     (2each) all-integers? ; inline
 
-: 3each ( seq1 seq2 seq3 quot -- )
+: 3each ( ... seq1 seq2 seq3 quot: ( ... elt1 elt2 elt3 -- ... ) -- ... )
     (3each) each-integer ; inline
 
-: 3map-as ( seq1 seq2 seq3 quot exemplar -- newseq )
+: 3map-as ( ... seq1 seq2 seq3 quot: ( ... elt1 elt2 elt3 -- ... newelt ) exemplar -- ... newseq )
     [ (3each) ] dip map-integers ; inline
 
-: 3map ( seq1 seq2 seq3 quot -- newseq )
+: 3map ( ... seq1 seq2 seq3 quot: ( ... elt1 elt2 elt3 -- ... newelt ) -- ... newseq )
     [ pick ] dip swap 3map-as ; inline
 
-: find-from ( n seq quot -- i elt )
+: find-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )
     [ (find-integer) ] (find-from) ; inline
 
-: find ( seq quot -- i elt )
+: find ( ... seq quot: ( ... elt -- ... ? ) -- ... i elt )
     [ find-integer ] (find) ; inline
 
-: find-last-from ( n seq quot -- i elt )
+: find-last-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )
     [ nip find-last-integer ] (find-from) ; inline
 
-: find-last ( seq quot -- i elt )
+: find-last ( ... seq quot: ( ... elt -- ... ? ) -- ... i elt )
     [ [ 1 - ] dip find-last-integer ] (find) ; inline
 
-: all? ( seq quot -- ? )
+: all? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
     (each) all-integers? ; inline
 
-: push-if ( elt quot accum -- )
+: push-if ( ..a elt quot: ( ..a elt -- ..b ? ) accum -- ..b )
     [ keep ] dip rot [ push ] [ 2drop ] if ; inline
 
 : selector-for ( quot exemplar -- selector accum )
@@ -492,19 +489,19 @@ PRIVATE>
 : selector ( quot -- selector accum )
     V{ } selector-for ; inline
 
-: filter-as ( seq quot exemplar -- subseq )
+: filter-as ( ... seq quot: ( ... elt -- ... ? ) exemplar -- ... subseq )
     dup [ selector-for [ each ] dip ] curry dip like ; inline
 
-: filter ( seq quot -- subseq )
+: filter ( ... seq quot: ( ... elt -- ... ? ) -- ... subseq )
     over filter-as ; inline
 
-: push-either ( elt quot accum1 accum2 -- )
+: push-either ( ..a elt quot: ( ..a elt -- ..b ? ) accum1 accum2 -- ..b )
     [ keep swap ] 2dip ? push ; inline
 
 : 2selector ( quot -- selector accum1 accum2 )
     V{ } clone V{ } clone [ [ push-either ] 3curry ] 2keep ; inline
 
-: partition ( seq quot -- trueseq falseseq )
+: partition ( ... seq quot: ( ... elt -- ... ? ) -- ... trueseq falseseq )
     over [ 2selector [ each ] 2dip ] dip [ like ] curry bi@ ; inline
 
 : collector-for ( quot exemplar -- quot' vec )
@@ -513,16 +510,16 @@ PRIVATE>
 : collector ( quot -- quot' vec )
     V{ } collector-for ; inline
 
-: produce-as ( pred quot exemplar -- seq )
+: produce-as ( ..a pred: ( ..a -- ..b ? ) quot: ( ..b -- ..a obj ) exemplar -- ..b seq )
     dup [ collector-for [ while ] dip ] curry dip like ; inline
 
-: produce ( pred quot -- seq )
+: produce ( ..a pred: ( ..a -- ..b ? ) quot: ( ..b -- ..a obj ) -- ..b seq )
     { } produce-as ; inline
 
-: follow ( obj quot -- seq )
+: follow ( ... obj quot: ( ... prev -- ... result/f ) -- ... seq )
     [ dup ] swap [ keep ] curry produce nip ; inline
 
-: each-index ( seq quot -- )
+: each-index ( ... seq quot: ( ... elt index -- ... ) -- ... )
     (each-index) each-integer ; inline
 
 : interleave ( seq between quot -- )
@@ -532,10 +529,10 @@ PRIVATE>
         3bi
     ] if ; inline
 
-: map-index ( seq quot -- newseq )
+: map-index ( ... seq quot: ( ... elt index -- ... newelt ) -- ... newseq )
     [ dup length iota ] dip 2map ; inline
 
-: reduce-index ( seq identity quot -- )
+: reduce-index ( ... seq identity quot: ( ... prev elt index -- ... next ) -- ... result )
     swapd each-index ; inline
 
 : index ( obj seq -- n )
@@ -564,7 +561,7 @@ PRIVATE>
 : nths ( indices seq -- seq' )
     [ nth ] curry map ;
 
-: any? ( seq quot -- ? )
+: any? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
     find drop >boolean ; inline
 
 : member? ( elt seq -- ? )
@@ -626,7 +623,7 @@ M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ;
 
 <PRIVATE
 
-: (filter!) ( quot: ( elt -- ? ) store scan seq -- )
+: (filter!) ( ... quot: ( ... elt -- ... ? ) store scan seq -- ... )
     2dup length < [
         [ move ] 3keep
         [ nth-unsafe pick call [ 1 + ] when ] 2keep
@@ -636,7 +633,7 @@ M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ;
 
 PRIVATE>
 
-: filter! ( seq quot -- seq )
+: filter! ( ... seq quot: ( ... elt -- ... ? ) -- ... seq )
     swap [ [ 0 0 ] dip (filter!) ] keep ; inline
 
 : remove! ( elt seq -- seq )
@@ -771,7 +768,7 @@ PRIVATE>
         ] keep like
     ] if ;
 
-: padding ( seq n elt quot -- newseq )
+: padding ( ... seq n elt quot: ( ... seq1 seq2 -- ... newseq ) -- ... newseq )
     [
         [ over length [-] dup 0 = [ drop ] ] dip
         [ <repetition> ] curry
@@ -810,7 +807,7 @@ PRIVATE>
 : halves ( seq -- first-slice second-slice )
     dup midpoint@ cut-slice ;
 
-: binary-reduce ( seq start quot: ( elt1 elt2 -- newelt ) -- value )
+: binary-reduce ( ... seq start quot: ( ... elt1 elt2 -- ... newelt ) -- ... value )
     #! We can't use case here since combinators depends on
     #! sequences
     pick length dup 0 3 between? [
@@ -873,11 +870,11 @@ PRIVATE>
 : 2unclip-slice ( seq1 seq2 -- rest-slice1 rest-slice2 first1 first2 )
     [ unclip-slice ] bi@ swapd ; inline
 
-: map-reduce ( seq map-quot reduce-quot -- result )
+: map-reduce ( ..a seq map-quot: ( ..a x -- ..b elt ) reduce-quot: ( ..b prev elt -- ..a next ) -- ..a result )
     [ [ unclip-slice ] dip [ call ] keep ] dip
     compose reduce ; inline
 
-: 2map-reduce ( seq1 seq2 map-quot reduce-quot -- result )
+: 2map-reduce ( ..a seq1 seq2 map-quot: ( ..a elt1 elt2 -- ..b intermediate ) reduce-quot: ( ..b prev intermediate -- ..a next ) -- ..a result )
     [ [ prepare-2map-reduce ] keep ] dip
     compose compose each-integer ; inline
 
@@ -889,20 +886,15 @@ PRIVATE>
 
 PRIVATE>
 
-: map-find ( seq quot -- result elt )
+: map-find ( ... seq quot: ( ... elt -- ... result/f ) -- ... result elt )
     [ find ] (map-find) ; inline
 
-: map-find-last ( seq quot -- result elt )
+: map-find-last ( ... seq quot: ( ... elt -- ... result/f ) -- ... result elt )
     [ find-last ] (map-find) ; inline
 
 : unclip-last-slice ( seq -- butlast-slice last )
     [ but-last-slice ] [ last ] bi ; inline
 
-: <flat-slice> ( seq -- slice )
-    dup slice? [ { } like ] when
-    [ drop 0 ] [ length ] [ ] tri <slice> ;
-    inline
-
 <PRIVATE
     
 : (trim-head) ( seq quot -- seq n )
@@ -915,22 +907,22 @@ PRIVATE>
 
 PRIVATE>
 
-: trim-head-slice ( seq quot -- slice )
+: trim-head-slice ( ... seq quot: ( ... elt -- ... ? ) -- ... slice )
     (trim-head) tail-slice ; inline
 
-: trim-head ( seq quot -- newseq )
+: trim-head ( ... seq quot: ( ... elt -- ... ? ) -- ... newseq )
     (trim-head) tail ; inline
 
-: trim-tail-slice ( seq quot -- slice )
+: trim-tail-slice ( ... seq quot: ( ... elt -- ... ? ) -- ... slice )
     (trim-tail) head-slice ; inline
 
-: trim-tail ( seq quot -- newseq )
+: trim-tail ( ... seq quot: ( ... elt -- ... ? ) -- ... newseq )
     (trim-tail) head ; inline
 
-: trim-slice ( seq quot -- slice )
+: trim-slice ( ... seq quot: ( ... elt -- ... ? ) -- ... slice )
     [ trim-head-slice ] [ trim-tail-slice ] bi ; inline
 
-: trim ( seq quot -- newseq )
+: trim ( ... seq quot: ( ... elt -- ... ? ) -- ... newseq )
     [ trim-slice ] [ drop ] 2bi like ; inline
 
 GENERIC: sum ( seq -- n )
@@ -942,10 +934,19 @@ M: object sum 0 [ + ] binary-reduce ; inline
 
 : supremum ( seq -- n ) [ ] [ max ] map-reduce ;
 
-: map-sum ( seq quot -- n )
+: map-sum ( ... seq quot: ( ... elt -- ... n ) -- ... n )
     [ 0 ] 2dip [ dip + ] curry [ swap ] prepose each ; inline
 
-: count ( seq quot -- n ) [ 1 0 ? ] compose map-sum ; inline
+: count ( ... seq quot: ( ... elt -- ... ? ) -- ... n ) [ 1 0 ? ] compose map-sum ; inline
+
+: cartesian-each ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... ) -- ... )
+    [ with each ] 2curry each ; inline
+
+: cartesian-map ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) -- ... newseq )
+    [ with map ] 2curry map ; inline
+
+: cartesian-product ( seq1 seq2 -- newseq )
+    [ { } 2sequence ] cartesian-map ;
 
 ! We hand-optimize flip to such a degree because type hints
 ! cannot express that an array is an array of arrays yet, and
index d9b1271152b201c4b93938cd4cb26203fe0761e0..5ae96417349cea718d5660ad704efa89e6eba197 100644 (file)
 USING: assocs hashtables help.markup help.syntax kernel
-quotations sequences ;
+quotations sequences vectors ;
 IN: sets
 
-ARTICLE: "sets" "Set-theoretic operations on sequences"
-"Set-theoretic operations on sequences are defined on the " { $vocab-link "sets" } " vocabulary. All of these operations use hashtables internally to achieve linear running time."
-$nl
-"Remove duplicates:"
-{ $subsections prune }
-"Test for duplicates:"
+ARTICLE: "sets" "Sets"
+"A set is an unordered list of elements. Words for working with sets are in the " { $vocab-link "sets" } " vocabulary." $nl
+"All sets are instances of a mixin class:"
 { $subsections
-    all-unique?
-    duplicates
+    set
+    set?
+}
+{ $subsections "set-operations" "set-implementations" } ;
+
+ABOUT: "sets"
+
+ARTICLE: "set-operations" "Operations on sets"
+"To test if an object is a member of a set:"
+{ $subsections member? }
+"All sets can be represented as a sequence, without duplicates, of their members:"
+{ $subsections members }
+"Sets can have members added or removed destructively:"
+{ $subsections
+    adjoin
+    delete
 }
-"Set operations on sequences:"
+"To test if a set is the empty set:"
+{ $subsections null? }
+"Basic mathematical operations, which any type of set may override for efficiency:"
 { $subsections
     diff
     intersect
     union
 }
-"Set-theoretic predicates:"
+"Mathematical predicates on sets, which may be overridden for efficiency:"
 { $subsections
     intersects?
     subset?
     set=
 }
-"A word used to implement the above:"
-{ $subsections unique }
-"Adding elements to sets:"
+"An optional generic word for creating sets of the same class as a given set:"
+{ $subsections set-like }
+"An optional generic word for creating a set with a fast lookup operation, if the set itself has a slow lookup operation:"
+{ $subsections fast-set }
+"For set types that allow duplicates, like sequence sets, some additional words test for duplication:"
 { $subsections
-    adjoin
+    all-unique?
+    duplicates
 }
-{ $see-also member? member-eq? any? all? "assocs-sets" } ;
+"Utilities for sets and sequences:"
+{ $subsections
+     within
+     without
+} ;
 
-ABOUT: "sets"
+ARTICLE: "set-implementations" "Set implementations"
+"There are several implementations of sets in the Factor library. More can be added if they implement the words of the set protocol, the basic set operations."
+{ $subsections
+    "sequence-sets"
+    "hash-sets"
+    "bit-sets"
+} ;
+
+ARTICLE: "sequence-sets" "Sequences as sets"
+"Any sequence can be used as a set. The members of this set are the elements of the sequence. Calling the word " { $link members } " on a sequence returns a copy of the sequence with only one listing of each member. Destructive operations " { $link adjoin } " and " { $link delete } " only work properly on growable sequences like " { $link vector } "s."
+$nl
+"Care must be taken in writing efficient code using sequence sets. Testing for membership with " { $link in? } ", as well as the destructive set operations, take time proportional to the size of the sequence. Another representation, like " { $link "hash-sets" } ", would take constant time for membership tests. But binary operations like " { $link union } " are asymptotically optimal, taking time proportional to the sum of the size of the inputs."
+$nl
+"As one particular example, " { $link POSTPONE: f } " is a representation of the empty set, since it is an empty sequence." ;
+
+HELP: set
+{ $class-description "The class of all sets. Custom implementations of the set protocol should be declared as instances of this mixin for all set implementation to work correctly." } ;
 
 HELP: adjoin
-{ $values { "elt" object } { "seq" "a resizable mutable sequence" } }
-{ $description "Removes all elements equal to " { $snippet "elt" } ", and adds " { $snippet "elt" } " at the end of the sequence." }
+{ $values { "elt" object } { "set" set } }
+{ $description "Destructively adds " { $snippet "elt" } " to " { $snippet "set" } ". For sequences, this guarantees that this element is not duplicated, and that it is at the end of the sequence." $nl "Each mutable set type is expected to implement a method on this generic word." }
 { $examples
     { $example
-        "USING: namespaces prettyprint sets ;"
-        "V{ \"beans\" \"salsa\" \"cheese\" } \"v\" set"
-        "\"nachos\" \"v\" get adjoin"
-        "\"salsa\" \"v\" get adjoin"
-        "\"v\" get ."
+        "USING: prettyprint sets kernel ;"
+        "V{ \"beans\" \"salsa\" \"cheese\" } clone"
+        "\"nachos\" over adjoin"
+        "\"salsa\" over adjoin"
+        "."
         "V{ \"beans\" \"cheese\" \"nachos\" \"salsa\" }"
     }
 }
-{ $side-effects "seq" } ;
+{ $side-effects "set" } ;
 
-HELP: conjoin
-{ $values { "elt" object } { "assoc" assoc } }
-{ $description "Stores a key/value pair, both equal to " { $snippet "elt" } ", into the assoc." }
-{ $examples
-    { $example
-        "USING: kernel prettyprint sets ;"
-        "H{ } clone 1 over conjoin ."
-        "H{ { 1 1 } }"
-    }
-}
-{ $side-effects "assoc" } ;
+HELP: delete
+{ $values { "elt" object } { "set" set } }
+{ $description "Destructively removes " { $snippet "elt" } " from " { $snippet "set" } ". If the element is not present, this does nothing." $nl "Each mutable set type is expected to implement a method on this generic word." }
+{ $side-effects "set" } ;
 
-HELP: conjoin-at
-{ $values { "value" object } { "key" object } { "assoc" assoc } }
-{ $description "Adds " { $snippet "value" } " to the set stored at " { $snippet "key" } " of " { $snippet "assoc" } "." } ;
+HELP: members
+{ $values { "set" set } { "seq" sequence } }
+{ $description "Creates a sequence with a single copy of each member of the set." $nl "Each set type is expected to implement a method on this generic word." } ;
 
-HELP: unique
-{ $values { "seq" "a sequence" } { "assoc" assoc } }
-{ $description "Outputs a new assoc where the keys and values are equal." }
-{ $examples
-    { $example "USING: sets prettyprint ;" "{ 1 1 2 2 3 3 } unique ." "H{ { 1 1 } { 2 2 } { 3 3 } }" }
-} ;
+HELP: in?
+{ $values { "elt" object } { "set" set } { "?" "a boolean" } }
+{ $description "Tests whether the element is a member of the set." $nl "Each set type is expected to implement a method on this generic word as part of the set protocol." } ;
 
-HELP: prune
-{ $values { "seq" "a sequence" } { "newseq" "a sequence" } }
-{ $description "Outputs a new sequence with each distinct element of " { $snippet "seq" } " appearing only once. Elements are compared for equality using " { $link = } " and elements are ordered according to their position in " { $snippet "seq" } "." }
-{ $examples
-    { $example "USING: sets prettyprint ;" "{ 1 1 t 3 t } prune ." "V{ 1 t 3 }" }
-} ;
+HELP: adjoin-at
+{ $values { "value" object } { "key" object } { "assoc" assoc } }
+{ $description "Adds " { $snippet "value" } " to the set stored at " { $snippet "key" } " of " { $snippet "assoc" } "." }
+{ $side-effects "assoc" } ;
 
 HELP: duplicates
-{ $values { "seq" "a sequence" } { "newseq" "a sequence" } }
-{ $description "Outputs a new sequence consisting of elements which occur more than once in " { $snippet "seq" } "." }
+{ $values { "set" set } { "seq" sequence } }
+{ $description "Outputs a sequence consisting of elements which occur more than once in " { $snippet "set" } "." }
 { $examples
     { $example "USING: sets prettyprint ;" "{ 1 2 3 1 2 1 } duplicates ." "{ 1 2 1 }" }
 } ;
 
 HELP: all-unique?
-{ $values { "seq" sequence } { "?" "a boolean" } }
-{ $description "Tests whether a sequence contains any repeated elements." }
+{ $values { "set" set } { "?" "a boolean" } }
+{ $description "Tests whether a set contains any repeated elements." }
 { $example
     "USING: sets prettyprint ;"
     "{ 0 1 1 2 3 5 } all-unique? ."
@@ -96,41 +120,44 @@ HELP: all-unique?
 } ;
 
 HELP: diff
-{ $values { "seq1" sequence } { "seq2" sequence } { "newseq" sequence } }
-{ $description "Outputs a sequence consisting of elements present in " { $snippet "seq1" } " but not " { $snippet "seq2" } ", comparing elements for equality." 
+{ $values { "set1" set } { "set2" set } { "set" set } }
+{ $description "Outputs a set consisting of elements present in " { $snippet "set1" } " but not " { $snippet "set2" } ", comparing elements for equality." 
+"This word has a default definition which works for all sets, but set implementations may override the default for efficiency."
 } { $examples
     { $example "USING: sets prettyprint ;" "{ 1 2 3 } { 2 3 4 } diff ." "{ 1 }" }
 } ;
 
 HELP: intersect
-{ $values { "seq1" sequence } { "seq2" sequence } { "newseq" sequence } }
-{ $description "Outputs a sequence consisting of elements present in both " { $snippet "seq1" } " and " { $snippet "seq2" } "." }
+{ $values { "set1" set } { "set2" set } { "set" set } }
+{ $description "Outputs a set consisting of elements present in both " { $snippet "set1" } " and " { $snippet "set2" } "."
+"This word has a default definition which works for all sets, but set implementations may override the default for efficiency." }
 { $examples
     { $example "USING: sets prettyprint ;" "{ 1 2 3 } { 2 3 4 } intersect ." "{ 2 3 }" }
 } ;
 
 HELP: union
-{ $values { "seq1" sequence } { "seq2" sequence } { "newseq" sequence } }
-{ $description "Outputs a sequence consisting of elements present in " { $snippet "seq1" } " and " { $snippet "seq2" } " which does not contain duplicate values." }
+{ $values { "set1" set } { "set2" set } { "set" set } }
+{ $description "Outputs a set consisting of elements present in either " { $snippet "set1" } " or " { $snippet "set2" } " which does not contain duplicate values."
+"This word has a default definition which works for all sets, but set implementations may override the default for efficiency." }
 { $examples
-    { $example "USING: sets prettyprint ;" "{ 1 2 3 } { 2 3 4 } union ." "V{ 1 2 3 4 }" }
+    { $example "USING: sets prettyprint ;" "{ 1 2 3 } { 2 3 4 } union ." "{ 1 2 3 4 }" }
 } ;
 
 { diff intersect union } related-words
 
 HELP: intersects?
-{ $values { "seq1" sequence } { "seq2" sequence } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "seq1" } " and " { $snippet "seq2" } " have any elements in common." }
-{ $notes "If one of the sequences is empty, the result is always " { $link f } "." } ;
+{ $values { "set1" set } { "set2" set } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "set1" } " and " { $snippet "set2" } " have any elements in common." }
+{ $notes "If one of the sets is empty, the result is always " { $link f } "." } ;
 
 HELP: subset?
-{ $values { "seq1" sequence } { "seq2" sequence } { "?" "a boolean" } }
-{ $description "Tests if every element of " { $snippet "seq1" } " is contained in " { $snippet "seq2" } "." }
-{ $notes "If " { $snippet "seq1" } " is empty, the result is always " { $link t } "." } ;
+{ $values { "set1" set } { "set2" set } { "?" "a boolean" } }
+{ $description "Tests if every element of " { $snippet "set1" } " is contained in " { $snippet "set2" } "." }
+{ $notes "If " { $snippet "set1" } " is empty, the result is always " { $link t } "." } ;
 
 HELP: set=
-{ $values { "seq1" sequence } { "seq2" sequence } { "?" "a boolean" } }
-{ $description "Tests if both sequences contain the same elements, disregrading order and duplicates." } ;
+{ $values { "set1" set } { "set2" set } { "?" "a boolean" } }
+{ $description "Tests if both sets contain the same elements, disregrading order and duplicates." } ;
 
 HELP: gather
 { $values
@@ -138,3 +165,22 @@ HELP: gather
      { "newseq" sequence } }
 { $description "Maps a quotation onto a sequence, concatenates the results of the mapping, and removes duplicates." } ;
 
+HELP: set-like
+{ $values { "set" set } { "exemplar" set } { "set'" set } }
+{ $description "If the conversion is defined for the exemplar, converts the set into a set of the exemplar's class. This is not guaranteed to create a new set, for example if the input set and exemplar are of the same class." $nl
+"Set implementations may optionally implement a method on this generic word. The default implementation returns its input set." }
+{ $examples
+    { $example "USING: sets prettyprint ;" "{ 1 2 3 } HS{ } set-like ." "HS{ 1 2 3 }" }
+} ;
+
+HELP: within
+{ $values { "seq" sequence } { "set" set } { "subseq" sequence } }
+{ $description "Returns the subsequence of the given sequence consisting of members of the set. This may contain duplicates, if the sequence has duplicates." } ;
+
+HELP: without
+{ $values { "seq" sequence } { "set" set } { "subseq" sequence } }
+{ $description "Returns the subsequence of the given sequence consisting of things that are not members of the set. This may contain duplicates, if the sequence has duplicates." } ;
+
+HELP: null?
+{ $values { "set" set } { "?" "a boolean" } }
+{ $description "Tests whether the given set is empty. This outputs " { $snippet "t" } " when given a null set of any type." } ;
index f9f8ba9e65a2ba3a8972f3bfcfa7bce3b86afaf8..9a48acc4cfc0ef64bb85720f2e3d98a69fc2288a 100644 (file)
@@ -1,26 +1,26 @@
-USING: kernel sets tools.test ;
+! Copyright (C) 2010 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: sets tools.test kernel prettyprint hash-sets sorting ;
 IN: sets.tests
 
-[ f ] [ { 0 1 1 2 3 5 } all-unique? ] unit-test
-[ t ] [ { 0 1 2 3 4 5 } all-unique? ] unit-test
-
-[ V{ 1 2 3 } ] [ { 1 2 2 3 3 } prune ] unit-test
-[ V{ 3 2 1 } ] [ { 3 3 2 2 1 } prune ] unit-test
-
 [ { } ] [ { } { } intersect  ] unit-test
 [ { 2 3 } ] [ { 1 2 3 } { 2 3 4 } intersect ] unit-test
+[ { 2 3 } ] [ { 1 2 2 3 } { 2 3 3 4 } intersect ] unit-test
 
 [ { } ] [ { } { } diff ] unit-test
 [ { 1 } ] [ { 1 2 3 } { 2 3 4 } diff ] unit-test
+[ { 1 } ] [ { 1 1 2 3 } { 2 3 4 4 } diff ] unit-test
 
-[ V{ } ] [ { } { } union ] unit-test
-[ V{ 1 2 3 4 } ] [ { 1 2 3 } { 2 3 4 } union ] unit-test
+[ { } ] [ { } { } within  ] unit-test
+[ { 2 3 } ] [ { 1 2 3 } { 2 3 4 } within ] unit-test
+[ { 2 2 3 } ] [ { 1 2 2 3 } { 2 3 3 4 } within ] unit-test
 
-[ V{ 1 2 3 } ]
-[ 3 V{ 1 2 } clone [ adjoin ] keep ] unit-test
+[ { } ] [ { } { } without ] unit-test
+[ { 1 } ] [ { 1 2 3 } { 2 3 4 } without ] unit-test
+[ { 1 1 } ] [ { 1 1 2 3 3 } { 2 3 4 4 } without ] unit-test
 
-[ V{ 1 2 3 } ]
-[ 3 V{ 1 3 2 } clone [ adjoin ] keep ] unit-test
+[ { } ] [ { } { } union ] unit-test
+[ { 1 2 3 4 } ] [ { 1 2 3 } { 2 3 4 } union ] unit-test
 
 [ t ] [ { 1 2 } { 1 3 } intersects? ] unit-test
 
@@ -30,3 +30,37 @@ IN: sets.tests
 
 [ f ] [ { 1 } { } intersects? ] unit-test
 
+[ t ] [ 4 { 2 4 5 } in? ] unit-test
+[ f ] [ 1 { 2 4 5 } in? ] unit-test
+
+[ V{ 1 2 3 } ] [ 3 V{ 1 2 } clone [ adjoin ] keep ] unit-test
+[ V{ 1 2 } ] [ 2 V{ 1 2 } clone [ adjoin ] keep ] unit-test
+[ V{ 1 2 } ] [ 3 V{ 1 2 } clone [ delete ] keep ] unit-test
+[ V{ 2 } ] [ 1 V{ 1 2 } clone [ delete ] keep ] unit-test
+
+[ t ] [ { 1 2 3 } { 2 1 3 } set= ] unit-test
+[ f ] [ { 2 3 } { 1 2 3 } set= ] unit-test
+[ f ] [ { 1 2 3 } { 2 3 } set= ] unit-test
+
+[ { 1 } ] [ { 1 } members ] unit-test
+
+[ { 1 2 3 } ] [ { 1 1 1 2 2 3 3 3 3 3 } dup set-like natural-sort ] unit-test
+[ { 1 2 3 } ] [ HS{ 1 2 3 } { } set-like natural-sort ] unit-test
+
+[ HS{ 1 2 3 } ] [ { 1 2 3 } fast-set ] unit-test
+
+[ { 1 2 3 } ] [ { { 1 } { 2 } { 1 3 } } combine ] unit-test
+
+[ f ] [ { 0 1 1 2 3 5 } all-unique? ] unit-test
+[ t ] [ { 0 1 2 3 4 5 } all-unique? ] unit-test
+
+[ { 1 2 3 } ] [ { 1 2 2 3 3 } { } set-like ] unit-test
+[ { 3 2 1 } ] [ { 3 3 2 2 1 } { } set-like ] unit-test
+
+[ { 2 1 2 1 } ] [ { 1 2 3 2 1 2 1 } duplicates ] unit-test
+[ f ] [ HS{ 1 2 3 1 2 1 } duplicates ] unit-test
+
+[ H{ { 3 HS{ 1 2 } } } ] [ H{ } clone 1 3 pick adjoin-at 2 3 pick adjoin-at ] unit-test
+
+[ t ] [ f null? ] unit-test
+[ f ] [ { 4 } null? ] unit-test
index 38c1f73bb372eca032898c05a90349bbfea3d00e..9c1870aa2e57634feee580262f0813bf65771b93 100644 (file)
-! Copyright (C) 2008, 2009 Slava Pestov, Doug Coleman.
+! Copyright (C) 2010 Daniel Ehrenberg
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs hashtables kernel sequences vectors ;
+USING: accessors assocs hashtables kernel vectors
+math sequences ;
+FROM: assocs => change-at ;
 IN: sets
 
-: adjoin ( elt seq -- ) [ remove! drop ] [ push ] 2bi ;
+! Set protocol
+MIXIN: set
+GENERIC: adjoin ( elt set -- )
+GENERIC: in? ( elt set -- ? )
+GENERIC: delete ( elt set -- )
+GENERIC: set-like ( set exemplar -- set' )
+GENERIC: fast-set ( set -- set' )
+GENERIC: members ( set -- seq )
+GENERIC: union ( set1 set2 -- set )
+GENERIC: intersect ( set1 set2 -- set )
+GENERIC: intersects? ( set1 set2 -- ? )
+GENERIC: diff ( set1 set2 -- set )
+GENERIC: subset? ( set1 set2 -- ? )
+GENERIC: set= ( set1 set2 -- ? )
+GENERIC: duplicates ( set -- seq )
+GENERIC: all-unique? ( set -- ? )
+GENERIC: null? ( set -- ? )
+
+! Defaults for some methods.
+! Override them for efficiency
+
+M: set null? members null? ; inline
+
+M: set set-like drop ; inline
+
+M: set union
+    [ [ members ] bi@ append ] keep set-like ;
 
-: conjoin ( elt assoc -- ) dupd set-at ;
+<PRIVATE
 
-: conjoin-at ( value key assoc -- )
-    [ dupd ?set-at ] change-at ;
+: tester ( set -- quot )
+    fast-set [ in? ] curry ; inline
 
-: (prune) ( elt hash vec -- )
-    3dup drop key? [ 3drop ] [
-        [ drop conjoin ] [ nip push ] 3bi
-    ] if ; inline
+: sequence/tester ( set1 set2 -- set1' quot )
+    [ members ] [ tester ] bi* ; inline
 
-: prune ( seq -- newseq )
-    [ ] [ length <hashtable> ] [ length <vector> ] tri
-    [ [ (prune) ] 2curry each ] keep ;
+PRIVATE>
 
-: duplicates ( seq -- newseq )
-    H{ } clone [ [ key? ] [ conjoin ] 2bi ] curry filter ;
+M: set intersect
+    [ sequence/tester filter ] keep set-like ;
 
-: gather ( seq quot -- newseq )
-    map concat prune ; inline
+M: set diff
+    [ sequence/tester [ not ] compose filter ] keep set-like ;
 
-: unique ( seq -- assoc )
-    [ dup ] H{ } map>assoc ;
+M: set intersects?
+    sequence/tester any? ;
+
+M: set subset?
+    sequence/tester all? ;
+    
+M: set set=
+    2dup subset? [ swap subset? ] [ 2drop f ] if ;
 
-: (all-unique?) ( elt hash -- ? )
-    2dup key? [ 2drop f ] [ conjoin t ] if ;
+M: set fast-set ;
 
-: all-unique? ( seq -- ? )
-    dup length <hashtable> [ (all-unique?) ] curry all? ;
+M: set duplicates drop f ;
+
+M: set all-unique? drop t ;
 
 <PRIVATE
 
-: tester ( seq -- quot ) unique [ key? ] curry ; inline
+: (pruned) ( elt hash vec -- )
+    3dup drop in? [ 3drop ] [
+        [ drop adjoin ] [ nip push ] 3bi
+    ] if ; inline
+
+: pruned ( seq -- newseq )
+    [ f fast-set ] [ length <vector> ] bi
+    [ [ (pruned) ] 2curry each ] keep ;
 
 PRIVATE>
 
-: intersect ( seq1 seq2 -- newseq )
-    tester filter ;
+! Sequences are sets
+INSTANCE: sequence set
 
-: intersects? ( seq1 seq2 -- ? )
-    tester any? ;
+M: sequence in?
+    member? ; inline
 
-: diff ( seq1 seq2 -- newseq )
-    tester [ not ] compose filter ;
+M: sequence adjoin
+    [ delete ] [ push ] 2bi ;
 
-: union ( seq1 seq2 -- newseq )
-    append prune ;
+M: sequence delete
+    remove! drop ; inline
 
-: subset? ( seq1 seq2 -- ? )
-    tester all? ;
+M: sequence set-like
+    [ members ] dip like ;
 
-: set= ( seq1 seq2 -- ? )
-    [ unique ] bi@ = ;
+M: sequence members
+    [ pruned ] keep like ;
+  
+M: sequence null?
+    empty? ; inline
+
+: combine ( sets -- set )
+    [ f ]
+    [ [ [ members ] map concat ] [ first ] bi set-like ]
+    if-empty ;
+
+: gather ( seq quot -- newseq )
+    map concat members ; inline
+
+: adjoin-at ( value key assoc -- )
+    [ [ f fast-set ] unless* [ adjoin ] keep ] change-at ;
+
+: within ( seq set -- subseq )
+    fast-set [ in? ] curry filter ;
+
+: without ( seq set -- subseq )
+    fast-set [ in? not ] curry filter ;
+
+! Temporarily for compatibility
+
+: unique ( seq -- assoc )
+    [ dup ] H{ } map>assoc ;
+: conjoin ( elt assoc -- )
+    dupd set-at ;
+: conjoin-at ( value key assoc -- )
+    [ dupd ?set-at ] change-at ;
index 92b34db6ecaf9da714257751e3ac1025563bd342..1fcf40aa20b3346338b1ae13c63e29b016544c0f 100644 (file)
@@ -28,9 +28,9 @@ $nl
 "The following uses writers, and requires some stack shuffling:"
 { $code
     "<email>"
-    "    \"Happy birthday\" over (>>subject)"
-    "    { \"bob@bigcorp.com\" } over (>>to)"
-    "    \"alice@bigcorp.com\" over (>>from)"
+    "    \"Happy birthday\" over subject<<"
+    "    { \"bob@bigcorp.com\" } over to<<"
+    "    \"alice@bigcorp.com\" over from<<"
     "send-email"
 }
 "Even if some of the slot values come from the stack underneath the tuple being constructed, setters win:"
@@ -44,9 +44,9 @@ $nl
 "The above has less shuffling than the writer version:"
 { $code
     "<email>"
-    "    [ (>>subject) ] keep"
-    "    [ (>>to) ] keep"
-    "    \"alice@bigcorp.com\" over (>>from)"
+    "    [ subject<< ] keep"
+    "    [ to<< ] keep"
+    "    \"alice@bigcorp.com\" over from<<"
     "send-email"
 }
 "The changer word abstracts a common pattern where a slot value is read then stored again; so the following is not idiomatic code:"
index 3548e22c336428b7cea07841ef50874fc6fa3f17..7ec0136467edcdf8fdf326beb6bb13f30683fd95 100644 (file)
@@ -24,7 +24,7 @@ SLOT: my-protocol-slot-test
 TUPLE: protocol-slot-test-tuple x ;
 
 M: protocol-slot-test-tuple my-protocol-slot-test>> x>> sq ;
-M: protocol-slot-test-tuple (>>my-protocol-slot-test) [ sqrt ] dip (>>x) ;
+M: protocol-slot-test-tuple my-protocol-slot-test<< [ sqrt ] dip x<< ;
 
 [ 9 ] [ T{ protocol-slot-test-tuple { x 3 } } my-protocol-slot-test>> ] unit-test
 
index 191205a9b47e7c9247f302d74a2192a5d468d8fe..6c7881b3ad7af9338083598f8cad7e4d0b6376ce 100644 (file)
@@ -59,7 +59,7 @@ M: object reader-quot
     ] 2bi ;
 
 : writer-word ( name -- word )
-    "(>>" ")" surround "accessors" create
+    "<<" append "accessors" create
     dup t "writer" set-word-prop ;
 
 ERROR: bad-slot-value value class ;
index 840ed94b966ffdfa2a0bcdae43450b15fd07f01b..120d91bb2269f8165aefda082d3a8b60c1cc0b8a 100644 (file)
@@ -16,11 +16,11 @@ checksum
 definitions ;
 
 : record-top-level-form ( quot file -- )
-    (>>top-level-form)
+    top-level-form<<
     [ ] [ H{ } notify-definition-observers ] if-bootstrapping ;
 
 : record-checksum ( lines source-file -- )
-    [ crc32 checksum-lines ] dip (>>checksum) ;
+    [ crc32 checksum-lines ] dip checksum<< ;
 
 : record-definitions ( file -- )
     new-definitions get >>definitions drop ;
index 7b805dffe55a2b169b87821c5329e4ae2a36eb2d..7e5c301711a46d6d0d88622a3bafe5c06311cdc6 100644 (file)
@@ -61,7 +61,7 @@ PRIVATE>
     [ drop [ swap [ tail ] unless-zero , ] 2curry ]
     3tri if* ; inline recursive
 
-: split, ( seq quot -- ) [ 0 ] 2dip (split) ; inline
+: split, ( ... seq quot: ( ... elt -- ... ? ) -- ... ) [ 0 ] 2dip (split) ; inline
 
 PRIVATE>
 
index 0a5572e5308e67ba9a2abd8e3902c0473aa4c4af..d3dc72005abbfe32eb76e801ae1391c79f7fd5ce 100644 (file)
@@ -81,7 +81,7 @@ name>char-hook [
             [ column>> ] [ line-text>> ] bi
         ] dip swap subseq
     ] [
-        lexer get (>>column)
+        lexer get column<<
     ] bi ;
 
 : rest-of-line ( lexer -- seq )
index b90d96a356e0809616fa2d87c698139d8c747307..247bd8d00766910a353c5ab1b3d108147e1a1519 100644 (file)
@@ -85,6 +85,9 @@ unit-test
     "s" get >array
 ] unit-test
 
+! Make sure string initialization works
+[ HEX: 123456 ] [ 100 HEX: 123456 <string> first ] unit-test
+
 ! Make sure we clear aux vector when storing octets
 [ "\u123456hi" ] [ "ih\u123456" clone reverse! ] unit-test
 
index 18af08b3f665f636fb3f204326120c8f76ef922b..f356d2a87772edffdda015503286b38eb6d1ced3 100644 (file)
@@ -1,8 +1,7 @@
-! Copyright (C) 2003, 2008 Slava Pestov.
+! Copyright (C) 2003, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel math.private sequences kernel.private
-math sequences.private slots.private byte-arrays
-alien.accessors ;
+USING: accessors alien.accessors byte-arrays kernel math.private
+sequences kernel.private math sequences.private slots.private ;
 IN: strings
 
 <PRIVATE
@@ -17,8 +16,31 @@ IN: strings
 : rehash-string ( str -- )
     1 over sequence-hashcode swap set-string-hashcode ; inline
 
+: (aux) ( n string -- byte-array m )
+    aux>> { byte-array } declare swap 1 fixnum-shift-fast ; inline
+
+: small-char? ( ch -- ? ) HEX: 7f fixnum<= ; inline
+
+: string-nth ( n string -- ch )
+    2dup string-nth-fast dup small-char?
+    [ 2nip ] [
+        [ (aux) alien-unsigned-2 7 fixnum-shift-fast ] dip
+        fixnum-bitxor
+    ] if ; inline
+
+: ensure-aux ( string -- string )
+    dup aux>> [ dup length 2 * (byte-array) >>aux ] unless ; inline
+
+: set-string-nth-slow ( ch n string -- )
+    [ [ HEX: 80 fixnum-bitor ] 2dip set-string-nth-fast ]
+    [
+        ensure-aux
+        [ -7 fixnum-shift-fast 1 fixnum-bitxor ] 2dip
+        (aux) set-alien-unsigned-2
+    ] 3bi ;
+
 : set-string-nth ( ch n string -- )
-    pick HEX: 7f fixnum<=
+    pick small-char?
     [ set-string-nth-fast ] [ set-string-nth-slow ] if ; inline
 
 PRIVATE>
index 4a1af4c57808ccd3852c7682a6611ef689687d54..512e2de61a896500faba02096b13a82639262422 100644 (file)
@@ -54,15 +54,15 @@ ARTICLE: "syntax-integers" "Integer syntax"
 "More information on integers can be found in " { $link "integers" } "." ;
 
 ARTICLE: "syntax-ratios" "Ratio syntax"
-"The printed representation of a ratio is a pair of integers separated by a slash (/), prefixed by an optional whole number part followed by a plus (+). No intermediate whitespace is permitted. Here are some examples:"
+"The printed representation of a ratio is a pair of integers separated by a slash (" { $snippet "/" } "). A ratio can also be written as a proper fraction by following an integer part with " { $snippet "+" } " or " { $snippet "-" } " (matching the sign of the integer) and a ratio. No intermediate whitespace is permitted within a ratio literal. Here are some examples:"
 { $code
     "75/33"
     "1/10"
     "-5/-6"
     "1+1/3"
-    "-10+1/7"
+    "-10-1/7"
 }
-"More information on ratios can be found in " { $link "rationals" } ;
+"More information on ratios can be found in " { $link "rationals" } "." ;
 
 ARTICLE: "syntax-floats" "Float syntax"
 "Floating point literals are specified when a literal number contains a decimal point or exponent. Exponents are marked by an " { $snippet "e" } " or " { $snippet "E" } ":"
@@ -189,6 +189,10 @@ ARTICLE: "syntax-hashtables" "Hashtable syntax"
 { $subsections POSTPONE: H{ }
 "Hashtables are documented in " { $link "hashtables" } "." ;
 
+ARTICLE: "syntax-hash-sets" "Hash set syntax"
+{ $subsections POSTPONE: HS{ }
+"Hashtables are documented in " { $link "hash-sets" } "." ;
+
 ARTICLE: "syntax-tuples" "Tuple syntax"
 { $subsections POSTPONE: T{ }
 "Tuples are documented in " { $link "tuples" } "."  ;
@@ -229,6 +233,7 @@ $nl
     "syntax-vectors"
     "syntax-sbufs"
     "syntax-hashtables"
+    "syntax-hash-sets"
     "syntax-tuples"
     "syntax-pathnames"
     "syntax-effects"
@@ -330,7 +335,7 @@ HELP: }
 $nl
 "Parsing words can use this word as a generic end delimiter." } ;
 
-{ POSTPONE: { POSTPONE: V{ POSTPONE: H{ POSTPONE: C{ POSTPONE: T{ POSTPONE: W{ POSTPONE: } } related-words
+{ POSTPONE: { POSTPONE: V{ POSTPONE: H{ POSTPONE: HS{ POSTPONE: C{ POSTPONE: T{ POSTPONE: W{ POSTPONE: } } related-words
 
 HELP: {
 { $syntax "{ elements... }" }
@@ -356,6 +361,12 @@ HELP: H{
 { $description "Marks the beginning of a literal hashtable, given as a list of two-element arrays holding key/value pairs. Literal hashtables are terminated by " { $link POSTPONE: } } "." } 
 { $examples { $code "H{ { \"tuna\" \"fish\" } { \"jalapeno\" \"vegetable\" } }" } } ;
 
+HELP: HS{
+{ $syntax "HS{ members ... }" }
+{ $values { "members" "a list of objects" } }
+{ $description "Marks the beginning of a literal hash set, given as a list of its members. Literal hashtables are terminated by " { $link POSTPONE: } } "." } 
+{ $examples { $code "HS{ 3 \"foo\" }" } } ;
+
 HELP: C{
 { $syntax "C{ real-part imaginary-part }" }
 { $values { "real-part" "a real number" } { "imaginary-part" "a real number" } }
index 0b5b32e289174a7336a8d64382c104f76af644e4..92211a5b01d8476df3b6c89822e6dc36fe40440a 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2004, 2009 Slava Pestov.
+! Copyright (C) 2004, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien arrays byte-arrays byte-vectors definitions generic
 hashtables kernel math namespaces parser lexer sequences strings
@@ -8,7 +8,7 @@ generic.standard generic.hook generic.math generic.parser classes
 io.pathnames vocabs vocabs.parser classes.parser classes.union
 classes.intersection classes.mixin classes.predicate
 classes.singleton classes.tuple.parser compiler.units
-combinators effects.parser slots ;
+combinators effects.parser slots hash-sets ;
 IN: bootstrap.syntax
 
 ! These words are defined as a top-level form, instead of with
@@ -51,7 +51,7 @@ IN: bootstrap.syntax
 
     "UNUSE:" [ scan unuse-vocab ] define-core-syntax
 
-    "USING:" [ ";" parse-tokens [ use-vocab ] each ] define-core-syntax
+    "USING:" [ ";" [ use-vocab ] each-token ] define-core-syntax
 
     "QUALIFIED:" [ scan dup add-qualified ] define-core-syntax
 
@@ -104,6 +104,7 @@ IN: bootstrap.syntax
     "H{" [ \ } [ >hashtable ] parse-literal ] define-core-syntax
     "T{" [ parse-tuple-literal suffix! ] define-core-syntax
     "W{" [ \ } [ first <wrapper> ] parse-literal ] define-core-syntax
+    "HS{" [ \ } [ <hash-set> ] parse-literal ] define-core-syntax
 
     "POSTPONE:" [ scan-word suffix! ] define-core-syntax
     "\\" [ scan-word <wrapper> suffix! ] define-core-syntax
@@ -124,13 +125,11 @@ IN: bootstrap.syntax
     ] define-core-syntax
 
     "SYMBOLS:" [
-        ";" parse-tokens
-        [ create-in dup reset-generic define-symbol ] each
+        ";" [ create-in [ reset-generic ] [ define-symbol ] bi ] each-token
     ] define-core-syntax
 
     "SINGLETONS:" [
-        ";" parse-tokens
-        [ create-class-in define-singleton-class ] each
+        ";" [ create-class-in define-singleton-class ] each-token
     ] define-core-syntax
 
     "DEFER:" [
@@ -234,7 +233,7 @@ IN: bootstrap.syntax
         "))" parse-effect suffix!
     ] define-core-syntax
 
-    "MAIN:" [ scan-word current-vocab (>>main) ] define-core-syntax
+    "MAIN:" [ scan-word current-vocab main<< ] define-core-syntax
 
     "<<" [
         [
@@ -258,4 +257,12 @@ IN: bootstrap.syntax
     "call(" [ \ call-effect parse-call( ] define-core-syntax
 
     "execute(" [ \ execute-effect parse-call( ] define-core-syntax
+
+    "<<<<<<<" [ version-control-merge-conflict ] define-core-syntax
+    "=======" [ version-control-merge-conflict ] define-core-syntax
+    ">>>>>>>" [ version-control-merge-conflict ] define-core-syntax
+
+    "<<<<<<" [ version-control-merge-conflict ] define-core-syntax
+    "======" [ version-control-merge-conflict ] define-core-syntax
+    ">>>>>>" [ version-control-merge-conflict ] define-core-syntax
 ] with-compilation-unit
index 715564c64dcf8c91cd8bd965890fb1ec2549b09a..ecd5047fba66d9edd6c0c0cc03c41ad377504950 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2007, 2009 Slava Pestov.
+! Copyright (C) 2007, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel kernel.private sequences math namespaces
 init splitting assocs system.private layouts words ;
@@ -24,6 +24,8 @@ UNION: unix bsd solaris linux haiku ;
 
 : os ( -- class ) \ os get-global ; foldable
 
+: vm-compiler ( -- string ) \ vm-compiler get-global ; foldable
+
 <PRIVATE
 
 : string>cpu ( str -- class )
@@ -55,4 +57,4 @@ PRIVATE>
 
 : embedded? ( -- ? ) 15 special-object ;
 
-: exit ( n -- ) do-shutdown-hooks (exit) ;
+: exit ( n -- ) do-shutdown-hooks (exit) ;
index 08ab729b6daecd36a806459738b82c10ed8c1fac..423abbc277b4d6159497fdea711aba54f888eaaa 100755 (executable)
@@ -50,7 +50,9 @@ $nl
 { $subsections "vocabs.metadata" "vocabs.icons" }
 "Vocabularies can also be loaded at run time, without altering the vocabulary search path. This is done by calling a word which loads a vocabulary if it is not in the image, doing nothing if it is:"
 { $subsections require }
-"The above word will only ever load a vocabulary once in a given session. There is another word which unconditionally loads vocabulary from disk, regardless of whether or not is has already been loaded:"
+"The above word will only ever load a vocabulary once in a given session. Sometimes, two vocabularies require special code to interact. The following word is used to load one vocabulary when another is present:"
+{ $subsections require-when }
+"There is another word which unconditionally loads vocabulary from disk, regardless of whether or not is has already been loaded:"
 { $subsections reload }
 "For interactive development in the listener, calling " { $link reload } " directly is usually not necessary, since a better facility exists for " { $link "vocabs.refresh" } "."
 $nl
@@ -111,6 +113,12 @@ HELP: require
 { $description "Loads a vocabulary if it has not already been loaded." }
 { $notes "To unconditionally reload a vocabulary, use " { $link reload } ". To reload changed source files only, use the words in " { $link "vocabs.refresh" } "." } ;
 
+HELP: require-when
+{ $values { "if" "a sequence of vocabulary specifiers" } { "then" "a vocabulary specifier" } }
+{ $description "Loads the " { $snippet "then" } " vocabulary if it is not loaded and all of the " { $snippet "if" } " vocabulary is. If some of the " { $snippet "if" } " vocabularies are not loaded now, but they are later, then the " { $snippet "then" } " vocabulary will be loaded along with the final one." }
+{ $notes "This is used to express a joint dependency of vocabularies. If vocabularies " { $snippet "a" } " and " { $snippet "b" } " use code in vocabulary " { $snippet "c" } " to interact, then the following line, which can be placed in " { $snippet "a" } " or " { $snippet "b" } ", expresses the dependency."
+{ $code "{ \"a\" \"b\" } \"c\" require-when" } } ;
+
 HELP: run
 { $values { "vocab" "a vocabulary specifier" } }
 { $description "Runs a vocabulary's main entry point. The main entry point is set with the " { $link POSTPONE: MAIN: } " parsing word." } ;
index 09f28541e0ba92c844a24b84e346d837b3b86f7d..89afb50af7b15bd83ef9e567e2783b3318752520 100644 (file)
@@ -170,3 +170,21 @@ forget-junk
 ] with-compilation-unit
 
 [ ] [ [ "vocabs.loader.test.j" require ] [ drop :1 ] recover ] unit-test
+
+[ ] [ "vocabs.loader.test.m" require ] unit-test
+[ f ] [ "vocabs.loader.test.n" vocab ] unit-test
+[ ] [ "vocabs.loader.test.o" require ] unit-test
+[ t ] [ "vocabs.loader.test.n" vocab >boolean ] unit-test
+
+[
+    "mno" [ "vocabs.loader.test." swap suffix forget-vocab ] each
+] with-compilation-unit
+
+[ ] [ "vocabs.loader.test.o" require ] unit-test
+[ f ] [ "vocabs.loader.test.n" vocab ] unit-test
+[ ] [ "vocabs.loader.test.m" require ] unit-test
+[ t ] [ "vocabs.loader.test.n" vocab >boolean ] unit-test
+
+[
+    "mno" [ "vocabs.loader.test." swap suffix forget-vocab ] each
+] with-compilation-unit
index c8cf77b795612145bc2a0acbe6fda1d21ff1d6d0..9c1dcaef182065b7d192ec3c81111458329cb337 100644 (file)
@@ -8,15 +8,22 @@ IN: vocabs.loader
 
 SYMBOL: vocab-roots
 
-V{
-    "resource:core"
-    "resource:basis"
-    "resource:extra"
-    "resource:work"
-} clone vocab-roots set-global
+SYMBOL: add-vocab-root-hook
+
+[
+    V{
+        "resource:core"
+        "resource:basis"
+        "resource:extra"
+        "resource:work"
+    } clone vocab-roots set-global
+
+    [ drop ] add-vocab-root-hook set-global
+] "vocabs.loader" add-startup-hook
 
 : add-vocab-root ( root -- )
-    vocab-roots get adjoin ;
+    [ vocab-roots get adjoin ]
+    [ add-vocab-root-hook get-global call( root -- ) ] bi ;
 
 SYMBOL: root-cache
 
@@ -62,8 +69,24 @@ SYMBOL: check-vocab-hook
 
 check-vocab-hook [ [ drop ] ] initialize
 
+DEFER: require
+
 <PRIVATE
 
+SYMBOL: require-when-vocabs
+require-when-vocabs [ HS{ } clone ] initialize
+
+SYMBOL: require-when-table
+require-when-table [ V{ } clone ] initialize
+
+: load-conditional-requires ( vocab -- )
+    vocab-name require-when-vocabs get in? [
+        require-when-table get [
+            [ [ vocab dup [ source-loaded?>> +done+ = ] when ] all? ] dip
+            [ require ] curry when
+        ] assoc-each
+    ] when ;
+
 : load-source ( vocab -- )
     dup check-vocab-hook get call( vocab -- )
     [
@@ -71,7 +94,8 @@ check-vocab-hook [ [ drop ] ] initialize
         dup vocab-source-path [ parse-file ] [ [ ] ] if*
         [ +parsing+ >>source-loaded? ] dip
         [ % ] [ call( -- ) ] if-bootstrapping
-        +done+ >>source-loaded? drop
+        +done+ >>source-loaded?
+        load-conditional-requires
     ] [ ] [ f >>source-loaded? ] cleanup ;
 
 : load-docs ( vocab -- )
@@ -88,6 +112,14 @@ PRIVATE>
 : require ( vocab -- )
     load-vocab drop ;
 
+: require-when ( if then -- )
+    over [ vocab ] all? [
+        require drop
+    ] [
+        [ drop [ require-when-vocabs get adjoin ] each ]
+        [ 2array require-when-table get push ] 2bi
+    ] if ;
+
 : reload ( name -- )
     dup vocab
     [ [ load-source ] [ load-docs ] bi ]
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
index 5d77766703db1089fff42575eddc9e6ad0296848..ebb74b4d5fa4d029bb5b28a4578943a164455073 100644 (file)
@@ -1 +1 @@
-untested
+not loaded
diff --git a/core/vocabs/loader/test/m/m.factor b/core/vocabs/loader/test/m/m.factor
new file mode 100644 (file)
index 0000000..cd35d83
--- /dev/null
@@ -0,0 +1,5 @@
+USE: vocabs.loader
+IN: vocabs.loader.test.m
+
+{ "vocabs.loader.test.o" "vocabs.loader.test.m" }
+"vocabs.loader.test.n" require-when
diff --git a/core/vocabs/loader/test/m/tags.txt b/core/vocabs/loader/test/m/tags.txt
new file mode 100644 (file)
index 0000000..ebb74b4
--- /dev/null
@@ -0,0 +1 @@
+not loaded
diff --git a/core/vocabs/loader/test/n/n.factor b/core/vocabs/loader/test/n/n.factor
new file mode 100644 (file)
index 0000000..b3cedb3
--- /dev/null
@@ -0,0 +1 @@
+IN: vocabs.loader.test.n
diff --git a/core/vocabs/loader/test/n/tags.txt b/core/vocabs/loader/test/n/tags.txt
new file mode 100644 (file)
index 0000000..ebb74b4
--- /dev/null
@@ -0,0 +1 @@
+not loaded
diff --git a/core/vocabs/loader/test/o/o.factor b/core/vocabs/loader/test/o/o.factor
new file mode 100644 (file)
index 0000000..cc8051a
--- /dev/null
@@ -0,0 +1 @@
+IN: vocabs.loader.test.o
diff --git a/core/vocabs/loader/test/o/tags.txt b/core/vocabs/loader/test/o/tags.txt
new file mode 100644 (file)
index 0000000..ebb74b4
--- /dev/null
@@ -0,0 +1 @@
+not loaded
index d21b7d20435d4b6c847fa68a696f475749771e1c..8d1d2664dabf043aae84224e0ebc34a584c1dc64 100644 (file)
@@ -86,7 +86,7 @@ PRIVATE>
 
 : set-current-vocab ( name -- )
     create-vocab
-    [ manifest get (>>current-vocab) ] [ (add-qualified) ] bi ;
+    [ manifest get current-vocab<< ] [ (add-qualified) ] bi ;
 
 : with-current-vocab ( name quot -- )
     manifest get clone manifest [
index 1c65e627d543e930b69291319e8b456b10956a84..3f8a71e76cf0b293277fcf46f127fb37aba5e695 100644 (file)
@@ -39,7 +39,7 @@ $nl
 }
 "Removing a vocabulary:"
 { $subsections forget-vocab }
-{ $see-also "words" "vocabs.loader" } ;
+{ $see-also "words" "vocabs.loader" "word-search" } ;
 
 ABOUT: "vocabularies"
 
index 239b88a2e80b6030285b0390602445a292072f7c..38881673e9877986398c0ca50684a627bca83a78 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2007, 2009 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs strings kernel sorting namespaces
-sequences definitions ;
+sequences definitions sets combinators ;
 IN: vocabs
 
 SYMBOL: dictionary
@@ -118,8 +118,8 @@ M: vocab-spec >vocab-link ;
 M: string >vocab-link dup vocab [ ] [ <vocab-link> ] ?if ;
 
 : forget-vocab ( vocab -- )
-    dup words forget-all
-    vocab-name dictionary get delete-at
+    [ words forget-all ]
+    [ vocab-name dictionary get delete-at ] bi
     notify-vocab-observers ;
 
 M: vocab-spec forget* forget-vocab ;
index 5b057230fe8e8daaa87f1a537c4a3e12807e3b88..2a4c2c4c06a130121f0c33b1db8bfb5cf70d52d7 100644 (file)
@@ -73,12 +73,14 @@ GENERIC: crossref? ( word -- ? )
 M: word crossref?
     dup "forgotten" word-prop [ drop f ] [ vocabulary>> >boolean ] if ;
 
-: inline? ( word -- ? ) "inline" word-prop ; inline
-
 GENERIC: subwords ( word -- seq )
 
 M: word subwords drop f ;
 
+GENERIC: parent-word ( word -- word/f )
+
+M: word parent-word drop f ;
+
 : define ( word def -- )
     over changed-definition [ ] like >>def drop ;
 
@@ -100,6 +102,8 @@ M: word subwords drop f ;
 : make-deprecated ( word -- )
     t "deprecated" set-word-prop ;
 
+: inline? ( word -- ? ) "inline" word-prop ; inline
+
 ERROR: cannot-be-inline word ;
 
 GENERIC: make-inline ( word -- )
@@ -111,21 +115,29 @@ M: word make-inline
         bi
     ] if ;
 
+: define-inline ( word def effect -- )
+    [ define-declared ] [ 2drop make-inline ] 3bi ;
+
 : make-recursive ( word -- )
     t "recursive" set-word-prop ;
 
+GENERIC: flushable? ( word -- ? )
+
+M: word flushable?
+    [ "flushable" word-prop ]
+    [ parent-word dup [ flushable? ] when ] bi or ;
+
 : make-flushable ( word -- )
     t "flushable" set-word-prop ;
 
-: make-foldable ( word -- )
-    dup make-flushable t "foldable" set-word-prop ;
-
-: define-inline ( word def effect -- )
-    [ define-declared ] [ 2drop make-inline ] 3bi ;
+GENERIC: foldable? ( word -- ? )
 
-GENERIC: flushable? ( word -- ? )
+M: word foldable?
+    [ "foldable" word-prop ]
+    [ parent-word dup [ foldable? ] when ] bi or ;
 
-M: word flushable? "flushable" word-prop ;
+: make-foldable ( word -- )
+    dup make-flushable t "foldable" set-word-prop ;
 
 GENERIC: reset-word ( word -- )
 
@@ -208,9 +220,10 @@ M: word set-where swap "loc" set-word-prop ;
 
 M: word forget*
     dup "forgotten" word-prop [ drop ] [
+        [ subwords forget-all ]
         [ [ name>> ] [ vocabulary>> vocab-words ] bi delete-at ]
         [ t "forgotten" set-word-prop ]
-        bi
+        tri
     ] if ;
 
 M: word hashcode*
diff --git a/extra/alien/cxx/cxx.factor b/extra/alien/cxx/cxx.factor
new file mode 100644 (file)
index 0000000..7194c5d
--- /dev/null
@@ -0,0 +1,12 @@
+! (c)2010 Joe Groff bsd license
+USING: alien kernel ;
+IN: alien.cxx
+
+SINGLETONS: g++ visual-c++ ;
+UNION: c++-abi
+    g++ visual-c++ ;
+
+GENERIC: c++>c-abi ( c++-abi -- c-abi )
+
+M: g++ c++>c-abi drop cdecl ;
+M: visual-c++ c++>c-abi drop thiscall ;
diff --git a/extra/alien/cxx/demangle/demangle.factor b/extra/alien/cxx/demangle/demangle.factor
new file mode 100644 (file)
index 0000000..08cf834
--- /dev/null
@@ -0,0 +1,12 @@
+! (c)2010 Joe Groff bsd license
+USING: alien.cxx kernel ;
+QUALIFIED-WITH: alien.cxx.demangle.libstdcxx libstdcxx
+IN: alien.cxx.demangle
+
+GENERIC: c++-symbol? ( mangled-name abi -- ? )
+GENERIC: demangle ( mangled-name abi -- c++-name )
+
+M: g++ c++-symbol?
+    drop libstdcxx:mangled-name? ;
+M: g++ demangle
+    drop libstdcxx:demangle ;
diff --git a/extra/alien/cxx/demangle/libstdcxx/libstdcxx.factor b/extra/alien/cxx/demangle/libstdcxx/libstdcxx.factor
new file mode 100644 (file)
index 0000000..403015b
--- /dev/null
@@ -0,0 +1,30 @@
+! (c)2010 Joe Groff bsd license
+USING: alien alien.c-types alien.libraries alien.strings
+alien.syntax combinators destructors io.encodings.ascii kernel
+libc locals sequences system ;
+IN: alien.cxx.demangle.libstdcxx
+
+FUNCTION: char* __cxa_demangle ( char* mangled_name, char* output_buffer, size_t* length, int* status ) ;
+
+ERROR: demangle-memory-allocation-failure ;
+ERROR: invalid-mangled-name name ;
+ERROR: invalid-demangle-args name ;
+
+: demangle-error ( name status -- )
+    {
+        {  0 [ drop ] }
+        { -1 [ drop demangle-memory-allocation-failure ] }
+        { -2 [ invalid-mangled-name ] }
+        { -3 [ invalid-demangle-args ] }
+    } case ;
+
+: mangled-name? ( name -- ? )
+    "_Z" head? ;
+
+:: demangle ( mangled-name -- c++-name )
+    0 <ulong> :> length
+    0 <int> :> status [
+        mangled-name ascii string>alien f length status __cxa_demangle &(free) :> demangled-buf
+        mangled-name status *int demangle-error
+        demangled-buf ascii alien>string
+    ] with-destructors ;
diff --git a/extra/alien/cxx/scaffold/scaffold.factor b/extra/alien/cxx/scaffold/scaffold.factor
new file mode 100644 (file)
index 0000000..603d5d0
--- /dev/null
@@ -0,0 +1,15 @@
+! (c)2010 Joe Groff bsd license
+USING: alien.cxx.demangle assocs combinators fry io.pathnames
+kernel macho sequences ;
+IN: alien.cxx.scaffold
+
+: library-symbols ( file -- symbols )
+    dup file-extension {
+        { "dylib" [ dylib-exports ] }
+        { f       [ dylib-exports ] }
+    } case ;
+
+: c++-library-symbols ( file abi -- symbols )
+    [ library-symbols ] dip
+    [ '[ _ c++-symbol? ] filter ]
+    [ '[ dup _ demangle ] H{ } map>assoc ] bi ;
diff --git a/extra/alien/cxx/tests/test.cpp b/extra/alien/cxx/tests/test.cpp
new file mode 100644 (file)
index 0000000..d4a6995
--- /dev/null
@@ -0,0 +1,31 @@
+namespace Namespace {
+    int namespaced(int x, int y) { return x + y; }
+}
+
+double toplevel(double x, double y) { return x + y; }
+double toplevel(double x, double y, double z) { return x + y + z; }
+
+class Class
+{
+    unsigned x;
+
+    Class();
+    Class(unsigned _x);
+
+    unsigned member(unsigned y);
+    unsigned member(unsigned y) const;
+
+    unsigned static_member(unsigned x, unsigned y);
+};
+
+Class::Class() : x(42) { }
+Class::Class(unsigned _x) : x(_x) { }
+unsigned Class::member(unsigned y) { return x += y; }
+unsigned Class::member(unsigned y) const { return x + y; }
+unsigned Class::static_member(unsigned x, unsigned y) { return Class(x).member(y); }
+
+template<typename T>
+T templated(T x, T y) { return x + y; }
+
+template int templated<int>(int x, int y);
+template double templated<double>(double x, double y);
index 305ae6bdf236f4b7b2d07d23bd1e58218968abad..67e7b5f22e72265e3ed8985ccc7c6d4b9bdb16a7 100644 (file)
@@ -9,7 +9,7 @@ IN: alien.data.map.tests
 [ float-array{ 1.0 1.0 3.0 3.0 5.0 5.0 } ]
 [
     int-array{ 1 3 5 } [ dup ] data-map( int -- float[2] )
-    byte-array>float-array
+    float-array-cast
 ] unit-test
 
 [
@@ -20,7 +20,7 @@ IN: alien.data.map.tests
     }
 ] [
     3 iota [ float-4-with ] data-map( object -- float-4 )
-    byte-array>float-4-array
+    float-4-array-cast
 ] unit-test
 
 [
@@ -31,7 +31,7 @@ IN: alien.data.map.tests
     }
 ] [
     12 iota [ float-4-boa ] data-map( object[4] -- float-4 )
-    byte-array>float-4-array
+    float-4-array-cast
 ] unit-test
 
 [ float-array{ 1.0 1.0 3.0 3.0 5.0 5.0 0.0 0.0 } ]
@@ -151,5 +151,5 @@ CONSTANT: plane-count 4
     [ ] data-map( object -- float ) ;
 
 [ float-array{ 0.0 0.5 1.0 } ]
-[ 2 data-map-compiler-bug-test byte-array>float-array ]
+[ 2 data-map-compiler-bug-test float-array-cast ]
 unit-test
index 2b96d2a4f4e02dde9f33c783815b61a9f609480c..1fb5757695211b077a9daccc2c9008bf4ae5391a 100644 (file)
@@ -72,7 +72,7 @@ TUPLE: element syntax id tag tagclass encoding contentlength newobj objtype ;
 
 : (set-tag) ( -- )
     elements get id>> 31 bitand
-    dup elements get (>>tag)
+    dup elements get tag<<
     31 < [
         [ "unsupported tag encoding: #{" % 
           get-id # "}" %
@@ -81,22 +81,22 @@ TUPLE: element syntax id tag tagclass encoding contentlength newobj objtype ;
 
 : set-tagclass ( -- )
     get-id -6 shift tag-classes nth
-    elements get (>>tagclass) ;
+    elements get tagclass<< ;
 
 : set-encoding ( -- )
     get-id HEX: 20 bitand
     zero? "primitive" "constructed" ?
-    elements get (>>encoding) ;
+    elements get encoding<< ;
 
 : set-content-length ( -- )
     read1
     dup 127 <= [ 
         127 bitand read be>
-    ] unless elements get (>>contentlength) ;
+    ] unless elements get contentlength<< ;
 
 : set-newobj ( -- )
     elements get contentlength>> read
-    elements get (>>newobj) ;
+    elements get newobj<< ;
 
 : set-objtype ( syntax -- )
     builtin-syntax 2array [
@@ -104,7 +104,7 @@ TUPLE: element syntax id tag tagclass encoding contentlength newobj objtype ;
         elements get encoding>> swap at
         elements get tag>>
         swap at [ 
-            elements get (>>objtype)
+            elements get objtype<<
         ] when*
     ] each ;
 
@@ -130,7 +130,7 @@ SYMBOL: end
     } case ;
 
 : set-id ( -- boolean )
-    read1 dup elements get (>>id) ;
+    read1 dup elements get id<< ;
 
 : read-ber ( syntax -- object )
     element new
@@ -199,7 +199,7 @@ TUPLE: tag value ;
     ] with-scope ; inline
 
 : set-tag ( value -- )
-    tagnum get (>>value) ;
+    tagnum get value<< ;
 
 M: string >ber ( str -- byte-array )
     tagnum get value>> 1array "C" pack-native swap dup
index ae94f5bb42f798f1383a7e2d43d99ebb69dfea43..a188df853b5a16c54328f4b036be153ce344e130 100644 (file)
@@ -1,7 +1,8 @@
 ! (c)2009 Joe Groff bsd license
 USING: accessors alien audio classes.struct fry calendar alarms
 combinators combinators.short-circuit destructors generalizations
-kernel literals locals math openal sequences specialized-arrays strings ;
+kernel literals locals math openal sequences
+sequences.generalizations specialized-arrays strings ;
 QUALIFIED-WITH: alien.c-types c
 SPECIALIZED-ARRAYS: c:float c:uchar c:uint ;
 IN: audio.engine
@@ -232,7 +233,7 @@ DEFER: update-audio
     dup al-sources>> [
         {
             [ make-engine-current ]
-            [ update-alarm>> [ cancel-alarm ] when* ]
+            [ update-alarm>> [ stop-alarm ] when* ]
             [ clips>> clone [ dispose ] each ]
             [ al-sources>> free-sources ]
             [
index bbc6c339e9f6b5359735d83d3fb256a676d9bb3a..0791a226d465edc06770b301308c2c0b575b8269 100644 (file)
@@ -44,7 +44,7 @@ M: noise-generator dispose
     ] 20 milliseconds every :> alarm
     "Press Enter to stop the test." print
     readln drop
-    alarm cancel-alarm
+    alarm stop-alarm
     engine dispose ;
 
 MAIN: audio-engine-test
index 78f637770fd67d41e6a75572b6755bbb11599bbf..e67c7b7934ebf3a72a05a93d3810301f08af732b 100644 (file)
@@ -1,8 +1,9 @@
 ! (c)2007, 2010 Chris Double, Joe Groff bsd license
-USING: accessors alien.c-types audio.engine byte-arrays classes.struct
-combinators destructors fry io io.files io.encodings.binary
-kernel libc locals make math math.order math.parser ogg ogg.vorbis
-sequences specialized-arrays specialized-vectors ;
+USING: accessors alien alien.c-types audio.engine byte-arrays
+classes.struct combinators destructors fry io io.files
+io.encodings.binary kernel libc locals make math math.order
+math.parser ogg ogg.vorbis sequences specialized-arrays
+specialized-vectors ;
 FROM: alien.c-types => float short void* ;
 SPECIALIZED-ARRAYS: float void* ;
 SPECIALIZED-VECTOR: short
index a379a03828a227d7269b5befdda8e5ce050e4b22..ec39554504432162562a46b51a0a54d55d46d868 100644 (file)
@@ -54,7 +54,7 @@ C: <transaction> transaction
 : process-day ( account date -- )
     2dup accumulate-interest ?pay-interest ;
 
-: each-day ( quot: ( -- ) start end -- )
+: each-day ( ... quot: ( ... day -- ... ) start end -- ... )
     2dup before? [
         [ dup [ over [ swap call ] dip ] dip 1 days time+ ] dip each-day
     ] [
index 5883836b7dbb229055bd4ab35f841bc127e89377..a7af66ed7e1015a4a55df6444ebbcf6b320ab554 100644 (file)
@@ -1,12 +1,10 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: binary-search compiler.units kernel math.primes math.ranges
-memoize prettyprint sequences ;
+USING: binary-search kernel math.primes math.ranges memoize
+prettyprint sequences ;
 IN: benchmark.binary-search
 
-[
-    MEMO: primes-under-million ( -- seq ) 1000000 primes-upto ;
-] with-compilation-unit
+MEMO: primes-under-million ( -- seq ) 1000000 primes-upto ;
 
 ! Force computation of the primes list before benchmarking the binary search
 primes-under-million drop
index 21ff7fbbef048c2da6bce9988ade3b8806e49405..b109e169da62bbfd4d5bdc5b07631ca387061f14 100644 (file)
@@ -1,5 +1,7 @@
-USING: kernel math accessors prettyprint io locals sequences
-math.ranges math.order ;
+! Copyright (C) 2008, 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors kernel math math.ranges math.order math.parser
+io locals sequences ;
 IN: benchmark.binary-trees
 
 TUPLE: tree-node item left right ;
@@ -27,8 +29,8 @@ CONSTANT: min-depth 4
 
 : stretch-tree ( max-depth -- )
     1 + 0 over bottom-up-tree item-check
-    [ "stretch tree of depth " write pprint ]
-    [ "\t check: " write . ] bi* ; inline
+    [ "stretch tree of depth " write number>string write ]
+    [ "\t check: " write number>string print ] bi* ; inline
 
 :: long-lived-tree ( max-depth -- )
     0 max-depth bottom-up-tree
@@ -40,13 +42,13 @@ CONSTANT: min-depth 4
                 [ depth bottom-up-tree item-check + ] bi@
             ] reduce
         ]
-        [ 2 * ] bi
-        pprint "\t trees of depth " write depth pprint
-        "\t check: " write .
+        [ 2 * number>string write ] bi
+        "\t trees of depth " write depth number>string write
+        "\t check: " write number>string print
     ] each
 
-    "long lived tree of depth " write max-depth pprint
-    "\t check: " write item-check . ; inline
+    "long lived tree of depth " write max-depth number>string write
+    "\t check: " write item-check number>string print ; inline
 
 : binary-trees ( n -- )
     min-depth 2 + max [ stretch-tree ] [ long-lived-tree ] bi ; inline
diff --git a/extra/benchmark/binary-trees/deploy.factor b/extra/benchmark/binary-trees/deploy.factor
new file mode 100644 (file)
index 0000000..0618530
--- /dev/null
@@ -0,0 +1,15 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-ui? f }
+    { deploy-word-defs? f }
+    { deploy-threads? t }
+    { deploy-math? t }
+    { deploy-io 2 }
+    { deploy-reflection 1 }
+    { deploy-unicode? f }
+    { "stop-after-last-window?" t }
+    { deploy-console? t }
+    { deploy-word-props? f }
+    { deploy-c-types? f }
+    { deploy-name "benchmark.binary-trees" }
+}
index afd2f8830a15e59728253bbe906225909abe983c..f17db30c927dbf7ed0de4fc74c81d8403675e996 100644 (file)
@@ -65,7 +65,7 @@ TUPLE: meeting-place count mailbox ;
     first2 {
         [ [ [ 1 + ] change-count ] bi@ 2drop ]
         [ 2dup = [ [ 1 + ] change-self-count ] when 2drop ]
-        [ [ [ color>> ] bi@ complement-color ] [ [ (>>color) ] bi-curry@ bi ] 2bi ]
+        [ [ [ color>> ] bi@ complement-color ] [ [ color<< ] bi-curry@ bi ] 2bi ]
         [ [ mailbox>> f swap mailbox-put ] bi@ ]
     } 2cleave ;
 
diff --git a/extra/benchmark/fasta/deploy.factor b/extra/benchmark/fasta/deploy.factor
new file mode 100644 (file)
index 0000000..ff90c8f
--- /dev/null
@@ -0,0 +1,15 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-name "benchmark.fasta" }
+    { deploy-ui? f }
+    { deploy-c-types? f }
+    { deploy-console? t }
+    { deploy-unicode? f }
+    { "stop-after-last-window?" t }
+    { deploy-io 3 }
+    { deploy-reflection 1 }
+    { deploy-word-props? f }
+    { deploy-math? t }
+    { deploy-threads? t }
+    { deploy-word-defs? f }
+}
index bd7ccafb9fa01eb7ebfbfc0ee47b374db953113a..f1ebc2aa9fcd48c604533612abcad5455ea6aa92 100644 (file)
@@ -1,8 +1,9 @@
 ! Based on http://shootout.alioth.debian.org/gp4/benchmark.php?test=fasta&lang=java&id=2
-USING: alien.c-types math kernel io io.files locals multiline
-assocs sequences sequences.private benchmark.reverse-complement
-hints io.encodings.ascii byte-arrays specialized-arrays ;
-SPECIALIZED-ARRAY: double
+USING: assocs benchmark.reverse-complement byte-arrays fry io
+io.encodings.ascii io.files locals kernel math sequences
+sequences.private specialized-arrays strings typed ;
+QUALIFIED-WITH: alien.c-types c
+SPECIALIZED-ARRAY: c:double
 IN: benchmark.fasta
 
 CONSTANT: IM 139968
@@ -11,10 +12,8 @@ CONSTANT: IC 29573
 CONSTANT: initial-seed 42
 CONSTANT: line-length 60
 
-: random ( seed -- n seed )
-    >float IA * IC + IM mod [ IM /f ] keep ; inline
-
-HINTS: random fixnum ;
+: random ( seed -- seed n )
+    IA * IC + IM mod dup IM /f ; inline
 
 CONSTANT: ALU "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"
 
@@ -46,34 +45,32 @@ CONSTANT: homo-sapiens
         { CHAR: t 0.3015094502008 }
     }
 
-: make-cumulative ( freq -- chars floats )
+TYPED: make-cumulative ( freq -- chars: byte-array floats: double-array )
     [ keys >byte-array ]
-    [ values >double-array ] bi unclip [ + ] accumulate swap suffix ;
+    [ values >double-array unclip [ + ] accumulate swap suffix ] bi ;
 
 :: select-random ( seed chars floats -- seed elt )
-    floats seed random -rot
-    [ >= ] curry find drop
-    chars nth-unsafe ; inline
+    seed random floats [ <= ] with find drop chars nth-unsafe ; inline
 
-: make-random-fasta ( seed len chars floats -- seed )
-    [ iota ] 2dip [ [ drop ] 2dip select-random ] 2curry "" map-as print ; inline
+TYPED: make-random-fasta ( seed: float len: fixnum chars: byte-array floats: double-array -- seed: float )
+    '[ _ _ select-random ] "" replicate-as print ;
 
 : write-description ( desc id -- )
-    ">" write write bl print ; inline
+    ">" write write bl print ;
 
 :: split-lines ( n quot -- )
     n line-length /mod
     [ [ line-length quot call ] times ] dip
     quot unless-zero ; inline
 
-: write-random-fasta ( seed n chars floats desc id -- seed )
+TYPED: write-random-fasta ( seed: float n: fixnum chars: byte-array floats: double-array desc id -- seed: float )
     write-description
-    [ make-random-fasta ] 2curry split-lines ; inline
+    '[ _ _ make-random-fasta ] split-lines ;
 
-:: make-repeat-fasta ( k len alu -- k' )
+TYPED:: make-repeat-fasta ( k: fixnum len: fixnum alu: string -- k': fixnum )
     alu length :> kn
     len iota [ k + kn mod alu nth-unsafe ] "" map-as print
-    k len + ; inline
+    k len + ;
 
 : write-repeat-fasta ( n alu desc id -- )
     write-description
@@ -81,7 +78,7 @@ CONSTANT: homo-sapiens
         :> alu
         0 :> k!
         [| len | k len alu make-repeat-fasta k! ] split-lines
-    ] ; inline
+    ] ;
 
 : fasta ( n out -- )
     homo-sapiens make-cumulative
@@ -94,10 +91,13 @@ CONSTANT: homo-sapiens
             n 2 * ALU "Homo sapiens alu" "ONE" write-repeat-fasta
 
             initial-seed
+
             n 3 * homo-sapiens-chars homo-sapiens-floats
             "IUB ambiguity codes" "TWO" write-random-fasta
+
             n 5 * IUB-chars IUB-floats
             "Homo sapiens frequency" "THREE" write-random-fasta
+
             drop
         ] with-file-writer
     ] ;
index 561110d941d0624760c000a1a22e4f9cd8695008..1ae1c6a34da1d625c8ef3316d00c2df9a6ac0a2e 100644 (file)
@@ -2,12 +2,12 @@ USING: math kernel alien alien.c-types ;
 IN: benchmark.fib6\r
 \r
 : fib ( x -- y )\r
-    int { int } "cdecl" [\r
+    int { int } cdecl [\r
         dup 1 <= [ drop 1 ] [\r
             1 - dup fib swap 1 - fib +\r
         ] if\r
     ] alien-callback\r
-    int { int } "cdecl" alien-indirect ;\r
+    int { int } cdecl alien-indirect ;\r
 \r
 : fib-main ( -- ) 32 fib drop ;\r
 \r
diff --git a/extra/benchmark/knucleotide/deploy.factor b/extra/benchmark/knucleotide/deploy.factor
new file mode 100644 (file)
index 0000000..85fc9c0
--- /dev/null
@@ -0,0 +1,15 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-ui? f }
+    { deploy-word-defs? f }
+    { deploy-threads? t }
+    { deploy-math? t }
+    { deploy-io 2 }
+    { deploy-reflection 1 }
+    { deploy-unicode? f }
+    { "stop-after-last-window?" t }
+    { deploy-console? t }
+    { deploy-word-props? f }
+    { deploy-c-types? f }
+    { deploy-name "benchmark.knucleotide" }
+}
index fb23263397d9e965fafc88e94dd7c57e074e2d07..46e42cfc0543986b62d3e60f34851eee1f37cad1 100644 (file)
@@ -332,7 +332,3007 @@ GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
 AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
 GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
 ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
-GAGGCTGAGGCAGGAGAATC
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA
+GCCGAGATCGCGCCACTGCA
 >TWO IUB ambiguity codes
 cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg
 tactDtDagcctatttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaa
@@ -834,7 +3834,11671 @@ aatWRgatataRgttRacaaNKttNtKagaaYaStaactScattattaacgatttaaatg
 DtaattagatHgaYataaactatggggatVHtgccgtNgatNYcaStRtagaccacWcaM
 tatRagHgVactYtWHtcttcatgatWgagaKggagtatgaWtDtVtNaNtcgYYgtaaa
 ctttaDtBactagtaDctatagtaatatttatatataacgHaaaRagKattSagttYtSt
+atatatagtcttaaaaMtcatgttcaaDactgRttctaagagDtatttttagcgacttgt
+gRtgNctgSgRaaaaatgcaMtYtDcatcaaYKttHcatSWgaaaatDataggttatgBD
+MtgttataacaaYSgagttacgttatgtDStttaaatctcgWKtcSacgagagaSgttat
+BMDgtcggtgtgcgaNtaSHBatBtttVMgVcagaNatcaDDaKMtMYtatagaBccctc
+tDtgtatttatatKNtgggtatgtRaacttgaWaaYgcaHatccctggtttStatMtcgc
+MtaaaWKttMVtWctVtgttaKDWctgWaVttaDVatgKtagagtcatctaKWgtaaMtt
+SacBaMattaKaaHDataattgWtgttttgtcatBacacgtStacaaagtNctNtgtgat
+cHtWttcKaagagttttaaaaWacgRacatctNatVStgaatDHgttWcgtRKcatatat
+ctcaNttaaBDcctgaaaaaDtaYaHaKttNtaYVaVtttaDtctacttctWttaactaa
+ttttMagWcaatcccNKYtBaacatgttgaKgKcgcBHaatDMttatatcSWacatDatR
+cWaMtDgatBctHgScttaaaHtSgKtDtttattgtRStWgttccatatttcacWttcat
+attgtaHVgaBtacaMtgMaaagDaataactDatattagMaNBagcttcattcgtaaKtg
+tatttcacMtgBaVtaattStcttagtYgtgtcgccttKatgggtgaWaataggaatacM
+MagaSKRttBgatgacRtgMtagaSRataggtatcaccgaNaaaWSWacDgatacttgat
+tagcttgtgVMttatYctaRgHVcDtVRRtSaMtcaVtVtatcaYaHatattaaVaatct
+aBtgtacRatNtatttgaYatSaHctaNgNtYtYaYagattVgatcRtaacgYggtgtat
+KttaatMagatgRtatatgHaKccHaaaaYtgaacgaWaNgtYHgacagaYtctaVtacc
+cgatttttaaagcDttatNRgattKaaattttcatctaatgccgcaataataattgttat
+YtagtRNtaagttggtHaKttWMtDKgatSagBYcgRggtWaVaattHtatgtaaaMgSa
+aagataaKaaKgttDttttRaagaacaWRcaacDgtgttaatattaKtatcaWacacatt
+tVtctgatHRcagtttNcaaatcNctNttttataactWacBBttgBttaaaRaWtBKaaa
+cgtatcRcaMaatgYacaaaagtgBataStWYtggtatgacaKWtctSgcKHgtcNaMNc
+ataSatattgactacMcataattNVtDaRccaaatcagttttYttagYaacgtaatMtMV
+atNgKaaMaaBgattaKttatDaBcttKtccttttacDagaYtacHgttggacaaaVaat
+agtYatcataSgatcaaWVttcgaatgaccctccttNtaSBWaatttDttttcaatatYg
+gctatDcttatNctttagDcMttcaacWaaNattSYgctttcaHcRaattaataaaatcV
+ccRaattactctaMaVRattacagtgRcDtcgtgctcttNtWVtacagtHtatHaBDtcW
+ggtgctcaaRHtatgtDgacStgcaaaVKtagttataatactaatatgtagScaatRSac
+aattgtattgcagatHHtgBcaatKKtaaMMcaRcgactatKBaMaYatgKatttDaaNt
+RatattgtatWttagcaaaaacaWgcacaaHcataYtDaHgttataaSacgcagggggtY
+atgcKctaaaHgcVgctBDaVttccStagNgcSgtatgVYaMatcaWRBtVtgYttgtgR
+cYttcgctgaacNttgtgtctattWttttcctagMtagaWtaKgatStScatMaBtaSta
+SactattYNatctgtacRatYDaatgatgatatgaatYaaaaSHttaaYMaWtDcaNHaB
+caYtgVgcatVaacattMRatBtaatttaDacRtagtaaaNYVSMtcagaaDtttDHtRc
+YatacSNKaaMcHgatBaaVttactggBYgaYatttttgcDacHctWatcgtagagtact
+cattDggtcatKaSgctttatttagtDtRBacttaWYaaaattttgaccttaaWtaatgc
+RgccacttMtaggKtcBtgacgaHctttatcgtcStatMHDNagattatNagVaaaWcgg
+aaaYcaVactDYactaStattgBHtcYctgggtacatataaYcgaYagaggaggacaVat
+acHRtYtctgtaVgaYcNgaaaNatacVgcNgtaatttDcatttttcaacttSNcaaDat
+VYctSgcaccttagMgacgcttgaSttaaaatagttaggRHttaaacMatagcaWgMgag
+tcgctagtgtKgactaaHttattaWgcaaaaaaSatatgcgttaBNggttaYVatgaact
+ttttgccatataaataRatSaBctagttataBccgaaacaagatacttaattttgaHgHM
+gtaaKctttaYtaaRacBMtBaYgaBaaacaYtVtagcRgWatHaWagattWSacStMHa
+tttaDagacaatcgtgtKtttggaMtgtWtgtgcaaNaaaaWtKaaBcMWtcttctatga
+cVgagcgaggHaYYtttWgSaaYYaWtRYHHaMDtctttacaatggaaMctataagcttB
+cgHcNWaatttgtatatYtStatctagcactgtVttccagaaattaDtttaRtVataBtt
+WagcatDMVactYtgcatWtttgaaMggKaatgaaaaHtataDtgYcMggVaaatSMHtt
+tgVttaYaWaataRttgttaYttattttRtWtataaBgtDtttatatcVgaaBcaDtatg
+tcaDagaWtgaYtWctcVagctcagctatatagcRVtcaKtaataatHgNaccgaaaatV
+HBaatattcgttaVYttatttctBYaatKaagaccVStttcattgaMagSaaaaccccWK
+caaNtMYacctaDStagaaatttatcatVgtcaatacccKattgtaaagtggWgtatatV
+tagBcttDaBacaattWtDYKtatRKggStRtaaaWatBtaagtaattDaaaaBRacWta
+agtacaSttaaatccgctaaccKaattgVWttDattatttattKaMtcYtMRWagMtcgK
+gBagacgggVaaNaaatgctKcgtaataaKtaaagtccWcttHMatSYgataaatDttBa
+HccattgBttSgaaHYtaataaaMtgaagatgtttBgRcattaRaDHcttBgaMaWaaVM
+MattaatttgtgBRctattgKMagNcMtatttaaaWttgaaacatWgcScgYYDYgttYt
+VtattgcKcWtagcggtgBaSctaKatacaaVtcaRDccccgtgttBgKgggtHagcgaa
+ttaaagMMttScggtDttttaHcSaagaacactcacactBcVgaKNaDHacacttatSag
+aattSKHtcagtataaatKaaHtgaaRagaaVcBtaHtaaatcgatcWcaRtaaaattta
+WttaagtcaggRctgaWcttDttgactttaVSaaaatggtaWDaRMtBtaaaaaKatBga
+tMtctatatcaVaMgatttgNagtDRttDatcttttaMtYaaatcggagttctctaYatN
+tagaNcgMMactacHcaagtaaaatStaSaacaHcacSgggtNKatggaaagcggaaKgg
+gtaYtacSgccgBaggcRacgtVgDtggaMcYaaaMatggacgYStKKatgaBcaaRtSt
+ccSagcRccgccgcSDtgcggBDgaDtBtSSggacMttttaWcatcMatgtNMBWgataa
+tcaaVtgaataataaNatgcaaNttNctgacDMcaHccgatgKgWVttccaStggattct
+cDacttttttctttaaNcWaMWccWKWttgaaaMctDaaBactRtVattttBtcMaNttW
+cKacagttKSttaYaWSactHSaBtHgatgttacatgcatatMtttgtaacScWHBatHa
+ctggatatatctgagMgRSatctaaSttaVagcaRcttggaYaatKHtagBBactattcg
+taaagaagttgtVcgatgaVatHMtcaggtcgKSgWattgaaaVctccVgtDcaaatgaa
+HgMYactcaMatatatattNVttWtWaatttacRagKataaaNtttacaaWgMVactatt
+aSgaggVaaagVtaccDRHaaataRaHaRgcattMttcaatcaKaaataDcaDKtctcga
+ggBggacctDtttatHacWVaWgatDctaNaNcgKatcMtcMaatBtttggacgtgataa
+tagaaacRactcBtattttaKtgSaaggKtaggRaVtatagcccaNRttaccttSMaaga
+tcggDacNBatWcgaactacactaactNBtaStgVtNagcatctaVtaKatKgaBtcgtt
+tWaagWMgagRaNatHaaaaDtacagacaBagtgcaHaNatctcBccNttaagttDgaat
+aaNtcgctaacRBgtaatSttaatatgcataacccaSattKcccttDttggtcaatgggt
+tWaacgatacattBtgMaYgaRttatgatKaKgtattDtKWgataacgNBtaccgaKWat
+cttcttKtgtcttagcattcctWcaaHgagtatDMSgKtcagcttgVHaKcttDaataaa
+VaatttDgtgaaataaRgtcaVaatacttagtVatatgggcatgtDDtMtgtatBggatt
+HtgcVtgtgatcaaSattatKYVaacSNNttNWcgaHttKDaaMYHatcgttaattaStt
+gctWaacHtaKBtaaaaKHttcRWgaaWcRtBtttggBcDtgtacNttaagcKtaHgtag
+aaaaRttgaaacatagtWRaacYggtaaatcgctYaBtWDRtgttgSctaaKatNcattg
+tgtMttatccatatagctSacgccSNaaactacgNtgtgcttMatSKtcaaBaNaaacat
+aacagaaatagtagctcNcatcVgaagStaataVcDKKttcagDHDtattctaatgaggg
+RgBMctatacaagYactctMaaagtcgctttctcgtgaattatNcgatMtttaggcBaaa
+tctNtactaaRKtgKactattgtcatatgtacgagttMaaHSSgHgBatatcgcaSaata
+aaWgaagtatagaHgcttctttatgaccWaatttaRtaDaatttaatcgaaattgattMc
+atcaWaMtaWaKactttctBacactatNgtccttaWgtctgaccKatStaKtgagtacgg
+gcgcgtYNtatttagacctctKcatgatKWStcaataactaWgMSgHtgatctttttgtc
+gacgtSacttaYgcctWctcctctacaagVtttMaBactWVaccaYtgtSgcgttattcK
+tatStgaaKaccgNaataaHtatWtYtRacggcaDaScagcagHaYWRtRNcDtHtcVWt
+ggaataaaYttgVaNtgttagtYttgtagSaaatDgaggccDcgBRYStattatttaagg
+ccgHgggYRaaccMaagttatSttctttagcMtgcgMtgaSagaNaDagttSatgattWa
+tttagtDgcttgagtgMKaYWaYccagcaHatKctaKaDgctagacttattgattaaYtt
+atcttattattStaattWaRaYBWagYaatatgttRgScttgBagDaWgcgtgcVDaggc
+ttgtctaDRKacttgcaKBWRtaaVaSctKtacttMaaSVaWWcgSaNtttSWgtcggtc
+acttggVVtgagaataaataaDttgaaccaaaaMttaaaagaaaaaaaatcNBtatMgcc
+WagcaNgaVaNaaaaaaYaMgttaWtatHaagtNtacgacaBtMMattttWNaRtaaata
+gYaScKattacagctVKBtWNSKgYtYgtWatHaVatDaaatWgDatcctggSRagagta
+aaaMgatttRtaHacatggtaKagVcctgatgaMtaaYgatgtattattttHggBaccaD
+ctctggNNtYaatctVttgVtRtVcRacttNctttataggHSRtaRacaaattaacHaHg
+tgttgtttcBtBtatWtgtattttgcKagMcaaagaMtattagtStagcBacYaaHcagV
+gWtgtttcgtgDHaVtagDatcRaRtggtWtaactgcacgaggaaaRttSDaaVaSttaa
+aaacSMttactaNtcaacaattDtacttttYatVSacYtWtMttaattatcKtcttctat
+caKDtctStSaaacggtYccatgtgagagtWtagWKgcaBaaaaKttgNactaatcgagg
+cWtcDDaaaaaacactHattaattcactatYttaagacactaKaagRtRataaattttca
+tHggtaataaatgataHtggctaacBacDgtaatattRtYgtDNDBgKtcaggcHatttt
+gHNgWtaatttccgactactgacatVNttYYgactcgctctatttagaMcgggatHcgtt
+tatBaDSagBaaaagRttBggttaaBactVHgatgaatttattcaaaattgcacttcDga
+cttYcVttactVtttatBaKHagaWgtgaatggBtaaSggcagacNcttaDttVgMtWag
+attggVatttacHtctNcMatacttSatMagcttgtNcYaaScaYactcKctKtagScSt
+cagtttcatWaatggtgagaggHaggggcaacgcRKtaRcMaNtHaatRaRaaactVtBt
+gttaatRtWWcaaagKttccaaKaaatacgVttcacaaacgcggtgagaRaatggtgDMW
+atcWVScacaaaDaggaaHtgttSMaaaaaccYccDBtatYgtMagcSagaccaVcctcg
+gtVWaaagttatcNaagataataSaataaaKccgtaDtYttatYcttHttaagKcMctaa
+atggaatRgaaaVaaVtcKYaggatWcaBtDaggDatccttcYNtgcSMRgaRtNgaatc
+gttRttatDVMtagctttacatDVtatatatcagctaDagMtataccYgaggYaaatgDa
+aaatSgctctgatgtttVaaBcctgataKtagaaaccaKatatgttaDtgaDtatagata
+atacagtaDtatcNtgtDMtYcattRVtctataNtWttggNaSgtMgaaYctctDggHtg
+gHDccaccacKKaaacaaaatRatttccctttaagcRattMHctattHaRtataVattgg
+atcSttaaHaHgaaHNDtacattSaaggDatttcaaaYgctBcatattaaaKagtgccca
+tSctcgatRtaaaMtgWactttNMaWctYgRatDggaactcDcaattaKaactgagtatc
+tataagYaaaSRctggtacWtttccWtaYRtKHattatagWtKttaNgcDtatHacccat
+taatttataacgctMgaagtaacaacagMgtaYHYVtKMHtacMgKcaaatctgRYataN
+tcgttcaatacggWtMcaatYcBWaagYtVaDNagtatagDaaNtaaaYtttcYWttttS
+tgggataaMgatattagaaYtNctcttcBagactaYDcgtacHDWccKaHgttcttHgVg
+gVDttatcatKaMttttacWaaSattctatagaHaggKaDagBtaaagtcYccattgtYc
+atctaNgRgVtgaagtDKttatBKcggDtattRYgHccgtgcgBNMtttVRgacaYctSc
+taRacgtagagccgtacRaagtaHKagStSttttgYSatattaaaWHaaWagttDKaaNa
+NHaaHttaYcttMtcaaatgKttBtSgtccaaVaattSaacgttgNattgatatNctaWt
+VcagtactKcWacgVagggHaaRgaDaatcMttattaataacaBMaaVtgYtKgRgHact
+gtactatcBaMtVggtagKcYtHtBSaattagtaatgMcaVVagYYgWtactttccaaSt
+tDgaaMaMttcacttYtRgacttcagcttWtttagtgataMaattaagVtagaatatKat
+aagtagttaagHMRaDattaHaaVcctDtagtcVYcaataaYcNttNaaaHctcaRaatt
+tcaNRgatSHgVatagctRtcatgaBttMaaagRtcgHVtgRgStgatttgtagaKagaR
+WRctgNaHYgaaatBctgtttRttNWagaccgagKgtgcggHKVttaatattaatataat
+aDtaNcctacaaRgcaNMctctgaaSHWWHcttagtNagtWgWaaKtYaNgcBattatcc
+aaaSctRRHKaNtKcBgtgagaDRWBttactaaattSMctatatagaaYacDgatttccV
+taagRtgRataatatagtctttttatgtMgtcaacaaNtaaaaactctWtagaVaaaDta
+attatagtBStcgaatDtgattVaatMtcaDattVKWaagatagggttgtMRSgtcYgWM
+aatgNtagtcBttagtttctctWaaMtVgctWgSgtHagaSagactagKtagWggcattt
+HgttgacaaactcggggHggcWBgVgtatgggagVgagtcVcBtDctttagtctaagVWt
+HtgtttaScatacMBtKgattatRtgtttgtctttDggcHaBtRtgtaataNataattta
+taWctgaYWataStcHaatcRtaaVagDWaSatagtaccNDgaagtatacgttttacgac
+gKRtattgDctatRRattVtStaaactagatgVatttagaMaSaaaattVtatYtgttgt
+RMagtHaatttSttaaYNaggWagtgcacgaMcactgHgtgtgggHMgtKacttaaYgtc
+gcatcSatattgBaagtttacMtYagSatttatttaVtaaDtaWaHcgNatactgactHt
+ggWtataDcDScatactcStcDtgtcgtgtatgaggtHaaNKgDattgcBccaagKgtat
+gacKSMtttttgttcaaatcaaYtagtaSatgDaaaMccKNaMaatagaataagcaatta
+ttataaMgagtgaSgtctNYttattHaNaYYtcDDtaatNRgtatttaaYtaaatcactH
+VaHcStccttcccaaVatcVggatKtatgRaaDBgaYtttacttYggactSDtaBcaaNg
+gggtattatattBDcttagagYNMatBgttYaagactMatgttRgatacccgtaacacBH
+tatKacWgatRcHttaattYtKtStccaaatVDcaNKHHaaataatagtagtatcttgct
+NDggVaVVtaVaRaaagSaccgttctcMtVtgNBgtDtttctYgttactBctcRtStWtW
+DScMtcWSaRatgaataRHctaNtcStctYtWacagatgtatYBtHaHWBtacggtDcaa
+BtatcaggtcaVattaNctactgaaaatWaDgactNWtMtggagaattBaataYcMWYcg
+atMYatWtgattSatgaRtDaRgccagtSttatatRaBtattRcWtagtVgaagttMcta
+ttatatDttaggtctKtgtgtBagacgttatRKtgatctatttBtataactgataacKcg
+gagtgHgtVttcttgtKDgcDtaYatBDatcaatattgttNtaBacatcgcNcaKcaWcR
+ataWcVgtacgScaWgttcggHcMttcRccatgaRStYgNacagatacYacWWtggNaDc
+WagttHatMaNaatNtcDMDcMaKgHNatScVgatKWatatgNRgtccgYgaagattDHg
+tMtcHaSNaaattBatRagtaaatttacaagHWtKatcaagtccHtYcctgttKDMSgta
+ctactVctgacaaaaHgatatacataatKtStHgctScSatNatacaYttaaWHtctgaa
+tYtagtHtKaggccWBaStaDctaagagNtaatcaatcgttNgaYDaagtaaaaHataga
+atcgcgBaYaBgaacSaaWaaaaactccgcMttHttYgtaagaMctKBtacSagattcBa
+aWtaattttacRttatcgaRtacaRHgtgRagaaBcttaVgacVDgggaatVatagaact
+RRtacgYttNattVHgaHttacaaaaaaaYtcRWtgtgattatgccaSDtttatKWgaat
+atSNDgattttaacgtcSRtatggttcttcBtWtttMtBtMScttaHatBattHacYtaY
+acattcgttKgtcStSctcKtatatttcaKSgagcttccaacaccRDtttDaccattata
+tSgtcWtVaaagttgtagccattDtYaatattDaccatcVDaaRccagttttgtcHacMa
+ttcHgaNcatgttKcVttcctgtgcSataaatattgaKtctaWctMRaKggtaYcaagtt
+DttcgttacRtatgatggHNaWMtKttcatattaaDaSaBaaaMtMatBgKtttgHtHac
+taatcatcgtWaatKaaWcaWtcctVttaaNaggaaaagtaaagaDctNttaDBaBgata
+gMgaataacRcYggatcRaaaHaagatRDtVRactaYagttcaccaaWtctcSSaaatcS
+KattctggDgaacagDtaDagacagtgtaattcaStYttNaStgtaHgccttaScatMRc
+accWtcatttatRtaagatWtNataaWtMNtDVgWttgcWgtgaRttttRgWcttMtcta
+HacaaYtKctgaBagtRagacttDatNttaaaDgRtatNcHatcSDgtBatcttacVcYa
+cNgaattaacgagttgYgacttDattatacBattMgctagcctagatVcaactNttccta
+atgtDaacgYaNatagMatSWtYBaaaRtgMtatSRgaataYaScaVgtaScMagatNNt
+ttacaaHBaWtNtRtctaaacDaaaaWMcaNtcVaDNcagaDtgcWKYgagttaHtgcDY
+ataaacataBaWWtcggtatgtgaaScaacctttRNatcgttaaagcaDctaatgcBatt
+tacaattVaMgSMMtccYaaaBYtggattttcataWttgBtatDtBgactaatgtccWaa
+HataaScHttWttDtcgtcaagMctMDtaaaatRtBaaaacaatgtcagcatBgNNBVtt
+ttttcBacWtttWtSWWtgaaaaSacgBtaaataaagtcDStaagaactgttaatYatgD
+ctattactgaHtaaatStHaagacaKtagDtaaHaDgttccaaDtaaggacactctDggc
+gtDagtcWaHgRcHgDgaSctttattgtcttttccttRYaDgNactaaatcaWggcNSBa
+gttttatatStKgtcRtgattaaggtcaSBttaacaaKatgggatcaaattgRgcBagtN
+tcgDcatttWcctttgtNagDgctgcatttactttgtgtcaBgSatttNHaMcggcagSc
+tcKDtWBaagSagWatggYtVatSRgKagattgaVatKttcgatYatKYSgDaacNtcVg
+tttaWataWtgVctgcgSggMgatccatgagttgtWcatYWWcctVcNHagtNtgtKttt
+gatcaacttaSttattgatNcatWaVgNHcagStVHcggHacaaDttgDttWcaaRaKga
+aatKaattagtaWacattgaaatgtgaatgacagtgaRVtaaYagYtcggcatMttgaag
+gDgagDRcaKgHtacacaaaMcaBtagHactgKaatRtNttcttcatcatNgYgStggac
+tatgSMttgKtDaDgacRRgtWaVattgatttaagYctatatagactaagaggtatWtat
+aaactaYaHRctStgKWcgtRtKtYtYtagacgattRaaYBtaStcttaWataatcHtta
+taRcactgagtgggagccaattctcDtgDaggHcDRVaVVggaaBtRttaataaRRttgt
+aagKNcaVWWgtatacctgatcttBtcttRgaWcaVRKcagttSacttagcgtKtgtYWa
+tatcgNttcKaccacacVKctgattBtggacgtctgacaDtWKttattttgMBgKaacaD
+ataattWtBtBRtVtacataaatatttgtWtttatagtDtgcctagctHYaatgcaNaaR
+caatVtacctgggggKtagBgagaBgRaaNttttMtMagMtgtgattNctcNaKggWtMa
+tcttagWgtaatatatNctaYBggKaataBattYtaattataVtggNtcgtgtctaatta
+aacctHtacaaactDctDtctgatatgMtgataacWctgtgYSaaNScgDYaWtatDatM
+KgcaatttctgNcgtHtaWtagatatcYBttaattactcaaaVattYRWtatttDtaNMY
+MttgattataatgcgNggWaatYagttgBagNcaagaaaDtRgtaaaagctgcatctagc
+ttaVgtBttatagcKMSaattYtHcMaBttcagtcttgKatgVSVttKgttttttagtgt
+DHgNggtcaVtatttaacNtgaatatgctatMcatgaaaBtgBSaWctaataaattatYt
+tagtaDtaccggaatgagtaattggatttaacBtctSMgWYtgKgattacgRctctccaa
+tgtaggcctgaNaatScgYataaBBacaKtHtttcatgaaHtgBtagaKHVtacctVtca
+accaDaaWNHNaatgataattgatgWcagggtcMBtgSgRataHctMctgMHHtKaBtaa
+MtMgataaRWtagYtgaaMaSgctYtgcgaaHatDtatgtcWRatKatatYDcBgNtRaR
+acattMcagaHgaaagRccgcgWttggSatBagagcHgYtatctVtcatYaaVRtcaSac
+aMYDcgRtcaaWgaRgataMtaaaacaggtgtaaYcattgWgDHcWgttaVatttgcatc
+taatccacaaagaagSatgcgtagRgagtHDgaVcgtgcttatggMttttcatKSctNac
+HcctMaKRatttgatctaaatgHaaScataataatgtttgtgtHaVcaaaaNHaaaatcg
+ctgSVtattVttagaaNWcacagtgKtatgattHcYcttgDaWVataBatBttttWtaac
+tNaattttctttaaYHaMtttaaaccgStcHaVBaatcRacaaWactgtagVKtNRtcct
+agcWaatNgctKccttctcDaBDcatYHatatgcaataaBaagaatgDMttaHcaaYYtc
+actgttRtgacRaacctaWtBtBMagBctaaBaWtgatgVtttattataggttaattgta
+atYcaRtVctcttgcacSaaMaatactRSgcataKcagcaVNKttcgSatcaaactaatt
+DtaHtNaVtgttttttaWVtatNccagWttcgtatBcgttVctcBttaaaaMSaDattKR
+cctttcataHaattaatWaaataKcaHVaggaatataBYKHVtgVcVgtcHcttccgcct
+attDtMMgWaacttgWttYtttcMcgtcctaaVHtgWtggtgacKtcaWaYMttacttag
+VWtacgSatatcgWcKaaatHKaaaYttgtagtcaacWtttggtcaagttgaaBBaSHac
+VcgYgttWBSRWggtattttaYDtHatattcgatNttacaaaaVacaMccaaYStaataR
+ttVtcttagaVKaacaWcgccgtRatcatctaaatccMcctttaMggccHgYcDgaKcta
+tgMRYBagcaNDtgMtcRttgtgHaRttacatgaWcDtgctgtataggNggtgaatagBg
+agYNtatcagKtHcatBatgVKgaHWagattRDatatcgYcHagRtaatgWtcStagcVa
+tNaaaaKttgRaRBYNgtaaDtStaVRgcMccatMWaaattBDatttaatttataaHtag
+tVVaDRMKBtaacaatttttttDaRSgaaKDtVaBatcagtaaMttaagcctRgaNVggg
+ttcataatagNatcctacactacgcatgtcggaYgtaKcatggattgactttHtaattWN
+RaaWYggttcaaaggaaNtaatgcHcaaaattBtagcttattcaagVtatttWgcctaKt
+atBttDYcattagDacKVaYNccgYaYRaaMaattRaagaHtatgcttgcRagcgctSaa
+tagaaRacaRacSccagcacVMataatHgRtagcgaKgYRaDcVWSDVgRaMgcDgtaat
+tttaYttggtaaWcttKDaaYtatMRcgKccYcagtYcBgRccattcaKtgaSSRtactg
+acgHtgtaaaaBatWgcaMcBcYcgccagactcttcSatYattgatgaNccaaaaWaKat
+VgcaggtWtBcgttaRMagcaaagtgttcacatataaagaHWtKatctacttatatcacY
+RaaVagataagtaattttgatgtBctaataggtaRtaaHaattgtaRcStYSYaWRgMta
+caHcNSttVNScattNKaaKgBtagtgatYcaaaStactggttggggaBggtNtgtcaaW
+BaYVSNgtaataBNtagtatatcacMcScccVcgtVRRtttNcKaSRNaNtHRttattta
+ttgacaatggSaBagataaccgttcctaDNaattgctVtatNtHtatagSccaagctKtt
+aaacaaattattgtSHgMWgStttNaccattBMYatRtccStNgttgaaBcctVagcaaa
+atgatattcRaBccMWaagKtttttcMtgaRYNaataDttgttWRttattggHtNtataa
+tggttgtStYgaMcYVtcattaggtaatVcaNggaRtNataMWcctcYgcgagagRgcHM
+gcWtgaYtVSttgDaacgaaaatMttYWtWttcctgaKNttatttattRaattaagaccM
+KtttcWgtcaBagKSaWaaacaNtaYaDtBNaaagWtHgacaaagtgVtcatKcgcaatV
+aactatgcgaaactccNctatatMgactatttatSaaVttNttRttagHtccKtHtaaaN
+atttYVctaatttaaaatHWaNtSacgaaaHggaaatcacagVYcctaattcMNtgtYtg
+agttatttaBtcRgBHNacBtactctagaacgcKaaDWYYgcattactVagaYtgaVVcg
+caNctttBagKRcSgaaatttgtatccattgtggHcaatRtaVtaSaBtcYYcatcgtgt
+cHaVttaHattctgtcaBSNYaKBBattaatggctgtHatattgtBacDcBgatttaaaN
+tggaaaaYtNcaKagRRtRgttRtMtWgggatcNtacacctgtWKagatataaYVMtaaD
+taaacctctgtgtgccttScacWaggaYacttttKacgtttgtgataKYagaYaVatcWc
+SattaMcatBYttYaaatgStKagWattKtttaWgtagaaSgtRattcSaDagVaMatta
+ttYaagccSgcNaaDgaaSaggtaNgtWactaWcgHctgaNatttttcaatgtaMHSWaR
+tggtaNtaHBtttWWaaatattcVtBtctStWtaWMaBcatttcDagttDtttatatgtt
+WBtNaYatcccSgtgagcgaRYtBtagaDacBtaagaataWactaaaagKtaKaWaataa
+cKcccgDtagccaaagcggaatcgctSRtacKgcactacccHaactMgtgccaBaRaaaB
+VtcgSacRKtttStgatcaaHgKtaaKaccHaccacccKttgagcttcSttttKKcgacB
+gggtYMaatcBStcgDBtMcataWtaWaMtgaataagaaDatccSYDtgBatgactBaVt
+aagatctcNMgtcaWKtgcWggcgatacgtgtttatttWaDaNWBNaaNtNttcaaatag
+taatScgHtMWttgttgaBaDtgNatSaagtttHttaNaNKaattKatttgatcgtVcat
+gaatatBtttctaacKaNttVttSagccatRtatatcactcHHatctWSKttaMacaaDa
+ttccaRaYttttagttaatattcctYaacVactgctMcgagcaMYtttgaagctagtKgN
+WttgaaaMatcaMcttcSVatcaatgtNactaaBagatagagtDMgtNtNWatttSaHac
+tagaaaDggtaaaaNctMaatagtaHgacgMaaacMtacatHtaSagaHatYDccagtBt
+gaWatcYtVaagataattgatcgacctgcaacgttttattacNMWNcattataDVDacta
+tattatYattttgcgaagtgagYVtagYaWaHaatctgWttttatgcHaacgttaccDaK
+tatagaccaDDttaacgtHBaacatccgtYaBtVtNccaaataaaatVactDttSKtcMt
+DSgaagctaMtatattgattactgtNaagNBcagHaDattaaaWttacacaaatactcaa
+tSDatagctcaDttWactttgaStaaDtagatSaaDtgtaatKtgVataggaagWSaaaa
+KatttaaagtttgcgtaaagcccggNWaacatacatgttctaRcaHttVtcattatctag
+ttttNcataaacDttWaagVtNYtaggctttggtatgagaWgtactNaVatcactVttBK
+cttaaccttcMtatcggtaataYaMaYggttgtcaaagSWHctaRMSatVcggactMata
+tccgaatcttttttcgagtccagtttgaMtcgcatcaaKagtattRMaaaKDBttDNcca
+tttttaaBNtVtccgtaatgaKgtcagMVSattatttaWaattttaHNcaaMaHttgtgg
+ctattctacDtgaagattatcgacaaVRHttcSaSaatactNHWaaNcgtWaWgaccgRS
+ttNtHtcttcKatYatatBaagtcgctBtgagccatatScctKaagaaKDaWactWagBg
+ctgattBagKtgaaataBaaaaagSacScaaagagtagcgaDaYtaMcaYcKtaataMat
+ttttaactttgYgtcgaaggacgcHctBcgYgaaVacRYagagBaaYgtagattgcgagt
+caagtStDagatBgtgaccctaSWtctDgactaSHttctWatWttctaWtatctYacact
+gBWatKKctgtatYgacaaHSatYSaNgSagtatagatgagtatttatgaccMaatgtaH
+tStaWttgYagccaWattcagtBaYtaaNaBtaNatactggcttWcaagatDctacggaN
+ctatcacatSgKgattgacgacccccgagtNDtattgagaaatattaatcVttNKtaaWt
+YacgSNcBHgttgWtatgtttcgccaactKaattaRgacgNataatctacaacKgttBat
+YatNMSaaaNtctKgacttatgcttatKtcaVtVcagDaataattYgNtRtHaagcaata
+HcacaVgtaNNHtHDatgttaMNtggWagSVaRttcMVDtcttWgtRttctacKaaVttc
+VcgcatcctHRKtattSgttSacgaagtcccRDVaacBWagtgYtKtgattgSgaBtgcc
+BtcaKacaDatacttHatcattNatttacgtcagtgaggcBtaRNaRcaSgcatattatS
+tatgctYcacgtattcattaaRtgStcttWgtattKtSYttNaHaRtNYcRaYtVtggtD
+cKcttctactaMcacggcMtacgcttctatatHtaatggcattMDtaaMaKattgaagtB
+aaKMVMNacKaDtttKNcgagctaaagtccMMtgagaagVaataatggcaWaaaaVaBgt
+aSaVgaaaSaaaataDttVtBccaNagcSBgaMaDaVaVYYRVBgttYMtagtaactDta
+agWaattBtattttMDYHtSaStScRaKatattacacctMttgNBKtcRtRggNagtYMa
+ttaaatMctYgaatgcKHagSggaaaaBcaggtHtatWcatcgtStagMcctcatgatta
+WRcStcgWtgRgttttcctaacatcgctcgDDtRaatatMgtcMtHtMaDYatgDattta
+tagctKDtYHaaaaattaSatatctggtctttattttatMtgtYttgtcatactcaaVcY
+BgatgSctKtYcctWaRaataWcMgNgcgggagtcttRMgactataHaHtgctNtVaatc
+aaccacgSRaDtgKtaaMSKgtaaaaWaKtttVagSDtaaaaaatgttYattttNagMHa
+aRtNgBttWattatatgcttatatcatttatKtKaaaagctRaaatcgcYgacgNtacNt
+ccVtSaaatttcDVctaatacWgcaMtcttSaaWaaaWagtagtaattaactagRttaVc
+SaaatataacHgHatWaattggaagtgcgSSgaaVtgYgSttccatWVataatcgaatat
+gHtRcgtBttcttaaggatatgttgtBcNtaatgtcacVatactgaaatMBttRRcRatc
+catagagggacatcgccWttagttgWttatKagtaaaagHtttccttSatVatKtgagca
+atttattaaYVattcaaattctgSattRaMtgaatMgttattattacaNcggVagcctta
+aKgccYcaaDattWtggMcttMacWttccMVgtgaattctDaBYgacttKYtBacatgct
+DcRaaKaaRaatatctttagKcKtaactttaatNaaggctgScacctYgcgcaaaccaHt
+tVHcBaDgtaatHaHVaaatMgttggtSatHtNNaaVagtgtacaataaagacgKttcaa
+aWVacagctcacWHaatcctgtBNWtaNMKcVcVSWtSgcaattctgKtVVaaacaRaat
+tgatRcgBacaKacVccVMactagcgMNaaactgataDaSgagaatVHaatVSVtccgga
+tgRgtagRatttgtaactaBataVaggcaagHgaaSMSaKgctRagcStNcatttVgcta
+tacttcNDtcaKBDcaHtDcaatagttHttattMBgagctgtaaagtMgatStStcagat
+atYcBtataacRcaggRaaaggtaWSatKgatatgagcgtgMYatcagcatVttSgaaaa
+aatatatgttYttcattatacataatVcacgattataDggttBtRaagtHMtatagaDgN
+ttggDaKctBcaaRcgattcgtgccttacaaaWattYWVcaaWagDattgaaagggaaga
+HattBtatVggtaHtWtaMagtccagaKttSatatcaStDtgWaagtKWaggtatttaWa
+aRcattaatStgaaVtacggaacatKctacatHtaaaBtcNWatttBBaNatRcDattcg
+aactataaattataactcagtSgatataagRaYaKHctggtaaNtttaaNgaRHtttatt
+atacNttttaDccttYgtaaacaggaagtgataaacatBgaSgtaaaaaaVcBgtWNtRM
+ttBttaaBgtaaaatatcHNStaBtaggtaVatYaccNtBaWagRctNSacRtMatDact
+StVctaaDtaYSRgttaRNttttKggccagaaBcatagtYcaYNtDatcgtatVcaatWR
+taggaattMcatRtgggatgtcMggMtttataagtaBgtggacNaaKYtgctWgagYtWc
+ctWtVcttaaactaRacatggtRcatctSDcHcMgcaactttttagttaccttattHRgt
+acggcactDBggtMHcVaaRatKctSHacctacaccactaaHaacgSttagKtKttttgN
+HVgagtaYaMtVYNVcggttaSBaBtaatttSRcgtBgaWaatctttttKggacaWKaat
+tKSaccttgDRgtcatatDatVMtMaVcgaattaNaagMWccctaaHgataatatgtatt
+WataaaatBaaMtgRttcHctaagctaagatatattMcggactaRttttKaSttactWYt
+gBcaMMacRRgNtactttaaaSKtttcaYBaBttaVagtRtHcWaggaVccttNgtgagt
+catataWttYScMtWgVRgattWtaSggacggWWctBHatattataaKaagttactaMRa
+aataSRaDttDaaatataVHaatggaaBDgWgHtcKStVcatHtaatcatggBWaagHta
+gtMtgHcHtcatggggWcatacaHNHagcDatRcaaattcgcttgDggDNVcaacgSgtg
+gcaccttMttaatattVYtVgaagRttaBcagVaYaHcaRDBagatgaVHtNMtcttact
+DaggMgMaattRWDcctVtgagaaaaSKatHHttVDgtctgtcacatHNttgaatSaagt
+KBatatagacaaRVctcWtgtacKtaacHtgHataSgVtactaggtttatggBgtcaaaY
+aDgaaaaaatcgMtagaKaYatgaattatYcttKtacaatttgWttMaatBgaatSttMt
+NaVgVtScgcttctBHKgtaRcNBaatcDtacgattgacgtgctatNaaBtMgagNgKct
+tWcWKacactYgttVgNcgaattttcttgaaaaactacccctcgcNtgMctatcccacMc
+actcMatttatttagtagaacMNtttcttgYKaWtaaBtttcWttagHtgtttctcttgt
+ggctatgDgctaatWDataatttagaNcgcRRNataKtctaataHgaaMYctNaKWtact
+aacDtgaVcgagaactggtaccaactHgaggctagagHHagtMgKtaaactacaggMatg
+tYgSBaKaaaattMgatRtggggtHBVgttaattgKttaaRDacgMactcaaacStaaag
+ctctgtgccttcgtSagtSaRctacaataKatattctaVgtgtaattRacKagttattga
+MtaatgaNatacDataaggactttccNtStatatKaagaataKtatggtcctctatgagg
+ttaaDtgtattgataaaactggatcactKBtttggcgtcaaagaaaNtagtWKatctaaW
+BactDaBaYtacaWtaSgcaattattWgaaBgactgaKctatBRgtagttaBaRRgattt
+aagBHctStgtVYRtaaataaagtMWtcHgcattcacaaMWtcMccWttgVgcHaWttca
+NtgtVaggNgcVatKttataaWDcccctatgatVttttattacagRBBWttcttRaWgaa
+tBVgcgtHgWgaccagtYacaattgSttaaMcVtDatttaVttRgttKtcaYWatKtaaD
+tttWaYtaatYctSctatagtcctBtccMaMMtaMYHaSSgKaaacttctcBtMtgDtgt
+ttttagRcgtacttataHgKtNtMtKcBtaNKaHStgSagYHtataDtcKtagRtNWaac
+VgctVtRtttStNtgaaccttaVatgagaaggtcaKSttaDataagcYaSatNStcaatD
+NgttcgacaatttaSgaRaBNNacattRatNtgSttHVtgWHgtSHccaactKttYtatH
+YttVtgHcNgactMcaacttBatatgSgattttacgtatttgtggtScaacggYtHtgca
+tctatttttWtaSatcagaYatcgcagtgtgtMgtattctttcattaRatttStcaatat
+gcttDtStaaagaccDcVtaWNcHYtWMaMcgaacKcaNcttacctaBtgcDacatcaHK
+tRcDaaacataaRacNNtccDataNactttatBSDYatDtctBtaBatctDatKaMcatt
+MatatcDHctaagRgYVcatgttcgtgataHDYaagttSgHYctaaatgtaaaactNgta
+gaaactaattRaatcttttBKcgaatSctMaggVaVaaatgagataaataSgttKgtcat
+KaKatDYtaaaRttYaMtgctcSatRtagttttagcaaNtaKgatcgWYcacDgaatcaa
+tactgBgaNtaactaaWatatacaatacactaNatcaVaKaaMaaaaaatcaccBtgttg
+NctaacaBattttaaKWcaggataWMtaattgtaaHtgVtcgaHtScaHtctcHacVata
+gtaMcaaKtcccSagMYtWcaaatHHtaagRttDagtMtcYtttaaWWaaaVaRtcHNtc
+tcSttagcacaKttgtagtNgWYtatKDtcatttgaacctcKHtatccttattcttNggt
+BgtgtKaggWtYgtStgtVaRtaRaaagtagtgtcgcKtKagatgagYtttaatKcScct
+gaaaaaRaaHtttttaaaVgtatagKctaNtKaSVgttcgagacattttRSatagttSac
+ataMtaYHccacttttctatactagtatgaBaagctttaMtgaatgtcaKYtaaatatgg
+attataNcgBHatcctaRaaactgttgacttYaHtStcatcctDaMBttgtaWgagtaat
+WKataaaBgBattcttttctttaatWStaatacgNaagtWaMaaNgactMtgaaDaggaa
+aSctaSSgatatDttattatcatagBcaataVcHcRgcStaHaaatWagatHttMHacta
+RacttaYaaaaNtataHKVaataKtatgatcgtcVaaWgttYtVcaaYggctRWttaaKt
+RttDaKtgtatcaattWKaatBHaaaaNgaatggStHgVVgatMgBYtaRNgBDttMcNt
+ggaNgtcaHtgttDcNaggBtatYtacVaNttctcWtactHYcSctgtYtDtgWaatcHg
+atDatatcHtcttatattaaKaRYaDgaatgSYcgactgcRgaagttagtStYatYtttc
+cgacactacagKcaaagDttaatVatcttaaacRaDatRcBatKNtNtaaaHtcBgatKH
+cWStSRaKaSMgtaKaBacWgDDttgYaaYttaNtDgHtatSaSataaaaMBaaDtaMat
+DaagWtggaMtRcacttatggctNataaaaatatWNMtacctatgtcaYKaRacagttHD
+agccgtaaYcaatataatcatagggaaSatgMYBcKBBtaaRVRatRtccVtgtgaagVN
+ttcttagtgtcWataVggtaaNaatVgVaKctttNgtttagtaaagBatBtgaYSagHtt
+SYaacaStcgcagaSttcDBtKtttggtctacNttgNgKNNtcaaaaKWactgaaYgaYa
+ctatHtaWcaactgttSatNVtgtctSttYctgattVaatKgtaYcaaattSgttaStat
+ggtccaatgSWccaaactattgccgttacgcNatcHctctcaKatgtagtctattttaag
+gHRatcDaagSaVgaVNccaBKtacgtttStagKgtctaHtcattaYcctaVKtttaYaa
+atYtccgataaaVttcDgatWcgBtcctaatttNaattgctDYgtgatcaatttaagggc
+tctcatcKattgBtaBagcaYcKctctttNtaacHacNStggRtMatHHgtacatgcaMa
+gtgtccatRWttRKctaaaDtcMctttaNVgaNtcMatcacHcctgWtaaStcacgtctN
+aagRNNaagMaDtactDgctttttcatcYacttaKttatgcStDaStNaMgDtaacKtMt
+acctaaWattggtttNaaVHatgaaattaattacgVNaaWtggaWatctgVatcacYctc
+VHMtVaNacNtcccaWtttgcaacctcWctHaatcttWcaaaYaBaattSctYatctaag
+DgBttagtaSgaWtBcRcKtccYatatcKBgtctttatgaaHDcgNaMatggatgtWagR
+ctStagagaagaacagctWtNtataaaataRatHatKgctNactHgttRgRgVcRacatg
+HYaNttaHtattaNStaagatgtagaHcVctcYgggccYcaaaatgatcttctagctctH
+MaMMgcaVtgHgtaagaWHHtggtaactBcaMNNctagaacggWtctttgaggHcYNaaM
+HtaYcttKaagtSccgttgggNMStatacDttataaaVaYcKtcgcattttcgacctctc
+acVttNtttattgtcttctaVcatagaattMttgtHtMgacataaatagttctMtgtWgW
+ctttcaagYgcgtNaagcaaDaVHaaStMtaaagccccgtgVgtcacatcHVaDtgttBt
+BacBtcggYttDagaDYtccMttagcttacNcgaagatRtDataRtgctaatatatgRtW
+VttatWKtgcBgactcgagaSgtaaaaagttaaWaaagtatttctcWtatcBtcataacN
+cgctcRKaaDKactRaNtagtatBtgaaatttcgcDactttaNtYgagagaNttgaatta
+ataaaSMattRHNtYtgttgaDBRBttgWttagSatgacDggNVagRWcggctacDaYSg
+aaattHgtYaaagctccVtatacattaMctttgSgacatBKaattRgtaBRtttaactat
+tctagcMKMtttctgtgtgVgtctttcDcgtaaMtaggtaaaDtcaYtatccgattcYtg
+aaRttctKaNctaYgYaattYgRttWctWttaaaccaatcactVatgcgYttgaaatgat
+KBcNRgctcatgaccHagcgaaaatgtVgccatcaBSatKccRStSattaaatttggtaa
+gcVattctgVcattMtacatMgaaaaaataYNDtDaatcatWattcaggNcaccctcBtg
+cKcHagYtatBatgBttgtVttaYBgBgataaHNtacRtcaaBaKcagNtcagaatYgtt
+WgggaNDagtatagRtctcDtDaHScagttcYcatcSYacHcagagNgtgcHagtacagc
+tgRtatatMtaatRaWMHgaaKacaBRtagHtaaaNcVHcatWBgWaaacWccggtaaRc
+attgMgttaNgttVMVttgcaagagaatcaaaaaagYScKVtgccgacHgacgttcaMcc
+tcattatgcBttttaagtKatDactccgBatHYgttcatcgaaatctSaKaagaatWVtc
+gttgtcttaMaaYaSDtaaaataccgcKMtatgKtgScaaDMaaaactgtgagcVtttaR
+cttgtaNMatatatttggtMgYVatDaatttgctttaaRtaBgttaYaaagKtataMtWS
+tcHaaaaNacgctacMttDDgactacaNaatBcagtcattatatSttaVgRtWgSggcaa
+tSataVgSYgctBttataaYRRgaactgtgHtgacHWSactYNgtttBactatWStaNtc
+StcMttgattStacctgaattctWatNaaHgMatattcaaaKWaBaataatHKgaWgata
+YcaWMBtgtacKagaaaaagaattttWttDaMtggttgtgaNMtVtDcaacNttactatt
+acggKctatttaaaaBKatagttHaatggaatatYWgtaVtNaaYgataatMaccWagag
+atRttMtgKaMcgatattaacaagatgttBBcNaYattcNgtRttgaBcctaagaSMttc
+MtcctcYattcaNaRBttaatgVcMNgaacKagatcgNctaWVgttaaYRtgctSctaaa
+aNtttgctaaScttcVattaHtaaMacNgttNtKHMcctattttaRtttVtSgtacatBg
+tVaaSSaMVaRBcaSaRHtaWtWHttMtattVcaMtWaaaNaccccgHYtcatagaaRta
+aBaatttaBccaatcRctcatagWgcBHRtacaaDttcBgaHggcgctaHtgacagcSNa
+ttcctcgagaccBggtcaagWctgVcRDgVtaagtttaattatcMtgatNagYttHtYta
+gccRatagDtaatcNtaKtacaMSgDaaaatttgHaHtRDgtaattKtaMHgaBcaWtBN
+YaWgtttStttaSttgataatgactMKatHBtttaVcYatgggttttaDKcSatttMata
+tcagtYaBtgVacaatHcaDMcccgtaataatagDataatVaaagaagaVtctccgaRgt
+RtaatcgagtcacttgttSatgNDHaSNRcggtaSaagcSaBgWSgcatcaaWatgttac
+atgattcWacMtagtgNcacgatgatttttRcWttSgtaatMRRBaacNWRHaaBaattD
+aagStgatccttcaDacccctKaagScSSHaaYHWcHcaWcaaaMBataattgDtagccW
+tcRHataMNKtMgHaBcatcgaagtgtaRgtgggaVMatgttaWRtStBHactaaRaact
+NctcHaaaggcatgcVHKHgaatcSccttggSaWatWtNcaaBctaRagaaacacgcttc
+KatRattcWtgYDaaaaaaNatWtKgaacgtNttactgWHBaccaWacggttcaaVgaga
+aacVtMttatagaagtatWtaaaNHYaMacagWagtaatttgcatcttcgaatacggaHt
+aatVattctaDaHtRKRaNHcttacatcDKttMDKaWggDtaatcttYctcWtRaaaaKt
+aatcctgccccatgcgDtctaaVMtWRKKDctaatatDgactagWtaaaBcKcacMactM
+HHttgDataKHDaDttHttatttagtcaaVatccKWtacWtSVcaggtaatatDSatgcc
+tKtatDtttagacKaaaagcgtttaaSaaaYtgattgtKtgBMcKttgDaaaagttBRat
+HgcaKgDgtgcWataatMWgcVaVatcYgWttaDatcatNaVgtttgggcttgaHRDaWg
+atttctgMHgtVtgccttBtWtaatcgttcgKgRcaBaRMtaattWgctaatMaVBccaH
+tDagaBNaataRcacYcYcHcatBgaNtgaNgKHttctYaacaaaYgBttRNtNggaagc
+WtDggattgagtHaWttVacaaaBtgttaNctaatactKaMaaaaaDtaRatttDaaagN
+ttcYcaaactcMgaYgtacaaatMaaatYtcacVaacgaaDagatWgBgaataggtWtKa
+aMtgDttHtgagttaatttgVaaDagttNMataatttaSVattNaDtKVccaaatcgaYV
+taaaacKRaataatgaBDtctRtgVcttatttYtgaHgttBWatgaatatacSaacctSa
+tNNRccagtactKagaRtgSKMcgaaDattttagtHcKcaaagtggtataaaggctccta
+SatHtaMtRKattaNRcWtccgctataKggatWttaggtaatHDRatttattRWgcgatc
+ttagSgtcttactatgYgttYaVBtgcaYaaRtDaatacHHtDcttHgBgNcccataDta
+aaaatctNtacatatWaRMBgaattaaaacgctctctcaagtKcacNacgVRVcttttta
+acttgctcStatRScaRaMataNaKagtatcattRttNaVatcKgtacNatttttgaNcg
+acaaKctHWtgaKStacMaBatgWttNSacaaKcaDaatcWaKaccgYBggMScgaMcct
+agcaDatgtttcVatgtRBtKNWHtcctWDtatttttNNSaatattcMttgatKgNgaNB
+atcSggtctRcttttttatatggtNttDYNYgaaaKctcacacYHRgttacatacttYac
+aataNaagaaaagttataNaataSatacagttScacVaScaccSWtccagKHtaatcaaa
+tVacatWacgBctccaataHaaYtMtacKacHttttKtcataWWtgtgaatWaataaaaa
+catttcaccttaHtttgttccaatcccgRBaWgatKgagtttBaVgaNtaNVBgcaataa
+gaatagcaKRttgtatcaattaMtaacatataDBgtaaNttcaNcgagatYactggttat
+gtNVtaBNtDaaDtDttaSaWtactaVtHactttNttcttcatWttcDatKaacgtttgg
+VDaDtVagttatgtcagactKaatcaYtSgttttataaataDttKttKagacWgHgatat
+aaatcttagatNKtttWtWaaatattacSHaRgtttScttaatWttacgRRaaMactcat
+BacaccatRtttgaacctacttcDMggcVaSBagaatcttaKMagcaVtctDVataWtSg
+atagacttBctDtBNWgtgKatWctYgaaStccgVaaaDattYatagtatcaacBaWYct
+gaaatttaKVgYtStNtcaVggtggaNYgaRtMaacataSttcagacVactcaVaagtgg
+tattaaDBNDaagtatatMtactatatgatRSgtttgccaacgcacRMtacRYNataaga
+tcMgttgatcataaacttVcatatgWtacaaaWttggaaactttaScataactRattMtD
+acVYataaaagMaattttKtgaBttKcaacatattVtagtcatgactcgDaacDtaWcta
+tRttSSYNtgWaScaaataagaaatKtagacataatggNaatttcSKtVWtgacagKWat
+tcgVatttcKWgagcaWgNKaaaatatgtaaacgttcactaaWgacaccBNaacagaaSt
+ctgctaHcVtttMtcYttStagYcgtttBcRtaYacttgNaacMtDRtagcatgtgcgag
+cScaMgtaatBaKataactMttttattaRcattattatacgtaagSNatVRgcttcgaVa
+acHNtctaHBKYgKaccYcttagagcccaVgatttgttagactaaacgtgcaBgccaWga
+VataggattDBWaattttgtBacWtttttaatDtMgaactaagcVtctcagBMKatgatt
+gaNaVttggatDaSaBatttcgccatatgctaattgYacatgatccacaaMHtttcKYKa
+WtYcgDtNaaDccgNaNcacacHKttDtttaggctagRVtYgtaactagctttcacaaat
+YtHaattYacaattaMSagMactcctcatgtScttcaaYtataaaaScHYaKcaYacact
+VcacataNtaBcaRatgYagVBatttgtaactttgRggacaagcVacctattacRcaaMa
+cHRagagtaVNctacagtgagacgaaaggKttacattgggacaataKNtattcaagWKtt
+gatNagNtgctaNgagatNacSatctNatttatctatRgaaaatKatNKSBcKactatac
+StcagtaggtVtcaaaBYYgctattKtWNttcRacaaaNatgaacttaRtaaDSttVBYt
+aatccagtNaaacRttagaaccRBatataWaatKctcattcSacWaacaacactDttVtt
+gacYaagagtaSgcMttBttaVNgRVagKDcttcttcNtaggttgcgacYacttaaggVH
+caagDagaagataaVaatctgtatRatDtKaaSDgattcaattYtcatgYgtgaVMtMaa
+ctaagaatgRgDtHttaaccaatStaaaaMctVDDtgttatcttaBBgccNacKMaHggc
+BMttctgNctHggagaataYMgtaMccaataattHttYttKggtKaccaactcccHtMSa
+atNactcRtttcatgcKcatgcacttcatSaatatactttVtaYttDattgWcctcactc
+YccattaDDaHaaKcaatSttagKtWtcatRcaactattaattYaDggKtagtNcgSgtt
+tKRgtDWtVHtDNcHWNtKtccgtctagtatSctaBcacgcaBtaacatgagatVtttaa
+ggcaVttBttaStWtattgYaggtSatBMBDactVtggttDagacataaactactBgcac
+aacMaagaStccaWNaaSYMYtgtaKaMcYSaHaaaatatttMgtcaaDScaKtcaBVta
+MVMRRDMtcttRBgWctaacttgaacNaatgttWgtggBtRttHVKgKcHVtatattSaa
+aatBttcBtttcDgHccBagtRBRttaVagBctRcaagcattacKccaWVWtaVcggtta
+tNaSgccgKtYcBaagcWgcatgaNHaKtagNgcHcgtgtcataaaatagagacttgHYa
+tattctaBgtttatRatctatttagacattttNtWaaSagtaHatRtctcggatttatgt
+gatBtctRggggcatWctaSVMaRtcatgKattgRcatMaHaataNcBcDcaggcactat
+tHBgaatStatattcatBgMVataaSacVacKHatggttaaBKtgtaSaWMattttMacK
+tgaaWaaWgctgRatgtgDacBtSaHtDgtgtMVttagatgattagagaSttgattgtSa
+aacagHaaatacaRcaccBtaaDtcaMtKaaStttatKagaataaNcaaBtattKaVNaW
+aNactagtYattaaagWgHttaMcKaSagatSactctatMSagtggaYctcacKKgaSMg
+cRgKtgccagNMataatccaVgatcttHagttttcttaaccataggggcttaDtYatcga
+aaMataagcaaatBttgHHcHagacagagaggcacWtacccMttacgtgNttattYctVa
+aactgttaagtKatMagttcacaaagggatgaVNMatgcaSattatcKagtHaBtgaagB
+cggagtWttVaaDaccMScactgVatccaRaSatattNtgcBatgBaaNgtcaBMgggaa
+tgagtatRgaatgtNttacaggcttaHaataaHSagatagtgVctattaaagggaagDWV
+ccatcKaaaatRccccaSVaaatttMtatStgtWagtStMaaatBctgcctKWgttDDaS
+KactctaaVRtaSWcVactggaaaaNMaaaccgcacNtaVgaagcttDNgaDBtaMaMKN
+tKccaVtgctcttMMYaaaaHaattcWgHcgtacatWaMaaKtaataccgBDaYRaggat
+atSKcScYagMtaatKHMtaaccatgHgtagDaggtgtaaatatagaKVgccRYctcRaK
+BKWtgatHYcaHgBaYtttMcatataatgaDttcatttaStgtcVSgacggtggVgtBtg
+acatgtaaSgtBgatKtKtaYcatVtNattataaaHaSccHaaagctSMKattcatagca
+cagtgBRataacaatMttKcWaaaaatagStcggRttaattatWaataatMaYagatgVt
+atccttttHaScgtBgagWcatgBtgcctatcgtaaWHacagtactgaattaaaaaNatt
+RNMaSSNSctattcaaagccVVcatattttagMcgtattNtVBactacScattgKVtata
+aKtttgNaWcttNacctagtgaNaaDcagtaWgKggaaKtacgcaaaYttatacSttgYa
+YttcDNagggttVDagHatSgtacYVatataVattataSataacgKgatVtVacHYRWtt
+atcctaaDtgtaaDgRDttttattWtaaDttggatcattNgtVaaaVggaaggcYgSWaa
+attcWHcgaSaVWaMatctMDtHBgttttaatctaWaagatatDKtVttaccgaMatRaa
+aBttaNagHatDHWcDtBVttaatKtMataYttSRHHcgtaHDtggttccaaagRRtaWt
+VctRcaNDttatacgatMcaatNHtacgaattBaatHtcccatctctccBtgtataYcta
+tgtcgaaDYWtNggatNcacRtMaatNtKcttSYSctaDaaaggctDaStatKtataBgc
+VaatttggYcttaaatgatgtHctaaccaactttgggttcMaaDattatKtVacgVcSca
+actSataSccHttYctttgtggcDtMcactaNSBtMRBMaggttWKtattaatgtKHact
+tcaMVatctgttgtccaaYNtaagttKaacttctHcgcWtYttatMBgBaMacaattaDa
+actNaaatSatcVtSSgatctatgNatSYaattRatgcDgtctataagagaagRgatatt
+tcccaataHgttttWKtgaagNRtctaaBtWcHHcDgaattgaaaKtgttaaRtatgtaM
+aggDttcMaccaMaattDctgYctaWtStaNtgRKaBtNcMHcSttMtaKccYacgNNct
+ttatStgVtaYtaagttaagaBHaaStVKHatgttRVWtataMtSatgcaattcMcttat
+KgMcagtgaatcYtcctNaYcttactttctcttcatggcgNcatScStBtagctWtHaaW
+attaccgtctcgtBMcaaacKctcccaacttBgtWStVttMRgKcVagHttVtaagMaNa
+tcaHttacatcYKttDBtatgSattVcgBcBVYttHNtcatKgcYgaaSaKtatttttMt
+ctatctaSaattDttcWagHSacgttagYgacWaSaDKatcNgctaatgVSctgctYgaK
+gKtaataggtggagcgtcgaaaaRYtgYWYSaatacBgacWtaNStcaattWtRctttta
+aSYgttcNgtBWWgtgaatHttttBaMcMtKccagtattttcgaHaDtSVgatgaacatg
+cacgtcagagDYattBcagDctcttNcNtaaaatRctgMcDacaagtttagtcaaSSaag
+aaacatacaDtctctYgcaaacBcaagaBatgtattgacgagYacBDgttcgtgRtaMga
+attttcNtgVcttctgtctagtgtccatatctgatYatNtatVWgttacaDacaHDDagW
+tgataWtatcaaBRatDRtMgVcgaaattcSMagYgWacgggtaacaaattcagcatagS
+gttactBctgSVWatYcYgcBWgggRcHtataSaattBcagHgcgcctttKcttWaggct
+ttaaDtRacBactaaVaaKtaaacctcgcgccattactKactKSDcgacaVtatatagga
+taKctcgSatgHSatVcgtagtgaBtSYtgaBataatStaaccaagttcaDtHtatatta
+acYatattatcctacgagatcaccgtVSttctYgtcataaVactcgWtaVatttgttgga
+ctaaaVcaSaDtYcgNtYtctVaMtaattatWRtWcaNtaKcaaYggatgNgaatcaatc
+RtcgagtHcgVgttataHDcatttaagttctHtcgMRHtaaagaVactBMtatgaagtaa
+aaaBNtataaNttcKcctaNttaaDtcgMacgDcaMatttgYtaaNtcaccgatgagMtg
+ttaggWcacHttNgtcttHYMcaattKcagttcNcaaaacgNaaSattgKttaaBaKtta
+tttaMggHcttttaaRNVgttaYttttMVRtYVgRatKcgVtacgaatttccBatBgYBR
+tSKKctaaaatgatatgBtcttcgtttgacHagtaattatatctgDtBttatgaDtatKt
+cKRcRttagattattagHgDNaaaKgcgMtHtttKtDtgaaaagtaMatcagaaccgaat
+KgtatatVaccRaKYtDHtcSagtBgtgccWaaaggtYKcaHatDDaaattDStDtcKgg
+tMgcMtgtHtcaaVcgtttNtagtNtgKgctaDcScgBcWSatgtatagcKgWgttgaac
+gagtgcgcgtKaaaacgRtttccatatatttttMgaKagcVcVRataccWctctcgBcga
+ggcgttaatgaHYtttHtaSWtagcagtttKtYaacaaataMtaNDatRgMBaBacSaat
+aSDctgaactattgataaRtaVtttHatWaacWtVaHaaBDtactYtaDactttSgtKtR
+attgatttatatattattataattBatagattctaacDcRMaaggttcgtcatattRVYc
+ttKgtRcgWaatcgaaWWatDctacaaaagaattHaatctgttttacYatKatBaccMaM
+aaVtcacStaaYgYKgtttctcattatattNgSaaHtgRaBtcataKYtHtacttgtaca
+aaDtYtgatagNRcYatgaStaaagactgtcWDtYaatVaNStagaaaWtaaaataDYtc
+aMatSVBVaaaYagaaaattgtgcDagWSaStattttaatNcacgataNBtaattggaat
+gcMgacattHaattctctaaMatactaBaaattacaHWgBNtNaaSattttaacHtgtag
+tBtcRtttSaNNaYaMaDtatDtagaKggYgcaaSttgctactDcNRtWgtttaVtggca
+aactattgSgaagtattatgDgcgtgtcttagcNtRctKggtMaHgaDaaagtactgtcg
+atttagatcagNggtaattaKaatgaaYaaHaattggttVaaMggatactctaBgtYHMc
+ttccVcaaWtgttHHRgagttKaaagaBtaRtaaWaggttctatRatSgtatcYtaWcat
+gtaBtcaatctaatRgaYYtWtccattataBacttWtcctaHaaaaggttgacgtRattK
+gaagcattSBtttctaNcSctSStNtYtWaWtgtagtcttgtctttaagNKgaagacgDa
+RgtNaBaVDgaattggaYtaccSVYKctSKKcatagttgSttatcStactcaatSMataH
+caKgatWVYtNacagtttBtRagYHaagtaNaaVVDgatattMaagattagcatcctaMa
+aMctgNtMcSaRcgctHMttaattDtttYttcgataaagtMtaagttaWaaDcaatccKg
+tgMMcatBgtRtaHBcttgtBaBggcaDcgaWttgggtaDaggtgatRtYaMWDttatcN
+tVcttRaKagctRgtgcNaatctgattatagattagtatatgaataDNatcYaggKRaca
+atcaHcaagttagtKgRatRgttaagaaaatacVctaaaagtgtaagKVgcttSWaaHat
+agHctagtDgDtSaVtgatcatttaNKgKHataKBctatatWaNgtttgcRaVNttaDgt
+cttagHYKatYaVaBtaatgaBattaYcNtgcaBtHaacttVtccatDagVaaaYgWtND
+BgacagVgctcaRtaHaaacttttacaaggaSRaaatagaagaatacccVaHatcBRtct
+tttaaDMHWtHgacMtctcaagKDttctgYctctcNagaMgcgaaDWatMcMatatttDc
+tttactaVSctagttcaRKWgtttKRaVaaKtacaacaKttatttttggcctataaDgtc
+BctBDgcYYaatNactcaaRgaRWcgattgVNcWaatctgKagDMgctatKttRatcatt
+MaagtctaRaVaattKctgaKtatccgaaRatcHMaaaaaagattccacgtacgaDStat
+atctcataggtacgcgatgtgaaggtHYtatWagKVKgaMDcaatttWccttgKgagtct
+agatgaatgVRcctaMttgtaRaaYtRtaacWgaaaMttatcatNcgttactaaggtDaa
+ggcagtRctcatcaatggYagccagcgaatatagtgttWtaccaRctagatttDtaaatR
+cDKtccHtBWgttctWaagccYBSgtggaaagHNttHtctaaattaBatggaDMgaBgat
+atcaatactcMtaaKtcYccgatDaYgHDBaagBattWattgatttttaagaRaaggatg
+gYggaKttaKtBVBcttaWcttBtacctYaNYttgctgtBaaMtWtcWaagtaaggWcgM
+DaaNtccWMWtatcMVgaSaRctaKtBgKWDacDgaaaaNgttcaaaaataMcttaWtat
+gNaVaaRataWtgKctRatataagtgttgacgaKgaNgtaHattaaRagSgattctatgt
+YtcaattagBYBatccYtgtNacHagHtacVcVacaacaccgNgBtataYaatWHSttat
+tgctDacttgtgHgHcMcHacagctRSDtgattaggaDHtYagatggagWtaMatcRccc
+acRaaaYagcagatgatacatatttVBBcaaMtctctaWgaNtttcctaVcttaYBDBct
+RgSaagcNgatttcacgtcRDaVBttaRaggtaaggHcacttccgDBKgagaatttataa
+aMaRattagcVgtttacaaagagaaaMtgDtttYttggcttataKaStacaVttBttctt
+gBcVaataaagagtgagBgcgNcNattgaaacRcactDaaccaatWMtaaHtBgaaacaa
+ccctcMctcaaatctMWttggttttacttagcRtttacatRtccBttVcatgaaBacaYg
+agHttatWDtcctSatRtYggHtNMttRgNtgcatcacgacagaHgtYaSaactgaaNWV
+agtagttagaNgatctgcatWYaDacataHtaWttaatHaDgactYgttcaSVtttacct
+aatttaDgRcagacaDtgcYVttaagaSSKBYtgHtDtNtcgtcWttDtgtcNtgacKag
+cactccDMacDNcccctWataRKcaaatttctRVaacagcaMtataaattWBctttgKgV
+catttaVgtDgtatHtgtaSctagtatagcBtBtgtatgtcgcMcgagttctacgaaBgW
+ccgaWatgcaRtWtaagYttaNtcWaHtgattYDatWRgRWagtRcHggNatNttWaaac
+aSgcaatMatgacNgggaSatgatttcBHcctaaggWactacagaaaagctMcaaagaYt
+HVgtaaHKgKattVaWtttcctaWgaKattatgMaattBgaaagtgaSaaaWtSNBtttY
+ataVgNatgaSgcBaaccatattcctctagRtattatctttctMtgaRtctcYgaatDtR
+cHgcRVtWtaacDtcacYatRcttNgcgaDtVctWtacHtatatgtatKaaggtaNcata
+KRaataacacDctcctWgtSaWcatcDgatatBtaatHSNBtcaataaStHtacttaYaD
+aMtaagMtgNaaaaNccccgYWHaatgcBcttaBcgtMBKggccaVgacaWgaaaaaVYc
+RKctMgcaccWctcSacttcVtacgaagtYtcctttttaYgttattaataactSttRggt
+cVgagWRStatKataYcaatNMtacttcgcttVBaYRaKttaaYatacagctBgagcttc
+HcaatBaaaVcgctcacaMgttaHaggctaDtSgatattggggBgRMagtaattggattg
+YYHtVtcttSRYaacttataBtNKgatVaWSDWacatVcttgttgaagScaDaSttcact
+aattagatKttaMcHtMgKccaYatKataMcKNgattgtYtaaRHHcaWagctgtgcYat
+MHaatRDgtgttYctatNKtSDtaKgcBttgagtKtacatgaaggcgMatDaWtcBatag
+taaaatNYtSVgVatttcaNgRtaRaaNBttggaatVgaaaaagaaggtgNtttVBgcct
+tgtgaBtgMgtaaacBgtactWgtaacctatatggaSYattYtVgtttaagccaRtatRM
+cgWMgDVSNgataatBRccNagagStHttBgctaBagatattaacaagaggttttcDaRa
+gtcDgtHttcataagaacaKBttaBgactaRatgaaDYHttgVagcMcBDgYactWgSga
+cBataMMcttSaRHgcagKcgaaYaDgttcataYKcttcMWttattaaBacDcttDtttB
+catVggttVHtgtMgKcgaaVgtcgMaaHHYBMaHtaaKaDttaNgNtttttaggMcWtt
+NaaaDaaaaactRgaatagSVHtaataagttStccaatcHataatacMcattHtacaatt
+tctgatggacatatgcaaacaKBatgcagacagVcctccgcaacNatcMaHtcMtaSctg
+taYgtStcBtcatDacRggttRgagaaHatVcttYWgaDtatgYcaBKgtSWVYtttctW
+ttHtctaYttttaBtcataaNgtBRaNcgttKgtgVKgggVtWatcWagttSttttttaM
+aRWtccgttttattaHatttBVtataSctRWtgcMacaattaStBcacggaatRatactV
+gaagMaaagWacaMgctaacaHctHtaatacacgaYagtcttKagcDttaKBHccgtaHa
+acaKVtcMKcaataaaNaggttSaatcatgaNaaBtacggBcaagatcRgttttHaNgtK
+ctYatBHHtaaaDNHtaVtVagttVacKtcYgcattcatacaaagtaacKaKKtaaNtNa
+taaNaaSaBtagaattctgacacNtaHtataBDttBctataatagYSctgtaHcgccgaM
+BaggttaMHtKgttactaaHaacgDatataaagcaWtgaMtttgVatcKaattcgHVNat
+NgDaaYtataHacaaacaagagtatatDStgcNgcRtaaWVVaDStNgtcaaacgDttaa
+ggNttWcaVNaccctgaaaMcagVYVaMtBgtatacSacgSgNtaaaDtRaBSaWcNacg
+YaggtcaYtattagVStaccgatgSStMattctWtattHtHaDtatgYaatattgtttta
+NggttVatcttRcgaNtHaVaStgaagactcacaaatcactgataaKBtNHtttctWWta
+ttgactacNtaWatataaaBaatBttgggtatYtttYtgttttVttgagtcVaMVgaatN
+taaNgKMaacgtaatattKWggcagtgRttgtgacactaaYacactggaaKaWYRgcatg
+cgttctBcttggtVaaWgtttHagtcaatctcggaNWtaatBNcaMVKStaNcMtgatat
+aatDYMctttcgcatgcYtHtVNgStggagcBtggMgccctgtgNtVatactgcctcHca
+taDBtaStgNcagaYttaMtcaYtgtagatDaagaHaaaRcRataattcaDtcaDgttgt
+atRaaaaYaRgtttDBgDcgaagcNttgcVttcacttaMgtMWaYaattcggaDcgaVtY
+attaBYaaaattaHVttttWaacDttaRaSWactcBgaRctacaVStBaaatRgaacMSa
+agaatagYtNctcaatagctNttaVtgctgtttgYcttaatgtgMaStactgDBagVSgg
+tSKMYttDatgtMaaSaVtccSRMgaaaactHaatWWtcatttctDgcMcggVtgtRtca
+tctttNatcaatatYaKaaaatKWtDDDaaactaagtacRHtcKttacaataggttWctt
+ataSaYctgctVtaaVggatcctaHVttgWtgHtWttaDHaNgaccctatatgcWtNtta
+cctaYtttDWtttaggHNgccatattacKggattVatatcRcggRWMtgcaVRaaHgtaa
+taattttaggtctcDccaatatgSaaaagatDtaaVtYgNaHBtcaYttaaaaacagata
+taaagttaaaDWccMHMattggtaaagtccgaKtatDKaVHaBagaBatactataVttDt
+tDaMagctctaaDSggtttgaDacacVatcttNtgatKtVaBStatgNtgDKYcaatcat
+aWtcNatYccgRtcgBHacaBaatagaVtagcttgaKagcgHtttDNtgaagMttStttt
+gDDKRWtagtaBgtgagtgBcaDtWtaHcctatHatttgttWgagcggDtgtRDRcaaat
+agcacacRtDgtgVaWtaattRacVataBWacSYWVctgYtWDaVtaKataaacttKaaa
+MVHaaaaKNtaaacttgVataaaatMaaatMaagtatcaaRtatSYRtBtaataattgtt
+tgaWtaNNtctcaatNaataaaaaaattgaaaattattgtgttaaYatccccHtaNcatt
+cacttttaMgVDtaDMtcaWSgYWcSYtSgaatHtgctagaVattaBtaaaYgatattcg
+aaBtgaaDacacatRaagcgggagggDMtatDttaatttggaKSNtactRMttactgtBg
+gcgtcatNttctattaVacgttccKtVttMacttWtctaYcacgtaVtaaRgKcttggat
+SYatattttgttacaaMgtgagagaSatattWcagDttggNtNaaYtaggaaKtYHcttg
+KattWagNgtaagHHVatYatcattaaaaaYtHgttcaaaataattatBgcaKWKtagaa
+tagtatBagaaMtattMagaMtHcWgYcacgttagtgtDNggctatNatRcYYHtaacMa
+SStattRagRcgataaaatWNNatgaaatttVtKcRtKtDtaaMcctccaDRcaHtBSWc
+YtaKttcacaaMaataaMaactccgSgtYattDtaWctagatBtaatSgatgatHKgttg
+caaaaagaScHtgaaHRDatSagatcBcggcatcatYVaatgMaatStgNgWaaaaMttg
+cYaaagttSHaYgaaatHattBgtaaMRagSaSacBaagtttttcatgttaaYcagYtgK
+tYctaStcaagcgtaVattaNatWtHgtHKNDtcNaKaVaStSacaaStttagaaataat
+gcDSatgtaKtgMMtcaaagtNattacMYgtgctNgVcaaNcDtaaaVtYggtaaaactg
+caagaWNcaaacctDSaaSgVaKtctcatataMtggBtaRttKtagRcctgttaHgWRaa
+ttgDaaatttHtaccagctcagaccKaaBctaagtatWtaVagBgtttatgaHaaggatt
+StaactWacKDVtMHccgtacaMWYctDtagatttRctaccRagtWcWgaaaaMcagttc
+tgacSctaaaactgaatcacaNcaMWtWccYgtttNaatttggttaaNtggttSattttc
+aacgYVccMtcgaactBtatcYttcYDVMttcgattaKWtatttagcaatatcagWatgc
+RVaatgRtacWaVVBttggatRtaNgRagttDYataacDVBcaaactttgtttgaccata
+gHMtRctaWcgacagtgcVcaaVgRgtaagtRaaaattSBKacBaatcagaatgtHattc
+aVRtatVSSaKatNataWRVaaagMaacataDgataWHatcNYcMtatttggaSatttcH
+cgacaYcaKaaatattacHcSaBVatHacactaMDataaaggcacaacaSacctgtaaRg
+tcccaaaatWtDtagtcaagNtttgatDacDgcagaDcWgatDaaKagctDWtttatatW
+gDcaaaWttStDtKtatSagVgaaKtaacgaccgMgaSaatRRcagYtgttNDggcHSca
+aYDWtcaacgtaHgaStKtgMtRtaatccagtDaaacHgtacaaccHtagataNaattat
+cVtgaKaaNaaaaaaaagttgMgtcRaNaacagtaKcaBgtttgaMDgDMacttattatg
+aDgagcgtcacaaRaagtYaggMtaaactagaacagVaMWataggtatHagtttaaHtca
+gtaaatgRgcatgRctgaMttBaaataagWVtcHctgtgtYaaaaVtKtaSaaBatMttt
+gttatattattcaaBYctBWtggatBtgaggDagtgcacVataRBctaBaaaataatttt
+tNggtccgtVaaaaataaattBHaatBaagaHgttaagcctaatcaaatgaYtKaatYta
+aggtMgaRggtWgggNactaacgaRaaattSttWtaataaVtHgtacttNtaagHaSacg
+WggaYggNStcctgacgDcgHggtttHggtNtMtttDatNDgtgacgtatacgatKatat
+aaacaattSaaagcagatKtttSagcaaMttttgaKtMtagtcRacctKSttBttaatMt
+gcgttacaaagaVaataattcaSaaWcBVacYKtacaNBaaKRtRtcgWtWBaRKVtYWW
+WgattgBctaaatKaattaYtMtSBMBHDtBtaggDtcNctWYagtgSaaBaVtcttNgt
+cgttHtgtMtctatKtatVggKaSaagtttattttatgtactactHtHttSMactatHca
+agaattVataaaMKNtaMccgtgatDaHcaacttRataacaNgaatcSBtatgacBcctc
+gggtaatWaaWtacacaattctRVgattctatgtgtatHagatagggacVaattttDtNa
+WKagtatatHtagacgaggtatgtcagtgagHccccaatNataKMBaHtcWgctagtgHa
+atBatSataDatatcacccaagattttcSatKgatWtgaagtcBMataaHaaMaattatg
+cttWWtttcgVKYNBattggtacttcaaMaVNcctcHatcgctVcttKatgtctctBMgg
+acatcaggacSgaKttgagtctKVYaaagtaaSgaaaHaWactgRattaaBttVaHtgga
+ttagRWtaaDaaatgatttSMBWMaDactScgRYtgaVagNctgtSBataKacStHRatc
+tVgBKaggccaRctaacttcYKtcaDcttgaaacBBataatacYMgWgctgtacttttat
+gaSaaatYcccgattattRStccaaaBagaacaaaVtttgcttatagaaacacScccSaN
+taaaaBgtaaggcDgtSttRatMYSWatcgtaacgtStBagttaVaaaScccSggaMDBS
+gcaaKaggatatacgtatgcWactccgVctNttMaYtaaatKaaatgKStaaaHaKatat
+gBtcctatgtVaBggaatBcgcaatgagtatHcYagctDgtWaaccagtatWWtaRtKag
+atagtgKatatgaaaggcaWgtNKaaagataWaatHaaaaaKMaaatttBtatHtctNac
+tKtBVVagtatcacgtMgtgttaKtaatcgaaMHtYKNcMaatgcaSaaDBaaaaagaWa
+DtWMgaacatttDcatttaBaBtDttaaSMtcagcttttRWWaataattcNctactWaat
+NaBaattaagaaacttYRHaccatatKtaKcNVgttYagttBtaaaaVtctcgVctagct
+cgSVatatagVtMcaaHRctaHStttNtcattRaatgtaRtgttaatYtaagcattgaat
+ttaKtctaKKgaaggtcgMctttcWaagcgWaKcttcYttgtgaRaagMtDatgWgYaat
+aKaatSWScatKBtYgtaagagaVcacgctHStaacaSgBtgtaNRYaaWtWcKgaccDt
+gaWtgagMaYgVVgBaRacYtcKgatcagttgtaKcgttgagNaStctggaatVtactaS
+NtaaagtaatcaattaaVaaDattHDBaHKDHctVggcaaacccKMaatVtgttacBcct
+StgBgMtScgaaHcatgctMtStaVttttcDaNagtDVaatYcggaDaYtaactaNgtcc
+aattSacaaaaRgtagaaKgtcRSNtgatBacccttMtactatKgtaaRMagataMatgV
+tVKagaRagtcagMgMaatRHNttagaagaatgggaatcHtttttSgtNgYatgtgcYta
+atgDctMaaaMccVScgcRgKNaaagtaMtacaKaMNaBatagBttttcttttYatataN
+aWcagatttgMtgaaacaBYtHaaatgtaDactatttNatttKttSattgBatSRtgKHt
+tacgattgcggtaaaaacHHtaNgMcgHaVDtgtagaagatBaaagDttaacSatttaat
+ttaccagatataattggVgaRctRtcgccVatRNtDgcagBcVaHtBaatDttatgKRKa
+gataaRgcagtaKgagttatatcaMSagttccRcttaaatgatcttataaacaaatttcc
+cttaBaWtagtagttMaacMaKaaaagHatYKactttRatgtctcgattBcSagaDKttt
+HtBaccttNttVttVVtggttacgtaaBMRgatcgtctacaaNBtaVggttYaaggattc
+caNgRgtagBtgtaBacaagtataaatBaaatKRtaMtKHgatcgYggDSgKRaSttHSt
+catgtatatWacacRacHcatYtttaacYatatgtgttNtgcSagDHgataYttNattat
+cVattcaaYttggtaRHtWtcgaBacgtttaBaccaBaatgtcgcNagaNtKtaDtgDta
+tgDaBtcKgtBgatacNaccDDatttYtKggMtYNtaactgVacattaaHgMttatcgtH
+MNtataBtKSgccaVttaBcttattcBaagtgaWtaRtcctDVRatgaattgatatgaWg
+ccacDaatKaHtttacatNttaWNWgtacaggctacttBaYaaatatacaaaatttcgNH
+gMgttHctcKYcttgMtaacBaDVtaatttacagaRttttttagcKagtKactatMRtgt
+DtaattccRcaaKSttagttttBtctatagaKaVttttgcNagtKVccttagRgWaNaKW
+ttataDgcgaatgMKatgatRcYtctgVagaccgcgVgactagaWaaHNtcRNRKaatac
+tcYaNtSDKtcVVggNgDagtttaaKRgttaDcgtNNgtcaYttggtttYtatgtaaagg
+attttagatattKMcatgYaaatcaVactcagagtRYtgtaactatagtBaDtVaWatDa
+tctataaaSgggtactaYaKKWagaaaaataaattatagRcaaaVataVagatatgtagg
+cWagacRWattctgacgcDtaBcYattgtaDggMatgagcgagaggctaaatVtctcagR
+agDtSgKNcgtVcStacatttagNtgatSNgatcYVtHattHtBgMacRaattaHBacRc
+NaaccctVaaYaattcVccatacKcttSagtctgKMNagRaNcatNgcgHattStSKYRg
+gtcagtcaccattttagtMaccctggVattHaatVagaaMaattaVacatacacaaatta
+attacgtKtagaaaMgatWgWccatYtagacKatctKatMcggYcgcatgHRtcStVtaa
+tHgSaaaVagtgaatgtgYtattaYcRagatgatcataacacSgaYaactMKttatRcga
+ataaMSatacNgaMatttcggccacgaYYMcaKattRagDtRtatMVBtaattWtMHgNa
+WDgStaaSNggStcBcVYtaYagaHtacagttccMcgtYtYttcattgSWcttagttcgt
+HtgVRYgaMacttBtatcaactaaaaVtDgataaDgtatcatYDttaStgccBacctaaB
+agttgRtaSBtaaaagWgcacBggttagcMaYatttBgtaggtRBaSagttcacgtaDaY
+aaaacDSaKattctgtSatatgtatggVBcctctgtgaaHDKgttaRttttBMHgRMgHa
+gtagMgacgaagttaatattgRtHtHttatYaaagcagatgtgattagtggcactactVa
+ttagatctctgtttatcattYttgatHcHttagStgatgactctDaaatcagtgttgttt
+ttcYaaagtatatcYcaSaacaVttcgWtatKaaaHWtRgtttaKacttctgaaNaYacc
+tNtcStatttaaagttKgtgatcctBcaBtctttaaaKagttgDtWctDtgtgctataKa
+gtaNHatctagYgatcMgtggYaagactgacacttaRaaccHgttcaYtagWtggtgBcS
+tacaMcMHataaaNagatactccaggagttaatcatRttttgaKNgSgcaggtgttRaYc
+aaataBtaDtatHgBtatacKaataKtaggaaatatgcataaHgaKttttatMaaaNgMa
+tYattgaatNtatVaggtKctttHattcatttatYtattagtataYtttagYcattagaa
+ataHtaaccttactcatYttHMRagttctDagNSVgcgVaNNattctVcaaVagaattta
+agaggttttacRagtagtaaaBaBaaMtaScKgVaRcNtctgtataagtatVgtDgHaYt
+tcHYttaagatRgtgaattctYaaaattRtcWtacDDaRatcaKtaSacaagctaNttRY
+agMSDKtWgWaYNgaaaatatNtaatatHMtMWRaRacaaaatgctgctacNKaKtagtt
+gVatDaVccatSDtgaSggcgWatccBgaaVtgtaWttagatVaBWtacgWtaYattaaa
+tMctDgDaaKatttgaaatgctWctttaHtggHaBBSRVBWtgattgagatccNcaaaHt
+tccgVcttaDHtNgtttaMggccVWaagattgKcaacgagtatgtccctctcttaccDtH
+cttcctBatcStVaactaatctacatgtacataacDgcgaVttataagcaaRWataattc
+ggtMaaBccYgRctagatctNtBaggacMaaaNgctgttHgScgttaaVgattVDtaaNa
+ccggatatHatKcgataRtaMcagctattcaagagaatHcYRNgNgcaWtgagYtacttN
+taagStaVVagctgcaaggHatgtcaWgaattKttgtcgaBcKatKKtDtRtNYNtctac
+tatgcgatgtaacDtcaYgaactSHctDataKtcaagtccVRtWaaKMRtagKttaatag
+tggKttYtaKtVataWYgHBatataatcatNMRtDYaYcttgttHagRtYacgaDaaMMt
+cagattBVScattYcaataataBWaBatgDtBaKaHacagtBggaVtgtgttRtgacata
+aagtBtaVgttaNaatcaSgcctgtcBBaVttctHgVttcttgttatccaatacaNtgcg
+ctatacctcatHtNaBMtgtagaDtKagtHatacctHgtgaDVWtatcWgtatScattac
+tSgatcWatatDataRSgctHaaWataataYacgtacgtgDatHcgtaacSaaagYaMat
+aYaactggaagtKgattKMaatStRgtatVgttcttKSMtcataVtttaDtgttatatta
+gWtatNaDcttgccHaMDttStgtctgagtRtatRSMWttaStcatattaNaDtcaattt
+aVatgMtcaattagMYWaRcNtDttcaaagMgagaVHtatYaacggttScaaccVKHaaa
+tacWagaataaccMatWgctDtatttgaatBtNttgaaBgagaaWcttggatcRctctaD
+agWBcacaatMStBcBWtatggtagtgaagaMKatacttaYHtNctgttHSMaWttacaS
+aatgtattttggccatatSatcgctctttgaRRVVtDaatcSYHcSDNacattcMDaNVa
+gatctSctBcatagtggHagaVtgtSactctSHaMaWtgtatcattWtacgaaHatatBa
+aSaYacagtaaaagtVacatKtatatataVtagcgWccacagctcaaccttRtatNactM
+tcattaaatttNaaggctgYctctacatcaVgcMHaagaBttcgYDaSRtHgaaaNcaWY
+BggataatBactgaataYgcgtaacccactHataagaaWgcgRacccagagaVtataggc
+ttNtaaaaHatacatttttYYatHattgaatgtNcttatNaVcaaRtKctcgaaWctDtt
+ttataaatgatagcgSttcVtgatataaataataBgaatgaRacgagtaRctttaactat
+tNagtcagtgtgaSgaHRacgVtggRccatttatgtMtattaNatgttaaatRaBRttca
+tcttaRBtNtaNSWgtVSgcNacBtWaDgaaNBMgagaBMgaHaHagatttctNtWatca
+aaaDgtgcaaWaataBattaNtatgDaMaWDataNtctatDagatSWctctggaccatca
+BgtatattaaHacHgattcgatgtRtaYattactNtWgaaRgcgDaatactgWcKaMacR
+SaSaacDgtgSgSRaagNtKttattcattaagtctgtctctataaVgctHKttgVtgacg
+attgRYcatccWcMtaBagaHacaaaDaaaRVgcacatgatYaatatttMttaaWBtctc
+gaNcWDtttcagYKattaRtttagHcKaacaBcaggtaacctaHtaMtttaHacctVacc
+taaagtcactttcWcaatggatSaataHattacaMggtgaaWaacagaaattgttggRgg
+cgattatWtaKtScWKggtttcttgtcMaRgYYacacggagtgccDcDattcaaacHaac
+ttSScaaStMttaYtgtcWaaaaaaaataBataWaatatBNttcgttgtVatgacaHtgt
+acatHtaatgtKcatgSatacVRcVctttagNttaatKYgHtRccttDBggHgDtgaatc
+aagacacWtcgRWKaactgRaDNMactactgacaDgVgatcaagNRatacagattSMtta
+attYtgWctRgttaaKMgggaaataagttatgHaScYaattccRMggSagaKKttRggtt
+tgDtcgtcMttttggaDgcVctYcaaataattSctDaccatNataDtaaaWtttagHMSS
+aagaaBgatYaaggNtagtgctcMaatttWMggtctatttggaKagaggatWcatttgct
+atcgcccBacacttataagaYtcNcagaNatcaYHgNgaacRgtaDgaNYttcattRtag
+NDcHNVcgDctggDatDtgNaaaaaHgaYagtRtcaaDcgcaKatcagttattcataacc
+NaatacacaaYWcatBaaaacaRttMgtaattctWttMaMtttccgaNcatVtgatcBaR
+tttgSaactcaKYaaNtKDttttRagaMcDYgcaKcataVaaagattcatatWcHtagta
+gatttctBtcWHtctaRgaSttgHatgaHMtNtaactgaaaNWtDctgDcacattMctNg
+WattatatctSttaScctaDaatatDYataaaaatataatNctKaNaatatcSgagttaa
+gtKDttaaStaaHtttaatgaRataBtaVcBtcDWWaaDaacacRNtaVggatattatag
+tBttggcaaKcacRNgaaYaaMRaHtatBcaaacNataKacttaMtaacaacgRtaattg
+ggaRcttagtWataactKttDccgaMcacNHKtattStaRcSStDttacggagagtMtaN
+HatttWRNVgaaacattcScatgctaVSttaRaMagatcScaBggtatacgatVttKcVt
+agtgccgtcDtagtRagggcagggRRttKtcgtKDRaaatgatVttDtcatMaNKtNaca
+gMattgttcaacKaatYKttaactaatgagattttaBattBctcaaRWgtYtYBatDcat
+tggRtaaHttcaNagagctcaRatBtaagHtctcttRatagBttHtgatgattgcRcgtg
+SaagcYaccacBWgtaNtctagacgaaSatBNtHMcKagttaaDcHtaDaaDtttccaat
+McaSaaacWWggtgDtgtMtcacggcgcWttcBctaaVatggaagNgtaacctagatggY
+KRVttRtMcgttaagccaHgatHBcgNtctMKDcYtaVttHaaDWcYcKtttttgatata
+cataggaaaaacWgctgttatWHaggatcgtggcataagaaaWtttgatcaagaDatgaW
+tRtttgMagcBattcNaatNcKgaatatWBBcttKVHtgcagtagaYRatcggaagaRta
+ttaBNttattaataatatgtttttaagMggggMttctBgtcgaaMctcctaVttRtBatt
+aatattgVDcDtggtgaccBaNttDWaVtaaaaactHcaVtacKMtgaataacggHtaaa
+atatataYtacBcattttSaaSttgatcatccacatatgcYaVcattatcaagacYcMaa
+taagaWWcBataBattcBtaKatgtaRgtKgattaSttYaHcgttHcacaatatKatgRM
+gatgatgRaattctKNMRtggatNttttagYRtgtgYttaataaDcttHaDcctttgggM
+tcgcMgNYtcNacttKtttttgYBaHMgcccgggtWttatVttttMtVgaHagDNtccBV
+aaagtaKttaaacgaYgHagVatMgaacBaSacNaaaBcagaaaatatttaYgaaSccaR
+acgctgtYcctttStttaacgatVWaatKtaBtaaataVaBVcctgKaatcaggaDYatg
+VcgctaaacVtcHctggttaDggtatRatttttaaatDttaMtMaggtMaattaRcaagg
+aatVaaaactSRctatttWaDtBataaBaaKattScSVgtatcWaaaBtattVtattttt
+atYtaatacRKcgcgYtccaacVBtagcttYBtgtgttaataataWactatataaVccaN
+tcaBtttcMagataatgactMBatBctaaRtatataaaaaaRacagtatYgtHgcaDgaH
+taaNMMStKtDgtaaaaactgtaaccBttMaaMDVaaaggaVatcScMRMaBttctSgac
+KaccKcDgaWattHVtKaNcDaagRSgcgcaRgagtacMKtWaacRtcKKtBYgtagNta
+tgtttVttatcRaWtattcgtttaDccttMVtatgHagaBgtaMWKtcVagaagcaaaaS
+taaatgagaWtttDttttagNMgVttcWagacDgaMatataaataagtttgcctatRttt
+NtcttggMtggVcgaMaBMgaatDtVaDgttaaacgaagVtttNccaagtgHgtgtcSca
+ataaRYaactgcVWtaNRDccSggagttattatgcctMaaNcgtttVgtcaatctaccaD
+MtaattBaatMtKgaDcBggatVtaattRBattgcccatgaNtttMDcKtgcaccttccB
+ccaatctgDgMSgaagcactctaWtattgaHgcDaagVRgtaBtaaRtgtYcYttaagat
+aaaHaHataattaattaStcttcgatHWaaRRSHctggttgtccaacaDttcaKggcVcg
+tSBctBNaRaattcgcatagaMtNattStRSaaattVtMtgttNYaatgtaHaKNSagat
+caHctaaaKKgtaYatDgaaaBKSacaatacRgDctaSagVcagDgtYMtcatcgttcRa
+tgaatgtcBSKtSagcttagKKccgHtBRgttStgtBaaKaMtaaKHBgaVaVattaatN
+NgcattgagtcaBaggMgctHtaatatttDatcWatagRatVaaattNttttaaVctYag
+tRaHttatttaaaVtaccgtNattataKSRcgcagMgaaMccagaatatMgtgNtcttNt
+gattaBgaaaagatWtccNtDggaaagaNttttNtttSggtDcaaagagtactccattMa
+tataHcgcHMBtgaaKHSYtctaVtaattgtacctctctaaaVtatgKaWaacagttYaM
+tNgDYtttcYRtgYaWaaaacagataaacgtaVatNaaBtBattcctWaaggcacatgWt
+ttaMtVtagatatacgataMtttggtVBagatctRatKggttgcYtacSaMStattBgca
+tttKatKtVgcDgcttNaaataatWNtaDStRaacHtacttacataatacaMtYgcggca
+tYcactttttDtcaacBtgHttggctttHNtRcgatctcactctcattMtatccgattag
+gtgggNgagacgttctDtHcaaatacaVaaaHttctcMaNtaattHWaMYgatNacKNNM
+atcRtNtYMgVtataaaatttaaaBMtaaaatBtaaacttgMataaaagBaaatBVacta
+gaaaHtWtKRHttgaatVattctttgaNgaDDtatcVWtDaataaaVaaatgcaYaagga
+tgggcttaaRataaacttVDcattcaattgtaBcMtgYtBtcaMKcRNaKRtKcaatttg
+atWgaMagtWtgYVaRcagattacaWttgaataaaaWgHaagacggYccctBtWttttYV
+tttggatKBtVagHBgtaatgttcgaggaWtDtgatattaMaagttcattMtttWcgtNg
+cgaRcaactaMgaVHctctgcgagKRatWtggtcgtWaaaBctcScVcaHatattNcact
+ttccBtDaaNtYggaattRtcggctaggNVgDcgaacttMatNagaagtaaRaaRttggt
+aVSaagaattattcaatNttWcaWtaggattScaStgattBagVBttaNcNaSagttagt
+cttDccctatBatHaRRttaacBYKKtattHVcHagStaSaatNDDatcSaVgtgMttaH
+ttgttaataatcaYtDcatttHNaRgWtgtaYcaaBaagaatYaagaccKggRattttaN
+cgacStttaatKcVtcYtttcggcaaaSYacaKattgSatHtWtKVcagatccccStaat
+RMaatgtaatKtcDgNaYaaBttccRaaacttHtaRcaaagtatgtctaaBDVcKSKVat
+SagtggttaatcttaVNaagRtctgRataKgcaagactSKattaBatNttggttDtgcDa
+taKaKgKacaWHgttScVaagaWtcatHagcgattcBBtcWaactBatgacBRctgatDc
+MaaVDattWaaKtRcctYVYacggaaagVNBaaaaaattKYaKcMatgagcatStaBtcc
+tgaHgtttacHacgcttatgNHWatgctWWattttgYaaacctaacYcataVtagVagtV
+tNgaMagtcgttatcYtaagcatgKgaaagNSattKtttaaggacaBNRatttacatttH
+ctaaaHactNcNcaaaYBcacggctcaaHagaaSaagcaWtcaaaDaaBNtNacRgtttB
+SVtttccttaaDgcctgKSttgtcaaacNMcaBtagaWatttVgcRtgaRtMttgccVtt
+atNtatggacaaagWgcacNatcaDMaWtcHgaaNaMMtttgcatHtYDcDactttRYta
+aatMtaVaaattggtgtcaacatVctBtHctYNacaaactcaMaaaMcHgtaactHaaWa
+ttKttactYataagaYgcttattaWMDgStMKKatatDataNHMaSagBaaaVtYtgVta
+NtataDRcBtagttcgVKagggatacaaSRaataaatagtaataKatMattVaSatSBta
+gVaYccaaaYacaKSactctaaHctaaaSaaagNttgactaSacDtttcattVctccagY
+tcNcagtWatacattNgttagagNctaYaYNttKgttttatKacMgRatgaaacVccgtc
+aKaatHHcacRtgtgDtccatHaaaRtNgcaSagtStgWKtttgBtHtSagaaacgtaSa
+atctacWaaattagagaDaWgtataMtgataaDaaaaaaaagttcBggaHaDWWcYctYt
+catctttcaBtctBaattattagcatgWcacgcaaaaDaactRVccBtaWaatYcVVcac
+MatNatacctSgtWgtttaattcactaaagcHgaatcHatcaBtgtaWatSScMMgctat
+ctctRaaaWMgttaKaatagBtttcttagaggVttcaatRattNtccatttcagctactc
+cacMatSHtagataaaWgaagtttgDcctaagtMaaaYagaaattttVattRacatctga
+accataYtcaaatcaRttaStRgSacctBcaHcgtMcccBaagaaagaDaaattKttNta
+ataaMgtctYcttDgaactaKaacNgcaRccDKtcatgaagtactcgtgttcctBtBtgt
+tatDtctgaactataacagtagStaaaaaatgHaaacaacYgtgtgHacaaattgttcSt
+tBtVctaHaacttKtttttWatBtcccttaaVaacaMaagaattcaKaSNatMScRtgaa
+aDtSStDtHtacNtNtaHtMtNMNNcWtgctctaaWttaattaNtttKtBttttttagct
+tcDagMNagtcKWatVMgcttBcgccttttgtBtatatttYtMgctaKaacttgatttta
+tctaatRagtttggKBSatagtaVVcaattMataaSBtDtaBaactgSgtatcaactgHa
+taacaDcaRtcKttatgaatcatacgcgaagNYaNgaaacaattatHMgYgtagatctct
+WttacatVgcgRcMaagttgttDaNtScgStWgtgacaacacggVgcgaSctcactcaaa
+aYtDatatBtattaNgatactctaagtWtKSgYtatataaaaaYagaggttaKagtcYtN
+tgaagtctBWgaWtaaBaattStcatgNNtttagMtRDtWttgctYattcVSBaMDcaga
+tVgccatMatttatctatcgtBgcScYtaaccaaHcattgcagtcttMNVaactWWKcaa
+ataNaatgHatgaatgtMStgccattacHNgVataaYtgaggtKttNBVtYagKacHRgg
+YMacDatcgKtatVtWaKgtHatatMgttScgaaVHagaaattaNttaatatgcaaactt
+WgRagaaRBcNcatctaagtggatgVKaaVgNcaccagtatgHKgacaWatYcSacaRaM
+gttgcttatVcaaWcVaKaaaKaDtaaaatcgVaccatcgKgtDagBNKNatccgaacgt
+KgtYctgaKaaSKcccKgcVtttKcaaYtagcagatVcctVtgaMYctaccMcgDtgBaR
+taaattaaagctKtaaatatatVgctgaatatctMatccaattacaSYgcactWttaRac
+attgtNaYcaactatNNtaHttYcStactctatatcWSaccaVNctBtaaagataNaagt
+aaaaStBaaVtggttatttagDScttttMMWctagcaactBctcttattSatacSatttR
+tBataatcaaKVSttaaaaacaNattMBcaacagtttcVtttatatttgtaaKBgcacat
+tttHNNaVtWaggaDataatNaWtBataattVacWaaattRHtacaSgWtttataDMctt
+RScttttaaaaMgatacMatYccgacKMagVtWcMtBaaatDatatHtttDtaattHaat
+ctaHgcgtaagRgWaccattgaStttattctattcVacctccBcgttaNaacagNWtagt
+aNgtctgaHaacBgtatgMcRVatataatKNKaagtttRgtaYcYcaMaaagattKgaaa
+aKcttgtaBHNaWNgMatcacctgcaMggScBaRgMMctaDaaRgctcYtaacgtgtata
+cttcacDaKtatgcaatMtactaHDtaaVcgaagaaaggVaMaatYtttttattttatMg
+gaVYVaaatBaatMgctgWctaagKtctgBtKacaataYtgctBgKgaMtgtgataBagt
+tMaagRcccVtSNtaWcgVDctcaSSttKaaaaVaDctacYatctcHHDtgattaacctt
+ttYatattcgaaHBagWgYtSgcMtMtagaHactaSgBgBSatHtDttagaacSatccca
+YtatttgtgKcgDcRatctccNtaagctagBVWaBaaMHacaHctDVaWgtaBtaaStVt
+DYtatacttgttcttggNYtatWBSNcagatttgBtcVaacVtRgtYaatctatSatagt
+tDatgttgtKagtctagKHtcttttaccattcccctaaaaSatttaDgBactaMttctVc
+aacVgtaSYcttgYaaKaggtaWttgaaaYgagataatgccMgSHatHtacaaMatHDtt
+caagtaMatgtaagtgtaggtDtacStVaHcaactatgagttatataaBHagggccHagt
+aaagcRgcttagYaaaaaagttaaattatYNtYctagtttaacBataaWactVtRtaatg
+tHatctagacatttaKagStttgttttaaagtDttMtgMKgcgttaactaVttHcatccg
+ctaaaaDttSMccttNaaccattacaBcHctVcttctYtaaSSctVtRVattaaagtHta
+BgttcatacRcctKctHVHgttKtcatctatagNSaacHVatcVgRtgtaaaRatYtcgg
+gtBtgcKacttgataRttDattatcMaggcWWRttccgaHttNtacYtYactgtatWaaW
+taaggtacaDacaDgttStgcttatctattatgttgStaaDaaattagttRgtgcBgRDt
+aWaggMaaVttVRtcBttatcgttBDgVgatttKgaaaMttatatgattataWctcWMga
+HgaattMDatgVagtgatatcaNcaaaataSttattttaaatDgtaNDNggaaacgataa
+tttaRaaatataaaVaagttacDtgtggttctatRatgcBtaVatVtMtaYtttaaYgaH
+ttgttgagctacttaatatBHtctttaagtcaHaWYtKttacttgtttatagacataMgt
+tgcaBVcttMacttYcHcNaDatNttagatcagaatcttatcatHaNtatcMagYaacac
+McaatacaNRatDtaHDHtSYgaatcRaBtKttgaMKgcDgtacgtgYatHcggatactD
+DctaVRgtgctttRtatgtaaaccagtttacVtatttBcatcRaaYgcaMaagaacSctH
+RtctaWatatacgtattKaNagtagatataaWKcgggacgaRWttNacaaaaagaaatga
+tacDaaaaMataKacatVgcgVcgcNacaaHNattaggaacattYtcRYtggtatccBat
+caccgacaccagaaagMgataacHRgttKctDaggMaKtaaatttScBtcagKBgYtaRK
+ttagttttcBaaHYatgattaaDaDVacaagKaaRYattaMaaagVatattKactatctt
+DacHaDaatBcactattKtKtRHggtaSctaaaaagtttaggBScaatcgMStttaatKa
+caVBSattaKaaagacacaaagtaattWactttacWaaBgYtMcMccagRtacaatatct
+tatBacgNagaRtctHgaKtMgaattcKYaaMacgcaatctcNgYgtYRaHagYtcVgaa
+gaacacKgaRaacgBtttagDcgaWgaYtKataaDcaBatttccgaaaacaRRBaVtRtg
+HacttHgagtMttWattMtBtgDaNtgKtaaKDccKgctaMRtaNacattacWcttacBa
+cgRtRttaYggcKNattagtgactttcKHNcWBYagttgataaYagaWaSMttgataatc
+tataatRtggaKtcactWaataatYgtgcHgYKttaaaacNcaSatgcggacaBaRattt
+tcgacctHtaKYgttaaactataRaaSactKatSggatgtKYtatctYggcMtactatgt
+gaWtttctgYDttggtBtcHBctactacBcVacaagtgaatSttcHttttttatRYYacc
+agatctgatgacgcccVataagMaggWgYtatctgtgtatcWttRttcattattgYcHtg
+atcVatcttVSataactgtgcgtgtgaRWaacgatSgaNaVKaaaaMttccNtWgtVaat
+NtHgttgatVcttatcaaDaRScagDtaKtatttYaSctttctcatccttaattagttaa
+atactgctgNcttgctcatatatactaDtagctagRcataBcgccRaacaagcacaagta
+HYaaatgttaaRgacNgccgctcKtacataBtWtaaaDagagactacaccacggaagcSt
+HgggtcatDcKcaacctctgDVRaYaatattWttattcttataatWatattaccYaagWt
+gaataatgatttgtatBYSaDctatRattgaatDgWtMacggtattttRgtaagtgWtRt
+agtSctVtaRgttScRcattacYYatattaRaaggaataagRtttBHaggtattacBHMc
+acKaDDagtatMaaSMacaSggtVVgacctgttaaHagtactaaatYtSSBgaKatcMVH
+cDtatgtagaVgtWtMcttctYRtgctRtgaacatDctcRaggatRaaVWtgHtaMgaat
+taHataStgaKRaVacataDtgDRagBHttgNcNaRDcaaSagStDgaStattBtBNHRH
+acaYaatcagcatacDtattWctgcMattaMaaWgKttgRKgcacNYtcatcaaKtctaN
+tgacatMatMgYagNtaRWtgaaatBattctaStYgttcSYatcctMagtgatgcgtatt
+KHKtNtcattcacatccDaaWattgcacMattattgDcttgaBgccaMNaacattctcaa
+cgaggagctaactagattWaatgtagtcagtYtcKtMVSagWagataaatgtaaVtaSat
+cccVMttataacaVWHNataWtgccggBVYtacRgHatagVtctDttaccaataSaDgcg
+gtttcKaggtaaMcatgMttaaDacaccagYgtattacWgaDtaBaacctatgaWagaca
+YttcRHDgDgaaMtcagRtaattDtaagKtYMMacagcaYacgtWtctcaNcaagttttc
+tacVtatagttgttDgDRDtatScgatgcgagggSacttcaNcVaatKtattRtWttaVa
+gtaaMDtMaattHtagtttaSgWctcctggNgatgMataNRcttatataatcVtDBHgtN
+aRatgctttacHtRacgYtYaBBtaScWtttMKcStgRcaSgaagatNVtagctgtatVt
+aaagttcgWMtgtcgtHtcacSgaaWcgttaMcttWDWataVKcaatctattaKgtattc
+MttattcgtatcaaatacaDtcacatatVaatcSgtgDatBtgtagatgtagttataaag
+tctcatMNgataNgtagKcatgaagKcYgcNYtVttYtaHKcattaaMagaataRWacgS
+actctWgtcgtaaaKaWagRaBataRSVatccYacttcaggtBVatKtHctatMcttctg
+tHttcataMgttattcttRtYttagNtVtDatattgcatYBtggKtctatcYctDtagHK
+BNttYKtcWtRgtaDatgaaStgtaMagcBgaaagtSctRNaHcDgtttcYaacBcagaM
+ttatRaVacgttKaaaacMttaWSgWcNRcaVgSaaaBatNcatttatttgYatttDgtc
+aatgagaYNattggagcDagagatacNtaacaWtBHgtatNtaggctaggcaacYBtatW
+ctgaRttDatcgttKtaNtgaaaHaYtcgattgtgccaagagKatcgatatttcaDHMMt
+tVagaKRtaKtDacYgtcBtaDMacagatHcttcagactcgtagaMggtKSctagKtaBY
+MggtagcStgNgaacaatSgattaaKWNaaYggaaaacgMaaattgatagagaMtacacN
+acacSgagcYVaattHgatDWatBtaattaaYttgDaacgctcRatatacVtcaMgcBta
+agattgcgNtaHDgtcaaaDcYMRtgcataVgtaatcaagaRccctYWccaacttagaag
+aaNgccHWaaaacacaMgatScgatgDtWaaVtatacatggtgRNattattcaatctBct
+tatDaMcaaHttatacaaNcttgtttagSSatgatacccKttaMtcatWgaVataatatg
+YYtcaHaacactWHatttVYatatgDactaaggcgcaKcatHaccMtccHcaatgtWtct
+ttatgWDatctgWaagHVtDggaagagtYHttBgaDKMctMHccDaattMatcaaBtBca
+gatBcatatagatttatDtNatcaaaatctgaaSNaagatagtVBtagctaBVNtStWBg
+ctagtYgatHNatatgcWacWtaYtctatatgaatactcattagatcgHgaRattaatDt
+NcaaDgactSatactgNataBYaHKaKaactctcHcKHRagDttgtYgtaattaactagc
+tatatataaKcattttgcKtcaacSttgHRaagacNaBtatacataaaaataVWHMcaYc
+agcagRaagagttBttaaMtgatacSDaNtttgaagRtattaHtttagtatYaaatcacc
+gaYaatattWBtttataactMYactaaactaaatttcNcVatgcVgKVatatattaaatc
+cggaaNaacacaSatgcttgcHccacatgatNtatgKaNtgctggagtctataHcRRScS
+agcactcaatataggaaYaataaagtKKaaaKtBttYRtgtcNVVaaaaaatatagaNaS
+gattDtgacgtctMatcaaatggtSaYtttaatcttaagcKataaMDaMctgtYcDtgaa
+ttRctgHaatgttggtcttcaataWacaaYaNtacHNtVWagcHWtBBYagSagcaaatc
+KgataaSgDHataaacattKBttWagtRtcNagHcttaatBccgaaatVacggStctaKa
+RaVtgcaHBcgKVcattttHgctttgtgacgaBttttccatccMatRcaVataattKatt
+aaaagDatVttaSRMggtacttKHaacaatgagRaWcgDtaggcataBaVgttNBcgtag
+SttgccYtacWcgagNaatttgctagagacatacaaggataacWRtcDaacSDStcaRtc
+DcaaaHgtatcaDRtgcagtDtacBtatDMagtatcctagtgcDaSaaRtcaRactHgaa
+atccaRtWgaacttattaataScaDaatYaaaWaRNcagtaaaYcaHttBctaattctNg
+gBYBtggaacaDaatKgcagataHtgtcKaWctaVtNWYBgttttgtHScaBctRccata
+ataMaaacatgaatatNatgagtWgatggattgaNttataHcSKttgtatcatBtDtaWa
+tcaWaDNgtagctaaaWttBatDgMatgagatctKttaHactataSgattRataYaYata
+gaatDagtaDaagatcKcYgtgWSgtttttaYKtSatttgYatgYHStattaKcttatNN
+SataaaacHBtaKgcataggYtacgtttccaaVtaVaHDcaWRYSBHattattcaaaaBa
+tataaggaBtaacaYcgHgaatgcggYHagtactNagaaatttttacgaBcaaBttgagt
+KtYHaKKgttgaacgacacgBtWDtSttgNHDMgaaaaattcKcatgataMKttVHVBac
+ataKaatcggWtaccagMtttcKgScgcaactattVctHScccaacccHDtgttacgttH
+VaatcVgMtgttcatBWBttDaaactattcttaaactaYtRtgtaWataWggacVgtggW
+tatgtataaaHNctRgRtattaagtcgHgWStttaWDacacatcaHatttVacttagcgt
+HagagttgttcatcatgcaHcgtcKaagaRRacaatNgtYDtatVgYccaYKVttDttBc
+tYcttaWtatgYtaVttttacVatBaYKSSVaNNccgctgctBtcaagcacaNttctata
+YMatccWacBcgVaaatagWgccRtHMttHgBacttYScaaVtgSgttacBtctBttaRt
+SMgttaatNaRatgttgtcatVtaaYgVgcVaaYSaNcagcttatNtacgatagtcgaVt
+aacYVaMttggataaagatStcaNtDttgcBacatattaDWatDatcaatatNttagttM
+ttcaactacaRHYtcggaacVHtaggatDggStgSWtVatagctgtttaagBcccgBtgc
+gtctacYaBatactYMttHttVttaWtSttgKtcttcgtgacctaDtttMYMtaaaaaat
+tcaMgWatBtgWWtaScccttaaVVgatagaRtYataatttgKaVHtgcataYtaaaaag
+StcaRaMaattWgcaacaaRaBaataacaMNatagatattatgWtagcgVHcgtcatgaH
+gtRatcctgtcSaaatWgtatcHBcatcatcHaattattDBHggcatBtgttagNDggtc
+RttaataVtctttStaaggtcccBtccaBgBRgaDaatttgtttgcNtatBgaaaggcgN
+ttatMtggtBgMgatactDtcatMaaWctatttaaaacYNgtSgMatBcSactaKYaDVa
+VtcagaaaStagttYRcaaKacaHaacagctNcatttKtttaaacWtMNaatttattaaV
+gaMStMcagctaWgaSccatNatgMacataWaaMtataggcgtatcctagHatttttVaa
+ttttSBttScgtBSatgaHcaacgaVtMaaaactKHatatttNWtttataWtaatVttKa
+KMggatcMaaattattMgatttgtatRtaVgaaDtacacRtaaaaaMttScaggRttgtc
+ttSatYWtVMactagatVaMaaaDtaattttaBWcataaggaatBtRgtctaWDtagWta
+aWYSaHaaacgatRcttgcatcattaSDBBKttttctaYSaactcgYacatttBaattKa
+aaccaMStaHatHtatgtctKcWataactctcVNYtttMttaDatSacDKcacaaHgagg
+aaBtgNaaaHtattgtRcgacDtYtctttMttatcDaNgattagtttYtaattBMtaggt
+acatgtYBNttcMacaagaaaaaKgaaatcacaNttgtttttagDBcMgtaNacSatcWB
+WtataVatYagtttccatatHtttDtcgtggBggcKacaBWtBcaattgMatcttaVaac
+VYgMgttDcaaactctctcgcHaSatYVHRaaatccMMtaDHtaaKccactgattatcca
+tBYVDacgttMctaaVtatacaatBgaagttaattttgatatgcatKgaYttHtatggaa
+aatcaDtttBtatgccacattactcaaagctctcBKcaagcaatataNtattcVtcataa
+cMHgtattaaDtctNaNttYWcWtaVatatataWgtaWtgaHtattcgagtMVaHDHtat
+gcttctaaWYaatttaatccaMactKtcgtDaDVWttaccVtacYBgDattKtHKSVStg
+MtBgcgtDRSatggatatDKacataWtatWaVttctSRWgtcaWattKaaYWtYaHctat
+aKacMaagtctRttaatcgtgaHaggYWtcgatKttKaccttacttccgtttHcgtKtct
+taatSBgaatttcVKaMattVSgDDcaattcagtcataccBccgtgaVtaggttYgaNag
+YcHatMYaattDgtttaaMagRactHattgatttaaSKtSccggBattatatKDacaacB
+gVWBaaacaagattgtcDtcttBgcattatcaaaacagNtaaDgtggVaacYDgtttDtg
+gKccttaaaWcacgSatacaggtagVgatacctBttcaattKRtctaMgSattgtaccta
+tataaaMgVtctYMYYcacttRaBgDctRtttaRHgcRSMVaaaaacagaYaagtaMatD
+aatttaggcctNaacgaaaatgNtttaBtMtScVtVtSacStaBggtggtKtRcatagHa
+ttcctggaRtaaKaBKtagttgaattgtatttMcatgcttDaWYtaVtNDgatKtHaaat
+taattaaStaagWaaBtNcaccaatRcacttgttttcaaattctggcccttttBgHccat
+cgaWctataSttBgataacagtacggcccDcScaactgattttaSWYtaaaMaVatttag
+ctaBgSaggtNaBRgStDaatDBtatcHgDtRtgMtStWaYaggtaYatBtaWaattgaa
+YattcBVtaVSactWaWgtKaatagaaatgNttHtgtcaatMattcggtcaDcVttgata
+MNttYVgSSYMWaVtgcaRaaccYtgccattaaHVgaaaattMtaSgtaYaggctataBt
+cRtttaaBtcHDatDgtaaVttgcagNcatWggNtgRMaDcYgYttacWNtgcaWtaaVa
+NctVacaaccRcacttgMttgtRMtgtccatttgKagttctVagcttccaccaNgtgcat
+RgtSBaacggaattttttNagtDcagaHaaaatStcaMtctagcacactHWtNtgctcgt
+NaWatataKcMcWtagaggDaVatttaatttYSDgRccWattHtaggctaccDMctacVa
+attBYtDacaYctWaHaaHttcggaMKaacSagtattaaatDttNaVNtacgVttKaaHt
+gagttWcKtgtaDcDaKacgtactctttacatSgtagtaHHtgaaatRtttagttMctac
+KgaKaatBttataKWMcggtttatgtgtgaStaagaaRttaVtgttBaHgNtggaRaWat
+aacaWtRWacaactcgHWttttaDagScKgtgSagtcMgaRgttacccaaaKRaaatatt
+cKatttNgtMaVcataccaKgaWgHBWagctaagttatcDaRVVtggaaHSVacggttaH
+aWWagtSgctctVattKctKtMatHWcgccttaYtagtaKDaVcHtctgHagatcaSaca
+atKtatgatagDgtcgttttgatVtatStctYaYNtgtgKaKaVcVNgaattWccgattc
+ttgaMaRattRgcaatHctcattaBaaMtattNSSttHcagRKRaaccaYacMDtaYaaa
+atttRataBVtcacaagKtatgcctcatcgtgWataagcgtatcDtNagcatNNatgttc
+RaaScagaaaRaataMtacMSctKtDgaBactaggtWgcRtaWcaYtgtgWaagDKattt
+tttaaccaaatDHattgacSttttatWaataatDaDaaaaRtaYaggagcYatacYaKaa
+gaaNtaaaYtaVtDtBaaDcgtttKMtggcagtVatgccggtHgtgtaVaacDBaattac
+aNatttMgaDgcaDtttggaaMgtYtDtSgccaaaaYcNgaacDVgcattaNgatgaaDa
+BBttgccatttRtctaatgtHNtaaatBtaMaVattcctggaaaaatMattgtagRDaca
+aacgaataWSBctctYVcgtSaMStgtttSatNagaacaRcagtatgaNBtcKgBttRta
+ttVtaBtBaKactaWaMgRtcMtaDtYtatHattScggacMtaggcataaWaKHaataaa
+gYcgWatatStBattKaKagKttacMaRacaSaRaaWtKaatagSatcgaaaKaaVcDtt
+cVcgaKVattggaYgtMataaacRtaDaactNatYcagtDgttagacBataRYRDgttct
+tttattacBcHatgaRacMaactcatVVtttaaaHgctgttcaattaVaHtDcaYKacgK
+tcNtttgctttgHWcaaSactWKSatcgYaNVaattacRcatVNgtagatgcatYatVaa
+YWaSactgatccatatNMaNagNtaatcgttaSttattWattaggagaatcNaaccaaaW
+atRaatHMaattaNWatRaMKaWctWtDataaagHctMctttRSttaacgaSWcatcaVg
+atataattgtWMagKKaBBgatatctcgHSaaNBctgVtaStagtttgaggSgagcKtta
+aatHattDtaaattgaacatactaaWaBYtKttacWtaaVNcWacgttctcctaactBaa
+SRagaaatgttKVgtHacatctcaScaataNgaaVagaaHttaKgHgKaccgtcYtcctB
+ccataagaSacataaaggtttDtVStaVBgtcgNatgtgaVctatWaaDccWHcctttaa
+tcWactaatactcttacttgttcttatttatcaaagatWacYctacKtaSaaaStgtWaV
+caYaRctgggtSaaaWtgctgcHtttgMcgatSaagttgttttNattgaacttaaKaYcS
+BSacWattaataKDattKaHtgaaattKKttttgacDtDtattttDBDDcMgcatagaVN
+ttaWtgaDttgttttttttgacattatagBDacgatNatMBcaggtacaatgtgctttat
+atttRgBcctVtYVctgcatgtgatataatHagtttccttHatagtaMMaaWggBataaK
+tttgataaagcKgtVtaaaatgtatWWaataaHgatttYtcWataataacagaacDRWDg
+WaWaaaggattBcRctacYtagctNgtScagMcccHaBaYgtgctgtSDtHacKtNgtga
+caaaacccMcacaKctcactaaaaaNgtagWtttYtgaDcatWctataVctNttKgRtat
+ataYaaaRacaggttatagtcRgDgcaYctattNcaNtVatYattKgaaggBDtttactt
+HttNtgcatRatgaMHtRBtaagatMcacatBatgtStctagacttccKaRgaWccRata
+VtggaScgatttDMaaatNNtcYaYtaDaatctatgaVtctBKtgccYgtWatDcMYtaa
+RtcVgcttttDtMtRagtactHccRBWatatccttatMtNatgttagagBcttKacaaMt
+agaaattaDttaatatgaaaRattNcHSgaaHtaDcagctYacgccagcMtaaMgDaaaa
+aggatcttcaaVNatRcKVaaHRBctgcattatMaWaNaKataaatatgWaaatcgMaaa
+atcctgttactDtDagaccYWacttctRatgataaKtaaatcaMttttcaaRtScaWgat
+MactMtcaBNataaaBactggtWHtYaattaWacattgaaVtYtSgMcatgaatYgatta
+tacaYttaaaKRgaVagNgtaHWaattcgDaRaaacgVtBDtStttRaKgVagatatWtc
+MKaaaaMDatttaaYcataDYagtaaaaKttVWMggctgVgtgagtKagtgtBBNctaca
+aacttagattSttHagacKVttgHttatSataaWtMHttSaSaaaaDatgBtaYaaaggt
+taMttgVtVtttctaattgaacaggtttDDVMtNSgcatataagDaNttatSVttMScNa
+aattDttYaaHcNgttatatBatgDKctttgVVaaBgataaBatRaagactBYgMgNaBt
+taaattagatttttttaVgttaYtatVtccgtaagDcNVcaWtgcaKgggYtgagattaM
+aaagaatagtgaBaVcacBNtagtaDctctcVtaSctgtagcBcHMWtataattDtaact
+ttHctaRcRaaBaYacatttcVRaatctgctattDSNDgBatcaaatgcaBccKctaHcB
+tctVtaaHgatcRgaacggctRtaagtaSatatgatcaaagBtaagatttVaMagaagaW
+WgcMWBRStRggtttWttttagtccaMRMaaattaSgBccggNataagtgctctttacYa
+taRtcattgtgYBtggcatRtacttBaacDacaKtHDtaNacMtataaKKtgtaaaRMVt
+ctVcRatcgatttgcattSaaaggttRatagtagaattVcNgRtKccBgBtWcataataK
+ctctKatttttgVcaacKStcacSRtattgcggtcctcHatcgaaDgaVgctagtMNVta
+attaaatattMYNcgattaaKtMttRtYgacttgttagggcDNgagNtKBaScagttctg
+cMaaaMtHctRaYtcgRtHatVctttatcttggtYctctYgttgattttaacSttaaact
+aaaWHattgWtctactatttcgMcVaaMctaKRcttcRaatSgctVNgtgaaaNcagata
+atcaatcKtagtgacaaBVtttgtaaVctaBatgtaagtgtacctttacKtMWtaaaatW
+tcVctgagataattacggaatacgSaWgaHcagtagNWaaaSacggaaatgatRBtRctV
+ctgtVaatataVNactMgDtaatggtatctacaaatgtatacKtttgttttaaacgttgB
+ggBtgacttWacgaMtttcagaacagaaRVtttKBacttDWaccagtaaatatcgMctta
+tRtaaKKcgMtHKattWYYgttgatgttaRgacHcattcttKtcgtttaatagagWgDKa
+YatKataKcDgctaaaHWgRtagccgttcatYattcagSHtttattataBVccaNMHtta
+cgWttgDgaaRtRaatcgatNaaNtWVcctacatacYtctgKtcattatctattatcgtc
+KtaataaattagggHctcatgHttSNacctYaKttMHtctttSgacgtttgMcStgttca
+aSBggataggWttataNagaNBcatcaagtBtagcMagtcagagaaDcaaaataKgtatg
+tgSaagtgtYDtDccVaaacagaagttaHSWatagaaaMYaggtacttctccttatatHa
+tgctgVMatKttgaNtggSaRcattggttgWcatYagtaatatttgcttgaVctaataMR
+ttttScggggtgagVcacatYBggtccatMattBaatgNataDatWtDttVcataacSVt
+attagaagtaDtatcBacNaacaaBaaagaaWBHSttgattttKRcVataHatttttgaB
+tcctctacctcRYttagcatactttagaMHgtcatgtHtatctaaYacacggtaaMtatg
+ttaagaHWaRcaaBaacaVaKattHgataNatatacgtatttaDWctagatataaNtacc
+gaacaDMttDSaSYaaYgYaVtcatactaaWWtatataaVtMcagMccaDaaSatBatta
+gcaaaatgRtaHRgccgataatagcaaacacWacagaaVgBcagaYctHctgtcttaccB
+attVaYtttHatgaVgttcRgaHtttagttttataatRWggattYatatMaaaactWaDR
+aggataaWgMataggtactatatttVctataattaaatatgtgttDtcctaKataaaaac
+ggtacgtKaaatccBKtgtaattacaKtKYtgStRaagaaaaaaaggYagtNactttaaN
+aStcNtBcBaaacHtacaatSgattYttaacDacaHtcttcatttgSYgtctRaatVagc
+aWtctcDcRctNHatScRtaMgaacWaaYatcaHaaagttggagtacaNcSRttagaatc
+atVgtgaccaaYacWHHtaMtHtctaatttcactBtgNVggBgttctaDtcttaWttaat
+catatHgaDacatgaaNagtaatacgDgHttaNggatDaggactcaatttcttDaNtRag
+ttgVgaVRacWNVHBttcVtYYtagataagHtccattcaatNaataYtNctgatcRttga
+YaaaBcaKatcacgSaataHatggtacacctttatRcgtaYacgataHWVKaattVtKcg
+atcgtRtatagRgccBtaatagctcVNtttatgRtggggtttcttatactaatcMaaaWc
+gcaatKttatttgtttatHRRacaVcSgatcagcaacccaMatYacBVccNcRgagatct
+gtSgaMttHgtaattatggRatgcWtcKatattMKWtaaatctccgtgtcaHNYaagStK
+caDaMtaaaWBttacBgNctMaatDttcttgatMagtagaaatYHKaacttattSgttNa
+KagttctcataagtaatgactgaVStaatcctcDagtcataagWtataatattacagScH
+aatatagcaHYaaSagaaaaactYtRYaatcggaaHcVcDcaccctattRaatattNgVa
+atacagaataaSaaaagcWRgaKttccgtaWttctaaWacgatctMHaNWSgVtgNttVg
+tattStaatNatVttacaRWagNgcaSgRVtcYtgtctYgtRKatctStHWttcYagtgN
+tBaacgtagtgtHcgaSggcNgHgWggKatMtaHcgtKaHaWggacRRatattaHaagga
+agaSgHggtttacctagtaattBaaatSttYgtagBaSKBaaSKgctMMcacagcgtYat
+SctWctSaatRtKKtgatatctMtattagcgagaMctNtBcgtatRDtcatHtgaVcYtt
+ctaHacgagDaaMNtcttaBgWattatagaKtcWtHaMacagattgtHacttttgDaBWD
+tcSWKacKttcaHtSgttttDtHtSaVRYVgcagaatWattYtgNcgccBSttataaNct
+ttcHtccaaDRgaataSatgctVDggacagBYtBcRacDtYDNtgWaattattatYKtNc
+ggaKRatcagBactgatgcctSttttttDtcSgtcaaataataaMVttgaacBagtattc
+tatggYtcaaatDWacVtgataYYacSccVcataaagacagtNaatgtactaagtRtatt
+BMKacNacagaaWtctSaMgaKataaaMBgtYtaWaaKNtDStSNggaacgtMRtaaHct
+atacMtattttaccaataKVtcagctttatacgtSWBaStgttgWVtYaacaacRgtSgt
+acNgatgRtaYcagStcaNScaaaRttaDttctcaaBgcScDtWaggtgaacttNBBYaa
+ccaNaactNgctaaDaaaggttgagaaMtatacttgtgtctHtgagKacagcacagcgKS
+attaSDaKaatttagtHtMttaMVctaaBtgBaattttactttaKcMagcatgcDcatcB
+agaBHattVgWtaataMgtttgtDaHaggctgtVattDYacNtNStttaKaNggtBtaKt
+gHaaKcaacatDMtagatgtatMtaaacttccNBgctacgtgcaaKgWSNacttSBaggM
+tNStaKtcaatagattatctagtaBttaggactYtaaaStaaYtgaaaagYtMaagaKct
+gtVtttcgWcatctacgtatVaagtagaattBcagaDcgSgtaSggaactaRcaBRtMtt
+RgattaattWaBYcaataHMacgHactatNctacgaVataNVcHatatVHKKagaaRSat
+taacgttMattgtatagBagtatctttgaagaBctgattattHgRttacDgMgtWtaggc
+aatNttgcttagagaRatttSgtttBtgRtgaNtHcgStatgaaKtgtaBacctgaaWgt
+KatHDStatctttaRaaataacaBttStHVMaccggtaVYaaBttYNKgNaBHaaKcKaa
+atStBcattgagggcRSttttctaaatcacaRBattccacatagacatSaDtaaaSNttt
+gtatDgWgcatacgaSacRttagNaggaHtttagccttttWDtcYaVtaRtacWggctca
+aaacVctWtacatagttaattBBttMacatDtatttaaRggattatBVcacattattaag
+WctactVcaBgcttKagagttatRBgctagaHtgDgaaaSVtKgattaWtMDWaRccaaW
+aagtaaVttgWgVgacaBtSaacDaaaaKcacaRKaagttgagtNatttaSttaWRgtct
+aaccataDatagYaMgaWBcattaacSttcacDtSttgtaWYataRBHtccagaMctaag
+aWagSDaactRNaaaWagtacaScaSDcaatMaaaaaaaVBcatKacaggtgMaaMtatV
+aVgcctcDDYgtattcaatattaggagtYBaaatttagaaVWDattcgttagHKSgcWtW
+caatttaBtaatNcaMYgYagatcRRtcataaaYctNtatttKRatRggtYcgaWcgccc
+ataWttVaaBtaataaatcgNtctttaggNtatatgNaagtMttccaagactRttgtgat
+tBagBtaataattBStcaatttaWcattaatVtacatgtatttBataVYWStagcaYKDa
+agYtaggKtgagatVtMDtKgNtcatagtNcagtBagagcaNaaNtaRtagatatcYWtS
+ataWggacagagtcaDSggYatttDaaatcactKatWatcDatatRattataaatatcta
+ttHSctttggNctaagtSacgagatatatatRataagtttcatgcSaaKttctHaRgaaD
+atgStWcataaaaatWMNttaaRaVgaYcHaagWggttttaaBtcagacKtaBtggcaac
+HtaggVttttactatRWaataVcccaRaagattNttggStYaatBRaataVacgaaattt
+aBaMYgcaMgtKStStVtgVaatacccYaDVYaVaYKVtgatgcctacaaagcWgDtVtc
+taBtcctccacgatatWtcDHHaHacaaataaatataccaYRSataVagtttaaStgttg
+RHtctaDMMaYYaaagatacaBWKcagttgcaacgagBagcaaatccgKaRgtgaatcgt
+aWcatYtWaBtaBatcgRattcaagtHctctaatcttcctattaaYgaNaaaaRaDtact
+DtMNagatMtttRacKaccWaYtatcagaaKcttVtVaaaatgttgtNYgtHtaDactag
+gaRttaccVaagMacgcKtatataHaMtcaattcctMaRtttttcatgtctcaacatggt
+gacatcaBatHaaMagaatttattaaaactYgMttaKHBccgacttttaVaaVtcScHaN
+ccttacccatataMgggDtactagKgtcacRtacMacYgBaatttcagYcacaaataaaa
+ggagYaaMHtataaaHtKgaaHtctcaVatcgStcatHtcaYctttWcttattBactata
+atWctcctRKaaHtaaHYcttcaYataaaHtNcaSctgattaagaKaatWagRaVaNSHD
+aactaYVRaatgttatVYttatDcctRtgcgaacStaWttgaYcatYtggtatWNataMt
+DNRtgtttgggtHcWtatHaaataatVtaaWaVgcaatagDatgScgNcagggagtcaDt
+gagataKtgtctataattgtgaNatcaNatDgtagctaaaNtgtagtcBatgWcagagtg
+tWtaagWtaKgattHagWRaNatacaagtactYtaWgatataRctcNKcttttgaRtgKW
+tgtgRagcNtKtYtgatatgatBDKVtaaaaatttWtcaatacgRtaactttaaaaMtaM
+attaVNHRKttattattaaVaatagatYaggattVaaaRactcaagccccRtagtScgDW
+gVSagtggtaacataVatttcagtttRtattcttcYaccaaaagttNttKtggBttBcSa
+WaattataatcataBtgtMtMtaaagataYtacgMtWaaacBtttatcKacaaaatattM
+agtKccaaWccatttgtgacctttMSataMgBtcttaVgtNttttSaactatgaggaSWa
+taRtHtcgaMagSMccSaMctcgNtatgtataaVtBatHcHtattaacgactgNKtttaM
+tVaaaagaatVgttMWcttacacgtacScttcttcWtaatccatactctaacaHHaaaat
+DctNtgatMcRaaWRtMgttgttatRagtaNtatgRtaMttggaaKWttaRtHKMaDDaa
+catgcgttaaaccaaaDttatagVRBatacMaatacMaaatWcNcaaHttBgttgtacgg
+RKaaaMtcHgttaattattttaHgKtgttaatDaHatctggtaatMtYaRgMccKRaRKa
+DaagaggatBtSacatactccaKgVaaRMaBttgcataaacYtKgaVDtttgcatSaata
+ttatNattataWatWgBttaggtBttaaYataaSHtRtaccaacMttaccattccKggKN
+tMatacctctgtaYctaaccttgagtataaRatagaatRBtttttMtgWNtKtgcttatg
+actcSaatattgtBRBtSWVWYagtaWBcNatttcNNgSKacctgaaMKgatWcYHgRat
+aYggtctaMtggcagaRgaaYaYgKgaaHVtaattMgaaWaWaDataagaaaaBDataca
+tatgatcNtagagMtactcatgatgtHataaggtaHaWatMgtagcttaWtcStataStt
+agttttgcaagtgctgacDtgctcDtgaSgVMtagttKtaacgtacattaaatctHgatY
+atttcgggcaDtVttcaaacccgDgtatBggcttcBcWtacttgaatBaRNcgYtgtaaa
+aaRDctKctagtaKSatRtRatMaMtaacVYaKtactgRDcaataaatSacagctDaatg
+gttttaaacNttBaattgattaaMgVBKtBaacctYNcaKcaVtDYtcBaaataNSaBga
+tacccgtVtaatactSgtttgMSYtttgKtgtKacgtKatgataaVccaMgtaVaWattt
+atattgBNtgtVgVNtYStMtgtatBcgagaBaVatgatgBcStttgtagDgYMgaatta
+cacHtaaaaaBttKaaggHttctaggKagRNtMBaatWcagMSBaaVtgaatgtgatNaa
+tSagcaatttHctatWMtgVcNtSaNRHatVaVacVtHattcaataatgSKttttttgta
+taRKYaatccRYaatggtaVtttaaaaaWBKtatatttatgtagtcNatSaatatcMDRt
+gtBttYtatKaattaaaaYtcWccVattcDaaatgattgtHccactgNgctttBtgagat
+WDgVgtactgtRtaaggtBgacctaaatctRtDttaBRaYacaaaYYtcaaagaWaSDtt
+ctttggacttcBcgaDacHataNtNgWtVMVtRactggaaagSgtgggtgaggcctccat
+aaatNttaYYgtcBatattWMaacMRctcgttaaaVatatagagataKatRMtHaVagaa
+BBtStttaatcaaatgagtatcaagtRMtaccgtBagaWKtagaaaYttcSScttaVttt
+tcatatcaSgtcWNgtttagccaaaVgaatgtgttatgaaYaatgaataaaagagatctt
+cYacaaatataDgRttcMtcataYaBtctStgaatgagDaDgtRNaMtYMatatagWNgg
+aNtcattatgacYgtBKYttttagccttataaNRaatggaatccaBacgttacttatMNg
+gaaaMtaaRtctagtttttKKKgcBttgccgtHKatcgatVtttacataMtagNaMttct
+KHNctaaNatttWaRNgRatctagatSctaactctDttaagacgcatagcRNgagatttg
+tacattSattaacttttcgttgattWatKtgaatttaMtSBattKKcttaaSggcactaa
+taaatcactcaMgacggtRcaDScNctYtBRYVgttgtttaVtacHWattattcatttVa
+KtgKaacctaggStatttacaactcKNtaaacaagSttcgattatttcaRttVtaVaaac
+RgDtaatgtccMaacNtcggttgcctaattaaaNaWcgKataaYcctSgMcataaatttg
+aaatttHtagSBgKYggcgYaagagataaWBcMgatRBNRaYctgHatctatHttgaHtg
+cHKBKVaWaacacWNRactWBVttaatttVccaagBSWacaaaatcDgttattBtHaMtM
+tHacKgWtcctcctttHaatagtYttaagccaHtYatatttacgtcaSgtgtYttgBcat
+catttaNRgaKgBtgattttaaatgaattVaKtVYgNaatgDaacaaVtHaaatggtttg
+aYYatgctgcacatttttctacVtacaNatataHtgtcVtaacVgtYccgaactaKaaaa
+tcagtttaKNRtaaataMatgtacatatcKScctDatDcKttSattttagatgttHtcBt
+KgNVRagctaRVtttaNYWttcWYRatgatMgaMKRctNVMgttVagWcaVStcDgtttc
+tcRatBVggaccgaatcMttgagaBDgtNMgKKRBNSMgcaWHYWccNgcacaggVYtMc
+aaaatgBtaKcgaRacccgStattcHttgaYttattattctaVMttgaacDaWtNccDtc
+HBataNcRggaaNBtgaYNtaaMaDctMaaaaaaHaaattcBgtcgHtgcgaaStttcta
+cttcgMagagtaaaacaDctgcagHctHtWaacgaatgtggtDacgtcacataSaatKtc
+WBtataccaaScttNgDgcctacgBaNWtagataBaNtRcSggtaMattgaatgtRHtgH
+aaNWtgttaccatacctBataaMWatttNttVaaRagMataVtgtaccattYVcKYcgag
+taaYtttgDaKDgVacMtttaVttcYcgtMattctatatataaggaagagttaaatHgtW
+ctatttgaaatHttgScgtBataatgatRWgtttVgatMBcgctttatgtctgWKtaaca
+aHttaMtctttatcDtccaHaNYtSWcWNtHNacaaatactNggtgStacKatgtgKVct
+aBcaHcttaccaaWatHaaYtattatYtttDgtBaKcataaaatcaNgttNYcatVSgtg
+atatYDMMtggaatKMaagcttVtaNNYctKcctagMWtttatttBattNagccggaRga
+gtattaKatgatctacatcaKVaaagttYgcStagtctacttttcatKtWtKtctRaRDt
+cggtataMcMDcaattNcacattattgaBaHattHgcYattagaattataaBtattBKHt
+gtaacHtHaacaaRYaBttaRVSaagttHVtatMtcacaWctgVtgaatcVtcctcNata
+acacgWtattDWccatDDYtcgtaHaaKaacaYaHaataBtaaBKagtttcStWataccg
+NcaDtWNaaRgctcNaacttatttgttaaacaaStttagtgVaKgggtatNaatVagtat
+aVVaHtaRaccacaRatacNStaacaYDgaWaRtaKttgtaatacggtttgccaaggMWt
+caaccttcgctaMSaattaatgaaVDagttBcatccattttccaaBggRttgKgccaaaY
+NcDcaSatMcaattYDcatcWatStttggaaWtttHtatVaggttDgVWatttaBWMagt
+cagcgaSaaSgtattctacHtaaSaVacaataNKtatagRMagtKYBKggtttKatDaca
+WaYDaactagcaDttctctttHtagtMtWtttatYatWNaBgHtaBgSttRgattatgKc
+ccaaBtWcccataaNattaYtRYWgRccNatatHttWgttatactttacBYHaaaKaHYa
+NttaatagKatacaaatWSMctttcKacatMattgcaRctBataaVaHtataSctDVtRa
+acttcggScYctataHRHtgttctgtgattYatatYtcYHaataaataYtMMgttaaatg
+atcttaaattaKRtttaaRtaacttaBtgtcatgtctNcaaKactMtKatagRaDKaatg
+SaHcRtMDctagatcaYtRatMSVRMYKYaggataaatYtDBaDacDtaVtacggaKtta
+ttNaggScgWcaYtaBaaacaWaNVtHVagtBaatgaBNagHaBtaNatNttSgaaactc
+tBaggtHHtgaSagYKNcataaMcatagaSttctNBYcttattcatagagagtHWWDtct
+gMtRHtactgggagcKcacctggaYattatttgaaWgtcaVaataagaaNatRgtttacN
+tWYMBcNScgggataataaagtWYKDYcVWVggtttMcttYaatagaaKaaataDcaYMV
+caVtgtStctctWaagtaRtaagtaaatWacSKaaatYaScctggtgMKtYMtctacDat
+ctcaMatVtNaataaNtaattgaagaNaataataagcttaagtgtgcgtVgttataYaag
+VgNaaRctSctgWKVaYKgctNWMaaRaHatcgctHaaYMtccggattgtgBacatHaac
+ttggtggDVgtcaaaggSatWRaKtKacNVggaatYttatttattcaaSttttttttcaa
+tgttatttgttttaBgcatacWKDgtYNtcYtgtcttttttgtcaaatgatacttWagat
+DatttcacctaaaaggtgagttatWgtgHctaatMtRKagccagcgcVgagYagtactgt
+actttagVctaBBaYNggtYtaattttcRtaaagatctMtaVYatctYgNMaVtaWtcat
+tgRtaNataagaaaacVSctHNtcNaMaRYcgagttaHcgacNgagagBgtKaactaaat
+atYRcggatgtKtttactgDctcVaYaaSaacBcacatagaaataaaaWDctVcNtttRt
+cataatNagatVMctBgttcHtVgagaNaaaHaaSccggatSctaHgtgaYRagattDcS
+DtMStNYtgtgaagcttgggaatttttDgcaatHatgaBttHttaacatBcaaagtaggt
+KgagacaattaataHcaNaaHataMtccaKagagtttBYSagDDtaNaRtWtWagatSgc
+SKtcttttcaaRgtMattatRtYSHgaMccttttttBtHactaattcaHtMatagaattV
+tBtDatcttVgagtatttaaaattacYSattatttaYtagcaVSHattDctKcVattata
+agagRaccccWcaBtYYtctaaaaYccSgattaaaMDRtHatMaYtHtcgcaaggWgBaN
+VDatataaatWtcMYSVtacBYaaatactcgtacttttWgaacRNaattctHagcYtaSt
+taaataatttttaaSDtKaaMcWgBaagBgaatDagaaatactcctNtgRaattaNWcat
+tgYVMtRtHgBaatcaagRcagtStaaWRgtaaatHcaMacDctatNaagtactVHaaVa
+gMgttgKtgtHatcMacatagMgaBtSaaaBtagttaaNaYgStRRctYWYVtttMNBgc
+ctgMctcacttagtgtttDagacaYaattagaggKtttacaatMttctttatKagaaNtB
+tttKSHWSaVtVtgttaRSaYccgtaBgggMtKtttctYWttcaVaagctttttMBgDKc
+catagVactWDgtRtKMtgBKaDaVaggtttRaataBgttYtattatgttatgtcMMaat
+cagaatagHaacaattRcBcDatttaYWttagattggttgaMcgtYRgagMtcactaRct
+cBMaaNgcaStgcgNtgagVttaBaaagaatacgcatYMaaatDtacgatatataMtYKa
+tctScatattNgStYWgtttaYcttgtagaHaHaYtaRaaagttcMHaStatcatYtttK
+BtctataaaatcaStcatatStattatMtSatcataHcaWaccagHtaaggaHatatgag
+aaYYgtgVacSttgKaBacSYcaNNccBNtHKtHcctttMttttagtaaaBHBaaattWK
+gtaaccDataactgatatgtaaRVtaHgaattctcRttcgcatHtaagttYYctaaattt
+tgWDacBtataatttctVaYHtMtagMaHWtagatttcaVgtKaaacctgHagSgtacSW
+ttMaBcHttaatcttMaStYatatatattagtttggMaYaatHgaaaHHgatggccctac
+tatSgacaatcVMcatactBBMtaattaaatattBNDacYtgYattBttHtNcaatgcgg
+acccctDcYcDtttaKaSggtatcaBYaaBttctDSRgacHttagMcggtWgagtcctRa
+tatRcttgattggaaaKggaaaagaaSNtattcNtataatVttgagBaMaaBctWtHatg
+cDaatHccgMDcgcWaaDaacWgaagcaatattactcaaaatMgttgtaaMatatYtctR
+SctctWcatttVatgBNtaaYagNtaMatcSgSgaVttSaccaataccKRNcataaggYc
+DMWaSKVcccaaaggVtHtgHagMaggtKVatVtVMDVatBgttWagcctagagacaaag
+gtataatttgcttgtSaaccttctccttcaatgNaacaBtttaVcaacagWaHMttgtta
+agttNWaaYcgaaVtatacBatgagHtSattacBgttYgtNRRcttgatcttaHcaataa
+ttattttccttgaYgacVgNcttaRattatatctcagWWatNcDgacacgttaatRatta
+YcKtggtSggWgatMcaaDBttgaacNttctcaaHtHaagcgVtDaaDtNMcagaaatWa
+NtatcttcattSgatatgatactattWatSaattWccgtctaatcttgKDacatRatggB
+ttatggKgaagtttcBaKtgttaaaKtcgatagcNgtatVDagaDtaVtcaactttYgaB
+YcgaYgWgaWtaaaWatVtctVtgggKaVctcgRtttacMaVaaagaaggtVtKNYtWcY
+aVtRVccgaattatacttatattagcatcKBattttgVDggcKaHaYttgcggcNaatRa
+ctWagWgttcagtgWMctaataBHtttgHaggcctgacMcYaRtRtcggcaatBagttaa
+gcDatatatNttgtMcVtaaaHMgattVgaYgtattatatSaDaaaaataWacaaNttKt
+tcatttttHaMagatYtgtttcattaatatVacgcHRttacaYtaagttacaBtcgaagc
+gttWtatVWRaaSacggWaBgSgcttaScatNaHcaatWacaMatagttcagYBagYgVa
+ctWtgtStNatacatYgSYDtaaacSaaatBtttKaKRSWRcRYMgcYgVataSNNtWgV
+tSaMgBcactaaatYaKattVggacaWaaatgHtatHccacStaatagaYaaaVaMaaac
+YYMctcagaNattatctattaaatatgMaRgggtatgaMcttaHgattgtScgtgtatVa
+tHNgcYttNatatBWaaactNVtHScgataaNcBataggtaagagatttMatVtaagtaa
+atYgctgttttaagatagaWaaYcgctaacttaaagaattggtSYgtVaStttRtcKtHa
+VcWaYaWVSccRactDaattgWaBSKtaDgtataaRcttaaaatKcagtNgtaaataaat
+gattcatgtcKRctatHaYtMacaWNgagatcDcgDtatKaHgaBcaaaNWaRataYtYY
+acttgcactaaYDcKDttWcYataStKcgcaaaaaRaaNtttatttgctYatgtcVcttt
+cBKcgtcttatSttattYMttaatcatattcatSaYtgWaDacgaataactctggaDcca
+ttacgSagaaattgatttaDtHacgtcMgaMHaaNDKttgtaMgRNtacataWgttccSt
+gaaatDaagYRtDagcatcHttcVNWWataatataaccKaatWtYgcctacVaagttWtH
+actaRaagatatMMtYattMttccatactHgStagHcaattaagacagaMDtttagcHtg
+ccctttattatSatWataBaaSMaccVVgtggatgtgttgYgtDHSaaMaKcagaagcWa
+caaaBagRactKacDaDgagagagcgKcaBggtgtaYttatgcDatgaNgatagagtBtN
+taWatagcacgcgcatDRSacHttcataBtaWaNtgtaatcDctBaSttttaggcWtBac
+gacaVYtRttaacttatgKcggDStacgtagaYtaagtaatgacggVMKtWagcatatag
+tcataagMgatVagVttSaacHataatatacaatRYaHacaWaaactRtHRaatagcaVt
+cMataaacatattHaStattDcMWVtYaacYagaaHaaWaccNHcatgtcccgaNttata
+aNaacatctBtaDNKgMtcDtgMgtatgKgSatDSgMtgVaaHNWcDcaaKgHMtaRtgg
+cgRgtHtVtatHgtMggaRVgtcDgtWaactactgttagaKcccDctcNcgtagtgStac
+gtataNcgVaHHagYttStaaccWacaKctgctttaactagtVatttaaatKttRcgact
+aHttSaKtcagBBaWaacccgRatKagNagKaWtHttttcWtatatttattacagacSBa
+gDgtagtatHtgcattgcaMaRgtagatYacactYSBDgctgatcMattStSgattcNtt
+aBWaacatgcttSattttctatNttaHNtSctgtcWttKgttgtttttKaMHNMcaacaa
+gNattRtcBaccatKgtVtaaDcttgattaaaatHgaataKYtgagMtgcWaWgtRttcD
+aatgRtDgcNWSgtagtatRttDcggatHWgaagtacgcVtcaatHtttttttgaKggaS
+aStaataWBMtgcaaatacgWttctagccRtaaaattNWaMggataRRaaHaaMcagaaa
+cacacgDaatctactaactDgatgtttaaDacacVaNgagKaBcatataaattcgRtSNa
+atDttKgKDgcaaactBDtaatatagWaBgagtgtYaaVatatMtaacaggtataacgKM
+taKgcttgNMtRaaaaVcHctKctaaBcWtcHtaRaacKgcaDKaYaSHgtatttataaY
+tcaKatgNacgtcWWatgDttRaacaaDWaatDgagaStaVScctgcacaaBtatacttc
+tgtctttcactacWcaaaWcactKattaKtatWagttacttgBtgaBMagaattgtYYtt
+ttVatttWtcBagaatcctcWtatYcVttattMgNgYStaBgtttcttWtagcaggtMat
+gtRaaDtDKttgataDggtttatgctaataVYcSttBtYcatctVtBtYaVagtaaDtga
+gacctgaaatcNKDactgKtacgBtDKgattaaatagattatagactatggacgacgRga
+aYKgYaRtgaaaagRgBaacatctctMttgacNaWtctVagtStMaactacaatttcVga
+tacKctaKgcSactaDaatHgBgtHgYttaagtNYtRcaRgYtBaactaatatDctaacS
+KatSDMatWtagKtttagaaHKattaVactttSgtgtagWctaggagctttgaScatcgg
+SttaggtgHtgYatgtctNtaggaaatDttcctgagagaHagttKcttttgcHtcaDgtc
+gKtatcaatgcgStVcatcaWNcgtatttHtatctggaHWSataWaVttgKgtKBaaagg
+taMNaatttRDtcDattaStctaaatKgtaagtcVgccaHKgtgtcgaSVtaaaaHtatg
+aaVcatacacVtKattaWaKDgttctattgNcaagaacaKYaHttWcDaccattttagac
+ttttMttaRaMtaHtacNgccgaaaaacKctNgaaagagggaVttttgtBVcatttattt
+VaHcgattWttMaWcattagtaYcMagaatKaYtcatttagacttStDtcagacattctc
+YaaKMttcagtSNtBtMaHacYWNaactVaMgtcNgMcVcVtgKaaataaVataacaDta
+aggtcSgtDatttaKtgSNHcgctVaaaatatagacRaBgaNtaattVWaKtgcaattHt
+tctaNRWtaHtttaaSgWBctVacaNVcKtaaagHDaaaNagtYcYKaVKtaaatBaaaS
+aVaMtcSgtaaacctcBYWttSgMaMccagcttRgtVggaaWgagtaggYctRtaaWtgt
+acaaMNtagtacggVcttKcaMgNaaatgtatgaSgDcSBRgRVcYtaDHgaVtWaaNag
+DtagggtHagHgctRagaNacacaStaNttMaatgaataaSgagBgagtgWccDtVgagc
+DWVctBttccaWcacgHttgtcYtttacttaatVatgtKtaaatttaNaYttaStMtVaS
+tggattgtVgaMRNHtacaaNttRScRtVcgttcScatMtBtttcDtcatVctDaSctta
+gacaaDaaBtaHtacRgRgaRNtKataNgcaaScactcWtKggRagtgtaaYtaaattWg
+NagatatYtHattWtYWatagatatttKatgtcgDagaVcgKVagacagagatVgHWtaa
+gttgcatgaKaatggattaHcaatatgKtMaWtWaYSVtNBDttaaHaMcaRctWScNcg
+gtggYSttcagaattattggaaaattVccMtgggWatatHMaYtaMaacaHaagVtgDtg
+gcHtRaagtHaagVMWacaaagggataBRcaaBcttKtHtMgcKaVtaacaRatKRaMaR
+tMtcagcaataaaaVccNcttMtctattaagacacgagatNtatttataaaSagaaatat
+SccaRHKatYMacgttaWKtgttgHtgagatBBaRRWSacatacWtNtcWgttcaaacca
+ctVcaSaYtaactaHgtcVWgactaNaatRgNattatagacHatgcYWcttatctaagct
+taatatgaaRcaDVaSaHatgaatttBDacatBtttHactacaNaNtataVcaVtattKg
+MaSaSggttggDNcgtgatactaccYHttaaaMaVcBSacctgatatataBgcaattaat
+BaHtttgtaagggataaacatgcgcaaataatattaaBVcaWgttagtVaaWctRgBtgY
+tttccgYattttYMaVMtaHatRDaatgVacaatatVBccgttaagactcgcaaHtVaBa
+aRctaVgggaacRaaaaaatYaSaccVgRaaBtgataaatttcaVttataSMatacKtaW
+ttgcaRcgtgNattatttaatagaatNctcatHtSWttaVtRattcaRYtaaattDcaKa
+gcWggaWcStaatNVgHaMaBKttaaatYRMHaRtcgtagMRgtattcctHtcacaaaKt
+aNttcaRcatRtccgatNDagaBttDHtcttggccttaNtattaaStaWgKtVWNaMcca
+VgVgtatcKacDaYcccactcattcacYtattggatVgaWttctgSDagaWDattctaca
+taaaDggtactatagcNcSgagtgtMtaacNtVtcStttSgNDaDYgaaWVgtactRtaN
+cYgataHagaDtagttggaHtgtNtcgcHYgaDttgRtgStatcattttKtWVaYattgN
+taaYgYccHgWactgtaaaVBtaBattaMBtHtttYttVgtaYMWatWgWtNaccVtgMW
+aSDaatcYWccaaaHtacgKagtNcMKactcgtaaaVtaMatttcRcttgHtattattcR
+aaaWaWactgDttttccttttaKVNaVggataagaagWttcgBtBtVaYcataRtaacBg
+NaaYctggtatctacaaaagatttagttaaaaNaaattgctcaactttBKagatctgctg
+aMgtBttgtKaSatVgcacgaHNatVDgttacVBacKBaaKaBctccDtagctataWKtt
+agtcttYgtaSccaatcBttggaBtMaaaagaYtMgtgtNatgacacctWcKattctgaN
+taSgaaataatatVSaattaaWattagDtgagBaHaaNHtBgttcttatHaggaBtatcH
+tSttgccaatNgtaHtttBattaacatcactgaWaaaaaatggatagMHtSgaaBSatac
+BSaagMaDcaattttcgtctaacgHtaaaBtatcttaattagtttatcttcgtWVttata
+tcgccgaagBgRaDcBaatHVDtataacaccVgttHaaSgaagaaatcMSaHBattgcaS
+gaSVaRttcaMtgtgcaatKaatWggatBVgtataNWgNctttacctttgaaRatSaKtt
+HgaaaYSaBttVacWttcctgctDgBSgYcagcgggWRataaaatgcactagaaHStaca
+atHtggtgtBgcNDttggattatgaagaKaatStgcttHtgKNMNRagtaNtaDattgaD
+DcKtaaatcVVBtcSgNcRtcHataRcggctVBtccaWcaDgaaRaRctgaatMtaRtgB
+caWNaNatatWScYYaWttatScYtSgcataDtWcacBtactaWgcYtcgtataagctat
+aNSgBctagattaNgaKgatVKgtagttttcaaagtgcgcYattcagatggaKcMBtacg
+tttaacctaaattaaatattcatRaggtcgcccattMttaaaaaaactggSgtcccgtct
+aNtWattcaattVHDagRtggVSSaaHtattatWctatKatHtHattYBtaVaMRatgYa
+gcHtaSataaStKaaacattaagggttggVYaaDgttWSttcattaRBcMttttaacatR
+DaataaMttRgataaagVDKatcatacaacgMtaatYctKcgggcBKNgtggttcttaag
+ttYgcataVMaaVBgtVMSNagttatSttgtDtgtMgMDtNKtBgctattacagataMWt
+cSggtcHgggcgagtcRtcRattaaaatgaaYYattgtaaccttgatacgtWcHDgBtVa
+gNcSgBKtaaMtcaStgggatDaVtKScaYagtttctagNBtcMcDgKaDHtVtMaMacM
+gtagtaaWtaYtgHtttttgtctagYHtRaagacDRaatgctVMtttWaYaaNtttatat
+ttStcgactaDatKaatatattHggttgtRtattaattaaaaRtaNacKattctVaatga
+ttcttacWatgDgagggtggScatNtcMggaagggHtaaccttcWcatWaStagHtttga
+tHaRVaaSVNNtcaRacaNaKttgctgggcVattatccatVatataDtDcNgMBMgHSag
+ggaaagKctgggtcacgaatcaataaVtDttaRRgtctStattNBaaaBHatcgttaaWM
+agatagacatatVgDBttYMacaatttKtttaataaaagcacgVgaaactDBtaaccgta
+gaNtgagaaaRttcKKagtYKttttaStataaHgtcNDcgttYccaaaaMcaWtgggtta
+tcaaRaaggaataaVWcacatattaRYaaVagagVtcHggaBtaataNattagKtcVRtg
+actatcgHDaBgRBStVtSgNBccWDgaatgaggaaNctttNttttacaaggagaaDDaV
+tcgaataaataagttaattStBDccaaaBgVaDtctScgtgtttttgctgtcacgtttWg
+acStMtttVaVgaBtacDWtttagttDctaSDVtttNaDDcHatatacYtKataaatagt
+tgaacaagaatacaDDcacatttgtaaaggHattaaatgttacgtcagtNStttcVattt
+aBtHtVggttattaaHcgaWagaYtVaataaatcaBgaccctHcatKaDatRttHRMcgt
+cgggSMtaatNagtYtgaYtggMYttgtaaactacgKgStttaaaYatatDtaaSaVVcH
+gtagatgaggtcaHggMtaMWaWaHctgaatctaaBaWaDtcgggtccctaagtaVYDaN
+actataaNcctKcBcataaatttcaWSttttgacHtctRggagRaagacagWVNtctcat
+HtDHaRagctStatattggcattcattttMaNaSaRaNDHaagNtMgtVWtgtMccaact
+KNaaaVaStatcgtStgtgtaBgBgtaatcNtccgaagtttaWgactNgtaaccaatgNa
+tWttgWagtaaKgtctRgtctaataagttVDHgStgttcVttgtSWatcYaggMatgMRc
+BaStgtaaaaaMttaYagccggtgaRRatgatccaaaggtttctaaKgacaDagagatgc
+tcMgaaaMcgRaacaaatataaaagcagtgtatDHgRaVtWBVtggacatStctKccttV
+ttatgtKattttYcatctgttatgtcDKHYcctSHMttgSDRNgtaMNHaggatBcSBtH
+atDMBcttMacNaVMKtctgtttcgaHSgtMgcacagaStaBttcWcattctDtcttHtD
+KBcaaNtRNaaDgaaaaccMRtBcWVVagcttatcgaDYccacKtatgatgtcaRttatt
+YttctaMBggcaYctaNtBactgattStaDaHccYaDtgcaRDgSYtYtatBSaYaaata
+aagtctcgcgttcagaaKtttctVattagtWcacgaaVaaVtctcaVgtagttNaaacaa
+tgtccttaactaaaStaKWagttaNttatacaaaKattBctgaagaagtYDNtagatata
+DtHcKcctaBaggcaatctHttctaaDNtgtgaaaagRaattataaBMaggtDgtMaWHa
+cBStSMtcgaacYttRMatNacScgaaRtttctattcMaaBggtaKttaRcgtBattcga
+tatYtVaccSacacgtaaagtctNatYttgcSSattttcKccttataatcRtHNctttMc
+atBtacatgtYtctagcNttYacaatgtaBgcgttVtattaaWtaDRtKNaNDttDWaaa
+ataatDgcgcKtaatatcgctMctatcatcgtaaaaYNRttSaNtWggatRgtgtcttat
+aVgaaaatcWDcttDRaatMKctcatatRttBtccaattBSacctgMtaDDRagtcagac
+BNtttattttagtDacaagcaHcacgRttVtatcatatacStaatMaWagttRccKtRct
+cgaagttgaatttNtttatHaHttagctatSBaBtcaagtDaaaRtgattcatStagttc
+aRattacaVgtatWRttWggttttctaactttSaaaVHRatttYHMKVVcgttMtatBta
+SaaMctgMtcaagaMtactcDatSaaaacNgatttNcaagttRgacgataVtaacYNata
+StRtgaattactgtaKtNagaaccDaatgNDaaHcataDSYattatgtctgYWaaRaHtt
+tWggcKatgcgtagDSVtMactataKMSttaHaaaacaHatVaDKtSaaaRtcaNWHtat
+ttctWataagctttcccaacctNtaaacattcgagaBKVattaWtcVaKtWcggtaatca
+atgttcaaatccDttctcaaSaWNDataaKatBcaYttRtcataMVtKttggcaaNgtgt
+tatMaccgttgMNagtgVtNBWggaacacaKaaKctagtctacttSaKYMacaWtWDtta
+tagHBacttRttcctgttagtScVNaRtaacgScaStttatctttttSgtBgNtttStRa
+tNDWtctgatcKtgHcattatctaaaaattNaaaWgWaDWttWRtHRNcHacBVgWttgt
+NggtWtWcttgSatRtaaYtYtNaDttYagactStacYaYtNHBatggatacVtBatgcc
+aHcgtagaaMatgataHagtKgHaWcgtaccKaNatagWtDttcgtagggcSgtRatatN
+gaRtYataaataRtBtcttaSatcagatgaaSgtVtHtgtaaDtVactgattcgcatctc
+tBaWWtaagBttVgacHattWWgcKataHtBtagScWtcaNtHStBKMHBRtRagcataa
+YtNtttatacttaMgacccattgagtDYggKccNaaRgataWaaaNWDMttMacttaatg
+StDYgtattaBatBttKcSaactagtaccgttggaKacRtDaataSBaatacaKtgagDt
+NcttattaagYcagacttNNttatcBtHtgRatgccacctaSaatccaRSgtWggtgaaM
+cgcaMaagSagaaDatHcttgaaDgNRttaDKacgcataagYaagtMRttNaMMMgcggt
+tcgtRaSgacaStaaVgStcaRBKcaMtctKtctatNaactaHtaactaaatNWaKtWaS
+tRSKcatggtgBtgRBtagaatagataSBagMtDVataaDtaattgaYgaBaagWagaac
+aggaagtctgacgMgtgagaRVacMcBaaDatKatcNtKaRtcatDNBaaHatatacatt
+aWRBtcaccattctctaaWttWacgtccgcgtMctcaaaccHYtNDatttSaDMccaStR
+ttWgttattaSVKtgttttgtcWatgtgStttgttttatcaagacMttgtRDgcRtctct
+gtgggggcSaagcatVattMacattSgttaacctaaaaccgcagtgagNgtctataatBt
+HtacaaSccccMgagRVctYagcgaatttacMagVttaRDcctRgSSttttcHtVaacat
+agBgaMRagatRcDBaMtaNtcatggHgaDYgaVgWaaaaMKattBtaDYBaHRccagtt
+atacVaDcacactcgtaSctaaatatRDaccagctttttaatgtagaMaRaaKaaataaa
+atacaRagaaYaNtatKcDttgHgcVtaYgDacagMBagtgttatgMcSgWDWYWtSaKa
+agcatKatatctcaRHacagttaKtgBKtDRggtcaYcattcgcYattttgtccaagtVg
+cattttttaVaagtaaaagtWccttgacYcaagtaatataYBaatataBtaaatacactt
+ttRHagtttaDSHgNtNVcatKgaKtgagttgaaaHcgBattatHgRKtcaBaagttgtt
+tgtVatYattaattBatYgaatgMgtttatagtKcVctagttaaYWttWaRKWggYttga
+RgagaaMKtaggtattaMVttataVcagHYacaaMaattRRtataWaaRacHcattaVaB
+tHgtatBaRtttaccaaggNgtaDMtatYtaYVtNtcBRKMgaatRaaagaatactRatt
+ttNcaaaDDaagtagtacaNtSHttaaataattggtaaKtttaaBaNgtaagtcaYttac
+VaataataatDtgHSSgtSDNaattcRMBgHttctaagaYVcHcactKgaaNHcgWaWtt
+aaBactcgYtDaacgactMtaYKacBgttcttgttataBacatScBcattKaaattactt
+SSDaRgKtHHagRNRMtttBDtcaagcBcgcYattactcgtttacSaaNVagtacacgtg
+gtSaWatBtgatttWttScaaDtttggtKtNKaMtMgcttaHKaRaccgatccctgtggg
+agRMttaaMaWccggtttBtgttaaVtagMWctNtctHgtBgcttatSMYccttgHaata
+tctgNgVttagcttagggaBBSStaYgYatYgtaaaaattHatctatgtWRNgtVcSgtg
+cgtcYBagtRHgacttaaagSHatatBaaDgcaKtcccDgcacMttatRaacaataaccW
+tNBaYatttYacYtagagattRtatagKcatattDgKtNNgtttWNagggtacStataRt
+VDYaacgtaBtVKtagaagRttttttatataSaagaaKtaatatKtattagBtHataata
+tcWNaacagtgWaccatatStcYcaaNRctcKacKttgtStaaKRaWDDaatBtttgtca
+gggBgtggSctaaWtttYVWttNtctaacatagVYatcagatctVaHMgWtcaagtataH
+tgacaagttSacgtNRataaatgttgNtaattagaattgctMaRttBtacBatNgacatt
+tcaMcgtaaacctctagHctaaKNttBatatttaatattBaKtRagYtatattSgtgtcc
+BaNSattgaaattgYggcaaataatatHcaaaatcMBaagYatttttaYttYaStatttD
+tacRtgRattttttgDcRaggagcaccaattcRcttttataHcggatcatNSatgtagtH
+HcactgtWgtaggtNgactactHagagHattcaggggSaatgcaaaacSSKDtaggcDta
+tVagMtggactaBSatagMttaggatSYttaacBtagaNSVtaSaNcSScaaatattVct
+cYaWYtBcttcgaYBagWtRgagHKagagMaatttMatgtDtaYNagDtaBagcKcKcaM
+ttKaaaaatVaatHDaataacgRatBNVKtMaccYaaccMgttgtactagcttMatKgKB
+tMagtcttMWgaatRcacaaaaSgcgVtSatggcaggcgKaYaatgctcattaaaggDVa
+cStgttaMaaaaacNVtBtgcttaacgtDNaaRcgWaKtatactagcactgKVttaatct
+tRcgDHHattcStatgatcWataagtattttacgtcaRgaaMcDattYHattYgatatca
+cNNWtDatgaaaactgaatHaggaNcttcctKggNgatBaaatttgcaaaDtgctcaatg
+tYagacMgtVVtgDBaacVaatNaDtatctgaaggKcagSggVtacgatgNWtKWaggMa
+cctagaatattcttYaatDatcgttgatggtcaacgttatatgcttaWVttccRgVcaDc
+gagMtacattaMtaVWcgttRcatRacaRcMcaNtaYWNYgMtatMgccctaKctagHtt
+taaBVMaaWcSaccgMttBRgNcRWMtHMaccaatgataaggagVttYgaatcttagtgt
+cMtgcctVtaRtgcaccaDaagHactNYcNcttaaggcMBagaWtattgtgctaccacgc
+WataRaHtDtacgaaVttagttVacctatatStDgtggtaMgaSattcatgMcaRctatg
+WgatKatYYaaataNYcSaDtttgtcYttttttaBScatRtctgtaWttaatagMaacat
+DttaaaNgaacttacYttagaaccctgNgagMNHaaKacccNatgKccttaKcatDStaa
+StNaaVBatagttcacRtYcRcKaagMgctKtBagSaagNcKRttaaaaKaaRtttttta
+tHHNHaHRtcaRcMataKDDtNcKtKatctaaataaatRatYttMccaaaNaaWgctgat
+tcaaaKgaatScaNaaaKaBaaaaRNtataVcYDattagctattaaatWtgBWHgggtat
+catattatcVttcgHacgcgatMattDcaRggDYtYttNaaaatBKttKccStYVDatat
+YcctSacVcattttatMtWRctaYagRgctcttttaacVtagaNaVRaccgRaattaaVc
+aattgcgKRctMaKtttHgctttVMaNaRaNMKacHSagtWagtgNatKttatctataaH
+atgSaSattcagtDctWaataaYtcagtaYtctatHcgattSRttaaaNDgagatatact
+tVttatcataSSaBNaDataRtRRaattcaRataaRtattttNaRYtaKttaccaaaaaH
+VaBtttWtttgatRagctaMattgcttactctgatKtgatgRBttaataagYttcStKaN
+gcNatacgWatYaatctggVtaaattYccKagaVagggatttatttWacgaBcaBtaaDt
+tttcgaBcHDgaaSgVNctgaaKtgaVagtVWgRHgtacaatattgcMDNNataatagaa
+aataatNtNgccgaaMaagtgNttacgVHaacSgStBBtRagtBgtaaWgacttcKgact
+aaatgaagVaacaBtggtacattcaaagtgattagKagNatatVaKBacaMMctccatcg
+cgggRctttKaaBatcacaScaNaaaaatVgHaattaatatcWcacacactcatgctcga
+RggVgcatatcaDcatYgaggttDgWNagagaaagagaYttHKaatgtaVtYttSNaDtc
+gaatctattSKgtgtaggaMgtaccWcaMRtHttaaatgWtgtccgtKtacggacaNgaa
+cgaSgcYagcKBttNacaagatacgaagaVcBgStMacMtgKaactataSgWtaaaatDR
+ataaaNaSaagHttHWYgaccWMtatataaaaagatgtaKtVtgtcBNMtRaSaRacVat
+aaNaaaDtaatgtaaagaDgtataVDaacagatttWtDtcBgatggBcgagctcKWgtHc
+BgcMaatDNatcaYtctBgaHtccagHctttMtattgtBccaHMctatctNaaatacgcg
+tacatacatctaDactactcKtacctataDccMattRgRggHtaaaaNYcVtatccgttS
+aagYcgMatttaVattttHagVatVtttKattaagttaNaacaccHSttagDactSNgtg
+tttaNtVtatttatgaaacSaKtactctacgagttgaagtcaSBaDgtagatNaaactRK
+ttcatcWtaBaggKtKcYttaDttatMaWcStgattKattgtatatDttatDtKatgtaN
+tgtcgtcttttttaBtDBcaaaaSgDatgHtctacaattcgMtVYtatgcattaaaattc
+aVgatRtcagBtcaMaNctHgtatVatcHttcaDNKgtWcgagHtttaccattNgaactY
+acaKgaaagtggtttgtgatcgaKaHgaatYNtBgcaaVatWacNggataccaDtaaaWt
+tBMaBccagaHDaataaBaagYVacYaScctYVgagWagaYagtgatgtttWatSaaaMY
+DcactYtaStWgaaattacHgKDaYtttttgttcaaaaatttgYatatVcMatcactggR
+aaMVtStBtaaaagggatYaagtBtatcatgcDttDaaaaMatagtctaataNtcttWHa
+aatcaVttaRaKtcgatttataWRtaatatcDWcctaNMatgtttDaYaaWtMaagtcag
+aKtaMKacgccaaVatgWtSagtagctatttcactaaNcaaaNaaattaggattatMWgt
+gacgtcttcattacaYttctRRtttgMatggNtatacaataataNgatNcMttaggBcDg
+RHgatctttagtNtacaaccgBatgtHaatgttttgatatccgttatcataStaKRaKgt
+tgNaagagKttgNYMaggaattcagaactcaRataDttaagcttaccttttgVttaWWga
+cYggStacYcgatgcSccaacHcaYNtgRaHtcaYaacHctYacatagatBgtgacDaNg
+atMacgKgBaWagacaSgttaKcatactatatcaHaatataattctggtcNttaYggDRt
+DaSHgNttYaatWagagtagaacKtWtHtBatNtScttttacaattagtaMaatttHgtc
+tagMctaccagagttcaKcStaccKggaggtctgcNatctctDgYccaaVgttgaatgac
+VcatagtgtattttccttcatctacttSgaaStcagHtMaataWNDagtatttttatagg
+catNKataNaMtgctgtttVaacctVBDWattgHttatattaKtatSVSttgtaScgcMc
+ccattgggtagaKMgaSaSttYgcaaMaatVaVaKgtatgYNattcttagWgtcBaaagS
+aaatRatttNctacaStggtYcaaggttBtgaDWBtRtgaaDccacaaaVSatatBcaaS
+cWccgaKttttcgtMaVttgatgtMatacatgNttBaNaagtaggaRaBagaagtaRtaa
+gttacWatgHtttaagSaatgataNWattgtaSggHDtttBataaNNBRaatKWBgtaDc
+BaMaKtctaYatVaKataaaattWYcgtaHcttagtgYtgcKDtccatMSaaagatYcSa
+HatcaDtaatgMMatgcaaatgtttagaDDNtatttgaaKcNtagKYcaBMattaaagtt
+aaWDacgRaRtaKttaaattaVVKaMaBtaKctaaWcatctRMtgKcBaBaaagattHcg
+McgaSNgactaccRatHtaSNtctYcaaBDtaggaagcMatttcaBcDaaatggWtcaHc
+taKtHcHMcRgattgaMtNVaDagttaggcttYctcatDacWDaaaaaKtaBgtBaatca
+ataaKgactgactcNcattMcacatNMattgtaaaNaaacttgctaRtttacttaatKYg
+cttgaSStgtaDaNgtaKgBgMaKgccagtgtMgatHDtgacaWDttHKaDgMacttaKa
+agBtttgtcttaagMagtaHcttWcacaatSatgYtgacHgHcaHDgtagaDccVaKcaa
+taNttccHYctctaSRtaYagtNgDagatWtRttSttNtRNagacatattttatggacta
+cYMagtMacYaagYgVgKgtNtaVcgtgaatcataatcgattYtaaatYtctgBaMgNWN
+KMgDttttaWtaBaaHatNHaDacctccNKtgaVcWattYtgccaVRattMacBtcccNa
+gYttBYNgaBaaaStWacMgcttccatgHaacttYagMtNaaVSYgcgatatHcaatatt
+tgtgBcatWMtaaaaDRttHaBaHttgaacaaataaWaMcaDctgBtatWttaacaaWac
+acWtDtatttatWaaHacaVagVgKaaaDttWgRBVagttVNttctgcttgacatttSHH
+MKScSgSaMtDtaMcgtcaWaacactMcaHWRgaactWtcgcMNcactVDaatHcDSttW
+tagactatgaRNcttagataYgaggaagagcaSHcWtMaKStatgYatttttVaattgtt
+tWataaaDaDgataMcaMtatttctVKaKgcttcctDagtgatWatacaRtttaaaBSMc
+tHaaatcagStatStgaaVttaattatttgctaagcgagaWaaWtccgcaaSgaatVgta
+StMcSNcgtWggMVWNatHctggRtttaacNagtttRtaMBgatatHtaatcMaaaYgat
+MtaccttaagYatcgaaattMataaHatYMcccaaaDaYaVaWgRaHaaaMcHSattcat
+WSatttcaMtgataKBYtactgaNttgaaDactgBatgYgttaagVgaagDagaatttKN
+tgaMtHagtaaHRgaaatttaYtaccNcgWNcKtaYtBMctVBWttttaSagRHBtaHtc
+gtactHggagtaatttaaaVVattWDgtaaHaYgDtaacatDtacWttttttatgccact
+taDtagtaaKgYNcttMNDaBcaVMcMctWgatactaRcaaWagaatgcWcRtattccag
+KgaNgtctcKtWgaNtSttagVaagaSYtcctWatatSgaDaKcactcgBtYacDgMtaK
+ggtKcDtRtRgSaNKctaatHtRDaRgatatacattagtgccSttctDgcgatNcatttc
+HgcKtagcYgttttgNKWRattgBtaaNcRaatcNaagcgaaVKttYtWttaBttttttN
+ggKcgaRBMVtNcNtDVaaMtcBNaKtaataRMcaaaattYactactBattWcgccgWaa
+MtaBYtgtaHagtcttVttaggaHVaaNaNaatcttgtgcattttatMDYKccataScaW
+gNttccttttMaRcVtWHgaaatgBaaRatgcgatataaaWYacYggtacttaaaaDaaa
+ttgatcWaatgtttRcatatcaggaBcttttcttVKatKccaccYtDatMtcttacMtSa
+ttaatatagaatgSgagYgWNtttagtatgRggYKacaatattgggVtttaSaYcaRtBc
+ggtDaggYaaactNataggaggaDgaKcaaataagatMKaattaaNagtagttcWctata
+aDtttcgtcgtattaccStgYgatgKtgcccYatDctYtttttYttaaaagaactcaNVa
+aYaYtccagacBttKcaatKataatKVWcBataaatgttcctatYaacttaSVtgatagg
+VatgagttgatcttacgMMgtWtYtagcacaSctcHYtataattMttataYaaccKgtgt
+aaKcYagaaVtcBKattStgcaaKcaKKaHgtaaBtctgcaattaWgMcgYttMctWtaD
+NcDatggWaattggaVDagKattttgaaaRHattgMaaMgtaatcattctKgNaacaccc
+NHataaaatgaaagagSatKtacVagttggtcgtgcBtgtgcatgagcaacataagKtca
+gtttgtDBBHWcgaDtatYttgattcttaaagcMMttaKgDaHtatVgWHccgatKttca
+aNcYtcaaDWDatcaWtBtWHgctaaMDaDWtWtNKcRRaNttVgHaRgKgcWgattNaa
+attaataNcaRtagtRgaacagataDKgtatScattaDgatcatMtcgYcgtttaaaRct
+cagcRattaacatccStcBtgaccgtgWaaagaaatgaaWtattaVtHacctaccaaatg
+BgtaVVYaaaatccKgtcaactataDgNagtcaSgtKttacHtccMKKWattagtatNct
+attagtttWttRtgaKaBHStgRagattaKRtWaKttaaWaagtaVccctgcgMRWatgt
+tNKgtcSggSHtaBttgtaYaatDtaVtaatgtHcatWaYcMttataVgaaaaagBgaag
+RattccggcttDgggcttcttaacttRgaStaMBaaMtctMBHBacttVgKggcttgcgB
+cBtgDtttcctattaaRcatStNgcKgctatcccacSctcHtaHWtgWaYatgVaRRYtg
+ctaaaatggagacctMcttgttMagBaKctttYWBtaYKgcccYttaMgtHaaNYgtgta
+gagDttcBatgtStttMtBWtaaBctaggaaNgaRgcttttttgtagacRttHSagaatD
+aYgcctMBtgtNSNaaBttgVtWtttKgacaatatVttVatagatttgcgtcgDtVgtSa
+ttaaaVHtaDaatYttatKSWtcattagtaaNatctcagcgtgcKcatDtaBccaaccct
+gaYcattaNaagNaKgagttttcattaHMaVKMDDtaSHScaDattgcaggcccMattat
+acYtMatWgatttcBcBtBctKacccaaWctatccctcaacaataaataaMttgtaHHcg
+atKgaggBtRYattatacgtaYNBacagacaaatVtMcttttRtVcaattgtttgaWtaa
+SacaRccMcaaacttttaaacgtacVBtcWcSaYHgtattacgRtgtgtaKgWgaatcta
+BtcgtgRaaaWWVBcaNtcgctgYtaaaHaSccaagaVMNaacagattaHRaaMWcVgMt
+ctgcatgaagRDattactgcKHtcactYtccttatgHtKgMgKcDtacNtcaStgYccaa
+DagttDtttgYcaagcacWWttaMgccaStaaWtVactgaagtKtttcaWaatgMattat
+KcctctttttcatgtaaactttNcaaKgttttMaMcYtgWctMtttactttagaKtMgtt
+DYttctatagWcRttatYSagacttcaScaacaYtSaattcaaagtgctSaagctattaa
+agggtaactcacgDKgttaMRgggattttMcgttattaVtccaNagaRgMaataaagaSt
+cSaacgtaWttatatHgttHBcgtacggKBtSatDactRggaRgccBRttctaaaatSac
+tcKtttVaWRatatttWaHaKMatgtacatcagctaatggBgaBNSNatatcYStagaat
+SNattaccgtcaataaggYMRtaDaatVgYaDaattataRgVaagtgcaNKtgttgactt
+atHccacHaacVcWcNMDtatcatttttaHacatKtatagtgccWttaattttBSDaKaH
+aDttYacDtBgtMNgggBaaaaattDaaVMaKgatcggKtgtctatctctVatcDtaaga
+agtgtaMcWatDggaaaaaYtcDVtNttcNacgaYtcgatHctctaWgaaggtMttcKtc
+ttaMgtctKNagcRWcgBVtcBDatYKtctaVaaaBgtaRagcacggcaHHagcagaaaa
+acgggtataatcaaWtacYcWtcctaBgVVaBagHaaaaaatataRYagaacgggVtttc
+HaMtNtMgcgaaatKtattaagtMttatcttWttttRaatatgttatgtatttRaagKtB
+gtgHtHDggaBDtWccattcKtttagtttagtBYcDaMBtgatcttgacatKctBcaaaa
+caHtatggaNaVttcgttatttttttcaaDtDDaatcaaaYaaBHttaMKMVgctgWtac
+VtRaaactgYtcatggcVHtgattRttataBtcgaaRataDttaatcattHtatatccNa
+ttcaaHtgKRtRtagtKaRWaataYaggatccacttcacaatgtgatMaggactNaacca
+aMaaKtagaaMctacttDSaaaWSgctcagtWaataWaHtStMacttaDtgagWaaaata
+tttatcaacaactRtDgYcYtatatgtataatWtagccaagcgtttataatDgctgVaaa
+gHaattagaatBWggttctBaNtactHtKBtcgaaaRttHBatDaaKccaSHgtgctWtt
+cBaatcctYttgaHacgtatgagStatRtMaacKacacggaaSctagDagNttgaKKSgt
+ttctacgtagSataHttDctggBcYtttaaatcgRgagagaDtgRSaVStggVtgacgtM
+tatgaaNtWtHgtDaDtgttNaSVagaattccgcttVatatacattatataYtaggYaaa
+RDHttHYDtNgcatHggctattYtaMcWaaVtaNtatttHaagBtatcagatHtttgaaW
+WtttKaaaggBtattHagtaacactDggtattttScttaaaacaStcaacHttMtatcag
+atSaHtaVtBaNYcttHcatgHatagaaggggaWgtgBtttagtVttgacatYtKtatta
+YSggtaaaHgcaggaStHtYcgtaaDWgtaaaMcgYtNHtgNgcttttataWatttKWaa
+KtHattgRtBtMMccgtBtYttgaKaWBatcBgaaacaBgaagatYgKWaaacBgatgtD
+aaacttDcacgatSKtaVaRDWtVKgHtcRattactctattBacaaactaatgDtaatca
+tatKRattSggtcggRMaaHVtgttMcgatatcccgVctKMgBactVtWtBKtgWtaaaV
+aatRgKatttKSaYHtcVBNtgStgtatNStaaccgttaaaaYactBgaaaaattacacV
+ttKattVNgaMattNccctaVtaaStctgaaVatactgtctaaaKYNDtataWtattaaN
+gtHtaWgaBMttttccaaaDcgctgagBacacttctDSctcMtBtNccaacaaatSVtat
+WggagSattKatRBaaaNtNtttagacttaagtHttaatcgtWctHaMBaHtaaagKaaK
+ttgatattttgKcgtcDtgtKtHagDtMtatgatcttgtcSgtWgctaaaaattDaaaNg
+NYtMttNHgtHBataatMgMttctDcgtNtNatggKatHtaaRtRtDStttRVcaatKga
+aRSRtBttatccataaMttagcaaWtagtVgaVBatcVtYtagttgtaMactaaataDat
+agNttttactagcgcKctDatatDgaHtRatVWagaDtttcggSKataacaggaaKggMt
+ttctaVttMaatgattcgaagcgattaNNtYactttKgaatWttNNgctatatgttacKa
+MtaaDgtKgttBttHtDacaagaaRgDgttWtaatgVBcaaccatgcYggtRcctaaDaa
+HcatYNaaVDNtBgtBaattYYgcHttRctattVtattgttcKaaatagtacccttgcVt
+aaHttaagaKtaagSaYtgcacttDattYttaVgRcacaattDDttagattttcHagcca
+YaataKaatccVDKctNcctcaaBccaaBaYgKacWVtWttatgcSatcDHttattaaca
+agaacRSactBHttDaBBBcacgttactHaKgacaKtaWMcHtaVHttaattcgttatat
+BaaagatgaactaaYgDNattNaHgHKtaatcctcttcHttagaatVcagaHtagBgtMa
+taattaagtcSRcatSagMagaaaacgYacgagcacgBcggacaHKaaBatSatagtatc
+DttRHtcagtDtaStYtagaaagtYNHtgaacaatgcgataaNgtNVagtacccctBcga
+YWaactRtDtatttKatBccVKtHttNcttVtgaKMtgcttggcgaNatctcKggtcttt
+tataaacWaBttcgHtcaHtcgatcgcggccaHaagcVgKattBaaWttKcttaVaagYa
+VacagaacgcScDcgatataagttttacaaKcaaaBcYcHKctRagcgaatgtScBagMt
+tYHtaatHcKKtgggatgKSaaatactgWBHVcagHcttVBgYDtaVtcctcatRcVKcN
+aaYaBtattttatRtVtDaaScgtatacMatcaaactagtaKataaatStHtacaagagt
+tgtYatctagaBaHSYtaaataaaStacaHagWSRSDtagtatggctgaKtaRctaaagB
+tactcttatgBcHcNtNRNtHataaccRttagatataaHtacScgtattgttgtDcctaY
+RaattccaNatgtgctaaaactMcaWttgttgVMaSgtaVaSctMcagtcacNaWacgaa
+tWtaRtaatSgatgaaWtaaWcgtttHtWcttgatKtgDtDMcagtcattcacttgaaat
+actWgtattcHttcataactgctgtgtKatRagtaatttYgNcaatcBctgtStaggtaM
+atacgtYaRNtgNaHtNccRtgcSHgRcaatttVcctattaBKtgYtaMaactRaaaaBa
+attHHtatVNWYHaatcagtaMVtttctattWHtttacaaVccDctYtttVtNtRRKtBg
+atHtBcaatHYaSgaagaagHagtttDaVaattVactactYcaDtKttgVVVtaWtggct
+aSttgtaataDctWactcaRttWcMSYtWagaagttctKHcgKtDaYggaDttgtgtata
+acaRKctaacttcYaDtccNaNttaYtaatagRttaSagaatBtVRtaatcttatgcgtW
+tataaWgHataatttYYSttYcggKKtaHcttttagHDDBtggtttaaacatagaRagtV
+agactttacKaWDMacgYaacctgctKaNattggatggNgtKcYSttttcctttDtYttB
+catgattSHaaccVtccatctcccacDBtgaWBaMaaccgttttcttaaMgScBNatBta
+gtcttccttatKBRcctggtVStatagcDgMgtacattacccattKKtaRcRatRctYVa
+SagttatatYtcgNDDggKaHggcccgcRtacgDtcYctgaaacHtatattaVtcaatta
+aatgaWaBggYtHYYaVagWacaNtDtaRattgRacRtacacatgHtagagtaatatttc
+tgDDcttgNDagcctaaHtatYHtKtRaScgtattMttacaacHggttttatSgaHVVga
+attaatagttattactgtRtaWgataMDaaaactgNYacYtagKtaRcaYDHatatVatg
+gctKtWatHaNttaatttttgtaagcctggcgKataaNtttRMNggDtataaaatVcMRa
+taacagctMatBgMtaaVcgagattcaaaSgtgKacgtDHatWaatgttcDtWatgYcWR
+ttcatBSHtttgaatatBgaaWgggaaBcctSSVaagctSctagYatDggtatatgtaat
+atgtatgHYcRtagagtHcgggcataDHattcaaattcRgcaaaataagattcaaYVtaB
+taagRagtttgSRtgRYKgWggtttaaHgcHStgtggtctaHaccaccSaaaattaHatg
+ttVtataccagaatDKVtctagtttcaatgtNctaccgDcacgaattacactatgaaggc
+cKVatccaSWaaKHtttSggatgagMagttgcaatatKYtacBttaccatHRttaactta
+caDKKtaKaDcHHcaYatatgMagaRaNNttcggagYRtacMtHgacttagacBaagggB
+atcttgaRDactgatacatatcSBggtaaaVWgMaatttaYtaWacHattDMtttaaaRR
+ScatcttctaatacagtBVgtgtttBagtatgBNcaagHaaaSaSYKcacMtKatggcac
+gcctSRaagcataattaYacctMaaKtcggaBaVaaWaDMttgccttaaacttDaaHacN
+VtgagaataccactctMttaatcttHcctttaggaKgaggWtaNataYgtaggtgaagtc
+WDcWaBatattRtVgtRgVtataacDDNttatcYaaaagcaVgtYggaDattccgtccDc
+SttaaWtttcaaaatggataSatctRYcaaBctMMtcttaacMaSgDatgagatcaYgct
+cacHccMgaacatcDNgtNRcgBaaatagaYgatgcttRaattStccttgagcctaVaag
+ggatatcagtaNMttaaHcMaatccScBtYaYttatgaMNagtgHaatHacaHaBaaDta
+RNDNcBtagBgacatStagacttgtaatMtYaNaKSaccBtttHcDaHNBttBaacSagg
+agaacgWcMgtRcaagattSctgtaBtcaatMtaHgcaaccataVgtaagDRcDcggaac
+caBtacVMgSttgtcataaaaacaMataHatgttaacaaMgtacgtMVcatagYtKgtgt
+cctaBcYKattcaggBaaHagStcNcattatRRaSYtYDRaHYttttggaRggggttatK
+cVtHgctggaNttaagagBaacattggYaaDcSacggYaRttacaacactcDcacBDtYa
+taaaaDWtctcaggVtaYttKtaVKtDSaMtYtYcgtaacHtRcHctaacBgattttagH
+aScDctHttaaaatVaHttggttatttDtatHtcaHcBagSttttDctttWtctaaataa
+WtHYtRgtBccSaaDSaNgatcSttaaaatgaYgKaaDaVatatYaRaHDtataKaNtag
+tacataggSaatMtctMtccctWgaYtaggataMttcgtacgccYgBSgttaaHgctRgR
+gtDVSRattttttaaKtRMtatSgRaatKacMaYgggtagBgNHcgYRagHcatatgtga
+acMtacSDRMHaaacHaagtWSMcaattcagtDctBattgttcatttMBaDVHVDBtaat
+KactNacgcBYtttgatctatVVtatcKaKSgtaWcgtcgNYatSaRtcaggaRtctatt
+agattKHttYaaBtcacatataattMgtatcataKKatDVtWtaHtHHVaggaaHagWaH
+tattgtDaHRgatgtaaaWaaSStMatttgNtgtcagDWgagaBagtcattaataggagt
+tcagcHttgWagaWcRttaKttaDgaDWtYacMWgRaatatccMtaaattRaatacaKYc
+gcatgtatgtNaccataSttSatttttcgatcttcaaKcMDatgaattcaMWctKNcHtc
+tacaYgatgcaBtDDWtaRtScaYaatYSgBtDcaacYataacgcDgtaacMtSaaKcKt
+tttDVgttgtaaNcaattctcaataaatcSVcKaacattgggacatgaaaacggaggagt
+acDYgatMYttaaaBBctccYgcgagccHattttaWtataYcaKaaDYaaaStMctSatt
+aatataNaWcacaataVtcatacaHcgMgaatYgaataatRcWcgtttcNDYcacaaaca
+caNttttaatctaKtRttHDSttccWatatagtKtgtcgaccaBgtVacNaYBHgtttSS
+agcNtctacctttaacgacaDcWVacSHcaNacatttgBYaaagatWagaacYMatcKgB
+YcBggtaWatataKcNgaaaattHYtSaYDVHSactgttNRgaaaMBtatataaaaacVt
+ctWtgKggtatDBgHaKaHVcMWtYYBaaattaVtcgaaacatggagYKtaaaacagttN
+tttatcatgctagYcctctNgttctgctaYttBataaRtattgatgaaactagttBgagt
+cttccatBagatctBaaagSacagtaaStaaatatataataatcttaactatVtaaBatt
+HcHgcttSSaaDRaKtataagggKaacRagBaggtaMYttggtacMatMttttYttaact
+taBaYaaaatKgtactactKDctcttgaDtMgattgVgcRaaaKattaatataagWgttc
+aWgtcaKtatcgacatDaaSatHtttcagcNtatSggtgtaRtgatttStBaNaHgcagt
+taggggatWtttgattttatcgaBtctaggcgtgtgtWttttaaSaWKctWggtgataaa
+attacBtMRtatccattaaSWttaSMcYtHtaacttaaBaDattctatKatctttcatDt
+cgNcgacttgtaaaattDcaVatRacatgaaagtcctgtctcatacatatcSWgNDttga
+aVKatNacDggagWaaatgaaVNtttBataaagVttVataataYcNMVaNaKaatRMcag
+NacVRactcWgctttNatHaRaBRtaaatRtaKtNgYWattaatcttaRttgttcttaaW
+aaagttcNVtagMaBatcVcgccDaaBMgKttgaVaaccgYtRaactttYtcatgattgt
+WSaaBatagtagSataDgatgNtaWatcaMttaHattagVtggagaNHtaatatctNaag
+aDBatcttttaRaaNtBYagtaacVttYBtaagcaaaMatcNgKaggacagagtgaRatW
+aDaaSaDaaattVgcWttatBNctgSagtctgcSttacSRtgatHDgggcBagccDtatY
+aaagaataDgatDaBttagctatcHtcWtagggagtDtSaaacagtagcttVatgttggc
+StataacttVtaatWKtatDatcttcDaagactgtgDNBaccaattaacaaagaaHWtat
+ttaacattWaatgttcMttaNNcYaRccHtacRagatccKaaYactcVRDtcHVtgaaNa
+SatctRSaWtagagtcgcaataDcagBaagtctSNagaaaKgttataStaatagStaatS
+atataWttctcgtaDgtYRcgtHttaKtcDttRaatNacYgtagVaattNttttatDgKc
+ttttSaaattYcgYBaaggttctagYcBataacVcagggaWtaKtacatgcYcctatccD
+atatagtcRaaaSMgtggaatcaaMaatWcgctagggtcattaVtctaatgHcaSHtcac
+ttBaagaMDtactYgtttgWgacccStDtagaDaBtgctctttKaaaatMttNStggttt
+atWttYttatKMKgtctaKcgaBaaaattcccgacYtBcaKaKttRccaaBaWgMaMatg
+tWtcRDWttcggacNctataaacKaaatHatggDatSaaKtgcgRaaacgtgttcatNtg
+HtcaataaacaaWMKatattcWaKcNaccWtggttcctBaMttgRtggtWtaaVggDgtt
+aDaScgWccWHatacaagtaHtaacttWaNatgtgttaacKaVtcataDMattgtaKcct
+tttttStaaDDtHYattNtcgatataBattctWRatMVtStaSaWttNRacgatagtRcg
+cRtcctttacagBKaaVcYtRaKatVtaWttaVggBBatcaaWatgtggagattDgWttt
+caataDtactRaatBattWVacttWVNtVagHaHtatttaVagtRMMtaBattatataaN
+aagatHBtgtatVtaaacatttagtccaKDcacgWaaHagttVKBgcgRaSYtttVcgaa
+caBatttaatctaSYtccNtcatctatttatBaHcattcaBgDMYtactgScccttRcta
+agtaaNtaaaaattatggtVataaagVStcaatcacgcDaatgtaacatDBagtcgaaRD
+aSactgcagaHgttYatgaVgtNccttcaKHgcgataDcgYtgtgBatcacScgctBcVt
+tttcYaaNtttttatcBaatgataYgtgttgtatgaVcBagtatagtNaRaaatKVtcRt
+cWatctaattgtVgataaMataWagaDttaatRcgctaKHgaRagtDctScatNgHgtKg
+tDtHBVgYcagatgttagcgaataaNBactBaaRaWcRcMctctBtWKaggcaataatSY
+tccagtRtaSVtRgatctaBgDNDtBgtttgtaNtWtaatatDtataacgccDttcaMaM
+atgRtgaaaMHatgBaatgcccDagNgttRDcWtaaaKtMSaBgctgcaatgtSVattRW
+cBtDaaMKRcccWtVttaaatatttctgtcatNBgaaaatHtttWtYtttcaacaaagaa
+NYBaatatctgatNtgaacaaMaaYcNgtgatttWtNaatWcYMScMctaaStttNgHtM
+acgtMDtgagcattcacWtttKttBtKaKcHaBtttaBacgaaNYaaaatBaatNHgaaa
+tMtagatDcaagMtaattctKtgNtScaatagcaHDagtagagSRcagcaagaccYHtaN
+tBatKtStcRagtgttMaYgtgggtNatSaatStcYtaBaSBtaggtctMtatcatgaat
+tactcYtNagaaaDtggaaatKBattaaatcWgKtStKtcaWMggaattYtggccgaWca
+cagaNWaNgaacaYaHgaVtMctVHttaKDcctNccBKMDagtatgcHtttaaaDaggtg
+HtattcatatttaagcBaaaRcSgttaaatgWacRatacaaatgBatYatatRBcacaVa
+taRaKWMcDWtSaatatHattcVgMKYtgtaVBtgagattRgaatgaDgtcaStacgcta
+ggRggtSagKcWYctacaagtttBtgaBttacgaStHgVaStgtaRtacaDccNDattSR
+gttatMtNttttWHacDtttVtgacgYattccWctaagtgaaaMMatgNtctaataRctg
+aacatttVcNtgtttgaggcaaagtatgVgtaVtgRDcttBDtataaMBatatNgataat
+aHaaaNacaStgaNaHgYtgacagtcYDggagattNcaDtKgtagMaacSHRtcagNaga
+tKcatataVatactgRVatgBtatcgttattHtHcKaDtagRagtgHtaDcVtatacatt
+acggcaKttattgacatDaatgtctcattVcaRcttttgDtNHSggcttaYDcHaatcDY
+acccWaMttgRtNggYtttttggDgctacVDtBMgBaDgtMaaBgctBVttVagaHBaaa
+aatgNactaattattNagaagNVaBgVtRgggatacgctgMtgaccatMaaDYDaagctg
+gtcaatggtatBtNtccWtWKcaNcBttactgtgBYDaMtMtcWaatctWYHatccgWta
+taaaNNacNgctYagtaaaRtaaYggcagaMaagggttHaatatcaccVtagtggcgtMt
+agtcaYaaRttWgBtctgaaBtKattaatYtacaatcKcacNcMDtgtactatcDcgRta
+aYagattgccMtgtYKaRaWHgtaccttagcRaWaagDataccagcatcYtcaaSgVaca
+tttaSttSVDSctactgaNctatVattttacgaggWgtaaaKtcNgatgttgcaaNVtta
+gRtttttRttYYaYcaaagcVDMaaRaRtccVcSattttcaattagWattMMctataWat
+ggtaagagRaaattYKKtgatagcMYgcVcgggStattacgBBctNtRgacaacYHctct
+NtataattBttStaRaaaatctgtWatcRacaaMtattYttKtccaatcSttatgtaWtt
+cgcaaWgtWNcBccRgtBagNgYtDctatccMaagtgcYMtYctYttgtcVaaHtatgcB
+aaBcgaataattcttcDaacaaacBtagWYaagcaVacYcKYttgSaKVcttccgcctca
+ttctcaatgVgaaacatWWctgcagtttctttttMagWttatRggcattattVaagaBBt
+tatctattatMcNtaacagttgaaaBaRtaRRtNtataYNtttNtcctaVBtatNtNgBt
+aHHYDttKctaDctcaNcatgDaYatgYagaDcaHgactHgWWaagWtSttctagKaagg
+YtcataYgBtccRaggggaaaHagaacaDatgaaaatcaKtattgWacgtcMSaacYaYg
+cWYNgagtaMgtSccgaaaaaatctggaMMRaaaataatctaaacgatatgDaggaVKct
+tttaatgacBttNYttagtatDagYttWctttNgtHtcVtattHtcHacattatHgNStg
+tSaNaactVMcaatcccBHNatcttDtcgaKccKttatttctVRaagttaMtaYtcttca
+tMYRctttRtaMgSaaaactgWacHagtacccatttcgcatgagtaaagtHcaKgVBtaa
+ttatBtttWatgMctccattgactattcttgtcatSttaaHaVtKtDcatcatatccaac
+KatattatNggNaRatcMSDHRtcctYRaatccacYaatBattcttBVctatatttRNtg
+aNtcaaaRgtaBcttaaDRcgctacWcttgatatctHttttgtNtYatatacgaVBgYHg
+attgggtcgacacDtttKVcaattWRcaagBtgctDKDaYtttcKgNgggtcacVagatM
+gtMVgVgatttcagtcgtgKgtKYgtYSaMtgataatNggattKNgaSggactaaBagat
+aacactcataVgttataaSacaatcRRaagtaDaagDYtcactgtgaVttWtBaMttttg
+aHtKaYtattccagccaaBaggataaRtBatNcatgtatatttcttacaaYVNatagaaa
+gaSaaaagaaatSaBgtcgattacattgWccttHNattataacgVRDtYcWgaaYaVgMt
+tcttgtDtKaYVttctgggSNtaYHWaaHactaaSSagttgSaaactYaMttaMaHVRtc
+gattaccHtcgcgatgNcaYtatattacgcHaaaMNMtaYDgacaggRgaYVtVKcaSVc
+WMBBaWaWcagtatHaWBNaMcBtatccatgaScHtYtgactcattgaYatRtacttYtc
+tttgBgtattaaDtcaHgcNcaVatagtttggggRaaaccWcNNttRBgaaRKgaaNtMa
+agcVacgtgttaaMYWtcBYtgagtaatcgttttaatcgaaaagttDcaatgtggtBaBc
+NtgNatBtggactttagYttBcgttRttatSgacNaDttatRKacactgcSKaVaaaRgH
+aattaaaRctgatKaWcctWggWWagccgaactaYccttgtgaBHggcYttttBccttag
+gaKtaaaBacVDcBYYgaWagaKtaHaaactaNttatagtcttttacgaccctttKattW
+cgHgcaDccctHttatVVaagKaatatgggMaNHagattgNStatBatcgaaYgcVcaga
+atcctcYtBKDatatcNKgacaatKDatgaaacgaaatYYcgNBDtataatMcRWtaagt
+ataHgMaVggcaaDtggttcVattattaaaatSVaMaNcDBttataYgttttStacattg
+agagtccaNtgaatttttKtStatatttRaatttcgBDccctaaSWatttaaMBStcata
+cctgctctatctatKatatgaacaactctWBaNagtcgYaaaaRtctMtDgtaBaacaNt
+acagtcgataNgaVccgtttattatgatctagtDSgaHNcctKtcttatNtgatYKaaSt
+ctWDVcaaccgaVttScaagaaaaVcccggagWatcVaNtVaRcNtcagatcMMatacta
+aaWaagatYHRWcaSagcgMtttatSBtBtBgacRaVgtgattaagtBgtatcgtNgggg
+DaWgagctgatctatttHaactttcgcttttccatttNaaYgtattttactttacttRat
+aBttgatagggacattattaaSaaaYtgatggaDaMttacttatttttttaaWttttaat
+aaWaNaattgtaBtBMcatcNtaaMtDaaaatcRgcatccaMtggWggHggagSttacaY
+HatYtgtaatcatttgVtataaDVttcaYttctHtHtagttWHNYYtVRVccatacaatt
+aaaYatcgcatBagcaatDaWacVaBWattagaaBataatgtKaaaNKcagaactNaaga
+NatgKtBSctgattgWcNaaSataggtataaacVaatDttcRaRtVtVtgtataagMtSc
+caSScagttgatYattcagcMaaWctaagtYcSattNccgtcgtaBtaattgttgacaaa
+DttttattaatacSKtcgcatNttatWatacgRtgcataactYtcacHgVgHttYaataa
+WacgSVKatactagDggcattKctggataagtVgKYtatgttagcgtaRtttaaagacHg
+acacattcHKaMKtcgKtcacggtgatcaaBtMttcttattcttDaKKVgWagtaacatg
+KatVgacattagWtaRtaccRaaVHtttttRtgBccagtcgctagtRtaBcMVWMtaBta
+ggttaYcttagaSgYgttttcaaNNgtttVaagctgStttactaacWattcgtVgtgtKc
+gtYaaaaaKtaSaattgBtYgaVcagKatgaMttWDRatgtaatctagacWaccgcaNgt
+ctgtgagtMttgaaatNtttattaRKcgtaWatcaWccaKtttNactaatNcgVaaBcgR
+gDttcDcatttgagWNattttNaYtttatgcHtttBBacgttgRgtcataNtatatcaWV
+catgaacatRgtNaWaatcaggttaaSctttcaacatHttVKaHtNtMtcttcHattYat
+cgatgtacSaaataVtcttYStaagattDagtKccgaccHBYatMtcggBacatVtaaag
+McttBgtSagKgNttttcNtSaaMaStHgtattttKaRttaMtDtcKtcgagDKgaaaac
+ttaaaWNaattgaWWaaggaaacKtttVggMBcatattDacctaMgaaKgcgcaaMRtaa
+tcgataaatRDttataNtVgtaVDggttaNgatBgtggcaaYWtagctcWgtSaacgtat
+tKcgcBtttDacaaaaaStKMtatNccagKatgtVtHtWaSBgDttgWgaattWagtttt
+aagcctNcttaBtYttaRactaattggagagggtctagtatgggtttacttBtatcatat
+gctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcgtactDtDagcct
+atttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaaNtactMcSMtYt
+cMgRtacttctWBacgaaatatagScDtttgaagacacatagtVgYgtcattHWtMMWcS
+tgttaggKtSgaYaaccWStcgBttgcgaMttBYatcWtgacaYcagagtaBDtRacttt
+tcWatMttDBcatWtatcttactaBgaYtcttgttttttttYaaScYaHgtgttNtSatc
+MtcVaaaStccRcctDaataataStcYtRDSaMtDttgttSagtRRcatttHatSttMtW
+gtcgtatSSagactYaaattcaMtWatttaSgYttaRgKaRtccactttattRggaMcDa
+WaWagttttgacatgttctacaaaRaatataataaMttcgDacgaSStacaStYRctVaN
+MtMgtaggcKatcttttattaaaaagVWaHKYagtttttatttaaccttacgtVtcVaat
+tVMBcttaMtttaStgacttagattWWacVtgWYagWVRctDattBYtgtttaagaagat
+tattgacVatMaacattVctgtBSgaVtgWWggaKHaatKWcBScSWaaccRVacacaaa
+ctaccScattRatatKVtactatatttHttaagtttSKtRtacaaagtRDttcaaaaWgc
+acatWaDgtDKacgaacaattacaRNWaatHtttStgttattaaMtgttgDcgtMgcatB
+tgcttcgcgaDWgagctgcgaggggVtaaScNatttacttaatgacagcccccacatYSc
+aMgtaggtYaNgttctgaMaacNaMRaacaaacaKctacatagYWctgttWaaataaaat
+aRattagHacacaagcgKatacBttRttaagtatttccgatctHSaatactcNttMaagt
+attMtgRtgaMgcataatHcMtaBSaRattagttgatHtMttaaKaggYtaaBataSaVa
+tactWtataVWgKgttaaaacagtgcgRatatacatVtHRtVYataSaKtWaStVcNKHK
+ttactatccctcatgWHatWaRcttactaggatctataDtDHBttataaaaHgtacVtag
+aYttYaKcctattcttcttaataNDaaggaaaDYgcggctaaWSctBaaNtgctggMBaK
+ctaMVKagBaactaWaDaMaccYVtNtaHtVWtKgRtcaaNtYaNacggtttNattgVtt
+tctgtBaWgtaattcaagtcaVWtactNggattctttaYtaaagccgctcttagHVggaY
+tgtNcDaVagctctctKgacgtatagYcctRYHDtgBattDaaDgccKtcHaaStttMcc
+tagtattgcRgWBaVatHaaaataYtgtttagMDMRtaataaggatMtttctWgtNtgtg
+aaaaMaatatRtttMtDgHHtgtcattttcWattRSHcVagaagtacgggtaKVattKYa
+gactNaatgtttgKMMgYNtcccgSKttctaStatatNVataYHgtNaBKRgNacaactg
+atttcctttaNcgatttctctataScaHtataRagtcRVttacDSDttaRtSatacHgtS
+KacYagttMHtWataggatgactNtatSaNctataVtttRNKtgRacctttYtatgttac
+tttttcctttaaacatacaHactMacacggtWataMtBVacRaSaatccgtaBVttccag
+ccBcttaRKtgtgcctttttRtgtcagcRttKtaaacKtaaatctcacaattgcaNtSBa
+accgggttattaaBcKatDagttactcttcattVtttHaaggctKKgatacatcBggSca
+gtVcacattttgaHaDSgHatRMaHWggtatatRgccDttcgtatcgaaacaHtaagtta
+RatgaVacttagattVKtaaYttaaatcaNatccRttRRaMScNaaaDgttVHWgtcHaa
+HgacVaWtgttScactaagSgttatcttagggDtaccagWattWtRtgttHWHacgattB
+tgVcaYatcggttgagKcWtKKcaVtgaYgWctgYggVctgtHgaNcVtaBtWaaYatcD
+RaaRtSctgaHaYRttagatMatgcatttNattaDttaattgttctaaccctcccctaga
+WBtttHtBccttagaVaatMcBHagaVcWcagBVttcBtaYMccagatgaaaaHctctaa
+cgttagNWRtcggattNatcRaNHttcagtKttttgWatWttcSaNgggaWtactKKMaa
+catKatacNattgctWtatctaVgagctatgtRaHtYcWcttagccaatYttWttaWSSt
+taHcaaaaagVacVgtaVaRMgattaVcDactttcHHggHRtgNcctttYatcatKgctc
+ctctatVcaaaaKaaaagtatatctgMtWtaaaacaStttMtcgactttaSatcgDataa
+actaaacaagtaaVctaggaSccaatMVtaaSKNVattttgHccatcacBVctgcaVatV
+ttRtactgtVcaattHgtaaattaaattttYtatattaaRSgYtgBagaHSBDgtagcac
+RHtYcBgtcacttacactaYcgctWtattgSHtSatcataaatataHtcgtYaaMNgBaa
+tttaRgaMaatatttBtttaaaHHKaatctgatWatYaacttMctcttttVctagctDaa
+agtaVaKaKRtaacBgtatccaaccactHHaagaagaaggaNaaatBWattccgStaMSa
+MatBttgcatgRSacgttVVtaaDMtcSgVatWcaSatcttttVatagttactttacgat
+caccNtaDVgSRcgVcgtgaacgaNtaNatatagtHtMgtHcMtagaaattBgtataRaa
+aacaYKgtRccYtatgaagtaataKgtaaMttgaaRVatgcagaKStctHNaaatctBBt
+cttaYaBWHgtVtgacagcaRcataWctcaBcYacYgatDgtDHcctaaagacYRcagga
+ttHaYgtKtaatgcVcaataMYacccatatcacgWDBtgaatcBaatacKcttRaRtgat
+gaBDacggtaattaaYtataStgVHDtDctgactcaaatKtacaatgcgYatBtRaDatH
+aactgtttatatDttttaaaKVccYcaaccNcBcgHaaVcattHctcgattaaatBtatg
+caaaaatYMctSactHatacgaWacattacMBgHttcgaatVaaaacaBatatVtctgaa
+aaWtctRacgBMaatSgRgtgtcgactatcRtattaScctaStagKgaDcWgtYtDDWKR
+gRtHatRtggtcgaHgggcgtattaMgtcagccaBggWVcWctVaaattcgNaatcKWag
+cNaHtgaaaSaaagctcYctttRVtaaaatNtataaccKtaRgtttaMtgtKaBtRtNag
+gaSattHatatWactcagtgtactaKctatttgRYYatKatgtccgtRtttttatttaat
+atVgKtttgtatgtNtataRatWYNgtRtHggtaaKaYtKSDcatcKgtaaYatcSRcta
+VtSMWtVtRWHatttagataDtVggacagVcgKWagBgatBtaaagNcaRtagcataBgg
+actaacacRctKgttaatcctHgDgttKHHagttgttaatgHBtatHcDaagtVaBaRcc
+ctVgtgDtacRHSctaagagcggWYaBtSaKtHBtaaactYacgNKBaVYgtaacttagt
+VttcttaatgtBtatMtMtttaattaatBWccatRtttcatagVgMMtagctStKctaMa
+ctacDNYgKYHgaWcgaHgagattacVgtttgtRaSttaWaVgataatgtgtYtaStatt
+attMtNgWtgttKaccaatagNYttattcgtatHcWtctaaaNVYKKttWtggcDtcgaa
+gtNcagatacgcattaagaccWctgcagcttggNSgaNcHggatgtVtcatNtRaaBNcH
+VagagaaBtaaSggDaatWaatRccaVgggStctDaacataKttKatttggacYtattcS
+atcttagcaatgaVBMcttDattctYaaRgatgcattttNgVHtKcYRaatRKctgtaaa
+cRatVSagctgtWacBtKVatctgttttKcgtctaaDcaagtatcSataWVgcKKataWa
+YttcccSaatgaaaacccWgcRctWatNcWtBRttYaattataaNgacacaatagtttVN
+tataNaYtaatRaVWKtBatKagtaatataDaNaaaaataMtaagaaStccBcaatNgaa
+taWtHaNactgtcDtRcYaaVaaaaaDgtttRatctatgHtgttKtgaaNSgatactttc
+gagWaaatctKaaDaRttgtggKKagcDgataaattgSaacWaVtaNMacKtcaDaaatt
+tctRaaVcagNacaScRBatatctRatcctaNatWgRtcDcSaWSgttRtKaRtMtKaat
+gttBHcYaaBtgatSgaSWaScMgatNtctcctatttctYtatMatMtRRtSaattaMta
+gaaaaStcgVgRttSVaScagtgDtttatcatcatacRcatatDcttatcatVRtttata
+aHtattcYtcaaaatactttgVctagtaaYttagatagtSYacKaaacgaaKtaaataga
+taatSatatgaaatSgKtaatVtttatcctgKHaatHattagaaccgtYaaHactRcggS
+BNgtgctaaBagBttgtRttaaattYtVRaaaattgtaatVatttctcttcatgBcVgtg
+KgaHaaatattYatagWacNctgaaMcgaattStagWaSgtaaKagttttaagaDgatKc
+ctgtaHtcatggKttVDatcaaggtYcgccagNgtgcVttttagagatgctaccacgggg
+tNttttaSHaNtatNcctcatSaaVgtactgBHtagcaYggYVKNgtaKBcRttgaWatg
+aatVtagtcgattYgatgtaatttacDacSctgctaaaStttaWMagDaaatcaVYctcc
+gggcgaVtaaWtStaKMgDtttcaaMtVgBaatccagNaaatcYRMBggttWtaaScKtt
+MWtYataRaDBMaDataatHBcacDaaKDactaMgagttDattaHatHtaYatDtattDc
+RNStgaatattSDttggtattaaNSYacttcDMgYgBatWtaMagactVWttctttgYMa
+YaacRgHWaattgRtaagcattctMKVStatactacHVtatgatcBtVNataaBttYtSt
+tacKgggWgYDtgaVtYgatDaacattYgatggtRDaVDttNactaSaMtgNttaacaaS
+aBStcDctaccacagacgcaHatMataWKYtaYattMcaMtgSttDagcHacgatcaHtt
+YaKHggagttccgatYcaatgatRaVRcaagatcagtatggScctatattaNtagcgacg
+tgKaaWaactSgagtMYtcttccaKtStaacggMtaagNttattatcgtctaRcactctc
+tDtaacWYtgaYaSaagaWtNtatttRacatgNaatgttattgWDDcNaHcctgaaHacS
+gaataaRaataMHttatMtgaSDSKatatHHaNtacagtccaYatWtcactaactatKDa
+cSaStcggataHgYatagKtaatKagStaNgtatactatggRHacttgtattatgtDVag
+DVaRctacMYattDgtttYgtctatggtKaRSttRccRtaaccttagagRatagSaaMaa
+cgcaNtatgaaatcaRaagataatagatactcHaaYKBctccaagaRaBaStNagatagg
+cgaatgaMtagaatgtcaKttaaatgtaWcaBttaatRcggtgNcacaaKtttScRtWtg
+catagtttWYaagBttDKgcctttatMggNttattBtctagVtacataaaYttacacaaR
+ttcYtWttgHcaYYtaMgBaBatctNgcDtNttacgacDcgataaSatYaSttWtcctat
+KaatgcagHaVaacgctgcatDtgttaSataaaaYSNttatagtaNYtaDaaaNtgggga
+cttaBggcHgcgtNtaaMcctggtVtaKcgNacNtatVaSWctWtgaWcggNaBagctct
+gaYataMgaagatBSttctatacttgtgtKtaattttRagtDtacatatatatgatNHVg
+BMtKtaKaNttDHaagatactHaccHtcatttaaagttVaMcNgHatatKtaNtgYMcct
+tatcaaNagctggacStttcNtggcaVtattactHaSttatgNMVattMMDtMactatta
+ttgWMSgtHBttStStgatatRaDaagattttctatMtaaaaaggtactaaVttaSacNa
+atactgMttgacHaHRttgMacaaaatagttaatatWKRgacDgaRtatatttattatcY
+ttaWtgtBRtWatgHaaattHataagtVaDtWaVaWtgStcgtMSgaSRgMKtaaataVa
+cataatgtaSaatttagtcgaaHtaKaatgcacatcggRaggSKctDcagtcSttcccSt
+YtccRtctctYtcaaKcgagtaMttttcRaYDttgttatctaatcataNctctgctatca
+MatactataggDaHaaSttMtaDtcNatataattctMcStaaBYtaNagatgtaatHaga
+gSttgWHVcttatKaYgDctcttggtgttMcRaVgSgggtagacaataaDtaattSaDaN
+aHaBctattgNtaccaaRgaVtKNtaaYggHtaKKgHcatctWtctDtttctttggSDtN
+taStagttataaacaattgcaBaBWggHgcaaaBtYgctaatgaaatWcDcttHtcMtWW
+attBHatcatcaaatctKMagtDNatttWaBtHaaaNgMttaaStagttctctaatDtcR
+VaYttgttMtRtgtcaSaaYVgSWDRtaatagctcagDgcWWaaaBaaRaBctgVgggNg
+DWStNaNBKcBctaaKtttDcttBaaggBttgaccatgaaaNgttttttttatctatgtt
+ataccaaDRaaSagtaVtDtcaWatBtacattaWacttaSgtattggDgKaaatScaatt
+acgWcagKHaaccaYcRcaRttaDttRtttHgaHVggcttBaRgtccctDatKaVtKtcR
+gYtaKttacgtatBtStaagcaattaagaRgBagSaattccSWYtttattVaataNctgH
+gttaaNBgcVYgtRtcccagWNaaaacaDNaBcaaaaRVtcWMgBagMtttattacgDac
+ttBtactatcattggaaatVccggttRttcatagttVYcatYaSHaHcttaaagcNWaHa
+taaaRWtctVtRYtagHtaaaYMataHYtNBctNtKaatattStgaMcBtRgctaKtgcS
+cSttDgYatcVtggaaKtaagatWccHccgKYctaNNctacaWcttttgcRtgtVcgaKt
+tcMRHgctaHtVaataaDtatgKDcttatBtDttggNtacttttMtgaacRattaaNaga
+actcaaaBBVtcDtcgaStaDctgaaaSgttMaDtcgttcaccaaaaggWtcKcgSMtcD
+tatgtttStaaBtatagDcatYatWtaaaBacaKgcaDatgRggaaYctaRtccagattD
+aWtttggacBaVcHtHtaacDacYgtaatataMagaatgHMatcttatacgtatttttat
+attacHactgttataMgStYaattYaccaattgagtcaaattaYtgtatcatgMcaDcgg
+gtcttDtKgcatgWRtataatatRacacNRBttcHtBgcRttgtgcgtcatacMtttBct
+atctBaatcattMttMYgattaaVYatgDaatVagtattDacaacDMatcMtHcccataa
+gatgBggaccattVWtRtSacatgctcaaggggYtttDtaaNgNtaaBatggaatgtctR
+taBgBtcNYatatNRtagaacMgagSaSDDSaDcctRagtVWSHtVSRggaacaBVaccg
+tttaStagaacaMtactccagtttVctaaRaaHttNcttagcaatttattaatRtaaaat
+ctaacDaBttggSagagctacHtaaRWgattcaaBtctRtSHaNtgtacattVcaHaNaa
+gtataccacaWtaRtaaVKgMYaWgttaKggKMtKcgWatcaDatYtKSttgtacgaccN
+ctSaattcDcatcttcaaaDKttacHtggttHggRRaRcaWacaMtBWVHSHgaaMcKat
+tgtaRWttScNattBBatYtaNRgcggaagacHSaattRtttcYgaccBRccMacccKga
+tgaacttcgDgHcaaaaaRtatatDtatYVtttttHgSHaSaatagctNYtaHYaVYtta
+ttNtttgaaaYtaKttWtctaNtgagaaaNctNDctaaHgttagDcRttatagccBaacg
+caRBtRctRtggtaMYYttWtgataatcgaataattattataVaaaaattacNRVYcaaM
+acNatRttcKatMctgaagactaattataaYgcKcaSYaatMNctcaacgtgatttttBa
+cNtgatDccaattattKWWcattttatatatgatBcDtaaaagttgaaVtaHtaHHtBta
+taRBgtgDtaataMttRtDgDcttattNtggtctatctaaBcatctaRatgNacWtaatg
+aagtcMNaacNgHttatactaWgcNtaStaRgttaaHacccgaYStacaaaatWggaYaW
+gaattattcMaactcBKaaaRVNcaNRDcYcgaBctKaacaaaaaSgctccYBBHYaVag
+aatagaaaacagYtctVccaMtcgtttVatcaatttDRtgWctagtacRttMctgtDctt
+tcKtWttttataaatgVttgBKtgtKWDaWagMtaaagaaattDVtaggttacatcattt
+atgtcgMHaVcttaBtVRtcgtaYgBRHatttHgaBcKaYWaatcNSctagtaaaaattt
+acaatcactSWacgtaatgKttWattagttttNaggtctcaagtcactattcttctaagK
+ggaataMgtttcataagataaaaatagattatDgcBVHWgaBKttDgcatRHaagcaYcR
+aattattatgtMatatattgHDtcaDtcaaaHctStattaatHaccgacNattgatatat
+tttgtgtDtRatagSacaMtcRtcattcccgacacSattgttKaWattNHcaacttccgt
+ttSRtgtctgDcgctcaaMagVtBctBMcMcWtgtaacgactctcttRggRKSttgYtYa
+tDccagttDgaKccacgVatWcataVaaagaataMgtgataaKYaaatcHDaacgataYc
+tRtcYatcgcaMgtNttaBttttgatttaRtStgcaacaaaataccVgaaDgtVgDcStc
+tatatttattaaaaRKDatagaaagaKaaYYcaYSgKStctccSttacagtcNactttDV
+ttagaaagMHttRaNcSaRaMgBttattggtttaRMggatggcKDgWRtNaataataWKK
+acttcKWaaagNaBttaBatMHtccattaacttccccYtcBcYRtagattaagctaaYBD
+ttaNtgaaaccHcaRMtKtaaHMcNBttaNaNcVcgVttWNtDaBatgataaVtcWKctt
+RggWatcattgaRagHgaattNtatttctctattaattaatgaDaaMatacgttgggcHa
+YVaaNaDDttHtcaaHtcVVDgBVagcMacgtgttaaBRNtatRtcagtaagaggtttaa
+gacaVaaggttaWatctccgtVtaDtcDatttccVatgtacNtttccgtHttatKgScBa
+tgtVgHtYcWagcaKtaMYaaHgtaattaSaHcgcagtWNaatNccNNYcacgVaagaRa
+cttctcattcccRtgtgtaattagcSttaaStWaMtctNNcSMacattataaactaDgta
+tWgtagtttaagaaaattgtagtNagtcaataaatttgatMMYactaatatcggBWDtVc
+YttcDHtVttatacYaRgaMaacaStaatcRttttVtagaDtcacWatttWtgaaaagaa
+agNRacDtttStVatBaDNtaactatatcBSMcccaSttccggaMatgattaaWatKMaB
+aBatttgataNctgttKtVaagtcagScgaaaDggaWgtgttttKtWtatttHaatgtag
+ttcactaaKMagttSYBtKtaYgaactcagagRtatagtVtatcaaaWYagcgNtaDagt
+acNSaaYDgatBgtcgataacYDtaaactacagWDcYKaagtttattagcatcgagttKc
+atDaattgattatDtcagRtWSKtcgNtMaaaaacaMttKcaWcaaSVMaaaccagMVta
+MaDtMaHaBgaacataBBVtaatVYaNSWcSgNtDNaaKacacBtttatKtgtttcaaHa
+MctcagtaacgtcgYtactDcgcctaNgagagcYgatattttaaatttccattttacatt
+tDaaRctattttWctttacgtDatYtttcagacgcaaVttagtaaKaaaRtgVtccataB
+ggacttatttgtttaWNtgttVWtaWNVDaattgtatttBaagcBtaaBttaaVatcHca
+VgacattccNggtcgacKttaaaRtagRtctWagaYggtgMtataatMtgaaRttatttt
+gWcttNtDRRgMDKacagaaaaggaaaRStcccagtYccVattaNaaKStNWtgacaVta
+gaagcttSaaDtcacaacgDYacWDYtgtttKatcVtgcMaDaSKStVcgtagaaWaKaa
+gtttcHaHgMgMtctataagBtKaaaKKcactggagRRttaagaBaaNatVVcgRcKStt
+DaactagtSttSattgttgaaRYatggttVttaataaHttccaagDtgatNWtaagHtgc
+YtaactRgcaatgMgtgtRaatRaNaacHKtagactactggaatttcgccataacgMctR
+gatgttaccctaHgtgWaYcactcacYaattcttaBtgacttaaacctgYgaWatgBttc
+ttVttcgttWttMcNYgtaaaatctYgMgaaattacNgaHgaacDVVMtttggtHtctaa
+RgtacagacgHtVtaBMNBgattagcttaRcttacaHcRctgttcaaDBggttKaacatg
+KtttYataVaNattccgMcgcgtagtRaVVaattaKaatggttRgaMcagtatcWBttNt
+HagctaatctagaaNaaacaYBctatcgcVctBtgcaaagDgttVtgaHtactSNYtaaN
+ccatgtgDacgaVtDcgKaRtacDcttgctaagggcagMDagggtBWRtttSgccttttt
+taacgtcHctaVtVDtagatcaNMaVtcVacatHctDWNaataRgcgtaVHaggtaaaaS
+gtttMtattDgBtctgatSgtRagagYtctSaKWaataMgattRKtaacatttYcgtaac
+acattRWtBtcggtaaatMtaaacBatttctKagtcDtttgcBtKYYBaKttctVttgtt
+aDtgattttcttccacttgSaaacggaaaNDaattcYNNaWcgaaYattttMgcBtcatR
+tgtaaagatgaWtgaccaYBHgaatagataVVtHtttVgYBtMctaMtcctgaDcYttgt
+ccaaaRNtacagcMctKaaaggatttacatgtttaaWSaYaKttBtagDacactagctMt
+ttNaKtctttcNcSattNacttggaacaatDagtattRtgSHaataatgccVgacccgat
+actatccctgtRctttgagaSgatcatatcgDcagWaaHSgctYYWtatHttggttcttt
+atVattatcgactaagtgtagcatVgtgHMtttgtttcgttaKattcMatttgtttWcaa
+StNatgtHcaaaDtaagBaKBtRgaBgDtSagtatMtaacYaatYtVcKatgtgcaacVa
+aaatactKcRgtaYtgtNgBBNcKtcttaccttKgaRaYcaNKtactttgagSBtgtRag
+aNgcaaaNcacagtVtttHWatgttaNatBgtttaatNgVtctgaatatcaRtattcttt
+tttttRaaKcRStctcggDgKagattaMaaaKtcaHacttaataataKtaRgDtKVBttt
+tcgtKaggHHcatgttagHggttNctcgtatKKagVagRaaaggaaBtNatttVKcRtta
+HctaHtcaaatgtaggHccaBataNaNaggttgcWaatctgatYcaaaHaatWtaVgaaB
+ttagtaagaKKtaaaKtRHatMaDBtBctagcatWtatttgWttVaaaScMNattRactt
+tgtYtttaaaagtaagtMtaMaSttMBtatgaBtttaKtgaatgagYgtNNacMtcNRac
+MMHcttWtgtRtctttaacaacattattcYaMagBaacYttMatcttKcRMtgMNccatt
+aRttNatHaHNaSaaHMacacaVaatacaKaSttHatattMtVatWgattttttaYcttt
+KttHgScWaacgHtttcaVaaMgaacagNatcgttaacaaaaagtacaHBNaattgttKt
+cttVttaaBtctgctacgBgcWtttcaggacacatMgacatcccagcggMgaVKaBattg
+acttaatgacacacaaaaaatRKaaBctacgtRaDcgtagcVBaacDSBHaaaaSacata
+tacagacRNatcttNaaVtaaaataHattagtaaaaSWccgtatWatggDttaactattg
+cccatcttHaSgYataBttBaactattBtcHtgatcaataSttaBtatKSHYttWggtcY
+tttBttaataccRgVatStaHaKagaatNtagRMNgtcttYaaSaactcagDSgagaaYt
+MttDtMRVgWKWtgMaKtKaDttttgactatacataatcNtatNaHattVagacgYgata
+tatttttgtStWaaatctWaMgagaRttRatacgStgattcttaagaDtaWccaaatRca
+gcagaaNKagtaaDggcgccBtYtagSBMtactaaataMataBSacRMgDgattMMgtcH
+tcaYDtRaDaacggttDaggcMtttatgttaNctaattaVacgaaMMtaatDccSgtatt
+gaRtWWaccaccgagtactMcgVNgctDctaMScatagcgtcaactatacRacgHRttgc
+tatttaatgaattataYKttgtaagWgtYttgcHgMtaMattWaWVtaRgcttgYgttBH
+tYataSccStBtgtagMgtDtggcVaaSBaatagDttgBgtctttctcattttaNagtHK
+taMWcYactVcgcgtatMVtttRacVagDaatcttgctBBcRDgcaacKttgatSKtYta
+gBMagaRtcgBattHcBWcaactgatttaatttWDccatttatcgagSKaWttataHact
+aHMttaatHtggaHtHagaatgtKtaaRactgtttMatacgatcaagDgatKaDctataM
+ggtHDtggHacctttRtatcttYattttgacttgaaSaataaatYcgBaaaaccgNatVB
+ttMacHaKaataagtatKgtcaagactcttaHttcggaattgttDtctaaccHttttWaa
+atgaaatataaaWattccYDtKtaaaacggtgaggWVtctattagtgactattaagtMgt
+ttaagcatttgSgaaatatccHaaggMaaaattttcWtatKctagDtYtMcctagagHca
+ctttactatacaaacattaacttaHatcVMYattYgVgtMttaaRtgaaataaDatcaHg
+tHHatKcDYaatcttMtNcgatYatgSaMaNtcttKcWataScKggtatcttacgcttWa
+aagNatgMgHtctttNtaacVtgttcMaaRatccggggactcMtttaYMtcWRgNctgNc
+cKatcttgYDcMgattNYaRagatHaaHgKctcataRDttacatBatccattgDWttatt
+taWgtcggagaaaaatacaatacSNtgggtttccttacSMaagBattacaMaNcactMtt
+atgaRBacYcYtcaaaWtagctSaacttWgDMHgaggatgBVgcHaDtggaactttggtc
+NatNgtaKaBcccaNtaagttBaacagtatacDYttcctNgWgcgSMcacatStctHatg
+RcNcgtacacaatRttMggaNKKggataaaSaYcMVcMgtaMaHtgattYMatYcggtct
+tcctHtcDccgtgRatcattgcgccgatatMaaYaataaYSggatagcgcBtNtaaaSca
+KgttBgagVagttaKagagtatVaactaSacWactSaKatWccaKaaaatBKgaaKtDMa
+ttttgtaaatcRctMatcaaMagMttDgVatggMaaWgttcgaWatgaaatttgRtYtat
+taWHKcRgctacatKttctaccaaHttRatctaYattaaWatVNccatNgagtcKttKat
+aStRaatatattcctRWatDctVagttYDgSBaatYgttttgtVaatttaatagcagMat
+RaacttBctattgtMagagattaaactaMatVtHtaaatctRgaaaaaaaatttWacaac
+aYccYDSaattMatgaccKtaBKWBattgtcaagcHKaagttMMtaatttcKcMagNaaK
+agattggMagaggtaatttYacatcWaaDgatMgKHacMacgcVaacaDtaDatatYggt
+tBcgtatgWgaSatttgtagaHYRVacaRtctHaaRtatgaactaatatctSSBgggaaH
+MWtcaagatKgagtDaSatagttgattVRatNtctMtcSaagaSHaataNataataRaaR
+gattctttaataaagWaRHcYgcatgtWRcttgaaggaMcaataBRaaccagStaaacNt
+ttcaatataYtaatatgHaDgcStcWttaacctaRgtYaRtataKtgMttttatgactaa
+aatttacYatcccRWtttHRtattaaatgtttatatttgttYaatMcaRcSVaaDatcgt
+aYMcatgtagacatgaaattgRtcaaYaaYtRBatKacttataccaNaaattVaBtctgg
+acaagKaaYaaatatWtMtatcYaaVNtcgHaactBaagKcHgtctacaatWtaDtSgta
+HcataHtactgataNctRgttMtDcDttatHtcgtacatcccaggSttaBgtcacacWtc
+cNMcNatMVaVgtccDYStatMaccDatggYaRKaaagataRatttHKtSaaatDgataa
+acttaHgttgVBtcttVttHgDacgaKatgtatatNYataactctSatatatattgcHRR
+YttStggaactHgttttYtttaWtatMcttttctatctDtagVHYgMRBgtHttcctaat
+YRttKtaagatggaVRataKDctaMtKBNtMtHNtWtttYcVtattMcgRaacMcctNSc
+tcatttaaagDcaHtYccSgatgcaatYaaaaDcttcgtaWtaattctcgttttScttgg
+taatctttYgtctaactKataHacctMctcttacHtKataacacagcNRatgKatttttS
+aaatRYcgDttaMRcgaaattactMtgcgtaagcgttatBtttttaattaagtNacatHg
+ttcRgacKcBBtVgatKttcgaBaatactDRgtRtgaNacWtcacYttaaKcgttctHaK
+ttaNaMgWgWaggtctRgaKgWttSttBtDcNtgtttacaaatYcDRtgVtgcctattcN
+tctaaaDMNttttNtggctgagaVctDaacVtWccaagtaacacaNctgaScattccDHc
+VBatcgatgtMtaatBgHaatDctMYgagaatgYWKcctaatNaStHaaaKccgHgcgtY
+aaYtattgtStgtgcaaRtattaKatattagaWVtcaMtBagttattagNaWHcVgcaat
+tttDcMtgtaRHVYtHtctgtaaaaHVtMKacatcgNaatttMatatgttgttactagWY
+taRacgataKagYNKcattataNaRtgaacKaYgcaaYYacaNccHatMatDcNgtHttR
+aWttagaaDcaaaaaatagggtKDtStaDaRtaVtHWKNtgtattVctSVgRgataDaRa
+WataBgaagaaKtaataaYgDcaStaNgtaDaaggtattHaRaWMYaYaWtggttHYgag
+VtgtgcttttcaaDKcagVcgttagacNaaWtagtaataDttctggttVcatcataaagt
+gKaaaNaMtaBBaattaatWaattgctHaVKaSgDaaVKaHtatatatHatcatSBagNg
+HtatcHYMHgttDgtaHtBttWatcgtttaRaattgStKgSKNWKatcagDtctcagatt
+tctRtYtBatBgHHtKaWtgYBgacVVWaKtacKcDttKMaKaVcggtgttataagaata
+aHaatattagtataatMHgttYgaRttagtaRtcaaVatacggtcMcgagtaaRttacWg
+actKRYataaaagSattYaWgagatYagKagatgSaagKgttaatMggtataatgttWYt
+tatgagaaacctNVataatHcccKtDctcctaatactggctHggaSaggRtKHaWaattc
+gSatMatttagaggcYtctaMcgctcataSatatgRagacNaaDaggaVBagaYttKtac
+NaKgtSYtagttggaWcatcWttaatctatgaVtcgtgtMtatcaYcgtRccaaYgDctg
+cMgtgtWgacWtgataacacgcgctBtgttaKtYDtatDcatcagKaVMctaatcttgVc
+aaRgcRMtDcgattaHttcaNatgaatMtactacVgtRgatggaWtttactaaKatgagS
+aaKggtaNtactVaYtaaKRagaacccacaMtaaMtKtatBcttgtaaWBtMctaataaV
+cDaaYtcRHBtcgttNtaaHatttBNgRStVDattBatVtaagttaYatVattaagaBca
+cggtSgtVtatttaRattgatgtaHDKgcaatattKtggcctatgaWDKRYcggattgRc
+tatNgatacaatMNttctgtcRBYRaaaHctNYattcHtaWcaattctBtMKtVgYataa
+tMgYtcagcttMDataVtggRtKtgaatgccNcRttcaMtRgattaacattRcagcctHt
+WMtgtDRagaKaBtgDttYaaaaKatKgatctVaaYaacWcgcatagBVtaNtRtYRagg
+BaaBtgKgttacataagagcatgtRattccacttaccatRaaatgWgDaMHaYVgVtaSc
+tatcgKaatatattaDgacccYagtgtaYNaaatKcagtBRgagtccatgKgaaaccBga
+agBtgSttWtacgatWHaYatcgatttRaaNRgcaNaKVacaNtDgattgHVaatcDaag
+cgtatgcNttaDataatcSataaKcaataaHWataBtttatBtcaKtKtatagttaDgSa
+YctacaRatNtaWctSaatatttYaKaKtaccWtatcRagacttaYttVcKgSDcgagaa
+gatccHtaattctSttatggtKYgtMaHagVaBRatttctgtRgtctatgggtaHKgtHa
+cHtSYacgtacacHatacKaaBaVaccaDtatcSaataaHaagagaatScagactataaR
+ttagcaaVcaHataKgDacatWccccaagcaBgagWatctaYttgaaatctVNcYtttWa
+gHcgcgcDcVaaatgttKcHtNtcaatagtgtNRaactttttcaatggWgBcgDtgVgtt
+tctacMtaaataaaRggaaacWaHttaRtNtgctaaRRtVBctYtVtatDcattDtgacc
+YatagatYRKatNYKttNgcctagtaWtgaactaMVaacctgaStttctgaKVtaaVaRK
+DttVtVctaDNtataaaDtccccaagtWtcgatcactDgYaBcatcctMtVtacDaaBtY
+tMaKNatNtcaNacgDatYcatcgcaRatWBgaacWttKttagYtaattcggttgSWttt
+tDWctttacYtatatWtcatDtMgtBttgRtVDggttaacYtacgtacatgaattgaaWc
+ttMStaDgtatattgaDtcRBcattSgaaVBRgagccaaKtttcDgcgaSMtatgWatta
+KttWtgDBMaggBBttBaatWttRtgcNtHcgttttHtKtcWtagHStaacagttgatat
+BtaWSaWggtaataaMttaKacDaatactcBttcaatatHttcBaaSaaatYggtaRtat
+NtHcaatcaHtagVtgtattataNggaMtcttHtNagctaaaggtagaYctMattNaMVN
+tcKtactBKcaHHcBttaSagaKacataYgctaKaYgttYcgacWVttWtSagcaacatc
+ccHaccKtcttaacgaKttcacKtNtacHtatatRtaaatacactaBtttgaHaRttggt
+tWtatYagcatYDatcggagagcWBataagRtacctataRKgtBgatgaDatataSttag
+BaHtaatNtaDWcWtgtaattacagKttcNtMagtattaNgtctcgtcctcttBaHaKcK
+ccgtRcaaYagSattaagtKataDatatatagtcDtaacaWHcaKttDgaaRcgtgYttg
+tcatatNtatttttatggccHtgDtYHtWgttatYaacaattcaWtatNgctcaaaSttR
+gctaatcaaatNatcgtttaBtNNVtgttataagcaaagattBacgtDatttNatttaaa
+DcBgtaSKgacgtagataatttcHMVNttgttBtDtgtaWKaaRMcKMtHtaVtagataW
+ctccNNaSWtVaHatctcMgggDgtNHtDaDttatatVWttgttatttaacctttcacaa
+ggaSaDcggttttttatatVtctgVtaacaStDVaKactaMtttaSNagtgaaattaNac
+ttSKctattcctctaSagKcaVttaagNaVcttaVaaRNaHaaHttatgtHttgtgatMc
+caggtaDcgaccgtWgtWMtttaHcRtattgScctatttKtaaccaagtYagaHgtWcHa
+atgccKNRtttagtMYSgaDatctgtgaWDtccMNcgHgcaaacNDaaaRaStDWtcaaa
+aHKtaNBctagBtgtattaactaattttVctagaatggcWSatMacccttHttaSgSgtg
+MRcatRVKtatctgaaaccDNatYgaaVHNgatMgHRtacttaaaRtatStRtDtatDtt
+YatattHggaBcttHgcgattgaKcKtttcRataMtcgaVttWacatNcatacctRataD
+DatVaWNcggttgaHtgtMacVtttaBHtgagVttMaataattatgttcttagtttgtgc
+DtSatttgBtcaacHattaaBagVWcgcaSYttMgcttacYKtVtatcaYaKctgBatgc
+gggcYcaaaaacgNtctagKBtattatctttKtaVttatagtaYtRagNtaYataaVtga
+atatcHgcaaRataHtacacatgtaNtgtcgYatWMatttgaactacRctaWtWtataca
+atctBatatgYtaagtatgtgtatSttactVatcttYtaBcKgRaSggRaaaaatgcagt
+aaaWgtaRgcgataatcBaataccgtatttttccatcNHtatWYgatHSaaaDHttgctg
+tccHtggggcctaataatttttctatattYWtcattBtgBRcVttaVMRSgctaatMagt
+YtttaaaaatBRtcBttcaaVtaacagctccSaaSttKNtHtKYcagcagaaaccccRtt
+tttaaDcDtaStatccaagcgctHtatcttaDRYgatDHtWcaaaBcWgKWHttHataag
+HacgMNKttMKHccaYcatMVaacgttaKgYcaVaaBtacgcaactttMctaaHaatgtB
+atgagaSatgtatgSRgHgWaVWgataaatatttccKagVgataattWaHNcYggaaatg
+ctHtKtaDtctaaagtMaatVDVactWtSaaWaaMtaHtaSKtcBRaNcttStggtBtta
+cNagcatagRgtKtgcgaacaacBcgKaatgataagatgaaaattgtactgcgggtccHH
+WHaaNacaBttNKtKtcaaBatatgctaHNgtKcDWgtttatNgVDHgaccaacWctKaa
+ggHttgaRgYaatHcaBacaatgagcaaattactgtaVaaYaDtagattgagNKggtggt
+gKtWKaatacagDRtatRaMRtgattDggtcaaYRtatttNtagaDtcacaaSDctDtat
+aatcgtactaHttatacaatYaacaaHttHatHtgcgatRRttNgcatSVtacWWgaagg
+agtatVMaVaaattScDDKNcaYBYaDatHgtctatBagcaacaagaatgagaaRcataa
+KNaRtBDatcaaacgcattttttaaBtcSgtacaRggatgtMNaattggatatWtgagta
+ttaaaVctgcaYMtatgatttttYgaHtgtcttaagWBttHttgtcttattDtcgtatWt
+ataataSgctaHagcDVcNtaatcaagtaBDaWaDgtttagYctaNccDtaKtaHcttaa
+taacccaRKtacaVaatNgcWRaMgaattatgaBaaagattVYaHMDcaDHtcRcgYtct
+taaaWaaaVKgatacRtttRRKYgaatacaWVacVcRtatMacaBtactggMataaattt
+tHggNagSctacHgtBagcgtcgtgattNtttgatSaaggMttctttcttNtYNagBtaa
+acaaatttMgaccttacataattgYtcgacBtVMctgStgMDtagtaRctHtatgttcat
+atVRNWataDKatWcgaaaaagttaaaagcacgHNacgtaatctttMRtgacttttDacc
+tataaacgaaatatgattagaactccSYtaBctttaataacWgaaaYatagatgWttcat
+KtNgatttttcaagHtaYgaaRaDaagtaggagcttatVtagtctttcattaaaatcgKt
+attaRttacagVaDatgcatVgattgggtctttHVtagKaaRBtaHtaaggccccaaaaK
+atggtttaMWgtBtaaacttcactttKHtcgatctccctaYaBacMgtcttBaBaNgcga
+aacaatctagtHccHtKttcRtRVttccVctttcatacYagMVtMcagaMaaacaataBc
+tgYtaatRaaagattaaccatVRatHtaRagcgcaBcgDttStttttcVtttaDtKgcaa
+WaaaaatSccMcVatgtKgtaKgcgatatgtagtSaaaDttatacaaacatYaRRcVRHc
+tKtcgacKttaaVctaDaatgttMggRcWaacttttHaDaKaDaBctgtaggcgtttaHB
+ccatccattcNHtDaYtaataMttacggctNVaacDattgatattttacVttSaattaca
+aRtataNDgacVtgaacataVRttttaDtcaaacataYDBtttaatBaDtttYDaDaMcc
+MttNBttatatgagaaMgaNtattHccNataattcaHagtgaaggDgatgtatatatgYa
+tgaStcataaBStWacgtcccataRMaaDattggttaaattcMKtctMacaBSactcgga
+atDDgatDgcWctaacaccgggaVcacWKVacggtaNatatacctMtatgatagtgcaKa
+gggVaDtgtaacttggagtcKatatcgMcttRaMagcattaBRaStctYSggaHYtacaa
+ctMBaagDcaBDRaaacMYacaHaattagcattaaaHgcgctaaggSccKtgaaKtNaBt
+atDDcKBSaVtgatVYaagVtctSgMctacgttaacWaaattctSgtDactaaStaaatt
+gcagBBRVctaatatacctNttMcRggctttMttagacRaHcaBaacVKgaataHttttM
+gYgattcYaNRgttMgcVaaacaVVcDHaatttgKtMYgtatBtVVctWgVtatHtacaa
+HttcacgatagcagtaaNattBatatatttcVgaDagcggttMaagtcScHagaaatgcY
+NggcgtttttMtStggtRatctacttaaatVVtBacttHNttttaRcaaatcacagHgag
+agtMgatcSWaNRacagDtatactaaDKaSRtgattctccatSaaRttaaYctacacNta
+RtaactggatgaccYtacactttaattaattgattYgttcagDtNKttagDttaaaaaaa
+BtttaaNaYWKMBaaaacVcBMtatWtgBatatgaacVtattMtYatMNYDKNcKgDttD
+aVtaaaatgggatttctgtaaatWtctcWgtVVagtcgRgacttcccctaDcacagcRca
+gagtgtWSatgtacatgttaaSttgtaaHcgatgggMagtgaacttatRtttaVcaccaW
+aMgtactaatSSaHtcMgaaYtatcgaaggYgggcgtgaNDtgttMNgaNDMtaattcgV
+ttttaacatgVatgtWVMatatcaKgaaattcaBcctccWcttgaaWHtWgHtcgNWgaR
+gctcBgSgaattgcaaHtgattgtgNagtDttHHgBttaaWcaaWagcaSaHHtaaaVct
+RaaMagtaDaatHtDMtcVaWMtagSagcttHSattaacaaagtRacMtRtctgttagcM
+tcaBatVKtKtKacgagaSNatSactgtatatcBctgagVtYactgtaaattaaaggcYg
+DHgtaacatSRDatMMccHatKgttaacgactKtgKagtcttcaaHRVtccttKgtSata
+atttacaactggatDNgaacttcaRtVaagDcaWatcBctctHYatHaDaaatttagYat
+SatccaWtttagaaatVaacBatHcatcgtacaatatcgcNYRcaataYaRaYtgattVt
+tgaatgaVaactcRcaNStgtgtattMtgaggtNttBaDRcgaaaagctNgBcWaWgtSa
+DcVtgVaatMKBtttcgtttctaaHctaaagYactgMtatBDtcStgaccgtSDattYaa
+taHctgggaYYttcggttaWaatctggtRagWMaDagtaacBccactacgHWMKaatgat
+WatcctgHcaBaSctVtcMtgtDttacctaVgatYcWaDRaaaaRtagatcgaMagtgga
+RaWctctgMgcWttaagKBRtaaDaaWtctgtaagYMttactaHtaatcttcataacggc
+acBtSgcgttNHtgtHccatgttttaaagtatcgaKtMttVcataYBBaKtaMVaVgtat
+tNDSataHcagtWMtaggtaSaaKgttgBtVtttgttatcatKcgHacacRtctHatNVa
+gSBgatgHtgaRaSgttRcctaacaaattDNttgacctaaYtBgaaaatagttattactc
+ttttgatgtNNtVtgtatMgtcttRttcatttgatgacacttcHSaaaccaWWDtWagta
+RDDVNacVaRatgttBccttaatHtgtaaacStcVNtcacaSRttcYagacagaMMtttt
+gMcNttBcgWBtactgVtaRttctccaaYHBtaaagaBattaYacgatttacatctgtaa
+MKaRYtttttactaaVatWgctBtttDVttctggcDaHaggDaagtcgaWcaagtagtWt
+tHtgKtVataStccaMcWcaagataagatcactctHatgtcYgaKcatcagatactaagN
+SStHcctRRNtattgtccttagttagMVgtatagactaactctVcaatMctgtttgtgtt
+gccttatWgtaBVtttctggMcaaKgDWtcgtaaYStgSactatttHgatctgKagtagB
+tVacRaagRtMctatgggcaaaKaaaatacttcHctaRtgtDcttDattaggaaatttcY
+HaRaaBttaatggcacKtgctHVcaDcaaaVDaaaVcgMttgtNagcgtaDWgtcgttaa
+tDgKgagcSatatcSHtagtagttggtgtHaWtaHKtatagctgtVgattaBVaatgaat
+aagtaatVatSttaHctttKtttgtagttaccttaatcgtagtcctgBcgactatttVcM
+acHaaaggaatgDatggKtaHtgStatattaaSagctWcctccRtataBaDYcgttgcNa
+agaggatRaaaYtaWgNtSMcaatttactaacatttaaWttHtatBattgtcgacaatNg
+attgcNgtMaaaKaBDattHacttggtRtttaYaacgVactBtaBaKtgBttatgVttgt
+VttcaatcWcNctDBaaBgaDHacBttattNtgtDtatttVSaaacaggatgcRatSgta
+SaNtgBatagttcHBgcBBaaattaHgtDattatDaKaatBaaYaaMaataaataKtttY
+tagtBgMatNcatgtttgaNagtgttgtgKaNaSagtttgaSMaYBcaaaacDStagttV
+acaaaaactaaWttBaagtctgtgcgtMgtaattctcctacctcaNtttaaccaaaaVtB
+cacataacaccccBcWMtatVtggaatgaWtcaaWaaaaaaaaWtDtaatatRcctDWtc
+ctaccMtVVatKttaWaaKaaatataaagScHBagaggBaSMtaWaVtatattactSaaa
+KNaactatNatccttgaYctattcaaaVgatttYHcRagattttaSataggttattcVta
+aagaKgtattattKtRttNcggcRgtgtgtWYtaacHgKatKgatYtacYagDtWcHBDc
+tctgRaYKaYagcactKcacSaRtBttttBHKcMtNtcBatttatttttgSatVgaaaga
+WtcDtagDatatgMacaacRgatatatgtttgtKtNRaatatNatgYcaHtgHataacKt
+gagtagtaacYttaNccaaatHcacaacaVDtagtaYtccagcattNtacKtBtactaaa
+gaBatVtKaaHBctgStgtBgtatgaSNtgDataaccctgtagcaBgtgatcttaDataS
+tgaMaccaSBBgWagtacKcgattgaDgNNaaaacacagtSatBacKDgcgtataBKcat
+acactaSaatYtYcDaactHttcatRtttaatcaattataRtttgtaagMcgNttcatcB
+tYBagtNWNMtSHcattcRctttttRWgaKacKttgggagBcgttcgcMaWHtaatactg
+tctctatttataVgtttaBScttttaBMaNaatMacactYtBMggtHacMagtaRtctgc
+atttaHtcaaaatttgagKtgNtactBacaHtcgtatttctMaSRagcagttaatgtNta
+aattgagagWcKtaNttagVtacgatttgaatttcgRtgtWcVatcgttaaDVctgtttB
+WgaccagaaagtcSgtVtatagaBccttttcctaaattgHtatcggRattttcaaggcYS
+KaagWaWtRactaaaacccBatMtttBaatYtaagaactSttcgaaScaatagtattgac
+caagtgttttctaacatgtttNVaatcaaagagaaaNattaaRttttaVaaaccgcaggN
+MtatattVctcaagaggaacgBgtttaacaagttcKcYaatatactaaccBaaaSggttc
+NtattctagttRtBacgScVctcaatttaatYtaaaaaaatgSaatgatagaMBRatgRc
+McgttgaWHtcaVYgaatYtaatctttYttatRaWtctgBtDcgatNatcKaBaDgatgt
+aNatWKctccgatattaacattNaaacDatgBgttctgtDtaaaMggtgaBaSHataacg
+ccSctaBtttaRBtcNHcDatcDcctagagtcRtaBgWttDRVHagattYatgtatcWta
+HtttYcattWtaaagtctNgtStggRNcgcggagSSaaagaaaatYcHDtcgctttaatg
+YcKBVSgtattRaYBaDaaatBgtatgaHtaaRaRgcaSWNtagatHaacttNctBtcac
+catctMcatattccaSatttgcgaDagDgtatYtaaaVDtaagtttWVaagtagYatRtt
+aagDcNgacKBcScagHtattatcDaDactaaaaaYgHttBcgaDttggataaaKSRcBM
+aBcgaBSttcWtgNBatRaccgattcatttataacggHVtaattcacaagagVttaaRaa
+tVVRKcgWtVgacctgDgYaaHaWtctttcacMagggatVgactagMaaataKaaNWagK
+atagNaaWtaaaatttgaattttatttgctaaVgaHatBatcaaBWcBgttcMatcgBaa
+NgttcgSNaggSaRtttgHtRtattaNttcDcatSaVttttcgaaaaattgHatctaRag
+gSaNatMDaaatDcacgattttagaHgHaWtYgattaatHNSttatMSgggNtcKtYatR
+ggtttgtMWVtttaYtagcagBagHaYagttatatggtBacYcattaRSataBatMttta
+aatctHcaaaSaaaagttNSaaWcWRccRtKaagtBWtcaaattSttMtattggaaacct
+taacgttBtWatttatatWcDaatagattcctScacctaagggRaaYtaNaatgVtBctt
+aaBaacaMVaaattatStYgRcctgtactatcMcVKatttcgSgatRHMaaaHtagtaaH
+tVgcaaataatatcgKKtgccaatBNgaaWcVttgagttaKatagttcaggKDatDtatt
+gaKaVcaKtaataDataataHSaHcattagttaatRVYcNaHtaRcaaggtNHcgtcaac
+caBaaagYtHWaaaRcKgaYaaDttgcWYtataRgaatatgtYtgcKtaNttWacatYHc
+tRaDtYtattcBttttatcSataYaYgttWaRagcacHMgtttHtYttYaatcggtatSt
+ttcgtRSattaaDaKMaatatactaNBaWgctacacYtgaYVgtgHtaaaRaaRgHtagt
+WattataaaSDaaWtgMattatcgaaaagtaYRSaWtSgNtBgagcRYaMDtactaactt
+aWgtatctagacaagNtattHggataatYttYatcataDcgHgttBttctttVttgccga
+aWtaaaacgKgtatctaaaaaNtccDtaDatBMaMggaatNKtatBaaatVtccRaHtaS
+acataHattgtttKVYattcataVaattWtcgtgMttcttKtgtctaacVtatctatatB
+RataactcgKatStatattcatHHRttKtccaacgtgggtgRgtgaMtattattggctat
+cgtgacMtRcBDtcttgtactaatRHttttaagatcgVMDStattatYBtttDttgtBtN
+ttgRcMtYtgBacHaWaBaatDKctaagtgaaactaatgRaaKgatccaagNaaaatatt
+aggWNtaagtatacttttKcgtcggSYtcttgRctataYcttatataaagtatattaatt
+tataVaacacaDHatctatttttKYVatHRactttaBHccaWagtactBtcacgaVgcgt
+tRtttttttSVgtSagtBaaattctgaHgactcttgMcattttagVtaagaattHctHtc
+aDaaNtaacRggWatagttcgtSttgaDatcNgNagctagDgatcNttKgttgtaDtctt
+tRaaYStRatDtgMggactSttaDtagSaVtBDttgtDgccatcacaMattaaaMtNaca
+VcgSWcVaaDatcaHaatgaattaMtatccVtctBtaattgtWattatBRcWcaatgNNt
+actWYtDaKttaaatcactcagtRaaRgatggtKgcgccaaHgaggatStattYcaNMtc
+aBttacttatgagDaNtaMgaaWtgtttcttctaHtMNgttatctaWWatMtBtaaatag
+DVatgtBYtatcggcttaagacMRtaHScgatatYgRDtcattatSDaHggaaataNgaW
+SRRaaaBaatagBattaDctttgHWNttacaataaaaaaatacggtttgHgVtaHtWMtt
+NtBtctagtMcgKMgHgYtataHaNagWtcaacYattaataYRgtaWKgaBctataaccg
+atttaHaNBRaRaMtccggtNgacMtctcatttgcaattcWgMacttacaaDaaNtactW
+atVtttagccttMaatcagVaagtctVaaDaBtattaattaYtNaYtggattaKtaKctY
+aMtattYgatattataatKtVgDcttatatNBtcgttgtStttttMagaggttaHYSttc
+KgtcKtDNtataagttataagSgttatDtRttattgttttSNggRtcaaKMNatgaatat
+tgtBWtaMacctgggYgaSgaagYataagattacgagaatBtggtRcVHtgYggaDgaYa
+KagWagctatagacgaaHgtWaNgacttHRatVaWacKYtgRVNgVcSgRWctacatcKS
+actctgWYtBggtataagcttNRttVtgRcaWaaatDMatYattaactttcgaagRatSc
+tgccttgcRKaccHtttSNVagtagHagBagttagaccaRtataBccataatSHatRtcH
+agacBWatagcaMtacaRtgtgaaBatctKRtScttccaNaatcNgtaatatWtcaMgac
+tctBtWtaaNactHaaaaRctcgcatggctMcaaNtcagaaaaacacagtggggWttRtt
+agtaagaVctVMtcgaatcttcMaaaHcaHBttcgattatgtcaDagcYRtBtYcgacMg
+tDcagcgaNgttaataatagcagKYYtcgtaBtYctMaRtaRtDagaaaacacatgYaBt
+tgattattcgaaNttBctSataaMataWRgaHtttccgtDgaYtatggtDgHKgMtattt
+VtMtVagttaRatMattRagataaccctKctMtSttgaHagtcStctatttccSagatgt
+tccacgaggYNttHRacgattcDatatDcataaaatBBttatcgaHtNHaaatatDNagg
+ctgaNcaaggagttBttMgRagVatBcRtaWgatgBtSgaKtcgHtttgaatcaaDaHtt
+cSBgHcagtVaaSttDcagccgttNBtgttHagYtattctttRWaaVtSttcatatKaaR
+aaaNacaVtVctMtSDtDtRHRcgtaatgctcttaaatSacacaatcgHattcaWcttaa
+aatHaaatcNctWttaNMcMtaKctVtcctaagYgatgatcYaaaRactctaRDaYagta
+acgtDgaggaaatctcaaacatcaScttcKttNtaccatNtaNatacatttHaaDHgcaD
+atMWaaBttcRggctMaagctVYcacgatcaDttatYtaatcKatWatcaatVYtNagat
+ttgattgaYttttYgacttVtcKaRagaaaHVgDtaMatKYagagttNatWttaccNtYt
+cDWgSatgaRgtMatgKtcgacaagWtacttaagtcgKtgatccttNcttatagMatHVg
+gtagcgHctatagccctYttggtaattKNaacgaaYatatVctaataMaaaYtgVtcKaY
+taataacagaatHcacVagatYWHttagaaSMaatWtYtgtaaagNaaacaVgaWtcacN
+WgataNttcaSagctMDaRttgNactaccgataMaaatgtttattDtcaagacgctDHYY
+atggttcaagccNctccttcMctttagacBtaaWtaWVHggaaaaNatttaDtDtgctaa
+HHtMtatNtMtagtcatttgcaaaRatacagRHtatDNtgtDgaatVgtVNtcaaatYBM
+aaaagcaKgtgatgatMgWWMaHttttMgMagatDtataaattaaccaactMtacataaa
+ttgRataatacgBtKtaataattRgtatDagDtcRDacctatRcagagcSHatNtcaScN
+tttggacNtaaggaccgtgKNttgttNcttgaaRgYgRtNtcagttBcttttcHtKtgct
+tYaaNgYagtaaatgaatggWaMattBHtatctatSgtcYtgcHtaattHgaaMtHcaga
+aSatggtatgccaHBtYtcNattWtgtNgctttaggtttgtWatNtgHtgcDttactttt
+tttgcNtactKtWRaVcttcatagtgSNKaNccgaataaBttataataYtSagctttaaa
+tSttggctaaKSaatRccgWHgagDttaaatcatgagMtcgagtVtaDggaBtatttgDa
+cataaacgtagYRagBWtgDStKDgatgaagttcattatttaKWcataaatWRgatataR
+gttRacaaNKttNtKagaaYaStaactScattattaacgatttaaatgDtaattagatHg
+aYataaactatggggatVHtgccgtNgatNYcaStRtagaccacWcaMtatRagHgVact
+YtWHtcttcatgatWgagaKggagtatgaWtDtVtNaNtcgYYgtaaactttaDtBacta
+gtaDctatagtaatatttatatataacgHaaaRagKattSagttYtStatatatagtctt
+aaaaMtcatgttcaaDactgRttctaagagDtatttttagcgacttgtgRtgNctgSgRa
+aaaatgcaMtYtDcatcaaYKttHcatSWgaaaatDataggttatgBDMtgttataacaa
+YSgagttacgttatgtDStttaaatctcgWKtcSacgagagaSgttatBMDgtcggtgtg
+cgaNtaSHBatBtttVMgVcagaNatcaDDaKMtMYtatagaBccctctDtgtatttata
+tKNtgggtatgtRaacttgaWaaYgcaHatccctggtttStatMtcgcMtaaaWKttMVt
+WctVtgttaKDWctgWaVttaDVatgKtagagtcatctaKWgtaaMttSacBaMattaKa
+aHDataattgWtgttttgtcatBacacgtStacaaagtNctNtgtgatcHtWttcKaaga
+gttttaaaaWacgRacatctNatVStgaatDHgttWcgtRKcatatatctcaNttaaBDc
+ctgaaaaaDtaYaHaKttNtaYVaVtttaDtctacttctWttaactaattttMagWcaat
+cccNKYtBaacatgttgaKgKcgcBHaatDMttatatcSWacatDatRcWaMtDgatBct
+HgScttaaaHtSgKtDtttattgtRStWgttccatatttcacWttcatattgtaHVgaBt
+acaMtgMaaagDaataactDatattagMaNBagcttcattcgtaaKtgtatttcacMtgB
+aVtaattStcttagtYgtgtcgccttKatgggtgaWaataggaatacMMagaSKRttBga
+tgacRtgMtagaSRataggtatcaccgaNaaaWSWacDgatacttgattagcttgtgVMt
+tatYctaRgHVcDtVRRtSaMtcaVtVtatcaYaHatattaaVaatctaBtgtacRatNt
+atttgaYatSaHctaNgNtYtYaYagattVgatcRtaacgYggtgtatKttaatMagatg
+RtatatgHaKccHaaaaYtgaacgaWaNgtYHgacagaYtctaVtacccgatttttaaag
+cDttatNRgattKaaattttcatctaatgccgcaataataattgttatYtagtRNtaagt
+tggtHaKttWMtDKgatSagBYcgRggtWaVaattHtatgtaaaMgSaaagataaKaaKg
+ttDttttRaagaacaWRcaacDgtgttaatattaKtatcaWacacatttVtctgatHRca
+gtttNcaaatcNctNttttataactWacBBttgBttaaaRaWtBKaaacgtatcRcaMaa
+tgYacaaaagtgBataStWYtggtatgacaKWtctSgcKHgtcNaMNcataSatattgac
+tacMcataattNVtDaRccaaatcagttttYttagYaacgtaatMtMVatNgKaaMaaBg
+attaKttatDaBcttKtccttttacDagaYtacHgttggacaaaVaatagtYatcataSg
+atcaaWVttcgaatgaccctccttNtaSBWaatttDttttcaatatYggctatDcttatN
+ctttagDcMttcaacWaaNattSYgctttcaHcRaattaataaaatcVccRaattactct
+aMaVRattacagtgRcDtcgtgctcttNtWVtacagtHtatHaBDtcWggtgctcaaRHt
+atgtDgacStgcaaaVKtagttataatactaatatgtagScaatRSacaattgtattgca
+gatHHtgBcaatKKtaaMMcaRcgactatKBaMaYatgKatttDaaNtRatattgtatWt
+tagcaaaaacaWgcacaaHcataYtDaHgttataaSacgcagggggtYatgcKctaaaHg
+cVgctBDaVttccStagNgcSgtatgVYaMatcaWRBtVtgYttgtgRcYttcgctgaac
+NttgtgtctattWttttcctagMtagaWtaKgatStScatMaBtaStaSactattYNatc
+tgtacRatYDaatgatgatatgaatYaaaaSHttaaYMaWtDcaNHaBcaYtgVgcatVa
+acattMRatBtaatttaDacRtagtaaaNYVSMtcagaaDtttDHtRcYatacSNKaaMc
+HgatBaaVttactggBYgaYatttttgcDacHctWatcgtagagtactcattDggtcatK
+aSgctttatttagtDtRBacttaWYaaaattttgaccttaaWtaatgcRgccacttMtag
+gKtcBtgacgaHctttatcgtcStatMHDNagattatNagVaaaWcggaaaYcaVactDY
+actaStattgBHtcYctgggtacatataaYcgaYagaggaggacaVatacHRtYtctgta
+VgaYcNgaaaNatacVgcNgtaatttDcatttttcaacttSNcaaDatVYctSgcacctt
+agMgacgcttgaSttaaaatagttaggRHttaaacMatagcaWgMgagtcgctagtgtKg
+actaaHttattaWgcaaaaaaSatatgcgttaBNggttaYVatgaactttttgccatata
+aataRatSaBctagttataBccgaaacaagatacttaattttgaHgHMgtaaKctttaYt
+aaRacBMtBaYgaBaaacaYtVtagcRgWatHaWagattWSacStMHatttaDagacaat
+cgtgtKtttggaMtgtWtgtgcaaNaaaaWtKaaBcMWtcttctatgacVgagcgaggHa
+YYtttWgSaaYYaWtRYHHaMDtctttacaatggaaMctataagcttBcgHcNWaatttg
+tatatYtStatctagcactgtVttccagaaattaDtttaRtVataBttWagcatDMVact
+YtgcatWtttgaaMggKaatgaaaaHtataDtgYcMggVaaatSMHtttgVttaYaWaat
+aRttgttaYttattttRtWtataaBgtDtttatatcVgaaBcaDtatgtcaDagaWtgaY
+tWctcVagctcagctatatagcRVtcaKtaataatHgNaccgaaaatVHBaatattcgtt
+aVYttatttctBYaatKaagaccVStttcattgaMagSaaaaccccWKcaaNtMYaccta
+DStagaaatttatcatVgtcaatacccKattgtaaagtggWgtatatVtagBcttDaBac
+aattWtDYKtatRKggStRtaaaWatBtaagtaattDaaaaBRacWtaagtacaSttaaa
+tccgctaaccKaattgVWttDattatttattKaMtcYtMRWagMtcgKgBagacgggVaa
+NaaatgctKcgtaataaKtaaagtccWcttHMatSYgataaatDttBaHccattgBttSg
+aaHYtaataaaMtgaagatgtttBgRcattaRaDHcttBgaMaWaaVMMattaatttgtg
+BRctattgKMagNcMtatttaaaWttgaaacatWgcScgYYDYgttYtVtattgcKcWta
+gcggtgBaSctaKatacaaVtcaRDccccgtgttBgKgggtHagcgaattaaagMMttSc
+ggtDttttaHcSaagaacactcacactBcVgaKNaDHacacttatSagaattSKHtcagt
+ataaatKaaHtgaaRagaaVcBtaHtaaatcgatcWcaRtaaaatttaWttaagtcaggR
+ctgaWcttDttgactttaVSaaaatggtaWDaRMtBtaaaaaKatBgatMtctatatcaV
+aMgatttgNagtDRttDatcttttaMtYaaatcggagttctctaYatNtagaNcgMMact
+acHcaagtaaaatStaSaacaHcacSgggtNKatggaaagcggaaKgggtaYtacSgccg
+BaggcRacgtVgDtggaMcYaaaMatggacgYStKKatgaBcaaRtStccSagcRccgcc
+gcSDtgcggBDgaDtBtSSggacMttttaWcatcMatgtNMBWgataatcaaVtgaataa
+taaNatgcaaNttNctgacDMcaHccgatgKgWVttccaStggattctcDacttttttct
+ttaaNcWaMWccWKWttgaaaMctDaaBactRtVattttBtcMaNttWcKacagttKStt
+aYaWSactHSaBtHgatgttacatgcatatMtttgtaacScWHBatHactggatatatct
+gagMgRSatctaaSttaVagcaRcttggaYaatKHtagBBactattcgtaaagaagttgt
+VcgatgaVatHMtcaggtcgKSgWattgaaaVctccVgtDcaaatgaaHgMYactcaMat
+atatattNVttWtWaatttacRagKataaaNtttacaaWgMVactattaSgaggVaaagV
+taccDRHaaataRaHaRgcattMttcaatcaKaaataDcaDKtctcgaggBggacctDtt
+tatHacWVaWgatDctaNaNcgKatcMtcMaatBtttggacgtgataatagaaacRactc
+BtattttaKtgSaaggKtaggRaVtatagcccaNRttaccttSMaagatcggDacNBatW
+cgaactacactaactNBtaStgVtNagcatctaVtaKatKgaBtcgtttWaagWMgagRa
+NatHaaaaDtacagacaBagtgcaHaNatctcBccNttaagttDgaataaNtcgctaacR
+BgtaatSttaatatgcataacccaSattKcccttDttggtcaatgggttWaacgatacat
+tBtgMaYgaRttatgatKaKgtattDtKWgataacgNBtaccgaKWatcttcttKtgtct
+tagcattcctWcaaHgagtatDMSgKtcagcttgVHaKcttDaataaaVaatttDgtgaa
+ataaRgtcaVaatacttagtVatatgggcatgtDDtMtgtatBggattHtgcVtgtgatc
+aaSattatKYVaacSNNttNWcgaHttKDaaMYHatcgttaattaSttgctWaacHtaKB
+taaaaKHttcRWgaaWcRtBtttggBcDtgtacNttaagcKtaHgtagaaaaRttgaaac
+atagtWRaacYggtaaatcgctYaBtWDRtgttgSctaaKatNcattgtgtMttatccat
+atagctSacgccSNaaactacgNtgtgcttMatSKtcaaBaNaaacataacagaaatagt
+agctcNcatcVgaagStaataVcDKKttcagDHDtattctaatgagggRgBMctatacaa
+gYactctMaaagtcgctttctcgtgaattatNcgatMtttaggcBaaatctNtactaaRK
+tgKactattgtcatatgtacgagttMaaHSSgHgBatatcgcaSaataaaWgaagtatag
+aHgcttctttatgaccWaatttaRtaDaatttaatcgaaattgattMcatcaWaMtaWaK
+actttctBacactatNgtccttaWgtctgaccKatStaKtgagtacgggcgcgtYNtatt
+tagacctctKcatgatKWStcaataactaWgMSgHtgatctttttgtcgacgtSacttaY
+gcctWctcctctacaagVtttMaBactWVaccaYtgtSgcgttattcKtatStgaaKacc
+gNaataaHtatWtYtRacggcaDaScagcagHaYWRtRNcDtHtcVWtggaataaaYttg
+VaNtgttagtYttgtagSaaatDgaggccDcgBRYStattatttaaggccgHgggYRaac
+cMaagttatSttctttagcMtgcgMtgaSagaNaDagttSatgattWatttagtDgcttg
+agtgMKaYWaYccagcaHatKctaKaDgctagacttattgattaaYttatcttattattS
+taattWaRaYBWagYaatatgttRgScttgBagDaWgcgtgcVDaggcttgtctaDRKac
+ttgcaKBWRtaaVaSctKtacttMaaSVaWWcgSaNtttSWgtcggtcacttggVVtgag
+aataaataaDttgaaccaaaaMttaaaagaaaaaaaatcNBtatMgccWagcaNgaVaNa
+aaaaaYaMgttaWtatHaagtNtacgacaBtMMattttWNaRtaaatagYaScKattaca
+gctVKBtWNSKgYtYgtWatHaVatDaaatWgDatcctggSRagagtaaaaMgatttRta
+HacatggtaKagVcctgatgaMtaaYgatgtattattttHggBaccaDctctggNNtYaa
+tctVttgVtRtVcRacttNctttataggHSRtaRacaaattaacHaHgtgttgtttcBtB
+tatWtgtattttgcKagMcaaagaMtattagtStagcBacYaaHcagVgWtgtttcgtgD
+HaVtagDatcRaRtggtWtaactgcacgaggaaaRttSDaaVaSttaaaaacSMttacta
+NtcaacaattDtacttttYatVSacYtWtMttaattatcKtcttctatcaKDtctStSaa
+acggtYccatgtgagagtWtagWKgcaBaaaaKttgNactaatcgaggcWtcDDaaaaaa
+cactHattaattcactatYttaagacactaKaagRtRataaattttcatHggtaataaat
+gataHtggctaacBacDgtaatattRtYgtDNDBgKtcaggcHattttgHNgWtaatttc
+cgactactgacatVNttYYgactcgctctatttagaMcgggatHcgtttatBaDSagBaa
+aagRttBggttaaBactVHgatgaatttattcaaaattgcacttcDgacttYcVttactV
+tttatBaKHagaWgtgaatggBtaaSggcagacNcttaDttVgMtWagattggVatttac
+HtctNcMatacttSatMagcttgtNcYaaScaYactcKctKtagScStcagtttcatWaa
+tggtgagaggHaggggcaacgcRKtaRcMaNtHaatRaRaaactVtBtgttaatRtWWca
+aagKttccaaKaaatacgVttcacaaacgcggtgagaRaatggtgDMWatcWVScacaaa
+DaggaaHtgttSMaaaaaccYccDBtatYgtMagcSagaccaVcctcggtVWaaagttat
+cNaagataataSaataaaKccgtaDtYttatYcttHttaagKcMctaaatggaatRgaaa
+VaaVtcKYaggatWcaBtDaggDatccttcYNtgcSMRgaRtNgaatcgttRttatDVMt
+agctttacatDVtatatatcagctaDagMtataccYgaggYaaatgDaaaatSgctctga
+tgtttVaaBcctgataKtagaaaccaKatatgttaDtgaDtatagataatacagtaDtat
+cNtgtDMtYcattRVtctataNtWttggNaSgtMgaaYctctDggHtggHDccaccacKK
+aaacaaaatRatttccctttaagcRattMHctattHaRtataVattggatcSttaaHaHg
+aaHNDtacattSaaggDatttcaaaYgctBcatattaaaKagtgcccatSctcgatRtaa
+aMtgWactttNMaWctYgRatDggaactcDcaattaKaactgagtatctataagYaaaSR
+ctggtacWtttccWtaYRtKHattatagWtKttaNgcDtatHacccattaatttataacg
+ctMgaagtaacaacagMgtaYHYVtKMHtacMgKcaaatctgRYataNtcgttcaatacg
+gWtMcaatYcBWaagYtVaDNagtatagDaaNtaaaYtttcYWttttStgggataaMgat
+attagaaYtNctcttcBagactaYDcgtacHDWccKaHgttcttHgVggVDttatcatKa
+MttttacWaaSattctatagaHaggKaDagBtaaagtcYccattgtYcatctaNgRgVtg
+aagtDKttatBKcggDtattRYgHccgtgcgBNMtttVRgacaYctSctaRacgtagagc
+cgtacRaagtaHKagStSttttgYSatattaaaWHaaWagttDKaaNaNHaaHttaYctt
+MtcaaatgKttBtSgtccaaVaattSaacgttgNattgatatNctaWtVcagtactKcWa
+cgVagggHaaRgaDaatcMttattaataacaBMaaVtgYtKgRgHactgtactatcBaMt
+VggtagKcYtHtBSaattagtaatgMcaVVagYYgWtactttccaaSttDgaaMaMttca
+cttYtRgacttcagcttWtttagtgataMaattaagVtagaatatKataagtagttaagH
+MRaDattaHaaVcctDtagtcVYcaataaYcNttNaaaHctcaRaatttcaNRgatSHgV
+atagctRtcatgaBttMaaagRtcgHVtgRgStgatttgtagaKagaRWRctgNaHYgaa
+atBctgtttRttNWagaccgagKgtgcggHKVttaatattaatataataDtaNcctacaa
+RgcaNMctctgaaSHWWHcttagtNagtWgWaaKtYaNgcBattatccaaaSctRRHKaN
+tKcBgtgagaDRWBttactaaattSMctatatagaaYacDgatttccVtaagRtgRataa
+tatagtctttttatgtMgtcaacaaNtaaaaactctWtagaVaaaDtaattatagtBStc
+gaatDtgattVaatMtcaDattVKWaagatagggttgtMRSgtcYgWMaatgNtagtcBt
+tagtttctctWaaMtVgctWgSgtHagaSagactagKtagWggcatttHgttgacaaact
+cggggHggcWBgVgtatgggagVgagtcVcBtDctttagtctaagVWtHtgtttaScata
+cMBtKgattatRtgtttgtctttDggcHaBtRtgtaataNataatttataWctgaYWata
+StcHaatcRtaaVagDWaSatagtaccNDgaagtatacgttttacgacgKRtattgDcta
+tRRattVtStaaactagatgVatttagaMaSaaaattVtatYtgttgtRMagtHaatttS
+ttaaYNaggWagtgcacgaMcactgHgtgtgggHMgtKacttaaYgtcgcatcSatattg
+BaagtttacMtYagSatttatttaVtaaDtaWaHcgNatactgactHtggWtataDcDSc
+atactcStcDtgtcgtgtatgaggtHaaNKgDattgcBccaagKgtatgacKSMtttttg
+ttcaaatcaaYtagtaSatgDaaaMccKNaMaatagaataagcaattattataaMgagtg
+aSgtctNYttattHaNaYYtcDDtaatNRgtatttaaYtaaatcactHVaHcStccttcc
+caaVatcVggatKtatgRaaDBgaYtttacttYggactSDtaBcaaNggggtattatatt
+BDcttagagYNMatBgttYaagactMatgttRgatacccgtaacacBHtatKacWgatRc
+HttaattYtKtStccaaatVDcaNKHHaaataatagtagtatcttgctNDggVaVVtaVa
+RaaagSaccgttctcMtVtgNBgtDtttctYgttactBctcRtStWtWDScMtcWSaRat
+gaataRHctaNtcStctYtWacagatgtatYBtHaHWBtacggtDcaaBtatcaggtcaV
+attaNctactgaaaatWaDgactNWtMtggagaattBaataYcMWYcgatMYatWtgatt
+SatgaRtDaRgccagtSttatatRaBtattRcWtagtVgaagttMctattatatDttagg
+tctKtgtgtBagacgttatRKtgatctatttBtataactgataacKcggagtgHgtVttc
+ttgtKDgcDtaYatBDatcaatattgttNtaBacatcgcNcaKcaWcRataWcVgtacgS
+caWgttcggHcMttcRccatgaRStYgNacagatacYacWWtggNaDcWagttHatMaNa
+atNtcDMDcMaKgHNatScVgatKWatatgNRgtccgYgaagattDHgtMtcHaSNaaat
+tBatRagtaaatttacaagHWtKatcaagtccHtYcctgttKDMSgtactactVctgaca
+aaaHgatatacataatKtStHgctScSatNatacaYttaaWHtctgaatYtagtHtKagg
+ccWBaStaDctaagagNtaatcaatcgttNgaYDaagtaaaaHatagaatcgcgBaYaBg
+aacSaaWaaaaactccgcMttHttYgtaagaMctKBtacSagattcBaaWtaattttacR
+ttatcgaRtacaRHgtgRagaaBcttaVgacVDgggaatVatagaactRRtacgYttNat
+tVHgaHttacaaaaaaaYtcRWtgtgattatgccaSDtttatKWgaatatSNDgatttta
+acgtcSRtatggttcttcBtWtttMtBtMScttaHatBattHacYtaYacattcgttKgt
+cStSctcKtatatttcaKSgagcttccaacaccRDtttDaccattatatSgtcWtVaaag
+ttgtagccattDtYaatattDaccatcVDaaRccagttttgtcHacMattcHgaNcatgt
+tKcVttcctgtgcSataaatattgaKtctaWctMRaKggtaYcaagttDttcgttacRta
+tgatggHNaWMtKttcatattaaDaSaBaaaMtMatBgKtttgHtHactaatcatcgtWa
+atKaaWcaWtcctVttaaNaggaaaagtaaagaDctNttaDBaBgatagMgaataacRcY
+ggatcRaaaHaagatRDtVRactaYagttcaccaaWtctcSSaaatcSKattctggDgaa
+cagDtaDagacagtgtaattcaStYttNaStgtaHgccttaScatMRcaccWtcatttat
+RtaagatWtNataaWtMNtDVgWttgcWgtgaRttttRgWcttMtctaHacaaYtKctga
+BagtRagacttDatNttaaaDgRtatNcHatcSDgtBatcttacVcYacNgaattaacga
+gttgYgacttDattatacBattMgctagcctagatVcaactNttcctaatgtDaacgYaN
+atagMatSWtYBaaaRtgMtatSRgaataYaScaVgtaScMagatNNtttacaaHBaWtN
+tRtctaaacDaaaaWMcaNtcVaDNcagaDtgcWKYgagttaHtgcDYataaacataBaW
+WtcggtatgtgaaScaacctttRNatcgttaaagcaDctaatgcBatttacaattVaMgS
+MMtccYaaaBYtggattttcataWttgBtatDtBgactaatgtccWaaHataaScHttWt
+tDtcgtcaagMctMDtaaaatRtBaaaacaatgtcagcatBgNNBVttttttcBacWttt
+WtSWWtgaaaaSacgBtaaataaagtcDStaagaactgttaatYatgDctattactgaHt
+aaatStHaagacaKtagDtaaHaDgttccaaDtaaggacactctDggcgtDagtcWaHgR
+cHgDgaSctttattgtcttttccttRYaDgNactaaatcaWggcNSBagttttatatStK
+gtcRtgattaaggtcaSBttaacaaKatgggatcaaattgRgcBagtNtcgDcatttWcc
+tttgtNagDgctgcatttactttgtgtcaBgSatttNHaMcggcagSctcKDtWBaagSa
+gWatggYtVatSRgKagattgaVatKttcgatYatKYSgDaacNtcVgtttaWataWtgV
+ctgcgSggMgatccatgagttgtWcatYWWcctVcNHagtNtgtKtttgatcaacttaSt
+tattgatNcatWaVgNHcagStVHcggHacaaDttgDttWcaaRaKgaaatKaattagta
+WacattgaaatgtgaatgacagtgaRVtaaYagYtcggcatMttgaaggDgagDRcaKgH
+tacacaaaMcaBtagHactgKaatRtNttcttcatcatNgYgStggactatgSMttgKtD
+aDgacRRgtWaVattgatttaagYctatatagactaagaggtatWtataaactaYaHRct
+StgKWcgtRtKtYtYtagacgattRaaYBtaStcttaWataatcHttataRcactgagtg
+ggagccaattctcDtgDaggHcDRVaVVggaaBtRttaataaRRttgtaagKNcaVWWgt
+atacctgatcttBtcttRgaWcaVRKcagttSacttagcgtKtgtYWatatcgNttcKac
+cacacVKctgattBtggacgtctgacaDtWKttattttgMBgKaacaDataattWtBtBR
+tVtacataaatatttgtWtttatagtDtgcctagctHYaatgcaNaaRcaatVtacctgg
+gggKtagBgagaBgRaaNttttMtMagMtgtgattNctcNaKggWtMatcttagWgtaat
+atatNctaYBggKaataBattYtaattataVtggNtcgtgtctaattaaacctHtacaaa
+ctDctDtctgatatgMtgataacWctgtgYSaaNScgDYaWtatDatMKgcaatttctgN
+cgtHtaWtagatatcYBttaattactcaaaVattYRWtatttDtaNMYMttgattataat
+gcgNggWaatYagttgBagNcaagaaaDtRgtaaaagctgcatctagcttaVgtBttata
+gcKMSaattYtHcMaBttcagtcttgKatgVSVttKgttttttagtgtDHgNggtcaVta
+tttaacNtgaatatgctatMcatgaaaBtgBSaWctaataaattatYttagtaDtaccgg
+aatgagtaattggatttaacBtctSMgWYtgKgattacgRctctccaatgtaggcctgaN
+aatScgYataaBBacaKtHtttcatgaaHtgBtagaKHVtacctVtcaaccaDaaWNHNa
+atgataattgatgWcagggtcMBtgSgRataHctMctgMHHtKaBtaaMtMgataaRWta
+gYtgaaMaSgctYtgcgaaHatDtatgtcWRatKatatYDcBgNtRaRacattMcagaHg
+aaagRccgcgWttggSatBagagcHgYtatctVtcatYaaVRtcaSacaMYDcgRtcaaW
+gaRgataMtaaaacaggtgtaaYcattgWgDHcWgttaVatttgcatctaatccacaaag
+aagSatgcgtagRgagtHDgaVcgtgcttatggMttttcatKSctNacHcctMaKRattt
+gatctaaatgHaaScataataatgtttgtgtHaVcaaaaNHaaaatcgctgSVtattVtt
+agaaNWcacagtgKtatgattHcYcttgDaWVataBatBttttWtaactNaattttcttt
+aaYHaMtttaaaccgStcHaVBaatcRacaaWactgtagVKtNRtcctagcWaatNgctK
+ccttctcDaBDcatYHatatgcaataaBaagaatgDMttaHcaaYYtcactgttRtgacR
+aacctaWtBtBMagBctaaBaWtgatgVtttattataggttaattgtaatYcaRtVctct
+tgcacSaaMaatactRSgcataKcagcaVNKttcgSatcaaactaattDtaHtNaVtgtt
+ttttaWVtatNccagWttcgtatBcgttVctcBttaaaaMSaDattKRcctttcataHaa
+ttaatWaaataKcaHVaggaatataBYKHVtgVcVgtcHcttccgcctattDtMMgWaac
+ttgWttYtttcMcgtcctaaVHtgWtggtgacKtcaWaYMttacttagVWtacgSatatc
+gWcKaaatHKaaaYttgtagtcaacWtttggtcaagttgaaBBaSHacVcgYgttWBSRW
+ggtattttaYDtHatattcgatNttacaaaaVacaMccaaYStaataRttVtcttagaVK
+aacaWcgccgtRatcatctaaatccMcctttaMggccHgYcDgaKctatgMRYBagcaND
+tgMtcRttgtgHaRttacatgaWcDtgctgtataggNggtgaatagBgagYNtatcagKt
+HcatBatgVKgaHWagattRDatatcgYcHagRtaatgWtcStagcVatNaaaaKttgRa
+RBYNgtaaDtStaVRgcMccatMWaaattBDatttaatttataaHtagtVVaDRMKBtaa
+caatttttttDaRSgaaKDtVaBatcagtaaMttaagcctRgaNVgggttcataatagNa
+tcctacactacgcatgtcggaYgtaKcatggattgactttHtaattWNRaaWYggttcaa
+aggaaNtaatgcHcaaaattBtagcttattcaagVtatttWgcctaKtatBttDYcatta
+gDacKVaYNccgYaYRaaMaattRaagaHtatgcttgcRagcgctSaatagaaRacaRac
+SccagcacVMataatHgRtagcgaKgYRaDcVWSDVgRaMgcDgtaattttaYttggtaa
+WcttKDaaYtatMRcgKccYcagtYcBgRccattcaKtgaSSRtactgacgHtgtaaaaB
+atWgcaMcBcYcgccagactcttcSatYattgatgaNccaaaaWaKatVgcaggtWtBcg
+ttaRMagcaaagtgttcacatataaagaHWtKatctacttatatcacYRaaVagataagt
+aattttgatgtBctaataggtaRtaaHaattgtaRcStYSYaWRgMtacaHcNSttVNSc
+attNKaaKgBtagtgatYcaaaStactggttggggaBggtNtgtcaaWBaYVSNgtaata
+BNtagtatatcacMcScccVcgtVRRtttNcKaSRNaNtHRttatttattgacaatggSa
+BagataaccgttcctaDNaattgctVtatNtHtatagSccaagctKttaaacaaattatt
+gtSHgMWgStttNaccattBMYatRtccStNgttgaaBcctVagcaaaatgatattcRaB
+ccMWaagKtttttcMtgaRYNaataDttgttWRttattggHtNtataatggttgtStYga
+McYVtcattaggtaatVcaNggaRtNataMWcctcYgcgagagRgcHMgcWtgaYtVStt
+gDaacgaaaatMttYWtWttcctgaKNttatttattRaattaagaccMKtttcWgtcaBa
+gKSaWaaacaNtaYaDtBNaaagWtHgacaaagtgVtcatKcgcaatVaactatgcgaaa
+ctccNctatatMgactatttatSaaVttNttRttagHtccKtHtaaaNatttYVctaatt
+taaaatHWaNtSacgaaaHggaaatcacagVYcctaattcMNtgtYtgagttatttaBtc
+RgBHNacBtactctagaacgcKaaDWYYgcattactVagaYtgaVVcgcaNctttBagKR
+cSgaaatttgtatccattgtggHcaatRtaVtaSaBtcYYcatcgtgtcHaVttaHattc
+tgtcaBSNYaKBBattaatggctgtHatattgtBacDcBgatttaaaNtggaaaaYtNca
+KagRRtRgttRtMtWgggatcNtacacctgtWKagatataaYVMtaaDtaaacctctgtg
+tgccttScacWaggaYacttttKacgtttgtgataKYagaYaVatcWcSattaMcatBYt
+tYaaatgStKagWattKtttaWgtagaaSgtRattcSaDagVaMattattYaagccSgcN
+aaDgaaSaggtaNgtWactaWcgHctgaNatttttcaatgtaMHSWaRtggtaNtaHBtt
+tWWaaatattcVtBtctStWtaWMaBcatttcDagttDtttatatgttWBtNaYatcccS
+gtgagcgaRYtBtagaDacBtaagaataWactaaaagKtaKaWaataacKcccgDtagcc
+aaagcggaatcgctSRtacKgcactacccHaactMgtgccaBaRaaaBVtcgSacRKttt
+StgatcaaHgKtaaKaccHaccacccKttgagcttcSttttKKcgacBgggtYMaatcBS
+tcgDBtMcataWtaWaMtgaataagaaDatccSYDtgBatgactBaVtaagatctcNMgt
+caWKtgcWggcgatacgtgtttatttWaDaNWBNaaNtNttcaaatagtaatScgHtMWt
+tgttgaBaDtgNatSaagtttHttaNaNKaattKatttgatcgtVcatgaatatBtttct
+aacKaNttVttSagccatRtatatcactcHHatctWSKttaMacaaDattccaRaYtttt
+agttaatattcctYaacVactgctMcgagcaMYtttgaagctagtKgNWttgaaaMatca
+McttcSVatcaatgtNactaaBagatagagtDMgtNtNWatttSaHactagaaaDggtaa
+aaNctMaatagtaHgacgMaaacMtacatHtaSagaHatYDccagtBtgaWatcYtVaag
+ataattgatcgacctgcaacgttttattacNMWNcattataDVDactatattatYatttt
+gcgaagtgagYVtagYaWaHaatctgWttttatgcHaacgttaccDaKtatagaccaDDt
+taacgtHBaacatccgtYaBtVtNccaaataaaatVactDttSKtcMtDSgaagctaMta
+tattgattactgtNaagNBcagHaDattaaaWttacacaaatactcaatSDatagctcaD
+ttWactttgaStaaDtagatSaaDtgtaatKtgVataggaagWSaaaaKatttaaagttt
+gcgtaaagcccggNWaacatacatgttctaRcaHttVtcattatctagttttNcataaac
+DttWaagVtNYtaggctttggtatgagaWgtactNaVatcactVttBKcttaaccttcMt
+atcggtaataYaMaYggttgtcaaagSWHctaRMSatVcggactMatatccgaatctttt
+ttcgagtccagtttgaMtcgcatcaaKagtattRMaaaKDBttDNccatttttaaBNtVt
+ccgtaatgaKgtcagMVSattatttaWaattttaHNcaaMaHttgtggctattctacDtg
+aagattatcgacaaVRHttcSaSaatactNHWaaNcgtWaWgaccgRSttNtHtcttcKa
+tYatatBaagtcgctBtgagccatatScctKaagaaKDaWactWagBgctgattBagKtg
+aaataBaaaaagSacScaaagagtagcgaDaYtaMcaYcKtaataMatttttaactttgY
+gtcgaaggacgcHctBcgYgaaVacRYagagBaaYgtagattgcgagtcaagtStDagat
+BgtgaccctaSWtctDgactaSHttctWatWttctaWtatctYacactgBWatKKctgta
+tYgacaaHSatYSaNgSagtatagatgagtatttatgaccMaatgtaHtStaWttgYagc
+caWattcagtBaYtaaNaBtaNatactggcttWcaagatDctacggaNctatcacatSgK
+gattgacgacccccgagtNDtattgagaaatattaatcVttNKtaaWtYacgSNcBHgtt
+gWtatgtttcgccaactKaattaRgacgNataatctacaacKgttBatYatNMSaaaNtc
+tKgacttatgcttatKtcaVtVcagDaataattYgNtRtHaagcaataHcacaVgtaNNH
+tHDatgttaMNtggWagSVaRttcMVDtcttWgtRttctacKaaVttcVcgcatcctHRK
+tattSgttSacgaagtcccRDVaacBWagtgYtKtgattgSgaBtgccBtcaKacaData
+cttHatcattNatttacgtcagtgaggcBtaRNaRcaSgcatattatStatgctYcacgt
+attcattaaRtgStcttWgtattKtSYttNaHaRtNYcRaYtVtggtDcKcttctactaM
+cacggcMtacgcttctatatHtaatggcattMDtaaMaKattgaagtBaaKMVMNacKaD
+tttKNcgagctaaagtccMMtgagaagVaataatggcaWaaaaVaBgtaSaVgaaaSaaa
+ataDttVtBccaNagcSBgaMaDaVaVYYRVBgttYMtagtaactDtaagWaattBtatt
+ttMDYHtSaStScRaKatattacacctMttgNBKtcRtRggNagtYMattaaatMctYga
+atgcKHagSggaaaaBcaggtHtatWcatcgtStagMcctcatgattaWRcStcgWtgRg
+ttttcctaacatcgctcgDDtRaatatMgtcMtHtMaDYatgDatttatagctKDtYHaa
+aaattaSatatctggtctttattttatMtgtYttgtcatactcaaVcYBgatgSctKtYc
+ctWaRaataWcMgNgcgggagtcttRMgactataHaHtgctNtVaatcaaccacgSRaDt
+gKtaaMSKgtaaaaWaKtttVagSDtaaaaaatgttYattttNagMHaaRtNgBttWatt
+atatgcttatatcatttatKtKaaaagctRaaatcgcYgacgNtacNtccVtSaaatttc
+DVctaatacWgcaMtcttSaaWaaaWagtagtaattaactagRttaVcSaaatataacHg
+HatWaattggaagtgcgSSgaaVtgYgSttccatWVataatcgaatatgHtRcgtBttct
+taaggatatgttgtBcNtaatgtcacVatactgaaatMBttRRcRatccatagagggaca
+tcgccWttagttgWttatKagtaaaagHtttccttSatVatKtgagcaatttattaaYVa
+ttcaaattctgSattRaMtgaatMgttattattacaNcggVagccttaaKgccYcaaDat
+tWtggMcttMacWttccMVgtgaattctDaBYgacttKYtBacatgctDcRaaKaaRaat
+atctttagKcKtaactttaatNaaggctgScacctYgcgcaaaccaHttVHcBaDgtaat
+HaHVaaatMgttggtSatHtNNaaVagtgtacaataaagacgKttcaaaWVacagctcac
+WHaatcctgtBNWtaNMKcVcVSWtSgcaattctgKtVVaaacaRaattgatRcgBacaK
+acVccVMactagcgMNaaactgataDaSgagaatVHaatVSVtccggatgRgtagRattt
+gtaactaBataVaggcaagHgaaSMSaKgctRagcStNcatttVgctatacttcNDtcaK
+BDcaHtDcaatagttHttattMBgagctgtaaagtMgatStStcagatatYcBtataacR
+caggRaaaggtaWSatKgatatgagcgtgMYatcagcatVttSgaaaaaatatatgttYt
+tcattatacataatVcacgattataDggttBtRaagtHMtatagaDgNttggDaKctBca
+aRcgattcgtgccttacaaaWattYWVcaaWagDattgaaagggaagaHattBtatVggt
+aHtWtaMagtccagaKttSatatcaStDtgWaagtKWaggtatttaWaaRcattaatStg
+aaVtacggaacatKctacatHtaaaBtcNWatttBBaNatRcDattcgaactataaatta
+taactcagtSgatataagRaYaKHctggtaaNtttaaNgaRHtttattatacNttttaDc
+cttYgtaaacaggaagtgataaacatBgaSgtaaaaaaVcBgtWNtRMttBttaaBgtaa
+aatatcHNStaBtaggtaVatYaccNtBaWagRctNSacRtMatDactStVctaaDtaYS
+RgttaRNttttKggccagaaBcatagtYcaYNtDatcgtatVcaatWRtaggaattMcat
+RtgggatgtcMggMtttataagtaBgtggacNaaKYtgctWgagYtWcctWtVcttaaac
+taRacatggtRcatctSDcHcMgcaactttttagttaccttattHRgtacggcactDBgg
+tMHcVaaRatKctSHacctacaccactaaHaacgSttagKtKttttgNHVgagtaYaMtV
+YNVcggttaSBaBtaatttSRcgtBgaWaatctttttKggacaWKaattKSaccttgDRg
+tcatatDatVMtMaVcgaattaNaagMWccctaaHgataatatgtattWataaaatBaaM
+tgRttcHctaagctaagatatattMcggactaRttttKaSttactWYtgBcaMMacRRgN
+tactttaaaSKtttcaYBaBttaVagtRtHcWaggaVccttNgtgagtcatataWttYSc
+MtWgVRgattWtaSggacggWWctBHatattataaKaagttactaMRaaataSRaDttDa
+aatataVHaatggaaBDgWgHtcKStVcatHtaatcatggBWaagHtagtMtgHcHtcat
+ggggWcatacaHNHagcDatRcaaattcgcttgDggDNVcaacgSgtggcaccttMttaa
+tattVYtVgaagRttaBcagVaYaHcaRDBagatgaVHtNMtcttactDaggMgMaattR
+WDcctVtgagaaaaSKatHHttVDgtctgtcacatHNttgaatSaagtKBatatagacaa
+RVctcWtgtacKtaacHtgHataSgVtactaggtttatggBgtcaaaYaDgaaaaaatcg
+MtagaKaYatgaattatYcttKtacaatttgWttMaatBgaatSttMtNaVgVtScgctt
+ctBHKgtaRcNBaatcDtacgattgacgtgctatNaaBtMgagNgKcttWcWKacactYg
+ttVgNcgaattttcttgaaaaactacccctcgcNtgMctatcccacMcactcMatttatt
+tagtagaacMNtttcttgYKaWtaaBtttcWttagHtgtttctcttgtggctatgDgcta
+atWDataatttagaNcgcRRNataKtctaataHgaaMYctNaKWtactaacDtgaVcgag
+aactggtaccaactHgaggctagagHHagtMgKtaaactacaggMatgtYgSBaKaaaat
+tMgatRtggggtHBVgttaattgKttaaRDacgMactcaaacStaaagctctgtgccttc
+gtSagtSaRctacaataKatattctaVgtgtaattRacKagttattgaMtaatgaNatac
+DataaggactttccNtStatatKaagaataKtatggtcctctatgaggttaaDtgtattg
+ataaaactggatcactKBtttggcgtcaaagaaaNtagtWKatctaaWBactDaBaYtac
+aWtaSgcaattattWgaaBgactgaKctatBRgtagttaBaRRgatttaagBHctStgtV
+YRtaaataaagtMWtcHgcattcacaaMWtcMccWttgVgcHaWttcaNtgtVaggNgcV
+atKttataaWDcccctatgatVttttattacagRBBWttcttRaWgaatBVgcgtHgWga
+ccagtYacaattgSttaaMcVtDatttaVttRgttKtcaYWatKtaaDtttWaYtaatYc
+tSctatagtcctBtccMaMMtaMYHaSSgKaaacttctcBtMtgDtgtttttagRcgtac
+ttataHgKtNtMtKcBtaNKaHStgSagYHtataDtcKtagRtNWaacVgctVtRtttSt
+NtgaaccttaVatgagaaggtcaKSttaDataagcYaSatNStcaatDNgttcgacaatt
+taSgaRaBNNacattRatNtgSttHVtgWHgtSHccaactKttYtatHYttVtgHcNgac
+tMcaacttBatatgSgattttacgtatttgtggtScaacggYtHtgcatctatttttWta
+SatcagaYatcgcagtgtgtMgtattctttcattaRatttStcaatatgcttDtStaaag
+accDcVtaWNcHYtWMaMcgaacKcaNcttacctaBtgcDacatcaHKtRcDaaacataa
+RacNNtccDataNactttatBSDYatDtctBtaBatctDatKaMcattMatatcDHctaa
+gRgYVcatgttcgtgataHDYaagttSgHYctaaatgtaaaactNgtagaaactaattRa
+atcttttBKcgaatSctMaggVaVaaatgagataaataSgttKgtcatKaKatDYtaaaR
+ttYaMtgctcSatRtagttttagcaaNtaKgatcgWYcacDgaatcaatactgBgaNtaa
+ctaaWatatacaatacactaNatcaVaKaaMaaaaaatcaccBtgttgNctaacaBattt
+taaKWcaggataWMtaattgtaaHtgVtcgaHtScaHtctcHacVatagtaMcaaKtccc
+SagMYtWcaaatHHtaagRttDagtMtcYtttaaWWaaaVaRtcHNtctcSttagcacaK
+ttgtagtNgWYtatKDtcatttgaacctcKHtatccttattcttNggtBgtgtKaggWtY
+gtStgtVaRtaRaaagtagtgtcgcKtKagatgagYtttaatKcScctgaaaaaRaaHtt
+tttaaaVgtatagKctaNtKaSVgttcgagacattttRSatagttSacataMtaYHccac
+ttttctatactagtatgaBaagctttaMtgaatgtcaKYtaaatatggattataNcgBHa
+tcctaRaaactgttgacttYaHtStcatcctDaMBttgtaWgagtaatWKataaaBgBat
+tcttttctttaatWStaatacgNaagtWaMaaNgactMtgaaDaggaaaSctaSSgatat
+DttattatcatagBcaataVcHcRgcStaHaaatWagatHttMHactaRacttaYaaaaN
+tataHKVaataKtatgatcgtcVaaWgttYtVcaaYggctRWttaaKtRttDaKtgtatc
+aattWKaatBHaaaaNgaatggStHgVVgatMgBYtaRNgBDttMcNtggaNgtcaHtgt
+tDcNaggBtatYtacVaNttctcWtactHYcSctgtYtDtgWaatcHgatDatatcHtct
+tatattaaKaRYaDgaatgSYcgactgcRgaagttagtStYatYtttccgacactacagK
+caaagDttaatVatcttaaacRaDatRcBatKNtNtaaaHtcBgatKHcWStSRaKaSMg
+taKaBacWgDDttgYaaYttaNtDgHtatSaSataaaaMBaaDtaMatDaagWtggaMtR
+cacttatggctNataaaaatatWNMtacctatgtcaYKaRacagttHDagccgtaaYcaa
+tataatcatagggaaSatgMYBcKBBtaaRVRatRtccVtgtgaagVNttcttagtgtcW
+ataVggtaaNaatVgVaKctttNgtttagtaaagBatBtgaYSagHttSYaacaStcgca
+gaSttcDBtKtttggtctacNttgNgKNNtcaaaaKWactgaaYgaYactatHtaWcaac
+tgttSatNVtgtctSttYctgattVaatKgtaYcaaattSgttaStatggtccaatgSWc
+caaactattgccgttacgcNatcHctctcaKatgtagtctattttaaggHRatcDaagSa
+VgaVNccaBKtacgtttStagKgtctaHtcattaYcctaVKtttaYaaatYtccgataaa
+VttcDgatWcgBtcctaatttNaattgctDYgtgatcaatttaagggctctcatcKattg
+BtaBagcaYcKctctttNtaacHacNStggRtMatHHgtacatgcaMagtgtccatRWtt
+RKctaaaDtcMctttaNVgaNtcMatcacHcctgWtaaStcacgtctNaagRNNaagMaD
+tactDgctttttcatcYacttaKttatgcStDaStNaMgDtaacKtMtacctaaWattgg
+tttNaaVHatgaaattaattacgVNaaWtggaWatctgVatcacYctcVHMtVaNacNtc
+ccaWtttgcaacctcWctHaatcttWcaaaYaBaattSctYatctaagDgBttagtaSga
+WtBcRcKtccYatatcKBgtctttatgaaHDcgNaMatggatgtWagRctStagagaaga
+acagctWtNtataaaataRatHatKgctNactHgttRgRgVcRacatgHYaNttaHtatt
+aNStaagatgtagaHcVctcYgggccYcaaaatgatcttctagctctHMaMMgcaVtgHg
+taagaWHHtggtaactBcaMNNctagaacggWtctttgaggHcYNaaMHtaYcttKaagt
+SccgttgggNMStatacDttataaaVaYcKtcgcattttcgacctctcacVttNtttatt
+gtcttctaVcatagaattMttgtHtMgacataaatagttctMtgtWgWctttcaagYgcg
+tNaagcaaDaVHaaStMtaaagccccgtgVgtcacatcHVaDtgttBtBacBtcggYttD
+agaDYtccMttagcttacNcgaagatRtDataRtgctaatatatgRtWVttatWKtgcBg
+actcgagaSgtaaaaagttaaWaaagtatttctcWtatcBtcataacNcgctcRKaaDKa
+ctRaNtagtatBtgaaatttcgcDactttaNtYgagagaNttgaattaataaaSMattRH
+NtYtgttgaDBRBttgWttagSatgacDggNVagRWcggctacDaYSgaaattHgtYaaa
+gctccVtatacattaMctttgSgacatBKaattRgtaBRtttaactattctagcMKMttt
+ctgtgtgVgtctttcDcgtaaMtaggtaaaDtcaYtatccgattcYtgaaRttctKaNct
+aYgYaattYgRttWctWttaaaccaatcactVatgcgYttgaaatgatKBcNRgctcatg
+accHagcgaaaatgtVgccatcaBSatKccRStSattaaatttggtaagcVattctgVca
+ttMtacatMgaaaaaataYNDtDaatcatWattcaggNcaccctcBtgcKcHagYtatBa
+tgBttgtVttaYBgBgataaHNtacRtcaaBaKcagNtcagaatYgttWgggaNDagtat
+agRtctcDtDaHScagttcYcatcSYacHcagagNgtgcHagtacagctgRtatatMtaa
+tRaWMHgaaKacaBRtagHtaaaNcVHcatWBgWaaacWccggtaaRcattgMgttaNgt
+tVMVttgcaagagaatcaaaaaagYScKVtgccgacHgacgttcaMcctcattatgcBtt
+ttaagtKatDactccgBatHYgttcatcgaaatctSaKaagaatWVtcgttgtcttaMaa
+YaSDtaaaataccgcKMtatgKtgScaaDMaaaactgtgagcVtttaRcttgtaNMatat
+atttggtMgYVatDaatttgctttaaRtaBgttaYaaagKtataMtWStcHaaaaNacgc
+tacMttDDgactacaNaatBcagtcattatatSttaVgRtWgSggcaatSataVgSYgct
+BttataaYRRgaactgtgHtgacHWSactYNgtttBactatWStaNtcStcMttgattSt
+acctgaattctWatNaaHgMatattcaaaKWaBaataatHKgaWgataYcaWMBtgtacK
+agaaaaagaattttWttDaMtggttgtgaNMtVtDcaacNttactattacggKctattta
+aaaBKatagttHaatggaatatYWgtaVtNaaYgataatMaccWagagatRttMtgKaMc
+gatattaacaagatgttBBcNaYattcNgtRttgaBcctaagaSMttcMtcctcYattca
+NaRBttaatgVcMNgaacKagatcgNctaWVgttaaYRtgctSctaaaaNtttgctaaSc
+ttcVattaHtaaMacNgttNtKHMcctattttaRtttVtSgtacatBgtVaaSSaMVaRB
+caSaRHtaWtWHttMtattVcaMtWaaaNaccccgHYtcatagaaRtaaBaatttaBcca
+atcRctcatagWgcBHRtacaaDttcBgaHggcgctaHtgacagcSNattcctcgagacc
+BggtcaagWctgVcRDgVtaagtttaattatcMtgatNagYttHtYtagccRatagDtaa
+tcNtaKtacaMSgDaaaatttgHaHtRDgtaattKtaMHgaBcaWtBNYaWgtttSttta
+SttgataatgactMKatHBtttaVcYatgggttttaDKcSatttMatatcagtYaBtgVa
+caatHcaDMcccgtaataatagDataatVaaagaagaVtctccgaRgtRtaatcgagtca
+cttgttSatgNDHaSNRcggtaSaagcSaBgWSgcatcaaWatgttacatgattcWacMt
+agtgNcacgatgatttttRcWttSgtaatMRRBaacNWRHaaBaattDaagStgatcctt
+caDacccctKaagScSSHaaYHWcHcaWcaaaMBataattgDtagccWtcRHataMNKtM
+gHaBcatcgaagtgtaRgtgggaVMatgttaWRtStBHactaaRaactNctcHaaaggca
+tgcVHKHgaatcSccttggSaWatWtNcaaBctaRagaaacacgcttcKatRattcWtgY
+DaaaaaaNatWtKgaacgtNttactgWHBaccaWacggttcaaVgagaaacVtMttatag
+aagtatWtaaaNHYaMacagWagtaatttgcatcttcgaatacggaHtaatVattctaDa
+HtRKRaNHcttacatcDKttMDKaWggDtaatcttYctcWtRaaaaKtaatcctgcccca
+tgcgDtctaaVMtWRKKDctaatatDgactagWtaaaBcKcacMactMHHttgDataKHD
+aDttHttatttagtcaaVatccKWtacWtSVcaggtaatatDSatgcctKtatDtttaga
+cKaaaagcgtttaaSaaaYtgattgtKtgBMcKttgDaaaagttBRatHgcaKgDgtgcW
+ataatMWgcVaVatcYgWttaDatcatNaVgtttgggcttgaHRDaWgatttctgMHgtV
+tgccttBtWtaatcgttcgKgRcaBaRMtaattWgctaatMaVBccaHtDagaBNaataR
+cacYcYcHcatBgaNtgaNgKHttctYaacaaaYgBttRNtNggaagcWtDggattgagt
+HaWttVacaaaBtgttaNctaatactKaMaaaaaDtaRatttDaaagNttcYcaaactcM
+gaYgtacaaatMaaatYtcacVaacgaaDagatWgBgaataggtWtKaaMtgDttHtgag
+ttaatttgVaaDagttNMataatttaSVattNaDtKVccaaatcgaYVtaaaacKRaata
+atgaBDtctRtgVcttatttYtgaHgttBWatgaatatacSaacctSatNNRccagtact
+KagaRtgSKMcgaaDattttagtHcKcaaagtggtataaaggctcctaSatHtaMtRKat
+taNRcWtccgctataKggatWttaggtaatHDRatttattRWgcgatcttagSgtcttac
+tatgYgttYaVBtgcaYaaRtDaatacHHtDcttHgBgNcccataDtaaaaatctNtaca
+tatWaRMBgaattaaaacgctctctcaagtKcacNacgVRVctttttaacttgctcStat
+RScaRaMataNaKagtatcattRttNaVatcKgtacNatttttgaNcgacaaKctHWtga
+KStacMaBatgWttNSacaaKcaDaatcWaKaccgYBggMScgaMcctagcaDatgtttc
+VatgtRBtKNWHtcctWDtatttttNNSaatattcMttgatKgNgaNBatcSggtctRct
+tttttatatggtNttDYNYgaaaKctcacacYHRgttacatacttYacaataNaagaaaa
+gttataNaataSatacagttScacVaScaccSWtccagKHtaatcaaatVacatWacgBc
+tccaataHaaYtMtacKacHttttKtcataWWtgtgaatWaataaaaacatttcacctta
+HtttgttccaatcccgRBaWgatKgagtttBaVgaNtaNVBgcaataagaatagcaKRtt
+gtatcaattaMtaacatataDBgtaaNttcaNcgagatYactggttatgtNVtaBNtDaa
+DtDttaSaWtactaVtHactttNttcttcatWttcDatKaacgtttggVDaDtVagttat
+gtcagactKaatcaYtSgttttataaataDttKttKagacWgHgatataaatcttagatN
+KtttWtWaaatattacSHaRgtttScttaatWttacgRRaaMactcatBacaccatRttt
+gaacctacttcDMggcVaSBagaatcttaKMagcaVtctDVataWtSgatagacttBctD
+tBNWgtgKatWctYgaaStccgVaaaDattYatagtatcaacBaWYctgaaatttaKVgY
+tStNtcaVggtggaNYgaRtMaacataSttcagacVactcaVaagtggtattaaDBNDaa
+gtatatMtactatatgatRSgtttgccaacgcacRMtacRYNataagatcMgttgatcat
+aaacttVcatatgWtacaaaWttggaaactttaScataactRattMtDacVYataaaagM
+aattttKtgaBttKcaacatattVtagtcatgactcgDaacDtaWctatRttSSYNtgWa
+ScaaataagaaatKtagacataatggNaatttcSKtVWtgacagKWattcgVatttcKWg
+agcaWgNKaaaatatgtaaacgttcactaaWgacaccBNaacagaaStctgctaHcVttt
+MtcYttStagYcgtttBcRtaYacttgNaacMtDRtagcatgtgcgagcScaMgtaatBa
+KataactMttttattaRcattattatacgtaagSNatVRgcttcgaVaacHNtctaHBKY
+gKaccYcttagagcccaVgatttgttagactaaacgtgcaBgccaWgaVataggattDBW
+aattttgtBacWtttttaatDtMgaactaagcVtctcagBMKatgattgaNaVttggatD
+aSaBatttcgccatatgctaattgYacatgatccacaaMHtttcKYKaWtYcgDtNaaDc
+cgNaNcacacHKttDtttaggctagRVtYgtaactagctttcacaaatYtHaattYacaa
+ttaMSagMactcctcatgtScttcaaYtataaaaScHYaKcaYacactVcacataNtaBc
+aRatgYagVBatttgtaactttgRggacaagcVacctattacRcaaMacHRagagtaVNc
+tacagtgagacgaaaggKttacattgggacaataKNtattcaagWKttgatNagNtgcta
+NgagatNacSatctNatttatctatRgaaaatKatNKSBcKactatacStcagtaggtVt
+caaaBYYgctattKtWNttcRacaaaNatgaacttaRtaaDSttVBYtaatccagtNaaa
+cRttagaaccRBatataWaatKctcattcSacWaacaacactDttVttgacYaagagtaS
+gcMttBttaVNgRVagKDcttcttcNtaggttgcgacYacttaaggVHcaagDagaagat
+aaVaatctgtatRatDtKaaSDgattcaattYtcatgYgtgaVMtMaactaagaatgRgD
+tHttaaccaatStaaaaMctVDDtgttatcttaBBgccNacKMaHggcBMttctgNctHg
+gagaataYMgtaMccaataattHttYttKggtKaccaactcccHtMSaatNactcRtttc
+atgcKcatgcacttcatSaatatactttVtaYttDattgWcctcactcYccattaDDaHa
+aKcaatSttagKtWtcatRcaactattaattYaDggKtagtNcgSgtttKRgtDWtVHtD
+NcHWNtKtccgtctagtatSctaBcacgcaBtaacatgagatVtttaaggcaVttBttaS
+tWtattgYaggtSatBMBDactVtggttDagacataaactactBgcacaacMaagaStcc
+aWNaaSYMYtgtaKaMcYSaHaaaatatttMgtcaaDScaKtcaBVtaMVMRRDMtcttR
+BgWctaacttgaacNaatgttWgtggBtRttHVKgKcHVtatattSaaaatBttcBtttc
+DgHccBagtRBRttaVagBctRcaagcattacKccaWVWtaVcggttatNaSgccgKtYc
+BaagcWgcatgaNHaKtagNgcHcgtgtcataaaatagagacttgHYatattctaBgttt
+atRatctatttagacattttNtWaaSagtaHatRtctcggatttatgtgatBtctRgggg
+catWctaSVMaRtcatgKattgRcatMaHaataNcBcDcaggcactattHBgaatStata
+ttcatBgMVataaSacVacKHatggttaaBKtgtaSaWMattttMacKtgaaWaaWgctg
+RatgtgDacBtSaHtDgtgtMVttagatgattagagaSttgattgtSaaacagHaaatac
+aRcaccBtaaDtcaMtKaaStttatKagaataaNcaaBtattKaVNaWaNactagtYatt
+aaagWgHttaMcKaSagatSactctatMSagtggaYctcacKKgaSMgcRgKtgccagNM
+ataatccaVgatcttHagttttcttaaccataggggcttaDtYatcgaaaMataagcaaa
+tBttgHHcHagacagagaggcacWtacccMttacgtgNttattYctVaaactgttaagtK
+atMagttcacaaagggatgaVNMatgcaSattatcKagtHaBtgaagBcggagtWttVaa
+DaccMScactgVatccaRaSatattNtgcBatgBaaNgtcaBMgggaatgagtatRgaat
+gtNttacaggcttaHaataaHSagatagtgVctattaaagggaagDWVccatcKaaaatR
+ccccaSVaaatttMtatStgtWagtStMaaatBctgcctKWgttDDaSKactctaaVRta
+SWcVactggaaaaNMaaaccgcacNtaVgaagcttDNgaDBtaMaMKNtKccaVtgctct
+tMMYaaaaHaattcWgHcgtacatWaMaaKtaataccgBDaYRaggatatSKcScYagMt
+aatKHMtaaccatgHgtagDaggtgtaaatatagaKVgccRYctcRaKBKWtgatHYcaH
+gBaYtttMcatataatgaDttcatttaStgtcVSgacggtggVgtBtgacatgtaaSgtB
+gatKtKtaYcatVtNattataaaHaSccHaaagctSMKattcatagcacagtgBRataac
+aatMttKcWaaaaatagStcggRttaattatWaataatMaYagatgVtatccttttHaSc
+gtBgagWcatgBtgcctatcgtaaWHacagtactgaattaaaaaNattRNMaSSNSctat
+tcaaagccVVcatattttagMcgtattNtVBactacScattgKVtataaKtttgNaWctt
+NacctagtgaNaaDcagtaWgKggaaKtacgcaaaYttatacSttgYaYttcDNagggtt
+VDagHatSgtacYVatataVattataSataacgKgatVtVacHYRWttatcctaaDtgta
+aDgRDttttattWtaaDttggatcattNgtVaaaVggaaggcYgSWaaattcWHcgaSaV
+WaMatctMDtHBgttttaatctaWaagatatDKtVttaccgaMatRaaaBttaNagHatD
+HWcDtBVttaatKtMataYttSRHHcgtaHDtggttccaaagRRtaWtVctRcaNDttat
+acgatMcaatNHtacgaattBaatHtcccatctctccBtgtataYctatgtcgaaDYWtN
+ggatNcacRtMaatNtKcttSYSctaDaaaggctDaStatKtataBgcVaatttggYctt
+aaatgatgtHctaaccaactttgggttcMaaDattatKtVacgVcScaactSataSccHt
+tYctttgtggcDtMcactaNSBtMRBMaggttWKtattaatgtKHacttcaMVatctgtt
+gtccaaYNtaagttKaacttctHcgcWtYttatMBgBaMacaattaDaactNaaatSatc
+VtSSgatctatgNatSYaattRatgcDgtctataagagaagRgatatttcccaataHgtt
+ttWKtgaagNRtctaaBtWcHHcDgaattgaaaKtgttaaRtatgtaMaggDttcMacca
+MaattDctgYctaWtStaNtgRKaBtNcMHcSttMtaKccYacgNNctttatStgVtaYt
+aagttaagaBHaaStVKHatgttRVWtataMtSatgcaattcMcttatKgMcagtgaatc
+YtcctNaYcttactttctcttcatggcgNcatScStBtagctWtHaaWattaccgtctcg
+tBMcaaacKctcccaacttBgtWStVttMRgKcVagHttVtaagMaNatcaHttacatcY
+KttDBtatgSattVcgBcBVYttHNtcatKgcYgaaSaKtatttttMtctatctaSaatt
+DttcWagHSacgttagYgacWaSaDKatcNgctaatgVSctgctYgaKgKtaataggtgg
+agcgtcgaaaaRYtgYWYSaatacBgacWtaNStcaattWtRcttttaaSYgttcNgtBW
+WgtgaatHttttBaMcMtKccagtattttcgaHaDtSVgatgaacatgcacgtcagagDY
+attBcagDctcttNcNtaaaatRctgMcDacaagtttagtcaaSSaagaaacatacaDtc
+tctYgcaaacBcaagaBatgtattgacgagYacBDgttcgtgRtaMgaattttcNtgVct
+tctgtctagtgtccatatctgatYatNtatVWgttacaDacaHDDagWtgataWtatcaa
+BRatDRtMgVcgaaattcSMagYgWacgggtaacaaattcagcatagSgttactBctgSV
+WatYcYgcBWgggRcHtataSaattBcagHgcgcctttKcttWaggctttaaDtRacBac
+taaVaaKtaaacctcgcgccattactKactKSDcgacaVtatataggataKctcgSatgH
+SatVcgtagtgaBtSYtgaBataatStaaccaagttcaDtHtatattaacYatattatcc
+tacgagatcaccgtVSttctYgtcataaVactcgWtaVatttgttggactaaaVcaSaDt
+YcgNtYtctVaMtaattatWRtWcaNtaKcaaYggatgNgaatcaatcRtcgagtHcgVg
+ttataHDcatttaagttctHtcgMRHtaaagaVactBMtatgaagtaaaaaBNtataaNt
+tcKcctaNttaaDtcgMacgDcaMatttgYtaaNtcaccgatgagMtgttaggWcacHtt
+NgtcttHYMcaattKcagttcNcaaaacgNaaSattgKttaaBaKttatttaMggHcttt
+taaRNVgttaYttttMVRtYVgRatKcgVtacgaatttccBatBgYBRtSKKctaaaatg
+atatgBtcttcgtttgacHagtaattatatctgDtBttatgaDtatKtcKRcRttagatt
+attagHgDNaaaKgcgMtHtttKtDtgaaaagtaMatcagaaccgaatKgtatatVaccR
+aKYtDHtcSagtBgtgccWaaaggtYKcaHatDDaaattDStDtcKggtMgcMtgtHtca
+aVcgtttNtagtNtgKgctaDcScgBcWSatgtatagcKgWgttgaacgagtgcgcgtKa
+aaacgRtttccatatatttttMgaKagcVcVRataccWctctcgBcgaggcgttaatgaH
+YtttHtaSWtagcagtttKtYaacaaataMtaNDatRgMBaBacSaataSDctgaactat
+tgataaRtaVtttHatWaacWtVaHaaBDtactYtaDactttSgtKtRattgatttatat
+attattataattBatagattctaacDcRMaaggttcgtcatattRVYcttKgtRcgWaat
+cgaaWWatDctacaaaagaattHaatctgttttacYatKatBaccMaMaaVtcacStaaY
+gYKgtttctcattatattNgSaaHtgRaBtcataKYtHtacttgtacaaaDtYtgatagN
+RcYatgaStaaagactgtcWDtYaatVaNStagaaaWtaaaataDYtcaMatSVBVaaaY
+agaaaattgtgcDagWSaStattttaatNcacgataNBtaattggaatgcMgacattHaa
+ttctctaaMatactaBaaattacaHWgBNtNaaSattttaacHtgtagtBtcRtttSaNN
+aYaMaDtatDtagaKggYgcaaSttgctactDcNRtWgtttaVtggcaaactattgSgaa
+gtattatgDgcgtgtcttagcNtRctKggtMaHgaDaaagtactgtcgatttagatcagN
+ggtaattaKaatgaaYaaHaattggttVaaMggatactctaBgtYHMcttccVcaaWtgt
+tHHRgagttKaaagaBtaRtaaWaggttctatRatSgtatcYtaWcatgtaBtcaatcta
+atRgaYYtWtccattataBacttWtcctaHaaaaggttgacgtRattKgaagcattSBtt
+tctaNcSctSStNtYtWaWtgtagtcttgtctttaagNKgaagacgDaRgtNaBaVDgaa
+ttggaYtaccSVYKctSKKcatagttgSttatcStactcaatSMataHcaKgatWVYtNa
+cagtttBtRagYHaagtaNaaVVDgatattMaagattagcatcctaMaaMctgNtMcSaR
+cgctHMttaattDtttYttcgataaagtMtaagttaWaaDcaatccKgtgMMcatBgtRt
+aHBcttgtBaBggcaDcgaWttgggtaDaggtgatRtYaMWDttatcNtVcttRaKagct
+RgtgcNaatctgattatagattagtatatgaataDNatcYaggKRacaatcaHcaagtta
+gtKgRatRgttaagaaaatacVctaaaagtgtaagKVgcttSWaaHatagHctagtDgDt
+SaVtgatcatttaNKgKHataKBctatatWaNgtttgcRaVNttaDgtcttagHYKatYa
+VaBtaatgaBattaYcNtgcaBtHaacttVtccatDagVaaaYgWtNDBgacagVgctca
+RtaHaaacttttacaaggaSRaaatagaagaatacccVaHatcBRtcttttaaDMHWtHg
+acMtctcaagKDttctgYctctcNagaMgcgaaDWatMcMatatttDctttactaVScta
+gttcaRKWgtttKRaVaaKtacaacaKttatttttggcctataaDgtcBctBDgcYYaat
+NactcaaRgaRWcgattgVNcWaatctgKagDMgctatKttRatcattMaagtctaRaVa
+attKctgaKtatccgaaRatcHMaaaaaagattccacgtacgaDStatatctcataggta
+cgcgatgtgaaggtHYtatWagKVKgaMDcaatttWccttgKgagtctagatgaatgVRc
+ctaMttgtaRaaYtRtaacWgaaaMttatcatNcgttactaaggtDaaggcagtRctcat
+caatggYagccagcgaatatagtgttWtaccaRctagatttDtaaatRcDKtccHtBWgt
+tctWaagccYBSgtggaaagHNttHtctaaattaBatggaDMgaBgatatcaatactcMt
+aaKtcYccgatDaYgHDBaagBattWattgatttttaagaRaaggatggYggaKttaKtB
+VBcttaWcttBtacctYaNYttgctgtBaaMtWtcWaagtaaggWcgMDaaNtccWMWta
+tcMVgaSaRctaKtBgKWDacDgaaaaNgttcaaaaataMcttaWtatgNaVaaRataWt
+gKctRatataagtgttgacgaKgaNgtaHattaaRagSgattctatgtYtcaattagBYB
+atccYtgtNacHagHtacVcVacaacaccgNgBtataYaatWHSttattgctDacttgtg
+HgHcMcHacagctRSDtgattaggaDHtYagatggagWtaMatcRcccacRaaaYagcag
+atgatacatatttVBBcaaMtctctaWgaNtttcctaVcttaYBDBctRgSaagcNgatt
+tcacgtcRDaVBttaRaggtaaggHcacttccgDBKgagaatttataaaMaRattagcVg
+tttacaaagagaaaMtgDtttYttggcttataKaStacaVttBttcttgBcVaataaaga
+gtgagBgcgNcNattgaaacRcactDaaccaatWMtaaHtBgaaacaaccctcMctcaaa
+tctMWttggttttacttagcRtttacatRtccBttVcatgaaBacaYgagHttatWDtcc
+tSatRtYggHtNMttRgNtgcatcacgacagaHgtYaSaactgaaNWVagtagttagaNg
+atctgcatWYaDacataHtaWttaatHaDgactYgttcaSVtttacctaatttaDgRcag
+acaDtgcYVttaagaSSKBYtgHtDtNtcgtcWttDtgtcNtgacKagcactccDMacDN
+cccctWataRKcaaatttctRVaacagcaMtataaattWBctttgKgVcatttaVgtDgt
+atHtgtaSctagtatagcBtBtgtatgtcgcMcgagttctacgaaBgWccgaWatgcaRt
+WtaagYttaNtcWaHtgattYDatWRgRWagtRcHggNatNttWaaacaSgcaatMatga
+cNgggaSatgatttcBHcctaaggWactacagaaaagctMcaaagaYtHVgtaaHKgKat
+tVaWtttcctaWgaKattatgMaattBgaaagtgaSaaaWtSNBtttYataVgNatgaSg
+cBaaccatattcctctagRtattatctttctMtgaRtctcYgaatDtRcHgcRVtWtaac
+DtcacYatRcttNgcgaDtVctWtacHtatatgtatKaaggtaNcataKRaataacacDc
+tcctWgtSaWcatcDgatatBtaatHSNBtcaataaStHtacttaYaDaMtaagMtgNaa
+aaNccccgYWHaatgcBcttaBcgtMBKggccaVgacaWgaaaaaVYcRKctMgcaccWc
+tcSacttcVtacgaagtYtcctttttaYgttattaataactSttRggtcVgagWRStatK
+ataYcaatNMtacttcgcttVBaYRaKttaaYatacagctBgagcttcHcaatBaaaVcg
+ctcacaMgttaHaggctaDtSgatattggggBgRMagtaattggattgYYHtVtcttSRY
+aacttataBtNKgatVaWSDWacatVcttgttgaagScaDaSttcactaattagatKtta
+McHtMgKccaYatKataMcKNgattgtYtaaRHHcaWagctgtgcYatMHaatRDgtgtt
+YctatNKtSDtaKgcBttgagtKtacatgaaggcgMatDaWtcBatagtaaaatNYtSVg
+VatttcaNgRtaRaaNBttggaatVgaaaaagaaggtgNtttVBgccttgtgaBtgMgta
+aacBgtactWgtaacctatatggaSYattYtVgtttaagccaRtatRMcgWMgDVSNgat
+aatBRccNagagStHttBgctaBagatattaacaagaggttttcDaRagtcDgtHttcat
+aagaacaKBttaBgactaRatgaaDYHttgVagcMcBDgYactWgSgacBataMMcttSa
+RHgcagKcgaaYaDgttcataYKcttcMWttattaaBacDcttDtttBcatVggttVHtg
+tMgKcgaaVgtcgMaaHHYBMaHtaaKaDttaNgNtttttaggMcWttNaaaDaaaaact
+RgaatagSVHtaataagttStccaatcHataatacMcattHtacaatttctgatggacat
+atgcaaacaKBatgcagacagVcctccgcaacNatcMaHtcMtaSctgtaYgtStcBtca
+tDacRggttRgagaaHatVcttYWgaDtatgYcaBKgtSWVYtttctWttHtctaYtttt
+aBtcataaNgtBRaNcgttKgtgVKgggVtWatcWagttSttttttaMaRWtccgtttta
+ttaHatttBVtataSctRWtgcMacaattaStBcacggaatRatactVgaagMaaagWac
+aMgctaacaHctHtaatacacgaYagtcttKagcDttaKBHccgtaHaacaKVtcMKcaa
+taaaNaggttSaatcatgaNaaBtacggBcaagatcRgttttHaNgtKctYatBHHtaaa
+DNHtaVtVagttVacKtcYgcattcatacaaagtaacKaKKtaaNtNataaNaaSaBtag
+aattctgacacNtaHtataBDttBctataatagYSctgtaHcgccgaMBaggttaMHtKg
+ttactaaHaacgDatataaagcaWtgaMtttgVatcKaattcgHVNatNgDaaYtataHa
+caaacaagagtatatDStgcNgcRtaaWVVaDStNgtcaaacgDttaaggNttWcaVNac
+cctgaaaMcagVYVaMtBgtatacSacgSgNtaaaDtRaBSaWcNacgYaggtcaYtatt
+agVStaccgatgSStMattctWtattHtHaDtatgYaatattgttttaNggttVatcttR
+cgaNtHaVaStgaagactcacaaatcactgataaKBtNHtttctWWtattgactacNtaW
+atataaaBaatBttgggtatYtttYtgttttVttgagtcVaMVgaatNtaaNgKMaacgt
+aatattKWggcagtgRttgtgacactaaYacactggaaKaWYRgcatgcgttctBcttgg
+tVaaWgtttHagtcaatctcggaNWtaatBNcaMVKStaNcMtgatataatDYMctttcg
+catgcYtHtVNgStggagcBtggMgccctgtgNtVatactgcctcHcataDBtaStgNca
+gaYttaMtcaYtgtagatDaagaHaaaRcRataattcaDtcaDgttgtatRaaaaYaRgt
+ttDBgDcgaagcNttgcVttcacttaMgtMWaYaattcggaDcgaVtYattaBYaaaatt
+aHVttttWaacDttaRaSWactcBgaRctacaVStBaaatRgaacMSaagaatagYtNct
+caatagctNttaVtgctgtttgYcttaatgtgMaStactgDBagVSggtSKMYttDatgt
+MaaSaVtccSRMgaaaactHaatWWtcatttctDgcMcggVtgtRtcatctttNatcaat
+atYaKaaaatKWtDDDaaactaagtacRHtcKttacaataggttWcttataSaYctgctV
+taaVggatcctaHVttgWtgHtWttaDHaNgaccctatatgcWtNttacctaYtttDWtt
+taggHNgccatattacKggattVatatcRcggRWMtgcaVRaaHgtaataattttaggtc
+tcDccaatatgSaaaagatDtaaVtYgNaHBtcaYttaaaaacagatataaagttaaaDW
+ccMHMattggtaaagtccgaKtatDKaVHaBagaBatactataVttDttDaMagctctaa
+DSggtttgaDacacVatcttNtgatKtVaBStatgNtgDKYcaatcataWtcNatYccgR
+tcgBHacaBaatagaVtagcttgaKagcgHtttDNtgaagMttSttttgDDKRWtagtaB
+gtgagtgBcaDtWtaHcctatHatttgttWgagcggDtgtRDRcaaatagcacacRtDgt
+gVaWtaattRacVataBWacSYWVctgYtWDaVtaKataaacttKaaaMVHaaaaKNtaa
+acttgVataaaatMaaatMaagtatcaaRtatSYRtBtaataattgtttgaWtaNNtctc
+aatNaataaaaaaattgaaaattattgtgttaaYatccccHtaNcattcacttttaMgVD
+taDMtcaWSgYWcSYtSgaatHtgctagaVattaBtaaaYgatattcgaaBtgaaDacac
+atRaagcgggagggDMtatDttaatttggaKSNtactRMttactgtBggcgtcatNttct
+attaVacgttccKtVttMacttWtctaYcacgtaVtaaRgKcttggatSYatattttgtt
+acaaMgtgagagaSatattWcagDttggNtNaaYtaggaaKtYHcttgKattWagNgtaa
+gHHVatYatcattaaaaaYtHgttcaaaataattatBgcaKWKtagaatagtatBagaaM
+tattMagaMtHcWgYcacgttagtgtDNggctatNatRcYYHtaacMaSStattRagRcg
+ataaaatWNNatgaaatttVtKcRtKtDtaaMcctccaDRcaHtBSWcYtaKttcacaaM
+aataaMaactccgSgtYattDtaWctagatBtaatSgatgatHKgttgcaaaaagaScHt
+gaaHRDatSagatcBcggcatcatYVaatgMaatStgNgWaaaaMttgcYaaagttSHaY
+gaaatHattBgtaaMRagSaSacBaagtttttcatgttaaYcagYtgKtYctaStcaagc
+gtaVattaNatWtHgtHKNDtcNaKaVaStSacaaStttagaaataatgcDSatgtaKtg
+MMtcaaagtNattacMYgtgctNgVcaaNcDtaaaVtYggtaaaactgcaagaWNcaaac
+ctDSaaSgVaKtctcatataMtggBtaRttKtagRcctgttaHgWRaattgDaaatttHt
+accagctcagaccKaaBctaagtatWtaVagBgtttatgaHaaggattStaactWacKDV
+tMHccgtacaMWYctDtagatttRctaccRagtWcWgaaaaMcagttctgacSctaaaac
+tgaatcacaNcaMWtWccYgtttNaatttggttaaNtggttSattttcaacgYVccMtcg
+aactBtatcYttcYDVMttcgattaKWtatttagcaatatcagWatgcRVaatgRtacWa
+VVBttggatRtaNgRagttDYataacDVBcaaactttgtttgaccatagHMtRctaWcga
+cagtgcVcaaVgRgtaagtRaaaattSBKacBaatcagaatgtHattcaVRtatVSSaKa
+tNataWRVaaagMaacataDgataWHatcNYcMtatttggaSatttcHcgacaYcaKaaa
+tattacHcSaBVatHacactaMDataaaggcacaacaSacctgtaaRgtcccaaaatWtD
+tagtcaagNtttgatDacDgcagaDcWgatDaaKagctDWtttatatWgDcaaaWttStD
+tKtatSagVgaaKtaacgaccgMgaSaatRRcagYtgttNDggcHScaaYDWtcaacgta
+HgaStKtgMtRtaatccagtDaaacHgtacaaccHtagataNaattatcVtgaKaaNaaa
+aaaaagttgMgtcRaNaacagtaKcaBgtttgaMDgDMacttattatgaDgagcgtcaca
+aRaagtYaggMtaaactagaacagVaMWataggtatHagtttaaHtcagtaaatgRgcat
+gRctgaMttBaaataagWVtcHctgtgtYaaaaVtKtaSaaBatMtttgttatattattc
+aaBYctBWtggatBtgaggDagtgcacVataRBctaBaaaataatttttNggtccgtVaa
+aaataaattBHaatBaagaHgttaagcctaatcaaatgaYtKaatYtaaggtMgaRggtW
+gggNactaacgaRaaattSttWtaataaVtHgtacttNtaagHaSacgWggaYggNStcc
+tgacgDcgHggtttHggtNtMtttDatNDgtgacgtatacgatKatataaacaattSaaa
+gcagatKtttSagcaaMttttgaKtMtagtcRacctKSttBttaatMtgcgttacaaaga
+VaataattcaSaaWcBVacYKtacaNBaaKRtRtcgWtWBaRKVtYWWWgattgBctaaa
+tKaattaYtMtSBMBHDtBtaggDtcNctWYagtgSaaBaVtcttNgtcgttHtgtMtct
+atKtatVggKaSaagtttattttatgtactactHtHttSMactatHcaagaattVataaa
+MKNtaMccgtgatDaHcaacttRataacaNgaatcSBtatgacBcctcgggtaatWaaWt
+acacaattctRVgattctatgtgtatHagatagggacVaattttDtNaWKagtatatHta
+gacgaggtatgtcagtgagHccccaatNataKMBaHtcWgctagtgHaatBatSataDat
+atcacccaagattttcSatKgatWtgaagtcBMataaHaaMaattatgcttWWtttcgVK
+YNBattggtacttcaaMaVNcctcHatcgctVcttKatgtctctBMggacatcaggacSg
+aKttgagtctKVYaaagtaaSgaaaHaWactgRattaaBttVaHtggattagRWtaaDaa
+atgatttSMBWMaDactScgRYtgaVagNctgtSBataKacStHRatctVgBKaggccaR
+ctaacttcYKtcaDcttgaaacBBataatacYMgWgctgtacttttatgaSaaatYcccg
+attattRStccaaaBagaacaaaVtttgcttatagaaacacScccSaNtaaaaBgtaagg
+cDgtSttRatMYSWatcgtaacgtStBagttaVaaaScccSggaMDBSgcaaKaggatat
+acgtatgcWactccgVctNttMaYtaaatKaaatgKStaaaHaKatatgBtcctatgtVa
+BggaatBcgcaatgagtatHcYagctDgtWaaccagtatWWtaRtKagatagtgKatatg
+aaaggcaWgtNKaaagataWaatHaaaaaKMaaatttBtatHtctNactKtBVVagtatc
+acgtMgtgttaKtaatcgaaMHtYKNcMaatgcaSaaDBaaaaagaWaDtWMgaacattt
+DcatttaBaBtDttaaSMtcagcttttRWWaataattcNctactWaatNaBaattaagaa
+acttYRHaccatatKtaKcNVgttYagttBtaaaaVtctcgVctagctcgSVatatagVt
+McaaHRctaHStttNtcattRaatgtaRtgttaatYtaagcattgaatttaKtctaKKga
+aggtcgMctttcWaagcgWaKcttcYttgtgaRaagMtDatgWgYaataKaatSWScatK
+BtYgtaagagaVcacgctHStaacaSgBtgtaNRYaaWtWcKgaccDtgaWtgagMaYgV
+VgBaRacYtcKgatcagttgtaKcgttgagNaStctggaatVtactaSNtaaagtaatca
+attaaVaaDattHDBaHKDHctVggcaaacccKMaatVtgttacBcctStgBgMtScgaa
+HcatgctMtStaVttttcDaNagtDVaatYcggaDaYtaactaNgtccaattSacaaaaR
+gtagaaKgtcRSNtgatBacccttMtactatKgtaaRMagataMatgVtVKagaRagtca
+gMgMaatRHNttagaagaatgggaatcHtttttSgtNgYatgtgcYtaatgDctMaaaMc
+cVScgcRgKNaaagtaMtacaKaMNaBatagBttttcttttYatataNaWcagatttgMt
+gaaacaBYtHaaatgtaDactatttNatttKttSattgBatSRtgKHttacgattgcggt
+aaaaacHHtaNgMcgHaVDtgtagaagatBaaagDttaacSatttaatttaccagatata
+attggVgaRctRtcgccVatRNtDgcagBcVaHtBaatDttatgKRKagataaRgcagta
+KgagttatatcaMSagttccRcttaaatgatcttataaacaaatttcccttaBaWtagta
+gttMaacMaKaaaagHatYKactttRatgtctcgattBcSagaDKtttHtBaccttNttV
+ttVVtggttacgtaaBMRgatcgtctacaaNBtaVggttYaaggattccaNgRgtagBtg
+taBacaagtataaatBaaatKRtaMtKHgatcgYggDSgKRaSttHStcatgtatatWac
+acRacHcatYtttaacYatatgtgttNtgcSagDHgataYttNattatcVattcaaYttg
+gtaRHtWtcgaBacgtttaBaccaBaatgtcgcNagaNtKtaDtgDtatgDaBtcKgtBg
+atacNaccDDatttYtKggMtYNtaactgVacattaaHgMttatcgtHMNtataBtKSgc
+caVttaBcttattcBaagtgaWtaRtcctDVRatgaattgatatgaWgccacDaatKaHt
+ttacatNttaWNWgtacaggctacttBaYaaatatacaaaatttcgNHgMgttHctcKYc
+ttgMtaacBaDVtaatttacagaRttttttagcKagtKactatMRtgtDtaattccRcaa
+KSttagttttBtctatagaKaVttttgcNagtKVccttagRgWaNaKWttataDgcgaat
+gMKatgatRcYtctgVagaccgcgVgactagaWaaHNtcRNRKaatactcYaNtSDKtcV
+VggNgDagtttaaKRgttaDcgtNNgtcaYttggtttYtatgtaaaggattttagatatt
+KMcatgYaaatcaVactcagagtRYtgtaactatagtBaDtVaWatDatctataaaSggg
+tactaYaKKWagaaaaataaattatagRcaaaVataVagatatgtaggcWagacRWattc
+tgacgcDtaBcYattgtaDggMatgagcgagaggctaaatVtctcagRagDtSgKNcgtV
+cStacatttagNtgatSNgatcYVtHattHtBgMacRaattaHBacRcNaaccctVaaYa
+attcVccatacKcttSagtctgKMNagRaNcatNgcgHattStSKYRggtcagtcaccat
+tttagtMaccctggVattHaatVagaaMaattaVacatacacaaattaattacgtKtaga
+aaMgatWgWccatYtagacKatctKatMcggYcgcatgHRtcStVtaatHgSaaaVagtg
+aatgtgYtattaYcRagatgatcataacacSgaYaactMKttatRcgaataaMSatacNg
+aMatttcggccacgaYYMcaKattRagDtRtatMVBtaattWtMHgNaWDgStaaSNggS
+tcBcVYtaYagaHtacagttccMcgtYtYttcattgSWcttagttcgtHtgVRYgaMact
+tBtatcaactaaaaVtDgataaDgtatcatYDttaStgccBacctaaBagttgRtaSBta
+aaagWgcacBggttagcMaYatttBgtaggtRBaSagttcacgtaDaYaaaacDSaKatt
+ctgtSatatgtatggVBcctctgtgaaHDKgttaRttttBMHgRMgHagtagMgacgaag
+ttaatattgRtHtHttatYaaagcagatgtgattagtggcactactVattagatctctgt
+ttatcattYttgatHcHttagStgatgactctDaaatcagtgttgtttttcYaaagtata
+tcYcaSaacaVttcgWtatKaaaHWtRgtttaKacttctgaaNaYacctNtcStatttaa
+agttKgtgatcctBcaBtctttaaaKagttgDtWctDtgtgctataKagtaNHatctagY
+gatcMgtggYaagactgacacttaRaaccHgttcaYtagWtggtgBcStacaMcMHataa
+aNagatactccaggagttaatcatRttttgaKNgSgcaggtgttRaYcaaataBtaDtat
+HgBtatacKaataKtaggaaatatgcataaHgaKttttatMaaaNgMatYattgaatNta
+tVaggtKctttHattcatttatYtattagtataYtttagYcattagaaataHtaacctta
+ctcatYttHMRagttctDagNSVgcgVaNNattctVcaaVagaatttaagaggttttacR
+agtagtaaaBaBaaMtaScKgVaRcNtctgtataagtatVgtDgHaYttcHYttaagatR
+gtgaattctYaaaattRtcWtacDDaRatcaKtaSacaagctaNttRYagMSDKtWgWaY
+NgaaaatatNtaatatHMtMWRaRacaaaatgctgctacNKaKtagttgVatDaVccatS
+DtgaSggcgWatccBgaaVtgtaWttagatVaBWtacgWtaYattaaatMctDgDaaKat
+ttgaaatgctWctttaHtggHaBBSRVBWtgattgagatccNcaaaHttccgVcttaDHt
+NgtttaMggccVWaagattgKcaacgagtatgtccctctcttaccDtHcttcctBatcSt
+VaactaatctacatgtacataacDgcgaVttataagcaaRWataattcggtMaaBccYgR
+ctagatctNtBaggacMaaaNgctgttHgScgttaaVgattVDtaaNaccggatatHatK
+cgataRtaMcagctattcaagagaatHcYRNgNgcaWtgagYtacttNtaagStaVVagc
+tgcaaggHatgtcaWgaattKttgtcgaBcKatKKtDtRtNYNtctactatgcgatgtaa
+cDtcaYgaactSHctDataKtcaagtccVRtWaaKMRtagKttaatagtggKttYtaKtV
+ataWYgHBatataatcatNMRtDYaYcttgttHagRtYacgaDaaMMtcagattBVScat
+tYcaataataBWaBatgDtBaKaHacagtBggaVtgtgttRtgacataaagtBtaVgtta
+NaatcaSgcctgtcBBaVttctHgVttcttgttatccaatacaNtgcgctatacctcatH
+tNaBMtgtagaDtKagtHatacctHgtgaDVWtatcWgtatScattactSgatcWatatD
+ataRSgctHaaWataataYacgtacgtgDatHcgtaacSaaagYaMataYaactggaagt
+KgattKMaatStRgtatVgttcttKSMtcataVtttaDtgttatattagWtatNaDcttg
+ccHaMDttStgtctgagtRtatRSMWttaStcatattaNaDtcaatttaVatgMtcaatt
+agMYWaRcNtDttcaaagMgagaVHtatYaacggttScaaccVKHaaatacWagaataac
+cMatWgctDtatttgaatBtNttgaaBgagaaWcttggatcRctctaDagWBcacaatMS
+tBcBWtatggtagtgaagaMKatacttaYHtNctgttHSMaWttacaSaatgtattttgg
+ccatatSatcgctctttgaRRVVtDaatcSYHcSDNacattcMDaNVagatctSctBcat
+agtggHagaVtgtSactctSHaMaWtgtatcattWtacgaaHatatBaaSaYacagtaaa
+agtVacatKtatatataVtagcgWccacagctcaaccttRtatNactMtcattaaatttN
+aaggctgYctctacatcaVgcMHaagaBttcgYDaSRtHgaaaNcaWYBggataatBact
+gaataYgcgtaacccactHataagaaWgcgRacccagagaVtataggcttNtaaaaHata
+catttttYYatHattgaatgtNcttatNaVcaaRtKctcgaaWctDttttataaatgata
+gcgSttcVtgatataaataataBgaatgaRacgagtaRctttaactattNagtcagtgtg
+aSgaHRacgVtggRccatttatgtMtattaNatgttaaatRaBRttcatcttaRBtNtaN
+SWgtVSgcNacBtWaDgaaNBMgagaBMgaHaHagatttctNtWatcaaaaDgtgcaaWa
+ataBattaNtatgDaMaWDataNtctatDagatSWctctggaccatcaBgtatattaaHa
+cHgattcgatgtRtaYattactNtWgaaRgcgDaatactgWcKaMacRSaSaacDgtgSg
+SRaagNtKttattcattaagtctgtctctataaVgctHKttgVtgacgattgRYcatccW
+cMtaBagaHacaaaDaaaRVgcacatgatYaatatttMttaaWBtctcgaNcWDtttcag
+YKattaRtttagHcKaacaBcaggtaacctaHtaMtttaHacctVacctaaagtcacttt
+cWcaatggatSaataHattacaMggtgaaWaacagaaattgttggRggcgattatWtaKt
+ScWKggtttcttgtcMaRgYYacacggagtgccDcDattcaaacHaacttSScaaStMtt
+aYtgtcWaaaaaaaataBataWaatatBNttcgttgtVatgacaHtgtacatHtaatgtK
+catgSatacVRcVctttagNttaatKYgHtRccttDBggHgDtgaatcaagacacWtcgR
+WKaactgRaDNMactactgacaDgVgatcaagNRatacagattSMttaattYtgWctRgt
+taaKMgggaaataagttatgHaScYaattccRMggSagaKKttRggtttgDtcgtcMttt
+tggaDgcVctYcaaataattSctDaccatNataDtaaaWtttagHMSSaagaaBgatYaa
+ggNtagtgctcMaatttWMggtctatttggaKagaggatWcatttgctatcgcccBacac
+ttataagaYtcNcagaNatcaYHgNgaacRgtaDgaNYttcattRtagNDcHNVcgDctg
+gDatDtgNaaaaaHgaYagtRtcaaDcgcaKatcagttattcataaccNaatacacaaYW
+catBaaaacaRttMgtaattctWttMaMtttccgaNcatVtgatcBaRtttgSaactcaK
+YaaNtKDttttRagaMcDYgcaKcataVaaagattcatatWcHtagtagatttctBtcWH
+tctaRgaSttgHatgaHMtNtaactgaaaNWtDctgDcacattMctNgWattatatctSt
+taScctaDaatatDYataaaaatataatNctKaNaatatcSgagttaagtKDttaaStaa
+HtttaatgaRataBtaVcBtcDWWaaDaacacRNtaVggatattatagtBttggcaaKca
+cRNgaaYaaMRaHtatBcaaacNataKacttaMtaacaacgRtaattgggaRcttagtWa
+taactKttDccgaMcacNHKtattStaRcSStDttacggagagtMtaNHatttWRNVgaa
+acattcScatgctaVSttaRaMagatcScaBggtatacgatVttKcVtagtgccgtcDta
+gtRagggcagggRRttKtcgtKDRaaatgatVttDtcatMaNKtNacagMattgttcaac
+KaatYKttaactaatgagattttaBattBctcaaRWgtYtYBatDcattggRtaaHttca
+NagagctcaRatBtaagHtctcttRatagBttHtgatgattgcRcgtgSaagcYaccacB
+WgtaNtctagacgaaSatBNtHMcKagttaaDcHtaDaaDtttccaatMcaSaaacWWgg
+tgDtgtMtcacggcgcWttcBctaaVatggaagNgtaacctagatggYKRVttRtMcgtt
+aagccaHgatHBcgNtctMKDcYtaVttHaaDWcYcKtttttgatatacataggaaaaac
+WgctgttatWHaggatcgtggcataagaaaWtttgatcaagaDatgaWtRtttgMagcBa
+ttcNaatNcKgaatatWBBcttKVHtgcagtagaYRatcggaagaRtattaBNttattaa
+taatatgtttttaagMggggMttctBgtcgaaMctcctaVttRtBattaatattgVDcDt
+ggtgaccBaNttDWaVtaaaaactHcaVtacKMtgaataacggHtaaaatatataYtacB
+cattttSaaSttgatcatccacatatgcYaVcattatcaagacYcMaataagaWWcBata
+BattcBtaKatgtaRgtKgattaSttYaHcgttHcacaatatKatgRMgatgatgRaatt
+ctKNMRtggatNttttagYRtgtgYttaataaDcttHaDcctttgggMtcgcMgNYtcNa
+cttKtttttgYBaHMgcccgggtWttatVttttMtVgaHagDNtccBVaaagtaKttaaa
+cgaYgHagVatMgaacBaSacNaaaBcagaaaatatttaYgaaSccaRacgctgtYcctt
+tStttaacgatVWaatKtaBtaaataVaBVcctgKaatcaggaDYatgVcgctaaacVtc
+HctggttaDggtatRatttttaaatDttaMtMaggtMaattaRcaaggaatVaaaactSR
+ctatttWaDtBataaBaaKattScSVgtatcWaaaBtattVtatttttatYtaatacRKc
+gcgYtccaacVBtagcttYBtgtgttaataataWactatataaVccaNtcaBtttcMaga
+taatgactMBatBctaaRtatataaaaaaRacagtatYgtHgcaDgaHtaaNMMStKtDg
+taaaaactgtaaccBttMaaMDVaaaggaVatcScMRMaBttctSgacKaccKcDgaWat
+tHVtKaNcDaagRSgcgcaRgagtacMKtWaacRtcKKtBYgtagNtatgtttVttatcR
+aWtattcgtttaDccttMVtatgHagaBgtaMWKtcVagaagcaaaaStaaatgagaWtt
+tDttttagNMgVttcWagacDgaMatataaataagtttgcctatRtttNtcttggMtggV
+cgaMaBMgaatDtVaDgttaaacgaagVtttNccaagtgHgtgtcScaataaRYaactgc
+VWtaNRDccSggagttattatgcctMaaNcgtttVgtcaatctaccaDMtaattBaatMt
+KgaDcBggatVtaattRBattgcccatgaNtttMDcKtgcaccttccBccaatctgDgMS
+gaagcactctaWtattgaHgcDaagVRgtaBtaaRtgtYcYttaagataaaHaHataatt
+aattaStcttcgatHWaaRRSHctggttgtccaacaDttcaKggcVcgtSBctBNaRaat
+tcgcatagaMtNattStRSaaattVtMtgttNYaatgtaHaKNSagatcaHctaaaKKgt
+aYatDgaaaBKSacaatacRgDctaSagVcagDgtYMtcatcgttcRatgaatgtcBSKt
+SagcttagKKccgHtBRgttStgtBaaKaMtaaKHBgaVaVattaatNNgcattgagtca
+BaggMgctHtaatatttDatcWatagRatVaaattNttttaaVctYagtRaHttatttaa
+aVtaccgtNattataKSRcgcagMgaaMccagaatatMgtgNtcttNtgattaBgaaaag
+atWtccNtDggaaagaNttttNtttSggtDcaaagagtactccattMatataHcgcHMBt
+gaaKHSYtctaVtaattgtacctctctaaaVtatgKaWaacagttYaMtNgDYtttcYRt
+gYaWaaaacagataaacgtaVatNaaBtBattcctWaaggcacatgWtttaMtVtagata
+tacgataMtttggtVBagatctRatKggttgcYtacSaMStattBgcatttKatKtVgcD
+gcttNaaataatWNtaDStRaacHtacttacataatacaMtYgcggcatYcactttttDt
+caacBtgHttggctttHNtRcgatctcactctcattMtatccgattaggtgggNgagacg
+ttctDtHcaaatacaVaaaHttctcMaNtaattHWaMYgatNacKNNMatcRtNtYMgVt
+ataaaatttaaaBMtaaaatBtaaacttgMataaaagBaaatBVactagaaaHtWtKRHt
+tgaatVattctttgaNgaDDtatcVWtDaataaaVaaatgcaYaaggatgggcttaaRat
+aaacttVDcattcaattgtaBcMtgYtBtcaMKcRNaKRtKcaatttgatWgaMagtWtg
+YVaRcagattacaWttgaataaaaWgHaagacggYccctBtWttttYVtttggatKBtVa
+gHBgtaatgttcgaggaWtDtgatattaMaagttcattMtttWcgtNgcgaRcaactaMg
+aVHctctgcgagKRatWtggtcgtWaaaBctcScVcaHatattNcactttccBtDaaNtY
+ggaattRtcggctaggNVgDcgaacttMatNagaagtaaRaaRttggtaVSaagaattat
+tcaatNttWcaWtaggattScaStgattBagVBttaNcNaSagttagtcttDccctatBa
+tHaRRttaacBYKKtattHVcHagStaSaatNDDatcSaVgtgMttaHttgttaataatc
+aYtDcatttHNaRgWtgtaYcaaBaagaatYaagaccKggRattttaNcgacStttaatK
+cVtcYtttcggcaaaSYacaKattgSatHtWtKVcagatccccStaatRMaatgtaatKt
+cDgNaYaaBttccRaaacttHtaRcaaagtatgtctaaBDVcKSKVatSagtggttaatc
+ttaVNaagRtctgRataKgcaagactSKattaBatNttggttDtgcDataKaKgKacaWH
+gttScVaagaWtcatHagcgattcBBtcWaactBatgacBRctgatDcMaaVDattWaaK
+tRcctYVYacggaaagVNBaaaaaattKYaKcMatgagcatStaBtcctgaHgtttacHa
+cgcttatgNHWatgctWWattttgYaaacctaacYcataVtagVagtVtNgaMagtcgtt
+atcYtaagcatgKgaaagNSattKtttaaggacaBNRatttacatttHctaaaHactNcN
+caaaYBcacggctcaaHagaaSaagcaWtcaaaDaaBNtNacRgtttBSVtttccttaaD
+gcctgKSttgtcaaacNMcaBtagaWatttVgcRtgaRtMttgccVttatNtatggacaa
+agWgcacNatcaDMaWtcHgaaNaMMtttgcatHtYDcDactttRYtaaatMtaVaaatt
+ggtgtcaacatVctBtHctYNacaaactcaMaaaMcHgtaactHaaWattKttactYata
+agaYgcttattaWMDgStMKKatatDataNHMaSagBaaaVtYtgVtaNtataDRcBtag
+ttcgVKagggatacaaSRaataaatagtaataKatMattVaSatSBtagVaYccaaaYac
+aKSactctaaHctaaaSaaagNttgactaSacDtttcattVctccagYtcNcagtWatac
+attNgttagagNctaYaYNttKgttttatKacMgRatgaaacVccgtcaKaatHHcacRt
+gtgDtccatHaaaRtNgcaSagtStgWKtttgBtHtSagaaacgtaSaatctacWaaatt
+agagaDaWgtataMtgataaDaaaaaaaagttcBggaHaDWWcYctYtcatctttcaBtc
+tBaattattagcatgWcacgcaaaaDaactRVccBtaWaatYcVVcacMatNatacctSg
+tWgtttaattcactaaagcHgaatcHatcaBtgtaWatSScMMgctatctctRaaaWMgt
+taKaatagBtttcttagaggVttcaatRattNtccatttcagctactccacMatSHtaga
+taaaWgaagtttgDcctaagtMaaaYagaaattttVattRacatctgaaccataYtcaaa
+tcaRttaStRgSacctBcaHcgtMcccBaagaaagaDaaattKttNtaataaMgtctYct
+tDgaactaKaacNgcaRccDKtcatgaagtactcgtgttcctBtBtgttatDtctgaact
+ataacagtagStaaaaaatgHaaacaacYgtgtgHacaaattgttcSttBtVctaHaact
+tKtttttWatBtcccttaaVaacaMaagaattcaKaSNatMScRtgaaaDtSStDtHtac
+NtNtaHtMtNMNNcWtgctctaaWttaattaNtttKtBttttttagcttcDagMNagtcK
+WatVMgcttBcgccttttgtBtatatttYtMgctaKaacttgattttatctaatRagttt
+ggKBSatagtaVVcaattMataaSBtDtaBaactgSgtatcaactgHataacaDcaRtcK
+ttatgaatcatacgcgaagNYaNgaaacaattatHMgYgtagatctctWttacatVgcgR
+cMaagttgttDaNtScgStWgtgacaacacggVgcgaSctcactcaaaaYtDatatBtat
+taNgatactctaagtWtKSgYtatataaaaaYagaggttaKagtcYtNtgaagtctBWga
+WtaaBaattStcatgNNtttagMtRDtWttgctYattcVSBaMDcagatVgccatMattt
+atctatcgtBgcScYtaaccaaHcattgcagtcttMNVaactWWKcaaataNaatgHatg
+aatgtMStgccattacHNgVataaYtgaggtKttNBVtYagKacHRggYMacDatcgKta
+tVtWaKgtHatatMgttScgaaVHagaaattaNttaatatgcaaacttWgRagaaRBcNc
+atctaagtggatgVKaaVgNcaccagtatgHKgacaWatYcSacaRaMgttgcttatVca
+aWcVaKaaaKaDtaaaatcgVaccatcgKgtDagBNKNatccgaacgtKgtYctgaKaaS
+KcccKgcVtttKcaaYtagcagatVcctVtgaMYctaccMcgDtgBaRtaaattaaagct
+KtaaatatatVgctgaatatctMatccaattacaSYgcactWttaRacattgtNaYcaac
+tatNNtaHttYcStactctatatcWSaccaVNctBtaaagataNaagtaaaaStBaaVtg
+gttatttagDScttttMMWctagcaactBctcttattSatacSatttRtBataatcaaKV
+SttaaaaacaNattMBcaacagtttcVtttatatttgtaaKBgcacattttHNNaVtWag
+gaDataatNaWtBataattVacWaaattRHtacaSgWtttataDMcttRScttttaaaaM
+gatacMatYccgacKMagVtWcMtBaaatDatatHtttDtaattHaatctaHgcgtaagR
+gWaccattgaStttattctattcVacctccBcgttaNaacagNWtagtaNgtctgaHaac
+BgtatgMcRVatataatKNKaagtttRgtaYcYcaMaaagattKgaaaaKcttgtaBHNa
+WNgMatcacctgcaMggScBaRgMMctaDaaRgctcYtaacgtgtatacttcacDaKtat
+gcaatMtactaHDtaaVcgaagaaaggVaMaatYtttttattttatMggaVYVaaatBaa
+tMgctgWctaagKtctgBtKacaataYtgctBgKgaMtgtgataBagttMaagRcccVtS
+NtaWcgVDctcaSSttKaaaaVaDctacYatctcHHDtgattaaccttttYatattcgaa
+HBagWgYtSgcMtMtagaHactaSgBgBSatHtDttagaacSatcccaYtatttgtgKcg
+DcRatctccNtaagctagBVWaBaaMHacaHctDVaWgtaBtaaStVtDYtatacttgtt
+cttggNYtatWBSNcagatttgBtcVaacVtRgtYaatctatSatagttDatgttgtKag
+tctagKHtcttttaccattcccctaaaaSatttaDgBactaMttctVcaacVgtaSYctt
+gYaaKaggtaWttgaaaYgagataatgccMgSHatHtacaaMatHDttcaagtaMatgta
+agtgtaggtDtacStVaHcaactatgagttatataaBHagggccHagtaaagcRgcttag
+YaaaaaagttaaattatYNtYctagtttaacBataaWactVtRtaatgtHatctagacat
+ttaKagStttgttttaaagtDttMtgMKgcgttaactaVttHcatccgctaaaaDttSMc
+cttNaaccattacaBcHctVcttctYtaaSSctVtRVattaaagtHtaBgttcatacRcc
+tKctHVHgttKtcatctatagNSaacHVatcVgRtgtaaaRatYtcgggtBtgcKacttg
+ataRttDattatcMaggcWWRttccgaHttNtacYtYactgtatWaaWtaaggtacaDac
+aDgttStgcttatctattatgttgStaaDaaattagttRgtgcBgRDtaWaggMaaVttV
+RtcBttatcgttBDgVgatttKgaaaMttatatgattataWctcWMgaHgaattMDatgV
+agtgatatcaNcaaaataSttattttaaatDgtaNDNggaaacgataatttaRaaatata
+aaVaagttacDtgtggttctatRatgcBtaVatVtMtaYtttaaYgaHttgttgagctac
+ttaatatBHtctttaagtcaHaWYtKttacttgtttatagacataMgttgcaBVcttMac
+ttYcHcNaDatNttagatcagaatcttatcatHaNtatcMagYaacacMcaatacaNRat
+DtaHDHtSYgaatcRaBtKttgaMKgcDgtacgtgYatHcggatactDDctaVRgtgctt
+tRtatgtaaaccagtttacVtatttBcatcRaaYgcaMaagaacSctHRtctaWatatac
+gtattKaNagtagatataaWKcgggacgaRWttNacaaaaagaaatgatacDaaaaMata
+KacatVgcgVcgcNacaaHNattaggaacattYtcRYtggtatccBatcaccgacaccag
+aaagMgataacHRgttKctDaggMaKtaaatttScBtcagKBgYtaRKttagttttcBaa
+HYatgattaaDaDVacaagKaaRYattaMaaagVatattKactatcttDacHaDaatBca
+ctattKtKtRHggtaSctaaaaagtttaggBScaatcgMStttaatKacaVBSattaKaa
+agacacaaagtaattWactttacWaaBgYtMcMccagRtacaatatcttatBacgNagaR
+tctHgaKtMgaattcKYaaMacgcaatctcNgYgtYRaHagYtcVgaagaacacKgaRaa
+cgBtttagDcgaWgaYtKataaDcaBatttccgaaaacaRRBaVtRtgHacttHgagtMt
+tWattMtBtgDaNtgKtaaKDccKgctaMRtaNacattacWcttacBacgRtRttaYggc
+KNattagtgactttcKHNcWBYagttgataaYagaWaSMttgataatctataatRtggaK
+tcactWaataatYgtgcHgYKttaaaacNcaSatgcggacaBaRattttcgacctHtaKY
+gttaaactataRaaSactKatSggatgtKYtatctYggcMtactatgtgaWtttctgYDt
+tggtBtcHBctactacBcVacaagtgaatSttcHttttttatRYYaccagatctgatgac
+gcccVataagMaggWgYtatctgtgtatcWttRttcattattgYcHtgatcVatcttVSa
+taactgtgcgtgtgaRWaacgatSgaNaVKaaaaMttccNtWgtVaatNtHgttgatVct
+tatcaaDaRScagDtaKtatttYaSctttctcatccttaattagttaaatactgctgNct
+tgctcatatatactaDtagctagRcataBcgccRaacaagcacaagtaHYaaatgttaaR
+gacNgccgctcKtacataBtWtaaaDagagactacaccacggaagcStHgggtcatDcKc
+aacctctgDVRaYaatattWttattcttataatWatattaccYaagWtgaataatgattt
+gtatBYSaDctatRattgaatDgWtMacggtattttRgtaagtgWtRtagtSctVtaRgt
+tScRcattacYYatattaRaaggaataagRtttBHaggtattacBHMcacKaDDagtatM
+aaSMacaSggtVVgacctgttaaHagtactaaatYtSSBgaKatcMVHcDtatgtagaVg
+tWtMcttctYRtgctRtgaacatDctcRaggatRaaVWtgHtaMgaattaHataStgaKR
+aVacataDtgDRagBHttgNcNaRDcaaSagStDgaStattBtBNHRHacaYaatcagca
+tacDtattWctgcMattaMaaWgKttgRKgcacNYtcatcaaKtctaNtgacatMatMgY
+agNtaRWtgaaatBattctaStYgttcSYatcctMagtgatgcgtattKHKtNtcattca
+catccDaaWattgcacMattattgDcttgaBgccaMNaacattctcaacgaggagctaac
+tagattWaatgtagtcagtYtcKtMVSagWagataaatgtaaVtaSatcccVMttataac
+aVWHNataWtgccggBVYtacRgHatagVtctDttaccaataSaDgcggtttcKaggtaa
+McatgMttaaDacaccagYgtattacWgaDtaBaacctatgaWagacaYttcRHDgDgaa
+MtcagRtaattDtaagKtYMMacagcaYacgtWtctcaNcaagttttctacVtatagttg
+ttDgDRDtatScgatgcgagggSacttcaNcVaatKtattRtWttaVagtaaMDtMaatt
+HtagtttaSgWctcctggNgatgMataNRcttatataatcVtDBHgtNaRatgctttacH
+tRacgYtYaBBtaScWtttMKcStgRcaSgaagatNVtagctgtatVtaaagttcgWMtg
+tcgtHtcacSgaaWcgttaMcttWDWataVKcaatctattaKgtattcMttattcgtatc
+aaatacaDtcacatatVaatcSgtgDatBtgtagatgtagttataaagtctcatMNgata
+NgtagKcatgaagKcYgcNYtVttYtaHKcattaaMagaataRWacgSactctWgtcgta
+aaKaWagRaBataRSVatccYacttcaggtBVatKtHctatMcttctgtHttcataMgtt
+attcttRtYttagNtVtDatattgcatYBtggKtctatcYctDtagHKBNttYKtcWtRg
+taDatgaaStgtaMagcBgaaagtSctRNaHcDgtttcYaacBcagaMttatRaVacgtt
+KaaaacMttaWSgWcNRcaVgSaaaBatNcatttatttgYatttDgtcaatgagaYNatt
+ggagcDagagatacNtaacaWtBHgtatNtaggctaggcaacYBtatWctgaRttDatcg
+ttKtaNtgaaaHaYtcgattgtgccaagagKatcgatatttcaDHMMttVagaKRtaKtD
+acYgtcBtaDMacagatHcttcagactcgtagaMggtKSctagKtaBYMggtagcStgNg
+aacaatSgattaaKWNaaYggaaaacgMaaattgatagagaMtacacNacacSgagcYVa
+attHgatDWatBtaattaaYttgDaacgctcRatatacVtcaMgcBtaagattgcgNtaH
+DgtcaaaDcYMRtgcataVgtaatcaagaRccctYWccaacttagaagaaNgccHWaaaa
+cacaMgatScgatgDtWaaVtatacatggtgRNattattcaatctBcttatDaMcaaHtt
+atacaaNcttgtttagSSatgatacccKttaMtcatWgaVataatatgYYtcaHaacact
+WHatttVYatatgDactaaggcgcaKcatHaccMtccHcaatgtWtctttatgWDatctg
+WaagHVtDggaagagtYHttBgaDKMctMHccDaattMatcaaBtBcagatBcatataga
+tttatDtNatcaaaatctgaaSNaagatagtVBtagctaBVNtStWBgctagtYgatHNa
+tatgcWacWtaYtctatatgaatactcattagatcgHgaRattaatDtNcaaDgactSat
+actgNataBYaHKaKaactctcHcKHRagDttgtYgtaattaactagctatatataaKca
+ttttgcKtcaacSttgHRaagacNaBtatacataaaaataVWHMcaYcagcagRaagagt
+tBttaaMtgatacSDaNtttgaagRtattaHtttagtatYaaatcaccgaYaatattWBt
+ttataactMYactaaactaaatttcNcVatgcVgKVatatattaaatccggaaNaacaca
+SatgcttgcHccacatgatNtatgKaNtgctggagtctataHcRRScSagcactcaatat
+aggaaYaataaagtKKaaaKtBttYRtgtcNVVaaaaaatatagaNaSgattDtgacgtc
+tMatcaaatggtSaYtttaatcttaagcKataaMDaMctgtYcDtgaattRctgHaatgt
+tggtcttcaataWacaaYaNtacHNtVWagcHWtBBYagSagcaaatcKgataaSgDHat
+aaacattKBttWagtRtcNagHcttaatBccgaaatVacggStctaKaRaVtgcaHBcgK
+VcattttHgctttgtgacgaBttttccatccMatRcaVataattKattaaaagDatVtta
+SRMggtacttKHaacaatgagRaWcgDtaggcataBaVgttNBcgtagSttgccYtacWc
+gagNaatttgctagagacatacaaggataacWRtcDaacSDStcaRtcDcaaaHgtatca
+DRtgcagtDtacBtatDMagtatcctagtgcDaSaaRtcaRactHgaaatccaRtWgaac
+ttattaataScaDaatYaaaWaRNcagtaaaYcaHttBctaattctNggBYBtggaacaD
+aatKgcagataHtgtcKaWctaVtNWYBgttttgtHScaBctRccataataMaaacatga
+atatNatgagtWgatggattgaNttataHcSKttgtatcatBtDtaWatcaWaDNgtagc
+taaaWttBatDgMatgagatctKttaHactataSgattRataYaYatagaatDagtaDaa
+gatcKcYgtgWSgtttttaYKtSatttgYatgYHStattaKcttatNNSataaaacHBta
+KgcataggYtacgtttccaaVtaVaHDcaWRYSBHattattcaaaaBatataaggaBtaa
+caYcgHgaatgcggYHagtactNagaaatttttacgaBcaaBttgagtKtYHaKKgttga
+acgacacgBtWDtSttgNHDMgaaaaattcKcatgataMKttVHVBacataKaatcggWt
+accagMtttcKgScgcaactattVctHScccaacccHDtgttacgttHVaatcVgMtgtt
+catBWBttDaaactattcttaaactaYtRtgtaWataWggacVgtggWtatgtataaaHN
+ctRgRtattaagtcgHgWStttaWDacacatcaHatttVacttagcgtHagagttgttca
+tcatgcaHcgtcKaagaRRacaatNgtYDtatVgYccaYKVttDttBctYcttaWtatgY
+taVttttacVatBaYKSSVaNNccgctgctBtcaagcacaNttctataYMatccWacBcg
+VaaatagWgccRtHMttHgBacttYScaaVtgSgttacBtctBttaRtSMgttaatNaRa
+tgttgtcatVtaaYgVgcVaaYSaNcagcttatNtacgatagtcgaVtaacYVaMttgga
+taaagatStcaNtDttgcBacatattaDWatDatcaatatNttagttMttcaactacaRH
+YtcggaacVHtaggatDggStgSWtVatagctgtttaagBcccgBtgcgtctacYaBata
+ctYMttHttVttaWtSttgKtcttcgtgacctaDtttMYMtaaaaaattcaMgWatBtgW
+WtaScccttaaVVgatagaRtYataatttgKaVHtgcataYtaaaaagStcaRaMaattW
+gcaacaaRaBaataacaMNatagatattatgWtagcgVHcgtcatgaHgtRatcctgtcS
+aaatWgtatcHBcatcatcHaattattDBHggcatBtgttagNDggtcRttaataVtctt
+tStaaggtcccBtccaBgBRgaDaatttgtttgcNtatBgaaaggcgNttatMtggtBgM
+gatactDtcatMaaWctatttaaaacYNgtSgMatBcSactaKYaDVaVtcagaaaStag
+ttYRcaaKacaHaacagctNcatttKtttaaacWtMNaatttattaaVgaMStMcagcta
+WgaSccatNatgMacataWaaMtataggcgtatcctagHatttttVaattttSBttScgt
+BSatgaHcaacgaVtMaaaactKHatatttNWtttataWtaatVttKaKMggatcMaaat
+tattMgatttgtatRtaVgaaDtacacRtaaaaaMttScaggRttgtcttSatYWtVMac
+tagatVaMaaaDtaattttaBWcataaggaatBtRgtctaWDtagWtaaWYSaHaaacga
+tRcttgcatcattaSDBBKttttctaYSaactcgYacatttBaattKaaaccaMStaHat
+HtatgtctKcWataactctcVNYtttMttaDatSacDKcacaaHgaggaaBtgNaaaHta
+ttgtRcgacDtYtctttMttatcDaNgattagtttYtaattBMtaggtacatgtYBNttc
+MacaagaaaaaKgaaatcacaNttgtttttagDBcMgtaNacSatcWBWtataVatYagt
+ttccatatHtttDtcgtggBggcKacaBWtBcaattgMatcttaVaacVYgMgttDcaaa
+ctctctcgcHaSatYVHRaaatccMMtaDHtaaKccactgattatccatBYVDacgttMc
+taaVtatacaatBgaagttaattttgatatgcatKgaYttHtatggaaaatcaDtttBta
+tgccacattactcaaagctctcBKcaagcaatataNtattcVtcataacMHgtattaaDt
+ctNaNttYWcWtaVatatataWgtaWtgaHtattcgagtMVaHDHtatgcttctaaWYaa
+tttaatccaMactKtcgtDaDVWttaccVtacYBgDattKtHKSVStgMtBgcgtDRSat
+ggatatDKacataWtatWaVttctSRWgtcaWattKaaYWtYaHctataKacMaagtctR
+ttaatcgtgaHaggYWtcgatKttKaccttacttccgtttHcgtKtcttaatSBgaattt
+cVKaMattVSgDDcaattcagtcataccBccgtgaVtaggttYgaNagYcHatMYaattD
+gtttaaMagRactHattgatttaaSKtSccggBattatatKDacaacBgVWBaaacaaga
+ttgtcDtcttBgcattatcaaaacagNtaaDgtggVaacYDgtttDtggKccttaaaWca
+cgSatacaggtagVgatacctBttcaattKRtctaMgSattgtacctatataaaMgVtct
+YMYYcacttRaBgDctRtttaRHgcRSMVaaaaacagaYaagtaMatDaatttaggcctN
+aacgaaaatgNtttaBtMtScVtVtSacStaBggtggtKtRcatagHattcctggaRtaa
+KaBKtagttgaattgtatttMcatgcttDaWYtaVtNDgatKtHaaattaattaaStaag
+WaaBtNcaccaatRcacttgttttcaaattctggcccttttBgHccatcgaWctataStt
+BgataacagtacggcccDcScaactgattttaSWYtaaaMaVatttagctaBgSaggtNa
+BRgStDaatDBtatcHgDtRtgMtStWaYaggtaYatBtaWaattgaaYattcBVtaVSa
+ctWaWgtKaatagaaatgNttHtgtcaatMattcggtcaDcVttgataMNttYVgSSYMW
+aVtgcaRaaccYtgccattaaHVgaaaattMtaSgtaYaggctataBtcRtttaaBtcHD
+atDgtaaVttgcagNcatWggNtgRMaDcYgYttacWNtgcaWtaaVaNctVacaaccRc
+acttgMttgtRMtgtccatttgKagttctVagcttccaccaNgtgcatRgtSBaacggaa
+ttttttNagtDcagaHaaaatStcaMtctagcacactHWtNtgctcgtNaWatataKcMc
+WtagaggDaVatttaatttYSDgRccWattHtaggctaccDMctacVaattBYtDacaYc
+tWaHaaHttcggaMKaacSagtattaaatDttNaVNtacgVttKaaHtgagttWcKtgta
+DcDaKacgtactctttacatSgtagtaHHtgaaatRtttagttMctacKgaKaatBttat
+aKWMcggtttatgtgtgaStaagaaRttaVtgttBaHgNtggaRaWataacaWtRWacaa
+ctcgHWttttaDagScKgtgSagtcMgaRgttacccaaaKRaaatattcKatttNgtMaV
+cataccaKgaWgHBWagctaagttatcDaRVVtggaaHSVacggttaHaWWagtSgctct
+VattKctKtMatHWcgccttaYtagtaKDaVcHtctgHagatcaSacaatKtatgatagD
+gtcgttttgatVtatStctYaYNtgtgKaKaVcVNgaattWccgattcttgaMaRattRg
+caatHctcattaBaaMtattNSSttHcagRKRaaccaYacMDtaYaaaatttRataBVtc
+acaagKtatgcctcatcgtgWataagcgtatcDtNagcatNNatgttcRaaScagaaaRa
+ataMtacMSctKtDgaBactaggtWgcRtaWcaYtgtgWaagDKattttttaaccaaatD
+HattgacSttttatWaataatDaDaaaaRtaYaggagcYatacYaKaagaaNtaaaYtaV
+tDtBaaDcgtttKMtggcagtVatgccggtHgtgtaVaacDBaattacaNatttMgaDgc
+aDtttggaaMgtYtDtSgccaaaaYcNgaacDVgcattaNgatgaaDaBBttgccatttR
+tctaatgtHNtaaatBtaMaVattcctggaaaaatMattgtagRDacaaacgaataWSBc
+tctYVcgtSaMStgtttSatNagaacaRcagtatgaNBtcKgBttRtattVtaBtBaKac
+taWaMgRtcMtaDtYtatHattScggacMtaggcataaWaKHaataaagYcgWatatStB
+attKaKagKttacMaRacaSaRaaWtKaatagSatcgaaaKaaVcDttcVcgaKVattgg
+aYgtMataaacRtaDaactNatYcagtDgttagacBataRYRDgttcttttattacBcHa
+tgaRacMaactcatVVtttaaaHgctgttcaattaVaHtDcaYKacgKtcNtttgctttg
+HWcaaSactWKSatcgYaNVaattacRcatVNgtagatgcatYatVaaYWaSactgatcc
+atatNMaNagNtaatcgttaSttattWattaggagaatcNaaccaaaWatRaatHMaatt
+aNWatRaMKaWctWtDataaagHctMctttRSttaacgaSWcatcaVgatataattgtWM
+agKKaBBgatatctcgHSaaNBctgVtaStagtttgaggSgagcKttaaatHattDtaaa
+ttgaacatactaaWaBYtKttacWtaaVNcWacgttctcctaactBaaSRagaaatgttK
+VgtHacatctcaScaataNgaaVagaaHttaKgHgKaccgtcYtcctBccataagaSaca
+taaaggtttDtVStaVBgtcgNatgtgaVctatWaaDccWHcctttaatcWactaatact
+cttacttgttcttatttatcaaagatWacYctacKtaSaaaStgtWaVcaYaRctgggtS
+aaaWtgctgcHtttgMcgatSaagttgttttNattgaacttaaKaYcSBSacWattaata
+KDattKaHtgaaattKKttttgacDtDtattttDBDDcMgcatagaVNttaWtgaDttgt
+tttttttgacattatagBDacgatNatMBcaggtacaatgtgctttatatttRgBcctVt
+YVctgcatgtgatataatHagtttccttHatagtaMMaaWggBataaKtttgataaagcK
+gtVtaaaatgtatWWaataaHgatttYtcWataataacagaacDRWDgWaWaaaggattB
+cRctacYtagctNgtScagMcccHaBaYgtgctgtSDtHacKtNgtgacaaaacccMcac
+aKctcactaaaaaNgtagWtttYtgaDcatWctataVctNttKgRtatataYaaaRacag
+gttatagtcRgDgcaYctattNcaNtVatYattKgaaggBDtttacttHttNtgcatRat
+gaMHtRBtaagatMcacatBatgtStctagacttccKaRgaWccRataVtggaScgattt
+DMaaatNNtcYaYtaDaatctatgaVtctBKtgccYgtWatDcMYtaaRtcVgcttttDt
+MtRagtactHccRBWatatccttatMtNatgttagagBcttKacaaMtagaaattaDtta
+atatgaaaRattNcHSgaaHtaDcagctYacgccagcMtaaMgDaaaaaggatcttcaaV
+NatRcKVaaHRBctgcattatMaWaNaKataaatatgWaaatcgMaaaatcctgttactD
+tDagaccYWacttctRatgataaKtaaatcaMttttcaaRtScaWgatMactMtcaBNat
+aaaBactggtWHtYaattaWacattgaaVtYtSgMcatgaatYgattatacaYttaaaKR
+gaVagNgtaHWaattcgDaRaaacgVtBDtStttRaKgVagatatWtcMKaaaaMDattt
+aaYcataDYagtaaaaKttVWMggctgVgtgagtKagtgtBBNctacaaacttagattSt
+tHagacKVttgHttatSataaWtMHttSaSaaaaDatgBtaYaaaggttaMttgVtVttt
+ctaattgaacaggtttDDVMtNSgcatataagDaNttatSVttMScNaaattDttYaaHc
+NgttatatBatgDKctttgVVaaBgataaBatRaagactBYgMgNaBttaaattagattt
+ttttaVgttaYtatVtccgtaagDcNVcaWtgcaKgggYtgagattaMaaagaatagtga
+BaVcacBNtagtaDctctcVtaSctgtagcBcHMWtataattDtaactttHctaRcRaaB
+aYacatttcVRaatctgctattDSNDgBatcaaatgcaBccKctaHcBtctVtaaHgatc
+RgaacggctRtaagtaSatatgatcaaagBtaagatttVaMagaagaWWgcMWBRStRgg
+tttWttttagtccaMRMaaattaSgBccggNataagtgctctttacYataRtcattgtgY
+BtggcatRtacttBaacDacaKtHDtaNacMtataaKKtgtaaaRMVtctVcRatcgatt
+tgcattSaaaggttRatagtagaattVcNgRtKccBgBtWcataataKctctKatttttg
+VcaacKStcacSRtattgcggtcctcHatcgaaDgaVgctagtMNVtaattaaatattMY
+NcgattaaKtMttRtYgacttgttagggcDNgagNtKBaScagttctgcMaaaMtHctRa
+YtcgRtHatVctttatcttggtYctctYgttgattttaacSttaaactaaaWHattgWtc
+tactatttcgMcVaaMctaKRcttcRaatSgctVNgtgaaaNcagataatcaatcKtagt
+gacaaBVtttgtaaVctaBatgtaagtgtacctttacKtMWtaaaatWtcVctgagataa
+ttacggaatacgSaWgaHcagtagNWaaaSacggaaatgatRBtRctVctgtVaatataV
+NactMgDtaatggtatctacaaatgtatacKtttgttttaaacgttgBggBtgacttWac
+gaMtttcagaacagaaRVtttKBacttDWaccagtaaatatcgMcttatRtaaKKcgMtH
+KattWYYgttgatgttaRgacHcattcttKtcgtttaatagagWgDKaYatKataKcDgc
+taaaHWgRtagccgttcatYattcagSHtttattataBVccaNMHttacgWttgDgaaRt
+RaatcgatNaaNtWVcctacatacYtctgKtcattatctattatcgtcKtaataaattag
+ggHctcatgHttSNacctYaKttMHtctttSgacgtttgMcStgttcaaSBggataggWt
+tataNagaNBcatcaagtBtagcMagtcagagaaDcaaaataKgtatgtgSaagtgtYDt
+DccVaaacagaagttaHSWatagaaaMYaggtacttctccttatatHatgctgVMatKtt
+gaNtggSaRcattggttgWcatYagtaatatttgcttgaVctaataMRttttScggggtg
+agVcacatYBggtccatMattBaatgNataDatWtDttVcataacSVtattagaagtaDt
+atcBacNaacaaBaaagaaWBHSttgattttKRcVataHatttttgaBtcctctacctcR
+YttagcatactttagaMHgtcatgtHtatctaaYacacggtaaMtatgttaagaHWaRca
+aBaacaVaKattHgataNatatacgtatttaDWctagatataaNtaccgaacaDMttDSa
+SYaaYgYaVtcatactaaWWtatataaVtMcagMccaDaaSatBattagcaaaatgRtaH
+RgccgataatagcaaacacWacagaaVgBcagaYctHctgtcttaccBattVaYtttHat
+gaVgttcRgaHtttagttttataatRWggattYatatMaaaactWaDRaggataaWgMat
+aggtactatatttVctataattaaatatgtgttDtcctaKataaaaacggtacgtKaaat
+ccBKtgtaattacaKtKYtgStRaagaaaaaaaggYagtNactttaaNaStcNtBcBaaa
+cHtacaatSgattYttaacDacaHtcttcatttgSYgtctRaatVagcaWtctcDcRctN
+HatScRtaMgaacWaaYatcaHaaagttggagtacaNcSRttagaatcatVgtgaccaaY
+acWHHtaMtHtctaatttcactBtgNVggBgttctaDtcttaWttaatcatatHgaDaca
+tgaaNagtaatacgDgHttaNggatDaggactcaatttcttDaNtRagttgVgaVRacWN
+VHBttcVtYYtagataagHtccattcaatNaataYtNctgatcRttgaYaaaBcaKatca
+cgSaataHatggtacacctttatRcgtaYacgataHWVKaattVtKcgatcgtRtatagR
+gccBtaatagctcVNtttatgRtggggtttcttatactaatcMaaaWcgcaatKttattt
+gtttatHRRacaVcSgatcagcaacccaMatYacBVccNcRgagatctgtSgaMttHgta
+attatggRatgcWtcKatattMKWtaaatctccgtgtcaHNYaagStKcaDaMtaaaWBt
+tacBgNctMaatDttcttgatMagtagaaatYHKaacttattSgttNaKagttctcataa
+gtaatgactgaVStaatcctcDagtcataagWtataatattacagScHaatatagcaHYa
+aSagaaaaactYtRYaatcggaaHcVcDcaccctattRaatattNgVaatacagaataaS
+aaaagcWRgaKttccgtaWttctaaWacgatctMHaNWSgVtgNttVgtattStaatNat
+VttacaRWagNgcaSgRVtcYtgtctYgtRKatctStHWttcYagtgNtBaacgtagtgt
+HcgaSggcNgHgWggKatMtaHcgtKaHaWggacRRatattaHaaggaagaSgHggttta
+cctagtaattBaaatSttYgtagBaSKBaaSKgctMMcacagcgtYatSctWctSaatRt
+KKtgatatctMtattagcgagaMctNtBcgtatRDtcatHtgaVcYttctaHacgagDaa
+MNtcttaBgWattatagaKtcWtHaMacagattgtHacttttgDaBWDtcSWKacKttca
+HtSgttttDtHtSaVRYVgcagaatWattYtgNcgccBSttataaNctttcHtccaaDRg
+aataSatgctVDggacagBYtBcRacDtYDNtgWaattattatYKtNcggaKRatcagBa
+ctgatgcctSttttttDtcSgtcaaataataaMVttgaacBagtattctatggYtcaaat
+DWacVtgataYYacSccVcataaagacagtNaatgtactaagtRtattBMKacNacagaa
+WtctSaMgaKataaaMBgtYtaWaaKNtDStSNggaacgtMRtaaHctatacMtatttta
+ccaataKVtcagctttatacgtSWBaStgttgWVtYaacaacRgtSgtacNgatgRtaYc
+agStcaNScaaaRttaDttctcaaBgcScDtWaggtgaacttNBBYaaccaNaactNgct
+aaDaaaggttgagaaMtatacttgtgtctHtgagKacagcacagcgKSattaSDaKaatt
+tagtHtMttaMVctaaBtgBaattttactttaKcMagcatgcDcatcBagaBHattVgWt
+aataMgtttgtDaHaggctgtVattDYacNtNStttaKaNggtBtaKtgHaaKcaacatD
+MtagatgtatMtaaacttccNBgctacgtgcaaKgWSNacttSBaggMtNStaKtcaata
+gattatctagtaBttaggactYtaaaStaaYtgaaaagYtMaagaKctgtVtttcgWcat
+ctacgtatVaagtagaattBcagaDcgSgtaSggaactaRcaBRtMttRgattaattWaB
+YcaataHMacgHactatNctacgaVataNVcHatatVHKKagaaRSattaacgttMattg
+tatagBagtatctttgaagaBctgattattHgRttacDgMgtWtaggcaatNttgcttag
+agaRatttSgtttBtgRtgaNtHcgStatgaaKtgtaBacctgaaWgtKatHDStatctt
+taRaaataacaBttStHVMaccggtaVYaaBttYNKgNaBHaaKcKaaatStBcattgag
+ggcRSttttctaaatcacaRBattccacatagacatSaDtaaaSNtttgtatDgWgcata
+cgaSacRttagNaggaHtttagccttttWDtcYaVtaRtacWggctcaaaacVctWtaca
+tagttaattBBttMacatDtatttaaRggattatBVcacattattaagWctactVcaBgc
+ttKagagttatRBgctagaHtgDgaaaSVtKgattaWtMDWaRccaaWaagtaaVttgWg
+VgacaBtSaacDaaaaKcacaRKaagttgagtNatttaSttaWRgtctaaccataDatag
+YaMgaWBcattaacSttcacDtSttgtaWYataRBHtccagaMctaagaWagSDaactRN
+aaaWagtacaScaSDcaatMaaaaaaaVBcatKacaggtgMaaMtatVaVgcctcDDYgt
+attcaatattaggagtYBaaatttagaaVWDattcgttagHKSgcWtWcaatttaBtaat
+NcaMYgYagatcRRtcataaaYctNtatttKRatRggtYcgaWcgcccataWttVaaBta
+ataaatcgNtctttaggNtatatgNaagtMttccaagactRttgtgattBagBtaataat
+tBStcaatttaWcattaatVtacatgtatttBataVYWStagcaYKDaagYtaggKtgag
+atVtMDtKgNtcatagtNcagtBagagcaNaaNtaRtagatatcYWtSataWggacagag
+tcaDSggYatttDaaatcactKatWatcDatatRattataaatatctattHSctttggNc
+taagtSacgagatatatatRataagtttcatgcSaaKttctHaRgaaDatgStWcataaa
+aatWMNttaaRaVgaYcHaagWggttttaaBtcagacKtaBtggcaacHtaggVttttac
+tatRWaataVcccaRaagattNttggStYaatBRaataVacgaaatttaBaMYgcaMgtK
+StStVtgVaatacccYaDVYaVaYKVtgatgcctacaaagcWgDtVtctaBtcctccacg
+atatWtcDHHaHacaaataaatataccaYRSataVagtttaaStgttgRHtctaDMMaYY
+aaagatacaBWKcagttgcaacgagBagcaaatccgKaRgtgaatcgtaWcatYtWaBta
+BatcgRattcaagtHctctaatcttcctattaaYgaNaaaaRaDtactDtMNagatMttt
+RacKaccWaYtatcagaaKcttVtVaaaatgttgtNYgtHtaDactaggaRttaccVaag
+MacgcKtatataHaMtcaattcctMaRtttttcatgtctcaacatggtgacatcaBatHa
+aMagaatttattaaaactYgMttaKHBccgacttttaVaaVtcScHaNccttacccatat
+aMgggDtactagKgtcacRtacMacYgBaatttcagYcacaaataaaaggagYaaMHtat
+aaaHtKgaaHtctcaVatcgStcatHtcaYctttWcttattBactataatWctcctRKaa
+HtaaHYcttcaYataaaHtNcaSctgattaagaKaatWagRaVaNSHDaactaYVRaatg
+ttatVYttatDcctRtgcgaacStaWttgaYcatYtggtatWNataMtDNRtgtttgggt
+HcWtatHaaataatVtaaWaVgcaatagDatgScgNcagggagtcaDtgagataKtgtct
+ataattgtgaNatcaNatDgtagctaaaNtgtagtcBatgWcagagtgtWtaagWtaKga
+ttHagWRaNatacaagtactYtaWgatataRctcNKcttttgaRtgKWtgtgRagcNtKt
+YtgatatgatBDKVtaaaaatttWtcaatacgRtaactttaaaaMtaMattaVNHRKtta
+ttattaaVaatagatYaggattVaaaRactcaagccccRtagtScgDWgVSagtggtaac
+ataVatttcagtttRtattcttcYaccaaaagttNttKtggBttBcSaWaattataatca
+taBtgtMtMtaaagataYtacgMtWaaacBtttatcKacaaaatattMagtKccaaWcca
+tttgtgacctttMSataMgBtcttaVgtNttttSaactatgaggaSWataRtHtcgaMag
+SMccSaMctcgNtatgtataaVtBatHcHtattaacgactgNKtttaMtVaaaagaatVg
+ttMWcttacacgtacScttcttcWtaatccatactctaacaHHaaaatDctNtgatMcRa
+aWRtMgttgttatRagtaNtatgRtaMttggaaKWttaRtHKMaDDaacatgcgttaaac
+caaaDttatagVRBatacMaatacMaaatWcNcaaHttBgttgtacggRKaaaMtcHgtt
+aattattttaHgKtgttaatDaHatctggtaatMtYaRgMccKRaRKaDaagaggatBtS
+acatactccaKgVaaRMaBttgcataaacYtKgaVDtttgcatSaatattatNattataW
+atWgBttaggtBttaaYataaSHtRtaccaacMttaccattccKggKNtMatacctctgt
+aYctaaccttgagtataaRatagaatRBtttttMtgWNtKtgcttatgactcSaatattg
+tBRBtSWVWYagtaWBcNatttcNNgSKacctgaaMKgatWcYHgRataYggtctaMtgg
+cagaRgaaYaYgKgaaHVtaattMgaaWaWaDataagaaaaBDatacatatgatcNtaga
+gMtactcatgatgtHataaggtaHaWatMgtagcttaWtcStataSttagttttgcaagt
+gctgacDtgctcDtgaSgVMtagttKtaacgtacattaaatctHgatYatttcgggcaDt
+VttcaaacccgDgtatBggcttcBcWtacttgaatBaRNcgYtgtaaaaaRDctKctagt
+aKSatRtRatMaMtaacVYaKtactgRDcaataaatSacagctDaatggttttaaacNtt
+BaattgattaaMgVBKtBaacctYNcaKcaVtDYtcBaaataNSaBgatacccgtVtaat
+actSgtttgMSYtttgKtgtKacgtKatgataaVccaMgtaVaWatttatattgBNtgtV
+gVNtYStMtgtatBcgagaBaVatgatgBcStttgtagDgYMgaattacacHtaaaaaBt
+tKaaggHttctaggKagRNtMBaatWcagMSBaaVtgaatgtgatNaatSagcaatttHc
+tatWMtgVcNtSaNRHatVaVacVtHattcaataatgSKttttttgtataRKYaatccRY
+aatggtaVtttaaaaaWBKtatatttatgtagtcNatSaatatcMDRtgtBttYtatKaa
+ttaaaaYtcWccVattcDaaatgattgtHccactgNgctttBtgagatWDgVgtactgtR
+taaggtBgacctaaatctRtDttaBRaYacaaaYYtcaaagaWaSDttctttggacttcB
+cgaDacHataNtNgWtVMVtRactggaaagSgtgggtgaggcctccataaatNttaYYgt
+cBatattWMaacMRctcgttaaaVatatagagataKatRMtHaVagaaBBtStttaatca
+aatgagtatcaagtRMtaccgtBagaWKtagaaaYttcSScttaVttttcatatcaSgtc
+WNgtttagccaaaVgaatgtgttatgaaYaatgaataaaagagatcttcYacaaatataD
+gRttcMtcataYaBtctStgaatgagDaDgtRNaMtYMatatagWNggaNtcattatgac
+YgtBKYttttagccttataaNRaatggaatccaBacgttacttatMNggaaaMtaaRtct
+agtttttKKKgcBttgccgtHKatcgatVtttacataMtagNaMttctKHNctaaNattt
+WaRNgRatctagatSctaactctDttaagacgcatagcRNgagatttgtacattSattaa
+cttttcgttgattWatKtgaatttaMtSBattKKcttaaSggcactaataaatcactcaM
+gacggtRcaDScNctYtBRYVgttgtttaVtacHWattattcatttVaKtgKaacctagg
+StatttacaactcKNtaaacaagSttcgattatttcaRttVtaVaaacRgDtaatgtccM
+aacNtcggttgcctaattaaaNaWcgKataaYcctSgMcataaatttgaaatttHtagSB
+gKYggcgYaagagataaWBcMgatRBNRaYctgHatctatHttgaHtgcHKBKVaWaaca
+cWNRactWBVttaatttVccaagBSWacaaaatcDgttattBtHaMtMtHacKgWtcctc
+ctttHaatagtYttaagccaHtYatatttacgtcaSgtgtYttgBcatcatttaNRgaKg
+BtgattttaaatgaattVaKtVYgNaatgDaacaaVtHaaatggtttgaYYatgctgcac
+atttttctacVtacaNatataHtgtcVtaacVgtYccgaactaKaaaatcagtttaKNRt
+aaataMatgtacatatcKScctDatDcKttSattttagatgttHtcBtKgNVRagctaRV
+tttaNYWttcWYRatgatMgaMKRctNVMgttVagWcaVStcDgtttctcRatBVggacc
+gaatcMttgagaBDgtNMgKKRBNSMgcaWHYWccNgcacaggVYtMcaaaatgBtaKcg
+aRacccgStattcHttgaYttattattctaVMttgaacDaWtNccDtcHBataNcRggaa
+NBtgaYNtaaMaDctMaaaaaaHaaattcBgtcgHtgcgaaStttctacttcgMagagta
+aaacaDctgcagHctHtWaacgaatgtggtDacgtcacataSaatKtcWBtataccaaSc
+ttNgDgcctacgBaNWtagataBaNtRcSggtaMattgaatgtRHtgHaaNWtgttacca
+tacctBataaMWatttNttVaaRagMataVtgtaccattYVcKYcgagtaaYtttgDaKD
+gVacMtttaVttcYcgtMattctatatataaggaagagttaaatHgtWctatttgaaatH
+ttgScgtBataatgatRWgtttVgatMBcgctttatgtctgWKtaacaaHttaMtcttta
+tcDtccaHaNYtSWcWNtHNacaaatactNggtgStacKatgtgKVctaBcaHcttacca
+aWatHaaYtattatYtttDgtBaKcataaaatcaNgttNYcatVSgtgatatYDMMtgga
+atKMaagcttVtaNNYctKcctagMWtttatttBattNagccggaRgagtattaKatgat
+ctacatcaKVaaagttYgcStagtctacttttcatKtWtKtctRaRDtcggtataMcMDc
+aattNcacattattgaBaHattHgcYattagaattataaBtattBKHtgtaacHtHaaca
+aRYaBttaRVSaagttHVtatMtcacaWctgVtgaatcVtcctcNataacacgWtattDW
+ccatDDYtcgtaHaaKaacaYaHaataBtaaBKagtttcStWataccgNcaDtWNaaRgc
+tcNaacttatttgttaaacaaStttagtgVaKgggtatNaatVagtataVVaHtaRacca
+caRatacNStaacaYDgaWaRtaKttgtaatacggtttgccaaggMWtcaaccttcgcta
+MSaattaatgaaVDagttBcatccattttccaaBggRttgKgccaaaYNcDcaSatMcaa
+ttYDcatcWatStttggaaWtttHtatVaggttDgVWatttaBWMagtcagcgaSaaSgt
+attctacHtaaSaVacaataNKtatagRMagtKYBKggtttKatDacaWaYDaactagca
+DttctctttHtagtMtWtttatYatWNaBgHtaBgSttRgattatgKcccaaBtWcccat
+aaNattaYtRYWgRccNatatHttWgttatactttacBYHaaaKaHYaNttaatagKata
+caaatWSMctttcKacatMattgcaRctBataaVaHtataSctDVtRaacttcggScYct
+ataHRHtgttctgtgattYatatYtcYHaataaataYtMMgttaaatgatcttaaattaK
+RtttaaRtaacttaBtgtcatgtctNcaaKactMtKatagRaDKaatgSaHcRtMDctag
+atcaYtRatMSVRMYKYaggataaatYtDBaDacDtaVtacggaKttattNaggScgWca
+YtaBaaacaWaNVtHVagtBaatgaBNagHaBtaNatNttSgaaactctBaggtHHtgaS
+agYKNcataaMcatagaSttctNBYcttattcatagagagtHWWDtctgMtRHtactggg
+agcKcacctggaYattatttgaaWgtcaVaataagaaNatRgtttacNtWYMBcNScggg
+ataataaagtWYKDYcVWVggtttMcttYaatagaaKaaataDcaYMVcaVtgtStctct
+WaagtaRtaagtaaatWacSKaaatYaScctggtgMKtYMtctacDatctcaMatVtNaa
+taaNtaattgaagaNaataataagcttaagtgtgcgtVgttataYaagVgNaaRctSctg
+WKVaYKgctNWMaaRaHatcgctHaaYMtccggattgtgBacatHaacttggtggDVgtc
+aaaggSatWRaKtKacNVggaatYttatttattcaaSttttttttcaatgttatttgttt
+taBgcatacWKDgtYNtcYtgtcttttttgtcaaatgatacttWagatDatttcacctaa
+aaggtgagttatWgtgHctaatMtRKagccagcgcVgagYagtactgtactttagVctaB
+BaYNggtYtaattttcRtaaagatctMtaVYatctYgNMaVtaWtcattgRtaNataaga
+aaacVSctHNtcNaMaRYcgagttaHcgacNgagagBgtKaactaaatatYRcggatgtK
+tttactgDctcVaYaaSaacBcacatagaaataaaaWDctVcNtttRtcataatNagatV
+MctBgttcHtVgagaNaaaHaaSccggatSctaHgtgaYRagattDcSDtMStNYtgtga
+agcttgggaatttttDgcaatHatgaBttHttaacatBcaaagtaggtKgagacaattaa
+taHcaNaaHataMtccaKagagtttBYSagDDtaNaRtWtWagatSgcSKtcttttcaaR
+gtMattatRtYSHgaMccttttttBtHactaattcaHtMatagaattVtBtDatcttVga
+gtatttaaaattacYSattatttaYtagcaVSHattDctKcVattataagagRaccccWc
+aBtYYtctaaaaYccSgattaaaMDRtHatMaYtHtcgcaaggWgBaNVDatataaatWt
+cMYSVtacBYaaatactcgtacttttWgaacRNaattctHagcYtaSttaaataattttt
+aaSDtKaaMcWgBaagBgaatDagaaatactcctNtgRaattaNWcattgYVMtRtHgBa
+atcaagRcagtStaaWRgtaaatHcaMacDctatNaagtactVHaaVagMgttgKtgtHa
+tcMacatagMgaBtSaaaBtagttaaNaYgStRRctYWYVtttMNBgcctgMctcactta
+gtgtttDagacaYaattagaggKtttacaatMttctttatKagaaNtBtttKSHWSaVtV
+tgttaRSaYccgtaBgggMtKtttctYWttcaVaagctttttMBgDKccatagVactWDg
+tRtKMtgBKaDaVaggtttRaataBgttYtattatgttatgtcMMaatcagaatagHaac
+aattRcBcDatttaYWttagattggttgaMcgtYRgagMtcactaRctcBMaaNgcaStg
+cgNtgagVttaBaaagaatacgcatYMaaatDtacgatatataMtYKatctScatattNg
+StYWgtttaYcttgtagaHaHaYtaRaaagttcMHaStatcatYtttKBtctataaaatc
+aStcatatStattatMtSatcataHcaWaccagHtaaggaHatatgagaaYYgtgVacSt
+tgKaBacSYcaNNccBNtHKtHcctttMttttagtaaaBHBaaattWKgtaaccDataac
+tgatatgtaaRVtaHgaattctcRttcgcatHtaagttYYctaaattttgWDacBtataa
+tttctVaYHtMtagMaHWtagatttcaVgtKaaacctgHagSgtacSWttMaBcHttaat
+cttMaStYatatatattagtttggMaYaatHgaaaHHgatggccctactatSgacaatcV
+McatactBBMtaattaaatattBNDacYtgYattBttHtNcaatgcggacccctDcYcDt
+ttaKaSggtatcaBYaaBttctDSRgacHttagMcggtWgagtcctRatatRcttgattg
+gaaaKggaaaagaaSNtattcNtataatVttgagBaMaaBctWtHatgcDaatHccgMDc
+gcWaaDaacWgaagcaatattactcaaaatMgttgtaaMatatYtctRSctctWcatttV
+atgBNtaaYagNtaMatcSgSgaVttSaccaataccKRNcataaggYcDMWaSKVcccaa
+aggVtHtgHagMaggtKVatVtVMDVatBgttWagcctagagacaaaggtataatttgct
+tgtSaaccttctccttcaatgNaacaBtttaVcaacagWaHMttgttaagttNWaaYcga
+aVtatacBatgagHtSattacBgttYgtNRRcttgatcttaHcaataattattttccttg
+aYgacVgNcttaRattatatctcagWWatNcDgacacgttaatRattaYcKtggtSggWg
+atMcaaDBttgaacNttctcaaHtHaagcgVtDaaDtNMcagaaatWaNtatcttcattS
+gatatgatactattWatSaattWccgtctaatcttgKDacatRatggBttatggKgaagt
+ttcBaKtgttaaaKtcgatagcNgtatVDagaDtaVtcaactttYgaBYcgaYgWgaWta
+aaWatVtctVtgggKaVctcgRtttacMaVaaagaaggtVtKNYtWcYaVtRVccgaatt
+atacttatattagcatcKBattttgVDggcKaHaYttgcggcNaatRactWagWgttcag
+tgWMctaataBHtttgHaggcctgacMcYaRtRtcggcaatBagttaagcDatatatNtt
+gtMcVtaaaHMgattVgaYgtattatatSaDaaaaataWacaaNttKttcatttttHaMa
+gatYtgtttcattaatatVacgcHRttacaYtaagttacaBtcgaagcgttWtatVWRaa
+SacggWaBgSgcttaScatNaHcaatWacaMatagttcagYBagYgVactWtgtStNata
+catYgSYDtaaacSaaatBtttKaKRSWRcRYMgcYgVataSNNtWgVtSaMgBcactaa
+atYaKattVggacaWaaatgHtatHccacStaatagaYaaaVaMaaacYYMctcagaNat
+tatctattaaatatgMaRgggtatgaMcttaHgattgtScgtgtatVatHNgcYttNata
+tBWaaactNVtHScgataaNcBataggtaagagatttMatVtaagtaaatYgctgtttta
+agatagaWaaYcgctaacttaaagaattggtSYgtVaStttRtcKtHaVcWaYaWVSccR
+actDaattgWaBSKtaDgtataaRcttaaaatKcagtNgtaaataaatgattcatgtcKR
+ctatHaYtMacaWNgagatcDcgDtatKaHgaBcaaaNWaRataYtYYacttgcactaaY
+DcKDttWcYataStKcgcaaaaaRaaNtttatttgctYatgtcVctttcBKcgtcttatS
+ttattYMttaatcatattcatSaYtgWaDacgaataactctggaDccattacgSagaaat
+tgatttaDtHacgtcMgaMHaaNDKttgtaMgRNtacataWgttccStgaaatDaagYRt
+DagcatcHttcVNWWataatataaccKaatWtYgcctacVaagttWtHactaRaagatat
+MMtYattMttccatactHgStagHcaattaagacagaMDtttagcHtgccctttattatS
+atWataBaaSMaccVVgtggatgtgttgYgtDHSaaMaKcagaagcWacaaaBagRactK
+acDaDgagagagcgKcaBggtgtaYttatgcDatgaNgatagagtBtNtaWatagcacgc
+gcatDRSacHttcataBtaWaNtgtaatcDctBaSttttaggcWtBacgacaVYtRttaa
+cttatgKcggDStacgtagaYtaagtaatgacggVMKtWagcatatagtcataagMgatV
+agVttSaacHataatatacaatRYaHacaWaaactRtHRaatagcaVtcMataaacatat
+tHaStattDcMWVtYaacYagaaHaaWaccNHcatgtcccgaNttataaNaacatctBta
+DNKgMtcDtgMgtatgKgSatDSgMtgVaaHNWcDcaaKgHMtaRtggcgRgtHtVtatH
+gtMggaRVgtcDgtWaactactgttagaKcccDctcNcgtagtgStacgtataNcgVaHH
+agYttStaaccWacaKctgctttaactagtVatttaaatKttRcgactaHttSaKtcagB
+BaWaacccgRatKagNagKaWtHttttcWtatatttattacagacSBagDgtagtatHtg
+cattgcaMaRgtagatYacactYSBDgctgatcMattStSgattcNttaBWaacatgctt
+SattttctatNttaHNtSctgtcWttKgttgtttttKaMHNMcaacaagNattRtcBacc
+atKgtVtaaDcttgattaaaatHgaataKYtgagMtgcWaWgtRttcDaatgRtDgcNWS
+gtagtatRttDcggatHWgaagtacgcVtcaatHtttttttgaKggaSaStaataWBMtg
+caaatacgWttctagccRtaaaattNWaMggataRRaaHaaMcagaaacacacgDaatct
+actaactDgatgtttaaDacacVaNgagKaBcatataaattcgRtSNaatDttKgKDgca
+aactBDtaatatagWaBgagtgtYaaVatatMtaacaggtataacgKMtaKgcttgNMtR
+aaaaVcHctKctaaBcWtcHtaRaacKgcaDKaYaSHgtatttataaYtcaKatgNacgt
+cWWatgDttRaacaaDWaatDgagaStaVScctgcacaaBtatacttctgtctttcacta
+cWcaaaWcactKattaKtatWagttacttgBtgaBMagaattgtYYttttVatttWtcBa
+gaatcctcWtatYcVttattMgNgYStaBgtttcttWtagcaggtMatgtRaaDtDKttg
+ataDggtttatgctaataVYcSttBtYcatctVtBtYaVagtaaDtgagacctgaaatcN
+KDactgKtacgBtDKgattaaatagattatagactatggacgacgRgaaYKgYaRtgaaa
+agRgBaacatctctMttgacNaWtctVagtStMaactacaatttcVgatacKctaKgcSa
+ctaDaatHgBgtHgYttaagtNYtRcaRgYtBaactaatatDctaacSKatSDMatWtag
+KtttagaaHKattaVactttSgtgtagWctaggagctttgaScatcggSttaggtgHtgY
+atgtctNtaggaaatDttcctgagagaHagttKcttttgcHtcaDgtcgKtatcaatgcg
+StVcatcaWNcgtatttHtatctggaHWSataWaVttgKgtKBaaaggtaMNaatttRDt
+cDattaStctaaatKgtaagtcVgccaHKgtgtcgaSVtaaaaHtatgaaVcatacacVt
+KattaWaKDgttctattgNcaagaacaKYaHttWcDaccattttagacttttMttaRaMt
+aHtacNgccgaaaaacKctNgaaagagggaVttttgtBVcatttatttVaHcgattWttM
+aWcattagtaYcMagaatKaYtcatttagacttStDtcagacattctcYaaKMttcagtS
+NtBtMaHacYWNaactVaMgtcNgMcVcVtgKaaataaVataacaDtaaggtcSgtDatt
+taKtgSNHcgctVaaaatatagacRaBgaNtaattVWaKtgcaattHttctaNRWtaHtt
+taaSgWBctVacaNVcKtaaagHDaaaNagtYcYKaVKtaaatBaaaSaVaMtcSgtaaa
+cctcBYWttSgMaMccagcttRgtVggaaWgagtaggYctRtaaWtgtacaaMNtagtac
+ggVcttKcaMgNaaatgtatgaSgDcSBRgRVcYtaDHgaVtWaaNagDtagggtHagHg
+ctRagaNacacaStaNttMaatgaataaSgagBgagtgWccDtVgagcDWVctBttccaW
+cacgHttgtcYtttacttaatVatgtKtaaatttaNaYttaStMtVaStggattgtVgaM
+RNHtacaaNttRScRtVcgttcScatMtBtttcDtcatVctDaScttagacaaDaaBtaH
+tacRgRgaRNtKataNgcaaScactcWtKggRagtgtaaYtaaattWgNagatatYtHat
+tWtYWatagatatttKatgtcgDagaVcgKVagacagagatVgHWtaagttgcatgaKaa
+tggattaHcaatatgKtMaWtWaYSVtNBDttaaHaMcaRctWScNcggtggYSttcaga
+attattggaaaattVccMtgggWatatHMaYtaMaacaHaagVtgDtggcHtRaagtHaa
+gVMWacaaagggataBRcaaBcttKtHtMgcKaVtaacaRatKRaMaRtMtcagcaataa
+aaVccNcttMtctattaagacacgagatNtatttataaaSagaaatatSccaRHKatYMa
+cgttaWKtgttgHtgagatBBaRRWSacatacWtNtcWgttcaaaccactVcaSaYtaac
+taHgtcVWgactaNaatRgNattatagacHatgcYWcttatctaagcttaatatgaaRca
+DVaSaHatgaatttBDacatBtttHactacaNaNtataVcaVtattKgMaSaSggttggD
+NcgtgatactaccYHttaaaMaVcBSacctgatatataBgcaattaatBaHtttgtaagg
+gataaacatgcgcaaataatattaaBVcaWgttagtVaaWctRgBtgYtttccgYatttt
+YMaVMtaHatRDaatgVacaatatVBccgttaagactcgcaaHtVaBaaRctaVgggaac
+RaaaaaatYaSaccVgRaaBtgataaatttcaVttataSMatacKtaWttgcaRcgtgNa
+ttatttaatagaatNctcatHtSWttaVtRattcaRYtaaattDcaKagcWggaWcStaa
+tNVgHaMaBKttaaatYRMHaRtcgtagMRgtattcctHtcacaaaKtaNttcaRcatRt
+ccgatNDagaBttDHtcttggccttaNtattaaStaWgKtVWNaMccaVgVgtatcKacD
+aYcccactcattcacYtattggatVgaWttctgSDagaWDattctacataaaDggtacta
+tagcNcSgagtgtMtaacNtVtcStttSgNDaDYgaaWVgtactRtaNcYgataHagaDt
+agttggaHtgtNtcgcHYgaDttgRtgStatcattttKtWVaYattgNtaaYgYccHgWa
+ctgtaaaVBtaBattaMBtHtttYttVgtaYMWatWgWtNaccVtgMWaSDaatcYWcca
+aaHtacgKagtNcMKactcgtaaaVtaMatttcRcttgHtattattcRaaaWaWactgDt
+tttccttttaKVNaVggataagaagWttcgBtBtVaYcataRtaacBgNaaYctggtatc
+tacaaaagatttagttaaaaNaaattgctcaactttBKagatctgctgaMgtBttgtKaS
+atVgcacgaHNatVDgttacVBacKBaaKaBctccDtagctataWKttagtcttYgtaSc
+caatcBttggaBtMaaaagaYtMgtgtNatgacacctWcKattctgaNtaSgaaataata
+tVSaattaaWattagDtgagBaHaaNHtBgttcttatHaggaBtatcHtSttgccaatNg
+taHtttBattaacatcactgaWaaaaaatggatagMHtSgaaBSatacBSaagMaDcaat
+tttcgtctaacgHtaaaBtatcttaattagtttatcttcgtWVttatatcgccgaagBgR
+aDcBaatHVDtataacaccVgttHaaSgaagaaatcMSaHBattgcaSgaSVaRttcaMt
+gtgcaatKaatWggatBVgtataNWgNctttacctttgaaRatSaKttHgaaaYSaBttV
+acWttcctgctDgBSgYcagcgggWRataaaatgcactagaaHStacaatHtggtgtBgc
+NDttggattatgaagaKaatStgcttHtgKNMNRagtaNtaDattgaDDcKtaaatcVVB
+tcSgNcRtcHataRcggctVBtccaWcaDgaaRaRctgaatMtaRtgBcaWNaNatatWS
+cYYaWttatScYtSgcataDtWcacBtactaWgcYtcgtataagctataNSgBctagatt
+aNgaKgatVKgtagttttcaaagtgcgcYattcagatggaKcMBtacgtttaacctaaat
+taaatattcatRaggtcgcccattMttaaaaaaactggSgtcccgtctaNtWattcaatt
+VHDagRtggVSSaaHtattatWctatKatHtHattYBtaVaMRatgYagcHtaSataaSt
+KaaacattaagggttggVYaaDgttWSttcattaRBcMttttaacatRDaataaMttRga
+taaagVDKatcatacaacgMtaatYctKcgggcBKNgtggttcttaagttYgcataVMaa
+VBgtVMSNagttatSttgtDtgtMgMDtNKtBgctattacagataMWtcSggtcHgggcg
+agtcRtcRattaaaatgaaYYattgtaaccttgatacgtWcHDgBtVagNcSgBKtaaMt
+caStgggatDaVtKScaYagtttctagNBtcMcDgKaDHtVtMaMacMgtagtaaWtaYt
+gHtttttgtctagYHtRaagacDRaatgctVMtttWaYaaNtttatatttStcgactaDa
+tKaatatattHggttgtRtattaattaaaaRtaNacKattctVaatgattcttacWatgD
+gagggtggScatNtcMggaagggHtaaccttcWcatWaStagHtttgatHaRVaaSVNNt
+caRacaNaKttgctgggcVattatccatVatataDtDcNgMBMgHSagggaaagKctggg
+tcacgaatcaataaVtDttaRRgtctStattNBaaaBHatcgttaaWMagatagacatat
+VgDBttYMacaatttKtttaataaaagcacgVgaaactDBtaaccgtagaNtgagaaaRt
+tcKKagtYKttttaStataaHgtcNDcgttYccaaaaMcaWtgggttatcaaRaaggaat
+aaVWcacatattaRYaaVagagVtcHggaBtaataNattagKtcVRtgactatcgHDaBg
+RBStVtSgNBccWDgaatgaggaaNctttNttttacaaggagaaDDaVtcgaataaataa
+gttaattStBDccaaaBgVaDtctScgtgtttttgctgtcacgtttWgacStMtttVaVg
+aBtacDWtttagttDctaSDVtttNaDDcHatatacYtKataaatagttgaacaagaata
+caDDcacatttgtaaaggHattaaatgttacgtcagtNStttcVatttaBtHtVggttat
+taaHcgaWagaYtVaataaatcaBgaccctHcatKaDatRttHRMcgtcgggSMtaatNa
+gtYtgaYtggMYttgtaaactacgKgStttaaaYatatDtaaSaVVcHgtagatgaggtc
+aHggMtaMWaWaHctgaatctaaBaWaDtcgggtccctaagtaVYDaNactataaNcctK
+cBcataaatttcaWSttttgacHtctRggagRaagacagWVNtctcatHtDHaRagctSt
+atattggcattcattttMaNaSaRaNDHaagNtMgtVWtgtMccaactKNaaaVaStatc
+gtStgtgtaBgBgtaatcNtccgaagtttaWgactNgtaaccaatgNatWttgWagtaaK
+gtctRgtctaataagttVDHgStgttcVttgtSWatcYaggMatgMRcBaStgtaaaaaM
+ttaYagccggtgaRRatgatccaaaggtttctaaKgacaDagagatgctcMgaaaMcgRa
+acaaatataaaagcagtgtatDHgRaVtWBVtggacatStctKccttVttatgtKatttt
+YcatctgttatgtcDKHYcctSHMttgSDRNgtaMNHaggatBcSBtHatDMBcttMacN
+aVMKtctgtttcgaHSgtMgcacagaStaBttcWcattctDtcttHtDKBcaaNtRNaaD
+gaaaaccMRtBcWVVagcttatcgaDYccacKtatgatgtcaRttattYttctaMBggca
+YctaNtBactgattStaDaHccYaDtgcaRDgSYtYtatBSaYaaataaagtctcgcgtt
+cagaaKtttctVattagtWcacgaaVaaVtctcaVgtagttNaaacaatgtccttaacta
+aaStaKWagttaNttatacaaaKattBctgaagaagtYDNtagatataDtHcKcctaBag
+gcaatctHttctaaDNtgtgaaaagRaattataaBMaggtDgtMaWHacBStSMtcgaac
+YttRMatNacScgaaRtttctattcMaaBggtaKttaRcgtBattcgatatYtVaccSac
+acgtaaagtctNatYttgcSSattttcKccttataatcRtHNctttMcatBtacatgtYt
+ctagcNttYacaatgtaBgcgttVtattaaWtaDRtKNaNDttDWaaaataatDgcgcKt
+aatatcgctMctatcatcgtaaaaYNRttSaNtWggatRgtgtcttataVgaaaatcWDc
+ttDRaatMKctcatatRttBtccaattBSacctgMtaDDRagtcagacBNtttattttag
+tDacaagcaHcacgRttVtatcatatacStaatMaWagttRccKtRctcgaagttgaatt
+tNtttatHaHttagctatSBaBtcaagtDaaaRtgattcatStagttcaRattacaVgta
+tWRttWggttttctaactttSaaaVHRatttYHMKVVcgttMtatBtaSaaMctgMtcaa
+gaMtactcDatSaaaacNgatttNcaagttRgacgataVtaacYNataStRtgaattact
+gtaKtNagaaccDaatgNDaaHcataDSYattatgtctgYWaaRaHtttWggcKatgcgt
+agDSVtMactataKMSttaHaaaacaHatVaDKtSaaaRtcaNWHtatttctWataagct
+ttcccaacctNtaaacattcgagaBKVattaWtcVaKtWcggtaatcaatgttcaaatcc
+DttctcaaSaWNDataaKatBcaYttRtcataMVtKttggcaaNgtgttatMaccgttgM
+NagtgVtNBWggaacacaKaaKctagtctacttSaKYMacaWtWDttatagHBacttRtt
+cctgttagtScVNaRtaacgScaStttatctttttSgtBgNtttStRatNDWtctgatcK
+tgHcattatctaaaaattNaaaWgWaDWttWRtHRNcHacBVgWttgtNggtWtWcttgS
+atRtaaYtYtNaDttYagactStacYaYtNHBatggatacVtBatgccaHcgtagaaMat
+gataHagtKgHaWcgtaccKaNatagWtDttcgtagggcSgtRatatNgaRtYataaata
+RtBtcttaSatcagatgaaSgtVtHtgtaaDtVactgattcgcatctctBaWWtaagBtt
+VgacHattWWgcKataHtBtagScWtcaNtHStBKMHBRtRagcataaYtNtttatactt
+aMgacccattgagtDYggKccNaaRgataWaaaNWDMttMacttaatgStDYgtattaBa
+tBttKcSaactagtaccgttggaKacRtDaataSBaatacaKtgagDtNcttattaagYc
+agacttNNttatcBtHtgRatgccacctaSaatccaRSgtWggtgaaMcgcaMaagSaga
+aDatHcttgaaDgNRttaDKacgcataagYaagtMRttNaMMMgcggttcgtRaSgacaS
+taaVgStcaRBKcaMtctKtctatNaactaHtaactaaatNWaKtWaStRSKcatggtgB
+tgRBtagaatagataSBagMtDVataaDtaattgaYgaBaagWagaacaggaagtctgac
+gMgtgagaRVacMcBaaDatKatcNtKaRtcatDNBaaHatatacattaWRBtcaccatt
+ctctaaWttWacgtccgcgtMctcaaaccHYtNDatttSaDMccaStRttWgttattaSV
+KtgttttgtcWatgtgStttgttttatcaagacMttgtRDgcRtctctgtgggggcSaag
+catVattMacattSgttaacctaaaaccgcagtgagNgtctataatBtHtacaaSccccM
+gagRVctYagcgaatttacMagVttaRDcctRgSSttttcHtVaacatagBgaMRagatR
+cDBaMtaNtcatggHgaDYgaVgWaaaaMKattBtaDYBaHRccagttatacVaDcacac
+tcgtaSctaaatatRDaccagctttttaatgtagaMaRaaKaaataaaatacaRagaaYa
+NtatKcDttgHgcVtaYgDacagMBagtgttatgMcSgWDWYWtSaKaagcatKatatct
+caRHacagttaKtgBKtDRggtcaYcattcgcYattttgtccaagtVgcattttttaVaa
+gtaaaagtWccttgacYcaagtaatataYBaatataBtaaatacacttttRHagtttaDS
+HgNtNVcatKgaKtgagttgaaaHcgBattatHgRKtcaBaagttgtttgtVatYattaa
+ttBatYgaatgMgtttatagtKcVctagttaaYWttWaRKWggYttgaRgagaaMKtagg
+tattaMVttataVcagHYacaaMaattRRtataWaaRacHcattaVaBtHgtatBaRttt
+accaaggNgtaDMtatYtaYVtNtcBRKMgaatRaaagaatactRattttNcaaaDDaag
+tagtacaNtSHttaaataattggtaaKtttaaBaNgtaagtcaYttacVaataataatDt
+gHSSgtSDNaattcRMBgHttctaagaYVcHcactKgaaNHcgWaWttaaBactcgYtDa
+acgactMtaYKacBgttcttgttataBacatScBcattKaaattacttSSDaRgKtHHag
+RNRMtttBDtcaagcBcgcYattactcgtttacSaaNVagtacacgtggtSaWatBtgat
+ttWttScaaDtttggtKtNKaMtMgcttaHKaRaccgatccctgtgggagRMttaaMaWc
+cggtttBtgttaaVtagMWctNtctHgtBgcttatSMYccttgHaatatctgNgVttagc
+ttagggaBBSStaYgYatYgtaaaaattHatctatgtWRNgtVcSgtgcgtcYBagtRHg
+acttaaagSHatatBaaDgcaKtcccDgcacMttatRaacaataaccWtNBaYatttYac
+YtagagattRtatagKcatattDgKtNNgtttWNagggtacStataRtVDYaacgtaBtV
+KtagaagRttttttatataSaagaaKtaatatKtattagBtHataatatcWNaacagtgW
+accatatStcYcaaNRctcKacKttgtStaaKRaWDDaatBtttgtcagggBgtggScta
+aWtttYVWttNtctaacatagVYatcagatctVaHMgWtcaagtataHtgacaagttSac
+gtNRataaatgttgNtaattagaattgctMaRttBtacBatNgacatttcaMcgtaaacc
+tctagHctaaKNttBatatttaatattBaKtRagYtatattSgtgtccBaNSattgaaat
+tgYggcaaataatatHcaaaatcMBaagYatttttaYttYaStatttDtacRtgRatttt
+ttgDcRaggagcaccaattcRcttttataHcggatcatNSatgtagtHHcactgtWgtag
+gtNgactactHagagHattcaggggSaatgcaaaacSSKDtaggcDtatVagMtggacta
+BSatagMttaggatSYttaacBtagaNSVtaSaNcSScaaatattVctcYaWYtBcttcg
+aYBagWtRgagHKagagMaatttMatgtDtaYNagDtaBagcKcKcaMttKaaaaatVaa
+tHDaataacgRatBNVKtMaccYaaccMgttgtactagcttMatKgKBtMagtcttMWga
+atRcacaaaaSgcgVtSatggcaggcgKaYaatgctcattaaaggDVacStgttaMaaaa
+acNVtBtgcttaacgtDNaaRcgWaKtatactagcactgKVttaatcttRcgDHHattcS
+tatgatcWataagtattttacgtcaRgaaMcDattYHattYgatatcacNNWtDatgaaa
+actgaatHaggaNcttcctKggNgatBaaatttgcaaaDtgctcaatgtYagacMgtVVt
+gDBaacVaatNaDtatctgaaggKcagSggVtacgatgNWtKWaggMacctagaatattc
+ttYaatDatcgttgatggtcaacgttatatgcttaWVttccRgVcaDcgagMtacattaM
+taVWcgttRcatRacaRcMcaNtaYWNYgMtatMgccctaKctagHtttaaBVMaaWcSa
+ccgMttBRgNcRWMtHMaccaatgataaggagVttYgaatcttagtgtcMtgcctVtaRt
+gcaccaDaagHactNYcNcttaaggcMBagaWtattgtgctaccacgcWataRaHtDtac
+gaaVttagttVacctatatStDgtggtaMgaSattcatgMcaRctatgWgatKatYYaaa
+taNYcSaDtttgtcYttttttaBScatRtctgtaWttaatagMaacatDttaaaNgaact
+tacYttagaaccctgNgagMNHaaKacccNatgKccttaKcatDStaaStNaaVBatagt
+tcacRtYcRcKaagMgctKtBagSaagNcKRttaaaaKaaRttttttatHHNHaHRtcaR
+cMataKDDtNcKtKatctaaataaatRatYttMccaaaNaaWgctgattcaaaKgaatSc
+aNaaaKaBaaaaRNtataVcYDattagctattaaatWtgBWHgggtatcatattatcVtt
+cgHacgcgatMattDcaRggDYtYttNaaaatBKttKccStYVDatatYcctSacVcatt
+ttatMtWRctaYagRgctcttttaacVtagaNaVRaccgRaattaaVcaattgcgKRctM
+aKtttHgctttVMaNaRaNMKacHSagtWagtgNatKttatctataaHatgSaSattcag
+tDctWaataaYtcagtaYtctatHcgattSRttaaaNDgagatatacttVttatcataSS
+aBNaDataRtRRaattcaRataaRtattttNaRYtaKttaccaaaaaHVaBtttWtttga
+tRagctaMattgcttactctgatKtgatgRBttaataagYttcStKaNgcNatacgWatY
+aatctggVtaaattYccKagaVagggatttatttWacgaBcaBtaaDttttcgaBcHDga
+aSgVNctgaaKtgaVagtVWgRHgtacaatattgcMDNNataatagaaaataatNtNgcc
+gaaMaagtgNttacgVHaacSgStBBtRagtBgtaaWgacttcKgactaaatgaagVaac
+aBtggtacattcaaagtgattagKagNatatVaKBacaMMctccatcgcgggRctttKaa
+BatcacaScaNaaaaatVgHaattaatatcWcacacactcatgctcgaRggVgcatatca
+DcatYgaggttDgWNagagaaagagaYttHKaatgtaVtYttSNaDtcgaatctattSKg
+tgtaggaMgtaccWcaMRtHttaaatgWtgtccgtKtacggacaNgaacgaSgcYagcKB
+ttNacaagatacgaagaVcBgStMacMtgKaactataSgWtaaaatDRataaaNaSaagH
+ttHWYgaccWMtatataaaaagatgtaKtVtgtcBNMtRaSaRacVataaNaaaDtaatg
+taaagaDgtataVDaacagatttWtDtcBgatggBcgagctcKWgtHcBgcMaatDNatc
+aYtctBgaHtccagHctttMtattgtBccaHMctatctNaaatacgcgtacatacatcta
+DactactcKtacctataDccMattRgRggHtaaaaNYcVtatccgttSaagYcgMattta
+VattttHagVatVtttKattaagttaNaacaccHSttagDactSNgtgtttaNtVtattt
+atgaaacSaKtactctacgagttgaagtcaSBaDgtagatNaaactRKttcatcWtaBag
+gKtKcYttaDttatMaWcStgattKattgtatatDttatDtKatgtaNtgtcgtcttttt
+taBtDBcaaaaSgDatgHtctacaattcgMtVYtatgcattaaaattcaVgatRtcagBt
+caMaNctHgtatVatcHttcaDNKgtWcgagHtttaccattNgaactYacaKgaaagtgg
+tttgtgatcgaKaHgaatYNtBgcaaVatWacNggataccaDtaaaWttBMaBccagaHD
+aataaBaagYVacYaScctYVgagWagaYagtgatgtttWatSaaaMYDcactYtaStWg
+aaattacHgKDaYtttttgttcaaaaatttgYatatVcMatcactggRaaMVtStBtaaa
+agggatYaagtBtatcatgcDttDaaaaMatagtctaataNtcttWHaaatcaVttaRaK
+tcgatttataWRtaatatcDWcctaNMatgtttDaYaaWtMaagtcagaKtaMKacgcca
+aVatgWtSagtagctatttcactaaNcaaaNaaattaggattatMWgtgacgtcttcatt
+acaYttctRRtttgMatggNtatacaataataNgatNcMttaggBcDgRHgatctttagt
+NtacaaccgBatgtHaatgttttgatatccgttatcataStaKRaKgttgNaagagKttg
+NYMaggaattcagaactcaRataDttaagcttaccttttgVttaWWgacYggStacYcga
+tgcSccaacHcaYNtgRaHtcaYaacHctYacatagatBgtgacDaNgatMacgKgBaWa
+gacaSgttaKcatactatatcaHaatataattctggtcNttaYggDRtDaSHgNttYaat
+WagagtagaacKtWtHtBatNtScttttacaattagtaMaatttHgtctagMctaccaga
+gttcaKcStaccKggaggtctgcNatctctDgYccaaVgttgaatgacVcatagtgtatt
+ttccttcatctacttSgaaStcagHtMaataWNDagtatttttataggcatNKataNaMt
+gctgtttVaacctVBDWattgHttatattaKtatSVSttgtaScgcMcccattgggtaga
+KMgaSaSttYgcaaMaatVaVaKgtatgYNattcttagWgtcBaaagSaaatRatttNct
+acaStggtYcaaggttBtgaDWBtRtgaaDccacaaaVSatatBcaaScWccgaKttttc
+gtMaVttgatgtMatacatgNttBaNaagtaggaRaBagaagtaRtaagttacWatgHtt
+taagSaatgataNWattgtaSggHDtttBataaNNBRaatKWBgtaDcBaMaKtctaYat
+VaKataaaattWYcgtaHcttagtgYtgcKDtccatMSaaagatYcSaHatcaDtaatgM
+MatgcaaatgtttagaDDNtatttgaaKcNtagKYcaBMattaaagttaaWDacgRaRta
+KttaaattaVVKaMaBtaKctaaWcatctRMtgKcBaBaaagattHcgMcgaSNgactac
+cRatHtaSNtctYcaaBDtaggaagcMatttcaBcDaaatggWtcaHctaKtHcHMcRga
+ttgaMtNVaDagttaggcttYctcatDacWDaaaaaKtaBgtBaatcaataaKgactgac
+tcNcattMcacatNMattgtaaaNaaacttgctaRtttacttaatKYgcttgaSStgtaD
+aNgtaKgBgMaKgccagtgtMgatHDtgacaWDttHKaDgMacttaKaagBtttgtctta
+agMagtaHcttWcacaatSatgYtgacHgHcaHDgtagaDccVaKcaataNttccHYctc
+taSRtaYagtNgDagatWtRttSttNtRNagacatattttatggactacYMagtMacYaa
+gYgVgKgtNtaVcgtgaatcataatcgattYtaaatYtctgBaMgNWNKMgDttttaWta
+BaaHatNHaDacctccNKtgaVcWattYtgccaVRattMacBtcccNagYttBYNgaBaa
+aStWacMgcttccatgHaacttYagMtNaaVSYgcgatatHcaatatttgtgBcatWMta
+aaaDRttHaBaHttgaacaaataaWaMcaDctgBtatWttaacaaWacacWtDtatttat
+WaaHacaVagVgKaaaDttWgRBVagttVNttctgcttgacatttSHHMKScSgSaMtDt
+aMcgtcaWaacactMcaHWRgaactWtcgcMNcactVDaatHcDSttWtagactatgaRN
+cttagataYgaggaagagcaSHcWtMaKStatgYatttttVaattgtttWataaaDaDga
+taMcaMtatttctVKaKgcttcctDagtgatWatacaRtttaaaBSMctHaaatcagSta
+tStgaaVttaattatttgctaagcgagaWaaWtccgcaaSgaatVgtaStMcSNcgtWgg
+MVWNatHctggRtttaacNagtttRtaMBgatatHtaatcMaaaYgatMtaccttaagYa
+tcgaaattMataaHatYMcccaaaDaYaVaWgRaHaaaMcHSattcatWSatttcaMtga
+taKBYtactgaNttgaaDactgBatgYgttaagVgaagDagaatttKNtgaMtHagtaaH
+RgaaatttaYtaccNcgWNcKtaYtBMctVBWttttaSagRHBtaHtcgtactHggagta
+atttaaaVVattWDgtaaHaYgDtaacatDtacWttttttatgccacttaDtagtaaKgY
+NcttMNDaBcaVMcMctWgatactaRcaaWagaatgcWcRtattccagKgaNgtctcKtW
+gaNtSttagVaagaSYtcctWatatSgaDaKcactcgBtYacDgMtaKggtKcDtRtRgS
+aNKctaatHtRDaRgatatacattagtgccSttctDgcgatNcatttcHgcKtagcYgtt
+ttgNKWRattgBtaaNcRaatcNaagcgaaVKttYtWttaBttttttNggKcgaRBMVtN
+cNtDVaaMtcBNaKtaataRMcaaaattYactactBattWcgccgWaaMtaBYtgtaHag
+tcttVttaggaHVaaNaNaatcttgtgcattttatMDYKccataScaWgNttccttttMa
+RcVtWHgaaatgBaaRatgcgatataaaWYacYggtacttaaaaDaaattgatcWaatgt
+ttRcatatcaggaBcttttcttVKatKccaccYtDatMtcttacMtSattaatatagaat
+gSgagYgWNtttagtatgRggYKacaatattgggVtttaSaYcaRtBcggtDaggYaaac
+tNataggaggaDgaKcaaataagatMKaattaaNagtagttcWctataaDtttcgtcgta
+ttaccStgYgatgKtgcccYatDctYtttttYttaaaagaactcaNVaaYaYtccagacB
+ttKcaatKataatKVWcBataaatgttcctatYaacttaSVtgataggVatgagttgatc
+ttacgMMgtWtYtagcacaSctcHYtataattMttataYaaccKgtgtaaKcYagaaVtc
+BKattStgcaaKcaKKaHgtaaBtctgcaattaWgMcgYttMctWtaDNcDatggWaatt
+ggaVDagKattttgaaaRHattgMaaMgtaatcattctKgNaacacccNHataaaatgaa
+agagSatKtacVagttggtcgtgcBtgtgcatgagcaacataagKtcagtttgtDBBHWc
+gaDtatYttgattcttaaagcMMttaKgDaHtatVgWHccgatKttcaaNcYtcaaDWDa
+tcaWtBtWHgctaaMDaDWtWtNKcRRaNttVgHaRgKgcWgattNaaattaataNcaRt
+agtRgaacagataDKgtatScattaDgatcatMtcgYcgtttaaaRctcagcRattaaca
+tccStcBtgaccgtgWaaagaaatgaaWtattaVtHacctaccaaatgBgtaVVYaaaat
+ccKgtcaactataDgNagtcaSgtKttacHtccMKKWattagtatNctattagtttWttR
+tgaKaBHStgRagattaKRtWaKttaaWaagtaVccctgcgMRWatgttNKgtcSggSHt
+aBttgtaYaatDtaVtaatgtHcatWaYcMttataVgaaaaagBgaagRattccggcttD
+gggcttcttaacttRgaStaMBaaMtctMBHBacttVgKggcttgcgBcBtgDtttccta
+ttaaRcatStNgcKgctatcccacSctcHtaHWtgWaYatgVaRRYtgctaaaatggaga
+cctMcttgttMagBaKctttYWBtaYKgcccYttaMgtHaaNYgtgtagagDttcBatgt
+StttMtBWtaaBctaggaaNgaRgcttttttgtagacRttHSagaatDaYgcctMBtgtN
+SNaaBttgVtWtttKgacaatatVttVatagatttgcgtcgDtVgtSattaaaVHtaDaa
+tYttatKSWtcattagtaaNatctcagcgtgcKcatDtaBccaaccctgaYcattaNaag
+NaKgagttttcattaHMaVKMDDtaSHScaDattgcaggcccMattatacYtMatWgatt
+tcBcBtBctKacccaaWctatccctcaacaataaataaMttgtaHHcgatKgaggBtRYa
+ttatacgtaYNBacagacaaatVtMcttttRtVcaattgtttgaWtaaSacaRccMcaaa
+cttttaaacgtacVBtcWcSaYHgtattacgRtgtgtaKgWgaatctaBtcgtgRaaaWW
+VBcaNtcgctgYtaaaHaSccaagaVMNaacagattaHRaaMWcVgMtctgcatgaagRD
+attactgcKHtcactYtccttatgHtKgMgKcDtacNtcaStgYccaaDagttDtttgYc
+aagcacWWttaMgccaStaaWtVactgaagtKtttcaWaatgMattatKcctctttttca
+tgtaaactttNcaaKgttttMaMcYtgWctMtttactttagaKtMgttDYttctatagWc
+RttatYSagacttcaScaacaYtSaattcaaagtgctSaagctattaaagggtaactcac
+gDKgttaMRgggattttMcgttattaVtccaNagaRgMaataaagaStcSaacgtaWtta
+tatHgttHBcgtacggKBtSatDactRggaRgccBRttctaaaatSactcKtttVaWRat
+atttWaHaKMatgtacatcagctaatggBgaBNSNatatcYStagaatSNattaccgtca
+ataaggYMRtaDaatVgYaDaattataRgVaagtgcaNKtgttgacttatHccacHaacV
+cWcNMDtatcatttttaHacatKtatagtgccWttaattttBSDaKaHaDttYacDtBgt
+MNgggBaaaaattDaaVMaKgatcggKtgtctatctctVatcDtaagaagtgtaMcWatD
+ggaaaaaYtcDVtNttcNacgaYtcgatHctctaWgaaggtMttcKtcttaMgtctKNag
+cRWcgBVtcBDatYKtctaVaaaBgtaRagcacggcaHHagcagaaaaacgggtataatc
+aaWtacYcWtcctaBgVVaBagHaaaaaatataRYagaacgggVtttcHaMtNtMgcgaa
+atKtattaagtMttatcttWttttRaatatgttatgtatttRaagKtBgtgHtHDggaBD
+tWccattcKtttagtttagtBYcDaMBtgatcttgacatKctBcaaaacaHtatggaNaV
+ttcgttatttttttcaaDtDDaatcaaaYaaBHttaMKMVgctgWtacVtRaaactgYtc
+atggcVHtgattRttataBtcgaaRataDttaatcattHtatatccNattcaaHtgKRtR
+tagtKaRWaataYaggatccacttcacaatgtgatMaggactNaaccaaMaaKtagaaMc
+tacttDSaaaWSgctcagtWaataWaHtStMacttaDtgagWaaaatatttatcaacaac
+tRtDgYcYtatatgtataatWtagccaagcgtttataatDgctgVaaagHaattagaatB
+WggttctBaNtactHtKBtcgaaaRttHBatDaaKccaSHgtgctWttcBaatcctYttg
+aHacgtatgagStatRtMaacKacacggaaSctagDagNttgaKKSgtttctacgtagSa
+taHttDctggBcYtttaaatcgRgagagaDtgRSaVStggVtgacgtMtatgaaNtWtHg
+tDaDtgttNaSVagaattccgcttVatatacattatataYtaggYaaaRDHttHYDtNgc
+atHggctattYtaMcWaaVtaNtatttHaagBtatcagatHtttgaaWWtttKaaaggBt
+attHagtaacactDggtattttScttaaaacaStcaacHttMtatcagatSaHtaVtBaN
+YcttHcatgHatagaaggggaWgtgBtttagtVttgacatYtKtattaYSggtaaaHgca
+ggaStHtYcgtaaDWgtaaaMcgYtNHtgNgcttttataWatttKWaaKtHattgRtBtM
+MccgtBtYttgaKaWBatcBgaaacaBgaagatYgKWaaacBgatgtDaaacttDcacga
+tSKtaVaRDWtVKgHtcRattactctattBacaaactaatgDtaatcatatKRattSggt
+cggRMaaHVtgttMcgatatcccgVctKMgBactVtWtBKtgWtaaaVaatRgKatttKS
+aYHtcVBNtgStgtatNStaaccgttaaaaYactBgaaaaattacacVttKattVNgaMa
+ttNccctaVtaaStctgaaVatactgtctaaaKYNDtataWtattaaNgtHtaWgaBMtt
+ttccaaaDcgctgagBacacttctDSctcMtBtNccaacaaatSVtatWggagSattKat
+RBaaaNtNtttagacttaagtHttaatcgtWctHaMBaHtaaagKaaKttgatattttgK
+cgtcDtgtKtHagDtMtatgatcttgtcSgtWgctaaaaattDaaaNgNYtMttNHgtHB
+ataatMgMttctDcgtNtNatggKatHtaaRtRtDStttRVcaatKgaaRSRtBttatcc
+ataaMttagcaaWtagtVgaVBatcVtYtagttgtaMactaaataDatagNttttactag
+cgcKctDatatDgaHtRatVWagaDtttcggSKataacaggaaKggMtttctaVttMaat
+gattcgaagcgattaNNtYactttKgaatWttNNgctatatgttacKaMtaaDgtKgttB
+ttHtDacaagaaRgDgttWtaatgVBcaaccatgcYggtRcctaaDaaHcatYNaaVDNt
+BgtBaattYYgcHttRctattVtattgttcKaaatagtacccttgcVtaaHttaagaKta
+agSaYtgcacttDattYttaVgRcacaattDDttagattttcHagccaYaataKaatccV
+DKctNcctcaaBccaaBaYgKacWVtWttatgcSatcDHttattaacaagaacRSactBH
+ttDaBBBcacgttactHaKgacaKtaWMcHtaVHttaattcgttatatBaaagatgaact
+aaYgDNattNaHgHKtaatcctcttcHttagaatVcagaHtagBgtMataattaagtcSR
+catSagMagaaaacgYacgagcacgBcggacaHKaaBatSatagtatcDttRHtcagtDt
+aStYtagaaagtYNHtgaacaatgcgataaNgtNVagtacccctBcgaYWaactRtDtat
+ttKatBccVKtHttNcttVtgaKMtgcttggcgaNatctcKggtcttttataaacWaBtt
+cgHtcaHtcgatcgcggccaHaagcVgKattBaaWttKcttaVaagYaVacagaacgcSc
+DcgatataagttttacaaKcaaaBcYcHKctRagcgaatgtScBagMttYHtaatHcKKt
+gggatgKSaaatactgWBHVcagHcttVBgYDtaVtcctcatRcVKcNaaYaBtatttta
+tRtVtDaaScgtatacMatcaaactagtaKataaatStHtacaagagttgtYatctagaB
+aHSYtaaataaaStacaHagWSRSDtagtatggctgaKtaRctaaagBtactcttatgBc
+HcNtNRNtHataaccRttagatataaHtacScgtattgttgtDcctaYRaattccaNatg
+tgctaaaactMcaWttgttgVMaSgtaVaSctMcagtcacNaWacgaatWtaRtaatSga
+tgaaWtaaWcgtttHtWcttgatKtgDtDMcagtcattcacttgaaatactWgtattcHt
+tcataactgctgtgtKatRagtaatttYgNcaatcBctgtStaggtaMatacgtYaRNtg
+NaHtNccRtgcSHgRcaatttVcctattaBKtgYtaMaactRaaaaBaattHHtatVNWY
+HaatcagtaMVtttctattWHtttacaaVccDctYtttVtNtRRKtBgatHtBcaatHYa
+SgaagaagHagtttDaVaattVactactYcaDtKttgVVVtaWtggctaSttgtaataDc
+tWactcaRttWcMSYtWagaagttctKHcgKtDaYggaDttgtgtataacaRKctaactt
+cYaDtccNaNttaYtaatagRttaSagaatBtVRtaatcttatgcgtWtataaWgHataa
+tttYYSttYcggKKtaHcttttagHDDBtggtttaaacatagaRagtVagactttacKaW
+DMacgYaacctgctKaNattggatggNgtKcYSttttcctttDtYttBcatgattSHaac
+cVtccatctcccacDBtgaWBaMaaccgttttcttaaMgScBNatBtagtcttccttatK
+BRcctggtVStatagcDgMgtacattacccattKKtaRcRatRctYVaSagttatatYtc
+gNDDggKaHggcccgcRtacgDtcYctgaaacHtatattaVtcaattaaatgaWaBggYt
+HYYaVagWacaNtDtaRattgRacRtacacatgHtagagtaatatttctgDDcttgNDag
+cctaaHtatYHtKtRaScgtattMttacaacHggttttatSgaHVVgaattaatagttat
+tactgtRtaWgataMDaaaactgNYacYtagKtaRcaYDHatatVatggctKtWatHaNt
+taatttttgtaagcctggcgKataaNtttRMNggDtataaaatVcMRataacagctMatB
+gMtaaVcgagattcaaaSgtgKacgtDHatWaatgttcDtWatgYcWRttcatBSHtttg
+aatatBgaaWgggaaBcctSSVaagctSctagYatDggtatatgtaatatgtatgHYcRt
+agagtHcgggcataDHattcaaattcRgcaaaataagattcaaYVtaBtaagRagtttgS
+RtgRYKgWggtttaaHgcHStgtggtctaHaccaccSaaaattaHatgttVtataccaga
+atDKVtctagtttcaatgtNctaccgDcacgaattacactatgaaggccKVatccaSWaa
+KHtttSggatgagMagttgcaatatKYtacBttaccatHRttaacttacaDKKtaKaDcH
+HcaYatatgMagaRaNNttcggagYRtacMtHgacttagacBaagggBatcttgaRDact
+gatacatatcSBggtaaaVWgMaatttaYtaWacHattDMtttaaaRRScatcttctaat
+acagtBVgtgtttBagtatgBNcaagHaaaSaSYKcacMtKatggcacgcctSRaagcat
+aattaYacctMaaKtcggaBaVaaWaDMttgccttaaacttDaaHacNVtgagaatacca
+ctctMttaatcttHcctttaggaKgaggWtaNataYgtaggtgaagtcWDcWaBatattR
+tVgtRgVtataacDDNttatcYaaaagcaVgtYggaDattccgtccDcSttaaWtttcaa
+aatggataSatctRYcaaBctMMtcttaacMaSgDatgagatcaYgctcacHccMgaaca
+tcDNgtNRcgBaaatagaYgatgcttRaattStccttgagcctaVaagggatatcagtaN
+MttaaHcMaatccScBtYaYttatgaMNagtgHaatHacaHaBaaDtaRNDNcBtagBga
+catStagacttgtaatMtYaNaKSaccBtttHcDaHNBttBaacSaggagaacgWcMgtR
+caagattSctgtaBtcaatMtaHgcaaccataVgtaagDRcDcggaaccaBtacVMgStt
+gtcataaaaacaMataHatgttaacaaMgtacgtMVcatagYtKgtgtcctaBcYKattc
+aggBaaHagStcNcattatRRaSYtYDRaHYttttggaRggggttatKcVtHgctggaNt
+taagagBaacattggYaaDcSacggYaRttacaacactcDcacBDtYataaaaDWtctca
+ggVtaYttKtaVKtDSaMtYtYcgtaacHtRcHctaacBgattttagHaScDctHttaaa
+atVaHttggttatttDtatHtcaHcBagSttttDctttWtctaaataaWtHYtRgtBccS
+aaDSaNgatcSttaaaatgaYgKaaDaVatatYaRaHDtataKaNtagtacataggSaat
+MtctMtccctWgaYtaggataMttcgtacgccYgBSgttaaHgctRgRgtDVSRattttt
+taaKtRMtatSgRaatKacMaYgggtagBgNHcgYRagHcatatgtgaacMtacSDRMHa
+aacHaagtWSMcaattcagtDctBattgttcatttMBaDVHVDBtaatKactNacgcBYt
+ttgatctatVVtatcKaKSgtaWcgtcgNYatSaRtcaggaRtctattagattKHttYaa
+BtcacatataattMgtatcataKKatDVtWtaHtHHVaggaaHagWaHtattgtDaHRga
+tgtaaaWaaSStMatttgNtgtcagDWgagaBagtcattaataggagttcagcHttgWag
+aWcRttaKttaDgaDWtYacMWgRaatatccMtaaattRaatacaKYcgcatgtatgtNa
+ccataSttSatttttcgatcttcaaKcMDatgaattcaMWctKNcHtctacaYgatgcaB
+tDDWtaRtScaYaatYSgBtDcaacYataacgcDgtaacMtSaaKcKttttDVgttgtaa
+NcaattctcaataaatcSVcKaacattgggacatgaaaacggaggagtacDYgatMYtta
+aaBBctccYgcgagccHattttaWtataYcaKaaDYaaaStMctSattaatataNaWcac
+aataVtcatacaHcgMgaatYgaataatRcWcgtttcNDYcacaaacacaNttttaatct
+aKtRttHDSttccWatatagtKtgtcgaccaBgtVacNaYBHgtttSSagcNtctacctt
+taacgacaDcWVacSHcaNacatttgBYaaagatWagaacYMatcKgBYcBggtaWatat
+aKcNgaaaattHYtSaYDVHSactgttNRgaaaMBtatataaaaacVtctWtgKggtatD
+BgHaKaHVcMWtYYBaaattaVtcgaaacatggagYKtaaaacagttNtttatcatgcta
+gYcctctNgttctgctaYttBataaRtattgatgaaactagttBgagtcttccatBagat
+ctBaaagSacagtaaStaaatatataataatcttaactatVtaaBattHcHgcttSSaaD
+RaKtataagggKaacRagBaggtaMYttggtacMatMttttYttaacttaBaYaaaatKg
+tactactKDctcttgaDtMgattgVgcRaaaKattaatataagWgttcaWgtcaKtatcg
+acatDaaSatHtttcagcNtatSggtgtaRtgatttStBaNaHgcagttaggggatWttt
+gattttatcgaBtctaggcgtgtgtWttttaaSaWKctWggtgataaaattacBtMRtat
+ccattaaSWttaSMcYtHtaacttaaBaDattctatKatctttcatDtcgNcgacttgta
+aaattDcaVatRacatgaaagtcctgtctcatacatatcSWgNDttgaaVKatNacDgga
+gWaaatgaaVNtttBataaagVttVataataYcNMVaNaKaatRMcagNacVRactcWgc
+tttNatHaRaBRtaaatRtaKtNgYWattaatcttaRttgttcttaaWaaagttcNVtag
+MaBatcVcgccDaaBMgKttgaVaaccgYtRaactttYtcatgattgtWSaaBatagtag
+SataDgatgNtaWatcaMttaHattagVtggagaNHtaatatctNaagaDBatcttttaR
+aaNtBYagtaacVttYBtaagcaaaMatcNgKaggacagagtgaRatWaDaaSaDaaatt
+VgcWttatBNctgSagtctgcSttacSRtgatHDgggcBagccDtatYaaagaataDgat
+DaBttagctatcHtcWtagggagtDtSaaacagtagcttVatgttggcStataacttVta
+atWKtatDatcttcDaagactgtgDNBaccaattaacaaagaaHWtatttaacattWaat
+gttcMttaNNcYaRccHtacRagatccKaaYactcVRDtcHVtgaaNaSatctRSaWtag
+agtcgcaataDcagBaagtctSNagaaaKgttataStaatagStaatSatataWttctcg
+taDgtYRcgtHttaKtcDttRaatNacYgtagVaattNttttatDgKcttttSaaattYc
+gYBaaggttctagYcBataacVcagggaWtaKtacatgcYcctatccDatatagtcRaaa
+SMgtggaatcaaMaatWcgctagggtcattaVtctaatgHcaSHtcacttBaagaMDtac
+tYgtttgWgacccStDtagaDaBtgctctttKaaaatMttNStggtttatWttYttatKM
+KgtctaKcgaBaaaattcccgacYtBcaKaKttRccaaBaWgMaMatgtWtcRDWttcgg
+acNctataaacKaaatHatggDatSaaKtgcgRaaacgtgttcatNtgHtcaataaacaa
+WMKatattcWaKcNaccWtggttcctBaMttgRtggtWtaaVggDgttaDaScgWccWHa
+tacaagtaHtaacttWaNatgtgttaacKaVtcataDMattgtaKccttttttStaaDDt
+HYattNtcgatataBattctWRatMVtStaSaWttNRacgatagtRcgcRtcctttacag
+BKaaVcYtRaKatVtaWttaVggBBatcaaWatgtggagattDgWtttcaataDtactRa
+atBattWVacttWVNtVagHaHtatttaVagtRMMtaBattatataaNaagatHBtgtat
+VtaaacatttagtccaKDcacgWaaHagttVKBgcgRaSYtttVcgaacaBatttaatct
+aSYtccNtcatctatttatBaHcattcaBgDMYtactgScccttRctaagtaaNtaaaaa
+ttatggtVataaagVStcaatcacgcDaatgtaacatDBagtcgaaRDaSactgcagaHg
+ttYatgaVgtNccttcaKHgcgataDcgYtgtgBatcacScgctBcVttttcYaaNtttt
+tatcBaatgataYgtgttgtatgaVcBagtatagtNaRaaatKVtcRtcWatctaattgt
+VgataaMataWagaDttaatRcgctaKHgaRagtDctScatNgHgtKgtDtHBVgYcaga
+tgttagcgaataaNBactBaaRaWcRcMctctBtWKaggcaataatSYtccagtRtaSVt
+RgatctaBgDNDtBgtttgtaNtWtaatatDtataacgccDttcaMaMatgRtgaaaMHa
+tgBaatgcccDagNgttRDcWtaaaKtMSaBgctgcaatgtSVattRWcBtDaaMKRccc
+WtVttaaatatttctgtcatNBgaaaatHtttWtYtttcaacaaagaaNYBaatatctga
+tNtgaacaaMaaYcNgtgatttWtNaatWcYMScMctaaStttNgHtMacgtMDtgagca
+ttcacWtttKttBtKaKcHaBtttaBacgaaNYaaaatBaatNHgaaatMtagatDcaag
+MtaattctKtgNtScaatagcaHDagtagagSRcagcaagaccYHtaNtBatKtStcRag
+tgttMaYgtgggtNatSaatStcYtaBaSBtaggtctMtatcatgaattactcYtNagaa
+aDtggaaatKBattaaatcWgKtStKtcaWMggaattYtggccgaWcacagaNWaNgaac
+aYaHgaVtMctVHttaKDcctNccBKMDagtatgcHtttaaaDaggtgHtattcatattt
+aagcBaaaRcSgttaaatgWacRatacaaatgBatYatatRBcacaVataRaKWMcDWtS
+aatatHattcVgMKYtgtaVBtgagattRgaatgaDgtcaStacgctaggRggtSagKcW
+YctacaagtttBtgaBttacgaStHgVaStgtaRtacaDccNDattSRgttatMtNtttt
+WHacDtttVtgacgYattccWctaagtgaaaMMatgNtctaataRctgaacatttVcNtg
+tttgaggcaaagtatgVgtaVtgRDcttBDtataaMBatatNgataataHaaaNacaStg
+aNaHgYtgacagtcYDggagattNcaDtKgtagMaacSHRtcagNagatKcatataVata
+ctgRVatgBtatcgttattHtHcKaDtagRagtgHtaDcVtatacattacggcaKttatt
+gacatDaatgtctcattVcaRcttttgDtNHSggcttaYDcHaatcDYacccWaMttgRt
+NggYtttttggDgctacVDtBMgBaDgtMaaBgctBVttVagaHBaaaaatgNactaatt
+attNagaagNVaBgVtRgggatacgctgMtgaccatMaaDYDaagctggtcaatggtatB
+tNtccWtWKcaNcBttactgtgBYDaMtMtcWaatctWYHatccgWtataaaNNacNgct
+YagtaaaRtaaYggcagaMaagggttHaatatcaccVtagtggcgtMtagtcaYaaRttW
+gBtctgaaBtKattaatYtacaatcKcacNcMDtgtactatcDcgRtaaYagattgccMt
+gtYKaRaWHgtaccttagcRaWaagDataccagcatcYtcaaSgVacatttaSttSVDSc
+tactgaNctatVattttacgaggWgtaaaKtcNgatgttgcaaNVttagRtttttRttYY
+aYcaaagcVDMaaRaRtccVcSattttcaattagWattMMctataWatggtaagagRaaa
+ttYKKtgatagcMYgcVcgggStattacgBBctNtRgacaacYHctctNtataattBttS
+taRaaaatctgtWatcRacaaMtattYttKtccaatcSttatgtaWttcgcaaWgtWNcB
+ccRgtBagNgYtDctatccMaagtgcYMtYctYttgtcVaaHtatgcBaaBcgaataatt
+cttcDaacaaacBtagWYaagcaVacYcKYttgSaKVcttccgcctcattctcaatgVga
+aacatWWctgcagtttctttttMagWttatRggcattattVaagaBBttatctattatMc
+NtaacagttgaaaBaRtaRRtNtataYNtttNtcctaVBtatNtNgBtaHHYDttKctaD
+ctcaNcatgDaYatgYagaDcaHgactHgWWaagWtSttctagKaaggYtcataYgBtcc
+RaggggaaaHagaacaDatgaaaatcaKtattgWacgtcMSaacYaYgcWYNgagtaMgt
+SccgaaaaaatctggaMMRaaaataatctaaacgatatgDaggaVKcttttaatgacBtt
+NYttagtatDagYttWctttNgtHtcVtattHtcHacattatHgNStgtSaNaactVMca
+atcccBHNatcttDtcgaKccKttatttctVRaagttaMtaYtcttcatMYRctttRtaM
+gSaaaactgWacHagtacccatttcgcatgagtaaagtHcaKgVBtaattatBtttWatg
+MctccattgactattcttgtcatSttaaHaVtKtDcatcatatccaacKatattatNggN
+aRatcMSDHRtcctYRaatccacYaatBattcttBVctatatttRNtgaNtcaaaRgtaB
+cttaaDRcgctacWcttgatatctHttttgtNtYatatacgaVBgYHgattgggtcgaca
+cDtttKVcaattWRcaagBtgctDKDaYtttcKgNgggtcacVagatMgtMVgVgatttc
+agtcgtgKgtKYgtYSaMtgataatNggattKNgaSggactaaBagataacactcataVg
+ttataaSacaatcRRaagtaDaagDYtcactgtgaVttWtBaMttttgaHtKaYtattcc
+agccaaBaggataaRtBatNcatgtatatttcttacaaYVNatagaaagaSaaaagaaat
+SaBgtcgattacattgWccttHNattataacgVRDtYcWgaaYaVgMttcttgtDtKaYV
+ttctgggSNtaYHWaaHactaaSSagttgSaaactYaMttaMaHVRtcgattaccHtcgc
+gatgNcaYtatattacgcHaaaMNMtaYDgacaggRgaYVtVKcaSVcWMBBaWaWcagt
+atHaWBNaMcBtatccatgaScHtYtgactcattgaYatRtacttYtctttgBgtattaa
+DtcaHgcNcaVatagtttggggRaaaccWcNNttRBgaaRKgaaNtMaagcVacgtgtta
+aMYWtcBYtgagtaatcgttttaatcgaaaagttDcaatgtggtBaBcNtgNatBtggac
+tttagYttBcgttRttatSgacNaDttatRKacactgcSKaVaaaRgHaattaaaRctga
+tKaWcctWggWWagccgaactaYccttgtgaBHggcYttttBccttaggaKtaaaBacVD
+cBYYgaWagaKtaHaaactaNttatagtcttttacgaccctttKattWcgHgcaDccctH
+ttatVVaagKaatatgggMaNHagattgNStatBatcgaaYgcVcagaatcctcYtBKDa
+tatcNKgacaatKDatgaaacgaaatYYcgNBDtataatMcRWtaagtataHgMaVggca
+aDtggttcVattattaaaatSVaMaNcDBttataYgttttStacattgagagtccaNtga
+atttttKtStatatttRaatttcgBDccctaaSWatttaaMBStcatacctgctctatct
+atKatatgaacaactctWBaNagtcgYaaaaRtctMtDgtaBaacaNtacagtcgataNg
+aVccgtttattatgatctagtDSgaHNcctKtcttatNtgatYKaaStctWDVcaaccga
+VttScaagaaaaVcccggagWatcVaNtVaRcNtcagatcMMatactaaaWaagatYHRW
+caSagcgMtttatSBtBtBgacRaVgtgattaagtBgtatcgtNggggDaWgagctgatc
+tatttHaactttcgcttttccatttNaaYgtattttactttacttRataBttgataggga
+cattattaaSaaaYtgatggaDaMttacttatttttttaaWttttaataaWaNaattgta
+BtBMcatcNtaaMtDaaaatcRgcatccaMtggWggHggagSttacaYHatYtgtaatca
+tttgVtataaDVttcaYttctHtHtagttWHNYYtVRVccatacaattaaaYatcgcatB
+agcaatDaWacVaBWattagaaBataatgtKaaaNKcagaactNaagaNatgKtBSctga
+ttgWcNaaSataggtataaacVaatDttcRaRtVtVtgtataagMtSccaSScagttgat
+YattcagcMaaWctaagtYcSattNccgtcgtaBtaattgttgacaaaDttttattaata
+cSKtcgcatNttatWatacgRtgcataactYtcacHgVgHttYaataaWacgSVKatact
+agDggcattKctggataagtVgKYtatgttagcgtaRtttaaagacHgacacattcHKaM
+KtcgKtcacggtgatcaaBtMttcttattcttDaKKVgWagtaacatgKatVgacattag
+WtaRtaccRaaVHtttttRtgBccagtcgctagtRtaBcMVWMtaBtaggttaYcttaga
+SgYgttttcaaNNgtttVaagctgStttactaacWattcgtVgtgtKcgtYaaaaaKtaS
+aattgBtYgaVcagKatgaMttWDRatgtaatctagacWaccgcaNgtctgtgagtMttg
+aaatNtttattaRKcgtaWatcaWccaKtttNactaatNcgVaaBcgRgDttcDcatttg
+agWNattttNaYtttatgcHtttBBacgttgRgtcataNtatatcaWVcatgaacatRgt
+NaWaatcaggttaaSctttcaacatHttVKaHtNtMtcttcHattYatcgatgtacSaaa
+taVtcttYStaagattDagtKccgaccHBYatMtcggBacatVtaaagMcttBgtSagKg
+NttttcNtSaaMaStHgtattttKaRttaMtDtcKtcgagDKgaaaacttaaaWNaattg
+aWWaaggaaacKtttVggMBcatattDacctaMgaaKgcgcaaMRtaatcgataaatRDt
+tataNtVgtaVDggttaNgatBgtggcaaYWtagctcWgtSaacgtattKcgcBtttDac
+aaaaaStKMtatNccagKatgtVtHtWaSBgDttgWgaattWagttttaagcctNcttaB
+tYttaRactaattggagagggtctagtatgggtttacttBtatcatatgctaKggNcata
+aaSatgtaaaDcDRtBggDtctttataattcBgtcgtactDtDagcctatttSVHtHttK
+tgtHMaSattgWaHKHttttagacatWatgtRgaaaNtactMcSMtYtcMgRtacttctW
+BacgaaatatagScDtttgaagacacatagtVgYgtcattHWtMMWcStgttaggKtSga
+YaaccWStcgBttgcgaMttBYatcWtgacaYcagagtaBDtRacttttcWatMttDBca
+tWtatcttactaBgaYtcttgttttttttYaaScYaHgtgttNtSatcMtcVaaaStccR
+cctDaataataStcYtRDSaMtDttgttSagtRRcatttHatSttMtWgtcgtatSSaga
+ctYaaattcaMtWatttaSgYttaRgKaRtccactttattRggaMcDaWaWagttttgac
+atgttctacaaaRaatataataaMttcgDacgaSStacaStYRctVaNMtMgtaggcKat
+cttttattaaaaagVWaHKYagtttttatttaaccttacgtVtcVaattVMBcttaMttt
+aStgacttagattWWacVtgWYagWVRctDattBYtgtttaagaagattattgacVatMa
+acattVctgtBSgaVtgWWggaKHaatKWcBScSWaaccRVacacaaactaccScattRa
+tatKVtactatatttHttaagtttSKtRtacaaagtRDttcaaaaWgcacatWaDgtDKa
+cgaacaattacaRNWaatHtttStgttattaaMtgttgDcgtMgcatBtgcttcgcgaDW
+gagctgcgaggggVtaaScNatttacttaatgacagcccccacatYScaMgtaggtYaNg
+ttctgaMaacNaMRaacaaacaKctacatagYWctgttWaaataaaataRattagHacac
+aagcgKatacBttRttaagtatttccgatctHSaatactcNttMaagtattMtgRtgaMg
+cataatHcMtaBSaRattagttgatHtMttaaKaggYtaaBataSaVatactWtataVWg
+KgttaaaacagtgcgRatatacatVtHRtVYataSaKtWaStVcNKHKttactatccctc
+atgWHatWaRcttactaggatctataDtDHBttataaaaHgtacVtagaYttYaKcctat
+tcttcttaataNDaaggaaaDYgcggctaaWSctBaaNtgctggMBaKctaMVKagBaac
+taWaDaMaccYVtNtaHtVWtKgRtcaaNtYaNacggtttNattgVtttctgtBaWgtaa
+ttcaagtcaVWtactNggattctttaYtaaagccgctcttagHVggaYtgtNcDaVagct
+ctctKgacgtatagYcctRYHDtgBattDaaDgccKtcHaaStttMcctagtattgcRgW
+BaVatHaaaataYtgtttagMDMRtaataaggatMtttctWgtNtgtgaaaaMaatatRt
+ttMtDgHHtgtcattttcWattRSHcVagaagtacgggtaKVattKYagactNaatgttt
+gKMMgYNtcccgSKttctaStatatNVataYHgtNaBKRgNacaactgatttcctttaNc
+gatttctctataScaHtataRagtcRVttacDSDttaRtSatacHgtSKacYagttMHtW
+ataggatgactNtatSaNctataVtttRNKtgRacctttYtatgttactttttcctttaa
+acatacaHactMacacggtWataMtBVacRaSaatccgtaBVttccagccBcttaRKtgt
+gcctttttRtgtcagcRttKtaaacKtaaatctcacaattgcaNtSBaaccgggttatta
+aBcKatDagttactcttcattVtttHaaggctKKgatacatcBggScagtVcacattttg
+aHaDSgHatRMaHWggtatatRgccDttcgtatcgaaacaHtaagttaRatgaVacttag
+attVKtaaYttaaatcaNatccRttRRaMScNaaaDgttVHWgtcHaaHgacVaWtgttS
+cactaagSgttatcttagggDtaccagWattWtRtgttHWHacgattBtgVcaYatcggt
+tgagKcWtKKcaVtgaYgWctgYggVctgtHgaNcVtaBtWaaYatcDRaaRtSctgaHa
+YRttagatMatgcatttNattaDttaattgttctaaccctcccctagaWBtttHtBcctt
+agaVaatMcBHagaVcWcagBVttcBtaYMccagatgaaaaHctctaacgttagNWRtcg
+gattNatcRaNHttcagtKttttgWatWttcSaNgggaWtactKKMaacatKatacNatt
+gctWtatctaVgagctatgtRaHtYcWcttagccaatYttWttaWSSttaHcaaaaagVa
+cVgtaVaRMgattaVcDactttcHHggHRtgNcctttYatcatKgctcctctatVcaaaa
+KaaaagtatatctgMtWtaaaacaStttMtcgactttaSatcgDataaactaaacaagta
+aVctaggaSccaatMVtaaSKNVattttgHccatcacBVctgcaVatVttRtactgtVca
+attHgtaaattaaattttYtatattaaRSgYtgBagaHSBDgtagcacRHtYcBgtcact
+tacactaYcgctWtattgSHtSatcataaatataHtcgtYaaMNgBaatttaRgaMaata
+tttBtttaaaHHKaatctgatWatYaacttMctcttttVctagctDaaagtaVaKaKRta
+acBgtatccaaccactHHaagaagaaggaNaaatBWattccgStaMSaMatBttgcatgR
+SacgttVVtaaDMtcSgVatWcaSatcttttVatagttactttacgatcaccNtaDVgSR
+cgVcgtgaacgaNtaNatatagtHtMgtHcMtagaaattBgtataRaaaacaYKgtRccY
+tatgaagtaataKgtaaMttgaaRVatgcagaKStctHNaaatctBBtcttaYaBWHgtV
+tgacagcaRcataWctcaBcYacYgatDgtDHcctaaagacYRcaggattHaYgtKtaat
+gcVcaataMYacccatatcacgWDBtgaatcBaatacKcttRaRtgatgaBDacggtaat
+taaYtataStgVHDtDctgactcaaatKtacaatgcgYatBtRaDatHaactgtttatat
+DttttaaaKVccYcaaccNcBcgHaaVcattHctcgattaaatBtatgcaaaaatYMctS
+actHatacgaWacattacMBgHttcgaatVaaaacaBatatVtctgaaaaWtctRacgBM
+aatSgRgtgtcgactatcRtattaScctaStagKgaDcWgtYtDDWKRgRtHatRtggtc
+gaHgggcgtattaMgtcagccaBggWVcWctVaaattcgNaatcKWagcNaHtgaaaSaa
+agctcYctttRVtaaaatNtataaccKtaRgtttaMtgtKaBtRtNaggaSattHatatW
+actcagtgtactaKctatttgRYYatKatgtccgtRtttttatttaatatVgKtttgtat
+gtNtataRatWYNgtRtHggtaaKaYtKSDcatcKgtaaYatcSRctaVtSMWtVtRWHa
+tttagataDtVggacagVcgKWagBgatBtaaagNcaRtagcataBggactaacacRctK
+gttaatcctHgDgttKHHagttgttaatgHBtatHcDaagtVaBaRccctVgtgDtacRH
+SctaagagcggWYaBtSaKtHBtaaactYacgNKBaVYgtaacttagtVttcttaatgtB
+tatMtMtttaattaatBWccatRtttcatagVgMMtagctStKctaMactacDNYgKYHg
+aWcgaHgagattacVgtttgtRaSttaWaVgataatgtgtYtaStattattMtNgWtgtt
+KaccaatagNYttattcgtatHcWtctaaaNVYKKttWtggcDtcgaagtNcagatacgc
+attaagaccWctgcagcttggNSgaNcHggatgtVtcatNtRaaBNcHVagagaaBtaaS
+ggDaatWaatRccaVgggStctDaacataKttKatttggacYtattcSatcttagcaatg
+aVBMcttDattctYaaRgatgcattttNgVHtKcYRaatRKctgtaaacRatVSagctgt
+WacBtKVatctgttttKcgtctaaDcaagtatcSataWVgcKKataWaYttcccSaatga
+aaacccWgcRctWatNcWtBRttYaattataaNgacacaatagtttVNtataNaYtaatR
+aVWKtBatKagtaatataDaNaaaaataMtaagaaStccBcaatNgaataWtHaNactgt
+cDtRcYaaVaaaaaDgtttRatctatgHtgttKtgaaNSgatactttcgagWaaatctKa
+aDaRttgtggKKagcDgataaattgSaacWaVtaNMacKtcaDaaatttctRaaVcagNa
+caScRBatatctRatcctaNatWgRtcDcSaWSgttRtKaRtMtKaatgttBHcYaaBtg
+atSgaSWaScMgatNtctcctatttctYtatMatMtRRtSaattaMtagaaaaStcgVgR
+ttSVaScagtgDtttatcatcatacRcatatDcttatcatVRtttataaHtattcYtcaa
+aatactttgVctagtaaYttagatagtSYacKaaacgaaKtaaatagataatSatatgaa
+atSgKtaatVtttatcctgKHaatHattagaaccgtYaaHactRcggSBNgtgctaaBag
+BttgtRttaaattYtVRaaaattgtaatVatttctcttcatgBcVgtgKgaHaaatattY
+atagWacNctgaaMcgaattStagWaSgtaaKagttttaagaDgatKcctgtaHtcatgg
+KttVDatcaaggtYcgccagNgtgcVttttagagatgctaccacggggtNttttaSHaNt
+atNcctcatSaaVgtactgBHtagcaYggYVKNgtaKBcRttgaWatgaatVtagtcgat
+tYgatgtaatttacDacSctgctaaaStttaWMagDaaatcaVYctccgggcgaVtaaWt
+StaKMgDtttcaaMtVgBaatccagNaaatcYRMBggttWtaaScKttMWtYataRaDBM
+aDataatHBcacDaaKDactaMgagttDattaHatHtaYatDtattDcRNStgaatattS
+DttggtattaaNSYacttcDMgYgBatWtaMagactVWttctttgYMaYaacRgHWaatt
+gRtaagcattctMKVStatactacHVtatgatcBtVNataaBttYtSttacKgggWgYDt
+gaVtYgatDaacattYgatggtRDaVDttNactaSaMtgNttaacaaSaBStcDctacca
+cagacgcaHatMataWKYtaYattMcaMtgSttDagcHacgatcaHttYaKHggagttcc
+gatYcaatgatRaVRcaagatcagtatggScctatattaNtagcgacgtgKaaWaactSg
+agtMYtcttccaKtStaacggMtaagNttattatcgtctaRcactctctDtaacWYtgaY
+aSaagaWtNtatttRacatgNaatgttattgWDDcNaHcctgaaHacSgaataaRaataM
+HttatMtgaSDSKatatHHaNtacagtccaYatWtcactaactatKDacSaStcggataH
+gYatagKtaatKagStaNgtatactatggRHacttgtattatgtDVagDVaRctacMYat
+tDgtttYgtctatggtKaRSttRccRtaaccttagagRatagSaaMaacgcaNtatgaaa
+tcaRaagataatagatactcHaaYKBctccaagaRaBaStNagataggcgaatgaMtaga
+atgtcaKttaaatgtaWcaBttaatRcggtgNcacaaKtttScRtWtgcatagtttWYaa
+gBttDKgcctttatMggNttattBtctagVtacataaaYttacacaaRttcYtWttgHca
+YYtaMgBaBatctNgcDtNttacgacDcgataaSatYaSttWtcctatKaatgcagHaVa
+acgctgcatDtgttaSataaaaYSNttatagtaNYtaDaaaNtggggacttaBggcHgcg
+tNtaaMcctggtVtaKcgNacNtatVaSWctWtgaWcggNaBagctctgaYataMgaaga
+tBSttctatacttgtgtKtaattttRagtDtacatatatatgatNHVgBMtKtaKaNttD
+HaagatactHaccHtcatttaaagttVaMcNgHatatKtaNtgYMccttatcaaNagctg
+gacStttcNtggcaVtattactHaSttatgNMVattMMDtMactattattgWMSgtHBtt
+StStgatatRaDaagattttctatMtaaaaaggtactaaVttaSacNaatactgMttgac
+HaHRttgMacaaaatagttaatatWKRgacDgaRtatatttattatcYttaWtgtBRtWa
+tgHaaattHataagtVaDtWaVaWtgStcgtMSgaSRgMKtaaataVacataatgtaSaa
+tttagtcgaaHtaKaatgcacatcggRaggSKctDcagtcSttcccStYtccRtctctYt
+caaKcgagtaMttttcRaYDttgttatctaatcataNctctgctatcaMatactataggD
+aHaaSttMtaDtcNatataattctMcStaaBYtaNagatgtaatHagagSttgWHVctta
+tKaYgDctcttggtgttMcRaVgSgggtagacaataaDtaattSaDaNaHaBctattgNt
+accaaRgaVtKNtaaYggHtaKKgHcatctWtctDtttctttggSDtNtaStagttataa
+acaattgcaBaBWggHgcaaaBtYgctaatgaaatWcDcttHtcMtWWattBHatcatca
+aatctKMagtDNatttWaBtHaaaNgMttaaStagttctctaatDtcRVaYttgttMtRt
+gtcaSaaYVgSWDRtaatagctcagDgcWWaaaBaaRaBctgVgggNgDWStNaNBKcBc
+taaKtttDcttBaaggBttgaccatgaaaNgttttttttatctatgttataccaaDRaaS
+agtaVtDtcaWatBtacattaWacttaSgtattggDgKaaatScaattacgWcagKHaac
+caYcRcaRttaDttRtttHgaHVggcttBaRgtccctDatKaVtKtcRgYtaKttacgta
+tBtStaagcaattaagaRgBagSaattccSWYtttattVaataNctgHgttaaNBgcVYg
+tRtcccagWNaaaacaDNaBcaaaaRVtcWMgBagMtttattacgDacttBtactatcat
+tggaaatVccggttRttcatagttVYcatYaSHaHcttaaagcNWaHataaaRWtctVtR
+YtagHtaaaYMataHYtNBctNtKaatattStgaMcBtRgctaKtgcScSttDgYatcVt
+ggaaKtaagatWccHccgKYctaNNctacaWcttttgcRtgtVcgaKttcMRHgctaHtV
+aataaDtatgKDcttatBtDttggNtacttttMtgaacRattaaNagaactcaaaBBVtc
+DtcgaStaDctgaaaSgttMaDtcgttcaccaaaaggWtcKcgSMtcDtatgtttStaaB
+tatagDcatYatWtaaaBacaKgcaDatgRggaaYctaRtccagattDaWtttggacBaV
+cHtHtaacDacYgtaatataMagaatgHMatcttatacgtatttttatattacHactgtt
+ataMgStYaattYaccaattgagtcaaattaYtgtatcatgMcaDcgggtcttDtKgcat
+gWRtataatatRacacNRBttcHtBgcRttgtgcgtcatacMtttBctatctBaatcatt
+MttMYgattaaVYatgDaatVagtattDacaacDMatcMtHcccataagatgBggaccat
+tVWtRtSacatgctcaaggggYtttDtaaNgNtaaBatggaatgtctRtaBgBtcNYata
+tNRtagaacMgagSaSDDSaDcctRagtVWSHtVSRggaacaBVaccgtttaStagaaca
+MtactccagtttVctaaRaaHttNcttagcaatttattaatRtaaaatctaacDaBttgg
+SagagctacHtaaRWgattcaaBtctRtSHaNtgtacattVcaHaNaagtataccacaWt
+aRtaaVKgMYaWgttaKggKMtKcgWatcaDatYtKSttgtacgaccNctSaattcDcat
+cttcaaaDKttacHtggttHggRRaRcaWacaMtBWVHSHgaaMcKattgtaRWttScNa
+ttBBatYtaNRgcggaagacHSaattRtttcYgaccBRccMacccKgatgaacttcgDgH
+caaaaaRtatatDtatYVtttttHgSHaSaatagctNYtaHYaVYttattNtttgaaaYt
+aKttWtctaNtgagaaaNctNDctaaHgttagDcRttatagccBaacgcaRBtRctRtgg
+taMYYttWtgataatcgaataattattataVaaaaattacNRVYcaaMacNatRttcKat
+MctgaagactaattataaYgcKcaSYaatMNctcaacgtgatttttBacNtgatDccaat
+tattKWWcattttatatatgatBcDtaaaagttgaaVtaHtaHHtBtataRBgtgDtaat
+aMttRtDgDcttattNtggtctatctaaBcatctaRatgNacWtaatgaagtcMNaacNg
+HttatactaWgcNtaStaRgttaaHacccgaYStacaaaatWggaYaWgaattattcMaa
+ctcBKaaaRVNcaNRDcYcgaBctKaacaaaaaSgctccYBBHYaVagaatagaaaacag
+YtctVccaMtcgtttVatcaatttDRtgWctagtacRttMctgtDctttcKtWttttata
+aatgVttgBKtgtKWDaWagMtaaagaaattDVtaggttacatcatttatgtcgMHaVct
+taBtVRtcgtaYgBRHatttHgaBcKaYWaatcNSctagtaaaaatttacaatcactSWa
+cgtaatgKttWattagttttNaggtctcaagtcactattcttctaagKggaataMgtttc
+ataagataaaaatagattatDgcBVHWgaBKttDgcatRHaagcaYcRaattattatgtM
+atatattgHDtcaDtcaaaHctStattaatHaccgacNattgatatattttgtgtDtRat
+agSacaMtcRtcattcccgacacSattgttKaWattNHcaacttccgtttSRtgtctgDc
+gctcaaMagVtBctBMcMcWtgtaacgactctcttRggRKSttgYtYatDccagttDgaK
+ccacgVatWcataVaaagaataMgtgataaKYaaatcHDaacgataYctRtcYatcgcaM
+gtNttaBttttgatttaRtStgcaacaaaataccVgaaDgtVgDcStctatatttattaa
+aaRKDatagaaagaKaaYYcaYSgKStctccSttacagtcNactttDVttagaaagMHtt
+RaNcSaRaMgBttattggtttaRMggatggcKDgWRtNaataataWKKacttcKWaaagN
+aBttaBatMHtccattaacttccccYtcBcYRtagattaagctaaYBDttaNtgaaaccH
+caRMtKtaaHMcNBttaNaNcVcgVttWNtDaBatgataaVtcWKcttRggWatcattga
+RagHgaattNtatttctctattaattaatgaDaaMatacgttgggcHaYVaaNaDDttHt
+caaHtcVVDgBVagcMacgtgttaaBRNtatRtcagtaagaggtttaagacaVaaggtta
+WatctccgtVtaDtcDatttccVatgtacNtttccgtHttatKgScBatgtVgHtYcWag
+caKtaMYaaHgtaattaSaHcgcagtWNaatNccNNYcacgVaagaRacttctcattccc
+RtgtgtaattagcSttaaStWaMtctNNcSMacattataaactaDgtatWgtagtttaag
+aaaattgtagtNagtcaataaatttgatMMYactaatatcggBWDtVcYttcDHtVttat
+acYaRgaMaacaStaatcRttttVtagaDtcacWatttWtgaaaagaaagNRacDtttSt
+VatBaDNtaactatatcBSMcccaSttccggaMatgattaaWatKMaBaBatttgataNc
+tgttKtVaagtcagScgaaaDggaWgtgttttKtWtatttHaatgtagttcactaaKMag
+ttSYBtKtaYgaactcagagRtatagtVtatcaaaWYagcgNtaDagtacNSaaYDgatB
+gtcgataacYDtaaactacagWDcYKaagtttattagcatcgagttKcatDaattgatta
+tDtcagRtWSKtcgNtMaaaaacaMttKcaWcaaSVMaaaccagMVtaMaDtMaHaBgaa
+cataBBVtaatVYaNSWcSgNtDNaaKacacBtttatKtgtttcaaHaMctcagtaacgt
+cgYtactDcgcctaNgagagcYgatattttaaatttccattttacatttDaaRctatttt
+WctttacgtDatYtttcagacgcaaVttagtaaKaaaRtgVtccataBggacttatttgt
+ttaWNtgttVWtaWNVDaattgtatttBaagcBtaaBttaaVatcHcaVgacattccNgg
+tcgacKttaaaRtagRtctWagaYggtgMtataatMtgaaRttattttgWcttNtDRRgM
+DKacagaaaaggaaaRStcccagtYccVattaNaaKStNWtgacaVtagaagcttSaaDt
+cacaacgDYacWDYtgtttKatcVtgcMaDaSKStVcgtagaaWaKaagtttcHaHgMgM
+tctataagBtKaaaKKcactggagRRttaagaBaaNatVVcgRcKSttDaactagtSttS
+attgttgaaRYatggttVttaataaHttccaagDtgatNWtaagHtgcYtaactRgcaat
+gMgtgtRaatRaNaacHKtagactactggaatttcgccataacgMctRgatgttacccta
+HgtgWaYcactcacYaattcttaBtgacttaaacctgYgaWatgBttcttVttcgttWtt
+McNYgtaaaatctYgMgaaattacNgaHgaacDVVMtttggtHtctaaRgtacagacgHt
+VtaBMNBgattagcttaRcttacaHcRctgttcaaDBggttKaacatgKtttYataVaNa
+ttccgMcgcgtagtRaVVaattaKaatggttRgaMcagtatcWBttNtHagctaatctag
+aaNaaacaYBctatcgcVctBtgcaaagDgttVtgaHtactSNYtaaNccatgtgDacga
+VtDcgKaRtacDcttgctaagggcagMDagggtBWRtttSgccttttttaacgtcHctaV
+tVDtagatcaNMaVtcVacatHctDWNaataRgcgtaVHaggtaaaaSgtttMtattDgB
+tctgatSgtRagagYtctSaKWaataMgattRKtaacatttYcgtaacacattRWtBtcg
+gtaaatMtaaacBatttctKagtcDtttgcBtKYYBaKttctVttgttaDtgattttctt
+ccacttgSaaacggaaaNDaattcYNNaWcgaaYattttMgcBtcatRtgtaaagatgaW
+tgaccaYBHgaatagataVVtHtttVgYBtMctaMtcctgaDcYttgtccaaaRNtacag
+cMctKaaaggatttacatgtttaaWSaYaKttBtagDacactagctMtttNaKtctttcN
+cSattNacttggaacaatDagtattRtgSHaataatgccVgacccgatactatccctgtR
+ctttgagaSgatcatatcgDcagWaaHSgctYYWtatHttggttctttatVattatcgac
+taagtgtagcatVgtgHMtttgtttcgttaKattcMatttgtttWcaaStNatgtHcaaa
+DtaagBaKBtRgaBgDtSagtatMtaacYaatYtVcKatgtgcaacVaaaatactKcRgt
+aYtgtNgBBNcKtcttaccttKgaRaYcaNKtactttgagSBtgtRagaNgcaaaNcaca
+gtVtttHWatgttaNatBgtttaatNgVtctgaatatcaRtattcttttttttRaaKcRS
+tctcggDgKagattaMaaaKtcaHacttaataataKtaRgDtKVBttttcgtKaggHHca
+tgttagHggttNctcgtatKKagVagRaaaggaaBtNatttVKcRttaHctaHtcaaatg
+taggHccaBataNaNaggttgcWaatctgatYcaaaHaatWtaVgaaBttagtaagaKKt
+aaaKtRHatMaDBtBctagcatWtatttgWttVaaaScMNattRactttgtYtttaaaag
+taagtMtaMaSttMBtatgaBtttaKtgaatgagYgtNNacMtcNRacMMHcttWtgtRt
+ctttaacaacattattcYaMagBaacYttMatcttKcRMtgMNccattaRttNatHaHNa
+SaaHMacacaVaatacaKaSttHatattMtVatWgattttttaYctttKttHgScWaacg
+HtttcaVaaMgaacagNatcgttaacaaaaagtacaHBNaattgttKtcttVttaaBtct
+gctacgBgcWtttcaggacacatMgacatcccagcggMgaVKaBattgacttaatgacac
+acaaaaaatRKaaBctacgtRaDcgtagcVBaacDSBHaaaaSacatatacagacRNatc
+ttNaaVtaaaataHattagtaaaaSWccgtatWatggDttaactattgcccatcttHaSg
+YataBttBaactattBtcHtgatcaataSttaBtatKSHYttWggtcYtttBttaatacc
+RgVatStaHaKagaatNtagRMNgtcttYaaSaactcagDSgagaaYtMttDtMRVgWKW
+tgMaKtKaDttttgactatacataatcNtatNaHattVagacgYgatatatttttgtStW
+aaatctWaMgagaRttRatacgStgattcttaagaDtaWccaaatRcagcagaaNKagta
+aDggcgccBtYtagSBMtactaaataMataBSacRMgDgattMMgtcHtcaYDtRaDaac
+ggttDaggcMtttatgttaNctaattaVacgaaMMtaatDccSgtattgaRtWWaccacc
+gagtactMcgVNgctDctaMScatagcgtcaactatacRacgHRttgctatttaatgaat
+tataYKttgtaagWgtYttgcHgMtaMattWaWVtaRgcttgYgttBHtYataSccStBt
+gtagMgtDtggcVaaSBaatagDttgBgtctttctcattttaNagtHKtaMWcYactVcg
+cgtatMVtttRacVagDaatcttgctBBcRDgcaacKttgatSKtYtagBMagaRtcgBa
+ttHcBWcaactgatttaatttWDccatttatcgagSKaWttataHactaHMttaatHtgg
+aHtHagaatgtKtaaRactgtttMatacgatcaagDgatKaDctataMggtHDtggHacc
+tttRtatcttYattttgacttgaaSaataaatYcgBaaaaccgNatVBttMacHaKaata
+agtatKgtcaagactcttaHttcggaattgttDtctaaccHttttWaaatgaaatataaa
+WattccYDtKtaaaacggtgaggWVtctattagtgactattaagtMgtttaagcatttgS
+gaaatatccHaaggMaaaattttcWtatKctagDtYtMcctagagHcactttactataca
+aacattaacttaHatcVMYattYgVgtMttaaRtgaaataaDatcaHgtHHatKcDYaat
+cttMtNcgatYatgSaMaNtcttKcWataScKggtatcttacgcttWaaagNatgMgHtc
+tttNtaacVtgttcMaaRatccggggactcMtttaYMtcWRgNctgNccKatcttgYDcM
+gattNYaRagatHaaHgKctcataRDttacatBatccattgDWttatttaWgtcggagaa
+aaatacaatacSNtgggtttccttacSMaagBattacaMaNcactMttatgaRBacYcYt
+caaaWtagctSaacttWgDMHgaggatgBVgcHaDtggaactttggtcNatNgtaKaBcc
+caNtaagttBaacagtatacDYttcctNgWgcgSMcacatStctHatgRcNcgtacacaa
+tRttMggaNKKggataaaSaYcMVcMgtaMaHtgattYMatYcggtcttcctHtcDccgt
+gRatcattgcgccgatatMaaYaataaYSggatagcgcBtNtaaaScaKgttBgagVagt
+taKagagtatVaactaSacWactSaKatWccaKaaaatBKgaaKtDMattttgtaaatcR
+ctMatcaaMagMttDgVatggMaaWgttcgaWatgaaatttgRtYtattaWHKcRgctac
+atKttctaccaaHttRatctaYattaaWatVNccatNgagtcKttKataStRaatatatt
+cctRWatDctVagttYDgSBaatYgttttgtVaatttaatagcagMatRaacttBctatt
+gtMagagattaaactaMatVtHtaaatctRgaaaaaaaatttWacaacaYccYDSaattM
+atgaccKtaBKWBattgtcaagcHKaagttMMtaatttcKcMagNaaKagattggMagag
+gtaatttYacatcWaaDgatMgKHacMacgcVaacaDtaDatatYggttBcgtatgWgaS
+atttgtagaHYRVacaRtctHaaRtatgaactaatatctSSBgggaaHMWtcaagatKga
+gtDaSatagttgattVRatNtctMtcSaagaSHaataNataataRaaRgattctttaata
+aagWaRHcYgcatgtWRcttgaaggaMcaataBRaaccagStaaacNtttcaatataYta
+atatgHaDgcStcWttaacctaRgtYaRtataKtgMttttatgactaaaatttacYatcc
+cRWtttHRtattaaatgtttatatttgttYaatMcaRcSVaaDatcgtaYMcatgtagac
+atgaaattgRtcaaYaaYtRBatKacttataccaNaaattVaBtctggacaagKaaYaaa
+tatWtMtatcYaaVNtcgHaactBaagKcHgtctacaatWtaDtSgtaHcataHtactga
+taNctRgttMtDcDttatHtcgtacatcccaggSttaBgtcacacWtccNMcNatMVaVg
+tccDYStatMaccDatggYaRKaaagataRatttHKtSaaatDgataaacttaHgttgVB
+tcttVttHgDacgaKatgtatatNYataactctSatatatattgcHRRYttStggaactH
+gttttYtttaWtatMcttttctatctDtagVHYgMRBgtHttcctaatYRttKtaagatg
+gaVRataKDctaMtKBNtMtHNtWtttYcVtattMcgRaacMcctNSctcatttaaagDc
+aHtYccSgatgcaatYaaaaDcttcgtaWtaattctcgttttScttggtaatctttYgtc
+taactKataHacctMctcttacHtKataacacagcNRatgKatttttSaaatRYcgDtta
+MRcgaaattactMtgcgtaagcgttatBtttttaattaagtNacatHgttcRgacKcBBt
+VgatKttcgaBaatactDRgtRtgaNacWtcacYttaaKcgttctHaKttaNaMgWgWag
+gtctRgaKgWttSttBtDcNtgtttacaaatYcDRtgVtgcctattcNtctaaaDMNttt
+tNtggctgagaVctDaacVtWccaagtaacacaNctgaScattccDHcVBatcgatgtMt
+aatBgHaatDctMYgagaatgYWKcctaatNaStHaaaKccgHgcgtYaaYtattgtStg
+tgcaaRtattaKatattagaWVtcaMtBagttattagNaWHcVgcaattttDcMtgtaRH
+VYtHtctgtaaaaHVtMKacatcgNaatttMatatgttgttactagWYtaRacgataKag
+YNKcattataNaRtgaacKaYgcaaYYacaNccHatMatDcNgtHttRaWttagaaDcaa
+aaaatagggtKDtStaDaRtaVtHWKNtgtattVctSVgRgataDaRaWataBgaagaaK
+taataaYgDcaStaNgtaDaaggtattHaRaWMYaYaWtggttHYgagVtgtgcttttca
+aDKcagVcgttagacNaaWtagtaataDttctggttVcatcataaagtgKaaaNaMtaBB
+aattaatWaattgctHaVKaSgDaaVKaHtatatatHatcatSBagNgHtatcHYMHgtt
+DgtaHtBttWatcgtttaRaattgStKgSKNWKatcagDtctcagatttctRtYtBatBg
+HHtKaWtgYBgacVVWaKtacKcDttKMaKaVcggtgttataagaataaHaatattagta
+taatMHgttYgaRttagtaRtcaaVatacggtcMcgagtaaRttacWgactKRYataaaa
+gSattYaWgagatYagKagatgSaagKgttaatMggtataatgttWYttatgagaaacct
+NVataatHcccKtDctcctaatactggctHggaSaggRtKHaWaattcgSatMatttaga
+ggcYtctaMcgctcataSatatgRagacNaaDaggaVBagaYttKtacNaKgtSYtagtt
+ggaWcatcWttaatctatgaVtcgtgtMtatcaYcgtRccaaYgDctgcMgtgtWgacWt
+gataacacgcgctBtgttaKtYDtatDcatcagKaVMctaatcttgVcaaRgcRMtDcga
+ttaHttcaNatgaatMtactacVgtRgatggaWtttactaaKatgagSaaKggtaNtact
+VaYtaaKRagaacccacaMtaaMtKtatBcttgtaaWBtMctaataaVcDaaYtcRHBtc
+gttNtaaHatttBNgRStVDattBatVtaagttaYatVattaagaBcacggtSgtVtatt
+taRattgatgtaHDKgcaatattKtggcctatgaWDKRYcggattgRctatNgatacaat
+MNttctgtcRBYRaaaHctNYattcHtaWcaattctBtMKtVgYataatMgYtcagcttM
+DataVtggRtKtgaatgccNcRttcaMtRgattaacattRcagcctHtWMtgtDRagaKa
+BtgDttYaaaaKatKgatctVaaYaacWcgcatagBVtaNtRtYRaggBaaBtgKgttac
+ataagagcatgtRattccacttaccatRaaatgWgDaMHaYVgVtaSctatcgKaatata
+ttaDgacccYagtgtaYNaaatKcagtBRgagtccatgKgaaaccBgaagBtgSttWtac
+gatWHaYatcgatttRaaNRgcaNaKVacaNtDgattgHVaatcDaagcgtatgcNttaD
+ataatcSataaKcaataaHWataBtttatBtcaKtKtatagttaDgSaYctacaRatNta
+WctSaatatttYaKaKtaccWtatcRagacttaYttVcKgSDcgagaagatccHtaattc
+tSttatggtKYgtMaHagVaBRatttctgtRgtctatgggtaHKgtHacHtSYacgtaca
+cHatacKaaBaVaccaDtatcSaataaHaagagaatScagactataaRttagcaaVcaHa
+taKgDacatWccccaagcaBgagWatctaYttgaaatctVNcYtttWagHcgcgcDcVaa
+atgttKcHtNtcaatagtgtNRaactttttcaatggWgBcgDtgVgtttctacMtaaata
+aaRggaaacWaHttaRtNtgctaaRRtVBctYtVtatDcattDtgaccYatagatYRKat
+NYKttNgcctagtaWtgaactaMVaacctgaStttctgaKVtaaVaRKDttVtVctaDNt
+ataaaDtccccaagtWtcgatcactDgYaBcatcctMtVtacDaaBtYtMaKNatNtcaN
+acgDatYcatcgcaRatWBgaacWttKttagYtaattcggttgSWttttDWctttacYta
+tatWtcatDtMgtBttgRtVDggttaacYtacgtacatgaattgaaWcttMStaDgtata
+ttgaDtcRBcattSgaaVBRgagccaaKtttcDgcgaSMtatgWattaKttWtgDBMagg
+BBttBaatWttRtgcNtHcgttttHtKtcWtagHStaacagttgatatBtaWSaWggtaa
+taaMttaKacDaatactcBttcaatatHttcBaaSaaatYggtaRtatNtHcaatcaHta
+gVtgtattataNggaMtcttHtNagctaaaggtagaYctMattNaMVNtcKtactBKcaH
+HcBttaSagaKacataYgctaKaYgttYcgacWVttWtSagcaacatcccHaccKtctta
+acgaKttcacKtNtacHtatatRtaaatacactaBtttgaHaRttggttWtatYagcatY
+DatcggagagcWBataagRtacctataRKgtBgatgaDatataSttagBaHtaatNtaDW
+cWtgtaattacagKttcNtMagtattaNgtctcgtcctcttBaHaKcKccgtRcaaYagS
+attaagtKataDatatatagtcDtaacaWHcaKttDgaaRcgtgYttgtcatatNtattt
+ttatggccHtgDtYHtWgttatYaacaattcaWtatNgctcaaaSttRgctaatcaaatN
+atcgtttaBtNNVtgttataagcaaagattBacgtDatttNatttaaaDcBgtaSKgacg
+tagataatttcHMVNttgttBtDtgtaWKaaRMcKMtHtaVtagataWctccNNaSWtVa
+HatctcMgggDgtNHtDaDttatatVWttgttatttaacctttcacaaggaSaDcggttt
+tttatatVtctgVtaacaStDVaKactaMtttaSNagtgaaattaNacttSKctattcct
+ctaSagKcaVttaagNaVcttaVaaRNaHaaHttatgtHttgtgatMccaggtaDcgacc
+gtWgtWMtttaHcRtattgScctatttKtaaccaagtYagaHgtWcHaatgccKNRttta
+gtMYSgaDatctgtgaWDtccMNcgHgcaaacNDaaaRaStDWtcaaaaHKtaNBctagB
+tgtattaactaattttVctagaatggcWSatMacccttHttaSgSgtgMRcatRVKtatc
+tgaaaccDNatYgaaVHNgatMgHRtacttaaaRtatStRtDtatDttYatattHggaBc
+ttHgcgattgaKcKtttcRataMtcgaVttWacatNcatacctRataDDatVaWNcggtt
+gaHtgtMacVtttaBHtgagVttMaataattatgttcttagtttgtgcDtSatttgBtca
+acHattaaBagVWcgcaSYttMgcttacYKtVtatcaYaKctgBatgcgggcYcaaaaac
+gNtctagKBtattatctttKtaVttatagtaYtRagNtaYataaVtgaatatcHgcaaRa
+taHtacacatgtaNtgtcgYatWMatttgaactacRctaWtWtatacaatctBatatgYt
+aagtatgtgtatSttactVatcttYtaBcKgRaSggRaaaaatgcagtaaaWgtaRgcga
+taatcBaataccgtatttttccatcNHtatWYgatHSaaaDHttgctgtccHtggggcct
+aataatttttctatattYWtcattBtgBRcVttaVMRSgctaatMagtYtttaaaaatBR
+tcBttcaaVtaacagctccSaaSttKNtHtKYcagcagaaaccccRtttttaaDcDtaSt
+atccaagcgctHtatcttaDRYgatDHtWcaaaBcWgKWHttHataagHacgMNKttMKH
+ccaYcatMVaacgttaKgYcaVaaBtacgcaactttMctaaHaatgtBatgagaSatgta
+tgSRgHgWaVWgataaatatttccKagVgataattWaHNcYggaaatgctHtKtaDtcta
+aagtMaatVDVactWtSaaWaaMtaHtaSKtcBRaNcttStggtBttacNagcatagRgt
+KtgcgaacaacBcgKaatgataagatgaaaattgtactgcgggtccHHWHaaNacaBttN
+KtKtcaaBatatgctaHNgtKcDWgtttatNgVDHgaccaacWctKaaggHttgaRgYaa
+tHcaBacaatgagcaaattactgtaVaaYaDtagattgagNKggtggtgKtWKaatacag
+DRtatRaMRtgattDggtcaaYRtatttNtagaDtcacaaSDctDtataatcgtactaHt
+tatacaatYaacaaHttHatHtgcgatRRttNgcatSVtacWWgaaggagtatVMaVaaa
 >THREE Homo sapiens frequency
+ggtattttaatttatagtcgatagtaccaacaacaagcacaatcataattatgttagaaa
+acccagggggtaatgctctaaatccagctttaaggccagagtgcactatgaaatcgccat
+tgatcattgtgtcattcgctgaacttggtgtctaggaggtgccgagtgagaatatcagat
+accttatgaagcaacgattatatctggactagatcatgatgatcggaataaaacattgaa
+ataagtccttatcaaggagcataaacattttatttaatttatacttcgtaaataaattca
+gaattttttttcaagacattaatctgagtaaatgacggctagaaagggttcctactcgaa
+tcgtagcctacgcatgtgggcagtaacctggcttgcgtttttactgaaacaaaggttcac
+cggaaagaaggctgccacttttagcttcttgacgatctttagcgtcatatttttagatta
+gtcgaaaaacggaaaacaaacttaacgaagctggttgcacggggtaccgagaaaccaaag
+agcaggacaactccttgatcgggaagaactgaaatagacagctgtcattttcattggtca
+acttatcaatataacgaccaccgtagtgacgcttgcatgaaaatactgaggatgtaaact
+atagccagtcaggcccgcgtgttgactaattgatgaagcaaacaaaatagccggtattcg
+ttaaaaggaacgggttgccagctacagatatactctaggtatatcccaaacaagagacgt
+cctttggctgttgtaatcggtcataatacttgtcacataaacaagatcgctgaattaaac
+attaaacagttagtgatacacaatcgtggttggggctgggatgtgcaataaaaagtcatc
+tatcgtctatcacagagcgacgtaaatttagacaaacattattatttcttgacaatggaa
+tcgataagcgttcctctaacttggtatatatatctcgaccccgggattccagccattctt
+gtatgaagatttaaccatttaactatgcatagttgaatggtaaggaaaatgatattgact
+gcaacagattttggatgcaaaaatatttgtgaattattggttatatactggttgtatagc
+acaatcattaggtcctagaaggcatactcaacctcagcgagagagctagcatgcataatt
+gtaccgcccatattaatattcctgaaatgatttcttacattacgcccaatttcagtcatc
+gaacacccccatcaatttacccgatagagaacgtgatcatacgcaataccctatgcgaac
+gtccactctatagcgtctgtatacaatgattattcgttccatttacaacgttaagtaatt
+taaacttacataaggacaaggaaatccgcgaacctcctggaatgtatgagttatttatgc
+agttaacttcgtctcgaccggaactaaaggcgtcgtacgaatgaaaggccacttttagaa
+gagacctttgtatccattgtggagaatatcataaattcaagatggggtgtcatgctattc
+ggtcctaaacattcttaatggctgttctattgttagtctgatttaaaatggaaccatagc
+acgaatagttagatagggctcatacccctgtaacgatctacaaatccttccccgggtgtg
+tgcgttagcgacggaaagttttacggtttgtgatcaaagaacactcacacgtcagattat
+tacactgatacgaattatttcagtcgacagtaattgaatagaaacttattaacgccagca
+cctgacacggtaagtaaggcaggtctgaactgtttgactgtaaaaaaatggtaatatttt
+taaaaatcttgatttctatatcaaatgatgtgtagttttttctctgttattaaaatccca
+gtgcgcgaaatttagatcgttacgactcacgtacaagatcacacatcacacgcgttagcg
+aaagcggaatggctaatacagccctacgcaacgtagtgggatcaacatatggacgaattt
+atgctcaatgagccaacctcccccgcattgcggttcattttaaggcctgggtaacatcta
+tcgtttagataatcaaaggaatccgactatgcaattgtctgacttcatccgctctcaagt
+ccaatgcaggcgctacgtgtttctttaatcaataccatattgaaatcgtaatacgataat
+tgttgctattgactacaggttatgaaaaaacttactttgcgggtacatgcatatttttgt
+accacattattacgcgatatctctcagtgtactctaaattaaaccctcttcgaacatttt
+agttcctattcgtaaacacgtgctacgcggcaatttgccggtcgtagaatggacaactcc
+agttcaactgcatgtaactcatagctcgcgttagtataaattgactagtagccatgggac
+aaagtaactagtcagcggaaaagatccctttaaagatatatgcaggttgcaagcataaag
+ctcattgctcgaggtgcaccgtggtattccaaaagcgtctctatcgtatcttctaatttt
+gggccgtgagaatcgaaactactctgatttgctgcacacgttaggtaatatcgcccattt
+tcccgtataagctccgtacttatacgaactacacgaccttttaagcattagccgctcata
+tcgtgattcgtgtacagatgagtctattaaaattacagacatactccatatctcgctcct
+tgaactttgaataatgcgctaacttgtactatgaataggcagaacccaactttcccgttt
+gcgtcaagcggggaaacgatacatgttgtcagatttatgattatctagttttagatcacg
+tttaccgataatcggctgtggtctgagcagtcctacactgagtatttacttcagcttcat
+atcggtccgaaaaaaggttgtgaccgaatgtcaaaatacggagtacgatgggcatctttt
+ttcgagtcgcggttgcagggcagcaaaaggcttaaaccatttttacgatttttactatag
+cggtcatgaagtgcgaaactgcttgcaaattttctacacacattgtggctcttgtccttg
+aagcttatggcgaaaatttgaaacatagtataccagggaaagcgcgaattatttggtgac
+taatagtccgtgggtttgagccatatacctaacgccataaactacgtggtgctttagatg
+caatctaaacagaacagaaagcgtagcgctcatcagcacagactaactttttcagtttga
+gtcgccggagggacttcgagacaagaacgcgtcaagtcgcttgcgcggcacggattcgat
+tgggcggctcaatcttgcctaatttctactattgtcagctgtacgactgtactaagtgta
+tagccccaaataaaagaagtatcgatgcgtctttatgaccaaaggtcttataattgaagc
+gcacttccgttcatcaaattaaatcctggcttacccgattctccggaagtctgacctaga
+gattgacgacggccgcgtattattgagacctcttcaggattaatcaataacgaagtagtt
+gatctgtttggcgacgtaccttaagccgactccgctacacgagtttctactaaaccaatg
+tagccttatgcttagatgaataccgtcctaattagatattccggcataacagcagtaaat
+tatctgttcaatggacgaacattgaattgttagtattctacacaagtcaggcctcgtaaa
+tattaggtaaggccgtgggataacctacgtgatatgcttgagcttgcgttgcaagctctc
+gttaatcattaatttaggtgcgtgagggttaaacaccagcatattctatatgctagacgt
+cttccttaaaggatcgtagtattataattaataataagaaatatggttgacgtctagtca
+gcgggcatacgctgctctatatactggcattattcaaaacttgacggtaaaaaaacgaat
+tttaaggcgctcacgtcgaatgagccgaactcatgggaaccaaaatgtcacagaaaacac
+ctctttattgccaagcatgcaataaaaaaaatgttaatagtacgtttacgacattttatt
+ttataataaagagaaactattacacctattgatatgataggacgtaaattaacgagtagc
+ctgcatagaggcaaatgaggtttctacatggtatagacctgatgctgaaacatcgatgag
+ttttggtcccctcgctcgttgaaatctagtcatttactactgtctttcgagctattatac
+cacttcactatgtggtgtttctttgctatgtatggggctagtcaaacatgatgactatag
+ctacaactcagagagcgggcgtgttaagagtatctcatgctagaactgcacgacgaactt
+gatacaaagtaacaacatttacgattccacaaggtgactttgaagaaacatagtttaatt
+ctctgcttcgatcatttctataaaccggtaccatcgcagcggatagatgcataacatttc
+tactactccaggcatcttaaaacacacgtagtacttcactagattaagacacgataagtg
+tataacttggcagtgggaagcaaggagattggcgaactcctggcatctgttacgttttgt
+tcaggctcggttgttgataatgtccgactcctgccatattgaagactcgctcgagggaga
+tcgggattcgttgattataagtacacgtgttccgtaatactatgaggcagtgattcaaaa
+tggcacttctgacttacatgactaggtattattaccacggaagcgttaaaggcacactct
+tatggacttaagattgcaagtgccttcttctagcctgaattcgcgggttcaacacaaact
+ctctttagacatccgttgcctaaaggctgagacgtaggggcaaccctttaactatgtact
+aaaaaactagttggtaatttaacaacgtgtccaatcaagacgatgcaccaacgcggtgcg
+aaaatcgggttaagcaaacacaaataggaattgtgataaaccccaccttgagaggtcgca
+agaccaacctcgggaacaacggctctaagagaataacctaaatccggatgagtagactgt
+gtaactctctaaagggaagtgaaaaaaagctaagcatacatttaggtctcctgcattgca
+ttcaattgaatcgtttgtattatgagctgtacagtagctatatcagctatagttatccca
+gaggaacaggtaaactagctctgagcgtgaaatccggatattagaacccctagatgggat
+tgattctagctaatacaggcttatctggttttacagttatctagatgattggtaaggtga
+aacgcttggtgccttccaccacttaaacaaaagtattgcccgggaagctattttctaggt
+attataaagtcgagcattaatatcaatttgacagtaaaggtctttcaccagcttcatatg
+ccatagggcccatactcgatttaaattgaacggtttaacgagtattggaactctcactta
+taactgagtagctatacgaaaaatctggtccatttccagaaatttattatcgatttgctg
+cttagtacccaggaagtgataacccttgaaggcacaacactgtaataagttttcctgtca
+catctgtaatattcggtcactacgcattcacgactaaagataattactatactaattaaa
+agttcaatgttagggccgaatcatagtagaaattctcgtctagcctaatcggacttacct
+atgggctgtgaggatttatcagtatgtggacaaaaatgctagagataggtatagttaaag
+tcaccatggtacatctatgtgaggaagtttgtagttcgcttctttagtccgggcgtttgg
+gatgacaactactatacgtagagccgtactcaggattagatagtgtgaaagagtcaaata
+aaagggttaatattaatttaacgttgcaaatgtgtttaggccaaacattaaccgttgtag
+ggatattctaatacaggccttcaccgaaccctaatgataatctgtcttaataacattaaa
+tgattgtctccgctacgagctcttagggcctcattttaaatgactaatgtccaaagaaga
+gactttcccaatttcaatctgtcacgtatagacggcaccttagtgagtcatatcattaag
+atagaagattatcaggagggaagtttctattatcaaccgttacgcaaccataaactttta
+aatctcataatggcattgagatcaagagctttcatgatggtaaagttcgtatgtgatgct
+ggggagctagatatcggtataccacttcggttgtggtaagcccgagtgggccgttagtaa
+tattaatagacgattatccgacaatgcattcgctgaaataatcttacttaggagaaatta
+atgctatgagccaaaactatttatgtctgtcacattattgactaaagtatctatcgacaa
+aactgatgtccataagttgtagcagatagtcggtgtatggtgtcaccaatgaaaacctcg
+agcgaaaaatgaattatagttatccaatttgagtaaattgcctattatacagataggctt
+gtttagtcagataaggttccgcttgaggtgctctaacttagcgagagttagaaagcctag
+tgagaggcattttggtgccaaactccggctcgcatgagtaggccagagagtcactttctt
+tcgtcgaagaagttggtgaacagccttttgattagttgtttgtcttgtggctatgtgcta
+ctatataagttagaacgcaaactaatctaatcagcaaagtaaaataggaccttgaacgag
+acggggtacgccgttgaggctcgagatagtagataaactagaggaatgtagataaaacat
+tagctagggggtttagttactggattacataggaagtgcaccatcacggtgtgggggttc
+gtacgtaaagtcgcatcaatattgtcagtggacttaacaagttcgtgcataatgaaatcc
+tatacggactttgcatatctctaccgactcatctggtcgtctatgcgggtaattgtattg
+ctccaagtggatgactattttggcgtcccagcacatagtaaatgtaaatccttataatag
+cataagcaattattagactgcgtgaagtcttagtagttctcaagctttacgttgtatgta
+aataactcacgtaatcagccgtccccaaatcaccattgaggtcattgaatgtacggagca
+ctattatcaatgcggtatgcgattttctgagcgattattgttaaagacttagcgttgagc
+cccggaacacttgattacagattctttaaggagttatccaaatatcattttaaataatag
+tagtatcgtgctttggacaataaaaaaagacccgttctcttatgttgttttgcgacgtac
+ttctctgatatatacttcaactatgaagattctattcatcgataacccaggtatatttat
+atgcccgttcactgcgcagggcaaattatctacggacaataatgacgtagttggacccgg
+taagaactaacgcttaatatgattaaggatgtatgccagtattatcttattatgtcagag
+tagaagtttctctgagattttccgtcgttgtggtacaccggatttggctctctttttaga
+actgagaactcggagtgtgtagtcttgtttccttcaatttatcaatatgcttttataccg
+ccctcatcaactataacaggacgacaagttccgtcttgctccatcatatactaccgatac
+accaatcgtatcaagtttagtatacttgctttctctcttctacagcttactcgcttgtcc
+gagaagcggttggtgctcataaagttagtagtaaatgtacaactagtagccagtccttac
+ctgtttttacgactactacggacaccatgagatacagaagttagtgctacaattatacca
+ttacatgctcaatatcgttgtcggccataagatcgaagagtgcatcacgcgtgtgaatac
+gtaaaatctaccatcccgtcaatgcacaaaaacacactccccttgttgactaacatcttt
+tacaagaggctaaatcattgtccaggatcgaataccttgtgtacaatcgtcacccatcgg
+aagaataccacttttccgatgtagtatgatttacaaaaaacatctatgtgagtaggccaa
+ttgtagtagaatatattcatttgaccgtcattagccttcttcttaggttgtgtacggata
+gtaggtacataaaccgtcgtgtggcatacgctgcgatttcatacagctgccaacaccttt
+tttaccaggctagagtcagaaaagttggagccatgttaaatagttaccatcataaaccac
+tgttgtctactagtctgatcagctttcatgcctgtgcaagcaatatggattctcacgtaa
+tggtaacaactgttgcgttacttaggctggttaatttgtcagagtaataaatacatgtct
+tgttgtgtttcctaatcctcggaaagtacacaagcctaggaataggaaaagtaaagctct
+tttattctgatagtgactaactcaggatctaaatacgcgattatactaaccttcaccaaa
+gctcaaaaatcatctgctggtgaccagttatagacagggtaattcaatatttaatgtctc
+ccttaacatttcaccagcatggattgaagatagtataaagttttacatggcagtcattgt
+gtcacggttctatacaaattctgatagttagacggtatttgaaatgtgcttctagcatgg
+tatcttacacaactgaatgaacgactggagccgttcgtatactatttgcgagcctcgaga
+ccccgtttcctaatgttaacgaatatagtataatataaattgtgatatgaataacacaag
+taactacagtttggacaattaattgttctaaactaaaaatcattcacttcagatggcata
+gagttatggctactacacatataaagcggtatgtgaaacacccgttttagccggaaaccc
+tctactgctcgggacaatgaatgatttccaaaatatggatgtgcagaattgttagtgtga
+ctcaggtccaaatagacactttagtttcgtcaagtcgttgcaaagtttaaaaccatcgca
+gcattctttatttggtctacattgagaaatgaaaaaacgtgacagaaagtctagaagaac
+tgtgaataatgtctattactgattaactagtaagacattagtgcatctggtccactgaag
+cacccgcttggcgttaggcaatctctgtgaactgtcgtggctgttccggtaatgtacgaa
+agcaagcctataggttgatcgagtcgcttcattaaggtcaatttcacaatatccgatcac
+attgtgctaggttcgtcctttaccttgcttagtgctgcatgtacggggtgtcatgacttg
+ttatcggcagactctttatcccaagaatggataatatgtacatggaaagtgtccataatt
+aagtcccttcactgtaaagaatgactgccacgtgatccatgaggtctacagaaaccgact
+tacttgctttttgatcaacttaattatggattcataaagttcagatatcggtacaattgg
+tgtacaatatgaaattaatgaggaaacatggaaatctgaatgacagtgatagaaaagatc
+cccatttgcccggtcagttcatgttacaccactcattagtactgtaagtgtttcgtcagc
+attgagatccacgatcatgtgtttatgccttcgaaactggatgtacgacgatcgagacga
+agaggtatatataacctaaatactaggtacgttgttagagagacgatgaaaattaatcgt
+caatacgctggcgaacactgagggggacccaatgctcttctcggtctaaaaaggaatgtg
+tcagaaattggtcagttcaaaagtagaccggatctttgcggagaacaattcacggaacgt
+agcgttgggaaatatcctttctaccacacatcggattttcgccctctcccattatttatt
+gtgttctcacatagaattattgtttagacatccctcgttgtatggagagttgcccgagcg
+taaaggcataatccatataccgccgggtgagtgacctgaaattgtttttagttgggattt
+cgctatggattagcttacacgaagagattctaatggtactataggataattataatgctg
+cgtggcgcagtacaccgttacaaacgtcgttcgcatatgtggctaacacggtgaaaatac
+ctacatcgtatttgcaatttcggtcgtttcatagagcgcattgaattactcaaaaattat
+atatgttgattatttgattagactgcgtggaaagaaggggtactcaagccatttgtaaaa
+gctgcatctcgcttaagtttgagagcttacattagtctatttcagtcttctaggaaatgt
+ctgtgtgagtggttgtcgtccataggtcactggcatatgcgattcatgacatgctaaact
+aagaaagtagattactattaccggcatgcctaatgcgattgcactgctatgaaggtgcgg
+acgtcgcgcccatgtagccctgataataccaatacttacatttggtcagcaattctgaca
+ttatacctagcacccataaatttactcagacttgaggacaggctcttggagtcgatcttc
+tgtttgtatgcatgtgatcatatagatgaataagcgatgcgactagttagggcatagtat
+agatctgtgtatacagttcagctgaacgtccgcgagtggaagtacagctgagatctatcc
+taaaatgcaaccatatcgttcacacatgatatgaacccagggggaaacattgagttcagt
+taaattggcagcgaatcccccaagaagaaggcggagtgacgttgaacgggcttatggttt
+ttcagtacttcctccgtataagttgagcgaaatgtaaacagaataatcgttgtgttaaca
+acattaaaatcgcggaatatgatgagaatacacagtgtgagcatttcacttgtaaaatat
+ctttggtagaacttactttgctttaaatatgttaaaccgatctaataatctacaaaacgg
+tagattttgcctagcacattgcgtccttctctattcagatagaggcaatactcagaaggt
+tttatccaaagcactgtgttgactaacctaagttttagtctaataatcatgattgattat
+aggtgccgtggactacatgactcgtccacaaataatacttagcagatcagcaattggcca
+agcacccgacttttatttaatggttgtgcaatagtccagattcgtattcgggactctttc
+aaataatagtttcctggcatctaagtaagaaaagctcataaggaagcgatattatgacac
+gctcttccgccgctgttttgaaacttgagtattgctcgtccgaaattgagggtcacttca
+aaatttactgagaagacgaagatcgactaaagttaaaatgctagtccacagttggtcaag
+ttgaattcatccacgagttatatagctattttaatttatagtcgagtgtacaaaaaacat
+ccacaataagatttatcttagaataacaacccccgtatcatcgaaatcctccgttatggc
+ctgactcctcgagcttatagcatttgtgctggcgctcttgccaggaacttgctcgcgagg
+tggtgacgagtgagatgatcagtttcattatgatgatacgattttatcgcgactagttaa
+tcatcatagcaagtaaaatttgaattatgtcattatcatgctccattaacaggttattta
+attgatactgacgaaattttttcacaatgggttttctagaatttaatatcagtaattgaa
+gccttcataggggtcctactagtatcctacacgacgcaggtccgcagtatcctggaggga
+cgtgttactgattaaaagggtcaaaggaatgaaggctcacaatgttacctgcttcaccat
+agtgagccgatgagttttacattagtactaaatcccaaatcatactttacgatgaggctt
+gctagcgctaaagagaatacatacaccaccacatagaattgttagcgatgatatcaaata
+gactcctggaagtgtcagggggaaactgttcaatatttcgtccacaggactgaccaggca
+tggaaaagactgacgttggaaactataccatctcacgcccgacgcttcactaattgatga
+tccaaaaaatatagcccggattcctgattagcaaagggttcacagagaaagatattatcg
+acgtatatcccaaaaaacagacgtaatgtgcatcttcgaatcgggatgaatacttgtatc
+ataaaaatgtgacctctagtatacaggttaatgttagtgatacacaatactcgtgggcca
+tgggttctcaaataaaatgtaatattgcgtcgatcactcacccacgtatttggtctaatt
+atgttttatttagtgacaatccaatagataaccggtcctattaagggctatatttttagc
+gaccacgcgtttaaacaaaggattgtatgtagatggtaccagtttaattgccagtgggca
+atcctaagcaaaatgagattctatcctaaagtttgggcttgatataagatttcggatgta
+tgggttttataatcgttggagagctcaatcatgagctaatacatggatttcgctacctca
+ccgagagaccttgcatgaagaattctaaccaaaagtttaataggccggattggattgagt
+taattaagaccttgttcagtcatagtaaaaacccttaaattttaccgattgacaaagtga
+gcagtcgcaataccctatgcgaaacgcctcgatagtgactaggtatacaaggtttttgag
+ttcctttgaaatagttaactaatttaaaattaattaacgacatggaaatcacagaaccta
+atgctttgtaggagttatttatgctgtttactgcctctacaaccctaataaagcagtcct
+aagaatgaaacgcatcttttagttcagaaagtggtatccagggtggtcaatttaataaat
+tcaacatcgggtctcaggatattcggtcatataatttattaagggctcttcgagtcttac
+tctgagtgaaattggaaacagtcatccttttcgttgtgaggcatcttacaccgctatcga
+tatacaatgcattccaccgcggtgtcccgtacacaaggaaacttgttaccttggggatat
+aagaaaactcacacgtctcattattaaactgagtacaatttttgcacgagaaagtaatgc
+aatacaatatgatgaaagccagctaatgaaaagggatggaacgcacctcggatctgttgc
+actggattaaaatccgattatttttaaaaatattcagtgctagagcatatcaggtctact
+tttttatctggtatgtaaagcccacggagcgatagtgagatccttacgactcaacgaaaa
+gttataacataactcccgttagccaaagcccaatcccgattactgccctaccctaacgtc
+tgccatctaaatatcgaacttgttatgatcaatgtgactacctcccaccctttccccttc
+atttgttccactggggataagctagcgttttcagaatcaatgcaataagaatagccaatt
+gtctcacttcatcagagctcttggcaattccaggcgctacgtggttctggaatatattca
+tttttcaaatagtaatacgtttagtgttgctattgtctacacgtttggatattacgttat
+gtgagcggacatcaatagttgtctaactctttagtaagccagagatagcactcttagcga
+atggataccatcttccataagtttagttaatagtccgaaacaactgcttcgagcatattt
+gaacctccttgtaggcaaatagcctcttcaaagcaatcttactaatagatagagtttgtt
+ttaagggactactagaaatgggacaatcttaatagtatgacctaaactgacatttaaaga
+tatatccaggtggcaagcataaagatcattgcgccacctccaccgtgggattacttatca
+gtcgatatcctatatgctaagtttgcgacggcagaatacaaactaagctgagttgatgct
+aaccttacctatgataccccattggaccggttaacagccctacttattccaaataaaaga
+acttttatgctgtagaagctattatagtgatgcctggtaacttcagtatattaaaatgac
+acacatacgccatatagagctcctggaactttgaataatgagcgaacttcgaagttgaag
+agcaagaaaccatatgtcacggttgcctaaagcccggtaaccagacatgtgctatcattg
+atcattatcgaggttttcataaccttgacccattatcggctgtgcgcggacaagtactta
+aatcactagtttcttcacctgcttatcggtaagaaataaggttggcaaagaatcgcataa
+gacggacgtagagccgcagcgttgtgcgagtccaggtgcatgcgcagcaataggatttta
+aattttgttccatttttaatttagccgtaaggatgtccgtaaatgattgaaaattggatt
+caatctttgggcctatgctactggaacctgatcgacaaaatttcaaacatacgttaactc
+cgaaagaccgtatttttgcggctagaatagtcagtcgcttggagccatataccttaccac
+ttaaacgacgtgctcctgtagttgaaatataaacagaacacaaagactaccgatcatatc
+aactgaagatctttgtaactttgaggcgaagcaccctcttcgagacaactaagagtaaag
+taccgggcgccgcaaggagtcgattgggaccctaaatcttgacgaattgctaagaggctc
+agagctaccactgtaatttctctagagcccataataaatgaacgatacatccgtaggtag
+cacctaagggattataatggaagccaaatgcagttaataatattatatactggcgtacac
+gattcgacggatctctcacatagtgattcacgacccccccctttgattgacacagcgtca
+gcattttgcaagaacgatcttctgcatagggtgcgccaccgtaaggatgacgtcgaagct
+acaactgggtataatttaccatgcttccctgatgctgagtgcaatacactaagaatgagt
+ttttaccccatatcaccagtatttgttctgttattgcgaagaaatggctatgctgagttg
+gcgactaaagtcacccatcctttttattaggtaaccccctcccttaaactaactgatttg
+ctggagctgccctgcatacatatactttatcatttatggacgtccgtgacgcttattatc
+caccatagtcgatatgctacacggattcattaatggatcgtaggagtttaagttatattt
+actaagatcggtctcggctactatcccgccttacccggcgctatttacggccatttttaa
+tatattgacggtaattattcctatggtttcgaccgcacgtccttggacaagaaagaatgg
+caaaaaaaatgtaaaagaaaaaaaatattgagtccctaccatcatataaaaaatatgtga
+tgagtaacttgacgaaatgttagtggttattaaagactatctattacaccttttgttttc
+tgtcgtagtatattaaagtctagaagccttacaggaaaatcagggttatacagccgatac
+tccgcagcatgaatcatcgaggaggtgtcctaccatcgcgccttgtaatcttgtctgtgt
+atactgtatttagaccttttatacaaagtaaatatctcggctttatgtgattgggagggg
+cctactcaaacatgatgacttgacctaataatcactgtgcgggcgtcttatgactagcta
+ttccttgaaatccaccaccaaatggttaatatgtaaaaactttgacgatgaaacaaggtg
+aatgtgtagttactttgtgtaattagctgcgtcgagcattgcttgtaaaaccgtcaatcg
+cacacgttacttccataaaatttctacgaatacacccttcttaaaaaaaacgtaggaatt
+cacgagtttaacaaacgataactgtataaagtggaagtccgaagaaagcagatgcccgaa
+ctactcgaagatgtttcgttttcttaaccataggggcttcttaatggcccactacgcaca
+ttttgttcaagcccgagagggacatccccattacgggagtattactaaaactgttccgta
+atacgttcagcaagggatgaaaaaggccactgctcaagttattgacgtgggagtattaca
+tcggaagcctgaatcccacactatgatggtctgtacaggcctagggactgcgtctagacg
+gtattaccggcttctaatcatacgatcgtgagtcttaacgggaagtaaggctcacaccta
+ccccaaaccatttatctatgtaagtataaaattgtgcgtaagtgttcaaagtggacaata
+aagacgtggcaaaaacccccgcacataagccgctttagatttcacaaataccaatgcggt
+taaaaacatccttgagtcgtacatacaccatactcgcgttaaacggatataacagaagat
+aataaatccggatgtggagtcggtgtaactatagaaagccaagtgaaataatgcttacca
+gtcatttagctatacggctttcatttcatgtcaagagggtggagtttgacctgtacagtt
+gatatatcaccgatacttagaactcacctaaagctaaaattgctcgcagcgtgtaatccg
+catattacaaacaatagatgggattcattatacataagacacgatgatctgctttttcag
+gttgcgagatgttgcctatcgtcaatcgagtcctgccttacaccacttaaacaaaagtat
+tgacagggaacctattttcgaggtattatatagtccagcttgaatatcaatttgacagtt
+aacctagtgaaaatcagtaagaggaaatacgccacattctccagtgaaattctacgggtt
+atcgtctagtccaactatcaattataactcacgagatataagtaaattctcgtacttggc
+ctgatttttattatactttggatccttagtaaacaggaagggagaaaccttcaacgaaaa
+acactggattttgttttactctcaaagctcttatatgacggaaataccctgtcaagtctt
+aactttattactagactaatgaaatgggcttggggtggccagaatcatagtacaatttag
+cggatacactattcggactttcctatcggctgtctggttggataagtatggggactaata
+ggctagacatacctatacttaaactatacaggcgtcatctatctctgcaactttggagtt
+ccctgatgttctcccgccctttgggttcacatcttctataccgacacccctaataacgat
+tagtttgtgggttagagtaaattaatacggttaatattaatgtatcgttgaaaagctggt
+gtcgccaataaggtaaccggctaggcagagtatatgtcacgaagtataactaccctaatg
+ataagctgtaggaataaaattaatgctgtctctaagcgaagagatatttccgactctgtt
+ttaatgacgaatctcattacttctgacttgcaaatgttcaatatggcacggtttcacggc
+acctttgtgacgcatataatgaacttagaagattataacgacggaactttatatgataat
+ccgttacgattaaagaatctgttaaatatcataatggcattcagttctagaccgtgcatc
+atggtaaacttactttctctgcatggcgacatacatttcgctattcaaattcgcgtgtgg
+ttacacccactcgcacctttggaatattaagagaagatgatcagaaaatccattcgctca
+atttttctgacgtacgtctaatttatcctaggagacaaatcgttttatgtctctcacatt
+tttgaagaaaggttcgagagacaatactcaggtcctgaactgctagaagatactcggtgg
+agcgtggcaacaatgaaaaactcgtgacataaatgaatgatacttttccaagttcagtta
+agtgaatatgtttaacatacccggcttttcgatcttaagctgacgctggacgtgcgagta
+atgtcagtctcttacatacactagtgactccaagtttcgtcaaaaacgccccctcccttc
+tcgagcccactcacgctatgtattgacgcgaacttgttcgggatcagacttttcaggagt
+tcggtcgcgtgtccctatgtgctaatatataagttagatcgcattagatgctaatctgaa
+tacttatagacgaccttcaacgagaacgggtaccaccttgaggctagagttaggtgtgaa
+acgacaggtagggacatataaaatttgagtgcggctttagttaagggtttaattacctac
+tcaaacatcacgctcgcgcccttcgtacgtaatcgaccatctagaggctaaggggactgt
+actaggtagtgattaatgatatcctagacgcacgtgccttagatcttcagactctgatgg
+tccgcgatcaccgtaattgtagtcctccaactcgatcactttgttggcgtcaaagaaatt
+acgatatctaaatacttataatacaataaccaaggatgagaatgactcatcgcgttggag
+ttatattgcttgaagttctatggaatgaaagcacgttatctgccgtcccaatatctccag
+tgagctaattcattggacggtccactttgatcaatccccgaggagatgttcggacacttt
+agtctgtaacacttagcgttgagaccacgaacaattgattactcagtcttgaaggtgttt
+tccaaagttcattttaaataagactacgataggcctttcctattgatataaactacccgg
+ctctgttgttcgtgtgagtcgtacttctctgtgtttttctgattatagcaagattcgatt
+cttagtgtaaacagcgatttttatttgacccgtcaatgagaagcgcataggatctaagca
+aaattatcaagttgtgccacaaggtaagatctttccagttattgcaggtaggatgtatcc
+cacgttgatagtatgaggtctgacgtcaactgtctaggagagttgaccgcgtgcgggtac
+accggatttgcatcgatgttgagaacgcagaactcccactgtcgtggcggcgttcctgat
+atttagcaagaggcgttgataaagccctcatcatctagatctcgacctcatctgccctct
+tgctccatcattttctacacagactactttcctatctacgttagtataattgctttctat
+cttagtatcatttagagcttctccgtcaacaggttcgtgctattaaagttagtacgaaag
+ggacaacttgtagcaacgcatttaatcggttttcgactacttcgcacaaaatcagataaa
+gaagtttgtcattctattagacattgaattgcgcaattgacttgtaccacttatgatcga
+acactgaatcaagactgtgattaactaaaatagacaagccactatatcaactaataaaaa
+cgcccctggtggtcgaacatagttgactacaggataattaattggactggagccattaca
+ttctctacaatcgtatcacttcccaagtagacaactttgaccttgtagtttcatgtacaa
+aaaaatgctttcgcaggagcacattggtagttcaatagtttcatgggaacctcttgagcc
+gtcttctgtgggtgtgttcggatagtaggtactgataaagtcgtgtcgctttcgatgaga
+gggaattcaccggaaaacaccttggttaacaggatagtctatgtaaacttcgagacatgt
+ttaagagttaccagcttaatccacggtgctctactagtatcatcagctgtcttgcctcgc
+ctagaaatatgcattctatcgttatcctatcaacggttgccgtactgagcagccttattg
+tggaagagtaatatataaatgtagtcttgtctttacgaagcagacgtaagtaataatgac
+ttggaataccaaaactaaacatagtggattatcatactcaagaactctccagataaataa
+cagtttttacgatacgtcaccaatgagcttaaagattaggatcctcaaaactgatacaaa
+cgctaattcatttgttattggatccagtatcagttaaactgaatggagtgaagattgtag
+aatgttgttctggcctcgcatggggtctaggtgatatacaatttctcatacttacacggt
+agtggaaatctgattctagcttcgtagctgactatactcaaggaaccactgctcaaggta
+ggagactagttccgaccctacagtcaaagtggccgaagcttaaactatagactagttgtt
+aaatgctgatttcaagatatcatctatatacagtttggacaattatgtgtgcgaaactaa
+aattcatgctattcagatggatttcacttatgccttagaaacagatattgcccgagctca
+atcaacagttttagccggaaacaatcgaagcatagggacaatgtatcttttcctaaattg
+ccatgtgcagatttctgagtgtcacgaagcgcataatagaatcttgtgttgcctcaactc
+gttgaaaagtttaaaacaatcgcagcagtctttttggggtctactgtgtgtttgcaaaat
+aactgaaagaaacgcttgaacaactctgaagtagctcgagtactcattaaagtgtaacac
+attagtgaatatcggccaatgaaccaaacgcttcccggtacgctatctctctcatcggga
+ggcgatgtgcaggttatctacgaaagcatccctttacgttgagagtgtcgatgcatgaac
+ctcattgtaacaatagcccagcaaattctcatacgtgcctcagggtccgggcgtactcct
+ccatggaagggcgcgcatctagtgttataccaactcgctttttaactactatgctgtagt
+tctacaggcatagtggccagtattttctaacttctctggatagatgctctcactcctcat
+ccatcacggcttcagtttacgtcttacttgcttgttcagcaacggatggaggcattaagt
+atcttcactgttccctaaaattgctgttcaatatcaaagtaaggacgatacagggaaagc
+tcaagcacactcattgaatactgccccagttgcaacctcacttaatctgacaaaaataat
+gactactctaagtgttgcggaagcagtctcttccacgagcttgtctgtatcacttcgtat
+aggcatgtaactcgatagacacgaacaccgagtgagaaactatattcttgcttccgtgtg
+tgtgacaccaggtaattgatgcggatataagctggagatcactcacgcccacacaaggcg
+ctgctacctctttattccaatgtgtaagaatttgctaacttcatttctagaccgcagctt
+tgcggtcataatttcacggtacggacccttgggttagagacttgataacacacttcgcag
+tttccaccgcgcacatgttttagtggcttctaacatagaatttttgttgtgacataaaga
+gtgcgtgggagacttgcccgaccgttaagccataatcaattgaaagccccgtgagtcaca
+tctaattggttgtactgcgcatttagctatcctttagctgactcgaagagattcgattcc
+taatataggttaattagatggctgccgcgcgaagtaaaacgtgaaaaacgtagtgcgcag
+atctgcataactcgcgcttaattacttatgagtagttccaagttcgctacgttatgagag
+agattggaattaagcaaatatgttttatggtgattttgggatgagaaggactgctaagta
+cggctactaaacaaatttctaaaaccgccatctaccttatcttggagacatttaagttgt
+atatgtcactagtctagcttttgtctgtgggacgcgttctcggaatgagggaaatgcaag
+agccgattcatcaaatgcttatctaagaaagtagtggactattacaccaagcacgaatgc
+cagggaactgctttcttgctcaggacctcgcgacaaggtaccccgcataagtcctagaat
+tacatttggtcagcaatgctgacatttgaccgtgaaaacataattttaatcagaaggcag
+ctcacccgcttgctctagatcttatctttgtatgaatgtcagaatttactgcaatatccg
+ttccgaatagtgagggcttagtatagttctctgtatacaggtcacatcaaactccccctg
+tcctagtacagctctgagctttaattaattgcatacatttccttcaatcatcagatgaaa
+acaccgcgaatcatgctcttctcgtatagggcaagagaagcaacaaacaactagcccgac
+tcacgttcatccgccgtatccttgttcagttcttactccgtattaggtcagcgaaatcta
+atcagaataatcggtcgcgtatcaaaattaaaatcccgcttgaggttgacaattaaaacg
+ctgagcagttatcggctattagatagtggggtgaaagtaattggctggaattatgttaaa
+acgtgatattaagctaaaatacgctacttgttgccgacctaattcagtcattcgatattc
+agttagagccaagaataacaagcttgtataaattgaacggggtgcactaaacgatgtgtt
+actctaatattcagcttggagtatacctgaaggcgaattcatgtatcggccaataataag
+acgttgaagatcacaatttggactagcaaaagaaggtgatttatgcgtggggattgagtc
+cactgtacgagtacggtctctggaaaattataggttcagggaatataaggaagtaaagat
+aattaccaagagatttttggtatcgctatgacccagaggtgttctaacgtctgttttgat
+ccgcagaatttctgcctcaatgcatatttgacggacttgaactagagcctctaaagttaa
+atggcgacgcaactgttcctaaacttcaattattactactctttttttcctagggtattg
+tagaggccagtggacaaaataaatcaaatttaagatgtttcggacattaacatcccccgt
+agcatagaaatcatcagttatccaatctctcatcgagcttttacaatttctgctggcgct
+atggacagcatatgccgcgagacctccgcaagactcacttgatcactgtaagtatcttca
+ttagaggttagagcctatagttaagctgctgacctagtaaaattggtattttctaatttt
+attgctcaagttaaaggttagtgaagggataatgacgttatttttgaacaatgggttgta
+ttcaattttatatcacgaatggaacccttcattcccggcataatactagacgacacgaac
+aagctccgatctatcagccaggcacgtgttaaggtttaattccggcaaaccaatgaagca
+tcaaaaggtgacctgatgcaacttagggtcacgatgagtttttcaggactacttattacc
+tattaataagttaacatgagccttcataccccgtaagacaatacatactccaccaattag
+aattctgagccatcttatctttttgtatcatcgaagggtatggccgaataggttaattag
+ttactcctaacgtctctacaggcatgcatttgacgcaccttcgaaaatagtcaatctctc
+gccacacgcgtctagtatgcagcatcaaaaatatagtccacggtttccggattaccaaac
+gcggcaaagagaaacattgtatcgacggagataacttaatacagaaggaaggggcatctt
+cgaatacggatgaataattctatctgtttattctgacatcttgttttcaggttaatctta
+cgcattcaaatgacgcctgccccatgcgtgcgcaattattttctaatattgacgagagca
+atctcactccttttgggtctatttatgttttattgaggcacaagcctatacagaacaggt
+actattaaggccgtgagtgtgagactcaaaccgtggaaacaaaggatgggttgttcttgg
+tacaagttttagtgcatgtgggcaatccttaccaaaatcagatgctatccttaactttgg
+gctgcatttaagatggcggttggaggcctgtgagaatcctgcgtgtcatctttaatgacc
+gaattcatccatgtagattcagatcacacactcattccttgatgttgtctaaacaaaagt
+tgttgtggacgcattggagggagttaagtaacaacttgggatcgcatacttataaaaatt
+atatgttaaactttcacaaacgctgaagtccaaagtaactagcccaaacgcctcgagagt
+cactaggtattaatggtgtttgagttcctgtgaaatagtgttcgaaggtaaaatttatgt
+accaaatcgaaagaacacttaataaggcttgcttgcacggaggtatgatgtttactgact
+ctacaaccctaattttccagtacgtacattcattccaataggttagttctcaaagtgcta
+tacaggctcctcaattgatgatatgcttcagccgctctatggatattagctcattttatt
+taggaagcccgcttagaggcttactatgagggaaatgccaaaatgtcatacttttcggtg
+tgtcccatatgacaccgctttacatagaatttgaattaaaacgcgctctcccgttcacta
+ccatacttggtaccgtgcgcatattacatatagatataggatcattttttaaagctgtac
+taggtttgatcgacaatcttatgctatactatatgatgtaaccctcataatcaataccga
+tcgtacgatcctagcataggtggcaagcgattttatgccgattattgtgttaaatagtct
+gtgagtgtgattatcagggctacgttggtagaggggttgtatagacctcgcacacattgt
+gacatacttaacaatatacgaaaactgatataataaatccccttacccaaacaccaatcc
+cgttgaatcaactaccataacgtctcccatataaattgcctacttgtttgcataaatctg
+aatacataacaccattgcaccttcttgtgttccaatcccgttaagattgccttgtcagat
+gatatgcaagaacaatagcatttgctagcaattattaacagctcttcgaattgcctccac
+ataacgcgggagggtatattttaatttggcaaatactaagtactgttggcgtcatatgct
+attaacggttggatattaagttatgtcagccgtaagcaagagtgggcgaaatattttgtt
+acccagtgagagcactcttagagtttggatacaataggccatatgttgacttaagaggac
+gtaactacgccgtacaccattgttcaaccgacttcttggcaaatagaatcgtattagcaa
+tcttaagaatagagacacgttcgtgttagggtatactacaaatccgaaaatcttaagagg
+atcacctaaactgaaatttatacatatttcaacgtggatagatttaacataattcagcca
+cctccaacctgggagtaattttcagtagatttactagatgattagtggcccaacgcactt
+gactatataagatctggggatcctaacctgacctatgagacaaaattggaaacgttaaca
+gcccttatgtgtacaaagaaaagtaagttgttgctgttcaacagatgatagtcatgacgc
+gtaacttcactatagtaaattgaaacaaatacgcaatttagacagaatggtacggtcatg
+aatgacagtaattcgaagtgctagaccaacttaaaataggtaaacgtgcccgaaaccccc
+cttaacagaaagctgctatcatggtgcagtatcgacgtgttcagaaacttgtaacttttg
+agcaggtccgagcacatggaagtatatcacgtgtttctgaaccggcttatccctaagata
+tatccgtcgcaaactttcgatttagtcccacgtagagcccaagcgttgtgcgactccacg
+tgcatgcccagaaatacgagtttaaatttggttacatggttaattttgaccgaagcatcg
+cactttatgattgataattggattcaatatgtcgccctatgcgaatgcaacatgatccac
+aatttggctataagacgtttaatccgtatcacactttgtttgcggctagtatagtaacgc
+ccgtgcaccaagagtcagtaacaattataagtactccgcaggtacttcaaatataaaaac
+taatcaaacacgacccatatgatcatctgaagatatttggaactttctcgacaaccaccc
+tcgtactcaatacttacactaatcgacaggcacacgcaacgtgtacagtcgcaccatatt
+gagtcaagatttgcttagtggcgatgagcgtacacgcttatttctctagtcacaattagt
+tatctacgagacatcacgagggagcaaataagcgatgttatggctacacataggcacgta
+tgaatatgatataagccagttaaacagtcgaaccatcgagcaaattctcatgcaccaacc
+cacacgttgaggcacaaagagtaagctgtttgaatgtaacttcttctgctgagcgggccc
+caacgtaaggatcaactagaagagaaaactcggtattagtttaaatgcgtcacggagcat
+gagtgcatttcactaagaatgtctgtgtaaccaatataacatctatttgttatctgattg
+cctacttatggctttgcggtcgtggcgactaatgtctccaatccttttgaggtcggtacc
+aactccctttaaattacgctgtgcaggctcatgcactgcatacatatacggtagcaggta
+gggacctcacgcacccttattataatcaatagtagttatcagtcaacgaggcaggaatgc
+tgaggtcgaggtgttggtatattttctatgtgccgtctaggcgactatcacgcattacca
+ggcgagatttaagccaattttgaatatagtcaacgtaatttttactatgggttccaccga
+aacgccttgcacaactaagaatcccataaaatatcgatatcaaataaaagattgtgtcaa
+taccttcatatatattttttcggttgactaacgtgaactaaggttaggggttttgtatgt
+ctatataggaaacagtttcttttctgtcctactttagtaaagtcttcaagccttactcca
+aaatcacggtgattaagccgttactcagcagcatgattctgcctgctcgggtcctaaaat
+ccagccttgtaagagtcgctgtgtattagctagggagacctttgttaaaaaggatatatc
+gcggcgggatgtgagtgcgtggcgcatactcaatcttcagctcgtgtcattataatatct
+ctcccccacgcttttcactagatatgccgtgtaagcaaacaccttatgcttaatttcgaa
+aatattggtacttgaaaaaagctgtaggggtacttaatgtctggtaggagatcaggagag
+aattgagtgtaaaaccgtaaagccctcacctgacttcatgtaaatggcttagaagactcc
+atgatttaataaatactacgaaggaaagactggatctaaagataactctagtaaggccaa
+ctcccttcaatgctgttgccagttataatccaagagctgtccttttctgaaccatagcgg
+cttctgaagcgaactagaagcaaagttggttctagccagacagccacataccctgtacgg
+gtgtattactaaaactggtccggtattagttcaccaagggaggaattaggcaaaggatct
+aggtatgcaagtcggagtattacatccctaccctgaatccatcaataggttcctctgtac
+tggccttcgcaatgagtattcaaggttgtacagccgtataataataagatagtgactatg
+aacgggaagtaacccgctcaccttccccaaaacattgttatatctaagtattaaagtctg
+ccgtagtgttaatactcgaaaataaacaactggcaaattacaccgcacttaagccgcttt
+tgatttatatttttccaatgcgcttttaaaaataattcagtcctacatactaattaagac
+ccttaaacggagatatcacaagttaagttttaaccatctcgactaggtggaactatagat
+acccaactcaatttatcattacctgtaatgttcctagaaggattgcatttcatgtcaaga
+cggtggagtttcacagcgaaacttcagtgtgaacagattctgagaaatcacctaaaccta
+ttagtcagagcacccggttagaaccagttgtcaaaaaatagagcggttgcatgagacaga
+agtaacgatgagatccgttgtaacgttgagacatctggcctatcgtcaatacagtcctcc
+cttaaaaatatttttaaatactaggcaaacccaacataggttagtcctatgtgatacgcc
+acatggtatatcattttgtaacgttacctagggataatcaggaagtggaattacgcaaaa
+gtagacagtgaaatgcttagggttatagtctagtccaaagataaaggataaagcacgtca
+gagaactatattagccgaatgggaatcattgttaggagactgtggatcatgtctaaaaag
+caacgcagaaacagtcatcgaaaaaatctcgtttttgtttgaatctaaaagagctttgat
+gaccgatagtacctgtatactagttactgtattacgtgtctaatgatttcggattggggt
+ccccagaatcagacgtcattgtagacgattcaagtttaccaatttaatttcccagctctc
+cttggagaactatcgccaataattgcagtcactttccttttctgaaacgataaagccgtc
+agagttctctgcaacgttggacttacctgaggttctaacccactttcggttctaatagta
+gttaacgacacaacgaataacctttactgtggggctttcacgatattttttcgcttatta
+ttaatggttacgtcataagctggtgtccaaattaaggttaccggcttcgcagagtagttg
+tatccaagtataacttccctaatcataagatcgaggtagaaaattaatgctgtctctaac
+cgaacagatatgtcccactatgtggtatggacgttgctaattacttctgaagggaaattg
+gtcattatggatacgtgtctaccatcaggtcggacgcagatatggttctgtcttcagttg
+atccaccgttctttataggataataactgacgattaaagattatggtaaatagattaagc
+caattctcttcttgtcagtgaagcatccttaactgacttgctctgcagcccctcatacat
+ttagctattcaaagtaccggctcgtttcaaactctcccacctttggaagaggttgtcaac
+ttgataagtatatcatttacagcattttttcggacgtacctctaatgtttcattgcagaa
+aattagttttttctatcgcacattttgcaagtaacgttagagacacaattatctgcgaat
+gaactgctagatctgacgaccgggagcctcgcaaatatcaaaaaagactgacatatatca
+aggagtcgttgacaagtgctggtaagtcaattggtttatctgtcccggcgtttcgatctt
+aagctgaccatgcacggcagagtaatgtcactctcgttcttacaagtctgtctccaaggg
+tcggcaaaaaagacccctccattctcgagcccactcacgatatgtagggacgacaacttg
+tgcggcttatgaattgtctggactgcgggcgagggtccatatctccgaagttagaaggga
+catacctttagatgataagatcaattcttattgacgaaattcatccacaacggggaacaa
+cttcaccctagacttacgtctgaaaagacacctagcgtcttataaaaggtcagtgccccg
+tttcgtaaggctggaattacctacgcaaacttaaacctcgcgcccttccttacgtatcga
+caagatagaggctatcgcgaatgtactacggaggcatgaatcatatactagaaccaagtg
+cctgtgatattaacaagatgatccgacgcgagcaccgtaattctaggcataaaactccag
+caatttgggggccgaaaacaaatgacgttagctaattaattatatgacatgatcaaagga
+ggtcaatcacgcatcgagttcgacgtatattcattgaacttcgtgcgtttgaaagaaact
+tttatgaaggcaaaattgatcctgtctcctatttcatgcgtacctcctagttgataattc
+cccgagcagtggttaggacacttttgtcggtatcaagttccggtctcaaaacgtaaaatt
+ctgtaatctgtatggatggtctgtgaattagttaatttttatgaagtcgtcgagacgcag
+ttcctattgatttattctaaacggagatgtgcttcgtgggactcggaagtagatctgtgt
+ttatgattattgctactttagatgctgactgttaactccgtgttgtttttcaaccgtata
+tcacaaccgaattggatagaacctatagtttcaagttctgccacaaggtatcatatttac
+agttagtgctggttgcttctttcaaacgtggtgagtttgtgctatcacgtcaacggtaga
+gctcagtggaccgagtgcgcgttcaaccctgttccagagagggtgtgatagcacatatac
+cacgctcgtcgaggcgttcatgatagtttgcaagagccggtgttaaacacatattattat
+tgttatccaactaatcggacctatgcataaagcattgtctaaacagaataattgcctata
+tacggtagttttagtgatttatatcttagtatcagttagagcttcgaactcttcaggttc
+ctcatatttaacgttcttcgaaagcgaaaacttctacaaacgaatgtaagcggttttcca
+agtagtacctataaatcacagaaagatctgtctcagtatagttgaaatggtattcagcta
+gtgacgtgtaccaattatcatagttcactcaagcaagacgctcattaacgaatatagaca
+agacactatatcatataataaaaaagaacatggtgctcgaacatagttgaattcaccata
+ttgaaggggaatgctgacatgtaattcgctactagacgatcaattccctacttgtcaaag
+ttgaactggtacgttcttggaattaaatatgattgcgctggaccaaattgcgacttcttg
+agtttcagggcaaacgattgagccggaggatgtccgtctcttacctttcttgcttatgat
+aaacgacggtccctgtacatcactgggaattctcagcaaaaataattgggtaaatcgaga
+ctcgatgtattcggccacaaaggtgttagacgttaaagattattcaacggggcgataata
+ggatcataaccggtatgcaagcgcattgaaagagccatgagatccttatccgataaacgc
+tgcacggtatgtgcagccttattgtcgatcacgaatttataaatgtagtctgggctgtaa
+gttgaagacctaagttataatgaagtgcaataccaaatcgattcatagtggattatcaga
+ctcaagatatctcctgataaattacagttgttaagatacggataaaatgagatttaagat
+tagcagcctctaatctgtttcaatcccgttggaatgtggtatgcgatcaaggttaagtta
+aaatcaagcctgtcttcagtcttgattcttgttctgccatcgcatgcggtctacgtgagt
+taatatgtagcttacgttctagcttgtgctaatctgagtatagattcgtagaggaatatt
+atcaagcttccacgcctcaacgtacgtgtattggtcacacaagacactaaaagtggaagt
+agcgtaaactatagtctagttgttaaatgctcagttcttgttatattcgatatactcttg
+gctaatttatgtctgagtatataaaattaatgatattaacttgcatttcacggatccctt
+agaaaaagattttgaccgagcgcattataaacggttacaccgaatcaatagaagcatacc
+caatagctttctttgaatttattgcctgcgcaacttggctgactctctagatccgaataa
+ttctatatggtcgtgacgaaactagttcattactgtttaaaatgccaacatgtcttttgg
+gccgataatggctctttgcaaaattactcaatgatacgattgatcaaagcggtagttgct
+agtggtagcatgtaagtctatcaaatgtctgattatccgaaaatcttccaaaagagtcca
+cgtaccatatctatctcatagcgacgcgaggggaaccttatctaactatcattccattta
+ccgggtgactctcgatgcaggatccgattgggataaattgcccagaaatggctcattcct
+gactaagggtaaggccgttctcagcaagggaaccccgcgaatctaggcttataccatcta
+gattgttaactacttgcctgtagttctacagccatactggacagttgtttctaaatgatc
+gggattcatgctagcactcctctgaatgcaccgcgtaagtttaactattacgtccgtggg
+cagataaggatggaggctgtatgtatcttaactgttacctaatatggctggtaattatca
+aagtaaggaccttaatgccatagcgctagcaatcgctttgtatactgaccatgtgccaac
+ctctcttaatctgtaaaatataatgtcttagctaactgtggacgatcatgtctctgccta
+gagcttcgctgtatcaattcctatagccagcgtactagtgacacaacaacaccgtgtgag
+aaaagatattagtccttacgtctgtctctctacagcttattgatgaggattgaacatgga
+catatagctccccctcaaaagcagatgctacctctttattccattctcgaacatttgccg
+aacttaatttcgacaaacctgaggtcacgtcttaatttatcggtaacgtcacgtcccttt
+gagactggataaatatattaccaggggccaacgagcaattgttggaggcgcttctataat
+acaaggtgtcttgtcaaagaaagacggcgtgcgtctcgtgcaactcacttaaccaatatt
+aatgtgaaacccccctctctcacatcttatgcggtgtactgccctggtacatttcctgta
+caggactccaacagtgtagattcctaagatagctgttggagttgcctcacgccagatcga
+aaaactgaataaactagtgagctgagctgcagaaataccgcttaattacttatgactagt
+tcaaagggacctacgtgatgtcagacattgcaaggaagaaattaggtttgtgcgtcattt
+tggctggactagcactccttacttcccctactattcaaatgtcgtaaacagcatgagaca
+ggatcgtgctgacatttaaggtctattgggaacgaggctacctttggtcgcgcgctcgcg
+ttctccgaatgaccgaaatgcatgagcacagtatgcaattgcttatagatctaaggtctg
+gtcgttgaaaccaagcacgtaggcctgggaaatcagttcttcctcagcaactacacaaaa
+gcgtccaagcattagtacttgtagtaaatgtccgaacctatgcgctcatttgaaagtcaa
+aaaatatttttaagcagtaggcacctaacccgattcctctacttagtagctttctttgat
+tctcagaattgactgcaatatcactgcacaattctgtgccattactagacttctctgtat
+taacgtctcatcttactaacactcgcctaggacacatctgagagtgaagtatttcaatac
+atttactgaaatcttcagttctaaaatccccgaataaggctcttatcggtttggccaaca
+caagaaaaaaacttcttgcaccactcaccttcatacgcaggagcctggggaacttagtaa
+taactatttcggcagacaaagcttataacaagttgccggcgcgtataatatttaaaagac
+cccttgagctgctcaattaaaacgctcacctggtataggctattagatagtgccgtctta
+gtaaggggcgggaattatcggataaactgatattttgataaaataaccgacttgttcacg
+acataagtcactaaggagattttatctttctccaaagtatatcttccttggataatttca
+aagcgctgcaatttaagttctgttactagtttatgctgctgggaggtgaccggaaggcgt
+agtaatctagaggcaaattataagaagttcatcatatcattttcgactacaaaaacaagg
+tgttgtatgccggcgcattgtgtaaactggacgagtaccctagatggaaaattatacgtt
+aagccaagatttcgatgtaatgataattacctacacatttttgctatccataggaacaag
+agctgttctataggctcgtggcatacgaacatttgctgccgctatgaatattggaagctc
+ttcaactacagactctattcttaattgccgtcgaaaatgggccgaatcggctattattaa
+tactcggtttttccgaggggattgttgtcgacagtcgtaattattattaatattgatgtt
+ggtgaggtcatttaaatacaaccttgcagacaatgaataagggatccaatctctcatact
+ccttttacaattgctcatgcccctatgcaaaccttatgccgccacacctccgcaactctc
+tcttctgaactgtaagtagcttcattactggtttgagactatactgaagctgatgacatt
+ctaaaatggctattttcgaatgtgattcataatgtttatcgtttgggatggcagaatcac
+gttatttttgatatagcccgggtattctattgtatagaacgtatgctacaagtcattccc
+cgaagaagactagaagtaaacaacatgcgaccatcgttaagccacgcaaggctgtagctt
+tatttcccgataacctatcttccataaatagcggacagcaggatactgacgctcaacatc
+agtggttatggtctaatttttaacttttaataaggtaacttcagcaggcatacacagtaa
+ctctttaatttataatcaaattagaagtctgacacttcttatatttttctatcatccaac
+gcgatcgcccattagcttattgtgttactaataacgtatctaaaccaatccttttcaagc
+tactgcctatattgtcaatatatacaaacaacaggatagtaggctgcttaaaaaatattg
+tcaaccgtgtacgctttacaatacccggaaatcacaaactttgtagacaacgagtgaaat
+ttatacactacgaagggccagcgtacaagacccatgaattaggcgatatgtttattctga
+catattggtttatccttaatctgtcgctgtaaaatgaagccgcccccatccctgcgaatt
+ttttttcgaagattcacgactgaaatataaatacgtttggctatatttatgttggaggga
+ggcaatagcctttactgttaaccgaagatttagccagtgagtgtgacactaaaacactgg
+aataaatgcaggcgttcttctgggtaaaaggtttagtcaatctcgcctataagttcatat
+agctctggatataattatctggcccatgcatttatcatggcgcttggtgccctgtgtgaa
+gccggcctctcatattgaaggtccgaagtattccatgtacattaagatcactctctcatt
+catgcatcttggcttaacaaatctggttgtccaagctttccaggcacgtatggtacaaat
+tcggatcgaatacttataaaaatgatatgttaaactgtctaaaacgctcatctacaaagt
+aaagtgcactaaccaatagagtctcaagaccgtgtaatgctggtgcactgaatgtgtaat
+acggttagaagggattagttatgttacaaatccattgaaaacttaagaagcattgcgtgc
+tcggagggtgcatcttttatcaagagactaacattattttcaacgacgtacatgctttac
+aatagggtacttatcaaacgccgagaaacgcgcctatagtgatgttatgattatgacccg
+atatccattggaccgaattttatgtaggttcccagcgtactcgcgtaatatctcggtatt
+gccataatgtaatacttgtcggtctctcccagatgaaaaagcgttacagagtatttcaat
+gaaaaacagcgcgcaacgtcaatacctttaggggtaacggccgctgatttcatatagata
+tacgataagttggtatagctctactaggtggcatccacaatcgttgcatttactatagct
+ggttacaatcataatctataccgttccttacatactaccatagcgggatagcgttttttt
+gccgttgattgggtttaagaggatgtcagtctcattatatccgattcggtgggagagccg
+ttgttttcaaatcgcacactttgtgacataatgtacaagataacaaaactgatataagat
+ataaactgtcaatatcaccttgacacttgaatcaaagtaaattaactcgcaaatataatt
+tgactaattgggtgcagatttctcaattaataaaaaaatggcaccggatgggcttacaag
+ccccttatcattcacttgtatcatgatttccaagaacaatagaatttgctagcaagtatg
+aacagagattcgaattgcatccacagtacgccggagcgtttattttaatgtggatatgac
+gatgtactgttggcggcatttgctagtaaccggtccttatttacgtagcgcacacgtaag
+catgtctgggagaaatatggtggtacaatctcagagaaagattacagtttggtttaaata
+ggacttatcgggtcggaagtggaacttaataagcagtacacaattgggcaacagacgtct
+tgcctattacaataggattacaatgcgttagatttcagacacgttcgtgtttggctattc
+gtcaattccctaaatagttagacgatcaactattatcaaagtgattctttgttcatcctc
+cattcatgtaacagatggcacactacgcataacgccgaggaattttaacgagatttaaga
+gagcagttcgggcacaacccacttgactttataacagctcggcagcataaacggtaatat
+gtgacaaatttccaaacgttataagaacgtatgtgtacttagaaaactaagtggttcatg
+ttcaacagatgtgacgcagcaagcctaacttatctattggttttgctataaaagaacaaa
+gttacacagaatcctaagggcttgtttcacacttatgcctagtgcttcaccatcttaaaa
+tagcgaaaccggcacgaatcaaaccttaaaacaatgcgcagatattggtgatggtgactc
+cgggtatgataatggtaactgttgaccagcgcccacctcatcgaagtatagaaagtggtt
+aggataaggatgagaccgaacttatttccggccataactttagattttctacctagtaca
+caacatcagggcggacacgaaaccgccatcacatcatataccaggtttaatttgcttaat
+gggggaagtgtcaacgaaccttcgaactttagcaggcatatggccattatatatggcccc
+agagcagaatgctacagcagacaaaatttggatttatgtagtttaatacctatcaaactt
+ggtgtgaccatacttgtctaacgacagtgcacaaagtgtaagttacaattattactactc
+agcagcttctgcaatgataaaatcttatcatacacgtcacatatgataatatctacttag
+ggggaacgggctccacaacctacatagtactcaatacttacactattcgacaggcacacc
+aaacctgtacagtcccaaaagattgagtcaactttgcagtactgcagatcacagtaatag
+cttagttagcgagtcaaaattagttttctacgagactgcacgaccgtgcaaatttccgat
+gtgttggctacaaatagcaacgtatgaatttgtttgaagccacgtaaactgtacaacctt
+agagataagtctcaggctactaaaaacacgttgtggcactaacaggatcatggttgattc
+ttacttattcggctgaccggcccaataagtaaccttcaactagaacagaataatcgggag
+tagtttaattcagtcaaggtgcaggtctcattgtaactaacaagctctgtgtaaccaagt
+taaaatcgttttcttagcggattccctacttatggatttgagctcgtccacaatattcga
+tacaagaagtttgtggtccgtaacaacgaaattttaattacgctgtgcagcctcatccaa
+ggaattaatagaaggttgatggtaggctccgaacgctccatgattataatcaagtggact
+gtgcagtaaacgaggaaggtatcctgacgtcgtggtgttcgtttttgttatttgtgccct
+atacgagtagataaaccatgaacagcacagtgtgaacccatggttgattttaggctacct
+tatttttaatttccgttacacagaaacgaattccacaactaacatgccattaatttttcg
+atatcttataaaagatggtcgaaattcattcatttattttttttcggttctcgaaagtca
+actaagctgtcgcgttttgtttctctttagaggtaaaagtggctttgatctcctacgttt
+ggatactagtcaaccattactccatttgatccgtgagtatcacctgtctaacatccagca
+ttatgactcctcggcgaagaaaagacacacttcttagagtcgatgtgtattagctaggga
+cacagttgtttaatacgatagtgagcccagggagggcagtgcgtcccccagtagatttat
+tcagctagtgtaagtataagatatctcacccacgaggttcaagtgatatgcagtcttaga
+ataatacttatcctgaatttcgatattatgggtacttcaataatccgctagcgctacttt
+atgtctcgttggacagcaggacacatggcagtcttaaacactaaagacatcacctgaatg
+aatgtaatgggattacaagaatcaatgaggtattatatacgacgtaggaaactctggata
+tatacagtaatctagttacgccatcgcacttcattcctctggaaacttagaagacatcag
+ctgtacgtggaggaaccagacccccgtatgtagccaaatagaaccaaagttgcttataca
+aacacacccaatgacaatggaccgctggagttcgtaaactcggaacgtagtactgcacaa
+acccagcatttagcaataggagctacgtatgcaactcccacgtggtaataccttcaagct
+atcaatatataggtgcctagctaatcgcattcgcaagcagtattcaagcttgtaaaccag
+tataataattacagaggctctatgaaacccaactttccagctaaaagtcccaattaaatg
+gttatttcgtacttttaaagtcgcccgttctgttattacgcgaattgattctactccaaa
+attaaacacaaattatcaaccgtttcatttatatttgtcaatgcagctgtttaaaataag
+gctctactaaattataattaagacacttattaccagatttctctagttaagtttgaacca
+gctcgactaccgcgaaagatacattcccttctctatttttcagttcatctatgggtcaga
+gaagcattgaatttattctattcaccctcgtcgttcacagcgaatcgtcagtgtgatcag
+tgtatgagaaatatcctaaaccgtttagtcagaccacacgcttagaacaagtggtctaaa
+aagactgccctggaaggagtaagaagtatacagctgatccggtgtatccttcagtcatct
+gccctatactaattacacgacgcaaggaaaaataggtttattttctaggcaaacccttca
+taggtgactccgatgtgttacgaatcatgcttgagaatgtgctatcgttaccgacggata
+ataacgatctccaatgaaccaaatgtagaatgtctattgattacccttttactattcgac
+ttagagataggagatagaacctcagtgtacttttttagccgaatgggaatctttgggagg
+tgaatggccataaggtcgtaaatccaaccctcttaaagtcttccatattatatcgttgtt
+cgtggaatcgataacagatttgttgacccatagtaaatgtatactagtttatgttgtaag
+tgtagattgttttccgattgccgtccaaactttatgtcgtaattgtagaccagtaaagtt
+gaccaaggtaagtgcccagcgatcctgcgagatcgatcgccaatttttccagtcactgta
+agtgtaggtttagataaagccgtatgagttatatcataagggcctcggaaagcagcttcg
+aaccaaagttcccttataatagtagtttaactataaaagtatatactggtctgtcgccct
+ttcacgatttgttttaccggtttatgaagcgttacgtcattagagcggctccaatttaag
+gttaacggcttccatgtgtagttgtatacaaggataacttaaagtatctgttcagcgagc
+tagttaagttatcctcgatagaacacaactcagaggtcccaagatcgggtttgcaacttg
+ctaatttattctcaaggcaaattgggaattatcgatacctgtataccataaggtcgctcg
+atgtgatgcttatgtcttctggtgatcctaccttagttagtgctgattaacggaacatta
+atgtttatcgttttgagatttagccaattctctgattctaactcaagatgccttatctga
+cgtgctatgcagcccctaagtattttacattgtaataggacacgctcctttaaaactcgc
+caaaaggtcgttgtggttctctactggttaactatataatttacagctttgttgagctag
+ttcctctttggtttaagtcctcaatattagttggttcgagcgataagttggctagttacc
+ttagtcactatattagatccgaatgttatgcttcatctgaagaccgccaccctccaaaat
+ttcttttaagactcacttattgcaaggtgtaggtgaattcggctcgtttctcaagtggtg
+tatctgtacacgagtttccatattttcatcaacagccaccgcacacttatgtcactctag
+gtattaaaagtcgctctacaaggggacgcaattaagaaacagacatgctagtcaaaaata
+aacatagcgaggcaccactaattcggccgcttatcaatgggatgctctgcgcgagacgcg
+ccagagctcagtagttagttcggacatacatttacttcagatgatcaattagttttctac
+aaatgcttactctaccccgaaaaaagtcaccagactcttacgtctctttagtatccttcc
+gtcttatataaggtcagtcccccgtttcggtaccctggaatttactaagaataatgaaac
+agcccccaaggacgtacgtttacaaatgatagaccagatcgcctagcttattccgacgca
+tgttgcatagaattgaaccaacggaatgtgagagtaactagatgagccgaccacagcacc
+cgtttgcgtcgcagaatacgcctgatagttcggccacgaaatcatatgtcctttgagtat
+taagtatttgtaatgatcaatcgagctcaagcaagcttacacttcctcggatattcaggg
+aacttagtgcctttgaaagatacgttgatcaacgaaaaattgataatggctcatatggaa
+tgcctacctcatagtgctgaattaacacagcactgcggacctaacttttcgaggtttcaa
+gttcacgtctcaaaacctaataggctggaatatgtagggatcctcggtgaatttgtgatt
+gggtttgttgtagtactgaccaagtgaatattctttttttctaaaagcagatctgctgcc
+gggcactacgaaggagatctctgtgtatcattattgcttcttgacatgatgactcttaaa
+tcactgtgggtgtgcaaaacgatagcacaacccaattcgatagtacatattgttgatact
+tcgcactaaaccgttcatatttaaaggttgtgctccttccttcgttaaatactggtgact
+tggtcctatctactattagctagacctctggggaaccacgcccccgtaaaacctgtgcaa
+gagagggggtcatacatcttagacatcgcgcctccaccagggaagcattgggtgattgac
+caggtgtgtaacaaatatgattattcttatactaatattagcaaagatgcataatgattt
+gtattaaatgtataattgaattgataagggtcttttagtcagtgatagagtagtataagg
+tagacattagaactcttaaccggacgcagatttttcggtcttagtaagccaattagtcga
+caaaacaaggtaagagcggttactagtagtacctataatgcactgaatcttcggtcgaag
+tatagttctaatgctatgcagattgtgacggcgacaaatgttcagacttatatcatgaaa
+caagctcttgtaagtattgacaaatgaaaagattgaatatttttaaatacaaaatgcgcc
+tacttattaggggaattaaccagattgaaggccaatcctcacatgtaatgagataataga
+cgataaatgaaattcttgtaatagttgaactgctacgtgatgggtattatatatgattga
+gatcctccaattgccgacgtcttgtcttgatgcccaaaagattgtcaacgaggagctccc
+tcgcgtacctgtcgtccgtatcataaacgacgcgacatgtacagcactccgaagtataag
+caataataatgcgggtaatccagactagatcttttcggactcaatgcggtttcacggtaa
+acatgattaataccggagagtagtcgagcttatcagcgatgcaagcgaattcattgtgcc
+aggagatacgttgcagataaaaccggcaacgtatgtcaacaagttttggcgatctcgttg
+tttgtattcgacgaggcgcgggaacttcaagaactatcgtatattcaagtccattacctt
+ttagtttcagactggtggagctgactaaagttatatcatcattttgtacactggtttagt
+taacgataatttcagatttaacatgaccagacgataatcgctgtatatccagttggaatg
+tggtttgccagaaaggttaacttataatcaagcctctcttcagtcttgattcgtcgtatc
+ccatccattgcgctatacctcagtgtatttggagctgtagttataccgtgtgctaagatc
+agtagacatgacgagagcaatattatctaccttacaagcatcaacggacgtctagtcgga
+acaaaagactctaaaactcgaacttcaggttaatatactatagttctgtattcagcagtt
+attcttatattcgatattatcttgcctattggatgtctgactttagtatattaatcatag
+tatctgccatgtaaaggtgccagtactaaatctgtttcacagtgcgaattataaacggtt
+acaaccattaaagacaacaagaccctatagctttatttgaattttgtcaatgcgcaactt
+ggagctcgcgatacatcccaattagtctatagggtcgggacgattctacggcatttctgg
+ttataatgacaacatggattgtggcccgagaatcgctctttcattaattaagcaatcatt
+acagtcttataagcgctacttccgagtggtagcaggtaactcgatataaggtcgcatgag
+ccgaatagcttaaaaaacaggccaccgaacattgatagagaataccgaccacagcgcaac
+ctttgattactttcattaaattgtacggctcactcgacatcaagcttaagattgcgataa
+tgtgaactcaaatggatcagtactgaagaaccgtaacccacttcgcagaaagcgtaccca
+gagaagatacgctgttacaatatacagggtgaaattattgcctgttcttcgtaaccattt
+cgccaaacttggttagaaatgatagccattcatgatagaaataagctgaatgataccagt
+atctttaactatgtagtcagggggaagataacgatggtccatgtatgtttctgatatgtg
+acagtattggccgcgtaatttgctaacgaagctacttaatgcctttgagcttcatataga
+tttctttaatcaaaatcggcaaaaagatagtatgagctataatatatgctagtagagaac
+tctggaccatcatctatatgaatactgattcgagcgtgcaattactttagcctgcgtact
+actgactctacaaaacactctgagataagtttgtagtcagtaagtcgctctctataaacc
+ttttggatgaccattgtacagccacttatagatcccaataaatagcacaggagacagagt
+ttttcaatgctcgatcatttgccgatagtattttcgtctaacctcagggcacctattatt
+tgatacctaacctaacggccctttcacaatggagaaatatatgacatcgggacaaacaca
+aatggtgggtggccaggagatatgacatggtggcgtctctaagaaacacggactccctct
+aggcaaactcacgtaaccaattttaatgtcaaacaaaacgctcgaaaagattttgccgtg
+taatgacctggtacattgactggtcaggaatacatcactgtagttgccgtagtgtcctgt
+tggtgttccatcaagacacatcgtataacgcaatttacgacggacatcagatcaagttat
+acagattatttaagtatcacgtgtgcattgggacataagggatctcacacatgccttgga
+acatttttgctttgtgccgctttttcgctgcactaccaatccttacttaccagtatattc
+aaaggtcgttaacagaatgagaaaggttagggctctaagttatcgtcgattgggatagac
+gagacatttgcgagcgccctccacggatacgaatctcccatatcaatgtgaactggatgc
+tatgcagtttagttcttacgtctcctagtggtaaaaatcaaagtagcactcgcatagcag
+ttattcagaacctaatacacaaaaccgtcaaacattttctaattctaggtatgggccgat
+cataggagctaaggtgaaactcataaatgttttgttagatctagcatcctaaaaagatgc
+atatactgagtagctggcgtgcattctctcaattgtatcctttttaactgaactagtcgg
+tcccatttcgtgactgagatctattaaccgataagattaataacactcgcattcgtatca
+gctcagagtgaagtttttcaataatttgactgatatattaacttctaaaataacccttta
+agcctcggatccgtttcccaatcacatcaaaaattcttattccaactatctacggattaa
+caacgtgcatggggatcgtagtaagaacttgttccgatcactttgagtatatcaagttga
+cggcccggttattattgaatagaaacattcacctgctaaattaaataccgcacatcggat
+acccgatttcagagggccgtcttactaagggcaggctttgttcggtttaactgagatgtt
+cattattttacagtatgcttcaactaatatgtaacgaaggacagtggatctgtctccata
+gtagatcttcagtcgtgaatttcataccgctcctatttaagttcgcgttcgagttgttga
+tcatggcacgtgaaagcaacccctagtattctagacgaaaattttttctagttcatctga
+taatttgccaattcaaaaacaaccgctggtttcccggcgcattctctaaaatggaagtcg
+aacctagagccattatttgtcggtaacccatgagttccttcttttcagaagttaatacac
+tgtggtcctatacagaggaaaaacagcggttatatacgatcgtggcataacaacattgga
+tcaagatagcaatttggctacctattctaattctcactagattcggtattccactacaat
+atcggcagattaggattggatgaataatcggtgtttaagtccggttgcgtctccaatctc
+ctaatttttattaatattgatcttggtgacctattgtaaataaaaacttcaagactttga
+ataacggtgaaaagatagaagactcatttgaaaatggatcatccacagatccaaacatta
+gcaagacactaatccccaactagctattctgatcgcgatcgtgctgcagtactcctgtca
+caatagtctgttcatgatctaattctttttgggctttgttcgatggtgattcagaatctt
+tatccggtcgcttccctgtagctactttgtggggatattgcccggggattatagggttga
+gatcgtttcctaaaagtatttaaaccaagtagacttcaactaaactacatcagaacatcg
+tgaagacaccatacgcggtacctttatttaccgataacatttcttcaagaaataccggta
+agcagcataatgaccctaaacagctcggggtatcgtcgtagttttaaattttatttaggt
+tactgctcaaggaataaaaactaactatttaatttataataatattacaaggctcacact
+gattagatttgtctataagacttcgcgatcccccattaccggattgtcttaagaataaac
+tagataaaccatgcattttctagataaggcctttagtctaattagatacaaaaaacacga
+tagttgcatccttaatttattgtgtcaaacctggaaccttttaattacccgcaaatcact
+ttatgtcgagactacctctgaaatttattatctacctaccgcatgaggacttgaaccatc
+ttgtaggagttatgtttattagctaagattcgtttatcctgtagcggtccatgtatattc
+aacaagcaaaaagcactcagaattgtttttagttgagtcaagactgatatataaataagt
+ttccctagttttttcgtggtgggacgatattgaattgaatcttaaccgaagagtttccca
+ctctgtcgcacaataatacacgccaatatttccagccctgcttatgccttaatcggttac
+tcaatctcccattgaagttcattttgatctgcatagaagtttcgggcccagccttttttc
+tgccaccttcctccaagctctgtagacgcactctaagattgatgctcacatgtattaatt
+ctacattaacataaatatataagtcatgcatcttcgagtaaaatatctggttctccaaca
+tgtcctggcacgtatcgttataatgcccatacatgtagtattaaaatgattgggttaact
+ggatattaagatcatcgaaattgtaaagtcaaattaacaatactgtctcaagaccgtgta
+ttcctcgtgctcggaagggctattacgcttacttccgttttggtatcttaatatgacttt
+caaaaattaagttgcagtgagtcctacctgcgtgcatcggttagcaagagtataaaagtt
+gtttaaacgaactacttgctttacaataccggtcgtatatatcgccgtgaatccagaaga
+ttgtcttctttggattatcaaccgagatcctgtggaccgatgttttgggaccttcacaga
+ggactccaggtagagctcgcttttgcattaatctaagaattgtacctctctaaaagatct
+aaaacagtgaatgtgtatttcatggaaaaacacagagaaacgtaaattactttaggccga
+aaggcacatgagttattatacatatacgagatggtggtatacatcgaattcggggcatac
+actatagttgcattgtatttagctgctttaaataatatgatattaccttccttacataag
+acattaccggcataccctggttttcaacttgtggggctttttgacgatcgcactctcatt
+tgatccgagtagggcggtgacccctgcttttcaaatacaaaaatttcgctatgaaggtaa
+tagattacttttcgctgttatgatagaaacggtaaatttaaaattgaaacttctagaaaa
+gtaaagtaacgagaaatgattttgtgaataatgcggtcatgattgcgcaagtaagaaaaa
+aaggcaaaaggatgcgcggaatagaaacttatcagtcacgggtatcttgatttcattctt
+cttgtcaattgccgacataggatgaaatcagattccaatgcaatacacagtaacccccac
+ccttgattgtaatgtcgatttgaagttgtacgcgtcgacgaagtggatagtatacgggcc
+ttttgtacggtgcgatcaactatgaatctcggcgagttagatggtcgtacaatctcacac
+atagaggtcacttgcctgtaatgacgaattttcggctaggtactcgaactttattagaag
+taaaaatgtgggcaaaagaaggattccattttacaagacgattacaatgagttacatgtc
+tctcaacgtagtctttccctagtagtctttgaactatttaggtactccagaaaattttag
+caaagggtttctgtgtgaatccgccattcatgtttatgatggaacaataagaataacgcc
+ctcgtatgttatcgacagtgaagtcagcagttcggccaaaaacatattcaatttagtaca
+gatccccagaagttaagctaagtgctctaaaatggcctaaacggttatcaaagtaggtct
+aattactatactaacgggtgcatcgtaataactgctgtcgatgcaacactatatgatagt
+gtcgttttgctatatatgtacaatgtgacaaagaagccttagcgattcttgcaaacttag
+gacttcggattctcaatcttaaatgtccgaaaacgcaaagattcaaaaatttaatctatg
+agcagatatgcctgatggtgactacgcgtatgttaaggctaaatgttgacaaccgcacac
+ataatcgaactattgatagtcgggagcataaccaggtgaacgtactttgttcacgacatt
+tattgacatgttctaaatacgtctcaaaatcacggcgcactagaaaacgcaatcaaatca
+ttgtcctggtttaagggccgtaatgccggtagtgtcaaacttcatgagaactttagctgg
+cttttggccagtatttagggaccaagagcactagccttaagctgaatattttgccattta
+tctactgttataactttaaaacttggtggcaccagacttgtcgatacacacgcatcaatc
+tgtaacgtaaaaggtttactaagaacaagcgtaggaattgagtttatattatatttaaac
+taaaagatgatattagcttctgagggcgatagggctccaaatcataaagaggaatatatt
+attacacgattagaaacccacaacatacctcgaatcgcccaaaagtttgacgaaacttgg
+cagtactccacatctcagtaatacagttgggagagtctcaaatgttgttttattactcaa
+tgaaccaccctcataatttcactgctgttccattaaatttgcaaacgatcatttgctttg
+aagaaacgtaaaatcgacaaaattacagataagtagatgcataataaaaaaaactgctcg
+ctataacacgatcatcgtgcattcttacttaggagcatcacccgcacaataacgtacctt
+aaactacaacactattagaccgagtactgtaattcacgaaagctcaagctcgcattgtaa
+agaacttgctctctcgtaaaatgtgataatagtttgcggagaggattcaattattttcca
+ttgcacctactccactagattcgataaaagaaggtggtcctcccttaaaaagaaatgtta
+agtaacatcggaaccataagcaaagcatgtaagtgaaccgtcatccttccctaagaaaca
+taaaggtttttaataatgtcgactgtgaactataactgcatcctttcctgacctactccg
+gttccttgttgttatttctgaacgagaccagtagataaacaatgtaaaccacagtgggta
+ccaatggtgcatgtgacgctaccgttgttttaagtgcccgtacaaacataagaagtcata
+atcttacttgaaattaattttgccttttattttttttcaggctcgaaattaatgatttgt
+tttttttgaccttctagttacgctaatatgcggtcgcctgtggtttctattgagtcctat
+aacgggatgggatctaatacgtttggttactagtaaacaaggtataaatttgataccgga
+gtatcaactgtataacatcaagctttatgactcatacgcgaagtaatgacacaaggcttt
+caggagatcgcgagtacagagccactaaggggtgtattacgatagtgacaccaccgagcg
+cactcactccccaagtagatttatgatcctacgctaagtattagatatataaccaaagag
+gttctagtcagtgcaactcttagaataataattagccggttttgcctttttaggcctaat
+gcaatattcagctagcccttatgtatctcgcgttccacagcaccactcatggcacgcgtt
+taaactaatcaaatataatctatgaatgttatgccagtacttgaataaatcaggtttttt
+ataagtccttgcatactctcgttatatactgttagagtcttaccccatagaaattctttc
+atctgcaaacttagaagaattctcagctacggggagcataaagtccccaggatgttgaca
+aatacaacaaatgtggcttatacaaacactccatatgaaaatcgaaccctcgtggtagtt
+ttagccgaaccttgtacggataaatccctccattttccaatagcagatacctatcctact
+acctcgtggtattaaattaaagcttgaaatatagagctgcatagcttatccaattcccaa
+gcacgagtctaccgtcgtaaccacgatttgatttacagacgctagagcaaacccatcttt
+aaacatataagtaaaaattaaagggtgagtgcgtacgtgtttactagcaacttcgcttat
+taagacaattgtttataagccataattaaaaacatatgttcaacaggttcattgatattt
+gtaattgcacaggtttttaataaggatctacgtaagtataatgaacaaactttttaccag
+agttatattctgtactttgaaaatgctcctctaccgccttagagactttcaattagattt
+tttgcagttaatctatgcgtaagtgaaccatgcaagggatgcgattcaaccgcctcgtgc
+taaccctatcgtctgtctcataactgtaggtctaatataattttcagttttcgaacacat
+aaccctttgaaaatctgctatttaatgtctcacctgcatgcactatcttctatactgctc
+agaacggctatacgtcactatgctccaagtgacgatttaaacgaagcaaggaataatagg
+tttattttagtgcaaaacaattaagtgcggactacgtgctctttacaataagccttgtga
+ttgggctataggttaagtcccatattaacgatctccaatgtacaaaatcgacaatcgctt
+tgcattacccggttactagtcgaattacagatagctgttagatactcactctaattttgg
+acaacaatcccaatcttggggtcgtctatcgcctgaagctcgtaaatccttccatcttaa
+acgattacatattatagacttgttcggggtagagatatcacagttgtgcaaacattgtaa
+atcgatactagtttatgttggtagtctagttgcttttaccattccccgaaaaacttgatc
+tactatttcgacaacagtaaacttgaactaggtaagtgaaaacagagaatgcctcatagt
+gccactatttgtccactatatgtaagtgtagctttacataatccactatgactgagatca
+ttacggcctaggaaagcagcgtagaaaaaaagggcccggatattacgactgtaactataa
+aactagttactggtagcgcgccatgtatagatttgttttaccggttgtggttgcgttaac
+gaatttcagccgcgaaaattgatccgttaaccagtccatctcgacttctataaaacgata
+aagtaaagttgatgttcagcctccttcttatggttgcatcgagagtacactactcagtgg
+gaaatagatcggggttcctacttcagattgtattatctaggcaattgccgattgtgccat
+acctggataaaataagctacctacatgtgatgcttatctattatcgtcatactaccttag
+ggtgtcctgttgaacgctacattaatctttagccgtttgagatgttccaatggataggag
+tctaacgcatgatgaagtttaggaaggcagagcatcccactaagtatgtgacagtgtatt
+tcgaaacgagacgttataaatagaaaaaaggtccttctggttctattctgctgaactatt
+gaatggaaagattggttgacctacgtactatttgcttgaagtcatcaatttgacggggtg
+agagacatatggtgcatactttacggactctatattttagatcagaagcttagcagtctt
+ctctacaccccctcacgacataattgcttttaagaatctatgtttgattcctctacggga
+attcggatccgttcgcatgtgcggtttatctaaaccaggggacatatgttcagctaaagc
+atacgaacactttgctaactagacgtatgtatagtagctataaatcccgacgatatttac
+aaaaagaaatgagactcaaatatatacatagcgaccctacacttattcgcaccctgatct
+aggcgatcctagcacccacacccgaaagtgagcactagtgtcttccgtattaaatttact
+gcagttgagattttagttgtctactaaggattactctaacccgtaataaggatcaagact
+cggtactagctttactatcattccctatgtgttttcctaactcacaagggtacgtaccag
+cctatgtaattacaataatgataaagacacaaaggaagtaactttacaaatgagtctcca
+gttacactagcttagtccctcccatcttgctttgaagtctaaatacgcaatctctgagga
+tatacagcagaagaacactcataacgttggagtccaagaattagactcatagggccccca
+acatttaatatgtactgtgagtttgaaggtgttctattgttaattcctgctcttgataca
+tgacacgtactccgtgtttaaggcttcggactgactttctttcataagttgagcaacgaa
+aatttcagaatcgataagttggattcactaactaatacggctgattgaaaactccactcc
+ggacctatatggtcgacctttatacgtaaccgatataaaacttataggctggtatatcga
+gccttcctagcgcaatttcggatggggtttcttctactactcaacaacggaatagtcttt
+gtttagtaaaccagagctcaggacgcccaatacgtaggagagcgctgtggagcatgtgtc
+attatggactggagcactcttaaatcactctgcgtgtgctaaacgatagatcataacatg
+tcctgagtaaattttcttgatacgtcgcaatataccgttattagttaaacgttctcatcc
+gtcatgcgtgaaatacggctgtcgtgctcagatatactattagcgactcatctcgcctaa
+cacgcacacgtataaactcggaatgactgccgctcttacatattagaaatacagactaca
+ccacggaagcattgggtcattctcaaccgctgtataaaagatgattagtcttataataag
+attaccaaagaggcagaatcatgggtagtaaatctattattcaagtgattaccgtcgtgt
+aggcagggagtgaggacgagatggtactcaggacaaatattaaccggacgaagtggttta
+cgtcgtactttcactattagtagtaaatacaaggtaacaccggggaatagtactaaatat
+aatgatatctatcttcgggagaacgagtcgtctattgctttgaacattctcaaggcgtaa
+aatgtgctgacttatagcatgatacaaccgattgttacttttgtctattcaaaagattga
+atagttttttatacaaaagccgcatacttatgacggctagtatacagtttcatcccctag
+catcaatgctatggacagtattgaacttataggaaattcttctaatagggcaaatccgtc
+gtgatgcctattttttttcagtcacatcctcaaatggcactagtattgtcgggatcccat
+taacaggctcaaccacgagctcacgcgaggacatgtagtccgtatctttaacgaagcgac
+agcgacagaactcccatggataaccaattataaggcccgtaatcctctagacatcgttta
+ccaataaatccgctttctccgtaatcatgttgaataccccagagtagtccagatgataac
+cgatgaaacacaagtctttctcaatgcacttacggtgaacttattaccgccaacgtagct
+catcaaggttgcgacatctagttgtgtgtttgcgacgagcccagcgaacttcatcaactt
+tcgtatattcaacgccttgtaattttactttaagacgcctggtgatgtagattcttagat
+aatcagtttgttatcggctgtactttaccataatttcacaggtttcaggtcaagaagatt
+atagctgtatatacagttccatgctcggtgcacagaaacgtgatcggataataatcaatc
+gcttatgtcgtctttaggcgtatccaatacatgccccgataccgcagtgtatttcgacat
+gtaggtataccgtcgcatttgagctcgagtcaggacgtcagctagattagattccttaat
+agaatataccgacctctagtccgaactaaactatagataacgccaacttcaggttaattg
+tctagtcgtctgtttgcagatgggattcttagatgagtgagtatcggccatattggttcg
+agcactttagtttttgatgcataggatatgcaatgtatagctgaaagtactttatctgtt
+tcaaactcacattgattaaaccggtaaacctttaaagactacaagaaaatattcagtgag
+ggcaattttgtcaatcacaatcttccagctagagatacttcacaatttgtcttgaggcta
+cgcaacattagacggattttcgcgttttattgaaataatcgaggggcccaagagtatcca
+tagttcattttgtaagatttctttacaggcttattacagcttcttcagactcctacatgc
+ttacgagttatatgctagcatgtgaacaatagattaatatacaggaaaacgtacattgag
+agagatgaccctacacagcgcaaccgttgagtactttcattaaagggtaacgctctcgag
+acagcatccttaagatggccttattgtcaaatcatttgcagaagtacgcaagatccctaa
+ccaacgtagaagaatccctacaaacacatgagacgcggtgaaaatagacagggtgttagt
+attcaatcttcggagtatcaatttcgccaatcttggtgagaaagcataccctttcttcag
+agaaagaagatcaatcataacactatctttaacgaggtacgcacgcgcatcattacctgc
+ctccatggatctttaggatagcggaaagtattggcagcgtattgtgatttcgttcctact
+ttatcaatttcacattcatatacatgtcttttatcaaaatcgccaataagataggatgag
+ctatattagatgctagtagagttcgcgccaacatcatcgataggaatactcaggacagcg
+tgataggacttttcaatccctaatactctctataattataactctctcttaagtttggag
+gcagtaacgcgctctatataatcagtttgctgcaccattcttcagcctctgatacataca
+aataaattccacagcagtaagagggtttaattgagacatcttgggaacttaggattttac
+tctaacatcaccgaaacgattattggataccgtacctaaacgaactttctcaaggcagta
+atataggacatccgcaataacacaaatgctgcctccccaggagttatgtcttcctggagg
+ctatatcttacacccactcactataggcaaactaaagtttaaatgttgattgtctaaaaa
+aaagatagataagagttggccggcgtagcacatgcgaaagtgaatcgtaagctataattc
+tctggacttgaagttctgtcctgttcctctgcaagaaacaaacttcctttaaagctattt
+acgacgcacatctcagcaagttataaacatgttggaagtttctagtcggaattcccaaag
+aacggatctatctaatgcattcctacatttttcctgtctgccgatggtgccatcctattc
+aaagaatttcttaaaagtagattaaatgggacttttaacaatgagtaaccttacgcctct
+aagggttcctcgagtgccatacaccagtcaggtccgagccacatacacggagaacattct
+aacatagcattctcaactcgatcatttgcaggttacttctttcctatcctagtgctaaaa
+atcatacttgcaatcccatagcacggattaagaacctaagaaacaattcagtaaaacatg
+ttcgaattcttggtatgggaacatcattgcagctatggtctaacgcattaatgtttgggt
+acatcttccatcatataaacaggaagagtctgacgacagggagtgcttgcgatcatgtct
+atcattgtgaaatcaaattgtagctcacatgtcgtctatgagagcgtgtatccgataaga
+tttagaaaaatagaagtcgtataagatctcactgaacttttgaatgaatgtgaagcatat
+atgatctgctttaataaaactttatccataggatacgtttccaaatcaattcaataatta
+ttagtcaaaatagataaggatgaacaacctgaaggccgatcggacgtagaaagtggtccc
+atcactttgagttgatattgttgaaccacacgttattatggttttcaaacagtctcagga
+tattgtatatacagataatccgataccagttgtctgacgcccctcttacgtaccccaccc
+tttgtgacgtttaaagcagttgttcagtattttaaactaggcggcaactaatttggaaag
+aagcacagtggatatgtctaaattcttgttattcaggcctgaatttaatacaccgcatag
+ttaacttcgcggtagagttgttcatcatgcctcctctaagctaccacttctatgatacac
+caatagttgttctacggaatctgataattggccaagtcataaacttccgctgcgttcaac
+ccccttgctcgaatatccaactcgaaaagacagccttttggtgtccggaacaaatcagtt
+acttcttttctgatgttaattctctgtggtcagatacagaccaaaaactccgcggattta
+ccatcctccaagaacaaatttgcatcaacatagcattttggctacatattctaagtctca
+atagtttaggttttcaactacattatcccaacattaggattggaggaataatagctgggt
+aagtccccttgcgtctacaatcgactattttttatgaatatgcttctgccgcacctatgg
+ttattaaaaaagtcatgactttgaagaaccctgaaaagatagatgaatcaggtgtaatgg
+cagcagccaaagagcatataattagcaacactctaagaacattatagatatgatgatagc
+gatcgtcatgatgttatccggtcacaatagtagcttcatcagctaattcgttttgccagt
+ggtgacttgcgctggaagaatcgttatacggtcccttccctcttgatacggtgggggctt
+attcaaccgcgtggattgggttgtcatacttgcattaaacgatgtaaaccatctagtagt
+caactatactaaatcacaaaatagtgatcaatacatacccgcttcatggttttaaccatt
+taattgattaaagatattccgctaagaaccattatctacctaaactgatcgccgtatcct
+agtagtttgaaatttgatgtaccgtaatgatcaacgaagtaaaacgttatattgtatgta
+gaataataggtcttggagctaaatgatgtgattggtagtgaagacttacccttacaactt
+taccggtttctcggaagaatatactagagaatcaatgcatgggctacataagcactttag
+tctaatgagataaaaaatacacgagtcttccatcatgaattttttgtcgaaaaactcgaa
+cctggtaatttaaaccatatatctttatgtcgtcaataactctcatatgttttatataac
+ttcccaatcacgacttgtaactgcttgttcgactgagctgtttgagctatgaggccggga
+tccggttgagctacatctatttgctacaagaaaaatgaaagcacatttgttgggagttct
+ggctacactcatagagaaataagtggcccgagtgggtgcggcctgcctccatattcaagt
+gtatcttaaaccaagtggttccaacgctcgcgctaaagaattaaagcctttatttcctcc
+acggagtagcccgtaatccggttcgaaagagaccattgaagttaattttcatatccagtg
+aagtttaggcacaagcatgtgttctgccacatgcctcaaagcgctcttcaaccaagatat
+gattcatcctaacttcgatgaatgcgtctgtaacataaatatagaaggaatgattcggcg
+agttaattttcgccttctccaacatggcatccctacgttcgttataaggaccatacatgt
+aggttttaaaggtttgcggttaatcgatatttacatcatagaaattctatagtcaaattt
+acaagactctagatactcactcgttgcagccggctaggaagcgctttgtaccttacttcc
+cttttcgttgcgtaatatgaatttcatatagtaagttcaaggcactcatacctccgtgaa
+gagggtagatagactattaaagttgtttaatagtacgtattgatggaaatgacccgtagg
+agatttaccactcaatccacaagattcgctgctgtgcattatcaaaacagtgcatgtcga
+aacatgggttgggtccttcaaacacgaatccaggtagagatacctttgcaatttttcgat
+gaaggcgaccgagataaatgagctataacactgtatgtcttttgattgctataaaacaca
+gaaacggatattaatttaggccgtaaccaacatctgttatttgacatagaacagatggtc
+ctttacagcgtattccggccttaatattgaggtccagtgtattgtcctcctttaaagaag
+ttgattgtaactgacttaaataagacatgtcacccattcactgggttgcaactgctggcc
+ctttttgtccatcgcacgctaatgtgataacagtaccgccctcacacctgcgtttaaaag
+acataaatgtcgctatgaaggttattcattaattttagctgttttcttagaaaaggtaaa
+tttaaaattgaaaaggctagaaaactaaagttacgacaaatgtgtttgtcaagtaggcgg
+gcatcattgagattgtaagaaataaagccataaccagccccggaatagaaaatgttaagg
+aaaggcgatcttctttgaattcttattgtcaagtgcagtcatacgttcttatcagaggac
+attgcaataaaatctaacaccctcccttgtgtggttgggccatttgtacttcgaagcgtc
+caccatgtgcagaggataacggaatgtggttccgtcccataaacgatcattctcgcccac
+ttagtggcgcggtaaatcgctctcatagaggtaactggcctgtaatgtccaatgttaggc
+taccttctccaactttagtacaacgaataatgtccgattaacaaggagtcaatttgtcat
+gaccagttcattcaggtacttgtatctatacggacgcgttccagagtagtatttgaaatt
+ttgaggttctactgataagtttagctatcgctgtatgtctgaataagaatttaatgttta
+tcttcgataaataacaattaacaactcctaggtgatacactgtgaagtctgctgttcccc
+aaattacatatgctattttgttcacataccatgaagttaagctaagtgctctataatggc
+ataaacggttatcaaactagctcgaatttcttttattacgccggaagcggattaactgct
+gtagatcaaacacgttaggatagtgtcgttttcatatatatctaaattcggtctaacatg
+cattacccatgcttgataacgtagcacttcgcagtctaattatgtaatgtccgtttaacc
+aaactttaaaaaagtttatctatcaccagtgatgcctcatcgtgactacccggatcttta
+gcctttagggtctaaacagaactaatattactacgtgtcatactccggagcttaaccagg
+tgaaacttatttgttaaccaaatttagtgacagggtagaaatacgtatcaaattaaccca
+gcaatacaataagcatgaaaataattgtaatcgggtttgggccggaatcccgcttggcga
+aaacttaatgacatagtgtgatgcattttgcactggattgagccacaaactcaactagca
+ttatgctcaatatttggccagtgttctacggtttgaaatttataaaggccgcgcaaaagt
+cttgtagttacaaacgcataaatctcgaacgtaataggtttaattagaacatccgtagga
+tttctgtttatagtagatttatactaaatgttctgattagattctgacggccttacccat
+acaattaataaagacgaatatattagttatagtttactatccaaataaattaagcgaatc
+gaaataaactgtcacgatactgggcagttatcaacttatcacttatacagttcggacact
+ctatattggtctgtgagtactctatcaaactaactcataagttaactgcgcttccattaa
+atttcaatacgttcttgtgctgtgtacaaacctataatcgaataaatgacacatatggag
+atgcataataaaaaaaacggctccatatttctcgttaatcgggcattcttaaggaggagc
+atctcaccaaaaataacgttcctgataagtcttaactattagaccgtcttcgggaatgaa
+cgaaacctcaagctagcatggtatagttcttgatagcgcgtaaattctgataatactggg
+cggacagctggaaattagttgccagtgcacctacgcaaatagtttacataaatcaacggg
+ctccgaacgtaaatacaaagggttagttacatcgcaacaagatgaaaagcatgtatgtct
+accgtcatccgtccctaacaaacataaaggtggtgaagaatctcgtaggtcaactataac
+tccatccttgaagcaactactccgcgtccgtgtgcgtagttcgcaacgagaacactactg
+aaaaaagctaaacaactctcggtacaaatgcggcttgtgtcgataaagttggtggtagtg
+cacggaataacataacaaggaatattatttattcaaattttttgtgactgttatttgttt
+tctgcctagaatgtaaggatgtgttttttgtgacctgatagttacgcttatttcaggtcc
+acggtgcgtgagagtgtgtcctataacggcaggggagcgaagtagtgtcctttagactat
+tcaaggtagaattttgataacgctctataaaaggtagaaaatcatgattgagcaataaga
+ccccaacttatcaaaaaaggagttctcgacagcgcgtgtacagtccctataacggctgta
+tttcctgtgtcacaacaccctcccatcgcactcaaaatgtagatttatgatcagacgcta
+acttgttcttagagaaaaatacacgggatactctgtgcaacgatttcattaataaggtgc
+agcttgggacttttttggccgtaggctttattaacattcacagtaggtagcgagacttcc
+tatgaaccaatcatgccacgcgttttaacgtttcaaatataagctaggaagcgtttgcca
+ggacttctataatgcaccgttttttttagtacttccttactagccttagtttatgttaga
+gtctttccaattacaaaggattgaatagccaaaatttctacaattctcagcgaacgccag
+cttaatctaaacacgagcttcaaatattctacatatcggcaggagtcaatatataaatat
+gaaaatcgtaccatcctcgtacttttagaccaaacgtcttcggataattaaatccttttt
+caattaccacagtacgtgcattagaactactgctatgaaagtaaaccttgaaatatagtc
+ctcaagagcgtatccaagtacattgcacgtgtatacagtcgtataaacgagttgatgttc
+tgacgctagagcttaccattcgttaaacagataactaaaatttaatggctgagtgactta
+gtgttttcgacaaacgtcgcggatgtagactattgtttataagcaatttttaaaaacata
+tgttcaaaacggtatgggatatgtcgaattccacaggggtttatgtaccatagaagtatg
+tataaggtactaaaggtttaaatctgtgatattcggttcggtgaaaatcagactagtcac
+acttagtgtctgtaaattagattgggtgaaggtaagcgatcccgaactctacaaggcatg
+ggatgagattctaccgactccggataacactttacgatcgcgcataactctagctcttag
+ataagtttaacttgtcgatctcataaacagttcaaaatctgcgatttattgtatcaaatc
+catcctctatcttctataatcatctgaaccgcgatacggcactatgagccaagtgaagat
+tgaatccaagaaagctataattggtttattttagtccatttaaattaagtccggtataag
+tgctctgtacaatatgcagtctcatgggcatatacgttaactaccttttgatacttcgaa
+ttggtaaaatatcgactatcgatttgcagtaaaaggtgtagagtccaattactctttcct
+gttacatacgatctcttagtttggacaactagcccatgatggcgctcctctagcgcatga
+acctactttataattacatctttatcgatgaatttttttagactgcggaggccttgagtt
+ttaacagggctgctaaatttcttaagcgattagacggtagcgtcgtacgctacttgcttg
+gaacaggcaccgaaaatattgatctactattgcgtcaactctattctgctaatagcgatg
+gcaaatcacagaagccctcttagtgacaatagttgtcaactatatctaagtcgaccttta
+ctgtatcaacgatcacggagagaattaccgaatacgaaacctcaggactaaaaaacggaa
+aggatttgtcgacggtaaatataatacttgttaagggtagcgacacaggtatactttggg
+tgtaaacgtggtgcttcccggaacgattttcagaccagaaaattgttccggtaaccagga
+aatctcgtctgcgttaattcgtgttagtaaacttgatcttcagactccttcttttcgttg
+cagcgagacttaaattatatctgcgaaatagtgccccgtgcatacttcagatggtaggag
+ataccatttggcccattgtgactttacgcgattaattaaccgacatacatctgttcctga
+gctatgatcgtctgaataaattacggtctcctcttgatacctaatggtttctggagacgt
+ttctcatgttcaaatggatagcaggagatcgcttcatcaagtttagctacgcagagcatc
+aaaatatgtatgggaaagtcgatttccaaaccagaagggataaagagaaataacggactt
+ctccgtagattagcctgatattttgatgggaatcatggcggcacatacgtaagagttgcg
+tgaacgaatattttggacggcgggagacacatatcggccattcgttaaggtctctatatt
+ggacatcacaagcttagcagtatgagctactaacactcaagacattattgattttttcaa
+gatatgtttcattcctctaccgctattcccatacgttcgattcgccgggtgagcgaaacc
+acgggactgaggttaagctaatcaataacaactcgttgcgatagagacctatgtatacta
+gagagaattccccaacatttttacaaaaacaaagcagactaaaatagatacagtccctcc
+atacaattaggaccaacatgttattgccgatcctagcacacacaccacaaactcagaact
+tctgtcttacctatgaaagggtctgcacttctgattgtacgtgtctaattagcattaata
+ttaaaactaattaggataaactataggtacgagctttactataagtcactaggtgttttc
+cgatcgaaaaacgggaccttcaagccttggtaagtacatttaggataaagaaaaaaagga
+aggtacgtgactaatctgtctaaactgacaatagagtagtacctacatgcttcatgtcaa
+gtcttaatacgcaagcgctctcgttatactgctcaacaaaactcataaagttggactcca
+tcatttagaatcatagggaccaaaacatttatttgctactgtcactttgtaggtgttcta
+ttctgaattcctcatattgatacatgaatcggaatacctgtggatcccttaggacgcacg
+tgctttctttacgtcagaatacatattgtcagaatcgagaagttccatgcaattaagaat
+tcgcctctttgaaaactcatatccccacatatagggtccaccgttattcggaaacgatat
+aataattattccagcgttgagcgtcccttaagagcgcattttcgcttggcctttcttcta
+cgactctacaacgcaagtggctgtgtggagtttaccacagcgcagcaccccatagaacta
+cctctgagagcgcgagatggtggcagtatgctctgcagctagcgtttagaacgcgcccgc
+gcattaaccagtcatattaaaatggactgtcttaattgtcggcattaggagcaatattaa
+ctgatgagggtatcggtcgcagaagtaatgacggaaatacgcctctagtccgcagagata
+cgattacagactcagatcccctaacaagcaaaacgattaaatcggaatcactccccctat
+gacatatttgaaatacacaagaaaccacgcaacatgtcccgcattctcaaccgcgcttta
+taagatgttgagtctgagaattagatgacctaactgcaagaatcatggcgagtttatcta
+gtaggcaagtctgtaccctagggttcgaacgctgtgacgtcgtgatcggtctaaggactt
+agatgataaccaagaactggtttaccgagtactttcactattaggagtaattacatgcgt
+tcaccgcggaatacgacgaaattttttcatatctttatgagcgagatcgtgtcgtctttg
+cattgcaacagtcgctaccagtaattgctgatcaattatagattcattatacagatgctt
+acttttctctattcaatactgtcatgagttgtttttaaataagcaccagaattatgtcgc
+ctagtataatcttgcttccacttgaatcaatgcgatggacagtattctactgattgcaaa
+gtagtctatttcggcttagcagtacgcatgcctatttttttgcaggcacagaataatatg
+caactaggattctcggcatccaattaacaggctaaaacaccaccgaaagacaggtaatct
+acgaagttgatgtttactacagaaagcgaatgatatcacttggagaacattttagatgcc
+cccttttaatctagactgagtgtaccaatatatcaccggtctaccgaatcagcttgaata
+aaccactctagtactcatgataaccgagcatacacatgtatttctcaatgcactgaaggt
+gaactgtttacaccataccttgcgaatcaacgtggcgacttatacttctgtctttgagta
+cagcacaccctaatgaatctaagttagttgttgatacgaattgtaatttgactggatctc
+gcctcctcatctagattcttagagaagatgtttcttatagccggtactgtaactttattg
+atctggtttatggtaatcaacattttacctctatttaaacgtccttgcgccgtgcactca
+atcctgatcggtttagattcaagcgattatcgagtctggaggccgagaaaagaaatgcac
+agagtaagctctctattgcgacatctacgtagaaactcgcatttcagatcgagtaagcaa
+ctctcattgtgttgattcagtaatacaagattacctacgcttctacgaaatatactatag
+atttagcctacgtcacctttagtgtcgagtcggagctttgaagatcggatgcggtgtgga
+ctgtgtataggcaattttgctgcgagctcgtgacttttggttgatgtcgatatcaatggg
+atacctcaaacgtctttatctctggataactcacattgagtataccggtaaaaatttatt
+ctattcatctaaatagtcagtgagggctagggtcgcaatcacattaggccacatacacat
+acttaacatgttctattgacccgacccaactttagtagcattgtagccgtttatgcaaat
+atgccaggcgccaaacactagccagagggcattttgttacatttatttaatcgattatta
+cacagtcggaacacgcctacatgcgttcgacttatttgcgacatggtcaacaattcagta
+atttaatccaaaacctaaagtcagagacatgacactaaaatcacattaaggtcagttagt
+gaaggaatggctaaccagctagagaatgcatcattaacaggcacttattgtcaaatattt
+tccagatctaagcaacatcacgttaaaaagtacaacaatcacttaaaacacatcagtcca
+ggtgtaattagaaagccgcttagtaggcaagcgtaggagtataaatgtagacaatagtcg
+ggacttagcagacactggatgcagtcatagaagatcttgcataacacgttagggttagag
+ctacgaacgcccatcattaactgcctaaagcgtgcgtgagcttagcgctaacttttccaa
+cacgtttgtgatttcgttcataatgtatcaatttcacagtcatatacagggagtgtagaa
+aaatcgcaattaacatacgttgacctatttttgttcagagttcagttagagcctaatgat
+tcgagagcaataatcaggacagcctcataggaagtgtcaatcacttagaagctatattat
+tataaatcgctctttactgtcgtcgaaggaacgagcgagagagaatcagttgcctgcaac
+tggcttaacaatatgatacataaaaatattttcatcaccactaagacggtggaattcaga
+cttattggcaacttaggatgggactattaaataacccataagatgttgggataaagttac
+gaaacgaaagggatatagcctgttagataggaaatccccaataaaacatagccggcctcc
+acagcagtgatctattccgccacgcgatatctttataccacgcaatataccaataataaa
+ggttaaatgtggttgcgatttaaaaaagatacatatcagttgcaccgcgtagcaaatccg
+tatgtgaagcgtaacctagaattatagcgtctgcaagttctctaagcttcctctgcaaga
+tacaatatgactttttagcttttttactaccaaatctcagaatcttagaaacaggttggt
+acgtgctactcggaattcccaaagtaccctgctatatatgccattccttcattggtccgg
+gctcaccatggggccatcatagtaatagaaggtagtaaaactagttgatttccgactttt
+aacaatcactatcctgacccagatatgggttccgactggcccttactccagtaagggcag
+acacacagacaacgagaacttgataactttgaattctcaaatcgatcattgcaacgtgac
+ttatttactagcctactcctataattcatacgtcaaatacatttcaacggaggaagataa
+taagtaaatattcactaaataatggtcgaaggagtcctttgccaacataagtccacatat
+gcgctatagattttttcttggggttcatattcaataagataaacagcaagagtatcacgt
+cagcgagtcattgagatcttggctagcattgtgatagcatattctacctaaatggtagtc
+tagcacagagtggataagatatcagttagatatagacaagtactataacagatctcgctt
+cgttggattgtatggctagctttgatgatatgattttataaaaattgatccagacctgac
+ctggccaattatattcattttttatgagtaaaaatagataaccatgaaaatactcaagcc
+ccttaggacgtacaaagtggtaacataaatttcaggtgttattctgcaaccacacctgtt
+ttgggttttcaaaaaggctaagcagattggttttacagataatccctgaacactggtatc
+tcccaacgatgtcgttcccaacccttgctgaccttttaagctctgctgaagttttgtaaa
+ctaggcggaaaatatgttcgatagatccactcgcctgaggtagaaattcgtcttagtaac
+gcctctttggattacacagaatagtgtactgacacgtacactgctgcagcagccatacgc
+taacattaaaattcgttgagtctacatttgttgttattcggattatgttattgggaatag
+tatttttattcccctgcgtgaaaccacatggatagattagcctactcctaaagactccct
+tttggtctacggttcaattctcttactgagtttatgttcgtaattatatcggcgcagtga
+atctcctaattatcaccggagttaccagacgccatgaacttatggccagaaacattgcat
+gtggcctacataggattagtatcaagagtttacgtttgcaacgacatttgaccaacttga
+ccattcctgcttgtagaccgcgggaactcccctgcacgcgactatagaagttggtggtgg
+atgtggcttatgccgcaaatatggttttgaaaaaagtaatctattgcttgatacctgaat
+tgagacatgtataagggctattgccagatgaaaaactgcatataaggtcaaacaatataa
+gaacattatacataggatcttagcgttcctcaggatggtatacgctataaagtctagctt
+cagcagctaaggagttttgccagtgcggacttccgctggaagattaggtttaaccgccct
+gacatcttcataaggtcgggcctgattcaaacccctggagtgccgtctcatacttgaatt
+aatcgatggaaaacttcttctagtctaatattattattaacaaatgacggttcaataaat
+aacaccgtaagggtgggaaactgttaagtgatgaatcattttaacctatcatccattagc
+tacagataatgataccccgatccgactagggggtaagtggttgttccgttaggataaacc
+atgtaaaacgttagagggtttgtagattaattggtattccagataaatgaggtcagggcg
+agtgatcaattacactgaaaaattgtcagcttgcgcggtagttgttaagacagtataaat
+gaaggggattcagaagcaagtttctcgattgactgaatttataaaccagtcgtcaatcat
+gatttttgtgtcgattaaagcctaaatggtaatttaaaccattgatatttatcgagtcta
+taaatatctttggttgtatattacttcacaatcaccaattctaaatgattcttccactgt
+gcgggtggagatatcaggacgggttaaggttgacctacatcgttttgatacaacaaaaat
+caaagcacatggctggggacttctcgatactatctttgagatagtacgggcaagagtggg
+tgacgcctccctacattttcaagtctatcggataacttctcggtaaaacgctcgcgatat
+agttttaaagcattgatttaatccacgcaggagcaagttttaccggtcgaatgagaaaat
+tcaacgtaagtgtcatatccagtcatggttagccaaaagcatgggttatccaaaaggaat
+aaaacagctcttcaacaaagagatgaggcttcataacttcgatgaatgcgtatggttctg
+atatatagatcgatgcatgaggacactttattttagccggcgaattaatggaatccatac
+gttacttatttggacatgacttctaggtgtttttgctgtcccgtttagcgatatttacag
+attagtatttcgtttctcatagttaattgtatctagatactaactcgttgaagacgcata
+ccttgccatttgtacaggacttaactgttccgtgcgtaatttgaatttcttataggttct
+tcaaggcacgaatacctcactcatgaccgttcatactctagttaaggtcgggaatactac
+gtatgcagggaattgtaacctaggagatttacaactctttaaacaagagtcgctgaggtc
+caggatcaaaacactgaatctcctaacttcgggtgcctccgtaaatcacctagaaaccta
+ctcatacatttgcaattttgagatgtaggcgaaagagagaaatctgctttttaacggtat
+ctcttgggattccttttaaaaacacataacgatagtaatgtaccaagtaaccaaaagctg
+ggatgtgtctgtgtactgatccgccgtgtcagagtagtccgccatgaatattgacgtcaa
+ggctagtgtcatcaggtattgatgttcattgtaaatgaaggaatgaactaatgtcaccaa
+gtaaagggggtgaaaatgctccccagggttctacagacatagagatggtcagaacacgac
+ccccctctcaacgcagtgtatttgaaatatatggacatatctaccttattctgtaatttt
+agatgtgttctgtgtataccgatattgataagtcaataggcttgattacgtatcttaaga
+caaatctgtttcgcaagtaggaccgcatctttcagattgtttctttttatgccataacct
+gcccaggaattcaaaaggttatcgatacccgatatgctgtgaattattattctaatggcc
+actcattcctgcttatatctggaattggcatgaatatcttacaacctaaagtctggcgtt
+gcgccagttctacttcgtaccggacaccatctccagtcgttaaccgaaggtgggtacgtc
+acataaaagttcattagaccacactttgtgccgacgtatatagatatattacacgtatag
+ggaatgttttctcctaggtgacccgaccttctactaaggttgtacatcgtataatggccc
+attaactacgaggaaagtggtattgacctggtaatgcacgttcttcgatatataccgacg
+aggtaaagtctactattgcaaagtttgacgttatactgataagtttagatttccctggat
+cgcgcatgaacaatgtatgcgttatctgccatatataacatgttacaaatccttggggat
+actatcgctactatcatcggaccaaaattaaataggctagtgtcttatcagaacatcatg
+tttaccgaactgatctattttccaatttaagctgatattacgtccgcgtatttattttag
+ttccccggatgacgattatctgagctacatcatacaagttagcatactcgccggtgcatt
+gatttcttatttcgctatatcttcaagttcacaggcttcatatagttccaattagcagta
+taattaggttttgtaactttaaccatactttataaaaggttatattgcacaactgatcaa
+gcatccgctataacccgagctttaccagttagcggctaataacaaataagatgacttcgt
+gtcatacgaccgtcatgatcatgctctaacttaggtgggaaccaaatttaggcaatgggt
+agtaataagtataaaatgataccacatatactataacaatgaaattatttgtaatccggt
+ttgccaacgtatcccccttcgcgataaattaatgacatagggtcatccatgtgccaatcg
+tgtgtgccaaaatctcaaattcaattatcatcaatattggccaagtgttataagcgttga
+aagtgatataggccgccaaaaagtagtctacttaaaaaccaatatttatcgttcgttatt
+gctggtagtacaacatcacgagcatttctcttttgagttgatttatactatatctgctga
+tgtgattatgtcccacttacccagaatattaagaaagtcctagattgtaggtatacttga
+ctataaatataatttaagactatacaaataatctggctacattatgccatcgtagaaact
+gataacgtagtaacgtcggacactagattttggtcggggagtaatctagcatactaacga
+atttgttaaatccgctgaaagtatatgtcattacctgcttggcctgtcttcaatacgttt
+agactattaaggactcatttcgagatccagtattaattatacgcatccatatttatactg
+aagacggattgagttaggacgacaagctaaacaaatattaagttaaggattagtattata
+ttgtagaaactcgtcgggttggaacgattcatcatcatagaatgcgttacttattcagag
+agacttaattcggttatgactggcagctcacctggaaagtaggtgaaaggcaacagaaga
+atattgttgactgaattctacgggctacgaacgtaattacaaagcggttcgtaaagagca
+taaagatcaatacaatggatctctacagtattacgtaaataacatacataaacctggtgt
+tgattcgactagctcatagattaatcattaattgaagctacgaagacgcggaagtctgcg
+gagtgagcaaacagtaatcgactgataaatgcttataatatcgcgcttaaatgccgcatg
+gtgtacattaacgtgggggtagtcaaaggaatatatttactaggaatattagttatgcaa
+atgttgtgtcaatgtgatgtgttttatccagacattggatgcatggctgtgggggcacag
+gatacttaccattagttcacctacaagcggcgtgagagggtctcagttttagccagcgca
+gagaagtacgggcctttagacgattaatgctagaattgtcataaacctcgtgaaaagcta
+gttaataatcatggtgctagaagaacacaacttttctataaaccagttctcgactgacag
+tcgtaactcactatatcgccgctttgtactgtcgcaaaaaaacctcacatagaaagaaaa
+atctactgggtgcatcagtagagatcgtgttctgagagataaatacaccggatacgatct
+gcatcgagttcatgtattaggtcaagcttgggactgttgtgccagtagcattttttaaca
+gtcaaagtagggtgagacacgtcatatcataatatatgccatcgaggtttaaagtttata
+tgataagctagcatgcgttgcaatcgtattcttgaatgctccgtggtttgtactaattcc
+tttatagactgagtgtatcgtacactcggtacaattacaaaggatggaagagcaaatagg
+tcttcaattataacagtaccccaccttaatctaaaaaccagcttcaattagtattaattt
+cgccaggagtatatatataaatatctaaagactaaaagactcgtacttttacaacttacg
+tcgtagcataattaaatcatgggtaaatgtcatcagtaagtgcattagaaatactccttt
+gtaaggatacagtgaatgtgtctcagcaagtcagtagaaatggaaattcatactcgatta
+aggcctataaaactgttgttggtatctacagagtgattaaaattagtgaatcagattacg
+aaaatgttttcccgctcgcacttacgcgtttagacaaaagtacaggtggtacaattggct
+gtagtagaattttggtataaaataggtgataaaccggatgggtgtgggcgaattcaaaag
+cggtttttgttccatagaactatgtagttggttataaaggttgtaatctcggagattagg
+ttagggcttaatcagaatagtaacaatttctctatgtaaagtacagtgggtgatcgtatg
+agttcacgaactcttaatgccatgcctggacaggataaacaatacgcatataacttgacg
+atcgagcttatatcgacctatttgagaagtttaacgggtcgatataatatacaggtctta
+atagccgattttttctagaaaagcaatcctatatcttagttaatcagatcaaccccgtga
+acgatatatcagcaaactgaacattgtatacaacattcctttttgtccgggtggggactc
+catttaaagtatctcacctagaactcagcggtaatagatgcagtctcttgcccagttacg
+gtaactaaatgttgatacttagaattgctaaattttagtctagacatttccaggtaaacc
+ggtagacgacaatttctctgtcatctgtcataagatcgcttagtgtgctcaaattgcaat
+tgagggccctactatagacaatcatcagactttttaattaaatagttttccatgaatgtg
+ttgtcaaggcggaccccttcacttttatcacggctcataaatgtcgtatgactgtagtcg
+gtagcggccttcgagtcttcaggggaaatggaaaagaaattaggcttctaagatggacta
+taatcgattaggctaattccgttcgcaaatcacagaagcaatcttactcaaaattgttgg
+aatcgatagcgaacgcgaccgtgaatgtttaaaagtgctcgcacagaattacccaatacc
+tatcatcacgacttaaatacccaaagcagttgtagtcgcgtaatagattaagtctgaagc
+ctagagacaaagggatactgggcggggaaacctgctccttcacggtaacatggtaacaac
+agaatttggttaaggttaaaacgaaatatactcggagtgaattactgttaggtttcgtca
+tcggatcaataagtagtttccgtgaagacactcttatattagatctccgaaattctgacc
+cgtgcattaggcacttggtaggagattccatttggaacttgctcaatgtaagccagtaat
+gttccgaaataattcgctgcaggagcgaggagccgctgaataaaggaccctcgcatcttg
+ttaccttatggttgagggtcaccgttctctgcgtcaattccagagctggagatacattca
+tcaacgttacctacgcacagaataaaaagatcgagcgctaactcgttttcctaaacacaa
+cggatttagacaaattaccgaatgcgccggagagtagcatcttagtgtcatgcctatcat
+ggcggctcagtacgaagagttcaggcatcgaatattgtggtagcccgcactcaaagttcc
+gccattaggtaagctatatattgtggtcagaacttgaggacaactatgagctactaaaaa
+taaacaattttgtcatttgttctagatatgtggcattcatcgaacgcttgtaccagaagt
+tacattcgcagcgtgagcgaataaacccgaatgagcgtaacattatcaataacatatagt
+tcagatagagaacgaggtattcgacagagaattacccaacattggttattaatctatgca
+gaataatttagataatgtcactacataatattaggaccaaaaggtgattccccagaagac
+aaaacaataaacaatctcacatattcgctagtacctatgtatgggtatgatcttctgatt
+ggacggggataatttccaggtatattaaaacttattaccataatctagacctaagagagg
+ttatataagtaaagagctgtgttccgatagaaaaacccgaccttaaagacttgcgaagta
+aattttgctttaacaaaaaaacctacgtaagggaatattctgtataaactgaaaagtcag
+gtgtaactacatgagtcatgtcttcgattaattacaatgcgatctcgttattctgatcaa
+ctaatatcataaactgccactacatcttgtacaatcattcgcaacaatacttttatgtgc
+taaggtcacgtgcttcctctgctatgctgatttaatcagattcataaaggaatacgaata
+actctggatccattaccacgcaagggatttatttacggctgattactttttggctgttga
+cagaactgccatgaaagtaagatgtcgcatcttgcataaataatagcacctaatatagcc
+gacaaagtgattccgataacagattttaagttgtccagccttgagactccatgaagaccg
+cttgggagcttccccgtgattagaagaatctaaatcccaagtggatggggggagtttaaa
+tctcagcaccaacaaatagtacttcctctcagagcgcgtcatggtcgaaggagcctatcc
+tgatagaggtttgaaagcgcacgcgcatttaactgtcatattaaattggaatctcgtaag
+tgtcggcagtacgacaaattttaactgatgtcggtatacggagaagaaggaagcacgcat
+tgaagcagctacgcagaactgagaagatgacactctaagatacaattaatacaaaaacgt
+tttaagcccaatctatcaacagatgtaagatgtctaatacacaagaataaaaccttcatg
+tcccgatgtataataacagctttatttctgctggtcgaggtgaagtagtggaaattactc
+catcttgctgcgcgtctttatagtgttggctactctgtaaccgacgcgtccatccctctc
+tcctagtgatccgtatatccaattagaggataaccaacatctgcgttaccgacgaattta
+aatttttcgactatttaattccgttcaaacccgtattcgtagtaagtgtttcatagattt
+atgaccgacatcgtgtacgagttgcagtgcatatgtagataccactaattgctgatctag
+gatacatgctttataaacatgcttacttggctattttatttactgtcatgtgggggtttt
+tattttcaacaagtatgtgctaccattggataatctggcttcaaattgaagatatgcgtt
+ccaaacttgtctactgtttgctaagtaggagttgtcccattagaactacgcagcacgtgg
+tttgtgatcgaaaagaataattggcaaatacgaggctagccttcaaatttaatgcagatt
+actcctcagaaacacacgtaagcgacgaacgtgatgtttactacacaatgcgtatcatag
+aaattcgtgataatttttgttccaacctttgaatctagactgagtggaaaaagatttcac
+cgggataccgtttatgctggttttaaaaactcgtcgaatcatcttataactgcattcaaa
+tggatttctcaatcatctgtacgtcaactgttttaacaataacgtcagaataaaccggca
+caatgagacggcggtctttcactacaccacacccttaggattataagtgacgtgtggatt
+cgaattctaaggtgacgggatctacaagcctcagctacattaggtctgaagatctttcgt
+atagccgcgtatgttactgtttggatatgggttatgctaatcaacagttgacagcgagtg
+aaacggccttgcgacctgaaatctttacggttaccttttgattcaagacaggatcgacga
+tggaccacgtgaaatgaattcaaaactgtaacatcgcttgtgcctcagcgaccgagtaac
+gacaagttcacatcctctatgcaactatcattgtggtcattaaggtattcaagattaact
+aagagtcgaccatatattctagagttttacaattaggaaccgttagtctagactaggagc
+gtgcaacatcgcaggaggtgtggactgtcttgacccaagttgcctgacacatagtgtctt
+ttgcttcatgtccttagcaatgcgatacctcaatcgtagttttatcgggataaataacat
+ggtgtttaaccctattaatggtttctattaatctaaattgtaaggcagcccttgggtcga
+aagcacattaggccacatacacagtatgaaattgttcgagtgtccagaccataattgact
+accatggtacacggtgttgctattatgactcccgcaaaactcttgacagagggaattttg
+gtacattgatgtaatcgatgatttaacagtaggaactagacgtcatccgttagactgagt
+tccgacatgctcaaattgtcaggatttttatccaataactaatggctctcacatgtaaat
+aaaatcacattaacgtcacttagtgatggattcgctaaacagatagactatcattcatga
+actggcactgtttcgattatatttgcaacatcgaacatacttaaagttaaatacgacatc
+attcaattaaaaaaattcagtacacctctaatgagtatcccgctttggaggaaagagtag
+cactttaaatggacaatttaggccggactttcctgtaaatggatgaagtcattgtacagc
+ttgaataaatcgttagggttagtccttacatccaccatatgttaatgaataaagcctgag
+ggaccttagagctaacttgtccaacacgttgctcatttacttaataaggttgaaatgtat
+cagtaagtgacagcgagtgtagattttgaccatttaactgaccttcacagttttgtcttc
+agacgtcacttacaccataatgatgacagagcttgtagatgcacacactcattcctagtg
+taaatcaagtagtagctagattattataaagagatattttctggcgtcgaacgtaacaca
+gagagagtataaggggcatgataatggcttatcaatatgtgtaagaaaaagtttttaata
+tcatctaactcggtggaatgcacacttatggccaactgaccttgggacgagttaagatac
+cataagaggttgcctgtaagttaagataacaaagggatattccatctttgtgtgctaaga
+acctatttatatttgcagccataaaaacctctgtgctatgcagccaccagagttatttat
+acaaagaaagagaccatttagatacgttaattctgcttgcgatttattaaacagacattt
+cacgtccaaccactacaaaagccctatcgcaagacgatcattgtattatagcctatgcaa
+cgtagctaagcggccgaggaatcataaaatatgaattgttacattgtttactacatatga
+tcacaatctttgtaaaaggttcgttcgtgatactaccatgtacctaactaacctgagata
+tatgcaatgacttatggggtcagcgcgcaacatccgcaaagcatagtaatacaaggtagg
+aaaacttctggatttcccaaggttataatgctctatactgaccaagagatccgttacgac
+tcgcaatgaatactctaagggcactcacaaagaaaaccactaattgataaatttcaatga
+taatatcctgaattgcatcgtgtatgagttacgagaagtcgcatttaatgaattagtcat
+agaaatgtcatagcaggaacataattactatattttaacgatttaatcgtagttggagtc
+ctttcccaaattatgtcatcagttccgatttagatgttttcgggcccttcttagtaaaga
+agttaatatccaagactagctcctcacccacgcatgcacatattcgcgagaagtctgata
+gaatattcgacagaaatgcgactctagctcacactcgttaactgatcaggtacttataga
+caagtacgttatcagatatcgcttcggggcattgttgcgctacctttgtgcatagcagtt
+ttgaaaaattgttcaagacctgaacgggaaaatgatattatttttttaggaggaataata
+cagtaccatgtaaatactcaaccaccttacgtacttcttacgccgaacatatatggcacg
+tgttattcggctaacaaaactgttgtgccttttctataaggataagcagattcgttttaa
+acatatgacctgtaaactgggatctacaaaagaggtacttaaaataaattgcgcaacggt
+ttagatctgcggatctttggttaaagagcaccattagatgtgccatacttcctatcgcct
+gagcgagaatttagtctgaggaaccactcttgggatttaaaacaattcggttaggacacc
+tactcggcggatgaagcaatacgataacattaaaagtcgttcagtctaattttggtcgta
+gtacgatgagctgatggccaattgtatttttattaacagcactgaaacaaaatggagact
+ttagactaatactaaagtctcaatgttcgtcgaaccttaaatgctcggaatgaggggatc
+ttcggaagtatagcgccgaagtgtatctcattattataacaccagtgtacagacgacatc
+taattatggccagaaactgtcattgtgccattaagaggattagtagatagtctggaccgt
+ggaatagaattttgaccaaattgaccagtcctgcttgtagacagcgcgatctaaactgca
+cgagaatatacaagttggtggtgcttgtggctgagcacgctaagatgcgtttgtttttac
+gattctagtgcttcttaacgcaattcagtcttctagatccgctattccaacatcaatatc
+tcaatttaaggtcaatatatataacaaaattagacagagcagctgacacttacgaagcat
+cgtagaaccgatatagtcgaccttatgatgatatggacgtgtccaagtccgcacttccga
+tgcatcttgacggtgaaccgaaatgaaatcttcattagggcccccatgtgtcaaaccact
+cgagtcccgtctctgaagtcaagtattactgcgaaaaattcgtctactattagtttatta
+tgaacttatgacgcttaaataaattaaacagtaagcctgggaaaatgttaaggcaggaat
+ctttgtaacagttcataatgttgctaaagattatcagaccccgtgaagacttcgggcttt
+gggcttcgtaccgtagcataatacatctatatagttagaggcttgcgtgttgttgtgcta
+ttccacatatagcagctctgggcgactcttcaatgaaaatgaaaaatggtaacctggcga
+cctacttgttaagtcagtttaattcaaggggattaagtaccaagggtcgagtttctctgt
+atttattatactgtaggcaagaagcttttttggcgagatttaagacttaagcctatggta
+aaaatttgatagtgagcgactatagtaagagatttgggtggttagtaattaaaattctcc
+tatgctaaatcaggcgtacaatctgagggtgcacatttctcgacgcgtgaaccttcaccg
+aaagcgtgtggattatacaaatttcaaacatattggcggggcacttatccataatagatt
+tctgtttgtacgccaaactctgcctcacccctccataaattgtattggctagaggttaaa
+ttctccgtaaatagagacacatatagttttatacaattgtttgaatcaaagcacgagaaa
+cttttaaccgtacattgacaaatgtcttcggatggggcagagcatctcttcgtgacccaa
+atcaatcgctgagcaataagcaagaaaacacagattatacaaagagatctggatgaagat
+attcgtgcaatcactatcgttatgttagagagttccatgcatgaggactcgttttttgac
+caggagaattaagccaagaaataactgacgtatttccaaatgaattctacgtgtttttcc
+tgtcacctttagccagtgttaaagatgactatggagtttcgaataggttattctatagac
+attataacgagtggaacacccataccttcacagtgctaaaggtaggaacgggtacgtcag
+gtagttcaagggattttaggttcttaatccaacgaagaaataacgcatcacccgtcattc
+tattgttttcgtcgggattacttagtaggcagggtattctaacctacctgagttacaaat
+ctttaaaaaactggccatgaggtcatggtgataaaatctgaatcgcctaaattcgcgtcc
+ctaaggaaatatactagaatccgtctcagaaagtgcaaaggttgacttcttcccctaaca
+cagaattctcagttttatagctatctagtggcattcctttttataaaactttacgtttgt
+aagggtccaactttacaaaagctcggatgtgtatgtgtaatcttccgccgtgtaagactt
+ggaacccatgtatattgacggcatggcgtggctaagcaggtattgatcttcagtgtaaag
+caaggtatgttctaatctaacaatgtaaagccggggattagccgccaaaggggtctaatg
+acatagagatgctctgaaatcgtaccaactataaaagcacgggatttgaaatatagcgac
+agatcttccgtattctgttagttgacatctgtgctgtctttaccgattgtgatttggctt
+tagcagtcatttagtttcgttactcattgctcgtgcgatagttccaccgaatatggcaca
+ttcgttctttttttccattttactgcaaaccttttcaaaagctgatcgataccactgatg
+atggcattgattagtcgattggcaactatgtcctgcttatatctccaattgcattgaata
+tagtaaaaaataaaggctcgccttcccaatgggctacggagtacacgaaaaaatcgcaac
+tcgtttaaccaagcgccgtacctaacatataagtgattgagacaaatagttctccagacg
+tattgagatatatgtctcctataggcaagcgtttctaattgctgaccagaaattagaatt
+aggttgttaatactatattcgaccattttattccacgaatgtgctattctactggtattg
+ctccgtatgcgatatataaccaacacggaaagtcgtcgattgcaaagtggctccgtagaa
+tcatttctggtcatttaccgggagcgcgcttgaacaatggatgcggtatctgccatattg
+ttattgttaaaaagacttccgcttactatcgcttcgatcatcggaaaaatattaatgagg
+attgggtcgtataagaaaatcatcttttcagttcgcagatttttgccaatttaaccggtt
+atttcgtcagacttggtagtgtagttacaagcatcacgattatatcagctacagaattaa
+actgtcctgactcgacggggcagtgtgtgagtattgcgctatatattcaaggtaacagga
+ggcatataggtcatagtacaaggataatgaggtttgctaactttaaaaattattgattta
+acggttgattgaaaatctctgcaagatgacgctagaacacctgatgttcaagtttgccga
+taataacatataagatgaattactgtctttagaccctcatgttaatccgctaacttaggg
+cggaaacaatgttaggctatgcggagtaagtactatattatgataccacatagaatttaa
+cattcatatgatgtctaatacccgttcccaaccttgcaaccgtcccgattaattaagcaa
+ttacggtcatcaatgggccaatcctgtctcaaaaattatcatattcaaggttcagctatt
+ttggcaatgggtgagtaccgttcttagtgatttacgaacccataatctaggcgacttaat
+atacaagatttagagttacgttttccgggtagtacatattaacgaccatggatcgggtga
+ggtgttgtattagttatctgatcttgtcagtagctcccaatgtcccagaatattatgttt
+ctactagagtgttcgtatactggaatttaaatattatgtaagactagacaaattttatgg
+atacattaggccatcgtagaatatgatatagttgtaacgtccctctatagattttcggag
+ggcaggtatattgcttaataaagatgttcggaaatcagcggaaaggatttgtaattaact
+gatgcgcagcgcttaaataagtttagactattaagctatatgttcgacagcatgtagttt
+tttttaccagaaagtgttatactgatgacccatggaggtagctcctcatgataaaaatat
+tgttacttaagcattactattatagtgttcaaactagtaccgttgcatactttaagaatc
+agacatggcgtttcttatgcagacacacttttttagctgttgacgcccacctcacatcca
+tagtaggtcaatcgcataagaacaatattctggactgttttattacccagaagaaagttt
+tttctttccggttcgttaagacaataaagatcatttcattcgttctcttaacgatgaact
+aaagtacttaaagtatccgcctcttgtttcgactagcgcatagtgtaataattaaggcaa
+gataagaagaacaggaacgcgcacgtcggagataactctaatagtctctttattccgttt
+aatatagcccgtaattgcaccatgcgctacagtaacggccgccttcgcaaacctatttat
+gtaattccaagtttaggtatgcaatggttggggcaatgtgaggggttttatcaagacttt
+cgttgcttcgcggggggcgcaaagcagactttacagtagttaaccgaaaaccgcagggag
+tcgctctaagtgttaccaacccctcactactacgcgaaggtactcgattattccttgaat
+gggctgaaacatcgtgattagcgtcttatgattcaggctgatagaagaaaacttattttc
+tatattccacgtatacaatcacactcgtaactaaatagttcccagcgttgtaatgtcgct
+ataataaataaaatacaaagaaaattcgtctgggtgcataagtacagttagtcgtctgtc
+acataaataatccgcagtcgatctcattacaggtattgttgttggtcaaccttcgcaagg
+tggtccaagtagcattgttgaacagtaaaactaccgtcacacaaggaatatcataataga
+tgccatacacggttttacttgatatgtttacagtccttgagttgcaatcgtagtattgtt
+tcatccggggtgtgtacgaagtaatttagacaaggtgtgtagcggtcactaggtaaaatg
+acttaggatggatgagcatttaggtattctatgataacactaaccatcatgtttctaaaa
+tcctcaggaaatttgtattattttaccaacctgtatttatagaaagtgcttttgacttaa
+agaagccgaagtgttcaaattaaggagtacctgattgaaagaatggggaattgtaatctg
+taactcaattacaaataagccgttctaaggattaaggctttgtgtctaagcaactcacgt
+gaattcgaaattcatactcgattaacgactttaatactcttctgcgtatctacagactca
+tttaaattacggaatatgttttcgtttttggtttccagctcgcacgtacgcgtttacaaa
+taaggacacctggtacaattggctggagtacaatgttggtttttatttgctgattatccc
+gatccctgtgggcgttggcataaccgggttttcttcaagactactttcgtgttgcttata
+tacctggtaatatcggtgagtagcttagggcttaatcacaatactaacaagttctctatg
+gattggacagggcggcatccgttgactgaacgatctattaatccattccctgcactggat
+aaacaagacccatttaaattgaccatagagatgttagcgtcatatttctgttcgtgatag
+ggtacatatattataaacggattatgagcagtggttttctagaaaagcattcatagttag
+gagtgtatcagatcataccactgaaccatagagcacaattctctactggctatacttcat
+tcctttttgtccgggtggggacgaaatttaaaggttctaacctagaacgcagagcgaatt
+gatcaaggcgctggccaagtgaacggttctaaatgttcttaatgagaattgcgtattttg
+actattgacagggcatcgtaaaccgctactcgacttggtatctgtaatctgtatgtagat
+agagtacgggcctataattcaaattcagccaccgaagattcacaatcttcagacgtttga
+aggaaagaggtttactggtatgtggtgtcaagccccacccattctctgttatatccgagc
+attaatgtagtttcactgtactacggtcacgccgtagagtcggcagggcaaatccaaaac
+aatttaggctgagaagtggcactataatagtttagcctaagtcccttcgctaataactca
+acaaagatgacgcaaaagtcggcgaatagattgcgttcgcgtaagggtatcttgaatact
+gatagctctcatggtaccaagaactttcataacctctttatttaccaaacctgttctact
+agcgttagtgttttagtctgtagccgacacaaaaaccgagaatggccggcgtaaccggcg
+cctgcaagctaacatgggatcaaaactattggcttaacgtttaatcgaatgagactagca
+ctgtattactctttcgtttcggcagcggatcaataaggaggtgacggcatcactctctta
+tagtagatatcacttattctcacaacggaagtaggatcttccgtcctcattaaatttgca
+actggctcaatgtaacactgtaatgttaacaaagtatgagctgaaggtcagagcagacga
+tgtagtaaggtccctcgaagctgcttacagtatccttgaggctcaacgggctatgcggaa
+attccagacctcgagttacattatgaaacgtgtcattccatctcattaaatagttcgtgc
+cctatcgccttgtaatataaacaaccgtttttgtctattttcccaaggagaaggagagta
+gcagcttagtggcttgcctatatggccccctaagtacgtactcggcacgcttagaagatt
+gggctaccccgcactatatgttcccaaagtaggtaacctagatagtgtcgtatgaaattc
+aggtcatcgatgagagtataaaaatatacaattttggcaggggttatacattgcgggcat
+gaagagtaacattggacatgaacggacattcgaaccctgtgagtttaataccctatctcc
+ggatcattataaagtaaatatacgtcacttactctacgtgcgtttagacagtctttgaaa
+ctaaattggttatttttctttcatctagatttgtctgtatctaactaaattatagttcca
+cataaagctgattcaactgaagacataaatataaactttctaacatagtagcgaggaaag
+agctatgcctagcatcggatcatgcgtccgcgagtagttcctggtagagttaaaagtttt
+tccagaatctagaccgaacacagggtagtgaacgaaagtgcgcggtgaacatacataata
+ccgaacgtaaacaattccgttcgtattgttgctgtatctatatttcctacgtaaggctat
+ttgatctataatatgaaaagtcacgtcgaaataaatcaggaagcgcttcgagtatgtaca
+ttcagatctccttagtatcatcaaattatagattttacggccacgaattattggtctaga
+tgtcccaaaaataatttgatgtcagtagcgatcgtgcttcctcggagttgaggttggaag
+aagagtcattatgctataccaagaactctccatccagtacctagaaaggcaggtatgtac
+cgctcattaattttgcgatcttgacagatctgcatgcaaagtaacttgtaccagatggct
+tttataatagaaactaagtttcccgaataacggtgtacgataacagatttttaggtgtac
+agacgtctgactcaatgaacacacattgggacctgccccgggaggagtagtagataatta
+ccttctccagcgcgggtcttttaatatcacaacataaaaatactaattaatatcacacac
+cctcatcctcgatggagcctagcatcatacacgtttgatagacaacgccaattttactgt
+aatatgatattcgaatctagtatgtggacgctgtaccacattgtttaaaggagctccctt
+taccgacatgaacgaagcaagctttgtacaagatacgaagaactcagtactggtaactat
+aagagacaatttatacataaaagtgttaagaccattatataaaaagaggtatgaggtctt
+tgtaactacaataatacattcatcgaacgatggagaataacagagttatttctgctgctc
+gagctctagttctgctaatttctcaatcttgatgccactcgtttgagtcttccattcgct
+cttaacgacgcgtacatccctctctcctactcttacctatatcctattactggttaacct
+acatctccgggaaagacgtaggtaaagtggtccacgattgtattcacttataacacctag
+tagtactatgtgttgctgagagtgaggacacacttactctacgagttcaagtccatatgg
+acattacactttttcagcatctaggtgtcatgatgtattaacagccgttaggggctattt
+gattttatcgattgtcggcgtgtgtattttcaacaactaggtgctacaattcgtgaatag
+gcatgaaaattcaagattgcagttcctatcttgtataatctttcctttggacgagttgta
+ccatttcaactaacctgcaagtggggggtcatccatatgaagatttgccaaatacctgga
+gaccctgaaaagtttatccagattaataataacaaacaaacctaagcgaagaacgtcagc
+tttaataaactatcactatcatagaaattcctgttaattgttcttccaaacgttgaatag
+actatcacgggtaatagattgaacacggagaacgtttatccggcttgtaaaatatcgtcg
+aatctgctgataactcaattatattcgatggagaattcatatctaccgcttagcttttaa
+aaattaagtcagattattccgccacaatgagaaggcgcgagtgcactaatcaaatcactt
+aggattattacggacgtctgcattacaatgctttggggtagggttatacaagcatatgat
+tctttaggtctcttgatcgggcgtttaccaccgtagcttaatgttggcatatccgtgatc
+ctaatattctgttgtcagcgtgtgtataggaatgcacaacgcaaatctttaagctgacct
+gttcatgaaagacaggagacacgaggcaccacctcaattctatgcaaaactctaacatag
+cgtggcactatgagtacgtgtaacgacaaggtctcatactcgatcctaagataattctcg
+tctggaaggttttaatctttaactaagagtagaacttagtttattgacttttacaattag
+gatacggttcgcgactctaccacagggcatcatacctggagctctgctatctcgtgacca
+aagtggcagcacacatagggtcgggtcctgcatctactgagcaatccctttaagcattcc
+tagtttgagagccatttagatattgctgtttaaaccgattaatggtttctattattataa
+agtgtaacgctcccattcgggacattgaaaattagcaataagacaatgtatgatattcgg
+cgagtctcaacaacattatggtctaccatgggacaaggggttgatatgatgaatccacaa
+aaaatagtcaaacacccatggttcgttaagtgagggtatccaggtgttataaggacgatc
+tagaagtattcaggtacacggtgttcagacatgctctaattgtcaggttgtttataattt
+aacgtatcgctctctattctaaataatataaaattaaccgctcgtagggatgctttccag
+taaaagatacactatcattaaggttatgcaaatgtggcgatttgatttgaatcttagtac
+attcttaaacttaaatacgtattatttaaagtaaatatattatctaaaccgcttttgtct
+atccacatttcgtcgaatcacgacctcgttaatgcgacaatttacgaccctctttcatct
+aaagcgatcatctatttcttctgattgatgtaatactgacccttactccgtacatacaaa
+tgatggtaagcaagaatgactgacgctcctgtcacctttcgtggcaatcaactggcgctg
+gtactgaagtagcttgaaagggatatggatgtgtatgccaggcttcattttgacaatttt
+tctgtcctgctcagtgttgtctgaagtcgtatcgtacacaataatgatgactctcattgt
+agatccaatcacgctttcctacgctaatgaaagttctagatagtgtaggtgttagacaga
+ggttagcgcctacatccttacacacacagtgttgaacggcaagcataatcgagtatcaat
+agctgtatgtatttgtttggaatatcatatttctcccgcctttgaacaatgatgccaaaa
+tgtcctgccctagagttatgataaaataactgctgccctgtaacttaagtttacaaaccg
+atattcaatcgttgtgtcctatgaaaatatttatatttgcaccaagaaaatcatctgtgc
+gatgaacaaaacacagtgatttataaatacaaagagtacatttagttaccggattgcggc
+ttgacatttattttacagaattttatcggcaaaacacttcatatgaactatcgcttcacg
+ataagtctatgatagactagcattcgtagagaacaggaagagcaatcattatatatgaag
+tgttacagtgggtactacatatgagatcattaggtctatatccggccttcctcataagac
+cttggaaatatcttacatcagagatatcaaaggaagtatgggcgaacccagaaaaagccc
+caaagaatagtaattcatcggacgtaatagtctggttttaactaggggttattgatattt
+aagctaaaagagttccctgaacactcgaaatgtataatctatcccaactaaaaaagtata
+cctctaattcagaaatgtcattgagattagactgatgtcaatacgctaggaggtaagaca
+agtagaagtttttgatttaggaattgaaatgtaatacctccatcttaagttctatatttt
+aaagttttatgcggacttcgagtaagtgcacaaatgatggcataagtgcccagttacatg
+tttgcggccccgtatgagtaatgatctgtttatcaatctctagctactatcccacgaatg
+cactgatgccagtcatggcgcttacattagtcgacagaaatccgacgatacctatcacgc
+gtgaactgttctggttcttattcaattcgaagtgatctcagatacattacggccatgctt
+gcccttcatgtctgctgagcagttttgttataggctgaatctcctctaagcgaaattgat
+aggatttttggtggtcgatttagtctgtacctgcttattaagattcaaaatgacctactt
+cttacgccgaaatgatagggatcggctgaggaggataaatatacgctggtgcctggtatt
+tatccagaacaagttgcctgtgtatcagatgaactctaatctccgagataaaaaacaggt
+acgtaaaataaaggccgcaaagggttacatctcaggatcgtggcgtatagtccaccatta
+gttctgacttacttaatatagactgaccgagattgtagtatgtggatccaagcttgccat
+gtaaaacatgtcggttagcaaaacgtataggagcatgatcaaagaagagttaattaatag
+tactgcactataattgtcggcggagtaccatgagctgttgcccaattcgatgtttattaa
+cagcacgcataaaaaatccagacttttcaattagaattaactataaatggtccgcgaacc
+ttaaatgatcggaaggacgggatctgccgttgtatagaccccaactctatctaattttta
+taacacctctgtaatcaacaaatcttattatgccatcattatgtcattcgccaagtaagt
+ccagttcgagattctctggaccgtgcaatagtattgtcaaattatggtaatggaatcctt
+cttctaacacccttagaaaagccacgagaattgacaagttgggcgtgcttgtccaggagc
+aacataagtgccgtttctttttacgatgatagggattcttaaagcttttctctattctag
+atcccagttgccatcatcaatatctcaattgatgctcattatatagttcttatttagtat
+gtccagatgtcactgaagatcctgcctagaaccgatattctcgacaggatcatcagttcg
+acggggcaaacgcacctatgcacatccatcttgaccgtgaaacgaaaggaaagagtcagt
+accgacccaatgtggaaaaaaactcctgtccacgatatgtaggcaagttttactgccttt
+aattagtagtcgattagtgtagtttgatattatctaccttatagaatgtaaacagtaacc
+cggccttaatggtttggcaggattctttgtaaaagttaataatgttcataaactttatca
+gaaaacctgaagtagtccgcctttcgcctgcgtaacgttgcagattaattcgttttacgg
+agtggcttgcgtcttgttgtccgagtacacatattgctcctctcccccactcttctagga
+aaatcaattatgctaacctgcagaccttcttctttactatctttaatgcatgcccagtat
+gttcatagggtagacttgctatctattttgtataatctacgaatgatgcttggggcgcga
+cttttaacaattaagccgttgggtataatttgagagggtgccacgatagtaagagatttc
+cggcgtgagtaaggaaaatgataataggattaagcaggcgtaatagctcaccctcctcag
+ttctccaaccctgaaccggctaagtatgactgtgcagtattaattttgaatacatattgc
+agcccctaggatacattatagatgtctctttcttacccaaactcgcccgcaccaagaaag
+aatgtggattcgattgaggttaaattagccggaattacagacacagattcttgtttacaa
+ttgtgggaagaaaaccacctcaaacgttgaaacctacattcacaaatggattacgttggg
+gatgagaatcgattccggtcaaaaatcatgcccggagcaataaccaagaattcacagagg
+attaatacacttctccatgaagataggactgcttgcactatccttatctttgtgtcttcc
+ttcaagcaccaatcgtttggggacaaccacaattatgccaagaaataacggaaggtgttc
+caaatctatgagtccgcggtttcatcgcaacgtttcactgtgggtatcatgactttggac
+tttagatttgggtattctagagactgtagaaagactgcaacaacaagacattcacagggc
+gaaacctaggaaaggggaccgcacgttgtgctagggatgtttccttaggaatccatacat
+gtaagaaagaatcaaccgtaattatagtgttttcggccccttgaattacgtgcatgcctt
+tgctaaaagacctctgggaaatagattgaatattctggacagcagcgaatcctgattata
+tctcaagcgaatatatgacccgcaagaaggatttatactagaataagtctaagaaagggc
+attgggtcacttcttccactaacacacttttatcagttttataccttgagagtcccatgc
+atttttatatatatttaactttcgttgcgtaaaactttaaatatgatccgtgctctatct
+ctaatctgaacaacggtatcacgtcgaacaaatctagtggctacgaatcgcgtcgctaag
+aacggtttcttctgctggcgttagctacgtatcttctatgctaaaaatgtatagccccgc
+attagcagcaaaaccgggagaatcaaatacacatccgatgaaatcgtaacaaagataaaa
+caacgcgatttctatgtttgccaaagtgattaagttgtatcgtaggggtcagcgctgatg
+tcttttcagtttgggttttggatttaccagtcttttagtttcggtactatttgatcggga
+cattcgtccaaacatgatggctcattcgttctttttttcaattttaatcaaaaccttgta
+tttacctgatacattaaactgagcatcgcatggaggtggagattcccatatatgtaatca
+tttgatatcctattccattctttttagttataaataaacgctccactgcacaatgggagt
+aggacttcaccaataattagcatctactgtaaacaagcgccgtaacgaaatgattactga
+ttgagaaaaataggtctcaacaacttttgacagatatgtatccgatacccaagcgttgct
+aattgcgcaaaagtaagtagaattacggtcgtattacttgttgccaaatggttattactc
+caatgggctattctaatccgatggatacgtaggagagagtgtacctacaccgaaactcgt
+agtgggcttagtggctacgtagaagctgttcgggtcagttacagcgtgcgaccttgtaaa
+atcgatcacggtgatgaattattgttattgtttaaaagaagtcccctgaatagcccttag
+ataatacgaaaatttgttatgtccagtcgctcgtatatcaaaagattcggttaagttcgc
+agagttttgccaagtttacaggtgatttactaacacttgggagggtacgtacaaccatca
+cctggttagcagagaatgaattatacggtcatgtcgcgaagggcaagtgtgtgagtattg
+accgagttattaaacgtaaatgcaggcatttacgtcataggacatcgagtttgtcctttg
+cgaaatgttaaatttatggttttttccgttgagtgataatagctgcaacatgaagatagt
+aaaactgaggttaaactttcaccatattaaattatatgttcaattacgcgatgtacaaac
+taatgttaatcagatttaggagcgcgcttaatatgggtccctatcccgactttgtacgag
+attttgataaaaaatagtattgtaaattcatttgatggcgtagaaccgggcaaaaccttg
+aaaaaggacacatttaggatgctatttccctaagaaagcggaaaatcctggctcaatatt
+tataatagtaatggttaagattgtggcccaatcgctgagtacccgtcttacgctttttcc
+aacacataatcgacgagaatgtatttaaatgtttgagacttacgttttccgcgtacttat
+tattaaagtcattggagagggtgtcgtctgggtgtagttttctcatctgctcaggagcta
+aaaatgtaaatctattggttgtttctaattctgtcgtccgtgtaggctatttaattttta
+tggtacacttgaatatgtttagccataatgtagccaatactacaatatcagatacttgta
+tacgacctatagacttttgccgaccgctcgtagagtgatttagaaagatgttcggatagc
+acagcaatcgtttgcgaatgtaagcatgcgaagcgagtatttaactgttgactattttgc
+tatatgttactctgaatgttgttttttttaccagaatgtgttataatgatcaaccatgca
+cgttcctactaatcatataaattttgttacgtaagcttttctatgatagtggtctaaaga
+ctacccttgcatactttaagattaagacatgcactttaggaggaactcacacgttttgag
+ctgttctagcccacctataagccattcgtccgcaatcccataactacaatagtcggcaat
+cttttattacccagaactaacgtttttatttcccggtacgtatcacattaatcttaattt
+aatgcgtgagagtaacgatgaacgaaagttatttatgtttaagccgcttcttgagaatac
+agattactgttagaatgaaggcatcataactagaacaccaacgcgcacctcgcacattac
+tctaatagtagctttattcagtttaatatagacagtatttgaaccaggcgctaatgttaa
+ggcccccttcgaaaaccttgttatgttattccatgtggtcggaggatttgcggggcgata
+gcgctgggcggggatcaacaatttcgttcatgcgagcgcccccataaccagtaggtacag
+ttcggaaaagaaaaccccacgcactcgctagaagtgttacaatcacatcacttcgtaccg
+aagggactactgtattccgtcttggggatgtaacagactgattacagtcttatgatgaag
+cctcattcatctaaaattagttgatttattccacggatactatcacactcctatagaaag
+agttaccaccgtgggaagctagatataataaataaaagacatacaatattagtatggctc
+atgatctacacttactcggatctctctttttttataaccagtagatcgcattacacgtat
+tgttgttccgcatcaggccctaggggctcaaacttccatggtggataactaaaacgtccg
+tcactaaacgaagatattaatagatgaaatacacgggtttacttgatttctgttcagtca
+ttcacgggaaatcctaggagtctttcataacggcggtcttagtaggaatgtagtcaagct
+ctgtagaggtctcgacggaattggtatttcctggcatcacaatttacctagtattggaga
+tcacttaaaataatgttgagataataatcaggatatttctagtatgtgacaaacctctat
+ttagtgattgtgattttcaattaaacaagacgtaggggtcaaattaacgactacatgttg
+gaaagaaggccgaattgtaatatctaactcatgtactaagaagaagtgctttcgtttaag
+gctttctgtctaacattctaacgtcaattcctatgtaatactactgtaaccaagttatta
+ctcggctgcgtagataaagtctcatgtaaatgacggtttatctgttacttttgggtttca
+acctagctaggacgccggtactaattacgacacctgcgtatagtgcagggtgttcaatgt
+gcctttttatgtccggattataaccatccctctcccacttggaatatcaccgggttctta
+atgacttagttcgtcttccttattttccgggtaagatcgctgtggaccggacccattttg
+atctagtctaaaaaggtatatagcgtttcgtctggcccgcttacgttcactgaaacttag
+attaatcaatgcactgcactggattaacaagaacatgttatagtgtactgacacatgtta
+gactaagaggtctgttcgggttagccgacttatatgtttaaccgattttgacaactgggt
+tgagagataacaatgaagagtgaggactgtagaagatcttaaaactgtaccatagtgctc
+aattcgctaatggcttgaattatttaattgttctaaccctggcgtcgaatttttttggtt
+cgaaaatacttagcacagcgtattgttcaacgagatgcacaactgtaccgttagaaagcg
+gcttaatgacaaggcagtattgtgactattgacagggaatcctaaaaagctactcgaatt
+ggtatatggaagaggtatgtactgagaggtcgcgcctattagtcaaattctgccaaagaa
+gagtcaaaagcttaactagtttgatggtatgaggtttaatgctaggtggtctataccacc
+aaaaagtatatgggatatcccagaatttatcgactttcaatcgtctaccgtcacgacgta
+cactaggcagccctaatccaaaacttttgaggatgagtactgccactattatactgtacc
+atttgtaacttacattttatatcttcaaagaggtagatattgtcggccattactgtcact
+tacactaagggtagcttgattactgatacctctcatggtaaaaagtaatttaagaaccta
+tttttttacataacctctgctactaccgttagtgttttagtcggttcaagtcacaaaatc
+cctgtagcgcacccctataagcagaaggaaaccttaatgcggataaaaacttttgccgga
+accgttaatcctatgagaataccactcttggaatcggtcctttaggctgaggatatagaa
+cgaggggaacgcatcaatctaggttaggtgagagaactttgtatcaaaacgcaagtacca
+tatgccgtcctcagtaaattgccaaatgcagaaatcttacactcttttcttaactaagta
+tgagagcaacctcactcctgaacagcttgttacctaacgagaagaggctttaagtagcct
+ggagcctcaaccggatatccggatttgactctcatccacttacatgatgattacggtcat
+tacatctcatgattttctgagtgccctatagactgggaatttaatctaccctgtttctat
+ttgttaacaaggagaaccactggtcaagatgacgcgcttccatttatgccaccataagta
+agttctcggaacccttacatgattggcctaccaacctatatatgtgaccaatgtacggta
+catagagtgtggcctatcatattcaggtcatcgagctcagtatttaaagattatatggtc
+gctgggggtattcagtgcgcgatggaagactaacattggaaatcaacggaattgacaaca
+cgctcactttaataacctatctcaggataagtttaatgtaattagacggaactttctcta
+actccgtgtactaactctttgaaaataatgtgggtatttttatttcatctagatttgtct
+gtatcgaaagaaagtattggtccaaataatcctcagtaaaatcaagtcataaatataaaa
+tttagatcttaggacagaggaaagtgctttcccgagcataggatctggcctacgccagta
+gttcatgcttgtgttaaaagttgttactgtttatagtccgtactcagggtagtgttcgat
+actcagcggggaactgacatattacactaaggaatcaaggcccttcgtatgggtcatgtt
+tatatatttaattacttacgctatttgatcgagaatagctatagtaacgtcgtaagaatg
+caggatgcgattcgagtttgtaaattcacagatactgtgtatcatattattatagatgtt
+aaggcatagaattattggtattgatgtacaaaaaattatgggtgggcagtaccgataggc
+attacgagcagtgcagcttggaagaactggatgtatcctataactagtaagagccttaaa
+ggtactacatacccagggatgttaccatcattaatttggccatcttcaatcttcgcaatg
+catactttcttctacaagatgccttttagaagacaaaataagtgtcaacaataacgctgt
+aacttaactctgttgtacgtggaatcaagtctcactaaagcaactaacattccgacatgc
+aaacgcaggactactagattattaaattcgccagcccgcctcgtttaatataacatcata
+aaaattctaagtaatatctcacacactaatccgccatcgtccatagcatcagtcacctgt
+cttacacaaacacatgtttaatcgatgttgttatgccaagctagtttcgcgaccatgtaa
+ctaattgtggaaagctgctaccttgaacgacatcaaccatcctacctttgtacaacagac
+caacatctctgtactggtaaatagatctgaaaagttataaatataactgttttcacattg
+atagaaaaacagctatgtgctatttgtatatactataataaattaagcgaaacatggaga
+ttaaaacagtgttttctcatcctccacctcttgttctgctaatttataattcttgatgcc
+actcgtgtgagtcgtccattcgatcgtaaagaacccgacataaatagatacgacgctgaa
+cgagatcctatttctcctgaaaattattagcacggtaactcctagggatagtggtactag
+ttggtatgaacgtataaaaacttgtactactttctcgggatgtgagggagcaaactatta
+ctcgaccagtgcaacgcattatcgacagtaaaagttttcagctgatacctgtctggatgg
+attatatgcaggtaggcgagagtggattgtagcgatgctcggcgggggtattttaaaaat
+ctaggtgataaaagtcctgtttagccaggaaaagtcatcattgcactgcatatcgtcgat
+tagctgtcatttcgtccactggtaccagttcaacgtacatcaaagtccgggcgcatccat
+atcaagttttgcaatagtactccagaccatgaaatggttatccagattaataataactta
+atatactttcactacatactcagcgggtattaaatttcactttatgtcaaaggactctta
+tgtggtcttcaaaaaggtctagagtctatcacgcctaattgtgtgaaaaccgagtaactt
+gatcagccttgtaaaatatagtagaatatgatgttaaatcatttatattccagggagatt
+gaatagcttacgattagctggtataatttaactcacatgattaagcaaatatctgtagga
+ccgagggaaagaataaaataaagtaccatgagttcggaacgctgcattacatggcgttgg
+gctagcctgatacaagaagatgagtatggagctctcttcatcgggacgtgacaaccctag
+cgtaatcttggcagatcccggagcagatgattatcgtctaacactgtctttaccaatgca
+caacgcatagatttaacctgaactgttctggattcactcctgactacagcctacaactca
+tttctatgcataactcttaaagacagtcgcaatatcagtacctctatacacatcggatca
+gactagatcataagataagtctcctctggatccttgtattctgttaagtacactacaaat
+ttgtttagtgtctgggacaattacgataagggtcgcgactagaccacagggcatatgacc
+tccaccgctcctagcgagtctccaatctgcaagcactcatacgctaggggcatgaatcga
+ctgtcaatgcactgtaagatttacgagggtgagacccatttagatatgcctcgtttaacc
+gttttaggcttgataggatgagtttgtcgatccatcaaattcccgacattcatattgtcc
+aataagtatatctagcttattcggactcgctaaactaaattatggtataaatgccgtcaa
+ccggtgcatttgttcaatcaacaaattatagtcaatctcccatggggccttatggcagcg
+tatacagctggtataacgaccatatacaactatgaacggactagctgtgaactaagcaga
+ttattggatccttgtgtataattttaagtttcgatctatatgctatagtatagaaaatgt
+tccgatcgtacgcttcctttacagttaaacagtctatatcatgaagcttatccaaagctg
+gacatttgatggcaatcttacttaattatgaaacttaattacctattattgaaagtattt
+atatgatcgaataagatttgctctataaacaggtcgtccattcacgacctagtgattgcg
+taaattgaccaacctaggtaatctaaagcctgcatctatttcttatcattcatgttatac
+tgacccgttctcagtacttaaaaatgatcgtaagcaagaatcactcacgctcatgtcaca
+tttagtcgaaataaactgccgatgggaaggaagttccgtcattgcgatatcgatgtctat
+cccacgcgtcattttcaaattggttatctacggataactgtgcgatgaactactataggt
+caaaattatcttcaatctcattctagatcatataaagatgtccttcgcgattgatacgtc
+tacagtgtgttggtgttacacagagggtagcgactacttacttactaactctctcttgat
+ccgcaagcataagccaggttaaagtgctctatctttttctgtggattataatagttatac
+cgccttgcatctaggtgcccattaggtaatgccctagtgttttcataaatttactcctgc
+catctaacgttactttaatttcccagattcaataggtctctcatttgaaaattgttatat
+gtcaacaaagaatataatagctgagtggaacaatacactgtgagggagtaatacatactc
+taaattttctttacggtttgcgcctgcacagttttttttatctatgtgatccgcataaaa
+agtaatttcaacgttccattcaagttaagtcttggtgacactagcattaggagagatcac
+caagaccattatttatttagctagggtttaagtcggttagaaatatcagataatgaggtc
+tttatccggccttacgcagtagaaattggaaatttcgtaaagcactgagttcaatggaag
+tatggccgaacccacataatgcacaaatcaagtcgatttcttccgtccttttagtctcct
+gggaactacgggttattcatagttaagctaaatcagttaacggaactagacaaatgtata
+atagttcccaaatatatatctataaatcttatgcagttagggaatgcagatttgaatcat
+ggcaatacgctagctcggaactcaactacaagtgttggatgtacgaattcaaaggtatta
+catccttatgatgttcttttttggatacttttatgacgacttccacgaagtgaaattatg
+ttcgaatatctgaacagttacttggttgagcccaaggatgacgaatgttctgtttataat
+tctcgtcataatataaatacaagcatatgaggccagtcatggagctttcatttggactaa
+catttccgtagagtcatatcacgcctgtaatctgatccgtctttttctattcgaagtgtt
+atcagatacatgacgcccttgcgtgacattcatggctcctgacatcgggtcttttaggct
+gaatctaatctaacccaatttgtttggattgtgggtcctccattttgtctgttaatgctt
+attaagattaaaaatgtactacgtatttagacctaatgattgcgatacgctgtggaccat
+taatataagctgcgccaggggatttttccagatcatctggcctgtgtatatgttcaaatc
+taatagccgagagaaattactccgacggaaaataaaggcagataagcgtttcagagcacc
+atcgtggcgtttagtcaacctttagttcggaatttattaatatacaatctcactctttgg
+acgagctccttaaaagatgcccttgtatatcatgtcccgtacctaaaagtataccagcat
+catcaaagaacagttaaggaatacgactgctctataattgtccgaggagtaccttctcat
+ctgccaatagtcgttgggttggaaaacaacgcattaatatgccacacttgtcaattagaa
+gtttctataaaggggacgagtaactgatttgagacctagcacggcagaggacgttcgtgt
+gacaacatctctttataagtttgagataaaatcgctaatctacaatgattatttgccaat
+cattatcgaatgcgcaaagtatctcctgttcgtgattctagcctaaggccattactatgg
+tcaaattatgctaatcgaagcagtcttctaacacccttagaaaagcaaacactattgaat
+actgccgccgcattcgccagcaccaacataactgcacgtgcttttttccatgattggcat
+tatgaaagatttgatctatgattcttaccagttgcaatattcaatttagcatgtgttcct
+aattattgtgttattatggtctatctcatcatgtaaatgaagatcatgacgtcaacacag
+attctagtcaggatcatcagttcctcggggaaatcgcacctaggaacagccttatgcaac
+cgctaaacaaagcaatgaggatgtaccgacaaaagctcgatttaaaagcctcgaaacgag
+atgtacgaatcgtttactgccttttatgaggagtcgagtactgttggttcatatttgcta
+catgattgtatgtaataacgatcccgccctttatcggttcgatcctttatggcgataagt
+tatgaatcgtcagtatctttagatcaaaaactcaactagtacccagttccccggaggaac
+ggtcatgattaatgcgttttacggtctcccgtccctcttcttgtcagaggaatcagtttc
+atccgatcccactcgatgattggtatagctatttgccgaaaagccacaacgtattcggta
+ctatcttgtttgattcccctgtatcttaattcgcgacacttgatatcttttgtgtttaat
+cgacgaatcatcctgggggcgacacttgttacaattatccagttgcgtttaatggctgtg
+ggtcacaagattgttagacaggtcccgcgtgtcgtaggaaattgataattggagtttgca
+ggacgaatagctcacccgcctaagtgatccaaccctcatcaggataactatcactgggca
+gtattatttttgatttcatatgccaccccctaggagactgtagtcatgtatctttcttac
+ccaatctagcccgaaacaagaaagaatgtcgattccagtcaccttttattagaccgattt
+acacacaaagtgtcttggtttaaaggctggcatgaatacatactcaaaagttgaaaacga
+cttgctctattcgattaccttcgcgatctcaatcgattacgctaaattttaatgcccgct
+gaaatatccaacatttaaaacaggattaattctctgatccatgaacttaggactcattgc
+acgtgacttatctttctctcttaattcatgctccaatacggtgggctaaaccacttttat
+cacatgaatgtacgcaacgtgttaataagctatgagtacgcgggggcagcgaaacgggtc
+aatctgggtatcttctattgggacggtacatttcggttttatagactatgtagttacacg
+gcatcaacatgtaattaaaacggcgtaacctaggaaagccgaacgcaccttgggattgcc
+atgtgtccggaggattacatacatctaagaaacattctaaactatgtatagtcgtttacg
+acccttgtagtacgtgcatcccttggcgaaaagtactctgggtattagagtgtatattat
+cgacagcaccgaatcctcattttatagcttgacaatttatgacccgaaagaaccttttat
+aagtctataagtatatctaacgcaattgcggcactgagtccactaactatctttgagcag
+tgttatacagtgagacgccatggaaggggtttatatattttactgtcgttccctaaaaag
+ttaattatcagacctgcgcgatctcgtagatgaacaacgcgatctagtcgaaaaatgctt
+gtggctaccattccagtcgagatcaaccgtttctgcggatcgcgttacattccttgctta
+tttgcgataaatcgatacaaccccattaccagaaaaacccggagaatcaattactctgca
+gatcttatactaaaaaagagattacaacccctgttctatgtgtcccaaagtgagtaacgt
+ggagcgttggggtaagagcggagcgattttaactttcgcttttccattttccagtattgt
+actttacgttatatttgagcggcacattcgtcaaaacatgatccatatggactgaggtgt
+ttaaatgttaatcaaataattgtattttcagctgactttaaaatctgcagccattggagg
+tggagattccaatagatgtaagcaggtgatatcatatgcaattcttgtgacttattaaga
+taccagacacggcacaatcgcagtagcacgtaaacaataatgacaatcgacggttaaatt
+ccgaacgtaagatatgtttacggatgcactaaaataggtagcaacaacgtttctctgaga
+tgtataagttaccaaacactggagaattccgctaaactaaggacaatttccgtcgtatta
+attgttgacaaatggttagtaatacattcgcagtggataatccgttgcatacctagcact
+gagtgtaaataaaaccaatcgactactggcatttcgggctaacgactagatgttagccta
+tgtgaaagcctcacacatgcttattgccttcacggtgagcaatgtttcttattcgttatt
+agaagtcacctgtagagacagtagagatgacctaaatttggtttgtccagtcccgaggtg
+atctaatgattaggttaacttagaacagtggtcaattggttaaagctgatttacgaacac
+ttccgaggggtcgtaaaacattaaactggtgagaacagtatgatgtattcggtcatctag
+acaaccccatcgctgggagtttggacagtgttatgattcgtaaatccaccatgtgtccga
+attcgaaatcctgttgctccggggagatagggttaatttaggcttttttacggtgtggca
+tattagctcaaacatcaacattcttaaaatcagcgtaaacggtcaccagttgatatttgt
+tctgctaggaagcgatgtacaaaataagcttaataagatttaggtccgaccttaatttcg
+gtccatagcacctctttctaagtgttttgcttaaataattgtattgttattgattttctg
+cgagttgaacacggaaaataagtcaaaaaggacacttttaggttcatatgtaccgatgaa
+tgcgcaatagaatcgagaaatttttagattagtaatcgtgatgattgtggccaaatcccg
+cactaaacggctttcgctgtttccaaaaaattttagtccactaggtatttaaatgttgga
+cactgaacgtggaagccgtcgtattatgaaactaatggcagaggggctcctctgcgtgta
+ctttgagcagatgctatcgtcagaaaaaggtaaatcttttggttctttataattctggcg
+tccgtgtagcctagtgaatgtgtttggttcaagtgaatttgtttagccagaatggaccaa
+ttacgtcattagctgttacgtctatacgaaatatagactgtggacgacccatcgtagagt
+catgtagttacatgtgaccttagaacaccaatcgtgtgcgattgtaagcaggacaacaca
+gtattgtactggtcaattggttcatagatctgactatgaatcttcgtttttgtacaacaa
+tctcggtgaagcttcaaaaagcctccttcctaataatcagttaatttttcgtaaggttcc
+tgttcgaggttagtcgtataaagacgaaacggccttaatgtaacattaactattccactg
+taggtggatctaacaaggttggacatgtgctaccaataagataagaatttcgtccgcaat
+acaatatctacttttgtagcctatcttggattaacaacaacttacgttggtatttcaccg
+gacgtatcaaatgattctgattttaatgactgagagtaaacatcaacgaatcttatgtat
+ctttaagccgctgcttgacaagtcacattactgttagaatgaacgcttcattactacaaa
+acctaccaccaactcccacattaatattatactagatgtttgaagtttatttgacaaagg
+ttttcaaaaagcacagaatcgttacgaacacgtacattaaattgttagggtattaattgt
+ggtcggtgcatttccggccccatagcgctccgcggggagaaactatggccttcatgacag
+cccccccataacatctaggtaatggtcggataactataaacaaccctctccagagaactg
+tgaaaataaaatctcttagtacacaagcgtatactggtttaagtcttgcccatcttaaag
+actcttttcactattttcttgatgcctcattcttctaatattaggtgattttttaatccg
+agaatataaaaagacgatagaaagtgttaaaacacggcgtagcgacatattttaaagaaa
+tgaaatactttttgactatccctcatgatctaaacttacgcggagctatctttttgtata
+acatgtacagagaattaatccgatgcttcttccgattaaggacatagcgccgaaaacgtc
+atggcggcttatcgatatcgtaacgcactataccaagtgattaagtgatcaatgaatacg
+ggtttcgggatttctgttaagtcatgcacggcaaatacttggagtcttgaataacgccgc
+gcgtagtacgaaggttctcaagctcgcgtgacgtatagaccgtattgctatttcctgcct
+tctcaattgtccgaggattgctgataacttaaaataaggttgagtttttaataacgattt
+gtcgagtttgggaaaatcctcgtttgtgtgtttgtcattttcaagttatcaagaactacg
+ggtataatttacgacgtaatgttggtttgatgcccgattgcgaatatcgtacgaatggta
+tttgtacaactgctttcctttatcgattgctcgagaacattataaagtctattactatgg
+attaagactgtatacaagtgtttaagcggagcccgtgataatctataaggttttggtacc
+tttatctgttacttttgccttgaaacatacatacgtacacgggaatatttacctaaacgc
+cgtatagtccagcctcgtatttgggccgtgttttgtcagcattttaaactgaaagcgccc
+acttgcattataacccggtgcggaatctcttagtgactcgtcaggagtttacgcctttga
+gacctctcgacaggacccattttgatctagtcgttataggtagagtgcctttcctatcgc
+accattaccttctagcaaacttagagtattcaatgaaatcatatcctgtttatactaaat
+gttataggctaatgacacagctgacactaagaggtctcttcgggttacccgaatgagttg
+tttatacgatgttgacaactcgggggagtcatttcaatgaagactgaggactcttgatca
+gattaaaacgcttaatgactgataatttagattatgccgtgtattatttaagtgggcgaa
+ccctcccctagaatgggtttcctgagaaaagtcttagaacacagtattctgaatccagat
+gcaaatcgctaacgttagtaagcggctgtagctcttggcagtttggtcaatagtcaatcg
+caatccgtttaaccgtctactattcctagagcgaagagctatgttctgacacgtccccaa
+tattaggcaaaggctccaaaagaacagtcaattgattaactacgggcttggtttctccgt
+gaatccttgcgccgctataccacataaaaggatagcggtgataccacaagtttgcgacgt
+taaagcgtcgaccctcaacaagtacactagcaaccccttagcaattaattttgtccatca
+ctactgccaagagttgactggaccagttggaaatgacatttgatatattaatagagctac
+atattgtaccactttactgtcacttacactaaccctagcgtgattactcatacatatatt
+cgtaaattctaagttatgatactagttttgtaaatttaatcggcgaagacacgttctctt
+gtacgagcttcaactaaatatttcactgtagccaaccactttaaccagaaggatacctta
+atgccgatataatattgtccaggaaacgttaatactttcacaagacaaagcttggaagag
+gtactttacgatcacctgatagatcgaccggaacgattctatataggtttggtctgagaa
+atttgtagctaaaaccatgttccataggaactcctctgtaatgggcaaaatgcagatagc
+gttcaatcgttgcttaactatctatcacagcatcctaactcctcaacagcttctttccta
+aagacatcagcaggtaagttgacggcacccgataacccagagcacgattggaatctaata
+ctctgtatggatcattacgctaagtaaatataatgattttctgactcaaagttacactgc
+gaattttatattaactggttctatttgttaaataccacaacctctcgtcaacaggtcgcg
+atgcaagtgatccaaaaatatctaacttataccaaccattacttctggcgcagaaaaaca
+tagatatctgaacaatcgaccgttaagactgtctcgccgatcttaggaacctaatactgc
+tcagtagttattgtttatttgggccatccccggattatgtcagccatggaacactaaaag
+tcctaatctaacctatggacaaaaagctcacttttataaaattgctcaccttatgttgat
+tgttatttgtccgaaatgtctataactcagtgtactatctattggaaaattatggccgga
+gttttattgaatatacttttgtatgttgagaaagaatgttgtcgtaataattatcagctg
+gaaaatcatctaatatatattatattgagatattacgacagacctaagtgctttcccgtc
+atgagcagatggactaacactcttggtaatccttctcgttttagttggtaatgtttagtc
+taagtaatatcccgactcttacttactcagagcggaaatgactttttaaactaacgttta
+aaggcacttagtatgcgtcagggttatttttttaattacgtacccttgtgcagagagttt
+agctattcgatcctacttagtatgaaccatgagagtacaggttggtaattcacagagaag
+gtcgagaagattatttttgatgtttaccaatactatgaggcgtattcatcgaaataattt
+tatggctgcgcacttcacatacgcaggaagaccactgcagcttgctagatctggatgtat
+cattgtacttctaagagcctgaaaggtaatacattcccagcgagcgtaacagattgtatg
+gggacatattcaatcttagcaatgcattcgttcttcgaaatcaggcatttttgatgtcat
+aagttctgtcaactataaccctggaactttaatctgttgttcgtcgaatcaaggatcaag
+aaagcttctaaaaggcccaaagcaaaacccaccactacttcagttttaaattagaatcac
+accctagggtattagataataattaaatgtcttaggaagagatatcaaaagatgcagaca
+tcctcaagtgaataagtctccggtctttcacaaacacatggttaagcgatgtggttttga
+ctagagacgttcgccaccatcgtaatatttctggttacctgcgaacgtgaaccaaatctt
+acttcatacattgcttaaacagtacaacttatctcttatcctatagagatctcaaaagtt
+tgtatttttactggtttcaaattgagagaaaaactgcgttctccgatttctatattattg
+tttaaatgatgccaaacatccagtttaaaacacggtgtgatcagccgactcagattcgta
+tcctatgttagaatgagtcatcaaactacggtcacgcgtacattacagagtaaactacac
+gaatgaaagagataagaagatgaaagagttaataggtctcctgttaattatgagaaccct
+aactactacggattggcctactagtgggttggaacggatataaaattcgactaagttcgc
+ggcatgtcaggctcctaaatatgaagagaactcggcatcgaattatccacagtaatagtt
+ggaacatgattcctctatgcatggtgtatatccacgtacgccagtgtgcagtgtagccat
+gcgaccacgggcgttgtgaatattcttcctcagaaaaggactgttgagcaaggaattgga
+ttctgtgaacggaatatagtcgagtagatggaatttcctacactgcgaaaaggtcatagt
+aaatcaaacgccgcgcgcagacatatcttcttggcaattagtactccactaaatcaattg
+gttataaacttttagaatatctttatataagttcactacttacgctgcgggtagtatatt
+taaagtgatgtcttaggaatcttatggcggcggaataaacggcttgactatagataccct
+aattctggcataaccctgtaacgtgtgaagcatgctttaatagacgactagatcagctta
+tagaatggatatgactgccacattgaagagattaacattagcgggtataatgttacgaac
+ttgtttaacaaaatagctctaccacacacgcatagtataatataaaggtcctggagttcg
+ctacgagcctggaattgcagttcccctaccctgagtaaacaagatcagtatggacctatc
+ttctgacccacgtgtaaaaactaccgttagcggccctgagaacggtgaagttgattatcg
+gctaacactcgctttaccaaggaacaaacaattgatggaacaggtaagcggctggattct
+atcctgaatacagcataataatatttgctttcaatatatagttatgacactcccaatatc
+actaactctttacaaatcggatatgaagagtgaattagagatggagccgatcgttccttg
+tattctggtaagtactcgactaatgtgtgtagtctaggggtaaaggtccttaaccgtcga
+gtctagaactcacgcattatgaaatcctccgagcatagagactctaaattcgccaagcaa
+taagtcccgacgcgaaggatgagaagctcattgaactgtaacatttacgtcgggctcacc
+atgttacatatgcagcgggtaaaagtttttgcctggagtggttgagtttcgcgatacata
+aaaggccccactttcatatggtcaaatatctatatcgtgctttggacgactcgataaact
+aaagtagcctagtaatgccctaaaccgctgcatttgtgcaataaaaaatttagagtatat
+ataacttccggacgtatggctgccttgaatcctcggatatcgtccttatacaacgatgaa
+cggtatagctcggaactatgcagattaggcgatccttgggttgaatttttagtttccata
+gatatgagttagttttgatatggttaccatacgtccctgcattgaaacttaatctgtata
+ttgattgatccttagcaatagcggcacatttctgggcaatatgacttaattaggttacgg
+tttttactatgatggatacgttttatatgatagaataacagttgctatttaaacaggtac
+tacattcaactaatactgtttcactattgtgtccaacatagggaatatattgcctgaata
+gatgtattatcaggcatcttttacgctccaggtagaactaattaaaaatgatccttagaa
+actttcaagcaacataagctaaaagttacgccaattataagccacatcggtaggatcttc
+aggcattcccatatccttctctatcaatcccgtctgttgctaattggttatctaagcata
+tcgcggcgagcatctacgataggtataaagttgctgctatctaattcgtcataatatata
+catggaattacagattcatacgtcttcagtctcgtggtgtttctaagagcggacccaaga
+attacgtaatatctctctcgtgttacccaagaagttgacacgtgattgtcagctatcttt
+ttctggcgatgttaatagttataaacaattgcatatagctgcaaattagctaatcaaata
+ctcgtttcttaaatgttatcagcaaagctttaggttctgtaatttcactgtgtaaagagg
+gcgctaagttcaaaattggtttttggcaacaaacaatttaatagcgcagtgcaaaaataa
+tatctcagggtgtaattatttctctaattggtctttacggttggaccaggcaatgggttt
+tttatctatgtgataccaattaaaagtaatttcaaagtgacattaaacttaagtattgct
+gtcaagaccattacgacacttcaccaacacatttatgtattgtgctacgcggtatggccc
+gtagtaatttctgatattgaccgcgttatcagcaagtacgctgtacaaatgccaaattta
+gtaaagctctgtgtgcattccaaggtgcccacatcacacattatcaacatatcatgtcgt
+tgtattacgtccttttactagcctgggaaataccggtgattcagagtgaacataaatctc
+tgaaagctactagacaaagctagtatagttaaaatatatatttcttttaatattaggatc
+tttgcgattgcacatttcaagcatcgcattaacctacctccgtactcttctacaacggtt
+gcatgtacgatttctatgcgatgaaatacttatgttcttagtttggggttactttgttca
+cctagtcctcgaacgcaaattagcttcgaatatctgaaaagtgtatgcgggcaccaaaac
+gatctcgattcttaggtttataattatagtcagaagataaatacatgcatatctggacac
+tcttccacatgtcatgtcgactaactttgaactacagtcatatatagactgttatctgat
+ccgtatgtgtctattactactcttatctgagaaaggacccaatggagtcacagtaagcga
+tcatgtcatcggggctttttccctgattataagattacactattgctgtgcttggggcct
+cctactttttctatcttaatcattttgtacattaaaaagctaagaagtaggtacaactta
+tctttcccatacgagctggaccattaatttaacagccgcaaggcgagttttaatgttaat
+ctggaagggctttatgttctaagcttttagcactgagaaattaatccgtaggaaattaat
+cccacataacccggtaagagaaccttacgccccgttactaataatgttctgcgcaatgta
+ggaagtgacaagctcactcttgcgacgagctccttaatacaggccctgcgttatattcga
+ccgtacctataactagaccaccatcttaaatgtacagttatggttttcgacgcatagagt
+atgggaccacctcgaaatgctcagctgcaaattgtactgggggtggttatcaaacattta
+atatgaatctatggtaaagtactagtttatagatagccgaacactaaaggtttgcagacc
+ttcctcccctgaggaacttcgtgtcacaaattagattgagaaggtggtgataaaatcgcg
+tatctacaatgatttggtgcaaatatttatcgattgcccaatcgttctactcgtactctt
+tatagcctaacgccttttcttggcgctaattagcctaatccaagaaggagtctaacaaaa
+ttacttaaccatactcttgtctattcggcccacgcatgcgcaagctcaaaaagttctcaa
+cgggcgtttttacttgagtcccaggaggtaacattggatctatgagtcttaacagtggaa
+atatgatttttagattgtgttcagatttattgtcttattttggtctatctcatcagctat
+agctacataatgacgtcttaactgtttcgactaaccttcagatctgactaccccaaatac
+aacatagcaaaagaatgatgctaacgcttaactatcctttcacgatcttaacaaaaaagc
+tccatttaaaagaatcgaaaacagatctaccattcgtggaatcaatttttggacgagtac
+tggtcgggtcgtgcttatttgctacaggattgtttcgtataacgttcaagcactttagcg
+gttccatccttgatggcgttaactgatgatgcgtaagtttatggtgatctaaaactctac
+tacgaaccaggtcccagcacgaaacgtcatctttaatgagtttttaggtctccaggcact
+aggctgcgaagtggaatatgtgtcatcagagacaaatagatgattcctatagctttttgc
+agttaagccactaagtaggcggttctatagggtttcattcaaatcgatcgtaattcccga
+ctctgcatagcgtgggtcttgtatagaccattcttcaggcccgccacaatggtttcaagt
+ttcaacttccgtttattggctgtccctcaatagagtcgttctcagggcacgactctcgtt
+cgttattcataagtccagtttgatccacgaatacagaacacgcatatctgataataaaag
+cttaacgataactttcacgcgcatggtttatttttgatttattaggcaaccaaataccag
+aatgtagtcagcgatatgtagtaaaatttagacaaacataaaacaaagtatcgccattac
+agtctcctgttaggagaacctttttatcaatatgtgtaggcgtgtattggcgcccttgat
+ttaataataattacggctaaacgtattgatattttccaggaactgccccatctcatgaga
+tgaccctaaattttattcacacctcatttttaattcttttatatcacgattatttatctg
+agcaagcatctttgcaagcattcatagtgacggtgctgtctctatgaatgcatgctaata
+tacggtgcgctaaacatattggttcaattcaatgtaagctacctcggaatttgcttgcac
+taagacggggaagccaaaacggtaaatcgccgtatatgctagtgccaagggacttgtccg
+ttggagtcactatggagttacaagcattataaatctaaggaaatcgcagtatcagtcctt
+accccaaagatacttcgcattccctggggtacggaccatgaaatacttctttcatacatg
+ataaacgatggagactcggttaccaccctggtagttactccatcaattggagttaactaa
+gatcgctattacaggctttattagccaatcatcacaagcctctttttagagattcacaag
+ttagcaaaccaaagttcctttgataagtctttaacgagatctatcccaattccggctagg
+agtaaaatttatatatttgagatcggggttaaagtcacacgcaatgcaaggggtttttat
+atggtaatgtccttccctaattaggtaattttcagacctccgagagagagtagatcaaca
+acgcgttatactcctaaaatgcttgtcgataacatgacactacagatcatccctggatga
+gcatcgactttcattacttgattagttcagttaattcgtttcaaaccattttcaacaaaa
+tcccccagtagatatgtatatgcacatcttagactaaataacagttttcataccctggga
+tttgtgtcactatctcaggaacgtcgagacgtcccctatcaccgcagcgagggtaactgg
+ccctgttccattgtaatcgatgggacgggacgttatattgcagacccaaagtagtaataa
+attcagccatatggacggagggggggaattgttaagaatataattcgattttcagctgaa
+tgtaaaagctccagccattcctcctccacttgacattagttcgaagaaggtctgagaatt
+ggaattgcttgtgacgttttttgtttccagacaaggaaatagcccagtaccaagtataat
+attatgacaatagaagcttaaattcacaacgtaacatatctgttagcatgctctaataga
+ccgagaaaataagtgtctatgtgtgcgagaactgtcaattcacggcagtagtcacctaat
+ctaacgtctagttcccgactatgaagtcttcacaaatggttagtaataatttcccagtgg
+agtagaagtggcataacgtgcactctctgttaataatacctttagactactcccatttcg
+ccagaacgtcttgatggtaccctatgggaaacactcacacatgcttattgcctgcaacct
+cagcaatgtgtcgtatgcggtatttctacgaacagctagtgaaaggactgatgacctaat
+tttggtttctcaagtccagacgtgatattttgatgaccgtatctgacatctctgggcaat
+tcggttaacctctggtacgaaatagtccgtcgcgtaggtaaaaatgataatgctgtcatc
+actatcatgttttagctaagctacactaccccatcgctcgcacgtggcaaagtgtgagga
+ttccgatatcatccatgtgtacgaattcctaatactcttgctcagggcacttagggttat
+tgtagcctgtgttaccgtctcgcatattagatcattaatcaacagtcttataatcaccgt
+aatcggtaaacagttgttatttgttctgataggtagacagctaataaagatgctgttgaa
+cagttacgtcccacctttattgccctacagtgaaactagttcttactctgttgctgtaat
+atgtctagggttattgatttgctgccacttcaaaacggaaattaagtcattaacgaaaat
+ggttccttcataggtaaagatcaatccccaattgaagccagaaattttgagatgtcgatt
+cctgatcattcgccaaatttacagctcgtaaacgagttccatgtgtaaaaaaatgttgag
+tccactagcttgtttattctggctcaaggtacgtggaacacgtagtattttgatactaat
+gccagacccgctacgatccctgtactgtgagcagagccgatcctcagaaatagctaaatc
+ttgtgcttcgttagaagtctcgactacgtgtagcctagtgtttgtgttgcgttatagtct
+atttgtggacacagtatggtcaaatgacgtcttttgatctgacggcgttaacaaagatac
+tctgggcaacacacatacttctctcatgttgtttcttcggacctttcataacctttcctg
+gcacatggttagctgcacatcacaggattgtaagggtctagtggttcagtgagcggaata
+tcattcgtcggtggtgttaatctatctcggtgtagcttataaatgcatccgtaagaatat
+tatgtttatttgtcggtacgttcatggtagtggtgtcgccgatttagacgtaaaggcatg
+tatggatcttgatctatgcaaaggtaggtccatctatatacgttgcacagcggatacaaa
+taagataagaatttactaacatttaaattttcttattgtcgagcatagattggaggaaaa
+acttatttacttggtatttaaacggaagtttctaatgtttatgattggatgcacggacag
+tttactgcttactttcttaggtttcttgaacaacaggatgcactagtaacatgtctcgtt
+catgcttccattaagttcttcttaaacttacacaaactacctaatttagagttgacgaga
+tggttgaacgtgttgtgacaaacgtttgcaaaatgcacagtatcgttaccaaaaagtaca
+tttaagtgtgtgcgtaggaattctgctacgtccattgcaggccacattcacatcccaccc
+ctgaatatatggactgaatcacacacaccaaatttcatctaccttatcgtagcataacta
+ttaacaaacatatacagacttcgcggtaaataaaatatattagtacacaaccgtatactg
+gttgaactattgcccagctttaagacgcttttaactaggtgcttgatcaagaagtattat
+tatatgacggcagtgtgtaatacctgaatagatatagacgttagattgtctgaaaacacg
+ccgtagagacatttttgttagatatgtatttctttttgacgagccagcatcttagtatct
+gaagacgagctatatgtttgtagaaaatcgactgacattgtatacgaggcggcgtaagat
+taaccaaattccccagaattagtaatggcgccttatcgatttactaacgatatataactt
+gtgatgttgtctgcaatgtatacccgtgtaggctgtgctcttatcgaaggaaacgcattg
+aagtccaggctggatgaaaccaccgcgtacttccatgcgtctatacatagcgtcaccgat
+actacgttttgctatgtaatccattctaatgggtaagaggattcctcttatagtaaaata
+tgcttgactttttaagaaccattgggagtggttggcaaaataatagtgggtgtctttctc
+agtgtatagttttctacaactacccctattaggttacaagtaatctggctttcttgccac
+ttggcgatgatagttagattcgtatttctacaacgcagttactgtatccatggcgcgaga
+taattagatacgatttgaatttggatgtagactcgttactactgttgtagaccagcacgt
+gagtatctagatgggtttgctaccttgttagcggacttttgccgggaaaaagacatacgt
+acaaccgtatattttactataagcagtattggccaccctcgtattgcggcagggtgtgct
+cacctggttaaaatgaaagagaaaaattccattttaaaacccggaggaatctattactga
+cgaggaaggtgtttaacccgttgagacatctcctaacgtaaaaggttcatattctagtta
+ttccgagagtcactttcctatccaaacatgaactgatagcataatgacaggttgaatgga
+aagcatatcctgtttattctaaatctgtttcgctaatcaatatgctgtcacgaactcgga
+gcttacccttacaactatgtgttctgtttaccaggtgctaatatcccggcactcttttca
+tgcatgtcgctcctagcgtcatctgatttaatagcttaatgtctcatattttacagtagc
+cagtgtagtatggaaggcggcgaaccagcccctacattgggtttcctgacataagtatta
+catatcacttgtctgattacacagcaaaatcgctaaccttactttgcgcatgtagctatt
+ggaactttgggctagtgtctatcccattaagtttaacagtagactagtccgtgagcgatc
+accgagcttatgtctcgtacccaagttttggatttggatcaaaaactactcgatattcat
+gatctacgggcttcctttctccgggtatcattgcgccgagattaaaaataaaacgatagc
+gctgtgaaaacatgtttgacacgggatagcgtagaaactaaacaacgaatagaccatcca
+atttgaattttattgggtccagcacttcgccatagtgttgaatggtaaagttcgaaagga
+aatttgttatattaattctgctacattttcgaccacttgtatctcaaggacaatatccct
+tgaggcttttagcagaaagagatgccgtaattctaagggatgataataggttgggaaatt
+taagagcagtagtaacggtcgcgggttcgaccttaaactatatatttaaatctagccaaa
+caagttaacaacaaccataaagttatgaccttattatattggcaagcttaacgttttaat
+tgctctagtaatagagtggtagaggtaagggaccatcacctgattcttcctccgcaacca
+ttatatagacgtgtcgtctgacaaatttcgagataaaacattcgtccttagcaacgaata
+tcgaatggcaattagccacattgagttaaatagttgaggatatttcttgcacagaatcag
+atctaatctaatgattcgttactaaacacttcaccaggtatcgtgaaggctcaagattac
+ccagagaacctttgcaatataagaatatgtatgcagcattaccctaagtaattatattct
+ttttctgactcaaagtgacaagccctagtgtatattaaatcggtatatttgggaaattcc
+tcaaactatcctaatcaggtagccatgaaagtgatcaaaaaagttcgtacttataccata
+catgaattctggccaagtaaaaaatagattgcgcaaaattcgtaccttaagtctctcgcc
+aagatattaggatcctattactcatatcgtgtttttctttattgccgccatccccggagt
+atctcacccatccttctcttaaaggcctaatattacctatgcaaataaacatatattgtt
+gaaaattgagaacctgatcgtgattcttatgtgtaccatatgtatagtaatcacgcgact
+atatagtgctttagtatcgcccgtgggtgagtgaatattctgggctagcgtgagatagtt
+tcttgtcctaatatttttcagatcgaatagcttctatttttgtgtttattgacatatgtc
+gaaactccttactcagtgaaagtcatgaccagatccacgaacaatcttcggaatcagtct
+cgttttacggcggaatcttgagtctaacttatatcccgtcgcttactttctaacacccct
+tatgtatttttaaaattacgtttattcgaacgtacttggcggaagcgttattttttgaag
+taagttacattgggcagactcttgacattttcgatacgactttctttcatccatcacagg
+actcgttcgtattgatatcagaagctcgtgatgattagttgtcttctttaccaatacttt
+gaggcctattctgcgaaatttttgttgccctgcgaacttcacataccaaggaacacctcg
+caacatgccttcatatccatcgttcattgtaattcttacacaatgaatcctaagtaatta
+catccctgcgtaaaagatggtaggggcactgaggatatattaccaagcatttagttatga
+gtaatcagcaatgtttcttgtattaagttctctaaaatagttacatcgtaatgttatctc
+gggttccgcgaataaacgagatagattcattatatatggccctaagcaaaaacctcctcg
+tattctgttggtaattagaatcacacaatacgggttgagatattaattatttgtagtacg
+aagagatataaaaagatgaacaattactcaagtcaagatgtatacgggatttataataaa
+aatcgggtagagatctgctttgcaattcagacgtgccactaaatcgtaatatgtcgcgtt
+acatcagaaagggtaactattattaattaataaagggcttaatcactacatattagatct
+tatccgatagtcttatctattcgttgtatttttaagcggttctaattcagtcattatatc
+agtgctccgagttctttattattgttttaaggatgacaaaatgcctcttgttataacgct
+gggagaagcagactaagagtcggagcagttggtagaatgaggctgcaaaagacggtctcg
+acgaatggacagactttactaaaccaatgaaagacagaagtagagcaaagtctgaagtgg
+tatcagcttaattatgacaacccttaatacttccctttcgccgaatactggcgtggaaag
+gttttaaaagtcgaagtagttagaggcatctctcgctcataaataggtagactactcgca
+atccaatgtgactatgtaatactgggaacatcagtccgcgatgcagcgtgtttatcaacc
+gtccccactcgcctggggagacatgagaccacccccgtggggattattagtccgcagtaa
+tcgactcttgacaatccttttcgattatgtcatagcaatttacgacagttcagcgaagtg
+actactcggcgaaatggtattactaaagcattcgaacccacatgaatgtgattcttggca
+atttctaatccactaaagcttttccgttgaatctggttgtagatatttatataagttcac
+taattaagatcacggtagtatattgatagtgatgtctttgcaagaggttggccgaggaat
+ttacggattctctattgatacaatttgtctggcttataactcttaaggctgaaccaggcg
+tttttagacgacttgatcagctgttagaatggtttggactccctctttcatgtcagtaac
+atttcagccgttattgttacgatatgcttgaacaatattgatctaccacacacccatagt
+atattttataggtcatgctgttacctacgagcatggtattccacttcccattcaatgagt
+attcaacatcactagcctcagagatgatgacccacctctaataacgtcacgttgcggcca
+tgtgaaacctgaacttgagtagacgatatcaagcgctttaaattgcatataacatttgag
+ggtaaagctaagcggatgctttatataatcaatactcaataataagatttgattgcattt
+tagagttatgacacgacatagttcactaacgagttactattcccagatctagactgaagt
+actgatcgagacgatccttacgtcgatgatcgttagttatcgacttaggtcgggtctcta
+gcggtattggtacttaaccggacactatactaataacccatgatcaaagcataacagaat
+acagacgataatttcgccaacatatatgtacagaccccaagcatgagaagctcattgaaa
+gctatcattgaagtcccgctcacaatgtgtcttttccagacggtttaactggttcccggg
+agtcctggagtttcgacttacataaatggaaacaatgtattttgctaatttatctatagc
+gtcatttggaccaatacagaatattatgttgcctagtaatccactataacccgcaagtgc
+tgatagaaaatttttagacgatttataaatgccccaagtatccctcccgtgaatcctccg
+ttatactaattagtattcgttcatacgtataccgcgcatatatgaacatttggcgataag
+gcgcgtgaattgttacgtgacagagatagcagtttcttgtgatatggttaacagacgtac
+atgaagggaaactttatatctatagtgatgcttccgtagaaataccgccactggtctgcc
+aatgatgaagtatgtagctttaggtttgtactatgaggctttcgtttgtttgcagagtat
+aacagttgcgagtgaaaaaccgacgaatttatactaatacgctttcactattggctacaa
+aatagggaagagtttcaatcatgagagggagtatatggatgctttgtagctaaaggtaga
+acgtatgtatatgctgccgttcattcttgaaagatacataagcgataagttacgacaatt
+ataagcaacatccctaccttcgtaacgatttcactgttactgcgcttgaaatacactatg
+gggctattggcggagagaagcagatcgcgccgagcatatacgagacctataatgttgatg
+atagagaaggcgtctgaattgatacatcgaagtacactttctttcgtagtatctctcgtc
+ctctttctatctccggacacaagaattaagttatatatatagagtcttaccaatcatgtt
+gaatcctgattctcagagttctttggcgggccttgtgatgactgagaaacaatgcaatat
+tgctccaaatttcctaagcaaattctcggttatgttatgttatcagcaaagcgttacgtt
+atgttatttaaatctggaatgacggagcgaagttcttatgtcggtgtgggaataattctt
+ttgaagacagcactccttaaataatatcgctccgtgtttgtatttatcgaatgggtctgt
+aaccttgcacaagcaaatcggtggtgtatatatcggataacaattaatacgatgttcata
+gtgacagtatactgatcgagtcctctaaagtcaattacctcacttaacaatctcattgat
+gttgtgtcattcccggtatcgcccgtagtatgtgctctgattgaccgagtgtgaaccaag
+gaacatctactaatgcctttgttaggtaagatctctctgaattccttcgtgccaacttaa
+aacattatcaaaatttcttctacttggattaactacttttacgagcatggcaaattcccc
+tgtggaagacggttcattattatcggaaaccttatagaaattgcgtgttgactgaaatta
+gatttttattgtaagagttgcatctttgcgattcctctggtctagcttccaatgaacagt
+cctcccttctattcgacatcgggtccttcgtacatgtctttgcgatgtaataattaggtt
+cggagtgtggccttaatgggtgcaactaggaatacaacgcaaatttgctgacatgatagc
+aaatcggtatgccggcaccaaaacgtgctccttgcttagcttgtgaatgagactcagtag
+ttaaataaatccatatctgcaatcgattccacaggtattgtccactatctttgaactact
+ctaagagatacaagcttagctgagaccgaggtgtatatgactacgctgatatctgtaagg
+taccaatgcaggcaaagtatgcgagaagctaataccggctgtttccagctttataagatt
+aaaatttggctgtcctggcggcctcagaattgttctatcgtaatcagttggttcattaat
+tagctaagtacgaggtacaacttatctgtcccagaacagctccacaagtttttttacagc
+cgaaacccctgtgtgaatcttaatatccaagcgcgttatctgattagagtttacaactca
+gtattttatcagtacgttttgtttccaacattacccggtatgacaaaatgacgccacgtg
+tcgaataatggtctgaccaatgtaggaagtgaaaagataaatattgcctacacatactga
+attcaggcaatgcgttttattcgaaaggtcatataactagaaaacatgatgaattcttat
+cggatccttttactagcatagtgttggcgaacacctcgtaatgctcagcggcaaattgga
+ctgcgggtccttatcatacattttttttcaatataggcgattggtctaggttagtgattc
+cccaacacttaaggtttgctgacattcataccctcagcaacttcctctcaaaaattagag
+tgagttggtggtcttataagaccgttgattatttgaggtggtcaaatgatggtgcgatgc
+acaaatcgttataatcgtactctgtagacaataacccattgtagtgccgattttgtgcat
+aatacaagaaggaggatataaaaatgacttttcaataatattggctattagcaacaagaa
+ggagaatcctcattaagttagcaaccgcagggggtactgcagtccaaggaggtttcattg
+gagagagcagtatgaaaacggcaattatgattgtgagattcgctgaagattgtgtctctg
+attttcctagatagaataagctatagctacttaatcaactcttaactgtggagactatcc
+tgatgatctgaataccccatttacaaaattccatatcaatgaggctaacgcttaaatttc
+atttctccatcgtaacaaaaatcagcctttttatacaagacaaaacactgcttccattac
+gggtagcaatggttgctcgactactggtagcgtcgtgatgtggtgataaagctgtcttgc
+gtttatacttaaacaaattttgacctgacataatggagcgacttatcggatgttgccgat
+ctttagggtcatctattaagcttatacgaaaaagggacaagcacgttacgtaatctggta
+ggactgggtacctagaaacgcaagaggaggcgaactccaatatctgtaagaacagaaaaa
+tacaggagtccttttcatttttcaagttaacaatataagtaggagcttagagaggcttgc
+atgaaaatcgttaggaattacagaataggcagagagtggggcgtgtagactacattcttc
+aggccccacaatatgggttataggttaaactgcactttttgcgatctcccgaaatactgt
+cgttctctgcgaaccacgctcgttccttttgctgtagtccacgttcatccaactattcag
+ataaacaagatcgcagaattaaagcttaaccatatcttgatagcccatcgtgtatggggc
+atgtatgtgcaaacaaaagacctcaatcttgtctgcgagagggaggaaaatttagacaaa
+cataattcattctttcgactggacacgctaaggtttggacaaactttgtatctatatctg
+gaggcctgtattccagcccttcttttaataagatttacggcttaaactatggatatttgc
+caggaaatgacactgctattgacaggaacataattttgattcaaacctcattgttaatta
+ttttatatctcctgtttttatatcagaatgcttctgtcctagaaggcatactcaaggtga
+gggctcgaggaatgaatcataatagaccggcccctattaatattggttcaattctttctt
+acataacgcggaatttgattgcacgaacaccgggaacacataaccgtatagcgcccgtta
+tgctagtgcctagcgactgggaccgtggagtctatatcgtctttctaccattattaatct
+aaggatataccactttaagtcctttcaactaacataaggcgcattccatgcgctaaggac
+cttgaatttattatttcttacatgataaaagatcgagtcgacgggaacaaaaggctacgt
+actcaataaagtgcagtttactaagagccctttttctggcttgtggagactatcataaca
+tgaagatgttttgacattcaatagtttgcaaaacaaacttactttgtgtagtattgaacg
+agatctttccaattgccccatagcaggaatagttatatattgcagatcgcggtgtaacgc
+actccaaatccatcgcggtgtgtgagggtaagcgacttaaagaattacggtttttgatca
+aagcacagtgagagttgagcaaattacagttatacgacttaattcagtctccataaattg
+aaacgacacttcttaacgggaggaccagacacgttcattaagtgaggagtgcactttttg
+actttaaaaacatggtaatcaatttaaaccacttgatatgtatatgaacagatttgaagt
+tatttctgttttaatacactgggagttctgtcaatatcgcaggaaccgcctgacgtcccc
+tatcacacctcagagggtaaagggacaggggaaagggtaatcgaggggtagggaacgtag
+ttggcacacccaatggacgaataaatgctgccatatccacggagggcgggattgcggttg
+attttaaggcgatggtaacctgaatgtaatagatcatcaaatgcctcctccactggaaat
+tactgcgtacatccgctgagaattgcaatggagtgtctcggtttttctttaaacaaaacc
+aaattgacaacttcatagtataatttttgcacattacaagcgttaattaacaaacttact
+ttgctgttagctgcctatatttgtccgacaatataactggatatctctgcgagaactgta
+aattaacggcacttggaacataatagttcctattggtaacgacgttgtaggcggcaatta
+tccggtggaagaattgacaactgcagttgaactgcatgaaagtcaaatctctcgtaagta
+taactttagaagactccaaggtacccagaacctcttcagcggacacgatcgctatcaatc
+aataaggattattcactgaaaccgctcatatctggaggtggacgtttttcttcgaaaagc
+ttgtcaaaggactcatcaaatttttggccgtgctaatcgacacacctgttattttcatga
+ccggataggacatctcgcggaaattcgggtaacagctgggtagatataggacctccccta
+cgtattaatgataagcctgtcataactagcttggtttaccgaagagacaataaacattcg
+agcgctcgtgccaaactcggtgcattacgtttgaataaatcggtaacatgtactattact
+ctgcctaacggcacttacccgtttgggtccatggggtaaccgctcgatgttgacagaatt
+atgctaaagtcgtttaagatcccgattaccgaaaatctggttatgtctgagcattcgtac
+actgcgtattaagatcaggttgaacaggttcctaacaaattttgtgacctaaagtgaaac
+taggtcgtactctgggcatgttttatgtcgtggcgtatgcatgtgctgacacttctaaaa
+ccaaattaaggctttatccaatatgggtccttaagtgctaaacatcattcacaatttcaa
+gacagattgttggtcttgtcgattccgcatctgtcgccaaattgacacatcgtaaaccag
+gtacatcggtaattatatgttgactaaactaccgtgtgtattctggctctaggtacggcg
+aacaagtacgatgtgcttaagaagccctcaccccagacgagcccgcgtaggtcacatcag
+cagatcctaagtaattccgttttattgtcctgagggagtaggatcgacgaactctacaag
+tcgctttgtcgtgccttataggctatttcgggtcaatgtagcgtcaaatgaactattgtc
+atctgtacgagttaactaagtgtctatcgccaactaaaagacgtctcgatggttctttat
+gcggacctgtcatatcattgactggcacttgcttacatccaaataacacgtttgttagcg
+gatagtcgttaagtgtgcgcaagatcatgaggcggggggggtaatatttcgccctctaca
+tgataaatgaataagtaagaagatgatctttttgtggcggtaccttaagcgtactcctgt
+cgacgagttactactaaaggaatgtagggttctggatctatgaaaagcgacctccatata
+tatacgggcctaagcggagtaaaataagtgatcaatggactaacattgaaatgttagtat
+tgtcgaccattgagggctggtaaatcttatttacgggcgtgggaaaacgaacgtgatatg
+gtttagcatgggatgcaagcactcgttaatgcttactttagttggttgcgggaacaacag
+gaggctatactaactggtagcgttcttgcttccattatgttattattataattaaaaata
+agacatatggtagagttgtagtcagggtggatcgggttgtctataacgttggaataatca
+aaactatcgttaacaaaaacgaaatttaagtcggtgcggtggaatgcgcctacctcatgt
+gcaccacacattcacagcacacccctcattataggcaaggaagcaaacaaaaaaaagtta
+atcgaccgtatccgaccttaaattttaaaataaatagaaacacttagcggtaatgaaaag
+ataggactaaaattcactagtatcctggaacgaggcaacagagttatctagatggtaacg
+aggtgctgcatcaagatgtatgatttttggtccgctgtgtggaatacctctattgatata
+caagtgactttctcggtaataacgcacttcacaatgtgttgtttcttttctatgtatttt
+gcaagagaaagaagcttagtataggtacacctcagagatgtttcgtgtaaatcgtatcac
+atggtataactgcaggaggaacattatccaaattcaccacaattactaatccaccctttt
+acttttactaaagatatattaattctcatgttgtctgaattgtataacccggtaccctgg
+gagcgtatcgaaggataccaattgaagtcctcgaggcatgttacaacacacgacttcctt
+ccgtctattcagacactcaacgagactaacttttcctaggtaatcaatgatattgggtaa
+ctcgtggcatcttatagttattgatccggctcttttgtagatcctgtgcgactcgtgcgc
+taattaagactggctctcttgcgcaggggatacgtttattctacgtacccgatttggtta
+ctactaagcggcctttcttcaaacttgcagttgtgacttacattcctatttcttcaaagc
+agggaagggttacagggagagacttattgagatacgattggaatttccatgtacaatcgt
+taatacgcttgtagaccagcaactcagtatagagatccgtttcctaaagggtgagcggta
+ggggcaaggcaataagaaattactaaaaccctagttgttaatataagaacgattcgaaac
+aataggattgcccaagggggtgcgaacatggtgtaaatcaaagagaaataggcattgtta
+aaacccgcacgtttctagtacgcaagaggaacgtcggtaaccagttctcaaagatcctaa
+cctaaaaggggcttattctactttttccgacactcaatggacgagacaaacatgaacgga
+tagctttaggtctcgttgaatgcaaagaatagaatcgttattattaatcggtttccatta
+tctatatgcggtatagatctccgagaggaccctgtaaactagctctgcggtttaactggt
+gctaatagaccgccactatgttattgcttctagctcctagcgtcttatcatgttatacat
+taatgtcgcatattggacagtagccaggcttggatggatcgccgacaaaaagaaaagact
+ttccctgtaaggacttaactattacatataacttggatcattaatctgcaaattagagta
+acggtctttcaccagcttcatattccaacgtggcgctagtcgatatcccatgaagtttaa
+aactagaattggcagtctcacttcacagtgcgtatctatacgacaaaagtggtcgatttg
+cataaatatcttatcgatattcaggttattaccgattccttgctaacgctagaagtcaca
+ccagagtaataataattccagacacctgtgaaataatcggtcactacggatagactagta
+acgataatacgtatagtccataaaagttgaattttaggggctaaagatattagcaatact
+ggtctagcctaatcgtcgatagcaaagggctgtgaggatttctcctacattttcgaccaa
+ttgtatcgataggaatagttacagtcacgcttgtagatgtaagagatgacgttattctta
+gggttcttaagtcggggggtaatttaagaccactagtaaaggtagaggcgtacacagtaa
+acgatattttgaaatcgtcaaaaaaaagtttacaacatcctttaagttagcaactgattt
+tagtggcaaccttaacggttgaattgatctactaatacaggcctacaccgaagggtacag
+ataatgattcttactaccctaacatgatagagtcctgtcctatctcataggtcgacattt
+taaattcgtaatgagcaacgaagatcgtttcccaatttgcaacattcacttatagacttc
+aggttatttcgtgctaacattaagatagaatataatcagtcgttaagaaactattatcca
+gctttcgtcaaccataaagattaaaaactgaaacttggcaagatatgaatagctatcctg
+ctttaaccgatcgtatgagatgctttgtagcaagaaaagtgactagcacttgtgtttagt
+aaagcgggagagtgcggtaattaatattaatatactattaagctacacagcaaaggctgc
+aataatgttagtaagtagaacataaaggtattctccacaagtaataaatagtgtgagcta
+attgactaacttaactctcgcgacaagtgatgtggataagatgactcatatcgtcttttt
+ctgtagtgccgacatcccacctggatcgaacaattccttctagttatcgactttgattac
+ctatcctattaaacagatagggttgtaaagtcagaaaatgatcggcttgcgttggtctac
+catagctagagttagaacgcgtagatagaggccttttgttgccaacgtgggggtgggatg
+agtctgggcgagcgtgactttctttcgtgtccgaatttgtttaacatccattagattaga
+tgtttgtgttttgggtctgatgtcctaactactttctcagtgaaactaatgtcatcatcc
+aagtaaaatagtccgatgaagtctccgttttcggccgaagcttgtctataacgtatataa
+agtcgctgaatttagaacacaccttatctatgttgtaaagttactttattccaaaggacg
+tgcacgaagcgtgagtgtgggaaggaacttaaagtcggatcactcttgtcagtgtagata
+agaatttctttcatacttcactggaatccggcgtatggatatctctaccgcgtcatctgg
+tggtgtctgcggtaaaaagtcttgctgcacgagtctgagaaatttttggtgccatcacat
+cgtaactgtacaacgaacaaatagcatcaggccttcttatccagcgtgaagtctaattat
+ttcacaagctttcctaagtatgtaaatccctcacttaatgatgcttgcgccaatgaggat
+agaggacattgcatgtacgtaggactattctccaaggggtcttctattttgttagcgaaa
+attgttacagcctaatgttagagcggcgtacgactttataccagatactttcattagata
+tgcaaatatccaattaaatcatagtagtatcgtggtatggacaatcaaaaaagacccgtt
+gtgatatgatgtttttctagttcgttctcatatatatagatcaacaatgaataatctcat
+gatctataaccgatgtatatttatattccggttgactgctccggtgcaattcactacgga
+cactaatgactaatatggcgcctttcatcagaaacgctaaatatgattaatgaattaagg
+gagtattatctaattattagagagtagcagttagtctgatattttcggtgtatgtgttag
+ccgttataatgctgtctttttatcagtgagaacagggagtgtgtagtgttgtatgcttca
+ctttatgactctggttatatccctcggagaacaagaataagagtacgagaagttcggtca
+ttgaggatgaaatagaaccgctagacgaatggactcacgtttataaaactatgtatcaca
+gtactacagctaactctgaagtccgagaagcttttgtaggacaaaacgttataagtacct
+ttcgcagaatacggccgtgcatacctgttataaggcgtagtagggacaccatgctatccc
+tcatatagagctacactaataccattacatggtgactatcgtttacggccatcatctgta
+agcgatcatgcctcgttagcatccgtacaatctcgcatggcgtcactgcagaaaaacccc
+gtgcggattttgagtcagaactattcgaagcttctcaatccttttccattatggcatagc
+aagtgacgactcgtcagccatgggaataatagcactaatccgattacttatgaattagaa
+cccacatgaatgtgattctgcgaattgtctaagaatctaatgattttccggtgaatatgg
+ttgttgttatttattgaacttatattattaacatcacccttcgttagtgatagtcagcta
+tttccaagaggttccccgagcatttttaccattctctagtcatacaagttggagcgcttt
+taaatctttaggctgatcaaggcgttttgtctagaattctgcagatgttagattcgtgtg
+caatccctcttgcatgtcagtaacaggtcacccgtttttcgttacatatgctggtaaaat
+attcatagtaataactacaatacttgatttgttacgtaatgctcgtacataacacaatcg
+tattccacggaacagtaaagctctattattctgatcgagcctaagagaggatcacactac
+gctattaaagtcacgttcacgaaatctcaaacctcaactgctggtgaccagttatagaca
+gtgtaattccatattacatgtcaggcttaagctaacccgagcctttatataagctataat
+caagaattagattggagtgcattttagacttatctatcgaaatagtgatagtaagagttt
+atatgacctgatctagactgatgttctcttccacaacagccttaaggcgtggagcctttc
+ttatactattaggtcgcgtcgagagccctattcgtaatgttaacgacactagactaatat
+acaatgagctaagaataacacaagtcacaagataatttacaaatcatatatctacagtcc
+acaaccatcactagcgattgcaaagcgttattggtactaccgctctaaatcggtatgtgc
+aagacgcgttaactggttcaagcctctcctgctcgtgagactgaaagaaatcgaaaatat
+ggatgtgcctaattgttcttgtgagtcatgtgcaactatacagtttagtttggtcaagac
+tatgcaactattaacagcatgtgcgcattgaatatttggtgtcgattgataaatgcccca
+acgttccatcacgtctataagccgtgttactaatgtgtattagtgcatacctattcagac
+catagttcaactgttggactgaaggcccgtcttggggttcgtgaatgagagtgcagtttc
+ttgtcttttccttaactgacctaaatgaaggcaatcggtttatctagagtcatgcttaag
+gtgaatttcagccaatgggctcccattgagctagtatggtgctttacctttgtaagtggt
+ggctttccttggtgtgctgactttaacacggcagagtgattatccgaagaatggataata
+agacgctggcaatattggctaataaagtccgatgagtttcaatcatgactgcgaggagat
+ccatgcggtgtacctaaacctacatcgtatgtatttgctgacgttcattcttgatacata
+aagatccgatatcggtccactttgtttaccaaaagccctaccttcgtaacgatggaaatg
+tgaatgagagtgaaatacacgatggggatattgccggtgagtacaagttagaccacacat
+tagaactgacctatattcgtcatcatagagatggagtatgaattgattctgcgaagtaca
+ctggctttacgagtatctagacgccgcggtatatctcccgtcaatactatgaaggtatat
+atatagaggctgaaaattcatgttcaatcctctttctaagagtgagtgggagccccttct
+gttgtcggagtaaaaaggcattattcctcaaattgtcagaagcaaagtatacgtgatgtt
+tgcttagaacaaaagagttaccttagggtaggtaaatctcgattcaccgagagaagtgat
+tttggcggtgtgcgattaattcttttgatgacagatctcattattttatatagctccctc
+tttgtatttagagtttgcgtaggtaacctggcaaaaccatatcccggggggagagtgcgc
+tgaacattttatacgatgtgattactcaaaggataaggttcgaggcctctatactcatgg
+aactatcttataattataatggatcgtggctcattccacctatccaaacttctttgtgat
+ctgatgctacgagtgtgaacaaacgtacatcttctaaggaatttgggacgtttcatagct
+cgcatttcattcctgaaaacttaaatatttttaaaaattgattctactgcgaggaactaa
+ggtgtagacaagcccttagtaaccggtggatgtcgcttcagttttatagcaaacattatt
+caatttcagtcttgactgaaattagtttgttagtgttagaggtccatatgtcacatgcat
+atggtctagatgccattgtacagtaataccttagattagtattagcggcatgcgtacttg
+gatttcacttgtaagaatgagcttaggacggtcgcctgtagggctgcaaataggaatact
+tacaatttttgatgacttgttagcatatcgctatcacccataaaaaacctgatacttgat
+gagcgggtgattgagactatgtactgatataattcaatagctccaatagatgaaacagct
+atgcgcctatttatgtcaaataatcgatgtgatacaagcttagagctgaacgagcgcgag
+tggaattagcggtgatctctatcctaaaaagccacgaaatcgatcccagaagctaatacc
+cgaggtgtcaagcttgagttcagttaaatttgcatctcatgccccacgaagaatgggtag
+agagtttgaaggtgcttctggattttcctaagtacgtggtaaaaatttgatgtaaatgaa
+cacctcctaatggttgtgttaaccacaaacccctgggtgaatctgattagccaacccagt
+gatctgatttcagttgtcaaatctcttttttataactaccttttgtttccataatttaac
+cggatctcataatgaacaaacgggtagaataatggtagcacatagcgagcttgtctattc
+agaaatatggcctactcagaatgtattctccaaatcagtgttatgcgaaacgtaatttta
+cgtgtaataatgatgatttcttatcggttccttgtactacaatactcttgcccaacaaat
+actaagcataacagcaaaattcgaatccccctccttttaataaatggtttttcaatatag
+ccgattcgtattcgttagtctttcaccaactattaacctggcatctaattaataaaatca
+ccaaaggactctataatatgacagtcacttcggcctcttttaagacagttgattattgca
+ggtccgcaattgatggtgacatgcacaattagttagaatccgactatggagacaattaac
+aattgtagtgcccatttggtccagttgacttcaaccacgagttataaaggtattttaatt
+tatagtcgatagtaccaacaacaagcacaatcataattatgttagaaaacccagggggta
+atgctctaaatccagctttaaggccagagtgcactatgaaatcgccattgatcattgtgt
+cattcgctgaacttggtgtctaggaggtgccgagtgagaatatcagataccttatgaagc
+aacgattatatctggactagatcatgatgatcggaataaaacattgaaataagtccttat
+caaggagcataaacattttatttaatttatacttcgtaaataaattcagaattttttttc
+aagacattaatctgagtaaatgacggctagaaagggttcctactcgaatcgtagcctacg
+catgtgggcagtaacctggcttgcgtttttactgaaacaaaggttcaccggaaagaaggc
+tgccacttttagcttcttgacgatctttagcgtcatatttttagattagtcgaaaaacgg
+aaaacaaacttaacgaagctggttgcacggggtaccgagaaaccaaagagcaggacaact
+ccttgatcgggaagaactgaaatagacagctgtcattttcattggtcaacttatcaatat
+aacgaccaccgtagtgacgcttgcatgaaaatactgaggatgtaaactatagccagtcag
+gcccgcgtgttgactaattgatgaagcaaacaaaatagccggtattcgttaaaaggaacg
+ggttgccagctacagatatactctaggtatatcccaaacaagagacgtcctttggctgtt
+gtaatcggtcataatacttgtcacataaacaagatcgctgaattaaacattaaacagtta
+gtgatacacaatcgtggttggggctgggatgtgcaataaaaagtcatctatcgtctatca
+cagagcgacgtaaatttagacaaacattattatttcttgacaatggaatcgataagcgtt
+cctctaacttggtatatatatctcgaccccgggattccagccattcttgtatgaagattt
+aaccatttaactatgcatagttgaatggtaaggaaaatgatattgactgcaacagatttt
+ggatgcaaaaatatttgtgaattattggttatatactggttgtatagcacaatcattagg
+tcctagaaggcatactcaacctcagcgagagagctagcatgcataattgtaccgcccata
+ttaatattcctgaaatgatttcttacattacgcccaatttcagtcatcgaacacccccat
+caatttacccgatagagaacgtgatcatacgcaataccctatgcgaacgtccactctata
+gcgtctgtatacaatgattattcgttccatttacaacgttaagtaatttaaacttacata
+aggacaaggaaatccgcgaacctcctggaatgtatgagttatttatgcagttaacttcgt
+ctcgaccggaactaaaggcgtcgtacgaatgaaaggccacttttagaagagacctttgta
+tccattgtggagaatatcataaattcaagatggggtgtcatgctattcggtcctaaacat
+tcttaatggctgttctattgttagtctgatttaaaatggaaccatagcacgaatagttag
+atagggctcatacccctgtaacgatctacaaatccttccccgggtgtgtgcgttagcgac
+ggaaagttttacggtttgtgatcaaagaacactcacacgtcagattattacactgatacg
+aattatttcagtcgacagtaattgaatagaaacttattaacgccagcacctgacacggta
+agtaaggcaggtctgaactgtttgactgtaaaaaaatggtaatatttttaaaaatcttga
+tttctatatcaaatgatgtgtagttttttctctgttattaaaatcccagtgcgcgaaatt
+tagatcgttacgactcacgtacaagatcacacatcacacgcgttagcgaaagcggaatgg
+ctaatacagccctacgcaacgtagtgggatcaacatatggacgaatttatgctcaatgag
+ccaacctcccccgcattgcggttcattttaaggcctgggtaacatctatcgtttagataa
+tcaaaggaatccgactatgcaattgtctgacttcatccgctctcaagtccaatgcaggcg
+ctacgtgtttctttaatcaataccatattgaaatcgtaatacgataattgttgctattga
+ctacaggttatgaaaaaacttactttgcgggtacatgcatatttttgtaccacattatta
+cgcgatatctctcagtgtactctaaattaaaccctcttcgaacattttagttcctattcg
+taaacacgtgctacgcggcaatttgccggtcgtagaatggacaactccagttcaactgca
+tgtaactcatagctcgcgttagtataaattgactagtagccatgggacaaagtaactagt
+cagcggaaaagatccctttaaagatatatgcaggttgcaagcataaagctcattgctcga
+ggtgcaccgtggtattccaaaagcgtctctatcgtatcttctaattttgggccgtgagaa
+tcgaaactactctgatttgctgcacacgttaggtaatatcgcccattttcccgtataagc
+tccgtacttatacgaactacacgaccttttaagcattagccgctcatatcgtgattcgtg
+tacagatgagtctattaaaattacagacatactccatatctcgctccttgaactttgaat
+aatgcgctaacttgtactatgaataggcagaacccaactttcccgtttgcgtcaagcggg
+gaaacgatacatgttgtcagatttatgattatctagttttagatcacgtttaccgataat
+cggctgtggtctgagcagtcctacactgagtatttacttcagcttcatatcggtccgaaa
+aaaggttgtgaccgaatgtcaaaatacggagtacgatgggcatcttttttcgagtcgcgg
+ttgcagggcagcaaaaggcttaaaccatttttacgatttttactatagcggtcatgaagt
+gcgaaactgcttgcaaattttctacacacattgtggctcttgtccttgaagcttatggcg
+aaaatttgaaacatagtataccagggaaagcgcgaattatttggtgactaatagtccgtg
+ggtttgagccatatacctaacgccataaactacgtggtgctttagatgcaatctaaacag
+aacagaaagcgtagcgctcatcagcacagactaactttttcagtttgagtcgccggaggg
+acttcgagacaagaacgcgtcaagtcgcttgcgcggcacggattcgattgggcggctcaa
+tcttgcctaatttctactattgtcagctgtacgactgtactaagtgtatagccccaaata
+aaagaagtatcgatgcgtctttatgaccaaaggtcttataattgaagcgcacttccgttc
+atcaaattaaatcctggcttacccgattctccggaagtctgacctagagattgacgacgg
+ccgcgtattattgagacctcttcaggattaatcaataacgaagtagttgatctgtttggc
+gacgtaccttaagccgactccgctacacgagtttctactaaaccaatgtagccttatgct
+tagatgaataccgtcctaattagatattccggcataacagcagtaaattatctgttcaat
+ggacgaacattgaattgttagtattctacacaagtcaggcctcgtaaatattaggtaagg
+ccgtgggataacctacgtgatatgcttgagcttgcgttgcaagctctcgttaatcattaa
+tttaggtgcgtgagggttaaacaccagcatattctatatgctagacgtcttccttaaagg
+atcgtagtattataattaataataagaaatatggttgacgtctagtcagcgggcatacgc
+tgctctatatactggcattattcaaaacttgacggtaaaaaaacgaattttaaggcgctc
+acgtcgaatgagccgaactcatgggaaccaaaatgtcacagaaaacacctctttattgcc
+aagcatgcaataaaaaaaatgttaatagtacgtttacgacattttattttataataaaga
+gaaactattacacctattgatatgataggacgtaaattaacgagtagcctgcatagaggc
+aaatgaggtttctacatggtatagacctgatgctgaaacatcgatgagttttggtcccct
+cgctcgttgaaatctagtcatttactactgtctttcgagctattataccacttcactatg
+tggtgtttctttgctatgtatggggctagtcaaacatgatgactatagctacaactcaga
+gagcgggcgtgttaagagtatctcatgctagaactgcacgacgaacttgatacaaagtaa
+caacatttacgattccacaaggtgactttgaagaaacatagtttaattctctgcttcgat
+catttctataaaccggtaccatcgcagcggatagatgcataacatttctactactccagg
+catcttaaaacacacgtagtacttcactagattaagacacgataagtgtataacttggca
+gtgggaagcaaggagattggcgaactcctggcatctgttacgttttgttcaggctcggtt
+gttgataatgtccgactcctgccatattgaagactcgctcgagggagatcgggattcgtt
+gattataagtacacgtgttccgtaatactatgaggcagtgattcaaaatggcacttctga
+cttacatgactaggtattattaccacggaagcgttaaaggcacactcttatggacttaag
+attgcaagtgccttcttctagcctgaattcgcgggttcaacacaaactctctttagacat
+ccgttgcctaaaggctgagacgtaggggcaaccctttaactatgtactaaaaaactagtt
+ggtaatttaacaacgtgtccaatcaagacgatgcaccaacgcggtgcgaaaatcgggtta
+agcaaacacaaataggaattgtgataaaccccaccttgagaggtcgcaagaccaacctcg
+ggaacaacggctctaagagaataacctaaatccggatgagtagactgtgtaactctctaa
+agggaagtgaaaaaaagctaagcatacatttaggtctcctgcattgcattcaattgaatc
+gtttgtattatgagctgtacagtagctatatcagctatagttatcccagaggaacaggta
+aactagctctgagcgtgaaatccggatattagaacccctagatgggattgattctagcta
+atacaggcttatctggttttacagttatctagatgattggtaaggtgaaacgcttggtgc
+cttccaccacttaaacaaaagtattgcccgggaagctattttctaggtattataaagtcg
+agcattaatatcaatttgacagtaaaggtctttcaccagcttcatatgccatagggccca
+tactcgatttaaattgaacggtttaacgagtattggaactctcacttataactgagtagc
+tatacgaaaaatctggtccatttccagaaatttattatcgatttgctgcttagtacccag
+gaagtgataacccttgaaggcacaacactgtaataagttttcctgtcacatctgtaatat
+tcggtcactacgcattcacgactaaagataattactatactaattaaaagttcaatgtta
+gggccgaatcatagtagaaattctcgtctagcctaatcggacttacctatgggctgtgag
+gatttatcagtatgtggacaaaaatgctagagataggtatagttaaagtcaccatggtac
+atctatgtgaggaagtttgtagttcgcttctttagtccgggcgtttgggatgacaactac
+tatacgtagagccgtactcaggattagatagtgtgaaagagtcaaataaaagggttaata
+ttaatttaacgttgcaaatgtgtttaggccaaacattaaccgttgtagggatattctaat
+acaggccttcaccgaaccctaatgataatctgtcttaataacattaaatgattgtctccg
+ctacgagctcttagggcctcattttaaatgactaatgtccaaagaagagactttcccaat
+ttcaatctgtcacgtatagacggcaccttagtgagtcatatcattaagatagaagattat
+caggagggaagtttctattatcaaccgttacgcaaccataaacttttaaatctcataatg
+gcattgagatcaagagctttcatgatggtaaagttcgtatgtgatgctggggagctagat
+atcggtataccacttcggttgtggtaagcccgagtgggccgttagtaatattaatagacg
+attatccgacaatgcattcgctgaaataatcttacttaggagaaattaatgctatgagcc
+aaaactatttatgtctgtcacattattgactaaagtatctatcgacaaaactgatgtcca
+taagttgtagcagatagtcggtgtatggtgtcaccaatgaaaacctcgagcgaaaaatga
+attatagttatccaatttgagtaaattgcctattatacagataggcttgtttagtcagat
+aaggttccgcttgaggtgctctaacttagcgagagttagaaagcctagtgagaggcattt
+tggtgccaaactccggctcgcatgagtaggccagagagtcactttctttcgtcgaagaag
+ttggtgaacagccttttgattagttgtttgtcttgtggctatgtgctactatataagtta
+gaacgcaaactaatctaatcagcaaagtaaaataggaccttgaacgagacggggtacgcc
+gttgaggctcgagatagtagataaactagaggaatgtagataaaacattagctagggggt
+ttagttactggattacataggaagtgcaccatcacggtgtgggggttcgtacgtaaagtc
+gcatcaatattgtcagtggacttaacaagttcgtgcataatgaaatcctatacggacttt
+gcatatctctaccgactcatctggtcgtctatgcgggtaattgtattgctccaagtggat
+gactattttggcgtcccagcacatagtaaatgtaaatccttataatagcataagcaatta
+ttagactgcgtgaagtcttagtagttctcaagctttacgttgtatgtaaataactcacgt
+aatcagccgtccccaaatcaccattgaggtcattgaatgtacggagcactattatcaatg
+cggtatgcgattttctgagcgattattgttaaagacttagcgttgagccccggaacactt
+gattacagattctttaaggagttatccaaatatcattttaaataatagtagtatcgtgct
+ttggacaataaaaaaagacccgttctcttatgttgttttgcgacgtacttctctgatata
+tacttcaactatgaagattctattcatcgataacccaggtatatttatatgcccgttcac
+tgcgcagggcaaattatctacggacaataatgacgtagttggacccggtaagaactaacg
+cttaatatgattaaggatgtatgccagtattatcttattatgtcagagtagaagtttctc
+tgagattttccgtcgttgtggtacaccggatttggctctctttttagaactgagaactcg
+gagtgtgtagtcttgtttccttcaatttatcaatatgcttttataccgccctcatcaact
+ataacaggacgacaagttccgtcttgctccatcatatactaccgatacaccaatcgtatc
+aagtttagtatacttgctttctctcttctacagcttactcgcttgtccgagaagcggttg
+gtgctcataaagttagtagtaaatgtacaactagtagccagtccttacctgtttttacga
+ctactacggacaccatgagatacagaagttagtgctacaattataccattacatgctcaa
+tatcgttgtcggccataagatcgaagagtgcatcacgcgtgtgaatacgtaaaatctacc
+atcccgtcaatgcacaaaaacacactccccttgttgactaacatcttttacaagaggcta
+aatcattgtccaggatcgaataccttgtgtacaatcgtcacccatcggaagaataccact
+tttccgatgtagtatgatttacaaaaaacatctatgtgagtaggccaattgtagtagaat
+atattcatttgaccgtcattagccttcttcttaggttgtgtacggatagtaggtacataa
+accgtcgtgtggcatacgctgcgatttcatacagctgccaacaccttttttaccaggcta
+gagtcagaaaagttggagccatgttaaatagttaccatcataaaccactgttgtctacta
+gtctgatcagctttcatgcctgtgcaagcaatatggattctcacgtaatggtaacaactg
+ttgcgttacttaggctggttaatttgtcagagtaataaatacatgtcttgttgtgtttcc
+taatcctcggaaagtacacaagcctaggaataggaaaagtaaagctcttttattctgata
+gtgactaactcaggatctaaatacgcgattatactaaccttcaccaaagctcaaaaatca
+tctgctggtgaccagttatagacagggtaattcaatatttaatgtctcccttaacatttc
+accagcatggattgaagatagtataaagttttacatggcagtcattgtgtcacggttcta
+tacaaattctgatagttagacggtatttgaaatgtgcttctagcatggtatcttacacaa
+ctgaatgaacgactggagccgttcgtatactatttgcgagcctcgagaccccgtttccta
+atgttaacgaatatagtataatataaattgtgatatgaataacacaagtaactacagttt
+ggacaattaattgttctaaactaaaaatcattcacttcagatggcatagagttatggcta
+ctacacatataaagcggtatgtgaaacacccgttttagccggaaaccctctactgctcgg
+gacaatgaatgatttccaaaatatggatgtgcagaattgttagtgtgactcaggtccaaa
+tagacactttagtttcgtcaagtcgttgcaaagtttaaaaccatcgcagcattctttatt
+tggtctacattgagaaatgaaaaaacgtgacagaaagtctagaagaactgtgaataatgt
+ctattactgattaactagtaagacattagtgcatctggtccactgaagcacccgcttggc
+gttaggcaatctctgtgaactgtcgtggctgttccggtaatgtacgaaagcaagcctata
+ggttgatcgagtcgcttcattaaggtcaatttcacaatatccgatcacattgtgctaggt
+tcgtcctttaccttgcttagtgctgcatgtacggggtgtcatgacttgttatcggcagac
+tctttatcccaagaatggataatatgtacatggaaagtgtccataattaagtcccttcac
+tgtaaagaatgactgccacgtgatccatgaggtctacagaaaccgacttacttgcttttt
+gatcaacttaattatggattcataaagttcagatatcggtacaattggtgtacaatatga
+aattaatgaggaaacatggaaatctgaatgacagtgatagaaaagatccccatttgcccg
+gtcagttcatgttacaccactcattagtactgtaagtgtttcgtcagcattgagatccac
+gatcatgtgtttatgccttcgaaactggatgtacgacgatcgagacgaagaggtatatat
+aacctaaatactaggtacgttgttagagagacgatgaaaattaatcgtcaatacgctggc
+gaacactgagggggacccaatgctcttctcggtctaaaaaggaatgtgtcagaaattggt
+cagttcaaaagtagaccggatctttgcggagaacaattcacggaacgtagcgttgggaaa
+tatcctttctaccacacatcggattttcgccctctcccattatttattgtgttctcacat
+agaattattgtttagacatccctcgttgtatggagagttgcccgagcgtaaaggcataat
+ccatataccgccgggtgagtgacctgaaattgtttttagttgggatttcgctatggatta
+gcttacacgaagagattctaatggtactataggataattataatgctgcgtggcgcagta
+caccgttacaaacgtcgttcgcatatgtggctaacacggtgaaaatacctacatcgtatt
+tgcaatttcggtcgtttcatagagcgcattgaattactcaaaaattatatatgttgatta
+tttgattagactgcgtggaaagaaggggtactcaagccatttgtaaaagctgcatctcgc
+ttaagtttgagagcttacattagtctatttcagtcttctaggaaatgtctgtgtgagtgg
+ttgtcgtccataggtcactggcatatgcgattcatgacatgctaaactaagaaagtagat
+tactattaccggcatgcctaatgcgattgcactgctatgaaggtgcggacgtcgcgccca
+tgtagccctgataataccaatacttacatttggtcagcaattctgacattatacctagca
+cccataaatttactcagacttgaggacaggctcttggagtcgatcttctgtttgtatgca
+tgtgatcatatagatgaataagcgatgcgactagttagggcatagtatagatctgtgtat
+acagttcagctgaacgtccgcgagtggaagtacagctgagatctatcctaaaatgcaacc
+atatcgttcacacatgatatgaacccagggggaaacattgagttcagttaaattggcagc
+gaatcccccaagaagaaggcggagtgacgttgaacgggcttatggtttttcagtacttcc
+tccgtataagttgagcgaaatgtaaacagaataatcgttgtgttaacaacattaaaatcg
+cggaatatgatgagaatacacagtgtgagcatttcacttgtaaaatatctttggtagaac
+ttactttgctttaaatatgttaaaccgatctaataatctacaaaacggtagattttgcct
+agcacattgcgtccttctctattcagatagaggcaatactcagaaggttttatccaaagc
+actgtgttgactaacctaagttttagtctaataatcatgattgattataggtgccgtgga
+ctacatgactcgtccacaaataatacttagcagatcagcaattggccaagcacccgactt
+ttatttaatggttgtgcaatagtccagattcgtattcgggactctttcaaataatagttt
+cctggcatctaagtaagaaaagctcataaggaagcgatattatgacacgctcttccgccg
+ctgttttgaaacttgagtattgctcgtccgaaattgagggtcacttcaaaatttactgag
+aagacgaagatcgactaaagttaaaatgctagtccacagttggtcaagttgaattcatcc
+acgagttatatagctattttaatttatagtcgagtgtacaaaaaacatccacaataagat
+ttatcttagaataacaacccccgtatcatcgaaatcctccgttatggcctgactcctcga
+gcttatagcatttgtgctggcgctcttgccaggaacttgctcgcgaggtggtgacgagtg
+agatgatcagtttcattatgatgatacgattttatcgcgactagttaatcatcatagcaa
+gtaaaatttgaattatgtcattatcatgctccattaacaggttatttaattgatactgac
+gaaattttttcacaatgggttttctagaatttaatatcagtaattgaagccttcataggg
+gtcctactagtatcctacacgacgcaggtccgcagtatcctggagggacgtgttactgat
+taaaagggtcaaaggaatgaaggctcacaatgttacctgcttcaccatagtgagccgatg
+agttttacattagtactaaatcccaaatcatactttacgatgaggcttgctagcgctaaa
+gagaatacatacaccaccacatagaattgttagcgatgatatcaaatagactcctggaag
+tgtcagggggaaactgttcaatatttcgtccacaggactgaccaggcatggaaaagactg
+acgttggaaactataccatctcacgcccgacgcttcactaattgatgatccaaaaaatat
+agcccggattcctgattagcaaagggttcacagagaaagatattatcgacgtatatccca
+aaaaacagacgtaatgtgcatcttcgaatcgggatgaatacttgtatcataaaaatgtga
+cctctagtatacaggttaatgttagtgatacacaatactcgtgggccatgggttctcaaa
+taaaatgtaatattgcgtcgatcactcacccacgtatttggtctaattatgttttattta
+gtgacaatccaatagataaccggtcctattaagggctatatttttagcgaccacgcgttt
+aaacaaaggattgtatgtagatggtaccagtttaattgccagtgggcaatcctaagcaaa
+atgagattctatcctaaagtttgggcttgatataagatttcggatgtatgggttttataa
+tcgttggagagctcaatcatgagctaatacatggatttcgctacctcaccgagagacctt
+gcatgaagaattctaaccaaaagtttaataggccggattggattgagttaattaagacct
+tgttcagtcatagtaaaaacccttaaattttaccgattgacaaagtgagcagtcgcaata
+ccctatgcgaaacgcctcgatagtgactaggtatacaaggtttttgagttcctttgaaat
+agttaactaatttaaaattaattaacgacatggaaatcacagaacctaatgctttgtagg
+agttatttatgctgtttactgcctctacaaccctaataaagcagtcctaagaatgaaacg
+catcttttagttcagaaagtggtatccagggtggtcaatttaataaattcaacatcgggt
+ctcaggatattcggtcatataatttattaagggctcttcgagtcttactctgagtgaaat
+tggaaacagtcatccttttcgttgtgaggcatcttacaccgctatcgatatacaatgcat
+tccaccgcggtgtcccgtacacaaggaaacttgttaccttggggatataagaaaactcac
+acgtctcattattaaactgagtacaatttttgcacgagaaagtaatgcaatacaatatga
+tgaaagccagctaatgaaaagggatggaacgcacctcggatctgttgcactggattaaaa
+tccgattatttttaaaaatattcagtgctagagcatatcaggtctacttttttatctggt
+atgtaaagcccacggagcgatagtgagatccttacgactcaacgaaaagttataacataa
+ctcccgttagccaaagcccaatcccgattactgccctaccctaacgtctgccatctaaat
+atcgaacttgttatgatcaatgtgactacctcccaccctttccccttcatttgttccact
+ggggataagctagcgttttcagaatcaatgcaataagaatagccaattgtctcacttcat
+cagagctcttggcaattccaggcgctacgtggttctggaatatattcatttttcaaatag
+taatacgtttagtgttgctattgtctacacgtttggatattacgttatgtgagcggacat
+caatagttgtctaactctttagtaagccagagatagcactcttagcgaatggataccatc
+ttccataagtttagttaatagtccgaaacaactgcttcgagcatatttgaacctccttgt
+aggcaaatagcctcttcaaagcaatcttactaatagatagagtttgttttaagggactac
+tagaaatgggacaatcttaatagtatgacctaaactgacatttaaagatatatccaggtg
+gcaagcataaagatcattgcgccacctccaccgtgggattacttatcagtcgatatccta
+tatgctaagtttgcgacggcagaatacaaactaagctgagttgatgctaaccttacctat
+gataccccattggaccggttaacagccctacttattccaaataaaagaacttttatgctg
+tagaagctattatagtgatgcctggtaacttcagtatattaaaatgacacacatacgcca
+tatagagctcctggaactttgaataatgagcgaacttcgaagttgaagagcaagaaacca
+tatgtcacggttgcctaaagcccggtaaccagacatgtgctatcattgatcattatcgag
+gttttcataaccttgacccattatcggctgtgcgcggacaagtacttaaatcactagttt
+cttcacctgcttatcggtaagaaataaggttggcaaagaatcgcataagacggacgtaga
+gccgcagcgttgtgcgagtccaggtgcatgcgcagcaataggattttaaattttgttcca
+tttttaatttagccgtaaggatgtccgtaaatgattgaaaattggattcaatctttgggc
+ctatgctactggaacctgatcgacaaaatttcaaacatacgttaactccgaaagaccgta
+tttttgcggctagaatagtcagtcgcttggagccatataccttaccacttaaacgacgtg
+ctcctgtagttgaaatataaacagaacacaaagactaccgatcatatcaactgaagatct
+ttgtaactttgaggcgaagcaccctcttcgagacaactaagagtaaagtaccgggcgccg
+caaggagtcgattgggaccctaaatcttgacgaattgctaagaggctcagagctaccact
+gtaatttctctagagcccataataaatgaacgatacatccgtaggtagcacctaagggat
+tataatggaagccaaatgcagttaataatattatatactggcgtacacgattcgacggat
+ctctcacatagtgattcacgacccccccctttgattgacacagcgtcagcattttgcaag
+aacgatcttctgcatagggtgcgccaccgtaaggatgacgtcgaagctacaactgggtat
+aatttaccatgcttccctgatgctgagtgcaatacactaagaatgagtttttaccccata
+tcaccagtatttgttctgttattgcgaagaaatggctatgctgagttggcgactaaagtc
+acccatcctttttattaggtaaccccctcccttaaactaactgatttgctggagctgccc
+tgcatacatatactttatcatttatggacgtccgtgacgcttattatccaccatagtcga
+tatgctacacggattcattaatggatcgtaggagtttaagttatatttactaagatcggt
+ctcggctactatcccgccttacccggcgctatttacggccatttttaatatattgacggt
+aattattcctatggtttcgaccgcacgtccttggacaagaaagaatggcaaaaaaaatgt
+aaaagaaaaaaaatattgagtccctaccatcatataaaaaatatgtgatgagtaacttga
+cgaaatgttagtggttattaaagactatctattacaccttttgttttctgtcgtagtata
+ttaaagtctagaagccttacaggaaaatcagggttatacagccgatactccgcagcatga
+atcatcgaggaggtgtcctaccatcgcgccttgtaatcttgtctgtgtatactgtattta
+gaccttttatacaaagtaaatatctcggctttatgtgattgggaggggcctactcaaaca
+tgatgacttgacctaataatcactgtgcgggcgtcttatgactagctattccttgaaatc
+caccaccaaatggttaatatgtaaaaactttgacgatgaaacaaggtgaatgtgtagtta
+ctttgtgtaattagctgcgtcgagcattgcttgtaaaaccgtcaatcgcacacgttactt
+ccataaaatttctacgaatacacccttcttaaaaaaaacgtaggaattcacgagtttaac
+aaacgataactgtataaagtggaagtccgaagaaagcagatgcccgaactactcgaagat
+gtttcgttttcttaaccataggggcttcttaatggcccactacgcacattttgttcaagc
+ccgagagggacatccccattacgggagtattactaaaactgttccgtaatacgttcagca
+agggatgaaaaaggccactgctcaagttattgacgtgggagtattacatcggaagcctga
+atcccacactatgatggtctgtacaggcctagggactgcgtctagacggtattaccggct
+tctaatcatacgatcgtgagtcttaacgggaagtaaggctcacacctaccccaaaccatt
+tatctatgtaagtataaaattgtgcgtaagtgttcaaagtggacaataaagacgtggcaa
+aaacccccgcacataagccgctttagatttcacaaataccaatgcggttaaaaacatcct
+tgagtcgtacatacaccatactcgcgttaaacggatataacagaagataataaatccgga
+tgtggagtcggtgtaactatagaaagccaagtgaaataatgcttaccagtcatttagcta
+tacggctttcatttcatgtcaagagggtggagtttgacctgtacagttgatatatcaccg
+atacttagaactcacctaaagctaaaattgctcgcagcgtgtaatccgcatattacaaac
+aatagatgggattcattatacataagacacgatgatctgctttttcaggttgcgagatgt
+tgcctatcgtcaatcgagtcctgccttacaccacttaaacaaaagtattgacagggaacc
+tattttcgaggtattatatagtccagcttgaatatcaatttgacagttaacctagtgaaa
+atcagtaagaggaaatacgccacattctccagtgaaattctacgggttatcgtctagtcc
+aactatcaattataactcacgagatataagtaaattctcgtacttggcctgatttttatt
+atactttggatccttagtaaacaggaagggagaaaccttcaacgaaaaacactggatttt
+gttttactctcaaagctcttatatgacggaaataccctgtcaagtcttaactttattact
+agactaatgaaatgggcttggggtggccagaatcatagtacaatttagcggatacactat
+tcggactttcctatcggctgtctggttggataagtatggggactaataggctagacatac
+ctatacttaaactatacaggcgtcatctatctctgcaactttggagttccctgatgttct
+cccgccctttgggttcacatcttctataccgacacccctaataacgattagtttgtgggt
+tagagtaaattaatacggttaatattaatgtatcgttgaaaagctggtgtcgccaataag
+gtaaccggctaggcagagtatatgtcacgaagtataactaccctaatgataagctgtagg
+aataaaattaatgctgtctctaagcgaagagatatttccgactctgttttaatgacgaat
+ctcattacttctgacttgcaaatgttcaatatggcacggtttcacggcacctttgtgacg
+catataatgaacttagaagattataacgacggaactttatatgataatccgttacgatta
+aagaatctgttaaatatcataatggcattcagttctagaccgtgcatcatggtaaactta
+ctttctctgcatggcgacatacatttcgctattcaaattcgcgtgtggttacacccactc
+gcacctttggaatattaagagaagatgatcagaaaatccattcgctcaatttttctgacg
+tacgtctaatttatcctaggagacaaatcgttttatgtctctcacatttttgaagaaagg
+ttcgagagacaatactcaggtcctgaactgctagaagatactcggtggagcgtggcaaca
+atgaaaaactcgtgacataaatgaatgatacttttccaagttcagttaagtgaatatgtt
+taacatacccggcttttcgatcttaagctgacgctggacgtgcgagtaatgtcagtctct
+tacatacactagtgactccaagtttcgtcaaaaacgccccctcccttctcgagcccactc
+acgctatgtattgacgcgaacttgttcgggatcagacttttcaggagttcggtcgcgtgt
+ccctatgtgctaatatataagttagatcgcattagatgctaatctgaatacttatagacg
+accttcaacgagaacgggtaccaccttgaggctagagttaggtgtgaaacgacaggtagg
+gacatataaaatttgagtgcggctttagttaagggtttaattacctactcaaacatcacg
+ctcgcgcccttcgtacgtaatcgaccatctagaggctaaggggactgtactaggtagtga
+ttaatgatatcctagacgcacgtgccttagatcttcagactctgatggtccgcgatcacc
+gtaattgtagtcctccaactcgatcactttgttggcgtcaaagaaattacgatatctaaa
+tacttataatacaataaccaaggatgagaatgactcatcgcgttggagttatattgcttg
+aagttctatggaatgaaagcacgttatctgccgtcccaatatctccagtgagctaattca
+ttggacggtccactttgatcaatccccgaggagatgttcggacactttagtctgtaacac
+ttagcgttgagaccacgaacaattgattactcagtcttgaaggtgttttccaaagttcat
+tttaaataagactacgataggcctttcctattgatataaactacccggctctgttgttcg
+tgtgagtcgtacttctctgtgtttttctgattatagcaagattcgattcttagtgtaaac
+agcgatttttatttgacccgtcaatgagaagcgcataggatctaagcaaaattatcaagt
+tgtgccacaaggtaagatctttccagttattgcaggtaggatgtatcccacgttgatagt
+atgaggtctgacgtcaactgtctaggagagttgaccgcgtgcgggtacaccggatttgca
+tcgatgttgagaacgcagaactcccactgtcgtggcggcgttcctgatatttagcaagag
+gcgttgataaagccctcatcatctagatctcgacctcatctgccctcttgctccatcatt
+ttctacacagactactttcctatctacgttagtataattgctttctatcttagtatcatt
+tagagcttctccgtcaacaggttcgtgctattaaagttagtacgaaagggacaacttgta
+gcaacgcatttaatcggttttcgactacttcgcacaaaatcagataaagaagtttgtcat
+tctattagacattgaattgcgcaattgacttgtaccacttatgatcgaacactgaatcaa
+gactgtgattaactaaaatagacaagccactatatcaactaataaaaacgcccctggtgg
+tcgaacatagttgactacaggataattaattggactggagccattacattctctacaatc
+gtatcacttcccaagtagacaactttgaccttgtagtttcatgtacaaaaaaatgctttc
+gcaggagcacattggtagttcaatagtttcatgggaacctcttgagccgtcttctgtggg
+tgtgttcggatagtaggtactgataaagtcgtgtcgctttcgatgagagggaattcaccg
+gaaaacaccttggttaacaggatagtctatgtaaacttcgagacatgtttaagagttacc
+agcttaatccacggtgctctactagtatcatcagctgtcttgcctcgcctagaaatatgc
+attctatcgttatcctatcaacggttgccgtactgagcagccttattgtggaagagtaat
+atataaatgtagtcttgtctttacgaagcagacgtaagtaataatgacttggaataccaa
+aactaaacatagtggattatcatactcaagaactctccagataaataacagtttttacga
+tacgtcaccaatgagcttaaagattaggatcctcaaaactgatacaaacgctaattcatt
+tgttattggatccagtatcagttaaactgaatggagtgaagattgtagaatgttgttctg
+gcctcgcatggggtctaggtgatatacaatttctcatacttacacggtagtggaaatctg
+attctagcttcgtagctgactatactcaaggaaccactgctcaaggtaggagactagttc
+cgaccctacagtcaaagtggccgaagcttaaactatagactagttgttaaatgctgattt
+caagatatcatctatatacagtttggacaattatgtgtgcgaaactaaaattcatgctat
+tcagatggatttcacttatgccttagaaacagatattgcccgagctcaatcaacagtttt
+agccggaaacaatcgaagcatagggacaatgtatcttttcctaaattgccatgtgcagat
+ttctgagtgtcacgaagcgcataatagaatcttgtgttgcctcaactcgttgaaaagttt
+aaaacaatcgcagcagtctttttggggtctactgtgtgtttgcaaaataactgaaagaaa
+cgcttgaacaactctgaagtagctcgagtactcattaaagtgtaacacattagtgaatat
+cggccaatgaaccaaacgcttcccggtacgctatctctctcatcgggaggcgatgtgcag
+gttatctacgaaagcatccctttacgttgagagtgtcgatgcatgaacctcattgtaaca
+atagcccagcaaattctcatacgtgcctcagggtccgggcgtactcctccatggaagggc
+gcgcatctagtgttataccaactcgctttttaactactatgctgtagttctacaggcata
+gtggccagtattttctaacttctctggatagatgctctcactcctcatccatcacggctt
+cagtttacgtcttacttgcttgttcagcaacggatggaggcattaagtatcttcactgtt
+ccctaaaattgctgttcaatatcaaagtaaggacgatacagggaaagctcaagcacactc
+attgaatactgccccagttgcaacctcacttaatctgacaaaaataatgactactctaag
+tgttgcggaagcagtctcttccacgagcttgtctgtatcacttcgtataggcatgtaact
+cgatagacacgaacaccgagtgagaaactatattcttgcttccgtgtgtgtgacaccagg
+taattgatgcggatataagctggagatcactcacgcccacacaaggcgctgctacctctt
+tattccaatgtgtaagaatttgctaacttcatttctagaccgcagctttgcggtcataat
+ttcacggtacggacccttgggttagagacttgataacacacttcgcagtttccaccgcgc
+acatgttttagtggcttctaacatagaatttttgttgtgacataaagagtgcgtgggaga
+cttgcccgaccgttaagccataatcaattgaaagccccgtgagtcacatctaattggttg
+tactgcgcatttagctatcctttagctgactcgaagagattcgattcctaatataggtta
+attagatggctgccgcgcgaagtaaaacgtgaaaaacgtagtgcgcagatctgcataact
+cgcgcttaattacttatgagtagttccaagttcgctacgttatgagagagattggaatta
+agcaaatatgttttatggtgattttgggatgagaaggactgctaagtacggctactaaac
+aaatttctaaaaccgccatctaccttatcttggagacatttaagttgtatatgtcactag
+tctagcttttgtctgtgggacgcgttctcggaatgagggaaatgcaagagccgattcatc
+aaatgcttatctaagaaagtagtggactattacaccaagcacgaatgccagggaactgct
+ttcttgctcaggacctcgcgacaaggtaccccgcataagtcctagaattacatttggtca
+gcaatgctgacatttgaccgtgaaaacataattttaatcagaaggcagctcacccgcttg
+ctctagatcttatctttgtatgaatgtcagaatttactgcaatatccgttccgaatagtg
+agggcttagtatagttctctgtatacaggtcacatcaaactccccctgtcctagtacagc
+tctgagctttaattaattgcatacatttccttcaatcatcagatgaaaacaccgcgaatc
+atgctcttctcgtatagggcaagagaagcaacaaacaactagcccgactcacgttcatcc
+gccgtatccttgttcagttcttactccgtattaggtcagcgaaatctaatcagaataatc
+ggtcgcgtatcaaaattaaaatcccgcttgaggttgacaattaaaacgctgagcagttat
+cggctattagatagtggggtgaaagtaattggctggaattatgttaaaacgtgatattaa
+gctaaaatacgctacttgttgccgacctaattcagtcattcgatattcagttagagccaa
+gaataacaagcttgtataaattgaacggggtgcactaaacgatgtgttactctaatattc
+agcttggagtatacctgaaggcgaattcatgtatcggccaataataagacgttgaagatc
+acaatttggactagcaaaagaaggtgatttatgcgtggggattgagtccactgtacgagt
+acggtctctggaaaattataggttcagggaatataaggaagtaaagataattaccaagag
+atttttggtatcgctatgacccagaggtgttctaacgtctgttttgatccgcagaatttc
+tgcctcaatgcatatttgacggacttgaactagagcctctaaagttaaatggcgacgcaa
+ctgttcctaaacttcaattattactactctttttttcctagggtattgtagaggccagtg
+gacaaaataaatcaaatttaagatgtttcggacattaacatcccccgtagcatagaaatc
+atcagttatccaatctctcatcgagcttttacaatttctgctggcgctatggacagcata
+tgccgcgagacctccgcaagactcacttgatcactgtaagtatcttcattagaggttaga
+gcctatagttaagctgctgacctagtaaaattggtattttctaattttattgctcaagtt
+aaaggttagtgaagggataatgacgttatttttgaacaatgggttgtattcaattttata
+tcacgaatggaacccttcattcccggcataatactagacgacacgaacaagctccgatct
+atcagccaggcacgtgttaaggtttaattccggcaaaccaatgaagcatcaaaaggtgac
+ctgatgcaacttagggtcacgatgagtttttcaggactacttattacctattaataagtt
+aacatgagccttcataccccgtaagacaatacatactccaccaattagaattctgagcca
+tcttatctttttgtatcatcgaagggtatggccgaataggttaattagttactcctaacg
+tctctacaggcatgcatttgacgcaccttcgaaaatagtcaatctctcgccacacgcgtc
+tagtatgcagcatcaaaaatatagtccacggtttccggattaccaaacgcggcaaagaga
+aacattgtatcgacggagataacttaatacagaaggaaggggcatcttcgaatacggatg
+aataattctatctgtttattctgacatcttgttttcaggttaatcttacgcattcaaatg
+acgcctgccccatgcgtgcgcaattattttctaatattgacgagagcaatctcactcctt
+ttgggtctatttatgttttattgaggcacaagcctatacagaacaggtactattaaggcc
+gtgagtgtgagactcaaaccgtggaaacaaaggatgggttgttcttggtacaagttttag
+tgcatgtgggcaatccttaccaaaatcagatgctatccttaactttgggctgcatttaag
+atggcggttggaggcctgtgagaatcctgcgtgtcatctttaatgaccgaattcatccat
+gtagattcagatcacacactcattccttgatgttgtctaaacaaaagttgttgtggacgc
+attggagggagttaagtaacaacttgggatcgcatacttataaaaattatatgttaaact
+ttcacaaacgctgaagtccaaagtaactagcccaaacgcctcgagagtcactaggtatta
+atggtgtttgagttcctgtgaaatagtgttcgaaggtaaaatttatgtaccaaatcgaaa
+gaacacttaataaggcttgcttgcacggaggtatgatgtttactgactctacaaccctaa
+ttttccagtacgtacattcattccaataggttagttctcaaagtgctatacaggctcctc
+aattgatgatatgcttcagccgctctatggatattagctcattttatttaggaagcccgc
+ttagaggcttactatgagggaaatgccaaaatgtcatacttttcggtgtgtcccatatga
+caccgctttacatagaatttgaattaaaacgcgctctcccgttcactaccatacttggta
+ccgtgcgcatattacatatagatataggatcattttttaaagctgtactaggtttgatcg
+acaatcttatgctatactatatgatgtaaccctcataatcaataccgatcgtacgatcct
+agcataggtggcaagcgattttatgccgattattgtgttaaatagtctgtgagtgtgatt
+atcagggctacgttggtagaggggttgtatagacctcgcacacattgtgacatacttaac
+aatatacgaaaactgatataataaatccccttacccaaacaccaatcccgttgaatcaac
+taccataacgtctcccatataaattgcctacttgtttgcataaatctgaatacataacac
+cattgcaccttcttgtgttccaatcccgttaagattgccttgtcagatgatatgcaagaa
+caatagcatttgctagcaattattaacagctcttcgaattgcctccacataacgcgggag
+ggtatattttaatttggcaaatactaagtactgttggcgtcatatgctattaacggttgg
+atattaagttatgtcagccgtaagcaagagtgggcgaaatattttgttacccagtgagag
+cactcttagagtttggatacaataggccatatgttgacttaagaggacgtaactacgccg
+tacaccattgttcaaccgacttcttggcaaatagaatcgtattagcaatcttaagaatag
+agacacgttcgtgttagggtatactacaaatccgaaaatcttaagaggatcacctaaact
+gaaatttatacatatttcaacgtggatagatttaacataattcagccacctccaacctgg
+gagtaattttcagtagatttactagatgattagtggcccaacgcacttgactatataaga
+tctggggatcctaacctgacctatgagacaaaattggaaacgttaacagcccttatgtgt
+acaaagaaaagtaagttgttgctgttcaacagatgatagtcatgacgcgtaacttcacta
+tagtaaattgaaacaaatacgcaatttagacagaatggtacggtcatgaatgacagtaat
+tcgaagtgctagaccaacttaaaataggtaaacgtgcccgaaaccccccttaacagaaag
+ctgctatcatggtgcagtatcgacgtgttcagaaacttgtaacttttgagcaggtccgag
+cacatggaagtatatcacgtgtttctgaaccggcttatccctaagatatatccgtcgcaa
+actttcgatttagtcccacgtagagcccaagcgttgtgcgactccacgtgcatgcccaga
+aatacgagtttaaatttggttacatggttaattttgaccgaagcatcgcactttatgatt
+gataattggattcaatatgtcgccctatgcgaatgcaacatgatccacaatttggctata
+agacgtttaatccgtatcacactttgtttgcggctagtatagtaacgcccgtgcaccaag
+agtcagtaacaattataagtactccgcaggtacttcaaatataaaaactaatcaaacacg
+acccatatgatcatctgaagatatttggaactttctcgacaaccaccctcgtactcaata
+cttacactaatcgacaggcacacgcaacgtgtacagtcgcaccatattgagtcaagattt
+gcttagtggcgatgagcgtacacgcttatttctctagtcacaattagttatctacgagac
+atcacgagggagcaaataagcgatgttatggctacacataggcacgtatgaatatgatat
+aagccagttaaacagtcgaaccatcgagcaaattctcatgcaccaacccacacgttgagg
+cacaaagagtaagctgtttgaatgtaacttcttctgctgagcgggccccaacgtaaggat
+caactagaagagaaaactcggtattagtttaaatgcgtcacggagcatgagtgcatttca
+ctaagaatgtctgtgtaaccaatataacatctatttgttatctgattgcctacttatggc
+tttgcggtcgtggcgactaatgtctccaatccttttgaggtcggtaccaactccctttaa
+attacgctgtgcaggctcatgcactgcatacatatacggtagcaggtagggacctcacgc
+acccttattataatcaatagtagttatcagtcaacgaggcaggaatgctgaggtcgaggt
+gttggtatattttctatgtgccgtctaggcgactatcacgcattaccaggcgagatttaa
+gccaattttgaatatagtcaacgtaatttttactatgggttccaccgaaacgccttgcac
+aactaagaatcccataaaatatcgatatcaaataaaagattgtgtcaataccttcatata
+tattttttcggttgactaacgtgaactaaggttaggggttttgtatgtctatataggaaa
+cagtttcttttctgtcctactttagtaaagtcttcaagccttactccaaaatcacggtga
+ttaagccgttactcagcagcatgattctgcctgctcgggtcctaaaatccagccttgtaa
+gagtcgctgtgtattagctagggagacctttgttaaaaaggatatatcgcggcgggatgt
+gagtgcgtggcgcatactcaatcttcagctcgtgtcattataatatctctcccccacgct
+tttcactagatatgccgtgtaagcaaacaccttatgcttaatttcgaaaatattggtact
+tgaaaaaagctgtaggggtacttaatgtctggtaggagatcaggagagaattgagtgtaa
+aaccgtaaagccctcacctgacttcatgtaaatggcttagaagactccatgatttaataa
+atactacgaaggaaagactggatctaaagataactctagtaaggccaactcccttcaatg
+ctgttgccagttataatccaagagctgtccttttctgaaccatagcggcttctgaagcga
+actagaagcaaagttggttctagccagacagccacataccctgtacgggtgtattactaa
+aactggtccggtattagttcaccaagggaggaattaggcaaaggatctaggtatgcaagt
+cggagtattacatccctaccctgaatccatcaataggttcctctgtactggccttcgcaa
+tgagtattcaaggttgtacagccgtataataataagatagtgactatgaacgggaagtaa
+cccgctcaccttccccaaaacattgttatatctaagtattaaagtctgccgtagtgttaa
+tactcgaaaataaacaactggcaaattacaccgcacttaagccgcttttgatttatattt
+ttccaatgcgcttttaaaaataattcagtcctacatactaattaagacccttaaacggag
+atatcacaagttaagttttaaccatctcgactaggtggaactatagatacccaactcaat
+ttatcattacctgtaatgttcctagaaggattgcatttcatgtcaagacggtggagtttc
+acagcgaaacttcagtgtgaacagattctgagaaatcacctaaacctattagtcagagca
+cccggttagaaccagttgtcaaaaaatagagcggttgcatgagacagaagtaacgatgag
+atccgttgtaacgttgagacatctggcctatcgtcaatacagtcctcccttaaaaatatt
+tttaaatactaggcaaacccaacataggttagtcctatgtgatacgccacatggtatatc
+attttgtaacgttacctagggataatcaggaagtggaattacgcaaaagtagacagtgaa
+atgcttagggttatagtctagtccaaagataaaggataaagcacgtcagagaactatatt
+agccgaatgggaatcattgttaggagactgtggatcatgtctaaaaagcaacgcagaaac
+agtcatcgaaaaaatctcgtttttgtttgaatctaaaagagctttgatgaccgatagtac
+ctgtatactagttactgtattacgtgtctaatgatttcggattggggtccccagaatcag
+acgtcattgtagacgattcaagtttaccaatttaatttcccagctctccttggagaacta
+tcgccaataattgcagtcactttccttttctgaaacgataaagccgtcagagttctctgc
+aacgttggacttacctgaggttctaacccactttcggttctaatagtagttaacgacaca
+acgaataacctttactgtggggctttcacgatattttttcgcttattattaatggttacg
+tcataagctggtgtccaaattaaggttaccggcttcgcagagtagttgtatccaagtata
+acttccctaatcataagatcgaggtagaaaattaatgctgtctctaaccgaacagatatg
+tcccactatgtggtatggacgttgctaattacttctgaagggaaattggtcattatggat
+acgtgtctaccatcaggtcggacgcagatatggttctgtcttcagttgatccaccgttct
+ttataggataataactgacgattaaagattatggtaaatagattaagccaattctcttct
+tgtcagtgaagcatccttaactgacttgctctgcagcccctcatacatttagctattcaa
+agtaccggctcgtttcaaactctcccacctttggaagaggttgtcaacttgataagtata
+tcatttacagcattttttcggacgtacctctaatgtttcattgcagaaaattagtttttt
+ctatcgcacattttgcaagtaacgttagagacacaattatctgcgaatgaactgctagat
+ctgacgaccgggagcctcgcaaatatcaaaaaagactgacatatatcaaggagtcgttga
+caagtgctggtaagtcaattggtttatctgtcccggcgtttcgatcttaagctgaccatg
+cacggcagagtaatgtcactctcgttcttacaagtctgtctccaagggtcggcaaaaaag
+acccctccattctcgagcccactcacgatatgtagggacgacaacttgtgcggcttatga
+attgtctggactgcgggcgagggtccatatctccgaagttagaagggacatacctttaga
+tgataagatcaattcttattgacgaaattcatccacaacggggaacaacttcaccctaga
+cttacgtctgaaaagacacctagcgtcttataaaaggtcagtgccccgtttcgtaaggct
+ggaattacctacgcaaacttaaacctcgcgcccttccttacgtatcgacaagatagaggc
+tatcgcgaatgtactacggaggcatgaatcatatactagaaccaagtgcctgtgatatta
+acaagatgatccgacgcgagcaccgtaattctaggcataaaactccagcaatttgggggc
+cgaaaacaaatgacgttagctaattaattatatgacatgatcaaaggaggtcaatcacgc
+atcgagttcgacgtatattcattgaacttcgtgcgtttgaaagaaacttttatgaaggca
+aaattgatcctgtctcctatttcatgcgtacctcctagttgataattccccgagcagtgg
+ttaggacacttttgtcggtatcaagttccggtctcaaaacgtaaaattctgtaatctgta
+tggatggtctgtgaattagttaatttttatgaagtcgtcgagacgcagttcctattgatt
+tattctaaacggagatgtgcttcgtgggactcggaagtagatctgtgtttatgattattg
+ctactttagatgctgactgttaactccgtgttgtttttcaaccgtatatcacaaccgaat
+tggatagaacctatagtttcaagttctgccacaaggtatcatatttacagttagtgctgg
+ttgcttctttcaaacgtggtgagtttgtgctatcacgtcaacggtagagctcagtggacc
+gagtgcgcgttcaaccctgttccagagagggtgtgatagcacatataccacgctcgtcga
+ggcgttcatgatagtttgcaagagccggtgttaaacacatattattattgttatccaact
+aatcggacctatgcataaagcattgtctaaacagaataattgcctatatacggtagtttt
+agtgatttatatcttagtatcagttagagcttcgaactcttcaggttcctcatatttaac
+gttcttcgaaagcgaaaacttctacaaacgaatgtaagcggttttccaagtagtacctat
+aaatcacagaaagatctgtctcagtatagttgaaatggtattcagctagtgacgtgtacc
+aattatcatagttcactcaagcaagacgctcattaacgaatatagacaagacactatatc
+atataataaaaaagaacatggtgctcgaacatagttgaattcaccatattgaaggggaat
+gctgacatgtaattcgctactagacgatcaattccctacttgtcaaagttgaactggtac
+gttcttggaattaaatatgattgcgctggaccaaattgcgacttcttgagtttcagggca
+aacgattgagccggaggatgtccgtctcttacctttcttgcttatgataaacgacggtcc
+ctgtacatcactgggaattctcagcaaaaataattgggtaaatcgagactcgatgtattc
+ggccacaaaggtgttagacgttaaagattattcaacggggcgataataggatcataaccg
+gtatgcaagcgcattgaaagagccatgagatccttatccgataaacgctgcacggtatgt
+gcagccttattgtcgatcacgaatttataaatgtagtctgggctgtaagttgaagaccta
+agttataatgaagtgcaataccaaatcgattcatagtggattatcagactcaagatatct
+cctgataaattacagttgttaagatacggataaaatgagatttaagattagcagcctcta
+atctgtttcaatcccgttggaatgtggtatgcgatcaaggttaagttaaaatcaagcctg
+tcttcagtcttgattcttgttctgccatcgcatgcggtctacgtgagttaatatgtagct
+tacgttctagcttgtgctaatctgagtatagattcgtagaggaatattatcaagcttcca
+cgcctcaacgtacgtgtattggtcacacaagacactaaaagtggaagtagcgtaaactat
+agtctagttgttaaatgctcagttcttgttatattcgatatactcttggctaatttatgt
+ctgagtatataaaattaatgatattaacttgcatttcacggatcccttagaaaaagattt
+tgaccgagcgcattataaacggttacaccgaatcaatagaagcatacccaatagctttct
+ttgaatttattgcctgcgcaacttggctgactctctagatccgaataattctatatggtc
+gtgacgaaactagttcattactgtttaaaatgccaacatgtcttttgggccgataatggc
+tctttgcaaaattactcaatgatacgattgatcaaagcggtagttgctagtggtagcatg
+taagtctatcaaatgtctgattatccgaaaatcttccaaaagagtccacgtaccatatct
+atctcatagcgacgcgaggggaaccttatctaactatcattccatttaccgggtgactct
+cgatgcaggatccgattgggataaattgcccagaaatggctcattcctgactaagggtaa
+ggccgttctcagcaagggaaccccgcgaatctaggcttataccatctagattgttaacta
+cttgcctgtagttctacagccatactggacagttgtttctaaatgatcgggattcatgct
+agcactcctctgaatgcaccgcgtaagtttaactattacgtccgtgggcagataaggatg
+gaggctgtatgtatcttaactgttacctaatatggctggtaattatcaaagtaaggacct
+taatgccatagcgctagcaatcgctttgtatactgaccatgtgccaacctctcttaatct
+gtaaaatataatgtcttagctaactgtggacgatcatgtctctgcctagagcttcgctgt
+atcaattcctatagccagcgtactagtgacacaacaacaccgtgtgagaaaagatattag
+tccttacgtctgtctctctacagcttattgatgaggattgaacatggacatatagctccc
+cctcaaaagcagatgctacctctttattccattctcgaacatttgccgaacttaatttcg
+acaaacctgaggtcacgtcttaatttatcggtaacgtcacgtccctttgagactggataa
+atatattaccaggggccaacgagcaattgttggaggcgcttctataatacaaggtgtctt
+gtcaaagaaagacggcgtgcgtctcgtgcaactcacttaaccaatattaatgtgaaaccc
+ccctctctcacatcttatgcggtgtactgccctggtacatttcctgtacaggactccaac
+agtgtagattcctaagatagctgttggagttgcctcacgccagatcgaaaaactgaataa
+actagtgagctgagctgcagaaataccgcttaattacttatgactagttcaaagggacct
+acgtgatgtcagacattgcaaggaagaaattaggtttgtgcgtcattttggctggactag
+cactccttacttcccctactattcaaatgtcgtaaacagcatgagacaggatcgtgctga
+catttaaggtctattgggaacgaggctacctttggtcgcgcgctcgcgttctccgaatga
+ccgaaatgcatgagcacagtatgcaattgcttatagatctaaggtctggtcgttgaaacc
+aagcacgtaggcctgggaaatcagttcttcctcagcaactacacaaaagcgtccaagcat
+tagtacttgtagtaaatgtccgaacctatgcgctcatttgaaagtcaaaaaatattttta
+agcagtaggcacctaacccgattcctctacttagtagctttctttgattctcagaattga
+ctgcaatatcactgcacaattctgtgccattactagacttctctgtattaacgtctcatc
+ttactaacactcgcctaggacacatctgagagtgaagtatttcaatacatttactgaaat
+cttcagttctaaaatccccgaataaggctcttatcggtttggccaacacaagaaaaaaac
+ttcttgcaccactcaccttcatacgcaggagcctggggaacttagtaataactatttcgg
+cagacaaagcttataacaagttgccggcgcgtataatatttaaaagaccccttgagctgc
+tcaattaaaacgctcacctggtataggctattagatagtgccgtcttagtaaggggcggg
+aattatcggataaactgatattttgataaaataaccgacttgttcacgacataagtcact
+aaggagattttatctttctccaaagtatatcttccttggataatttcaaagcgctgcaat
+ttaagttctgttactagtttatgctgctgggaggtgaccggaaggcgtagtaatctagag
+gcaaattataagaagttcatcatatcattttcgactacaaaaacaaggtgttgtatgccg
+gcgcattgtgtaaactggacgagtaccctagatggaaaattatacgttaagccaagattt
+cgatgtaatgataattacctacacatttttgctatccataggaacaagagctgttctata
+ggctcgtggcatacgaacatttgctgccgctatgaatattggaagctcttcaactacaga
+ctctattcttaattgccgtcgaaaatgggccgaatcggctattattaatactcggttttt
+ccgaggggattgttgtcgacagtcgtaattattattaatattgatgttggtgaggtcatt
+taaatacaaccttgcagacaatgaataagggatccaatctctcatactccttttacaatt
+gctcatgcccctatgcaaaccttatgccgccacacctccgcaactctctcttctgaactg
+taagtagcttcattactggtttgagactatactgaagctgatgacattctaaaatggcta
+ttttcgaatgtgattcataatgtttatcgtttgggatggcagaatcacgttatttttgat
+atagcccgggtattctattgtatagaacgtatgctacaagtcattccccgaagaagacta
+gaagtaaacaacatgcgaccatcgttaagccacgcaaggctgtagctttatttcccgata
+acctatcttccataaatagcggacagcaggatactgacgctcaacatcagtggttatggt
+ctaatttttaacttttaataaggtaacttcagcaggcatacacagtaactctttaattta
+taatcaaattagaagtctgacacttcttatatttttctatcatccaacgcgatcgcccat
+tagcttattgtgttactaataacgtatctaaaccaatccttttcaagctactgcctatat
+tgtcaatatatacaaacaacaggatagtaggctgcttaaaaaatattgtcaaccgtgtac
+gctttacaatacccggaaatcacaaactttgtagacaacgagtgaaatttatacactacg
+aagggccagcgtacaagacccatgaattaggcgatatgtttattctgacatattggttta
+tccttaatctgtcgctgtaaaatgaagccgcccccatccctgcgaattttttttcgaaga
+ttcacgactgaaatataaatacgtttggctatatttatgttggagggaggcaatagcctt
+tactgttaaccgaagatttagccagtgagtgtgacactaaaacactggaataaatgcagg
+cgttcttctgggtaaaaggtttagtcaatctcgcctataagttcatatagctctggatat
+aattatctggcccatgcatttatcatggcgcttggtgccctgtgtgaagccggcctctca
+tattgaaggtccgaagtattccatgtacattaagatcactctctcattcatgcatcttgg
+cttaacaaatctggttgtccaagctttccaggcacgtatggtacaaattcggatcgaata
+cttataaaaatgatatgttaaactgtctaaaacgctcatctacaaagtaaagtgcactaa
+ccaatagagtctcaagaccgtgtaatgctggtgcactgaatgtgtaatacggttagaagg
+gattagttatgttacaaatccattgaaaacttaagaagcattgcgtgctcggagggtgca
+tcttttatcaagagactaacattattttcaacgacgtacatgctttacaatagggtactt
+atcaaacgccgagaaacgcgcctatagtgatgttatgattatgacccgatatccattgga
+ccgaattttatgtaggttcccagcgtactcgcgtaatatctcggtattgccataatgtaa
+tacttgtcggtctctcccagatgaaaaagcgttacagagtatttcaatgaaaaacagcgc
+gcaacgtcaatacctttaggggtaacggccgctgatttcatatagatatacgataagttg
+gtatagctctactaggtggcatccacaatcgttgcatttactatagctggttacaatcat
+aatctataccgttccttacatactaccatagcgggatagcgtttttttgccgttgattgg
+gtttaagaggatgtcagtctcattatatccgattcggtgggagagccgttgttttcaaat
+cgcacactttgtgacataatgtacaagataacaaaactgatataagatataaactgtcaa
+tatcaccttgacacttgaatcaaagtaaattaactcgcaaatataatttgactaattggg
+tgcagatttctcaattaataaaaaaatggcaccggatgggcttacaagccccttatcatt
+cacttgtatcatgatttccaagaacaatagaatttgctagcaagtatgaacagagattcg
+aattgcatccacagtacgccggagcgtttattttaatgtggatatgacgatgtactgttg
+gcggcatttgctagtaaccggtccttatttacgtagcgcacacgtaagcatgtctgggag
+aaatatggtggtacaatctcagagaaagattacagtttggtttaaataggacttatcggg
+tcggaagtggaacttaataagcagtacacaattgggcaacagacgtcttgcctattacaa
+taggattacaatgcgttagatttcagacacgttcgtgtttggctattcgtcaattcccta
+aatagttagacgatcaactattatcaaagtgattctttgttcatcctccattcatgtaac
+agatggcacactacgcataacgccgaggaattttaacgagatttaagagagcagttcggg
+cacaacccacttgactttataacagctcggcagcataaacggtaatatgtgacaaatttc
+caaacgttataagaacgtatgtgtacttagaaaactaagtggttcatgttcaacagatgt
+gacgcagcaagcctaacttatctattggttttgctataaaagaacaaagttacacagaat
+cctaagggcttgtttcacacttatgcctagtgcttcaccatcttaaaatagcgaaaccgg
+cacgaatcaaaccttaaaacaatgcgcagatattggtgatggtgactccgggtatgataa
+tggtaactgttgaccagcgcccacctcatcgaagtatagaaagtggttaggataaggatg
+agaccgaacttatttccggccataactttagattttctacctagtacacaacatcagggc
+ggacacgaaaccgccatcacatcatataccaggtttaatttgcttaatgggggaagtgtc
+aacgaaccttcgaactttagcaggcatatggccattatatatggccccagagcagaatgc
+tacagcagacaaaatttggatttatgtagtttaatacctatcaaacttggtgtgaccata
+cttgtctaacgacagtgcacaaagtgtaagttacaattattactactcagcagcttctgc
+aatgataaaatcttatcatacacgtcacatatgataatatctacttagggggaacgggct
+ccacaacctacatagtactcaatacttacactattcgacaggcacaccaaacctgtacag
+tcccaaaagattgagtcaactttgcagtactgcagatcacagtaatagcttagttagcga
+gtcaaaattagttttctacgagactgcacgaccgtgcaaatttccgatgtgttggctaca
+aatagcaacgtatgaatttgtttgaagccacgtaaactgtacaaccttagagataagtct
+caggctactaaaaacacgttgtggcactaacaggatcatggttgattcttacttattcgg
+ctgaccggcccaataagtaaccttcaactagaacagaataatcgggagtagtttaattca
+gtcaaggtgcaggtctcattgtaactaacaagctctgtgtaaccaagttaaaatcgtttt
+cttagcggattccctacttatggatttgagctcgtccacaatattcgatacaagaagttt
+gtggtccgtaacaacgaaattttaattacgctgtgcagcctcatccaaggaattaataga
+aggttgatggtaggctccgaacgctccatgattataatcaagtggactgtgcagtaaacg
+aggaaggtatcctgacgtcgtggtgttcgtttttgttatttgtgccctatacgagtagat
+aaaccatgaacagcacagtgtgaacccatggttgattttaggctaccttatttttaattt
+ccgttacacagaaacgaattccacaactaacatgccattaatttttcgatatcttataaa
+agatggtcgaaattcattcatttattttttttcggttctcgaaagtcaactaagctgtcg
+cgttttgtttctctttagaggtaaaagtggctttgatctcctacgtttggatactagtca
+accattactccatttgatccgtgagtatcacctgtctaacatccagcattatgactcctc
+ggcgaagaaaagacacacttcttagagtcgatgtgtattagctagggacacagttgttta
+atacgatagtgagcccagggagggcagtgcgtcccccagtagatttattcagctagtgta
+agtataagatatctcacccacgaggttcaagtgatatgcagtcttagaataatacttatc
+ctgaatttcgatattatgggtacttcaataatccgctagcgctactttatgtctcgttgg
+acagcaggacacatggcagtcttaaacactaaagacatcacctgaatgaatgtaatggga
+ttacaagaatcaatgaggtattatatacgacgtaggaaactctggatatatacagtaatc
+tagttacgccatcgcacttcattcctctggaaacttagaagacatcagctgtacgtggag
+gaaccagacccccgtatgtagccaaatagaaccaaagttgcttatacaaacacacccaat
+gacaatggaccgctggagttcgtaaactcggaacgtagtactgcacaaacccagcattta
+gcaataggagctacgtatgcaactcccacgtggtaataccttcaagctatcaatatatag
+gtgcctagctaatcgcattcgcaagcagtattcaagcttgtaaaccagtataataattac
+agaggctctatgaaacccaactttccagctaaaagtcccaattaaatggttatttcgtac
+ttttaaagtcgcccgttctgttattacgcgaattgattctactccaaaattaaacacaaa
+ttatcaaccgtttcatttatatttgtcaatgcagctgtttaaaataaggctctactaaat
+tataattaagacacttattaccagatttctctagttaagtttgaaccagctcgactaccg
+cgaaagatacattcccttctctatttttcagttcatctatgggtcagagaagcattgaat
+ttattctattcaccctcgtcgttcacagcgaatcgtcagtgtgatcagtgtatgagaaat
+atcctaaaccgtttagtcagaccacacgcttagaacaagtggtctaaaaagactgccctg
+gaaggagtaagaagtatacagctgatccggtgtatccttcagtcatctgccctatactaa
+ttacacgacgcaaggaaaaataggtttattttctaggcaaacccttcataggtgactccg
+atgtgttacgaatcatgcttgagaatgtgctatcgttaccgacggataataacgatctcc
+aatgaaccaaatgtagaatgtctattgattacccttttactattcgacttagagatagga
+gatagaacctcagtgtacttttttagccgaatgggaatctttgggaggtgaatggccata
+aggtcgtaaatccaaccctcttaaagtcttccatattatatcgttgttcgtggaatcgat
+aacagatttgttgacccatagtaaatgtatactagtttatgttgtaagtgtagattgttt
+tccgattgccgtccaaactttatgtcgtaattgtagaccagtaaagttgaccaaggtaag
+tgcccagcgatcctgcgagatcgatcgccaatttttccagtcactgtaagtgtaggttta
+gataaagccgtatgagttatatcataagggcctcggaaagcagcttcgaaccaaagttcc
+cttataatagtagtttaactataaaagtatatactggtctgtcgccctttcacgatttgt
+tttaccggtttatgaagcgttacgtcattagagcggctccaatttaaggttaacggcttc
+catgtgtagttgtatacaaggataacttaaagtatctgttcagcgagctagttaagttat
+cctcgatagaacacaactcagaggtcccaagatcgggtttgcaacttgctaatttattct
+caaggcaaattgggaattatcgatacctgtataccataaggtcgctcgatgtgatgctta
+tgtcttctggtgatcctaccttagttagtgctgattaacggaacattaatgtttatcgtt
+ttgagatttagccaattctctgattctaactcaagatgccttatctgacgtgctatgcag
+cccctaagtattttacattgtaataggacacgctcctttaaaactcgccaaaaggtcgtt
+gtggttctctactggttaactatataatttacagctttgttgagctagttcctctttggt
+ttaagtcctcaatattagttggttcgagcgataagttggctagttaccttagtcactata
+ttagatccgaatgttatgcttcatctgaagaccgccaccctccaaaatttcttttaagac
+tcacttattgcaaggtgtaggtgaattcggctcgtttctcaagtggtgtatctgtacacg
+agtttccatattttcatcaacagccaccgcacacttatgtcactctaggtattaaaagtc
+gctctacaaggggacgcaattaagaaacagacatgctagtcaaaaataaacatagcgagg
+caccactaattcggccgcttatcaatgggatgctctgcgcgagacgcgccagagctcagt
+agttagttcggacatacatttacttcagatgatcaattagttttctacaaatgcttactc
+taccccgaaaaaagtcaccagactcttacgtctctttagtatccttccgtcttatataag
+gtcagtcccccgtttcggtaccctggaatttactaagaataatgaaacagcccccaagga
+cgtacgtttacaaatgatagaccagatcgcctagcttattccgacgcatgttgcatagaa
+ttgaaccaacggaatgtgagagtaactagatgagccgaccacagcacccgtttgcgtcgc
+agaatacgcctgatagttcggccacgaaatcatatgtcctttgagtattaagtatttgta
+atgatcaatcgagctcaagcaagcttacacttcctcggatattcagggaacttagtgcct
+ttgaaagatacgttgatcaacgaaaaattgataatggctcatatggaatgcctacctcat
+agtgctgaattaacacagcactgcggacctaacttttcgaggtttcaagttcacgtctca
+aaacctaataggctggaatatgtagggatcctcggtgaatttgtgattgggtttgttgta
+gtactgaccaagtgaatattctttttttctaaaagcagatctgctgccgggcactacgaa
+ggagatctctgtgtatcattattgcttcttgacatgatgactcttaaatcactgtgggtg
+tgcaaaacgatagcacaacccaattcgatagtacatattgttgatacttcgcactaaacc
+gttcatatttaaaggttgtgctccttccttcgttaaatactggtgacttggtcctatcta
+ctattagctagacctctggggaaccacgcccccgtaaaacctgtgcaagagagggggtca
+tacatcttagacatcgcgcctccaccagggaagcattgggtgattgaccaggtgtgtaac
+aaatatgattattcttatactaatattagcaaagatgcataatgatttgtattaaatgta
+taattgaattgataagggtcttttagtcagtgatagagtagtataaggtagacattagaa
+ctcttaaccggacgcagatttttcggtcttagtaagccaattagtcgacaaaacaaggta
+agagcggttactagtagtacctataatgcactgaatcttcggtcgaagtatagttctaat
+gctatgcagattgtgacggcgacaaatgttcagacttatatcatgaaacaagctcttgta
+agtattgacaaatgaaaagattgaatatttttaaatacaaaatgcgcctacttattaggg
+gaattaaccagattgaaggccaatcctcacatgtaatgagataatagacgataaatgaaa
+ttcttgtaatagttgaactgctacgtgatgggtattatatatgattgagatcctccaatt
+gccgacgtcttgtcttgatgcccaaaagattgtcaacgaggagctccctcgcgtacctgt
+cgtccgtatcataaacgacgcgacatgtacagcactccgaagtataagcaataataatgc
+gggtaatccagactagatcttttcggactcaatgcggtttcacggtaaacatgattaata
+ccggagagtagtcgagcttatcagcgatgcaagcgaattcattgtgccaggagatacgtt
+gcagataaaaccggcaacgtatgtcaacaagttttggcgatctcgttgtttgtattcgac
+gaggcgcgggaacttcaagaactatcgtatattcaagtccattaccttttagtttcagac
+tggtggagctgactaaagttatatcatcattttgtacactggtttagttaacgataattt
+cagatttaacatgaccagacgataatcgctgtatatccagttggaatgtggtttgccaga
+aaggttaacttataatcaagcctctcttcagtcttgattcgtcgtatcccatccattgcg
+ctatacctcagtgtatttggagctgtagttataccgtgtgctaagatcagtagacatgac
+gagagcaatattatctaccttacaagcatcaacggacgtctagtcggaacaaaagactct
+aaaactcgaacttcaggttaatatactatagttctgtattcagcagttattcttatattc
+gatattatcttgcctattggatgtctgactttagtatattaatcatagtatctgccatgt
+aaaggtgccagtactaaatctgtttcacagtgcgaattataaacggttacaaccattaaa
+gacaacaagaccctatagctttatttgaattttgtcaatgcgcaacttggagctcgcgat
+acatcccaattagtctatagggtcgggacgattctacggcatttctggttataatgacaa
+catggattgtggcccgagaatcgctctttcattaattaagcaatcattacagtcttataa
+gcgctacttccgagtggtagcaggtaactcgatataaggtcgcatgagccgaatagctta
+aaaaacaggccaccgaacattgatagagaataccgaccacagcgcaacctttgattactt
+tcattaaattgtacggctcactcgacatcaagcttaagattgcgataatgtgaactcaaa
+tggatcagtactgaagaaccgtaacccacttcgcagaaagcgtacccagagaagatacgc
+tgttacaatatacagggtgaaattattgcctgttcttcgtaaccatttcgccaaacttgg
+ttagaaatgatagccattcatgatagaaataagctgaatgataccagtatctttaactat
+gtagtcagggggaagataacgatggtccatgtatgtttctgatatgtgacagtattggcc
+gcgtaatttgctaacgaagctacttaatgcctttgagcttcatatagatttctttaatca
+aaatcggcaaaaagatagtatgagctataatatatgctagtagagaactctggaccatca
+tctatatgaatactgattcgagcgtgcaattactttagcctgcgtactactgactctaca
+aaacactctgagataagtttgtagtcagtaagtcgctctctataaaccttttggatgacc
+attgtacagccacttatagatcccaataaatagcacaggagacagagtttttcaatgctc
+gatcatttgccgatagtattttcgtctaacctcagggcacctattatttgatacctaacc
+taacggccctttcacaatggagaaatatatgacatcgggacaaacacaaatggtgggtgg
+ccaggagatatgacatggtggcgtctctaagaaacacggactccctctaggcaaactcac
+gtaaccaattttaatgtcaaacaaaacgctcgaaaagattttgccgtgtaatgacctggt
+acattgactggtcaggaatacatcactgtagttgccgtagtgtcctgttggtgttccatc
+aagacacatcgtataacgcaatttacgacggacatcagatcaagttatacagattattta
+agtatcacgtgtgcattgggacataagggatctcacacatgccttggaacatttttgctt
+tgtgccgctttttcgctgcactaccaatccttacttaccagtatattcaaaggtcgttaa
+cagaatgagaaaggttagggctctaagttatcgtcgattgggatagacgagacatttgcg
+agcgccctccacggatacgaatctcccatatcaatgtgaactggatgctatgcagtttag
+ttcttacgtctcctagtggtaaaaatcaaagtagcactcgcatagcagttattcagaacc
+taatacacaaaaccgtcaaacattttctaattctaggtatgggccgatcataggagctaa
+ggtgaaactcataaatgttttgttagatctagcatcctaaaaagatgcatatactgagta
+gctggcgtgcattctctcaattgtatcctttttaactgaactagtcggtcccatttcgtg
+actgagatctattaaccgataagattaataacactcgcattcgtatcagctcagagtgaa
+gtttttcaataatttgactgatatattaacttctaaaataaccctttaagcctcggatcc
+gtttcccaatcacatcaaaaattcttattccaactatctacggattaacaacgtgcatgg
+ggatcgtagtaagaacttgttccgatcactttgagtatatcaagttgacggcccggttat
+tattgaatagaaacattcacctgctaaattaaataccgcacatcggatacccgatttcag
+agggccgtcttactaagggcaggctttgttcggtttaactgagatgttcattattttaca
+gtatgcttcaactaatatgtaacgaaggacagtggatctgtctccatagtagatcttcag
+tcgtgaatttcataccgctcctatttaagttcgcgttcgagttgttgatcatggcacgtg
+aaagcaacccctagtattctagacgaaaattttttctagttcatctgataatttgccaat
+tcaaaaacaaccgctggtttcccggcgcattctctaaaatggaagtcgaacctagagcca
+ttatttgtcggtaacccatgagttccttcttttcagaagttaatacactgtggtcctata
+cagaggaaaaacagcggttatatacgatcgtggcataacaacattggatcaagatagcaa
+tttggctacctattctaattctcactagattcggtattccactacaatatcggcagatta
+ggattggatgaataatcggtgtttaagtccggttgcgtctccaatctcctaatttttatt
+aatattgatcttggtgacctattgtaaataaaaacttcaagactttgaataacggtgaaa
+agatagaagactcatttgaaaatggatcatccacagatccaaacattagcaagacactaa
+tccccaactagctattctgatcgcgatcgtgctgcagtactcctgtcacaatagtctgtt
+catgatctaattctttttgggctttgttcgatggtgattcagaatctttatccggtcgct
+tccctgtagctactttgtggggatattgcccggggattatagggttgagatcgtttccta
+aaagtatttaaaccaagtagacttcaactaaactacatcagaacatcgtgaagacaccat
+acgcggtacctttatttaccgataacatttcttcaagaaataccggtaagcagcataatg
+accctaaacagctcggggtatcgtcgtagttttaaattttatttaggttactgctcaagg
+aataaaaactaactatttaatttataataatattacaaggctcacactgattagatttgt
+ctataagacttcgcgatcccccattaccggattgtcttaagaataaactagataaaccat
+gcattttctagataaggcctttagtctaattagatacaaaaaacacgatagttgcatcct
+taatttattgtgtcaaacctggaaccttttaattacccgcaaatcactttatgtcgagac
+tacctctgaaatttattatctacctaccgcatgaggacttgaaccatcttgtaggagtta
+tgtttattagctaagattcgtttatcctgtagcggtccatgtatattcaacaagcaaaaa
+gcactcagaattgtttttagttgagtcaagactgatatataaataagtttccctagtttt
+ttcgtggtgggacgatattgaattgaatcttaaccgaagagtttcccactctgtcgcaca
+ataatacacgccaatatttccagccctgcttatgccttaatcggttactcaatctcccat
+tgaagttcattttgatctgcatagaagtttcgggcccagccttttttctgccaccttcct
+ccaagctctgtagacgcactctaagattgatgctcacatgtattaattctacattaacat
+aaatatataagtcatgcatcttcgagtaaaatatctggttctccaacatgtcctggcacg
+tatcgttataatgcccatacatgtagtattaaaatgattgggttaactggatattaagat
+catcgaaattgtaaagtcaaattaacaatactgtctcaagaccgtgtattcctcgtgctc
+ggaagggctattacgcttacttccgttttggtatcttaatatgactttcaaaaattaagt
+tgcagtgagtcctacctgcgtgcatcggttagcaagagtataaaagttgtttaaacgaac
+tacttgctttacaataccggtcgtatatatcgccgtgaatccagaagattgtcttctttg
+gattatcaaccgagatcctgtggaccgatgttttgggaccttcacagaggactccaggta
+gagctcgcttttgcattaatctaagaattgtacctctctaaaagatctaaaacagtgaat
+gtgtatttcatggaaaaacacagagaaacgtaaattactttaggccgaaaggcacatgag
+ttattatacatatacgagatggtggtatacatcgaattcggggcatacactatagttgca
+ttgtatttagctgctttaaataatatgatattaccttccttacataagacattaccggca
+taccctggttttcaacttgtggggctttttgacgatcgcactctcatttgatccgagtag
+ggcggtgacccctgcttttcaaatacaaaaatttcgctatgaaggtaatagattactttt
+cgctgttatgatagaaacggtaaatttaaaattgaaacttctagaaaagtaaagtaacga
+gaaatgattttgtgaataatgcggtcatgattgcgcaagtaagaaaaaaaggcaaaagga
+tgcgcggaatagaaacttatcagtcacgggtatcttgatttcattcttcttgtcaattgc
+cgacataggatgaaatcagattccaatgcaatacacagtaacccccacccttgattgtaa
+tgtcgatttgaagttgtacgcgtcgacgaagtggatagtatacgggccttttgtacggtg
+cgatcaactatgaatctcggcgagttagatggtcgtacaatctcacacatagaggtcact
+tgcctgtaatgacgaattttcggctaggtactcgaactttattagaagtaaaaatgtggg
+caaaagaaggattccattttacaagacgattacaatgagttacatgtctctcaacgtagt
+ctttccctagtagtctttgaactatttaggtactccagaaaattttagcaaagggtttct
+gtgtgaatccgccattcatgtttatgatggaacaataagaataacgccctcgtatgttat
+cgacagtgaagtcagcagttcggccaaaaacatattcaatttagtacagatccccagaag
+ttaagctaagtgctctaaaatggcctaaacggttatcaaagtaggtctaattactatact
+aacgggtgcatcgtaataactgctgtcgatgcaacactatatgatagtgtcgttttgcta
+tatatgtacaatgtgacaaagaagccttagcgattcttgcaaacttaggacttcggattc
+tcaatcttaaatgtccgaaaacgcaaagattcaaaaatttaatctatgagcagatatgcc
+tgatggtgactacgcgtatgttaaggctaaatgttgacaaccgcacacataatcgaacta
+ttgatagtcgggagcataaccaggtgaacgtactttgttcacgacatttattgacatgtt
+ctaaatacgtctcaaaatcacggcgcactagaaaacgcaatcaaatcattgtcctggttt
+aagggccgtaatgccggtagtgtcaaacttcatgagaactttagctggcttttggccagt
+atttagggaccaagagcactagccttaagctgaatattttgccatttatctactgttata
+actttaaaacttggtggcaccagacttgtcgatacacacgcatcaatctgtaacgtaaaa
+ggtttactaagaacaagcgtaggaattgagtttatattatatttaaactaaaagatgata
+ttagcttctgagggcgatagggctccaaatcataaagaggaatatattattacacgatta
+gaaacccacaacatacctcgaatcgcccaaaagtttgacgaaacttggcagtactccaca
+tctcagtaatacagttgggagagtctcaaatgttgttttattactcaatgaaccaccctc
+ataatttcactgctgttccattaaatttgcaaacgatcatttgctttgaagaaacgtaaa
+atcgacaaaattacagataagtagatgcataataaaaaaaactgctcgctataacacgat
+catcgtgcattcttacttaggagcatcacccgcacaataacgtaccttaaactacaacac
+tattagaccgagtactgtaattcacgaaagctcaagctcgcattgtaaagaacttgctct
+ctcgtaaaatgtgataatagtttgcggagaggattcaattattttccattgcacctactc
+cactagattcgataaaagaaggtggtcctcccttaaaaagaaatgttaagtaacatcgga
+accataagcaaagcatgtaagtgaaccgtcatccttccctaagaaacataaaggttttta
+ataatgtcgactgtgaactataactgcatcctttcctgacctactccggttccttgttgt
+tatttctgaacgagaccagtagataaacaatgtaaaccacagtgggtaccaatggtgcat
+gtgacgctaccgttgttttaagtgcccgtacaaacataagaagtcataatcttacttgaa
+attaattttgccttttattttttttcaggctcgaaattaatgatttgttttttttgacct
+tctagttacgctaatatgcggtcgcctgtggtttctattgagtcctataacgggatggga
+tctaatacgtttggttactagtaaacaaggtataaatttgataccggagtatcaactgta
+taacatcaagctttatgactcatacgcgaagtaatgacacaaggctttcaggagatcgcg
+agtacagagccactaaggggtgtattacgatagtgacaccaccgagcgcactcactcccc
+aagtagatttatgatcctacgctaagtattagatatataaccaaagaggttctagtcagt
+gcaactcttagaataataattagccggttttgcctttttaggcctaatgcaatattcagc
+tagcccttatgtatctcgcgttccacagcaccactcatggcacgcgtttaaactaatcaa
+atataatctatgaatgttatgccagtacttgaataaatcaggttttttataagtccttgc
+atactctcgttatatactgttagagtcttaccccatagaaattctttcatctgcaaactt
+agaagaattctcagctacggggagcataaagtccccaggatgttgacaaatacaacaaat
+gtggcttatacaaacactccatatgaaaatcgaaccctcgtggtagttttagccgaacct
+tgtacggataaatccctccattttccaatagcagatacctatcctactacctcgtggtat
+taaattaaagcttgaaatatagagctgcatagcttatccaattcccaagcacgagtctac
+cgtcgtaaccacgatttgatttacagacgctagagcaaacccatctttaaacatataagt
+aaaaattaaagggtgagtgcgtacgtgtttactagcaacttcgcttattaagacaattgt
+ttataagccataattaaaaacatatgttcaacaggttcattgatatttgtaattgcacag
+gtttttaataaggatctacgtaagtataatgaacaaactttttaccagagttatattctg
+tactttgaaaatgctcctctaccgccttagagactttcaattagattttttgcagttaat
+ctatgcgtaagtgaaccatgcaagggatgcgattcaaccgcctcgtgctaaccctatcgt
+ctgtctcataactgtaggtctaatataattttcagttttcgaacacataaccctttgaaa
+atctgctatttaatgtctcacctgcatgcactatcttctatactgctcagaacggctata
+cgtcactatgctccaagtgacgatttaaacgaagcaaggaataataggtttattttagtg
+caaaacaattaagtgcggactacgtgctctttacaataagccttgtgattgggctatagg
+ttaagtcccatattaacgatctccaatgtacaaaatcgacaatcgctttgcattacccgg
+ttactagtcgaattacagatagctgttagatactcactctaattttggacaacaatccca
+atcttggggtcgtctatcgcctgaagctcgtaaatccttccatcttaaacgattacatat
+tatagacttgttcggggtagagatatcacagttgtgcaaacattgtaaatcgatactagt
+ttatgttggtagtctagttgcttttaccattccccgaaaaacttgatctactatttcgac
+aacagtaaacttgaactaggtaagtgaaaacagagaatgcctcatagtgccactatttgt
+ccactatatgtaagtgtagctttacataatccactatgactgagatcattacggcctagg
+aaagcagcgtagaaaaaaagggcccggatattacgactgtaactataaaactagttactg
+gtagcgcgccatgtatagatttgttttaccggttgtggttgcgttaacgaatttcagccg
+cgaaaattgatccgttaaccagtccatctcgacttctataaaacgataaagtaaagttga
+tgttcagcctccttcttatggttgcatcgagagtacactactcagtgggaaatagatcgg
+ggttcctacttcagattgtattatctaggcaattgccgattgtgccatacctggataaaa
+taagctacctacatgtgatgcttatctattatcgtcatactaccttagggtgtcctgttg
+aacgctacattaatctttagccgtttgagatgttccaatggataggagtctaacgcatga
+tgaagtttaggaaggcagagcatcccactaagtatgtgacagtgtatttcgaaacgagac
+gttataaatagaaaaaaggtccttctggttctattctgctgaactattgaatggaaagat
+tggttgacctacgtactatttgcttgaagtcatcaatttgacggggtgagagacatatgg
+tgcatactttacggactctatattttagatcagaagcttagcagtcttctctacaccccc
+tcacgacataattgcttttaagaatctatgtttgattcctctacgggaattcggatccgt
+tcgcatgtgcggtttatctaaaccaggggacatatgttcagctaaagcatacgaacactt
+tgctaactagacgtatgtatagtagctataaatcccgacgatatttacaaaaagaaatga
+gactcaaatatatacatagcgaccctacacttattcgcaccctgatctaggcgatcctag
+cacccacacccgaaagtgagcactagtgtcttccgtattaaatttactgcagttgagatt
+ttagttgtctactaaggattactctaacccgtaataaggatcaagactcggtactagctt
+tactatcattccctatgtgttttcctaactcacaagggtacgtaccagcctatgtaatta
+caataatgataaagacacaaaggaagtaactttacaaatgagtctccagttacactagct
+tagtccctcccatcttgctttgaagtctaaatacgcaatctctgaggatatacagcagaa
+gaacactcataacgttggagtccaagaattagactcatagggcccccaacatttaatatg
+tactgtgagtttgaaggtgttctattgttaattcctgctcttgatacatgacacgtactc
+cgtgtttaaggcttcggactgactttctttcataagttgagcaacgaaaatttcagaatc
+gataagttggattcactaactaatacggctgattgaaaactccactccggacctatatgg
+tcgacctttatacgtaaccgatataaaacttataggctggtatatcgagccttcctagcg
+caatttcggatggggtttcttctactactcaacaacggaatagtctttgtttagtaaacc
+agagctcaggacgcccaatacgtaggagagcgctgtggagcatgtgtcattatggactgg
+agcactcttaaatcactctgcgtgtgctaaacgatagatcataacatgtcctgagtaaat
+tttcttgatacgtcgcaatataccgttattagttaaacgttctcatccgtcatgcgtgaa
+atacggctgtcgtgctcagatatactattagcgactcatctcgcctaacacgcacacgta
+taaactcggaatgactgccgctcttacatattagaaatacagactacaccacggaagcat
+tgggtcattctcaaccgctgtataaaagatgattagtcttataataagattaccaaagag
+gcagaatcatgggtagtaaatctattattcaagtgattaccgtcgtgtaggcagggagtg
+aggacgagatggtactcaggacaaatattaaccggacgaagtggtttacgtcgtactttc
+actattagtagtaaatacaaggtaacaccggggaatagtactaaatataatgatatctat
+cttcgggagaacgagtcgtctattgctttgaacattctcaaggcgtaaaatgtgctgact
+tatagcatgatacaaccgattgttacttttgtctattcaaaagattgaatagttttttat
+acaaaagccgcatacttatgacggctagtatacagtttcatcccctagcatcaatgctat
+ggacagtattgaacttataggaaattcttctaatagggcaaatccgtcgtgatgcctatt
+ttttttcagtcacatcctcaaatggcactagtattgtcgggatcccattaacaggctcaa
+ccacgagctcacgcgaggacatgtagtccgtatctttaacgaagcgacagcgacagaact
+cccatggataaccaattataaggcccgtaatcctctagacatcgtttaccaataaatccg
+ctttctccgtaatcatgttgaataccccagagtagtccagatgataaccgatgaaacaca
+agtctttctcaatgcacttacggtgaacttattaccgccaacgtagctcatcaaggttgc
+gacatctagttgtgtgtttgcgacgagcccagcgaacttcatcaactttcgtatattcaa
+cgccttgtaattttactttaagacgcctggtgatgtagattcttagataatcagtttgtt
+atcggctgtactttaccataatttcacaggtttcaggtcaagaagattatagctgtatat
+acagttccatgctcggtgcacagaaacgtgatcggataataatcaatcgcttatgtcgtc
+tttaggcgtatccaatacatgccccgataccgcagtgtatttcgacatgtaggtataccg
+tcgcatttgagctcgagtcaggacgtcagctagattagattccttaatagaatataccga
+cctctagtccgaactaaactatagataacgccaacttcaggttaattgtctagtcgtctg
+tttgcagatgggattcttagatgagtgagtatcggccatattggttcgagcactttagtt
+tttgatgcataggatatgcaatgtatagctgaaagtactttatctgtttcaaactcacat
+tgattaaaccggtaaacctttaaagactacaagaaaatattcagtgagggcaattttgtc
+aatcacaatcttccagctagagatacttcacaatttgtcttgaggctacgcaacattaga
+cggattttcgcgttttattgaaataatcgaggggcccaagagtatccatagttcattttg
+taagatttctttacaggcttattacagcttcttcagactcctacatgcttacgagttata
+tgctagcatgtgaacaatagattaatatacaggaaaacgtacattgagagagatgaccct
+acacagcgcaaccgttgagtactttcattaaagggtaacgctctcgagacagcatcctta
+agatggccttattgtcaaatcatttgcagaagtacgcaagatccctaaccaacgtagaag
+aatccctacaaacacatgagacgcggtgaaaatagacagggtgttagtattcaatcttcg
+gagtatcaatttcgccaatcttggtgagaaagcataccctttcttcagagaaagaagatc
+aatcataacactatctttaacgaggtacgcacgcgcatcattacctgcctccatggatct
+ttaggatagcggaaagtattggcagcgtattgtgatttcgttcctactttatcaatttca
+cattcatatacatgtcttttatcaaaatcgccaataagataggatgagctatattagatg
+ctagtagagttcgcgccaacatcatcgataggaatactcaggacagcgtgataggacttt
+tcaatccctaatactctctataattataactctctcttaagtttggaggcagtaacgcgc
+tctatataatcagtttgctgcaccattcttcagcctctgatacatacaaataaattccac
+agcagtaagagggtttaattgagacatcttgggaacttaggattttactctaacatcacc
+gaaacgattattggataccgtacctaaacgaactttctcaaggcagtaatataggacatc
+cgcaataacacaaatgctgcctccccaggagttatgtcttcctggaggctatatcttaca
+cccactcactataggcaaactaaagtttaaatgttgattgtctaaaaaaaagatagataa
+gagttggccggcgtagcacatgcgaaagtgaatcgtaagctataattctctggacttgaa
+gttctgtcctgttcctctgcaagaaacaaacttcctttaaagctatttacgacgcacatc
+tcagcaagttataaacatgttggaagtttctagtcggaattcccaaagaacggatctatc
+taatgcattcctacatttttcctgtctgccgatggtgccatcctattcaaagaatttctt
+aaaagtagattaaatgggacttttaacaatgagtaaccttacgcctctaagggttcctcg
+agtgccatacaccagtcaggtccgagccacatacacggagaacattctaacatagcattc
+tcaactcgatcatttgcaggttacttctttcctatcctagtgctaaaaatcatacttgca
+atcccatagcacggattaagaacctaagaaacaattcagtaaaacatgttcgaattcttg
+gtatgggaacatcattgcagctatggtctaacgcattaatgtttgggtacatcttccatc
+atataaacaggaagagtctgacgacagggagtgcttgcgatcatgtctatcattgtgaaa
+tcaaattgtagctcacatgtcgtctatgagagcgtgtatccgataagatttagaaaaata
+gaagtcgtataagatctcactgaacttttgaatgaatgtgaagcatatatgatctgcttt
+aataaaactttatccataggatacgtttccaaatcaattcaataattattagtcaaaata
+gataaggatgaacaacctgaaggccgatcggacgtagaaagtggtcccatcactttgagt
+tgatattgttgaaccacacgttattatggttttcaaacagtctcaggatattgtatatac
+agataatccgataccagttgtctgacgcccctcttacgtaccccaccctttgtgacgttt
+aaagcagttgttcagtattttaaactaggcggcaactaatttggaaagaagcacagtgga
+tatgtctaaattcttgttattcaggcctgaatttaatacaccgcatagttaacttcgcgg
+tagagttgttcatcatgcctcctctaagctaccacttctatgatacaccaatagttgttc
+tacggaatctgataattggccaagtcataaacttccgctgcgttcaacccccttgctcga
+atatccaactcgaaaagacagccttttggtgtccggaacaaatcagttacttcttttctg
+atgttaattctctgtggtcagatacagaccaaaaactccgcggatttaccatcctccaag
+aacaaatttgcatcaacatagcattttggctacatattctaagtctcaatagtttaggtt
+ttcaactacattatcccaacattaggattggaggaataatagctgggtaagtccccttgc
+gtctacaatcgactattttttatgaatatgcttctgccgcacctatggttattaaaaaag
+tcatgactttgaagaaccctgaaaagatagatgaatcaggtgtaatggcagcagccaaag
+agcatataattagcaacactctaagaacattatagatatgatgatagcgatcgtcatgat
+gttatccggtcacaatagtagcttcatcagctaattcgttttgccagtggtgacttgcgc
+tggaagaatcgttatacggtcccttccctcttgatacggtgggggcttattcaaccgcgt
+ggattgggttgtcatacttgcattaaacgatgtaaaccatctagtagtcaactatactaa
+atcacaaaatagtgatcaatacatacccgcttcatggttttaaccatttaattgattaaa
+gatattccgctaagaaccattatctacctaaactgatcgccgtatcctagtagtttgaaa
+tttgatgtaccgtaatgatcaacgaagtaaaacgttatattgtatgtagaataataggtc
+ttggagctaaatgatgtgattggtagtgaagacttacccttacaactttaccggtttctc
+ggaagaatatactagagaatcaatgcatgggctacataagcactttagtctaatgagata
+aaaaatacacgagtcttccatcatgaattttttgtcgaaaaactcgaacctggtaattta
+aaccatatatctttatgtcgtcaataactctcatatgttttatataacttcccaatcacg
+acttgtaactgcttgttcgactgagctgtttgagctatgaggccgggatccggttgagct
+acatctatttgctacaagaaaaatgaaagcacatttgttgggagttctggctacactcat
+agagaaataagtggcccgagtgggtgcggcctgcctccatattcaagtgtatcttaaacc
+aagtggttccaacgctcgcgctaaagaattaaagcctttatttcctccacggagtagccc
+gtaatccggttcgaaagagaccattgaagttaattttcatatccagtgaagtttaggcac
+aagcatgtgttctgccacatgcctcaaagcgctcttcaaccaagatatgattcatcctaa
+cttcgatgaatgcgtctgtaacataaatatagaaggaatgattcggcgagttaattttcg
+ccttctccaacatggcatccctacgttcgttataaggaccatacatgtaggttttaaagg
+tttgcggttaatcgatatttacatcatagaaattctatagtcaaatttacaagactctag
+atactcactcgttgcagccggctaggaagcgctttgtaccttacttcccttttcgttgcg
+taatatgaatttcatatagtaagttcaaggcactcatacctccgtgaagagggtagatag
+actattaaagttgtttaatagtacgtattgatggaaatgacccgtaggagatttaccact
+caatccacaagattcgctgctgtgcattatcaaaacagtgcatgtcgaaacatgggttgg
+gtccttcaaacacgaatccaggtagagatacctttgcaatttttcgatgaaggcgaccga
+gataaatgagctataacactgtatgtcttttgattgctataaaacacagaaacggatatt
+aatttaggccgtaaccaacatctgttatttgacatagaacagatggtcctttacagcgta
+ttccggccttaatattgaggtccagtgtattgtcctcctttaaagaagttgattgtaact
+gacttaaataagacatgtcacccattcactgggttgcaactgctggccctttttgtccat
+cgcacgctaatgtgataacagtaccgccctcacacctgcgtttaaaagacataaatgtcg
+ctatgaaggttattcattaattttagctgttttcttagaaaaggtaaatttaaaattgaa
+aaggctagaaaactaaagttacgacaaatgtgtttgtcaagtaggcgggcatcattgaga
+ttgtaagaaataaagccataaccagccccggaatagaaaatgttaaggaaaggcgatctt
+ctttgaattcttattgtcaagtgcagtcatacgttcttatcagaggacattgcaataaaa
+tctaacaccctcccttgtgtggttgggccatttgtacttcgaagcgtccaccatgtgcag
+aggataacggaatgtggttccgtcccataaacgatcattctcgcccacttagtggcgcgg
+taaatcgctctcatagaggtaactggcctgtaatgtccaatgttaggctaccttctccaa
+ctttagtacaacgaataatgtccgattaacaaggagtcaatttgtcatgaccagttcatt
+caggtacttgtatctatacggacgcgttccagagtagtatttgaaattttgaggttctac
+tgataagtttagctatcgctgtatgtctgaataagaatttaatgtttatcttcgataaat
+aacaattaacaactcctaggtgatacactgtgaagtctgctgttccccaaattacatatg
+ctattttgttcacataccatgaagttaagctaagtgctctataatggcataaacggttat
+caaactagctcgaatttcttttattacgccggaagcggattaactgctgtagatcaaaca
+cgttaggatagtgtcgttttcatatatatctaaattcggtctaacatgcattacccatgc
+ttgataacgtagcacttcgcagtctaattatgtaatgtccgtttaaccaaactttaaaaa
+agtttatctatcaccagtgatgcctcatcgtgactacccggatctttagcctttagggtc
+taaacagaactaatattactacgtgtcatactccggagcttaaccaggtgaaacttattt
+gttaaccaaatttagtgacagggtagaaatacgtatcaaattaacccagcaatacaataa
+gcatgaaaataattgtaatcgggtttgggccggaatcccgcttggcgaaaacttaatgac
+atagtgtgatgcattttgcactggattgagccacaaactcaactagcattatgctcaata
+tttggccagtgttctacggtttgaaatttataaaggccgcgcaaaagtcttgtagttaca
+aacgcataaatctcgaacgtaataggtttaattagaacatccgtaggatttctgtttata
+gtagatttatactaaatgttctgattagattctgacggccttacccatacaattaataaa
+gacgaatatattagttatagtttactatccaaataaattaagcgaatcgaaataaactgt
+cacgatactgggcagttatcaacttatcacttatacagttcggacactctatattggtct
+gtgagtactctatcaaactaactcataagttaactgcgcttccattaaatttcaatacgt
+tcttgtgctgtgtacaaacctataatcgaataaatgacacatatggagatgcataataaa
+aaaaacggctccatatttctcgttaatcgggcattcttaaggaggagcatctcaccaaaa
+ataacgttcctgataagtcttaactattagaccgtcttcgggaatgaacgaaacctcaag
+ctagcatggtatagttcttgatagcgcgtaaattctgataatactgggcggacagctgga
+aattagttgccagtgcacctacgcaaatagtttacataaatcaacgggctccgaacgtaa
+atacaaagggttagttacatcgcaacaagatgaaaagcatgtatgtctaccgtcatccgt
+ccctaacaaacataaaggtggtgaagaatctcgtaggtcaactataactccatccttgaa
+gcaactactccgcgtccgtgtgcgtagttcgcaacgagaacactactgaaaaaagctaaa
+caactctcggtacaaatgcggcttgtgtcgataaagttggtggtagtgcacggaataaca
+taacaaggaatattatttattcaaattttttgtgactgttatttgttttctgcctagaat
+gtaaggatgtgttttttgtgacctgatagttacgcttatttcaggtccacggtgcgtgag
+agtgtgtcctataacggcaggggagcgaagtagtgtcctttagactattcaaggtagaat
+tttgataacgctctataaaaggtagaaaatcatgattgagcaataagaccccaacttatc
+aaaaaaggagttctcgacagcgcgtgtacagtccctataacggctgtatttcctgtgtca
+caacaccctcccatcgcactcaaaatgtagatttatgatcagacgctaacttgttcttag
+agaaaaatacacgggatactctgtgcaacgatttcattaataaggtgcagcttgggactt
+ttttggccgtaggctttattaacattcacagtaggtagcgagacttcctatgaaccaatc
+atgccacgcgttttaacgtttcaaatataagctaggaagcgtttgccaggacttctataa
+tgcaccgttttttttagtacttccttactagccttagtttatgttagagtctttccaatt
+acaaaggattgaatagccaaaatttctacaattctcagcgaacgccagcttaatctaaac
+acgagcttcaaatattctacatatcggcaggagtcaatatataaatatgaaaatcgtacc
+atcctcgtacttttagaccaaacgtcttcggataattaaatcctttttcaattaccacag
+tacgtgcattagaactactgctatgaaagtaaaccttgaaatatagtcctcaagagcgta
+tccaagtacattgcacgtgtatacagtcgtataaacgagttgatgttctgacgctagagc
+ttaccattcgttaaacagataactaaaatttaatggctgagtgacttagtgttttcgaca
+aacgtcgcggatgtagactattgtttataagcaatttttaaaaacatatgttcaaaacgg
+tatgggatatgtcgaattccacaggggtttatgtaccatagaagtatgtataaggtacta
+aaggtttaaatctgtgatattcggttcggtgaaaatcagactagtcacacttagtgtctg
+taaattagattgggtgaaggtaagcgatcccgaactctacaaggcatgggatgagattct
+accgactccggataacactttacgatcgcgcataactctagctcttagataagtttaact
+tgtcgatctcataaacagttcaaaatctgcgatttattgtatcaaatccatcctctatct
+tctataatcatctgaaccgcgatacggcactatgagccaagtgaagattgaatccaagaa
+agctataattggtttattttagtccatttaaattaagtccggtataagtgctctgtacaa
+tatgcagtctcatgggcatatacgttaactaccttttgatacttcgaattggtaaaatat
+cgactatcgatttgcagtaaaaggtgtagagtccaattactctttcctgttacatacgat
+ctcttagtttggacaactagcccatgatggcgctcctctagcgcatgaacctactttata
+attacatctttatcgatgaatttttttagactgcggaggccttgagttttaacagggctg
+ctaaatttcttaagcgattagacggtagcgtcgtacgctacttgcttggaacaggcaccg
+aaaatattgatctactattgcgtcaactctattctgctaatagcgatggcaaatcacaga
+agccctcttagtgacaatagttgtcaactatatctaagtcgacctttactgtatcaacga
+tcacggagagaattaccgaatacgaaacctcaggactaaaaaacggaaaggatttgtcga
+cggtaaatataatacttgttaagggtagcgacacaggtatactttgggtgtaaacgtggt
+gcttcccggaacgattttcagaccagaaaattgttccggtaaccaggaaatctcgtctgc
+gttaattcgtgttagtaaacttgatcttcagactccttcttttcgttgcagcgagactta
+aattatatctgcgaaatagtgccccgtgcatacttcagatggtaggagataccatttggc
+ccattgtgactttacgcgattaattaaccgacatacatctgttcctgagctatgatcgtc
+tgaataaattacggtctcctcttgatacctaatggtttctggagacgtttctcatgttca
+aatggatagcaggagatcgcttcatcaagtttagctacgcagagcatcaaaatatgtatg
+ggaaagtcgatttccaaaccagaagggataaagagaaataacggacttctccgtagatta
+gcctgatattttgatgggaatcatggcggcacatacgtaagagttgcgtgaacgaatatt
+ttggacggcgggagacacatatcggccattcgttaaggtctctatattggacatcacaag
+cttagcagtatgagctactaacactcaagacattattgattttttcaagatatgtttcat
+tcctctaccgctattcccatacgttcgattcgccgggtgagcgaaaccacgggactgagg
+ttaagctaatcaataacaactcgttgcgatagagacctatgtatactagagagaattccc
+caacatttttacaaaaacaaagcagactaaaatagatacagtccctccatacaattagga
+ccaacatgttattgccgatcctagcacacacaccacaaactcagaacttctgtcttacct
+atgaaagggtctgcacttctgattgtacgtgtctaattagcattaatattaaaactaatt
+aggataaactataggtacgagctttactataagtcactaggtgttttccgatcgaaaaac
+gggaccttcaagccttggtaagtacatttaggataaagaaaaaaaggaaggtacgtgact
+aatctgtctaaactgacaatagagtagtacctacatgcttcatgtcaagtcttaatacgc
+aagcgctctcgttatactgctcaacaaaactcataaagttggactccatcatttagaatc
+atagggaccaaaacatttatttgctactgtcactttgtaggtgttctattctgaattcct
+catattgatacatgaatcggaatacctgtggatcccttaggacgcacgtgctttctttac
+gtcagaatacatattgtcagaatcgagaagttccatgcaattaagaattcgcctctttga
+aaactcatatccccacatatagggtccaccgttattcggaaacgatataataattattcc
+agcgttgagcgtcccttaagagcgcattttcgcttggcctttcttctacgactctacaac
+gcaagtggctgtgtggagtttaccacagcgcagcaccccatagaactacctctgagagcg
+cgagatggtggcagtatgctctgcagctagcgtttagaacgcgcccgcgcattaaccagt
+catattaaaatggactgtcttaattgtcggcattaggagcaatattaactgatgagggta
+tcggtcgcagaagtaatgacggaaatacgcctctagtccgcagagatacgattacagact
+cagatcccctaacaagcaaaacgattaaatcggaatcactccccctatgacatatttgaa
+atacacaagaaaccacgcaacatgtcccgcattctcaaccgcgctttataagatgttgag
+tctgagaattagatgacctaactgcaagaatcatggcgagtttatctagtaggcaagtct
+gtaccctagggttcgaacgctgtgacgtcgtgatcggtctaaggacttagatgataacca
+agaactggtttaccgagtactttcactattaggagtaattacatgcgttcaccgcggaat
+acgacgaaattttttcatatctttatgagcgagatcgtgtcgtctttgcattgcaacagt
+cgctaccagtaattgctgatcaattatagattcattatacagatgcttacttttctctat
+tcaatactgtcatgagttgtttttaaataagcaccagaattatgtcgcctagtataatct
+tgcttccacttgaatcaatgcgatggacagtattctactgattgcaaagtagtctatttc
+ggcttagcagtacgcatgcctatttttttgcaggcacagaataatatgcaactaggattc
+tcggcatccaattaacaggctaaaacaccaccgaaagacaggtaatctacgaagttgatg
+tttactacagaaagcgaatgatatcacttggagaacattttagatgcccccttttaatct
+agactgagtgtaccaatatatcaccggtctaccgaatcagcttgaataaaccactctagt
+actcatgataaccgagcatacacatgtatttctcaatgcactgaaggtgaactgtttaca
+ccataccttgcgaatcaacgtggcgacttatacttctgtctttgagtacagcacacccta
+atgaatctaagttagttgttgatacgaattgtaatttgactggatctcgcctcctcatct
+agattcttagagaagatgtttcttatagccggtactgtaactttattgatctggtttatg
+gtaatcaacattttacctctatttaaacgtccttgcgccgtgcactcaatcctgatcggt
+ttagattcaagcgattatcgagtctggaggccgagaaaagaaatgcacagagtaagctct
+ctattgcgacatctacgtagaaactcgcatttcagatcgagtaagcaactctcattgtgt
+tgattcagtaatacaagattacctacgcttctacgaaatatactatagatttagcctacg
+tcacctttagtgtcgagtcggagctttgaagatcggatgcggtgtggactgtgtataggc
+aattttgctgcgagctcgtgacttttggttgatgtcgatatcaatgggatacctcaaacg
+tctttatctctggataactcacattgagtataccggtaaaaatttattctattcatctaa
+atagtcagtgagggctagggtcgcaatcacattaggccacatacacatacttaacatgtt
+ctattgacccgacccaactttagtagcattgtagccgtttatgcaaatatgccaggcgcc
+aaacactagccagagggcattttgttacatttatttaatcgattattacacagtcggaac
+acgcctacatgcgttcgacttatttgcgacatggtcaacaattcagtaatttaatccaaa
+acctaaagtcagagacatgacactaaaatcacattaaggtcagttagtgaaggaatggct
+aaccagctagagaatgcatcattaacaggcacttattgtcaaatattttccagatctaag
+caacatcacgttaaaaagtacaacaatcacttaaaacacatcagtccaggtgtaattaga
+aagccgcttagtaggcaagcgtaggagtataaatgtagacaatagtcgggacttagcaga
+cactggatgcagtcatagaagatcttgcataacacgttagggttagagctacgaacgccc
+atcattaactgcctaaagcgtgcgtgagcttagcgctaacttttccaacacgtttgtgat
+ttcgttcataatgtatcaatttcacagtcatatacagggagtgtagaaaaatcgcaatta
+acatacgttgacctatttttgttcagagttcagttagagcctaatgattcgagagcaata
+atcaggacagcctcataggaagtgtcaatcacttagaagctatattattataaatcgctc
+tttactgtcgtcgaaggaacgagcgagagagaatcagttgcctgcaactggcttaacaat
+atgatacataaaaatattttcatcaccactaagacggtggaattcagacttattggcaac
+ttaggatgggactattaaataacccataagatgttgggataaagttacgaaacgaaaggg
+atatagcctgttagataggaaatccccaataaaacatagccggcctccacagcagtgatc
+tattccgccacgcgatatctttataccacgcaatataccaataataaaggttaaatgtgg
+ttgcgatttaaaaaagatacatatcagttgcaccgcgtagcaaatccgtatgtgaagcgt
+aacctagaattatagcgtctgcaagttctctaagcttcctctgcaagatacaatatgact
+ttttagcttttttactaccaaatctcagaatcttagaaacaggttggtacgtgctactcg
+gaattcccaaagtaccctgctatatatgccattccttcattggtccgggctcaccatggg
+gccatcatagtaatagaaggtagtaaaactagttgatttccgacttttaacaatcactat
+cctgacccagatatgggttccgactggcccttactccagtaagggcagacacacagacaa
+cgagaacttgataactttgaattctcaaatcgatcattgcaacgtgacttatttactagc
+ctactcctataattcatacgtcaaatacatttcaacggaggaagataataagtaaatatt
+cactaaataatggtcgaaggagtcctttgccaacataagtccacatatgcgctatagatt
+ttttcttggggttcatattcaataagataaacagcaagagtatcacgtcagcgagtcatt
+gagatcttggctagcattgtgatagcatattctacctaaatggtagtctagcacagagtg
+gataagatatcagttagatatagacaagtactataacagatctcgcttcgttggattgta
+tggctagctttgatgatatgattttataaaaattgatccagacctgacctggccaattat
+attcattttttatgagtaaaaatagataaccatgaaaatactcaagccccttaggacgta
+caaagtggtaacataaatttcaggtgttattctgcaaccacacctgttttgggttttcaa
+aaaggctaagcagattggttttacagataatccctgaacactggtatctcccaacgatgt
+cgttcccaacccttgctgaccttttaagctctgctgaagttttgtaaactaggcggaaaa
+tatgttcgatagatccactcgcctgaggtagaaattcgtcttagtaacgcctctttggat
+tacacagaatagtgtactgacacgtacactgctgcagcagccatacgctaacattaaaat
+tcgttgagtctacatttgttgttattcggattatgttattgggaatagtatttttattcc
+cctgcgtgaaaccacatggatagattagcctactcctaaagactcccttttggtctacgg
+ttcaattctcttactgagtttatgttcgtaattatatcggcgcagtgaatctcctaatta
+tcaccggagttaccagacgccatgaacttatggccagaaacattgcatgtggcctacata
+ggattagtatcaagagtttacgtttgcaacgacatttgaccaacttgaccattcctgctt
+gtagaccgcgggaactcccctgcacgcgactatagaagttggtggtggatgtggcttatg
+ccgcaaatatggttttgaaaaaagtaatctattgcttgatacctgaattgagacatgtat
+aagggctattgccagatgaaaaactgcatataaggtcaaacaatataagaacattataca
+taggatcttagcgttcctcaggatggtatacgctataaagtctagcttcagcagctaagg
+agttttgccagtgcggacttccgctggaagattaggtttaaccgccctgacatcttcata
+aggtcgggcctgattcaaacccctggagtgccgtctcatacttgaattaatcgatggaaa
+acttcttctagtctaatattattattaacaaatgacggttcaataaataacaccgtaagg
+gtgggaaactgttaagtgatgaatcattttaacctatcatccattagctacagataatga
+taccccgatccgactagggggtaagtggttgttccgttaggataaaccatgtaaaacgtt
+agagggtttgtagattaattggtattccagataaatgaggtcagggcgagtgatcaatta
+cactgaaaaattgtcagcttgcgcggtagttgttaagacagtataaatgaaggggattca
+gaagcaagtttctcgattgactgaatttataaaccagtcgtcaatcatgatttttgtgtc
+gattaaagcctaaatggtaatttaaaccattgatatttatcgagtctataaatatctttg
+gttgtatattacttcacaatcaccaattctaaatgattcttccactgtgcgggtggagat
+atcaggacgggttaaggttgacctacatcgttttgatacaacaaaaatcaaagcacatgg
+ctggggacttctcgatactatctttgagatagtacgggcaagagtgggtgacgcctccct
+acattttcaagtctatcggataacttctcggtaaaacgctcgcgatatagttttaaagca
+ttgatttaatccacgcaggagcaagttttaccggtcgaatgagaaaattcaacgtaagtg
+tcatatccagtcatggttagccaaaagcatgggttatccaaaaggaataaaacagctctt
+caacaaagagatgaggcttcataacttcgatgaatgcgtatggttctgatatatagatcg
+atgcatgaggacactttattttagccggcgaattaatggaatccatacgttacttatttg
+gacatgacttctaggtgtttttgctgtcccgtttagcgatatttacagattagtatttcg
+tttctcatagttaattgtatctagatactaactcgttgaagacgcataccttgccatttg
+tacaggacttaactgttccgtgcgtaatttgaatttcttataggttcttcaaggcacgaa
+tacctcactcatgaccgttcatactctagttaaggtcgggaatactacgtatgcagggaa
+ttgtaacctaggagatttacaactctttaaacaagagtcgctgaggtccaggatcaaaac
+actgaatctcctaacttcgggtgcctccgtaaatcacctagaaacctactcatacatttg
+caattttgagatgtaggcgaaagagagaaatctgctttttaacggtatctcttgggattc
+cttttaaaaacacataacgatagtaatgtaccaagtaaccaaaagctgggatgtgtctgt
+gtactgatccgccgtgtcagagtagtccgccatgaatattgacgtcaaggctagtgtcat
+caggtattgatgttcattgtaaatgaaggaatgaactaatgtcaccaagtaaagggggtg
+aaaatgctccccagggttctacagacatagagatggtcagaacacgacccccctctcaac
+gcagtgtatttgaaatatatggacatatctaccttattctgtaattttagatgtgttctg
+tgtataccgatattgataagtcaataggcttgattacgtatcttaagacaaatctgtttc
+gcaagtaggaccgcatctttcagattgtttctttttatgccataacctgcccaggaattc
+aaaaggttatcgatacccgatatgctgtgaattattattctaatggccactcattcctgc
+ttatatctggaattggcatgaatatcttacaacctaaagtctggcgttgcgccagttcta
+cttcgtaccggacaccatctccagtcgttaaccgaaggtgggtacgtcacataaaagttc
+attagaccacactttgtgccgacgtatatagatatattacacgtatagggaatgttttct
+cctaggtgacccgaccttctactaaggttgtacatcgtataatggcccattaactacgag
+gaaagtggtattgacctggtaatgcacgttcttcgatatataccgacgaggtaaagtcta
+ctattgcaaagtttgacgttatactgataagtttagatttccctggatcgcgcatgaaca
+atgtatgcgttatctgccatatataacatgttacaaatccttggggatactatcgctact
+atcatcggaccaaaattaaataggctagtgtcttatcagaacatcatgtttaccgaactg
+atctattttccaatttaagctgatattacgtccgcgtatttattttagttccccggatga
+cgattatctgagctacatcatacaagttagcatactcgccggtgcattgatttcttattt
+cgctatatcttcaagttcacaggcttcatatagttccaattagcagtataattaggtttt
+gtaactttaaccatactttataaaaggttatattgcacaactgatcaagcatccgctata
+acccgagctttaccagttagcggctaataacaaataagatgacttcgtgtcatacgaccg
+tcatgatcatgctctaacttaggtgggaaccaaatttaggcaatgggtagtaataagtat
+aaaatgataccacatatactataacaatgaaattatttgtaatccggtttgccaacgtat
+cccccttcgcgataaattaatgacatagggtcatccatgtgccaatcgtgtgtgccaaaa
+tctcaaattcaattatcatcaatattggccaagtgttataagcgttgaaagtgatatagg
+ccgccaaaaagtagtctacttaaaaaccaatatttatcgttcgttattgctggtagtaca
+acatcacgagcatttctcttttgagttgatttatactatatctgctgatgtgattatgtc
+ccacttacccagaatattaagaaagtcctagattgtaggtatacttgactataaatataa
+tttaagactatacaaataatctggctacattatgccatcgtagaaactgataacgtagta
+acgtcggacactagattttggtcggggagtaatctagcatactaacgaatttgttaaatc
+cgctgaaagtatatgtcattacctgcttggcctgtcttcaatacgtttagactattaagg
+actcatttcgagatccagtattaattatacgcatccatatttatactgaagacggattga
+gttaggacgacaagctaaacaaatattaagttaaggattagtattatattgtagaaactc
+gtcgggttggaacgattcatcatcatagaatgcgttacttattcagagagacttaattcg
+gttatgactggcagctcacctggaaagtaggtgaaaggcaacagaagaatattgttgact
+gaattctacgggctacgaacgtaattacaaagcggttcgtaaagagcataaagatcaata
+caatggatctctacagtattacgtaaataacatacataaacctggtgttgattcgactag
+ctcatagattaatcattaattgaagctacgaagacgcggaagtctgcggagtgagcaaac
+agtaatcgactgataaatgcttataatatcgcgcttaaatgccgcatggtgtacattaac
+gtgggggtagtcaaaggaatatatttactaggaatattagttatgcaaatgttgtgtcaa
+tgtgatgtgttttatccagacattggatgcatggctgtgggggcacaggatacttaccat
+tagttcacctacaagcggcgtgagagggtctcagttttagccagcgcagagaagtacggg
+cctttagacgattaatgctagaattgtcataaacctcgtgaaaagctagttaataatcat
+ggtgctagaagaacacaacttttctataaaccagttctcgactgacagtcgtaactcact
+atatcgccgctttgtactgtcgcaaaaaaacctcacatagaaagaaaaatctactgggtg
+catcagtagagatcgtgttctgagagataaatacaccggatacgatctgcatcgagttca
+tgtattaggtcaagcttgggactgttgtgccagtagcattttttaacagtcaaagtaggg
+tgagacacgtcatatcataatatatgccatcgaggtttaaagtttatatgataagctagc
+atgcgttgcaatcgtattcttgaatgctccgtggtttgtactaattcctttatagactga
+gtgtatcgtacactcggtacaattacaaaggatggaagagcaaataggtcttcaattata
+acagtaccccaccttaatctaaaaaccagcttcaattagtattaatttcgccaggagtat
+atatataaatatctaaagactaaaagactcgtacttttacaacttacgtcgtagcataat
+taaatcatgggtaaatgtcatcagtaagtgcattagaaatactcctttgtaaggatacag
+tgaatgtgtctcagcaagtcagtagaaatggaaattcatactcgattaaggcctataaaa
+ctgttgttggtatctacagagtgattaaaattagtgaatcagattacgaaaatgttttcc
+cgctcgcacttacgcgtttagacaaaagtacaggtggtacaattggctgtagtagaattt
+tggtataaaataggtgataaaccggatgggtgtgggcgaattcaaaagcggtttttgttc
+catagaactatgtagttggttataaaggttgtaatctcggagattaggttagggcttaat
+cagaatagtaacaatttctctatgtaaagtacagtgggtgatcgtatgagttcacgaact
+cttaatgccatgcctggacaggataaacaatacgcatataacttgacgatcgagcttata
+tcgacctatttgagaagtttaacgggtcgatataatatacaggtcttaatagccgatttt
+ttctagaaaagcaatcctatatcttagttaatcagatcaaccccgtgaacgatatatcag
+caaactgaacattgtatacaacattcctttttgtccgggtggggactccatttaaagtat
+ctcacctagaactcagcggtaatagatgcagtctcttgcccagttacggtaactaaatgt
+tgatacttagaattgctaaattttagtctagacatttccaggtaaaccggtagacgacaa
+tttctctgtcatctgtcataagatcgcttagtgtgctcaaattgcaattgagggccctac
+tatagacaatcatcagactttttaattaaatagttttccatgaatgtgttgtcaaggcgg
+accccttcacttttatcacggctcataaatgtcgtatgactgtagtcggtagcggccttc
+gagtcttcaggggaaatggaaaagaaattaggcttctaagatggactataatcgattagg
+ctaattccgttcgcaaatcacagaagcaatcttactcaaaattgttggaatcgatagcga
+acgcgaccgtgaatgtttaaaagtgctcgcacagaattacccaatacctatcatcacgac
+ttaaatacccaaagcagttgtagtcgcgtaatagattaagtctgaagcctagagacaaag
+ggatactgggcggggaaacctgctccttcacggtaacatggtaacaacagaatttggtta
+aggttaaaacgaaatatactcggagtgaattactgttaggtttcgtcatcggatcaataa
+gtagtttccgtgaagacactcttatattagatctccgaaattctgacccgtgcattaggc
+acttggtaggagattccatttggaacttgctcaatgtaagccagtaatgttccgaaataa
+ttcgctgcaggagcgaggagccgctgaataaaggaccctcgcatcttgttaccttatggt
+tgagggtcaccgttctctgcgtcaattccagagctggagatacattcatcaacgttacct
+acgcacagaataaaaagatcgagcgctaactcgttttcctaaacacaacggatttagaca
+aattaccgaatgcgccggagagtagcatcttagtgtcatgcctatcatggcggctcagta
+cgaagagttcaggcatcgaatattgtggtagcccgcactcaaagttccgccattaggtaa
+gctatatattgtggtcagaacttgaggacaactatgagctactaaaaataaacaattttg
+tcatttgttctagatatgtggcattcatcgaacgcttgtaccagaagttacattcgcagc
+gtgagcgaataaacccgaatgagcgtaacattatcaataacatatagttcagatagagaa
+cgaggtattcgacagagaattacccaacattggttattaatctatgcagaataatttaga
+taatgtcactacataatattaggaccaaaaggtgattccccagaagacaaaacaataaac
+aatctcacatattcgctagtacctatgtatgggtatgatcttctgattggacggggataa
+tttccaggtatattaaaacttattaccataatctagacctaagagaggttatataagtaa
+agagctgtgttccgatagaaaaacccgaccttaaagacttgcgaagtaaattttgcttta
+acaaaaaaacctacgtaagggaatattctgtataaactgaaaagtcaggtgtaactacat
+gagtcatgtcttcgattaattacaatgcgatctcgttattctgatcaactaatatcataa
+actgccactacatcttgtacaatcattcgcaacaatacttttatgtgctaaggtcacgtg
+cttcctctgctatgctgatttaatcagattcataaaggaatacgaataactctggatcca
+ttaccacgcaagggatttatttacggctgattactttttggctgttgacagaactgccat
+gaaagtaagatgtcgcatcttgcataaataatagcacctaatatagccgacaaagtgatt
+ccgataacagattttaagttgtccagccttgagactccatgaagaccgcttgggagcttc
+cccgtgattagaagaatctaaatcccaagtggatggggggagtttaaatctcagcaccaa
+caaatagtacttcctctcagagcgcgtcatggtcgaaggagcctatcctgatagaggttt
+gaaagcgcacgcgcatttaactgtcatattaaattggaatctcgtaagtgtcggcagtac
+gacaaattttaactgatgtcggtatacggagaagaaggaagcacgcattgaagcagctac
+gcagaactgagaagatgacactctaagatacaattaatacaaaaacgttttaagcccaat
+ctatcaacagatgtaagatgtctaatacacaagaataaaaccttcatgtcccgatgtata
+ataacagctttatttctgctggtcgaggtgaagtagtggaaattactccatcttgctgcg
+cgtctttatagtgttggctactctgtaaccgacgcgtccatccctctctcctagtgatcc
+gtatatccaattagaggataaccaacatctgcgttaccgacgaatttaaatttttcgact
+atttaattccgttcaaacccgtattcgtagtaagtgtttcatagatttatgaccgacatc
+gtgtacgagttgcagtgcatatgtagataccactaattgctgatctaggatacatgcttt
+ataaacatgcttacttggctattttatttactgtcatgtgggggtttttattttcaacaa
+gtatgtgctaccattggataatctggcttcaaattgaagatatgcgttccaaacttgtct
+actgtttgctaagtaggagttgtcccattagaactacgcagcacgtggtttgtgatcgaa
+aagaataattggcaaatacgaggctagccttcaaatttaatgcagattactcctcagaaa
+cacacgtaagcgacgaacgtgatgtttactacacaatgcgtatcatagaaattcgtgata
+atttttgttccaacctttgaatctagactgagtggaaaaagatttcaccgggataccgtt
+tatgctggttttaaaaactcgtcgaatcatcttataactgcattcaaatggatttctcaa
+tcatctgtacgtcaactgttttaacaataacgtcagaataaaccggcacaatgagacggc
+ggtctttcactacaccacacccttaggattataagtgacgtgtggattcgaattctaagg
+tgacgggatctacaagcctcagctacattaggtctgaagatctttcgtatagccgcgtat
+gttactgtttggatatgggttatgctaatcaacagttgacagcgagtgaaacggccttgc
+gacctgaaatctttacggttaccttttgattcaagacaggatcgacgatggaccacgtga
+aatgaattcaaaactgtaacatcgcttgtgcctcagcgaccgagtaacgacaagttcaca
+tcctctatgcaactatcattgtggtcattaaggtattcaagattaactaagagtcgacca
+tatattctagagttttacaattaggaaccgttagtctagactaggagcgtgcaacatcgc
+aggaggtgtggactgtcttgacccaagttgcctgacacatagtgtcttttgcttcatgtc
+cttagcaatgcgatacctcaatcgtagttttatcgggataaataacatggtgtttaaccc
+tattaatggtttctattaatctaaattgtaaggcagcccttgggtcgaaagcacattagg
+ccacatacacagtatgaaattgttcgagtgtccagaccataattgactaccatggtacac
+ggtgttgctattatgactcccgcaaaactcttgacagagggaattttggtacattgatgt
+aatcgatgatttaacagtaggaactagacgtcatccgttagactgagttccgacatgctc
+aaattgtcaggatttttatccaataactaatggctctcacatgtaaataaaatcacatta
+acgtcacttagtgatggattcgctaaacagatagactatcattcatgaactggcactgtt
+tcgattatatttgcaacatcgaacatacttaaagttaaatacgacatcattcaattaaaa
+aaattcagtacacctctaatgagtatcccgctttggaggaaagagtagcactttaaatgg
+acaatttaggccggactttcctgtaaatggatgaagtcattgtacagcttgaataaatcg
+ttagggttagtccttacatccaccatatgttaatgaataaagcctgagggaccttagagc
+taacttgtccaacacgttgctcatttacttaataaggttgaaatgtatcagtaagtgaca
+gcgagtgtagattttgaccatttaactgaccttcacagttttgtcttcagacgtcactta
+caccataatgatgacagagcttgtagatgcacacactcattcctagtgtaaatcaagtag
+tagctagattattataaagagatattttctggcgtcgaacgtaacacagagagagtataa
+ggggcatgataatggcttatcaatatgtgtaagaaaaagtttttaatatcatctaactcg
+gtggaatgcacacttatggccaactgaccttgggacgagttaagataccataagaggttg
+cctgtaagttaagataacaaagggatattccatctttgtgtgctaagaacctatttatat
+ttgcagccataaaaacctctgtgctatgcagccaccagagttatttatacaaagaaagag
+accatttagatacgttaattctgcttgcgatttattaaacagacatttcacgtccaacca
+ctacaaaagccctatcgcaagacgatcattgtattatagcctatgcaacgtagctaagcg
+gccgaggaatcataaaatatgaattgttacattgtttactacatatgatcacaatctttg
+taaaaggttcgttcgtgatactaccatgtacctaactaacctgagatatatgcaatgact
+tatggggtcagcgcgcaacatccgcaaagcatagtaatacaaggtaggaaaacttctgga
+tttcccaaggttataatgctctatactgaccaagagatccgttacgactcgcaatgaata
+ctctaagggcactcacaaagaaaaccactaattgataaatttcaatgataatatcctgaa
+ttgcatcgtgtatgagttacgagaagtcgcatttaatgaattagtcatagaaatgtcata
+gcaggaacataattactatattttaacgatttaatcgtagttggagtcctttcccaaatt
+atgtcatcagttccgatttagatgttttcgggcccttcttagtaaagaagttaatatcca
+agactagctcctcacccacgcatgcacatattcgcgagaagtctgatagaatattcgaca
+gaaatgcgactctagctcacactcgttaactgatcaggtacttatagacaagtacgttat
+cagatatcgcttcggggcattgttgcgctacctttgtgcatagcagttttgaaaaattgt
+tcaagacctgaacgggaaaatgatattatttttttaggaggaataatacagtaccatgta
+aatactcaaccaccttacgtacttcttacgccgaacatatatggcacgtgttattcggct
+aacaaaactgttgtgccttttctataaggataagcagattcgttttaaacatatgacctg
+taaactgggatctacaaaagaggtacttaaaataaattgcgcaacggtttagatctgcgg
+atctttggttaaagagcaccattagatgtgccatacttcctatcgcctgagcgagaattt
+agtctgaggaaccactcttgggatttaaaacaattcggttaggacacctactcggcggat
+gaagcaatacgataacattaaaagtcgttcagtctaattttggtcgtagtacgatgagct
+gatggccaattgtatttttattaacagcactgaaacaaaatggagactttagactaatac
+taaagtctcaatgttcgtcgaaccttaaatgctcggaatgaggggatcttcggaagtata
+gcgccgaagtgtatctcattattataacaccagtgtacagacgacatctaattatggcca
+gaaactgtcattgtgccattaagaggattagtagatagtctggaccgtggaatagaattt
+tgaccaaattgaccagtcctgcttgtagacagcgcgatctaaactgcacgagaatataca
+agttggtggtgcttgtggctgagcacgctaagatgcgtttgtttttacgattctagtgct
+tcttaacgcaattcagtcttctagatccgctattccaacatcaatatctcaatttaaggt
+caatatatataacaaaattagacagagcagctgacacttacgaagcatcgtagaaccgat
+atagtcgaccttatgatgatatggacgtgtccaagtccgcacttccgatgcatcttgacg
+gtgaaccgaaatgaaatcttcattagggcccccatgtgtcaaaccactcgagtcccgtct
+ctgaagtcaagtattactgcgaaaaattcgtctactattagtttattatgaacttatgac
+gcttaaataaattaaacagtaagcctgggaaaatgttaaggcaggaatctttgtaacagt
+tcataatgttgctaaagattatcagaccccgtgaagacttcgggctttgggcttcgtacc
+gtagcataatacatctatatagttagaggcttgcgtgttgttgtgctattccacatatag
+cagctctgggcgactcttcaatgaaaatgaaaaatggtaacctggcgacctacttgttaa
+gtcagtttaattcaaggggattaagtaccaagggtcgagtttctctgtatttattatact
+gtaggcaagaagcttttttggcgagatttaagacttaagcctatggtaaaaatttgatag
+tgagcgactatagtaagagatttgggtggttagtaattaaaattctcctatgctaaatca
+ggcgtacaatctgagggtgcacatttctcgacgcgtgaaccttcaccgaaagcgtgtgga
+ttatacaaatttcaaacatattggcggggcacttatccataatagatttctgtttgtacg
+ccaaactctgcctcacccctccataaattgtattggctagaggttaaattctccgtaaat
+agagacacatatagttttatacaattgtttgaatcaaagcacgagaaacttttaaccgta
+cattgacaaatgtcttcggatggggcagagcatctcttcgtgacccaaatcaatcgctga
+gcaataagcaagaaaacacagattatacaaagagatctggatgaagatattcgtgcaatc
+actatcgttatgttagagagttccatgcatgaggactcgttttttgaccaggagaattaa
+gccaagaaataactgacgtatttccaaatgaattctacgtgtttttcctgtcacctttag
+ccagtgttaaagatgactatggagtttcgaataggttattctatagacattataacgagt
+ggaacacccataccttcacagtgctaaaggtaggaacgggtacgtcaggtagttcaaggg
+attttaggttcttaatccaacgaagaaataacgcatcacccgtcattctattgttttcgt
+cgggattacttagtaggcagggtattctaacctacctgagttacaaatctttaaaaaact
+ggccatgaggtcatggtgataaaatctgaatcgcctaaattcgcgtccctaaggaaatat
+actagaatccgtctcagaaagtgcaaaggttgacttcttcccctaacacagaattctcag
+ttttatagctatctagtggcattcctttttataaaactttacgtttgtaagggtccaact
+ttacaaaagctcggatgtgtatgtgtaatcttccgccgtgtaagacttggaacccatgta
+tattgacggcatggcgtggctaagcaggtattgatcttcagtgtaaagcaaggtatgttc
+taatctaacaatgtaaagccggggattagccgccaaaggggtctaatgacatagagatgc
+tctgaaatcgtaccaactataaaagcacgggatttgaaatatagcgacagatcttccgta
+ttctgttagttgacatctgtgctgtctttaccgattgtgatttggctttagcagtcattt
+agtttcgttactcattgctcgtgcgatagttccaccgaatatggcacattcgttcttttt
+ttccattttactgcaaaccttttcaaaagctgatcgataccactgatgatggcattgatt
+agtcgattggcaactatgtcctgcttatatctccaattgcattgaatatagtaaaaaata
+aaggctcgccttcccaatgggctacggagtacacgaaaaaatcgcaactcgtttaaccaa
+gcgccgtacctaacatataagtgattgagacaaatagttctccagacgtattgagatata
+tgtctcctataggcaagcgtttctaattgctgaccagaaattagaattaggttgttaata
+ctatattcgaccattttattccacgaatgtgctattctactggtattgctccgtatgcga
+tatataaccaacacggaaagtcgtcgattgcaaagtggctccgtagaatcatttctggtc
+atttaccgggagcgcgcttgaacaatggatgcggtatctgccatattgttattgttaaaa
+agacttccgcttactatcgcttcgatcatcggaaaaatattaatgaggattgggtcgtat
+aagaaaatcatcttttcagttcgcagatttttgccaatttaaccggttatttcgtcagac
+ttggtagtgtagttacaagcatcacgattatatcagctacagaattaaactgtcctgact
+cgacggggcagtgtgtgagtattgcgctatatattcaaggtaacaggaggcatataggtc
+atagtacaaggataatgaggtttgctaactttaaaaattattgatttaacggttgattga
+aaatctctgcaagatgacgctagaacacctgatgttcaagtttgccgataataacatata
+agatgaattactgtctttagaccctcatgttaatccgctaacttagggcggaaacaatgt
+taggctatgcggagtaagtactatattatgataccacatagaatttaacattcatatgat
+gtctaatacccgttcccaaccttgcaaccgtcccgattaattaagcaattacggtcatca
+atgggccaatcctgtctcaaaaattatcatattcaaggttcagctattttggcaatgggt
+gagtaccgttcttagtgatttacgaacccataatctaggcgacttaatatacaagattta
+gagttacgttttccgggtagtacatattaacgaccatggatcgggtgaggtgttgtatta
+gttatctgatcttgtcagtagctcccaatgtcccagaatattatgtttctactagagtgt
+tcgtatactggaatttaaatattatgtaagactagacaaattttatggatacattaggcc
+atcgtagaatatgatatagttgtaacgtccctctatagattttcggagggcaggtatatt
+gcttaataaagatgttcggaaatcagcggaaaggatttgtaattaactgatgcgcagcgc
+ttaaataagtttagactattaagctatatgttcgacagcatgtagttttttttaccagaa
+agtgttatactgatgacccatggaggtagctcctcatgataaaaatattgttacttaagc
+attactattatagtgttcaaactagtaccgttgcatactttaagaatcagacatggcgtt
+tcttatgcagacacacttttttagctgttgacgcccacctcacatccatagtaggtcaat
+cgcataagaacaatattctggactgttttattacccagaagaaagttttttctttccggt
+tcgttaagacaataaagatcatttcattcgttctcttaacgatgaactaaagtacttaaa
+gtatccgcctcttgtttcgactagcgcatagtgtaataattaaggcaagataagaagaac
+aggaacgcgcacgtcggagataactctaatagtctctttattccgtttaatatagcccgt
+aattgcaccatgcgctacagtaacggccgccttcgcaaacctatttatgtaattccaagt
+ttaggtatgcaatggttggggcaatgtgaggggttttatcaagactttcgttgcttcgcg
+gggggcgcaaagcagactttacagtagttaaccgaaaaccgcagggagtcgctctaagtg
+ttaccaacccctcactactacgcgaaggtactcgattattccttgaatgggctgaaacat
+cgtgattagcgtcttatgattcaggctgatagaagaaaacttattttctatattccacgt
+atacaatcacactcgtaactaaatagttcccagcgttgtaatgtcgctataataaataaa
+atacaaagaaaattcgtctgggtgcataagtacagttagtcgtctgtcacataaataatc
+cgcagtcgatctcattacaggtattgttgttggtcaaccttcgcaaggtggtccaagtag
+cattgttgaacagtaaaactaccgtcacacaaggaatatcataatagatgccatacacgg
+ttttacttgatatgtttacagtccttgagttgcaatcgtagtattgtttcatccggggtg
+tgtacgaagtaatttagacaaggtgtgtagcggtcactaggtaaaatgacttaggatgga
+tgagcatttaggtattctatgataacactaaccatcatgtttctaaaatcctcaggaaat
+ttgtattattttaccaacctgtatttatagaaagtgcttttgacttaaagaagccgaagt
+gttcaaattaaggagtacctgattgaaagaatggggaattgtaatctgtaactcaattac
+aaataagccgttctaaggattaaggctttgtgtctaagcaactcacgtgaattcgaaatt
+catactcgattaacgactttaatactcttctgcgtatctacagactcatttaaattacgg
+aatatgttttcgtttttggtttccagctcgcacgtacgcgtttacaaataaggacacctg
+gtacaattggctggagtacaatgttggtttttatttgctgattatcccgatccctgtggg
+cgttggcataaccgggttttcttcaagactactttcgtgttgcttatatacctggtaata
+tcggtgagtagcttagggcttaatcacaatactaacaagttctctatggattggacaggg
+cggcatccgttgactgaacgatctattaatccattccctgcactggataaacaagaccca
+tttaaattgaccatagagatgttagcgtcatatttctgttcgtgatagggtacatatatt
+ataaacggattatgagcagtggttttctagaaaagcattcatagttaggagtgtatcaga
+tcataccactgaaccatagagcacaattctctactggctatacttcattcctttttgtcc
+gggtggggacgaaatttaaaggttctaacctagaacgcagagcgaattgatcaaggcgct
+ggccaagtgaacggttctaaatgttcttaatgagaattgcgtattttgactattgacagg
+gcatcgtaaaccgctactcgacttggtatctgtaatctgtatgtagatagagtacgggcc
+tataattcaaattcagccaccgaagattcacaatcttcagacgtttgaaggaaagaggtt
+tactggtatgtggtgtcaagccccacccattctctgttatatccgagcattaatgtagtt
+tcactgtactacggtcacgccgtagagtcggcagggcaaatccaaaacaatttaggctga
+gaagtggcactataatagtttagcctaagtcccttcgctaataactcaacaaagatgacg
+caaaagtcggcgaatagattgcgttcgcgtaagggtatcttgaatactgatagctctcat
+ggtaccaagaactttcataacctctttatttaccaaacctgttctactagcgttagtgtt
+ttagtctgtagccgacacaaaaaccgagaatggccggcgtaaccggcgcctgcaagctaa
+catgggatcaaaactattggcttaacgtttaatcgaatgagactagcactgtattactct
+ttcgtttcggcagcggatcaataaggaggtgacggcatcactctcttatagtagatatca
+cttattctcacaacggaagtaggatcttccgtcctcattaaatttgcaactggctcaatg
+taacactgtaatgttaacaaagtatgagctgaaggtcagagcagacgatgtagtaaggtc
+cctcgaagctgcttacagtatccttgaggctcaacgggctatgcggaaattccagacctc
+gagttacattatgaaacgtgtcattccatctcattaaatagttcgtgccctatcgccttg
+taatataaacaaccgtttttgtctattttcccaaggagaaggagagtagcagcttagtgg
+cttgcctatatggccccctaagtacgtactcggcacgcttagaagattgggctaccccgc
+actatatgttcccaaagtaggtaacctagatagtgtcgtatgaaattcaggtcatcgatg
+agagtataaaaatatacaattttggcaggggttatacattgcgggcatgaagagtaacat
+tggacatgaacggacattcgaaccctgtgagtttaataccctatctccggatcattataa
+agtaaatatacgtcacttactctacgtgcgtttagacagtctttgaaactaaattggtta
+tttttctttcatctagatttgtctgtatctaactaaattatagttccacataaagctgat
+tcaactgaagacataaatataaactttctaacatagtagcgaggaaagagctatgcctag
+catcggatcatgcgtccgcgagtagttcctggtagagttaaaagtttttccagaatctag
+accgaacacagggtagtgaacgaaagtgcgcggtgaacatacataataccgaacgtaaac
+aattccgttcgtattgttgctgtatctatatttcctacgtaaggctatttgatctataat
+atgaaaagtcacgtcgaaataaatcaggaagcgcttcgagtatgtacattcagatctcct
+tagtatcatcaaattatagattttacggccacgaattattggtctagatgtcccaaaaat
+aatttgatgtcagtagcgatcgtgcttcctcggagttgaggttggaagaagagtcattat
+gctataccaagaactctccatccagtacctagaaaggcaggtatgtaccgctcattaatt
+ttgcgatcttgacagatctgcatgcaaagtaacttgtaccagatggcttttataatagaa
+actaagtttcccgaataacggtgtacgataacagatttttaggtgtacagacgtctgact
+caatgaacacacattgggacctgccccgggaggagtagtagataattaccttctccagcg
+cgggtcttttaatatcacaacataaaaatactaattaatatcacacaccctcatcctcga
+tggagcctagcatcatacacgtttgatagacaacgccaattttactgtaatatgatattc
+gaatctagtatgtggacgctgtaccacattgtttaaaggagctccctttaccgacatgaa
+cgaagcaagctttgtacaagatacgaagaactcagtactggtaactataagagacaattt
+atacataaaagtgttaagaccattatataaaaagaggtatgaggtctttgtaactacaat
+aatacattcatcgaacgatggagaataacagagttatttctgctgctcgagctctagttc
+tgctaatttctcaatcttgatgccactcgtttgagtcttccattcgctcttaacgacgcg
+tacatccctctctcctactcttacctatatcctattactggttaacctacatctccggga
+aagacgtaggtaaagtggtccacgattgtattcacttataacacctagtagtactatgtg
+ttgctgagagtgaggacacacttactctacgagttcaagtccatatggacattacacttt
+ttcagcatctaggtgtcatgatgtattaacagccgttaggggctatttgattttatcgat
+tgtcggcgtgtgtattttcaacaactaggtgctacaattcgtgaataggcatgaaaattc
+aagattgcagttcctatcttgtataatctttcctttggacgagttgtaccatttcaacta
+acctgcaagtggggggtcatccatatgaagatttgccaaatacctggagaccctgaaaag
+tttatccagattaataataacaaacaaacctaagcgaagaacgtcagctttaataaacta
+tcactatcatagaaattcctgttaattgttcttccaaacgttgaatagactatcacgggt
+aatagattgaacacggagaacgtttatccggcttgtaaaatatcgtcgaatctgctgata
+actcaattatattcgatggagaattcatatctaccgcttagcttttaaaaattaagtcag
+attattccgccacaatgagaaggcgcgagtgcactaatcaaatcacttaggattattacg
+gacgtctgcattacaatgctttggggtagggttatacaagcatatgattctttaggtctc
+ttgatcgggcgtttaccaccgtagcttaatgttggcatatccgtgatcctaatattctgt
+tgtcagcgtgtgtataggaatgcacaacgcaaatctttaagctgacctgttcatgaaaga
+caggagacacgaggcaccacctcaattctatgcaaaactctaacatagcgtggcactatg
+agtacgtgtaacgacaaggtctcatactcgatcctaagataattctcgtctggaaggttt
+taatctttaactaagagtagaacttagtttattgacttttacaattaggatacggttcgc
+gactctaccacagggcatcatacctggagctctgctatctcgtgaccaaagtggcagcac
+acatagggtcgggtcctgcatctactgagcaatccctttaagcattcctagtttgagagc
+catttagatattgctgtttaaaccgattaatggtttctattattataaagtgtaacgctc
+ccattcgggacattgaaaattagcaataagacaatgtatgatattcggcgagtctcaaca
+acattatggtctaccatgggacaaggggttgatatgatgaatccacaaaaaatagtcaaa
+cacccatggttcgttaagtgagggtatccaggtgttataaggacgatctagaagtattca
+ggtacacggtgttcagacatgctctaattgtcaggttgtttataatttaacgtatcgctc
+tctattctaaataatataaaattaaccgctcgtagggatgctttccagtaaaagatacac
+tatcattaaggttatgcaaatgtggcgatttgatttgaatcttagtacattcttaaactt
+aaatacgtattatttaaagtaaatatattatctaaaccgcttttgtctatccacatttcg
+tcgaatcacgacctcgttaatgcgacaatttacgaccctctttcatctaaagcgatcatc
+tatttcttctgattgatgtaatactgacccttactccgtacatacaaatgatggtaagca
+agaatgactgacgctcctgtcacctttcgtggcaatcaactggcgctggtactgaagtag
+cttgaaagggatatggatgtgtatgccaggcttcattttgacaatttttctgtcctgctc
+agtgttgtctgaagtcgtatcgtacacaataatgatgactctcattgtagatccaatcac
+gctttcctacgctaatgaaagttctagatagtgtaggtgttagacagaggttagcgccta
+catccttacacacacagtgttgaacggcaagcataatcgagtatcaatagctgtatgtat
+ttgtttggaatatcatatttctcccgcctttgaacaatgatgccaaaatgtcctgcccta
+gagttatgataaaataactgctgccctgtaacttaagtttacaaaccgatattcaatcgt
+tgtgtcctatgaaaatatttatatttgcaccaagaaaatcatctgtgcgatgaacaaaac
+acagtgatttataaatacaaagagtacatttagttaccggattgcggcttgacatttatt
+ttacagaattttatcggcaaaacacttcatatgaactatcgcttcacgataagtctatga
+tagactagcattcgtagagaacaggaagagcaatcattatatatgaagtgttacagtggg
+tactacatatgagatcattaggtctatatccggccttcctcataagaccttggaaatatc
+ttacatcagagatatcaaaggaagtatgggcgaacccagaaaaagccccaaagaatagta
+attcatcggacgtaatagtctggttttaactaggggttattgatatttaagctaaaagag
+ttccctgaacactcgaaatgtataatctatcccaactaaaaaagtatacctctaattcag
+aaatgtcattgagattagactgatgtcaatacgctaggaggtaagacaagtagaagtttt
+tgatttaggaattgaaatgtaatacctccatcttaagttctatattttaaagttttatgc
+ggacttcgagtaagtgcacaaatgatggcataagtgcccagttacatgtttgcggccccg
+tatgagtaatgatctgtttatcaatctctagctactatcccacgaatgcactgatgccag
+tcatggcgcttacattagtcgacagaaatccgacgatacctatcacgcgtgaactgttct
+ggttcttattcaattcgaagtgatctcagatacattacggccatgcttgcccttcatgtc
+tgctgagcagttttgttataggctgaatctcctctaagcgaaattgataggatttttggt
+ggtcgatttagtctgtacctgcttattaagattcaaaatgacctacttcttacgccgaaa
+tgatagggatcggctgaggaggataaatatacgctggtgcctggtatttatccagaacaa
+gttgcctgtgtatcagatgaactctaatctccgagataaaaaacaggtacgtaaaataaa
+ggccgcaaagggttacatctcaggatcgtggcgtatagtccaccattagttctgacttac
+ttaatatagactgaccgagattgtagtatgtggatccaagcttgccatgtaaaacatgtc
+ggttagcaaaacgtataggagcatgatcaaagaagagttaattaatagtactgcactata
+attgtcggcggagtaccatgagctgttgcccaattcgatgtttattaacagcacgcataa
+aaaatccagacttttcaattagaattaactataaatggtccgcgaaccttaaatgatcgg
+aaggacgggatctgccgttgtatagaccccaactctatctaatttttataacacctctgt
+aatcaacaaatcttattatgccatcattatgtcattcgccaagtaagtccagttcgagat
+tctctggaccgtgcaatagtattgtcaaattatggtaatggaatccttcttctaacaccc
+ttagaaaagccacgagaattgacaagttgggcgtgcttgtccaggagcaacataagtgcc
+gtttctttttacgatgatagggattcttaaagcttttctctattctagatcccagttgcc
+atcatcaatatctcaattgatgctcattatatagttcttatttagtatgtccagatgtca
+ctgaagatcctgcctagaaccgatattctcgacaggatcatcagttcgacggggcaaacg
+cacctatgcacatccatcttgaccgtgaaacgaaaggaaagagtcagtaccgacccaatg
+tggaaaaaaactcctgtccacgatatgtaggcaagttttactgcctttaattagtagtcg
+attagtgtagtttgatattatctaccttatagaatgtaaacagtaacccggccttaatgg
+tttggcaggattctttgtaaaagttaataatgttcataaactttatcagaaaacctgaag
+tagtccgcctttcgcctgcgtaacgttgcagattaattcgttttacggagtggcttgcgt
+cttgttgtccgagtacacatattgctcctctcccccactcttctaggaaaatcaattatg
+ctaacctgcagaccttcttctttactatctttaatgcatgcccagtatgttcatagggta
+gacttgctatctattttgtataatctacgaatgatgcttggggcgcgacttttaacaatt
+aagccgttgggtataatttgagagggtgccacgatagtaagagatttccggcgtgagtaa
+ggaaaatgataataggattaagcaggcgtaatagctcaccctcctcagttctccaaccct
+gaaccggctaagtatgactgtgcagtattaattttgaatacatattgcagcccctaggat
+acattatagatgtctctttcttacccaaactcgcccgcaccaagaaagaatgtggattcg
+attgaggttaaattagccggaattacagacacagattcttgtttacaattgtgggaagaa
+aaccacctcaaacgttgaaacctacattcacaaatggattacgttggggatgagaatcga
+ttccggtcaaaaatcatgcccggagcaataaccaagaattcacagaggattaatacactt
+ctccatgaagataggactgcttgcactatccttatctttgtgtcttccttcaagcaccaa
+tcgtttggggacaaccacaattatgccaagaaataacggaaggtgttccaaatctatgag
+tccgcggtttcatcgcaacgtttcactgtgggtatcatgactttggactttagatttggg
+tattctagagactgtagaaagactgcaacaacaagacattcacagggcgaaacctaggaa
+aggggaccgcacgttgtgctagggatgtttccttaggaatccatacatgtaagaaagaat
+caaccgtaattatagtgttttcggccccttgaattacgtgcatgcctttgctaaaagacc
+tctgggaaatagattgaatattctggacagcagcgaatcctgattatatctcaagcgaat
+atatgacccgcaagaaggatttatactagaataagtctaagaaagggcattgggtcactt
+cttccactaacacacttttatcagttttataccttgagagtcccatgcatttttatatat
+atttaactttcgttgcgtaaaactttaaatatgatccgtgctctatctctaatctgaaca
+acggtatcacgtcgaacaaatctagtggctacgaatcgcgtcgctaagaacggtttcttc
+tgctggcgttagctacgtatcttctatgctaaaaatgtatagccccgcattagcagcaaa
+accgggagaatcaaatacacatccgatgaaatcgtaacaaagataaaacaacgcgatttc
+tatgtttgccaaagtgattaagttgtatcgtaggggtcagcgctgatgtcttttcagttt
+gggttttggatttaccagtcttttagtttcggtactatttgatcgggacattcgtccaaa
+catgatggctcattcgttctttttttcaattttaatcaaaaccttgtatttacctgatac
+attaaactgagcatcgcatggaggtggagattcccatatatgtaatcatttgatatccta
+ttccattctttttagttataaataaacgctccactgcacaatgggagtaggacttcacca
+ataattagcatctactgtaaacaagcgccgtaacgaaatgattactgattgagaaaaata
+ggtctcaacaacttttgacagatatgtatccgatacccaagcgttgctaattgcgcaaaa
+gtaagtagaattacggtcgtattacttgttgccaaatggttattactccaatgggctatt
+ctaatccgatggatacgtaggagagagtgtacctacaccgaaactcgtagtgggcttagt
+ggctacgtagaagctgttcgggtcagttacagcgtgcgaccttgtaaaatcgatcacggt
+gatgaattattgttattgtttaaaagaagtcccctgaatagcccttagataatacgaaaa
+tttgttatgtccagtcgctcgtatatcaaaagattcggttaagttcgcagagttttgcca
+agtttacaggtgatttactaacacttgggagggtacgtacaaccatcacctggttagcag
+agaatgaattatacggtcatgtcgcgaagggcaagtgtgtgagtattgaccgagttatta
+aacgtaaatgcaggcatttacgtcataggacatcgagtttgtcctttgcgaaatgttaaa
+tttatggttttttccgttgagtgataatagctgcaacatgaagatagtaaaactgaggtt
+aaactttcaccatattaaattatatgttcaattacgcgatgtacaaactaatgttaatca
+gatttaggagcgcgcttaatatgggtccctatcccgactttgtacgagattttgataaaa
+aatagtattgtaaattcatttgatggcgtagaaccgggcaaaaccttgaaaaaggacaca
+tttaggatgctatttccctaagaaagcggaaaatcctggctcaatatttataatagtaat
+ggttaagattgtggcccaatcgctgagtacccgtcttacgctttttccaacacataatcg
+acgagaatgtatttaaatgtttgagacttacgttttccgcgtacttattattaaagtcat
+tggagagggtgtcgtctgggtgtagttttctcatctgctcaggagctaaaaatgtaaatc
+tattggttgtttctaattctgtcgtccgtgtaggctatttaatttttatggtacacttga
+atatgtttagccataatgtagccaatactacaatatcagatacttgtatacgacctatag
+acttttgccgaccgctcgtagagtgatttagaaagatgttcggatagcacagcaatcgtt
+tgcgaatgtaagcatgcgaagcgagtatttaactgttgactattttgctatatgttactc
+tgaatgttgttttttttaccagaatgtgttataatgatcaaccatgcacgttcctactaa
+tcatataaattttgttacgtaagcttttctatgatagtggtctaaagactacccttgcat
+actttaagattaagacatgcactttaggaggaactcacacgttttgagctgttctagccc
+acctataagccattcgtccgcaatcccataactacaatagtcggcaatcttttattaccc
+agaactaacgtttttatttcccggtacgtatcacattaatcttaatttaatgcgtgagag
+taacgatgaacgaaagttatttatgtttaagccgcttcttgagaatacagattactgtta
+gaatgaaggcatcataactagaacaccaacgcgcacctcgcacattactctaatagtagc
+tttattcagtttaatatagacagtatttgaaccaggcgctaatgttaaggcccccttcga
+aaaccttgttatgttattccatgtggtcggaggatttgcggggcgatagcgctgggcggg
+gatcaacaatttcgttcatgcgagcgcccccataaccagtaggtacagttcggaaaagaa
+aaccccacgcactcgctagaagtgttacaatcacatcacttcgtaccgaagggactactg
+tattccgtcttggggatgtaacagactgattacagtcttatgatgaagcctcattcatct
+aaaattagttgatttattccacggatactatcacactcctatagaaagagttaccaccgt
+gggaagctagatataataaataaaagacatacaatattagtatggctcatgatctacact
+tactcggatctctctttttttataaccagtagatcgcattacacgtattgttgttccgca
+tcaggccctaggggctcaaacttccatggtggataactaaaacgtccgtcactaaacgaa
+gatattaatagatgaaatacacgggtttacttgatttctgttcagtcattcacgggaaat
+cctaggagtctttcataacggcggtcttagtaggaatgtagtcaagctctgtagaggtct
+cgacggaattggtatttcctggcatcacaatttacctagtattggagatcacttaaaata
+atgttgagataataatcaggatatttctagtatgtgacaaacctctatttagtgattgtg
+attttcaattaaacaagacgtaggggtcaaattaacgactacatgttggaaagaaggccg
+aattgtaatatctaactcatgtactaagaagaagtgctttcgtttaaggctttctgtcta
+acattctaacgtcaattcctatgtaatactactgtaaccaagttattactcggctgcgta
+gataaagtctcatgtaaatgacggtttatctgttacttttgggtttcaacctagctagga
+cgccggtactaattacgacacctgcgtatagtgcagggtgttcaatgtgcctttttatgt
+ccggattataaccatccctctcccacttggaatatcaccgggttcttaatgacttagttc
+gtcttccttattttccgggtaagatcgctgtggaccggacccattttgatctagtctaaa
+aaggtatatagcgtttcgtctggcccgcttacgttcactgaaacttagattaatcaatgc
+actgcactggattaacaagaacatgttatagtgtactgacacatgttagactaagaggtc
+tgttcgggttagccgacttatatgtttaaccgattttgacaactgggttgagagataaca
+atgaagagtgaggactgtagaagatcttaaaactgtaccatagtgctcaattcgctaatg
+gcttgaattatttaattgttctaaccctggcgtcgaatttttttggttcgaaaatactta
+gcacagcgtattgttcaacgagatgcacaactgtaccgttagaaagcggcttaatgacaa
+ggcagtattgtgactattgacagggaatcctaaaaagctactcgaattggtatatggaag
+aggtatgtactgagaggtcgcgcctattagtcaaattctgccaaagaagagtcaaaagct
+taactagtttgatggtatgaggtttaatgctaggtggtctataccaccaaaaagtatatg
+ggatatcccagaatttatcgactttcaatcgtctaccgtcacgacgtacactaggcagcc
+ctaatccaaaacttttgaggatgagtactgccactattatactgtaccatttgtaactta
+cattttatatcttcaaagaggtagatattgtcggccattactgtcacttacactaagggt
+agcttgattactgatacctctcatggtaaaaagtaatttaagaacctatttttttacata
+acctctgctactaccgttagtgttttagtcggttcaagtcacaaaatccctgtagcgcac
+ccctataagcagaaggaaaccttaatgcggataaaaacttttgccggaaccgttaatcct
+atgagaataccactcttggaatcggtcctttaggctgaggatatagaacgaggggaacgc
+atcaatctaggttaggtgagagaactttgtatcaaaacgcaagtaccatatgccgtcctc
+agtaaattgccaaatgcagaaatcttacactcttttcttaactaagtatgagagcaacct
+cactcctgaacagcttgttacctaacgagaagaggctttaagtagcctggagcctcaacc
+ggatatccggatttgactctcatccacttacatgatgattacggtcattacatctcatga
+ttttctgagtgccctatagactgggaatttaatctaccctgtttctatttgttaacaagg
+agaaccactggtcaagatgacgcgcttccatttatgccaccataagtaagttctcggaac
+ccttacatgattggcctaccaacctatatatgtgaccaatgtacggtacatagagtgtgg
+cctatcatattcaggtcatcgagctcagtatttaaagattatatggtcgctgggggtatt
+cagtgcgcgatggaagactaacattggaaatcaacggaattgacaacacgctcactttaa
+taacctatctcaggataagtttaatgtaattagacggaactttctctaactccgtgtact
+aactctttgaaaataatgtgggtatttttatttcatctagatttgtctgtatcgaaagaa
+agtattggtccaaataatcctcagtaaaatcaagtcataaatataaaatttagatcttag
+gacagaggaaagtgctttcccgagcataggatctggcctacgccagtagttcatgcttgt
+gttaaaagttgttactgtttatagtccgtactcagggtagtgttcgatactcagcgggga
+actgacatattacactaaggaatcaaggcccttcgtatgggtcatgtttatatatttaat
+tacttacgctatttgatcgagaatagctatagtaacgtcgtaagaatgcaggatgcgatt
+cgagtttgtaaattcacagatactgtgtatcatattattatagatgttaaggcatagaat
+tattggtattgatgtacaaaaaattatgggtgggcagtaccgataggcattacgagcagt
+gcagcttggaagaactggatgtatcctataactagtaagagccttaaaggtactacatac
+ccagggatgttaccatcattaatttggccatcttcaatcttcgcaatgcatactttcttc
+tacaagatgccttttagaagacaaaataagtgtcaacaataacgctgtaacttaactctg
+ttgtacgtggaatcaagtctcactaaagcaactaacattccgacatgcaaacgcaggact
+actagattattaaattcgccagcccgcctcgtttaatataacatcataaaaattctaagt
+aatatctcacacactaatccgccatcgtccatagcatcagtcacctgtcttacacaaaca
+catgtttaatcgatgttgttatgccaagctagtttcgcgaccatgtaactaattgtggaa
+agctgctaccttgaacgacatcaaccatcctacctttgtacaacagaccaacatctctgt
+actggtaaatagatctgaaaagttataaatataactgttttcacattgatagaaaaacag
+ctatgtgctatttgtatatactataataaattaagcgaaacatggagattaaaacagtgt
+tttctcatcctccacctcttgttctgctaatttataattcttgatgccactcgtgtgagt
+cgtccattcgatcgtaaagaacccgacataaatagatacgacgctgaacgagatcctatt
+tctcctgaaaattattagcacggtaactcctagggatagtggtactagttggtatgaacg
+tataaaaacttgtactactttctcgggatgtgagggagcaaactattactcgaccagtgc
+aacgcattatcgacagtaaaagttttcagctgatacctgtctggatggattatatgcagg
+taggcgagagtggattgtagcgatgctcggcgggggtattttaaaaatctaggtgataaa
+agtcctgtttagccaggaaaagtcatcattgcactgcatatcgtcgattagctgtcattt
+cgtccactggtaccagttcaacgtacatcaaagtccgggcgcatccatatcaagttttgc
+aatagtactccagaccatgaaatggttatccagattaataataacttaatatactttcac
+tacatactcagcgggtattaaatttcactttatgtcaaaggactcttatgtggtcttcaa
+aaaggtctagagtctatcacgcctaattgtgtgaaaaccgagtaacttgatcagccttgt
+aaaatatagtagaatatgatgttaaatcatttatattccagggagattgaatagcttacg
+attagctggtataatttaactcacatgattaagcaaatatctgtaggaccgagggaaaga
+ataaaataaagtaccatgagttcggaacgctgcattacatggcgttgggctagcctgata
+caagaagatgagtatggagctctcttcatcgggacgtgacaaccctagcgtaatcttggc
+agatcccggagcagatgattatcgtctaacactgtctttaccaatgcacaacgcatagat
+ttaacctgaactgttctggattcactcctgactacagcctacaactcatttctatgcata
+actcttaaagacagtcgcaatatcagtacctctatacacatcggatcagactagatcata
+agataagtctcctctggatccttgtattctgttaagtacactacaaatttgtttagtgtc
+tgggacaattacgataagggtcgcgactagaccacagggcatatgacctccaccgctcct
+agcgagtctccaatctgcaagcactcatacgctaggggcatgaatcgactgtcaatgcac
+tgtaagatttacgagggtgagacccatttagatatgcctcgtttaaccgttttaggcttg
+ataggatgagtttgtcgatccatcaaattcccgacattcatattgtccaataagtatatc
+tagcttattcggactcgctaaactaaattatggtataaatgccgtcaaccggtgcatttg
+ttcaatcaacaaattatagtcaatctcccatggggccttatggcagcgtatacagctggt
+ataacgaccatatacaactatgaacggactagctgtgaactaagcagattattggatcct
+tgtgtataattttaagtttcgatctatatgctatagtatagaaaatgttccgatcgtacg
+cttcctttacagttaaacagtctatatcatgaagcttatccaaagctggacatttgatgg
+caatcttacttaattatgaaacttaattacctattattgaaagtatttatatgatcgaat
+aagatttgctctataaacaggtcgtccattcacgacctagtgattgcgtaaattgaccaa
+cctaggtaatctaaagcctgcatctatttcttatcattcatgttatactgacccgttctc
+agtacttaaaaatgatcgtaagcaagaatcactcacgctcatgtcacatttagtcgaaat
+aaactgccgatgggaaggaagttccgtcattgcgatatcgatgtctatcccacgcgtcat
+tttcaaattggttatctacggataactgtgcgatgaactactataggtcaaaattatctt
+caatctcattctagatcatataaagatgtccttcgcgattgatacgtctacagtgtgttg
+gtgttacacagagggtagcgactacttacttactaactctctcttgatccgcaagcataa
+gccaggttaaagtgctctatctttttctgtggattataatagttataccgccttgcatct
+aggtgcccattaggtaatgccctagtgttttcataaatttactcctgccatctaacgtta
+ctttaatttcccagattcaataggtctctcatttgaaaattgttatatgtcaacaaagaa
+tataatagctgagtggaacaatacactgtgagggagtaatacatactctaaattttcttt
+acggtttgcgcctgcacagttttttttatctatgtgatccgcataaaaagtaatttcaac
+gttccattcaagttaagtcttggtgacactagcattaggagagatcaccaagaccattat
+ttatttagctagggtttaagtcggttagaaatatcagataatgaggtctttatccggcct
+tacgcagtagaaattggaaatttcgtaaagcactgagttcaatggaagtatggccgaacc
+cacataatgcacaaatcaagtcgatttcttccgtccttttagtctcctgggaactacggg
+ttattcatagttaagctaaatcagttaacggaactagacaaatgtataatagttcccaaa
+tatatatctataaatcttatgcagttagggaatgcagatttgaatcatggcaatacgcta
+gctcggaactcaactacaagtgttggatgtacgaattcaaaggtattacatccttatgat
+gttcttttttggatacttttatgacgacttccacgaagtgaaattatgttcgaatatctg
+aacagttacttggttgagcccaaggatgacgaatgttctgtttataattctcgtcataat
+ataaatacaagcatatgaggccagtcatggagctttcatttggactaacatttccgtaga
+gtcatatcacgcctgtaatctgatccgtctttttctattcgaagtgttatcagatacatg
+acgcccttgcgtgacattcatggctcctgacatcgggtcttttaggctgaatctaatcta
+acccaatttgtttggattgtgggtcctccattttgtctgttaatgcttattaagattaaa
+aatgtactacgtatttagacctaatgattgcgatacgctgtggaccattaatataagctg
+cgccaggggatttttccagatcatctggcctgtgtatatgttcaaatctaatagccgaga
+gaaattactccgacggaaaataaaggcagataagcgtttcagagcaccatcgtggcgttt
+agtcaacctttagttcggaatttattaatatacaatctcactctttggacgagctcctta
+aaagatgcccttgtatatcatgtcccgtacctaaaagtataccagcatcatcaaagaaca
+gttaaggaatacgactgctctataattgtccgaggagtaccttctcatctgccaatagtc
+gttgggttggaaaacaacgcattaatatgccacacttgtcaattagaagtttctataaag
+gggacgagtaactgatttgagacctagcacggcagaggacgttcgtgtgacaacatctct
+ttataagtttgagataaaatcgctaatctacaatgattatttgccaatcattatcgaatg
+cgcaaagtatctcctgttcgtgattctagcctaaggccattactatggtcaaattatgct
+aatcgaagcagtcttctaacacccttagaaaagcaaacactattgaatactgccgccgca
+ttcgccagcaccaacataactgcacgtgcttttttccatgattggcattatgaaagattt
+gatctatgattcttaccagttgcaatattcaatttagcatgtgttcctaattattgtgtt
+attatggtctatctcatcatgtaaatgaagatcatgacgtcaacacagattctagtcagg
+atcatcagttcctcggggaaatcgcacctaggaacagccttatgcaaccgctaaacaaag
+caatgaggatgtaccgacaaaagctcgatttaaaagcctcgaaacgagatgtacgaatcg
+tttactgccttttatgaggagtcgagtactgttggttcatatttgctacatgattgtatg
+taataacgatcccgccctttatcggttcgatcctttatggcgataagttatgaatcgtca
+gtatctttagatcaaaaactcaactagtacccagttccccggaggaacggtcatgattaa
+tgcgttttacggtctcccgtccctcttcttgtcagaggaatcagtttcatccgatcccac
+tcgatgattggtatagctatttgccgaaaagccacaacgtattcggtactatcttgtttg
+attcccctgtatcttaattcgcgacacttgatatcttttgtgtttaatcgacgaatcatc
+ctgggggcgacacttgttacaattatccagttgcgtttaatggctgtgggtcacaagatt
+gttagacaggtcccgcgtgtcgtaggaaattgataattggagtttgcaggacgaatagct
+cacccgcctaagtgatccaaccctcatcaggataactatcactgggcagtattatttttg
+atttcatatgccaccccctaggagactgtagtcatgtatctttcttacccaatctagccc
+gaaacaagaaagaatgtcgattccagtcaccttttattagaccgatttacacacaaagtg
+tcttggtttaaaggctggcatgaatacatactcaaaagttgaaaacgacttgctctattc
+gattaccttcgcgatctcaatcgattacgctaaattttaatgcccgctgaaatatccaac
+atttaaaacaggattaattctctgatccatgaacttaggactcattgcacgtgacttatc
+tttctctcttaattcatgctccaatacggtgggctaaaccacttttatcacatgaatgta
+cgcaacgtgttaataagctatgagtacgcgggggcagcgaaacgggtcaatctgggtatc
+ttctattgggacggtacatttcggttttatagactatgtagttacacggcatcaacatgt
+aattaaaacggcgtaacctaggaaagccgaacgcaccttgggattgccatgtgtccggag
+gattacatacatctaagaaacattctaaactatgtatagtcgtttacgacccttgtagta
+cgtgcatcccttggcgaaaagtactctgggtattagagtgtatattatcgacagcaccga
+atcctcattttatagcttgacaatttatgacccgaaagaaccttttataagtctataagt
+atatctaacgcaattgcggcactgagtccactaactatctttgagcagtgttatacagtg
+agacgccatggaaggggtttatatattttactgtcgttccctaaaaagttaattatcaga
+cctgcgcgatctcgtagatgaacaacgcgatctagtcgaaaaatgcttgtggctaccatt
+ccagtcgagatcaaccgtttctgcggatcgcgttacattccttgcttatttgcgataaat
+cgatacaaccccattaccagaaaaacccggagaatcaattactctgcagatcttatacta
+aaaaagagattacaacccctgttctatgtgtcccaaagtgagtaacgtggagcgttgggg
+taagagcggagcgattttaactttcgcttttccattttccagtattgtactttacgttat
+atttgagcggcacattcgtcaaaacatgatccatatggactgaggtgtttaaatgttaat
+caaataattgtattttcagctgactttaaaatctgcagccattggaggtggagattccaa
+tagatgtaagcaggtgatatcatatgcaattcttgtgacttattaagataccagacacgg
+cacaatcgcagtagcacgtaaacaataatgacaatcgacggttaaattccgaacgtaaga
+tatgtttacggatgcactaaaataggtagcaacaacgtttctctgagatgtataagttac
+caaacactggagaattccgctaaactaaggacaatttccgtcgtattaattgttgacaaa
+tggttagtaatacattcgcagtggataatccgttgcatacctagcactgagtgtaaataa
+aaccaatcgactactggcatttcgggctaacgactagatgttagcctatgtgaaagcctc
+acacatgcttattgccttcacggtgagcaatgtttcttattcgttattagaagtcacctg
+tagagacagtagagatgacctaaatttggtttgtccagtcccgaggtgatctaatgatta
+ggttaacttagaacagtggtcaattggttaaagctgatttacgaacacttccgaggggtc
+gtaaaacattaaactggtgagaacagtatgatgtattcggtcatctagacaaccccatcg
+ctgggagtttggacagtgttatgattcgtaaatccaccatgtgtccgaattcgaaatcct
+gttgctccggggagatagggttaatttaggcttttttacggtgtggcatattagctcaaa
+catcaacattcttaaaatcagcgtaaacggtcaccagttgatatttgttctgctaggaag
+cgatgtacaaaataagcttaataagatttaggtccgaccttaatttcggtccatagcacc
+tctttctaagtgttttgcttaaataattgtattgttattgattttctgcgagttgaacac
+ggaaaataagtcaaaaaggacacttttaggttcatatgtaccgatgaatgcgcaatagaa
+tcgagaaatttttagattagtaatcgtgatgattgtggccaaatcccgcactaaacggct
+ttcgctgtttccaaaaaattttagtccactaggtatttaaatgttggacactgaacgtgg
+aagccgtcgtattatgaaactaatggcagaggggctcctctgcgtgtactttgagcagat
+gctatcgtcagaaaaaggtaaatcttttggttctttataattctggcgtccgtgtagcct
+agtgaatgtgtttggttcaagtgaatttgtttagccagaatggaccaattacgtcattag
+ctgttacgtctatacgaaatatagactgtggacgacccatcgtagagtcatgtagttaca
+tgtgaccttagaacaccaatcgtgtgcgattgtaagcaggacaacacagtattgtactgg
+tcaattggttcatagatctgactatgaatcttcgtttttgtacaacaatctcggtgaagc
+ttcaaaaagcctccttcctaataatcagttaatttttcgtaaggttcctgttcgaggtta
+gtcgtataaagacgaaacggccttaatgtaacattaactattccactgtaggtggatcta
+acaaggttggacatgtgctaccaataagataagaatttcgtccgcaatacaatatctact
+tttgtagcctatcttggattaacaacaacttacgttggtatttcaccggacgtatcaaat
+gattctgattttaatgactgagagtaaacatcaacgaatcttatgtatctttaagccgct
+gcttgacaagtcacattactgttagaatgaacgcttcattactacaaaacctaccaccaa
+ctcccacattaatattatactagatgtttgaagtttatttgacaaaggttttcaaaaagc
+acagaatcgttacgaacacgtacattaaattgttagggtattaattgtggtcggtgcatt
+tccggccccatagcgctccgcggggagaaactatggccttcatgacagcccccccataac
+atctaggtaatggtcggataactataaacaaccctctccagagaactgtgaaaataaaat
+ctcttagtacacaagcgtatactggtttaagtcttgcccatcttaaagactcttttcact
+attttcttgatgcctcattcttctaatattaggtgattttttaatccgagaatataaaaa
+gacgatagaaagtgttaaaacacggcgtagcgacatattttaaagaaatgaaatactttt
+tgactatccctcatgatctaaacttacgcggagctatctttttgtataacatgtacagag
+aattaatccgatgcttcttccgattaaggacatagcgccgaaaacgtcatggcggcttat
+cgatatcgtaacgcactataccaagtgattaagtgatcaatgaatacgggtttcgggatt
+tctgttaagtcatgcacggcaaatacttggagtcttgaataacgccgcgcgtagtacgaa
+ggttctcaagctcgcgtgacgtatagaccgtattgctatttcctgccttctcaattgtcc
+gaggattgctgataacttaaaataaggttgagtttttaataacgatttgtcgagtttggg
+aaaatcctcgtttgtgtgtttgtcattttcaagttatcaagaactacgggtataatttac
+gacgtaatgttggtttgatgcccgattgcgaatatcgtacgaatggtatttgtacaactg
+ctttcctttatcgattgctcgagaacattataaagtctattactatggattaagactgta
+tacaagtgtttaagcggagcccgtgataatctataaggttttggtacctttatctgttac
+ttttgccttgaaacatacatacgtacacgggaatatttacctaaacgccgtatagtccag
+cctcgtatttgggccgtgttttgtcagcattttaaactgaaagcgcccacttgcattata
+acccggtgcggaatctcttagtgactcgtcaggagtttacgcctttgagacctctcgaca
+ggacccattttgatctagtcgttataggtagagtgcctttcctatcgcaccattaccttc
+tagcaaacttagagtattcaatgaaatcatatcctgtttatactaaatgttataggctaa
+tgacacagctgacactaagaggtctcttcgggttacccgaatgagttgtttatacgatgt
+tgacaactcgggggagtcatttcaatgaagactgaggactcttgatcagattaaaacgct
+taatgactgataatttagattatgccgtgtattatttaagtgggcgaaccctcccctaga
+atgggtttcctgagaaaagtcttagaacacagtattctgaatccagatgcaaatcgctaa
+cgttagtaagcggctgtagctcttggcagtttggtcaatagtcaatcgcaatccgtttaa
+ccgtctactattcctagagcgaagagctatgttctgacacgtccccaatattaggcaaag
+gctccaaaagaacagtcaattgattaactacgggcttggtttctccgtgaatccttgcgc
+cgctataccacataaaaggatagcggtgataccacaagtttgcgacgttaaagcgtcgac
+cctcaacaagtacactagcaaccccttagcaattaattttgtccatcactactgccaaga
+gttgactggaccagttggaaatgacatttgatatattaatagagctacatattgtaccac
+tttactgtcacttacactaaccctagcgtgattactcatacatatattcgtaaattctaa
+gttatgatactagttttgtaaatttaatcggcgaagacacgttctcttgtacgagcttca
+actaaatatttcactgtagccaaccactttaaccagaaggataccttaatgccgatataa
+tattgtccaggaaacgttaatactttcacaagacaaagcttggaagaggtactttacgat
+cacctgatagatcgaccggaacgattctatataggtttggtctgagaaatttgtagctaa
+aaccatgttccataggaactcctctgtaatgggcaaaatgcagatagcgttcaatcgttg
+cttaactatctatcacagcatcctaactcctcaacagcttctttcctaaagacatcagca
+ggtaagttgacggcacccgataacccagagcacgattggaatctaatactctgtatggat
+cattacgctaagtaaatataatgattttctgactcaaagttacactgcgaattttatatt
+aactggttctatttgttaaataccacaacctctcgtcaacaggtcgcgatgcaagtgatc
+caaaaatatctaacttataccaaccattacttctggcgcagaaaaacatagatatctgaa
+caatcgaccgttaagactgtctcgccgatcttaggaacctaatactgctcagtagttatt
+gtttatttgggccatccccggattatgtcagccatggaacactaaaagtcctaatctaac
+ctatggacaaaaagctcacttttataaaattgctcaccttatgttgattgttatttgtcc
+gaaatgtctataactcagtgtactatctattggaaaattatggccggagttttattgaat
+atacttttgtatgttgagaaagaatgttgtcgtaataattatcagctggaaaatcatcta
+atatatattatattgagatattacgacagacctaagtgctttcccgtcatgagcagatgg
+actaacactcttggtaatccttctcgttttagttggtaatgtttagtctaagtaatatcc
+cgactcttacttactcagagcggaaatgactttttaaactaacgtttaaaggcacttagt
+atgcgtcagggttatttttttaattacgtacccttgtgcagagagtttagctattcgatc
+ctacttagtatgaaccatgagagtacaggttggtaattcacagagaaggtcgagaagatt
+atttttgatgtttaccaatactatgaggcgtattcatcgaaataattttatggctgcgca
+cttcacatacgcaggaagaccactgcagcttgctagatctggatgtatcattgtacttct
+aagagcctgaaaggtaatacattcccagcgagcgtaacagattgtatggggacatattca
+atcttagcaatgcattcgttcttcgaaatcaggcatttttgatgtcataagttctgtcaa
+ctataaccctggaactttaatctgttgttcgtcgaatcaaggatcaagaaagcttctaaa
+aggcccaaagcaaaacccaccactacttcagttttaaattagaatcacaccctagggtat
+tagataataattaaatgtcttaggaagagatatcaaaagatgcagacatcctcaagtgaa
+taagtctccggtctttcacaaacacatggttaagcgatgtggttttgactagagacgttc
+gccaccatcgtaatatttctggttacctgcgaacgtgaaccaaatcttacttcatacatt
+gcttaaacagtacaacttatctcttatcctatagagatctcaaaagtttgtatttttact
+ggtttcaaattgagagaaaaactgcgttctccgatttctatattattgtttaaatgatgc
+caaacatccagtttaaaacacggtgtgatcagccgactcagattcgtatcctatgttaga
+atgagtcatcaaactacggtcacgcgtacattacagagtaaactacacgaatgaaagaga
+taagaagatgaaagagttaataggtctcctgttaattatgagaaccctaactactacgga
+ttggcctactagtgggttggaacggatataaaattcgactaagttcgcggcatgtcaggc
+tcctaaatatgaagagaactcggcatcgaattatccacagtaatagttggaacatgattc
+ctctatgcatggtgtatatccacgtacgccagtgtgcagtgtagccatgcgaccacgggc
+gttgtgaatattcttcctcagaaaaggactgttgagcaaggaattggattctgtgaacgg
+aatatagtcgagtagatggaatttcctacactgcgaaaaggtcatagtaaatcaaacgcc
+gcgcgcagacatatcttcttggcaattagtactccactaaatcaattggttataaacttt
+tagaatatctttatataagttcactacttacgctgcgggtagtatatttaaagtgatgtc
+ttaggaatcttatggcggcggaataaacggcttgactatagataccctaattctggcata
+accctgtaacgtgtgaagcatgctttaatagacgactagatcagcttatagaatggatat
+gactgccacattgaagagattaacattagcgggtataatgttacgaacttgtttaacaaa
+atagctctaccacacacgcatagtataatataaaggtcctggagttcgctacgagcctgg
+aattgcagttcccctaccctgagtaaacaagatcagtatggacctatcttctgacccacg
+tgtaaaaactaccgttagcggccctgagaacggtgaagttgattatcggctaacactcgc
+tttaccaaggaacaaacaattgatggaacaggtaagcggctggattctatcctgaataca
+gcataataatatttgctttcaatatatagttatgacactcccaatatcactaactcttta
+caaatcggatatgaagagtgaattagagatggagccgatcgttccttgtattctggtaag
+tactcgactaatgtgtgtagtctaggggtaaaggtccttaaccgtcgagtctagaactca
+cgcattatgaaatcctccgagcatagagactctaaattcgccaagcaataagtcccgacg
+cgaaggatgagaagctcattgaactgtaacatttacgtcgggctcaccatgttacatatg
+cagcgggtaaaagtttttgcctggagtggttgagtttcgcgatacataaaaggccccact
+ttcatatggtcaaatatctatatcgtgctttggacgactcgataaactaaagtagcctag
+taatgccctaaaccgctgcatttgtgcaataaaaaatttagagtatatataacttccgga
+cgtatggctgccttgaatcctcggatatcgtccttatacaacgatgaacggtatagctcg
+gaactatgcagattaggcgatccttgggttgaatttttagtttccatagatatgagttag
+ttttgatatggttaccatacgtccctgcattgaaacttaatctgtatattgattgatcct
+tagcaatagcggcacatttctgggcaatatgacttaattaggttacggtttttactatga
+tggatacgttttatatgatagaataacagttgctatttaaacaggtactacattcaacta
+atactgtttcactattgtgtccaacatagggaatatattgcctgaatagatgtattatca
+ggcatcttttacgctccaggtagaactaattaaaaatgatccttagaaactttcaagcaa
+cataagctaaaagttacgccaattataagccacatcggtaggatcttcaggcattcccat
+atccttctctatcaatcccgtctgttgctaattggttatctaagcatatcgcggcgagca
+tctacgataggtataaagttgctgctatctaattcgtcataatatatacatggaattaca
+gattcatacgtcttcagtctcgtggtgtttctaagagcggacccaagaattacgtaatat
+ctctctcgtgttacccaagaagttgacacgtgattgtcagctatctttttctggcgatgt
+taatagttataaacaattgcatatagctgcaaattagctaatcaaatactcgtttcttaa
+atgttatcagcaaagctttaggttctgtaatttcactgtgtaaagagggcgctaagttca
+aaattggtttttggcaacaaacaatttaatagcgcagtgcaaaaataatatctcagggtg
+taattatttctctaattggtctttacggttggaccaggcaatgggttttttatctatgtg
+ataccaattaaaagtaatttcaaagtgacattaaacttaagtattgctgtcaagaccatt
+acgacacttcaccaacacatttatgtattgtgctacgcggtatggcccgtagtaatttct
+gatattgaccgcgttatcagcaagtacgctgtacaaatgccaaatttagtaaagctctgt
+gtgcattccaaggtgcccacatcacacattatcaacatatcatgtcgttgtattacgtcc
+ttttactagcctgggaaataccggtgattcagagtgaacataaatctctgaaagctacta
+gacaaagctagtatagttaaaatatatatttcttttaatattaggatctttgcgattgca
+catttcaagcatcgcattaacctacctccgtactcttctacaacggttgcatgtacgatt
+tctatgcgatgaaatacttatgttcttagtttggggttactttgttcacctagtcctcga
+acgcaaattagcttcgaatatctgaaaagtgtatgcgggcaccaaaacgatctcgattct
+taggtttataattatagtcagaagataaatacatgcatatctggacactcttccacatgt
+catgtcgactaactttgaactacagtcatatatagactgttatctgatccgtatgtgtct
+attactactcttatctgagaaaggacccaatggagtcacagtaagcgatcatgtcatcgg
+ggctttttccctgattataagattacactattgctgtgcttggggcctcctactttttct
+atcttaatcattttgtacattaaaaagctaagaagtaggtacaacttatctttcccatac
+gagctggaccattaatttaacagccgcaaggcgagttttaatgttaatctggaagggctt
+tatgttctaagcttttagcactgagaaattaatccgtaggaaattaatcccacataaccc
+ggtaagagaaccttacgccccgttactaataatgttctgcgcaatgtaggaagtgacaag
+ctcactcttgcgacgagctccttaatacaggccctgcgttatattcgaccgtacctataa
+ctagaccaccatcttaaatgtacagttatggttttcgacgcatagagtatgggaccacct
+cgaaatgctcagctgcaaattgtactgggggtggttatcaaacatttaatatgaatctat
+ggtaaagtactagtttatagatagccgaacactaaaggtttgcagaccttcctcccctga
+ggaacttcgtgtcacaaattagattgagaaggtggtgataaaatcgcgtatctacaatga
+tttggtgcaaatatttatcgattgcccaatcgttctactcgtactctttatagcctaacg
+ccttttcttggcgctaattagcctaatccaagaaggagtctaacaaaattacttaaccat
+actcttgtctattcggcccacgcatgcgcaagctcaaaaagttctcaacgggcgttttta
+cttgagtcccaggaggtaacattggatctatgagtcttaacagtggaaatatgattttta
+gattgtgttcagatttattgtcttattttggtctatctcatcagctatagctacataatg
+acgtcttaactgtttcgactaaccttcagatctgactaccccaaatacaacatagcaaaa
+gaatgatgctaacgcttaactatcctttcacgatcttaacaaaaaagctccatttaaaag
+aatcgaaaacagatctaccattcgtggaatcaatttttggacgagtactggtcgggtcgt
+gcttatttgctacaggattgtttcgtataacgttcaagcactttagcggttccatccttg
+atggcgttaactgatgatgcgtaagtttatggtgatctaaaactctactacgaaccaggt
+cccagcacgaaacgtcatctttaatgagtttttaggtctccaggcactaggctgcgaagt
+ggaatatgtgtcatcagagacaaatagatgattcctatagctttttgcagttaagccact
+aagtaggcggttctatagggtttcattcaaatcgatcgtaattcccgactctgcatagcg
+tgggtcttgtatagaccattcttcaggcccgccacaatggtttcaagtttcaacttccgt
+ttattggctgtccctcaatagagtcgttctcagggcacgactctcgttcgttattcataa
+gtccagtttgatccacgaatacagaacacgcatatctgataataaaagcttaacgataac
+tttcacgcgcatggtttatttttgatttattaggcaaccaaataccagaatgtagtcagc
+gatatgtagtaaaatttagacaaacataaaacaaagtatcgccattacagtctcctgtta
+ggagaacctttttatcaatatgtgtaggcgtgtattggcgcccttgatttaataataatt
+acggctaaacgtattgatattttccaggaactgccccatctcatgagatgaccctaaatt
+ttattcacacctcatttttaattcttttatatcacgattatttatctgagcaagcatctt
+tgcaagcattcatagtgacggtgctgtctctatgaatgcatgctaatatacggtgcgcta
+aacatattggttcaattcaatgtaagctacctcggaatttgcttgcactaagacggggaa
+gccaaaacggtaaatcgccgtatatgctagtgccaagggacttgtccgttggagtcacta
+tggagttacaagcattataaatctaaggaaatcgcagtatcagtccttaccccaaagata
+cttcgcattccctggggtacggaccatgaaatacttctttcatacatgataaacgatgga
+gactcggttaccaccctggtagttactccatcaattggagttaactaagatcgctattac
+aggctttattagccaatcatcacaagcctctttttagagattcacaagttagcaaaccaa
+agttcctttgataagtctttaacgagatctatcccaattccggctaggagtaaaatttat
+atatttgagatcggggttaaagtcacacgcaatgcaaggggtttttatatggtaatgtcc
+ttccctaattaggtaattttcagacctccgagagagagtagatcaacaacgcgttatact
+cctaaaatgcttgtcgataacatgacactacagatcatccctggatgagcatcgactttc
+attacttgattagttcagttaattcgtttcaaaccattttcaacaaaatcccccagtaga
+tatgtatatgcacatcttagactaaataacagttttcataccctgggatttgtgtcacta
+tctcaggaacgtcgagacgtcccctatcaccgcagcgagggtaactggccctgttccatt
+gtaatcgatgggacgggacgttatattgcagacccaaagtagtaataaattcagccatat
+ggacggagggggggaattgttaagaatataattcgattttcagctgaatgtaaaagctcc
+agccattcctcctccacttgacattagttcgaagaaggtctgagaattggaattgcttgt
+gacgttttttgtttccagacaaggaaatagcccagtaccaagtataatattatgacaata
+gaagcttaaattcacaacgtaacatatctgttagcatgctctaatagaccgagaaaataa
+gtgtctatgtgtgcgagaactgtcaattcacggcagtagtcacctaatctaacgtctagt
+tcccgactatgaagtcttcacaaatggttagtaataatttcccagtggagtagaagtggc
+ataacgtgcactctctgttaataatacctttagactactcccatttcgccagaacgtctt
+gatggtaccctatgggaaacactcacacatgcttattgcctgcaacctcagcaatgtgtc
+gtatgcggtatttctacgaacagctagtgaaaggactgatgacctaattttggtttctca
+agtccagacgtgatattttgatgaccgtatctgacatctctgggcaattcggttaacctc
+tggtacgaaatagtccgtcgcgtaggtaaaaatgataatgctgtcatcactatcatgttt
+tagctaagctacactaccccatcgctcgcacgtggcaaagtgtgaggattccgatatcat
+ccatgtgtacgaattcctaatactcttgctcagggcacttagggttattgtagcctgtgt
+taccgtctcgcatattagatcattaatcaacagtcttataatcaccgtaatcggtaaaca
+gttgttatttgttctgataggtagacagctaataaagatgctgttgaacagttacgtccc
+acctttattgccctacagtgaaactagttcttactctgttgctgtaatatgtctagggtt
+attgatttgctgccacttcaaaacggaaattaagtcattaacgaaaatggttccttcata
+ggtaaagatcaatccccaattgaagccagaaattttgagatgtcgattcctgatcattcg
+ccaaatttacagctcgtaaacgagttccatgtgtaaaaaaatgttgagtccactagcttg
+tttattctggctcaaggtacgtggaacacgtagtattttgatactaatgccagacccgct
+acgatccctgtactgtgagcagagccgatcctcagaaatagctaaatcttgtgcttcgtt
+agaagtctcgactacgtgtagcctagtgtttgtgttgcgttatagtctatttgtggacac
+agtatggtcaaatgacgtcttttgatctgacggcgttaacaaagatactctgggcaacac
+acatacttctctcatgttgtttcttcggacctttcataacctttcctggcacatggttag
+ctgcacatcacaggattgtaagggtctagtggttcagtgagcggaatatcattcgtcggt
+ggtgttaatctatctcggtgtagcttataaatgcatccgtaagaatattatgtttatttg
+tcggtacgttcatggtagtggtgtcgccgatttagacgtaaaggcatgtatggatcttga
+tctatgcaaaggtaggtccatctatatacgttgcacagcggatacaaataagataagaat
+ttactaacatttaaattttcttattgtcgagcatagattggaggaaaaacttatttactt
+ggtatttaaacggaagtttctaatgtttatgattggatgcacggacagtttactgcttac
+tttcttaggtttcttgaacaacaggatgcactagtaacatgtctcgttcatgcttccatt
+aagttcttcttaaacttacacaaactacctaatttagagttgacgagatggttgaacgtg
+ttgtgacaaacgtttgcaaaatgcacagtatcgttaccaaaaagtacatttaagtgtgtg
+cgtaggaattctgctacgtccattgcaggccacattcacatcccacccctgaatatatgg
+actgaatcacacacaccaaatttcatctaccttatcgtagcataactattaacaaacata
+tacagacttcgcggtaaataaaatatattagtacacaaccgtatactggttgaactattg
+cccagctttaagacgcttttaactaggtgcttgatcaagaagtattattatatgacggca
+gtgtgtaatacctgaatagatatagacgttagattgtctgaaaacacgccgtagagacat
+ttttgttagatatgtatttctttttgacgagccagcatcttagtatctgaagacgagcta
+tatgtttgtagaaaatcgactgacattgtatacgaggcggcgtaagattaaccaaattcc
+ccagaattagtaatggcgccttatcgatttactaacgatatataacttgtgatgttgtct
+gcaatgtatacccgtgtaggctgtgctcttatcgaaggaaacgcattgaagtccaggctg
+gatgaaaccaccgcgtacttccatgcgtctatacatagcgtcaccgatactacgttttgc
+tatgtaatccattctaatgggtaagaggattcctcttatagtaaaatatgcttgactttt
+taagaaccattgggagtggttggcaaaataatagtgggtgtctttctcagtgtatagttt
+tctacaactacccctattaggttacaagtaatctggctttcttgccacttggcgatgata
+gttagattcgtatttctacaacgcagttactgtatccatggcgcgagataattagatacg
+atttgaatttggatgtagactcgttactactgttgtagaccagcacgtgagtatctagat
+gggtttgctaccttgttagcggacttttgccgggaaaaagacatacgtacaaccgtatat
+tttactataagcagtattggccaccctcgtattgcggcagggtgtgctcacctggttaaa
+atgaaagagaaaaattccattttaaaacccggaggaatctattactgacgaggaaggtgt
+ttaacccgttgagacatctcctaacgtaaaaggttcatattctagttattccgagagtca
+ctttcctatccaaacatgaactgatagcataatgacaggttgaatggaaagcatatcctg
+tttattctaaatctgtttcgctaatcaatatgctgtcacgaactcggagcttacccttac
+aactatgtgttctgtttaccaggtgctaatatcccggcactcttttcatgcatgtcgctc
+ctagcgtcatctgatttaatagcttaatgtctcatattttacagtagccagtgtagtatg
+gaaggcggcgaaccagcccctacattgggtttcctgacataagtattacatatcacttgt
+ctgattacacagcaaaatcgctaaccttactttgcgcatgtagctattggaactttgggc
+tagtgtctatcccattaagtttaacagtagactagtccgtgagcgatcaccgagcttatg
+tctcgtacccaagttttggatttggatcaaaaactactcgatattcatgatctacgggct
+tcctttctccgggtatcattgcgccgagattaaaaataaaacgatagcgctgtgaaaaca
+tgtttgacacgggatagcgtagaaactaaacaacgaatagaccatccaatttgaatttta
+ttgggtccagcacttcgccatagtgttgaatggtaaagttcgaaaggaaatttgttatat
+taattctgctacattttcgaccacttgtatctcaaggacaatatcccttgaggcttttag
+cagaaagagatgccgtaattctaagggatgataataggttgggaaatttaagagcagtag
+taacggtcgcgggttcgaccttaaactatatatttaaatctagccaaacaagttaacaac
+aaccataaagttatgaccttattatattggcaagcttaacgttttaattgctctagtaat
+agagtggtagaggtaagggaccatcacctgattcttcctccgcaaccattatatagacgt
+gtcgtctgacaaatttcgagataaaacattcgtccttagcaacgaatatcgaatggcaat
+tagccacattgagttaaatagttgaggatatttcttgcacagaatcagatctaatctaat
+gattcgttactaaacacttcaccaggtatcgtgaaggctcaagattacccagagaacctt
+tgcaatataagaatatgtatgcagcattaccctaagtaattatattctttttctgactca
+aagtgacaagccctagtgtatattaaatcggtatatttgggaaattcctcaaactatcct
+aatcaggtagccatgaaagtgatcaaaaaagttcgtacttataccatacatgaattctgg
+ccaagtaaaaaatagattgcgcaaaattcgtaccttaagtctctcgccaagatattagga
+tcctattactcatatcgtgtttttctttattgccgccatccccggagtatctcacccatc
+cttctcttaaaggcctaatattacctatgcaaataaacatatattgttgaaaattgagaa
+cctgatcgtgattcttatgtgtaccatatgtatagtaatcacgcgactatatagtgcttt
+agtatcgcccgtgggtgagtgaatattctgggctagcgtgagatagtttcttgtcctaat
+atttttcagatcgaatagcttctatttttgtgtttattgacatatgtcgaaactccttac
+tcagtgaaagtcatgaccagatccacgaacaatcttcggaatcagtctcgttttacggcg
+gaatcttgagtctaacttatatcccgtcgcttactttctaacaccccttatgtattttta
+aaattacgtttattcgaacgtacttggcggaagcgttattttttgaagtaagttacattg
+ggcagactcttgacattttcgatacgactttctttcatccatcacaggactcgttcgtat
+tgatatcagaagctcgtgatgattagttgtcttctttaccaatactttgaggcctattct
+gcgaaatttttgttgccctgcgaacttcacataccaaggaacacctcgcaacatgccttc
+atatccatcgttcattgtaattcttacacaatgaatcctaagtaattacatccctgcgta
+aaagatggtaggggcactgaggatatattaccaagcatttagttatgagtaatcagcaat
+gtttcttgtattaagttctctaaaatagttacatcgtaatgttatctcgggttccgcgaa
+taaacgagatagattcattatatatggccctaagcaaaaacctcctcgtattctgttggt
+aattagaatcacacaatacgggttgagatattaattatttgtagtacgaagagatataaa
+aagatgaacaattactcaagtcaagatgtatacgggatttataataaaaatcgggtagag
+atctgctttgcaattcagacgtgccactaaatcgtaatatgtcgcgttacatcagaaagg
+gtaactattattaattaataaagggcttaatcactacatattagatcttatccgatagtc
+ttatctattcgttgtatttttaagcggttctaattcagtcattatatcagtgctccgagt
+tctttattattgttttaaggatgacaaaatgcctcttgttataacgctgggagaagcaga
+ctaagagtcggagcagttggtagaatgaggctgcaaaagacggtctcgacgaatggacag
+actttactaaaccaatgaaagacagaagtagagcaaagtctgaagtggtatcagcttaat
+tatgacaacccttaatacttccctttcgccgaatactggcgtggaaaggttttaaaagtc
+gaagtagttagaggcatctctcgctcataaataggtagactactcgcaatccaatgtgac
+tatgtaatactgggaacatcagtccgcgatgcagcgtgtttatcaaccgtccccactcgc
+ctggggagacatgagaccacccccgtggggattattagtccgcagtaatcgactcttgac
+aatccttttcgattatgtcatagcaatttacgacagttcagcgaagtgactactcggcga
+aatggtattactaaagcattcgaacccacatgaatgtgattcttggcaatttctaatcca
+ctaaagcttttccgttgaatctggttgtagatatttatataagttcactaattaagatca
+cggtagtatattgatagtgatgtctttgcaagaggttggccgaggaatttacggattctc
+tattgatacaatttgtctggcttataactcttaaggctgaaccaggcgtttttagacgac
+ttgatcagctgttagaatggtttggactccctctttcatgtcagtaacatttcagccgtt
+attgttacgatatgcttgaacaatattgatctaccacacacccatagtatattttatagg
+tcatgctgttacctacgagcatggtattccacttcccattcaatgagtattcaacatcac
+tagcctcagagatgatgacccacctctaataacgtcacgttgcggccatgtgaaacctga
+acttgagtagacgatatcaagcgctttaaattgcatataacatttgagggtaaagctaag
+cggatgctttatataatcaatactcaataataagatttgattgcattttagagttatgac
+acgacatagttcactaacgagttactattcccagatctagactgaagtactgatcgagac
+gatccttacgtcgatgatcgttagttatcgacttaggtcgggtctctagcggtattggta
+cttaaccggacactatactaataacccatgatcaaagcataacagaatacagacgataat
+ttcgccaacatatatgtacagaccccaagcatgagaagctcattgaaagctatcattgaa
+gtcccgctcacaatgtgtcttttccagacggtttaactggttcccgggagtcctggagtt
+tcgacttacataaatggaaacaatgtattttgctaatttatctatagcgtcatttggacc
+aatacagaatattatgttgcctagtaatccactataacccgcaagtgctgatagaaaatt
+tttagacgatttataaatgccccaagtatccctcccgtgaatcctccgttatactaatta
+gtattcgttcatacgtataccgcgcatatatgaacatttggcgataaggcgcgtgaattg
+ttacgtgacagagatagcagtttcttgtgatatggttaacagacgtacatgaagggaaac
+tttatatctatagtgatgcttccgtagaaataccgccactggtctgccaatgatgaagta
+tgtagctttaggtttgtactatgaggctttcgtttgtttgcagagtataacagttgcgag
+tgaaaaaccgacgaatttatactaatacgctttcactattggctacaaaatagggaagag
+tttcaatcatgagagggagtatatggatgctttgtagctaaaggtagaacgtatgtatat
+gctgccgttcattcttgaaagatacataagcgataagttacgacaattataagcaacatc
+cctaccttcgtaacgatttcactgttactgcgcttgaaatacactatggggctattggcg
+gagagaagcagatcgcgccgagcatatacgagacctataatgttgatgatagagaaggcg
+tctgaattgatacatcgaagtacactttctttcgtagtatctctcgtcctctttctatct
+ccggacacaagaattaagttatatatatagagtcttaccaatcatgttgaatcctgattc
+tcagagttctttggcgggccttgtgatgactgagaaacaatgcaatattgctccaaattt
+cctaagcaaattctcggttatgttatgttatcagcaaagcgttacgttatgttatttaaa
+tctggaatgacggagcgaagttcttatgtcggtgtgggaataattcttttgaagacagca
+ctccttaaataatatcgctccgtgtttgtatttatcgaatgggtctgtaaccttgcacaa
+gcaaatcggtggtgtatatatcggataacaattaatacgatgttcatagtgacagtatac
+tgatcgagtcctctaaagtcaattacctcacttaacaatctcattgatgttgtgtcattc
+ccggtatcgcccgtagtatgtgctctgattgaccgagtgtgaaccaaggaacatctacta
+atgcctttgttaggtaagatctctctgaattccttcgtgccaacttaaaacattatcaaa
+atttcttctacttggattaactacttttacgagcatggcaaattcccctgtggaagacgg
+ttcattattatcggaaaccttatagaaattgcgtgttgactgaaattagatttttattgt
+aagagttgcatctttgcgattcctctggtctagcttccaatgaacagtcctcccttctat
+tcgacatcgggtccttcgtacatgtctttgcgatgtaataattaggttcggagtgtggcc
+ttaatgggtgcaactaggaatacaacgcaaatttgctgacatgatagcaaatcggtatgc
+cggcaccaaaacgtgctccttgcttagcttgtgaatgagactcagtagttaaataaatcc
+atatctgcaatcgattccacaggtattgtccactatctttgaactactctaagagataca
+agcttagctgagaccgaggtgtatatgactacgctgatatctgtaaggtaccaatgcagg
+caaagtatgcgagaagctaataccggctgtttccagctttataagattaaaatttggctg
+tcctggcggcctcagaattgttctatcgtaatcagttggttcattaattagctaagtacg
+aggtacaacttatctgtcccagaacagctccacaagtttttttacagccgaaacccctgt
+gtgaatcttaatatccaagcgcgttatctgattagagtttacaactcagtattttatcag
+tacgttttgtttccaacattacccggtatgacaaaatgacgccacgtgtcgaataatggt
+ctgaccaatgtaggaagtgaaaagataaatattgcctacacatactgaattcaggcaatg
+cgttttattcgaaaggtcatataactagaaaacatgatgaattcttatcggatcctttta
+ctagcatagtgttggcgaacacctcgtaatgctcagcggcaaattggactgcgggtcctt
+atcatacattttttttcaatataggcgattggtctaggttagtgattccccaacacttaa
+ggtttgctgacattcataccctcagcaacttcctctcaaaaattagagtgagttggtggt
+cttataagaccgttgattatttgaggtggtcaaatgatggtgcgatgcacaaatcgttat
+aatcgtactctgtagacaataacccattgtagtgccgattttgtgcataatacaagaagg
+aggatataaaaatgacttttcaataatattggctattagcaacaagaaggagaatcctca
+ttaagttagcaaccgcagggggtactgcagtccaaggaggtttcattggagagagcagta
+tgaaaacggcaattatgattgtgagattcgctgaagattgtgtctctgattttcctagat
+agaataagctatagctacttaatcaactcttaactgtggagactatcctgatgatctgaa
+taccccatttacaaaattccatatcaatgaggctaacgcttaaatttcatttctccatcg
+taacaaaaatcagcctttttatacaagacaaaacactgcttccattacgggtagcaatgg
+ttgctcgactactggtagcgtcgtgatgtggtgataaagctgtcttgcgtttatacttaa
+acaaattttgacctgacataatggagcgacttatcggatgttgccgatctttagggtcat
+ctattaagcttatacgaaaaagggacaagcacgttacgtaatctggtaggactgggtacc
+tagaaacgcaagaggaggcgaactccaatatctgtaagaacagaaaaatacaggagtcct
+tttcatttttcaagttaacaatataagtaggagcttagagaggcttgcatgaaaatcgtt
+aggaattacagaataggcagagagtggggcgtgtagactacattcttcaggccccacaat
+atgggttataggttaaactgcactttttgcgatctcccgaaatactgtcgttctctgcga
+accacgctcgttccttttgctgtagtccacgttcatccaactattcagataaacaagatc
+gcagaattaaagcttaaccatatcttgatagcccatcgtgtatggggcatgtatgtgcaa
+acaaaagacctcaatcttgtctgcgagagggaggaaaatttagacaaacataattcattc
+tttcgactggacacgctaaggtttggacaaactttgtatctatatctggaggcctgtatt
+ccagcccttcttttaataagatttacggcttaaactatggatatttgccaggaaatgaca
+ctgctattgacaggaacataattttgattcaaacctcattgttaattattttatatctcc
+tgtttttatatcagaatgcttctgtcctagaaggcatactcaaggtgagggctcgaggaa
+tgaatcataatagaccggcccctattaatattggttcaattctttcttacataacgcgga
+atttgattgcacgaacaccgggaacacataaccgtatagcgcccgttatgctagtgccta
+gcgactgggaccgtggagtctatatcgtctttctaccattattaatctaaggatatacca
+ctttaagtcctttcaactaacataaggcgcattccatgcgctaaggaccttgaatttatt
+atttcttacatgataaaagatcgagtcgacgggaacaaaaggctacgtactcaataaagt
+gcagtttactaagagccctttttctggcttgtggagactatcataacatgaagatgtttt
+gacattcaatagtttgcaaaacaaacttactttgtgtagtattgaacgagatctttccaa
+ttgccccatagcaggaatagttatatattgcagatcgcggtgtaacgcactccaaatcca
+tcgcggtgtgtgagggtaagcgacttaaagaattacggtttttgatcaaagcacagtgag
+agttgagcaaattacagttatacgacttaattcagtctccataaattgaaacgacacttc
+ttaacgggaggaccagacacgttcattaagtgaggagtgcactttttgactttaaaaaca
+tggtaatcaatttaaaccacttgatatgtatatgaacagatttgaagttatttctgtttt
+aatacactgggagttctgtcaatatcgcaggaaccgcctgacgtcccctatcacacctca
+gagggtaaagggacaggggaaagggtaatcgaggggtagggaacgtagttggcacaccca
+atggacgaataaatgctgccatatccacggagggcgggattgcggttgattttaaggcga
+tggtaacctgaatgtaatagatcatcaaatgcctcctccactggaaattactgcgtacat
+ccgctgagaattgcaatggagtgtctcggtttttctttaaacaaaaccaaattgacaact
+tcatagtataatttttgcacattacaagcgttaattaacaaacttactttgctgttagct
+gcctatatttgtccgacaatataactggatatctctgcgagaactgtaaattaacggcac
+ttggaacataatagttcctattggtaacgacgttgtaggcggcaattatccggtggaaga
+attgacaactgcagttgaactgcatgaaagtcaaatctctcgtaagtataactttagaag
+actccaaggtacccagaacctcttcagcggacacgatcgctatcaatcaataaggattat
+tcactgaaaccgctcatatctggaggtggacgtttttcttcgaaaagcttgtcaaaggac
+tcatcaaatttttggccgtgctaatcgacacacctgttattttcatgaccggataggaca
+tctcgcggaaattcgggtaacagctgggtagatataggacctcccctacgtattaatgat
+aagcctgtcataactagcttggtttaccgaagagacaataaacattcgagcgctcgtgcc
+aaactcggtgcattacgtttgaataaatcggtaacatgtactattactctgcctaacggc
+acttacccgtttgggtccatggggtaaccgctcgatgttgacagaattatgctaaagtcg
+tttaagatcccgattaccgaaaatctggttatgtctgagcattcgtacactgcgtattaa
+gatcaggttgaacaggttcctaacaaattttgtgacctaaagtgaaactaggtcgtactc
+tgggcatgttttatgtcgtggcgtatgcatgtgctgacacttctaaaaccaaattaaggc
+tttatccaatatgggtccttaagtgctaaacatcattcacaatttcaagacagattgttg
+gtcttgtcgattccgcatctgtcgccaaattgacacatcgtaaaccaggtacatcggtaa
+ttatatgttgactaaactaccgtgtgtattctggctctaggtacggcgaacaagtacgat
+gtgcttaagaagccctcaccccagacgagcccgcgtaggtcacatcagcagatcctaagt
+aattccgttttattgtcctgagggagtaggatcgacgaactctacaagtcgctttgtcgt
+gccttataggctatttcgggtcaatgtagcgtcaaatgaactattgtcatctgtacgagt
+taactaagtgtctatcgccaactaaaagacgtctcgatggttctttatgcggacctgtca
+tatcattgactggcacttgcttacatccaaataacacgtttgttagcggatagtcgttaa
+gtgtgcgcaagatcatgaggcggggggggtaatatttcgccctctacatgataaatgaat
+aagtaagaagatgatctttttgtggcggtaccttaagcgtactcctgtcgacgagttact
+actaaaggaatgtagggttctggatctatgaaaagcgacctccatatatatacgggccta
+agcggagtaaaataagtgatcaatggactaacattgaaatgttagtattgtcgaccattg
+agggctggtaaatcttatttacgggcgtgggaaaacgaacgtgatatggtttagcatggg
+atgcaagcactcgttaatgcttactttagttggttgcgggaacaacaggaggctatacta
+actggtagcgttcttgcttccattatgttattattataattaaaaataagacatatggta
+gagttgtagtcagggtggatcgggttgtctataacgttggaataatcaaaactatcgtta
+acaaaaacgaaatttaagtcggtgcggtggaatgcgcctacctcatgtgcaccacacatt
+cacagcacacccctcattataggcaaggaagcaaacaaaaaaaagttaatcgaccgtatc
+cgaccttaaattttaaaataaatagaaacacttagcggtaatgaaaagataggactaaaa
+ttcactagtatcctggaacgaggcaacagagttatctagatggtaacgaggtgctgcatc
+aagatgtatgatttttggtccgctgtgtggaatacctctattgatatacaagtgactttc
+tcggtaataacgcacttcacaatgtgttgtttcttttctatgtattttgcaagagaaaga
+agcttagtataggtacacctcagagatgtttcgtgtaaatcgtatcacatggtataactg
+caggaggaacattatccaaattcaccacaattactaatccacccttttacttttactaaa
+gatatattaattctcatgttgtctgaattgtataacccggtaccctgggagcgtatcgaa
+ggataccaattgaagtcctcgaggcatgttacaacacacgacttccttccgtctattcag
+acactcaacgagactaacttttcctaggtaatcaatgatattgggtaactcgtggcatct
+tatagttattgatccggctcttttgtagatcctgtgcgactcgtgcgctaattaagactg
+gctctcttgcgcaggggatacgtttattctacgtacccgatttggttactactaagcggc
+ctttcttcaaacttgcagttgtgacttacattcctatttcttcaaagcagggaagggtta
+cagggagagacttattgagatacgattggaatttccatgtacaatcgttaatacgcttgt
+agaccagcaactcagtatagagatccgtttcctaaagggtgagcggtaggggcaaggcaa
+taagaaattactaaaaccctagttgttaatataagaacgattcgaaacaataggattgcc
+caagggggtgcgaacatggtgtaaatcaaagagaaataggcattgttaaaacccgcacgt
+ttctagtacgcaagaggaacgtcggtaaccagttctcaaagatcctaacctaaaaggggc
+ttattctactttttccgacactcaatggacgagacaaacatgaacggatagctttaggtc
+tcgttgaatgcaaagaatagaatcgttattattaatcggtttccattatctatatgcggt
+atagatctccgagaggaccctgtaaactagctctgcggtttaactggtgctaatagaccg
+ccactatgttattgcttctagctcctagcgtcttatcatgttatacattaatgtcgcata
+ttggacagtagccaggcttggatggatcgccgacaaaaagaaaagactttccctgtaagg
+acttaactattacatataacttggatcattaatctgcaaattagagtaacggtctttcac
+cagcttcatattccaacgtggcgctagtcgatatcccatgaagtttaaaactagaattgg
+cagtctcacttcacagtgcgtatctatacgacaaaagtggtcgatttgcataaatatctt
+atcgatattcaggttattaccgattccttgctaacgctagaagtcacaccagagtaataa
+taattccagacacctgtgaaataatcggtcactacggatagactagtaacgataatacgt
+atagtccataaaagttgaattttaggggctaaagatattagcaatactggtctagcctaa
+tcgtcgatagcaaagggctgtgaggatttctcctacattttcgaccaattgtatcgatag
+gaatagttacagtcacgcttgtagatgtaagagatgacgttattcttagggttcttaagt
+cggggggtaatttaagaccactagtaaaggtagaggcgtacacagtaaacgatattttga
+aatcgtcaaaaaaaagtttacaacatcctttaagttagcaactgattttagtggcaacct
+taacggttgaattgatctactaatacaggcctacaccgaagggtacagataatgattctt
+actaccctaacatgatagagtcctgtcctatctcataggtcgacattttaaattcgtaat
+gagcaacgaagatcgtttcccaatttgcaacattcacttatagacttcaggttatttcgt
+gctaacattaagatagaatataatcagtcgttaagaaactattatccagctttcgtcaac
+cataaagattaaaaactgaaacttggcaagatatgaatagctatcctgctttaaccgatc
+gtatgagatgctttgtagcaagaaaagtgactagcacttgtgtttagtaaagcgggagag
+tgcggtaattaatattaatatactattaagctacacagcaaaggctgcaataatgttagt
+aagtagaacataaaggtattctccacaagtaataaatagtgtgagctaattgactaactt
+aactctcgcgacaagtgatgtggataagatgactcatatcgtctttttctgtagtgccga
+catcccacctggatcgaacaattccttctagttatcgactttgattacctatcctattaa
+acagatagggttgtaaagtcagaaaatgatcggcttgcgttggtctaccatagctagagt
+tagaacgcgtagatagaggccttttgttgccaacgtgggggtgggatgagtctgggcgag
+cgtgactttctttcgtgtccgaatttgtttaacatccattagattagatgtttgtgtttt
+gggtctgatgtcctaactactttctcagtgaaactaatgtcatcatccaagtaaaatagt
+ccgatgaagtctccgttttcggccgaagcttgtctataacgtatataaagtcgctgaatt
+tagaacacaccttatctatgttgtaaagttactttattccaaaggacgtgcacgaagcgt
+gagtgtgggaaggaacttaaagtcggatcactcttgtcagtgtagataagaatttctttc
+atacttcactggaatccggcgtatggatatctctaccgcgtcatctggtggtgtctgcgg
+taaaaagtcttgctgcacgagtctgagaaatttttggtgccatcacatcgtaactgtaca
+acgaacaaatagcatcaggccttcttatccagcgtgaagtctaattatttcacaagcttt
+cctaagtatgtaaatccctcacttaatgatgcttgcgccaatgaggatagaggacattgc
+atgtacgtaggactattctccaaggggtcttctattttgttagcgaaaattgttacagcc
+taatgttagagcggcgtacgactttataccagatactttcattagatatgcaaatatcca
+attaaatcatagtagtatcgtggtatggacaatcaaaaaagacccgttgtgatatgatgt
+ttttctagttcgttctcatatatatagatcaacaatgaataatctcatgatctataaccg
+atgtatatttatattccggttgactgctccggtgcaattcactacggacactaatgacta
+atatggcgcctttcatcagaaacgctaaatatgattaatgaattaagggagtattatcta
+attattagagagtagcagttagtctgatattttcggtgtatgtgttagccgttataatgc
+tgtctttttatcagtgagaacagggagtgtgtagtgttgtatgcttcactttatgactct
+ggttatatccctcggagaacaagaataagagtacgagaagttcggtcattgaggatgaaa
+tagaaccgctagacgaatggactcacgtttataaaactatgtatcacagtactacagcta
+actctgaagtccgagaagcttttgtaggacaaaacgttataagtacctttcgcagaatac
+ggccgtgcatacctgttataaggcgtagtagggacaccatgctatccctcatatagagct
+acactaataccattacatggtgactatcgtttacggccatcatctgtaagcgatcatgcc
+tcgttagcatccgtacaatctcgcatggcgtcactgcagaaaaaccccgtgcggattttg
+agtcagaactattcgaagcttctcaatccttttccattatggcatagcaagtgacgactc
+gtcagccatgggaataatagcactaatccgattacttatgaattagaacccacatgaatg
+tgattctgcgaattgtctaagaatctaatgattttccggtgaatatggttgttgttattt
+attgaacttatattattaacatcacccttcgttagtgatagtcagctatttccaagaggt
+tccccgagcatttttaccattctctagtcatacaagttggagcgcttttaaatctttagg
+ctgatcaaggcgttttgtctagaattctgcagatgttagattcgtgtgcaatccctcttg
+catgtcagtaacaggtcacccgtttttcgttacatatgctggtaaaatattcatagtaat
+aactacaatacttgatttgttacgtaatgctcgtacataacacaatcgtattccacggaa
+cagtaaagctctattattctgatcgagcctaagagaggatcacactacgctattaaagtc
+acgttcacgaaatctcaaacctcaactgctggtgaccagttatagacagtgtaattccat
+attacatgtcaggcttaagctaacccgagcctttatataagctataatcaagaattagat
+tggagtgcattttagacttatctatcgaaatagtgatagtaagagtttatatgacctgat
+ctagactgatgttctcttccacaacagccttaaggcgtggagcctttcttatactattag
+gtcgcgtcgagagccctattcgtaatgttaacgacactagactaatatacaatgagctaa
+gaataacacaagtcacaagataatttacaaatcatatatctacagtccacaaccatcact
+agcgattgcaaagcgttattggtactaccgctctaaatcggtatgtgcaagacgcgttaa
+ctggttcaagcctctcctgctcgtgagactgaaagaaatcgaaaatatggatgtgcctaa
+ttgttcttgtgagtcatgtgcaactatacagtttagtttggtcaagactatgcaactatt
+aacagcatgtgcgcattgaatatttggtgtcgattgataaatgccccaacgttccatcac
+gtctataagccgtgttactaatgtgtattagtgcatacctattcagaccatagttcaact
+gttggactgaaggcccgtcttggggttcgtgaatgagagtgcagtttcttgtcttttcct
+taactgacctaaatgaaggcaatcggtttatctagagtcatgcttaaggtgaatttcagc
+caatgggctcccattgagctagtatggtgctttacctttgtaagtggtggctttccttgg
+tgtgctgactttaacacggcagagtgattatccgaagaatggataataagacgctggcaa
+tattggctaataaagtccgatgagtttcaatcatgactgcgaggagatccatgcggtgta
+cctaaacctacatcgtatgtatttgctgacgttcattcttgatacataaagatccgatat
+cggtccactttgtttaccaaaagccctaccttcgtaacgatggaaatgtgaatgagagtg
+aaatacacgatggggatattgccggtgagtacaagttagaccacacattagaactgacct
+atattcgtcatcatagagatggagtatgaattgattctgcgaagtacactggctttacga
+gtatctagacgccgcggtatatctcccgtcaatactatgaaggtatatatatagaggctg
+aaaattcatgttcaatcctctttctaagagtgagtgggagccccttctgttgtcggagta
+aaaaggcattattcctcaaattgtcagaagcaaagtatacgtgatgtttgcttagaacaa
+aagagttaccttagggtaggtaaatctcgattcaccgagagaagtgattttggcggtgtg
+cgattaattcttttgatgacagatctcattattttatatagctccctctttgtatttaga
+gtttgcgtaggtaacctggcaaaaccatatcccggggggagagtgcgctgaacattttat
+acgatgtgattactcaaaggataaggttcgaggcctctatactcatggaactatcttata
+attataatggatcgtggctcattccacctatccaaacttctttgtgatctgatgctacga
+gtgtgaacaaacgtacatcttctaaggaatttgggacgtttcatagctcgcatttcattc
+ctgaaaacttaaatatttttaaaaattgattctactgcgaggaactaaggtgtagacaag
+cccttagtaaccggtggatgtcgcttcagttttatagcaaacattattcaatttcagtct
+tgactgaaattagtttgttagtgttagaggtccatatgtcacatgcatatggtctagatg
+ccattgtacagtaataccttagattagtattagcggcatgcgtacttggatttcacttgt
+aagaatgagcttaggacggtcgcctgtagggctgcaaataggaatacttacaatttttga
+tgacttgttagcatatcgctatcacccataaaaaacctgatacttgatgagcgggtgatt
+gagactatgtactgatataattcaatagctccaatagatgaaacagctatgcgcctattt
+atgtcaaataatcgatgtgatacaagcttagagctgaacgagcgcgagtggaattagcgg
+tgatctctatcctaaaaagccacgaaatcgatcccagaagctaatacccgaggtgtcaag
+cttgagttcagttaaatttgcatctcatgccccacgaagaatgggtagagagtttgaagg
+tgcttctggattttcctaagtacgtggtaaaaatttgatgtaaatgaacacctcctaatg
+gttgtgttaaccacaaacccctgggtgaatctgattagccaacccagtgatctgatttca
+gttgtcaaatctcttttttataactaccttttgtttccataatttaaccggatctcataa
+tgaacaaacgggtagaataatggtagcacatagcgagcttgtctattcagaaatatggcc
+tactcagaatgtattctccaaatcagtgttatgcgaaacgtaattttacgtgtaataatg
+atgatttcttatcggttccttgtactacaatactcttgcccaacaaatactaagcataac
+agcaaaattcgaatccccctccttttaataaatggtttttcaatatagccgattcgtatt
+cgttagtctttcaccaactattaacctggcatctaattaataaaatcaccaaaggactct
+ataatatgacagtcacttcggcctcttttaagacagttgattattgcaggtccgcaattg
+atggtgacatgcacaattagttagaatccgactatggagacaattaacaattgtagtgcc
+catttggtccagttgacttcaaccacgagttataaaggtattttaatttatagtcgatag
+taccaacaacaagcacaatcataattatgttagaaaacccagggggtaatgctctaaatc
+cagctttaaggccagagtgcactatgaaatcgccattgatcattgtgtcattcgctgaac
+ttggtgtctaggaggtgccgagtgagaatatcagataccttatgaagcaacgattatatc
+tggactagatcatgatgatcggaataaaacattgaaataagtccttatcaaggagcataa
+acattttatttaatttatacttcgtaaataaattcagaattttttttcaagacattaatc
+tgagtaaatgacggctagaaagggttcctactcgaatcgtagcctacgcatgtgggcagt
+aacctggcttgcgtttttactgaaacaaaggttcaccggaaagaaggctgccacttttag
+cttcttgacgatctttagcgtcatatttttagattagtcgaaaaacggaaaacaaactta
+acgaagctggttgcacggggtaccgagaaaccaaagagcaggacaactccttgatcggga
+agaactgaaatagacagctgtcattttcattggtcaacttatcaatataacgaccaccgt
+agtgacgcttgcatgaaaatactgaggatgtaaactatagccagtcaggcccgcgtgttg
+actaattgatgaagcaaacaaaatagccggtattcgttaaaaggaacgggttgccagcta
+cagatatactctaggtatatcccaaacaagagacgtcctttggctgttgtaatcggtcat
+aatacttgtcacataaacaagatcgctgaattaaacattaaacagttagtgatacacaat
+cgtggttggggctgggatgtgcaataaaaagtcatctatcgtctatcacagagcgacgta
+aatttagacaaacattattatttcttgacaatggaatcgataagcgttcctctaacttgg
+tatatatatctcgaccccgggattccagccattcttgtatgaagatttaaccatttaact
+atgcatagttgaatggtaaggaaaatgatattgactgcaacagattttggatgcaaaaat
+atttgtgaattattggttatatactggttgtatagcacaatcattaggtcctagaaggca
+tactcaacctcagcgagagagctagcatgcataattgtaccgcccatattaatattcctg
+aaatgatttcttacattacgcccaatttcagtcatcgaacacccccatcaatttacccga
+tagagaacgtgatcatacgcaataccctatgcgaacgtccactctatagcgtctgtatac
+aatgattattcgttccatttacaacgttaagtaatttaaacttacataaggacaaggaaa
+tccgcgaacctcctggaatgtatgagttatttatgcagttaacttcgtctcgaccggaac
+taaaggcgtcgtacgaatgaaaggccacttttagaagagacctttgtatccattgtggag
+aatatcataaattcaagatggggtgtcatgctattcggtcctaaacattcttaatggctg
+ttctattgttagtctgatttaaaatggaaccatagcacgaatagttagatagggctcata
+cccctgtaacgatctacaaatccttccccgggtgtgtgcgttagcgacggaaagttttac
+ggtttgtgatcaaagaacactcacacgtcagattattacactgatacgaattatttcagt
+cgacagtaattgaatagaaacttattaacgccagcacctgacacggtaagtaaggcaggt
+ctgaactgtttgactgtaaaaaaatggtaatatttttaaaaatcttgatttctatatcaa
+atgatgtgtagttttttctctgttattaaaatcccagtgcgcgaaatttagatcgttacg
+actcacgtacaagatcacacatcacacgcgttagcgaaagcggaatggctaatacagccc
+tacgcaacgtagtgggatcaacatatggacgaatttatgctcaatgagccaacctccccc
+gcattgcggttcattttaaggcctgggtaacatctatcgtttagataatcaaaggaatcc
+gactatgcaattgtctgacttcatccgctctcaagtccaatgcaggcgctacgtgtttct
+ttaatcaataccatattgaaatcgtaatacgataattgttgctattgactacaggttatg
+aaaaaacttactttgcgggtacatgcatatttttgtaccacattattacgcgatatctct
+cagtgtactctaaattaaaccctcttcgaacattttagttcctattcgtaaacacgtgct
+acgcggcaatttgccggtcgtagaatggacaactccagttcaactgcatgtaactcatag
+ctcgcgttagtataaattgactagtagccatgggacaaagtaactagtcagcggaaaaga
+tccctttaaagatatatgcaggttgcaagcataaagctcattgctcgaggtgcaccgtgg
+tattccaaaagcgtctctatcgtatcttctaattttgggccgtgagaatcgaaactactc
+tgatttgctgcacacgttaggtaatatcgcccattttcccgtataagctccgtacttata
+cgaactacacgaccttttaagcattagccgctcatatcgtgattcgtgtacagatgagtc
+tattaaaattacagacatactccatatctcgctccttgaactttgaataatgcgctaact
+tgtactatgaataggcagaacccaactttcccgtttgcgtcaagcggggaaacgatacat
+gttgtcagatttatgattatctagttttagatcacgtttaccgataatcggctgtggtct
+gagcagtcctacactgagtatttacttcagcttcatatcggtccgaaaaaaggttgtgac
+cgaatgtcaaaatacggagtacgatgggcatcttttttcgagtcgcggttgcagggcagc
+aaaaggcttaaaccatttttacgatttttactatagcggtcatgaagtgcgaaactgctt
+gcaaattttctacacacattgtggctcttgtccttgaagcttatggcgaaaatttgaaac
+atagtataccagggaaagcgcgaattatttggtgactaatagtccgtgggtttgagccat
+atacctaacgccataaactacgtggtgctttagatgcaatctaaacagaacagaaagcgt
+agcgctcatcagcacagactaactttttcagtttgagtcgccggagggacttcgagacaa
+gaacgcgtcaagtcgcttgcgcggcacggattcgattgggcggctcaatcttgcctaatt
+tctactattgtcagctgtacgactgtactaagtgtatagccccaaataaaagaagtatcg
+atgcgtctttatgaccaaaggtcttataattgaagcgcacttccgttcatcaaattaaat
+cctggcttacccgattctccggaagtctgacctagagattgacgacggccgcgtattatt
+gagacctcttcaggattaatcaataacgaagtagttgatctgtttggcgacgtaccttaa
+gccgactccgctacacgagtttctactaaaccaatgtagccttatgcttagatgaatacc
+gtcctaattagatattccggcataacagcagtaaattatctgttcaatggacgaacattg
+aattgttagtattctacacaagtcaggcctcgtaaatattaggtaaggccgtgggataac
+ctacgtgatatgcttgagcttgcgttgcaagctctcgttaatcattaatttaggtgcgtg
+agggttaaacaccagcatattctatatgctagacgtcttccttaaaggatcgtagtatta
+taattaataataagaaatatggttgacgtctagtcagcgggcatacgctgctctatatac
+tggcattattcaaaacttgacggtaaaaaaacgaattttaaggcgctcacgtcgaatgag
+ccgaactcatgggaaccaaaatgtcacagaaaacacctctttattgccaagcatgcaata
+aaaaaaatgttaatagtacgtttacgacattttattttataataaagagaaactattaca
+cctattgatatgataggacgtaaattaacgagtagcctgcatagaggcaaatgaggtttc
+tacatggtatagacctgatgctgaaacatcgatgagttttggtcccctcgctcgttgaaa
+tctagtcatttactactgtctttcgagctattataccacttcactatgtggtgtttcttt
+gctatgtatggggctagtcaaacatgatgactatagctacaactcagagagcgggcgtgt
+taagagtatctcatgctagaactgcacgacgaacttgatacaaagtaacaacatttacga
+ttccacaaggtgactttgaagaaacatagtttaattctctgcttcgatcatttctataaa
+ccggtaccatcgcagcggatagatgcataacatttctactactccaggcatcttaaaaca
+cacgtagtacttcactagattaagacacgataagtgtataacttggcagtgggaagcaag
+gagattggcgaactcctggcatctgttacgttttgttcaggctcggttgttgataatgtc
+cgactcctgccatattgaagactcgctcgagggagatcgggattcgttgattataagtac
+acgtgttccgtaatactatgaggcagtgattcaaaatggcacttctgacttacatgacta
+ggtattattaccacggaagcgttaaaggcacactcttatggacttaagattgcaagtgcc
+ttcttctagcctgaattcgcgggttcaacacaaactctctttagacatccgttgcctaaa
+ggctgagacgtaggggcaaccctttaactatgtactaaaaaactagttggtaatttaaca
+acgtgtccaatcaagacgatgcaccaacgcggtgcgaaaatcgggttaagcaaacacaaa
+taggaattgtgataaaccccaccttgagaggtcgcaagaccaacctcgggaacaacggct
+ctaagagaataacctaaatccggatgagtagactgtgtaactctctaaagggaagtgaaa
+aaaagctaagcatacatttaggtctcctgcattgcattcaattgaatcgtttgtattatg
+agctgtacagtagctatatcagctatagttatcccagaggaacaggtaaactagctctga
+gcgtgaaatccggatattagaacccctagatgggattgattctagctaatacaggcttat
+ctggttttacagttatctagatgattggtaaggtgaaacgcttggtgccttccaccactt
+aaacaaaagtattgcccgggaagctattttctaggtattataaagtcgagcattaatatc
+aatttgacagtaaaggtctttcaccagcttcatatgccatagggcccatactcgatttaa
+attgaacggtttaacgagtattggaactctcacttataactgagtagctatacgaaaaat
+ctggtccatttccagaaatttattatcgatttgctgcttagtacccaggaagtgataacc
+cttgaaggcacaacactgtaataagttttcctgtcacatctgtaatattcggtcactacg
+cattcacgactaaagataattactatactaattaaaagttcaatgttagggccgaatcat
+agtagaaattctcgtctagcctaatcggacttacctatgggctgtgaggatttatcagta
+tgtggacaaaaatgctagagataggtatagttaaagtcaccatggtacatctatgtgagg
+aagtttgtagttcgcttctttagtccgggcgtttgggatgacaactactatacgtagagc
+cgtactcaggattagatagtgtgaaagagtcaaataaaagggttaatattaatttaacgt
+tgcaaatgtgtttaggccaaacattaaccgttgtagggatattctaatacaggccttcac
+cgaaccctaatgataatctgtcttaataacattaaatgattgtctccgctacgagctctt
+agggcctcattttaaatgactaatgtccaaagaagagactttcccaatttcaatctgtca
+cgtatagacggcaccttagtgagtcatatcattaagatagaagattatcaggagggaagt
+ttctattatcaaccgttacgcaaccataaacttttaaatctcataatggcattgagatca
+agagctttcatgatggtaaagttcgtatgtgatgctggggagctagatatcggtatacca
+cttcggttgtggtaagcccgagtgggccgttagtaatattaatagacgattatccgacaa
+tgcattcgctgaaataatcttacttaggagaaattaatgctatgagccaaaactatttat
+gtctgtcacattattgactaaagtatctatcgacaaaactgatgtccataagttgtagca
+gatagtcggtgtatggtgtcaccaatgaaaacctcgagcgaaaaatgaattatagttatc
+caatttgagtaaattgcctattatacagataggcttgtttagtcagataaggttccgctt
+gaggtgctctaacttagcgagagttagaaagcctagtgagaggcattttggtgccaaact
+ccggctcgcatgagtaggccagagagtcactttctttcgtcgaagaagttggtgaacagc
+cttttgattagttgtttgtcttgtggctatgtgctactatataagttagaacgcaaacta
+atctaatcagcaaagtaaaataggaccttgaacgagacggggtacgccgttgaggctcga
+gatagtagataaactagaggaatgtagataaaacattagctagggggtttagttactgga
+ttacataggaagtgcaccatcacggtgtgggggttcgtacgtaaagtcgcatcaatattg
+tcagtggacttaacaagttcgtgcataatgaaatcctatacggactttgcatatctctac
+cgactcatctggtcgtctatgcgggtaattgtattgctccaagtggatgactattttggc
+gtcccagcacatagtaaatgtaaatccttataatagcataagcaattattagactgcgtg
+aagtcttagtagttctcaagctttacgttgtatgtaaataactcacgtaatcagccgtcc
+ccaaatcaccattgaggtcattgaatgtacggagcactattatcaatgcggtatgcgatt
+ttctgagcgattattgttaaagacttagcgttgagccccggaacacttgattacagattc
+tttaaggagttatccaaatatcattttaaataatagtagtatcgtgctttggacaataaa
+aaaagacccgttctcttatgttgttttgcgacgtacttctctgatatatacttcaactat
+gaagattctattcatcgataacccaggtatatttatatgcccgttcactgcgcagggcaa
+attatctacggacaataatgacgtagttggacccggtaagaactaacgcttaatatgatt
+aaggatgtatgccagtattatcttattatgtcagagtagaagtttctctgagattttccg
+tcgttgtggtacaccggatttggctctctttttagaactgagaactcggagtgtgtagtc
+ttgtttccttcaatttatcaatatgcttttataccgccctcatcaactataacaggacga
+caagttccgtcttgctccatcatatactaccgatacaccaatcgtatcaagtttagtata
+cttgctttctctcttctacagcttactcgcttgtccgagaagcggttggtgctcataaag
+ttagtagtaaatgtacaactagtagccagtccttacctgtttttacgactactacggaca
+ccatgagatacagaagttagtgctacaattataccattacatgctcaatatcgttgtcgg
+ccataagatcgaagagtgcatcacgcgtgtgaatacgtaaaatctaccatcccgtcaatg
+cacaaaaacacactccccttgttgactaacatcttttacaagaggctaaatcattgtcca
+ggatcgaataccttgtgtacaatcgtcacccatcggaagaataccacttttccgatgtag
+tatgatttacaaaaaacatctatgtgagtaggccaattgtagtagaatatattcatttga
+ccgtcattagccttcttcttaggttgtgtacggatagtaggtacataaaccgtcgtgtgg
+catacgctgcgatttcatacagctgccaacaccttttttaccaggctagagtcagaaaag
+ttggagccatgttaaatagttaccatcataaaccactgttgtctactagtctgatcagct
+ttcatgcctgtgcaagcaatatggattctcacgtaatggtaacaactgttgcgttactta
+ggctggttaatttgtcagagtaataaatacatgtcttgttgtgtttcctaatcctcggaa
+agtacacaagcctaggaataggaaaagtaaagctcttttattctgatagtgactaactca
+ggatctaaatacgcgattatactaaccttcaccaaagctcaaaaatcatctgctggtgac
+cagttatagacagggtaattcaatatttaatgtctcccttaacatttcaccagcatggat
+tgaagatagtataaagttttacatggcagtcattgtgtcacggttctatacaaattctga
+tagttagacggtatttgaaatgtgcttctagcatggtatcttacacaactgaatgaacga
+ctggagccgttcgtatactatttgcgagcctcgagaccccgtttcctaatgttaacgaat
+atagtataatataaattgtgatatgaataacacaagtaactacagtttggacaattaatt
+gttctaaactaaaaatcattcacttcagatggcatagagttatggctactacacatataa
+agcggtatgtgaaacacccgttttagccggaaaccctctactgctcgggacaatgaatga
+tttccaaaatatggatgtgcagaattgttagtgtgactcaggtccaaatagacactttag
+tttcgtcaagtcgttgcaaagtttaaaaccatcgcagcattctttatttggtctacattg
+agaaatgaaaaaacgtgacagaaagtctagaagaactgtgaataatgtctattactgatt
+aactagtaagacattagtgcatctggtccactgaagcacccgcttggcgttaggcaatct
+ctgtgaactgtcgtggctgttccggtaatgtacgaaagcaagcctataggttgatcgagt
+cgcttcattaaggtcaatttcacaatatccgatcacattgtgctaggttcgtcctttacc
+ttgcttagtgctgcatgtacggggtgtcatgacttgttatcggcagactctttatcccaa
+gaatggataatatgtacatggaaagtgtccataattaagtcccttcactgtaaagaatga
+ctgccacgtgatccatgaggtctacagaaaccgacttacttgctttttgatcaacttaat
+tatggattcataaagttcagatatcggtacaattggtgtacaatatgaaattaatgagga
+aacatggaaatctgaatgacagtgatagaaaagatccccatttgcccggtcagttcatgt
+tacaccactcattagtactgtaagtgtttcgtcagcattgagatccacgatcatgtgttt
+atgccttcgaaactggatgtacgacgatcgagacgaagaggtatatataacctaaatact
+aggtacgttgttagagagacgatgaaaattaatcgtcaatacgctggcgaacactgaggg
+ggacccaatgctcttctcggtctaaaaaggaatgtgtcagaaattggtcagttcaaaagt
+agaccggatctttgcggagaacaattcacggaacgtagcgttgggaaatatcctttctac
+cacacatcggattttcgccctctcccattatttattgtgttctcacatagaattattgtt
+tagacatccctcgttgtatggagagttgcccgagcgtaaaggcataatccatataccgcc
+gggtgagtgacctgaaattgtttttagttgggatttcgctatggattagcttacacgaag
+agattctaatggtactataggataattataatgctgcgtggcgcagtacaccgttacaaa
+cgtcgttcgcatatgtggctaacacggtgaaaatacctacatcgtatttgcaatttcggt
+cgtttcatagagcgcattgaattactcaaaaattatatatgttgattatttgattagact
+gcgtggaaagaaggggtactcaagccatttgtaaaagctgcatctcgcttaagtttgaga
+gcttacattagtctatttcagtcttctaggaaatgtctgtgtgagtggttgtcgtccata
+ggtcactggcatatgcgattcatgacatgctaaactaagaaagtagattactattaccgg
+catgcctaatgcgattgcactgctatgaaggtgcggacgtcgcgcccatgtagccctgat
+aataccaatacttacatttggtcagcaattctgacattatacctagcacccataaattta
+ctcagacttgaggacaggctcttggagtcgatcttctgtttgtatgcatgtgatcatata
+gatgaataagcgatgcgactagttagggcatagtatagatctgtgtatacagttcagctg
+aacgtccgcgagtggaagtacagctgagatctatcctaaaatgcaaccatatcgttcaca
+catgatatgaacccagggggaaacattgagttcagttaaattggcagcgaatcccccaag
+aagaaggcggagtgacgttgaacgggcttatggtttttcagtacttcctccgtataagtt
+gagcgaaatgtaaacagaataatcgttgtgttaacaacattaaaatcgcggaatatgatg
+agaatacacagtgtgagcatttcacttgtaaaatatctttggtagaacttactttgcttt
+aaatatgttaaaccgatctaataatctacaaaacggtagattttgcctagcacattgcgt
+ccttctctattcagatagaggcaatactcagaaggttttatccaaagcactgtgttgact
+aacctaagttttagtctaataatcatgattgattataggtgccgtggactacatgactcg
+tccacaaataatacttagcagatcagcaattggccaagcacccgacttttatttaatggt
+tgtgcaatagtccagattcgtattcgggactctttcaaataatagtttcctggcatctaa
+gtaagaaaagctcataaggaagcgatattatgacacgctcttccgccgctgttttgaaac
+ttgagtattgctcgtccgaaattgagggtcacttcaaaatttactgagaagacgaagatc
+gactaaagttaaaatgctagtccacagttggtcaagttgaattcatccacgagttatata
+gctattttaatttatagtcgagtgtacaaaaaacatccacaataagatttatcttagaat
+aacaacccccgtatcatcgaaatcctccgttatggcctgactcctcgagcttatagcatt
+tgtgctggcgctcttgccaggaacttgctcgcgaggtggtgacgagtgagatgatcagtt
+tcattatgatgatacgattttatcgcgactagttaatcatcatagcaagtaaaatttgaa
+ttatgtcattatcatgctccattaacaggttatttaattgatactgacgaaattttttca
+caatgggttttctagaatttaatatcagtaattgaagccttcataggggtcctactagta
+tcctacacgacgcaggtccgcagtatcctggagggacgtgttactgattaaaagggtcaa
+aggaatgaaggctcacaatgttacctgcttcaccatagtgagccgatgagttttacatta
+gtactaaatcccaaatcatactttacgatgaggcttgctagcgctaaagagaatacatac
+accaccacatagaattgttagcgatgatatcaaatagactcctggaagtgtcagggggaa
+actgttcaatatttcgtccacaggactgaccaggcatggaaaagactgacgttggaaact
+ataccatctcacgcccgacgcttcactaattgatgatccaaaaaatatagcccggattcc
+tgattagcaaagggttcacagagaaagatattatcgacgtatatcccaaaaaacagacgt
+aatgtgcatcttcgaatcgggatgaatacttgtatcataaaaatgtgacctctagtatac
+aggttaatgttagtgatacacaatactcgtgggccatgggttctcaaataaaatgtaata
+ttgcgtcgatcactcacccacgtatttggtctaattatgttttatttagtgacaatccaa
+tagataaccggtcctattaagggctatatttttagcgaccacgcgtttaaacaaaggatt
+gtatgtagatggtaccagtttaattgccagtgggcaatcctaagcaaaatgagattctat
+cctaaagtttgggcttgatataagatttcggatgtatgggttttataatcgttggagagc
+tcaatcatgagctaatacatggatttcgctacctcaccgagagaccttgcatgaagaatt
+ctaaccaaaagtttaataggccggattggattgagttaattaagaccttgttcagtcata
+gtaaaaacccttaaattttaccgattgacaaagtgagcagtcgcaataccctatgcgaaa
+cgcctcgatagtgactaggtatacaaggtttttgagttcctttgaaatagttaactaatt
+taaaattaattaacgacatggaaatcacagaacctaatgctttgtaggagttatttatgc
+tgtttactgcctctacaaccctaataaagcagtcctaagaatgaaacgcatcttttagtt
+cagaaagtggtatccagggtggtcaatttaataaattcaacatcgggtctcaggatattc
+ggtcatataatttattaagggctcttcgagtcttactctgagtgaaattggaaacagtca
+tccttttcgttgtgaggcatcttacaccgctatcgatatacaatgcattccaccgcggtg
+tcccgtacacaaggaaacttgttaccttggggatataagaaaactcacacgtctcattat
+taaactgagtacaatttttgcacgagaaagtaatgcaatacaatatgatgaaagccagct
+aatgaaaagggatggaacgcacctcggatctgttgcactggattaaaatccgattatttt
+taaaaatattcagtgctagagcatatcaggtctacttttttatctggtatgtaaagccca
+cggagcgatagtgagatccttacgactcaacgaaaagttataacataactcccgttagcc
+aaagcccaatcccgattactgccctaccctaacgtctgccatctaaatatcgaacttgtt
+atgatcaatgtgactacctcccaccctttccccttcatttgttccactggggataagcta
+gcgttttcagaatcaatgcaataagaatagccaattgtctcacttcatcagagctcttgg
+caattccaggcgctacgtggttctggaatatattcatttttcaaatagtaatacgtttag
+tgttgctattgtctacacgtttggatattacgttatgtgagcggacatcaatagttgtct
+aactctttagtaagccagagatagcactcttagcgaatggataccatcttccataagttt
+agttaatagtccgaaacaactgcttcgagcatatttgaacctccttgtaggcaaatagcc
+tcttcaaagcaatcttactaatagatagagtttgttttaagggactactagaaatgggac
+aatcttaatagtatgacctaaactgacatttaaagatatatccaggtggcaagcataaag
+atcattgcgccacctccaccgtgggattacttatcagtcgatatcctatatgctaagttt
+gcgacggcagaatacaaactaagctgagttgatgctaaccttacctatgataccccattg
+gaccggttaacagccctacttattccaaataaaagaacttttatgctgtagaagctatta
+tagtgatgcctggtaacttcagtatattaaaatgacacacatacgccatatagagctcct
+ggaactttgaataatgagcgaacttcgaagttgaagagcaagaaaccatatgtcacggtt
+gcctaaagcccggtaaccagacatgtgctatcattgatcattatcgaggttttcataacc
+ttgacccattatcggctgtgcgcggacaagtacttaaatcactagtttcttcacctgctt
+atcggtaagaaataaggttggcaaagaatcgcataagacggacgtagagccgcagcgttg
+tgcgagtccaggtgcatgcgcagcaataggattttaaattttgttccatttttaatttag
+ccgtaaggatgtccgtaaatgattgaaaattggattcaatctttgggcctatgctactgg
+aacctgatcgacaaaatttcaaacatacgttaactccgaaagaccgtatttttgcggcta
+gaatagtcagtcgcttggagccatataccttaccacttaaacgacgtgctcctgtagttg
+aaatataaacagaacacaaagactaccgatcatatcaactgaagatctttgtaactttga
+ggcgaagcaccctcttcgagacaactaagagtaaagtaccgggcgccgcaaggagtcgat
+tgggaccctaaatcttgacgaattgctaagaggctcagagctaccactgtaatttctcta
+gagcccataataaatgaacgatacatccgtaggtagcacctaagggattataatggaagc
+caaatgcagttaataatattatatactggcgtacacgattcgacggatctctcacatagt
+gattcacgacccccccctttgattgacacagcgtcagcattttgcaagaacgatcttctg
+catagggtgcgccaccgtaaggatgacgtcgaagctacaactgggtataatttaccatgc
+ttccctgatgctgagtgcaatacactaagaatgagtttttaccccatatcaccagtattt
+gttctgttattgcgaagaaatggctatgctgagttggcgactaaagtcacccatcctttt
+tattaggtaaccccctcccttaaactaactgatttgctggagctgccctgcatacatata
+ctttatcatttatggacgtccgtgacgcttattatccaccatagtcgatatgctacacgg
+attcattaatggatcgtaggagtttaagttatatttactaagatcggtctcggctactat
+cccgccttacccggcgctatttacggccatttttaatatattgacggtaattattcctat
+ggtttcgaccgcacgtccttggacaagaaagaatggcaaaaaaaatgtaaaagaaaaaaa
+atattgagtccctaccatcatataaaaaatatgtgatgagtaacttgacgaaatgttagt
+ggttattaaagactatctattacaccttttgttttctgtcgtagtatattaaagtctaga
+agccttacaggaaaatcagggttatacagccgatactccgcagcatgaatcatcgaggag
+gtgtcctaccatcgcgccttgtaatcttgtctgtgtatactgtatttagaccttttatac
+aaagtaaatatctcggctttatgtgattgggaggggcctactcaaacatgatgacttgac
+ctaataatcactgtgcgggcgtcttatgactagctattccttgaaatccaccaccaaatg
+gttaatatgtaaaaactttgacgatgaaacaaggtgaatgtgtagttactttgtgtaatt
+agctgcgtcgagcattgcttgtaaaaccgtcaatcgcacacgttacttccataaaatttc
+tacgaatacacccttcttaaaaaaaacgtaggaattcacgagtttaacaaacgataactg
+tataaagtggaagtccgaagaaagcagatgcccgaactactcgaagatgtttcgttttct
+taaccataggggcttcttaatggcccactacgcacattttgttcaagcccgagagggaca
+tccccattacgggagtattactaaaactgttccgtaatacgttcagcaagggatgaaaaa
+ggccactgctcaagttattgacgtgggagtattacatcggaagcctgaatcccacactat
+gatggtctgtacaggcctagggactgcgtctagacggtattaccggcttctaatcatacg
+atcgtgagtcttaacgggaagtaaggctcacacctaccccaaaccatttatctatgtaag
+tataaaattgtgcgtaagtgttcaaagtggacaataaagacgtggcaaaaacccccgcac
+ataagccgctttagatttcacaaataccaatgcggttaaaaacatccttgagtcgtacat
+acaccatactcgcgttaaacggatataacagaagataataaatccggatgtggagtcggt
+gtaactatagaaagccaagtgaaataatgcttaccagtcatttagctatacggctttcat
+ttcatgtcaagagggtggagtttgacctgtacagttgatatatcaccgatacttagaact
+cacctaaagctaaaattgctcgcagcgtgtaatccgcatattacaaacaatagatgggat
+tcattatacataagacacgatgatctgctttttcaggttgcgagatgttgcctatcgtca
+atcgagtcctgccttacaccacttaaacaaaagtattgacagggaacctattttcgaggt
+attatatagtccagcttgaatatcaatttgacagttaacctagtgaaaatcagtaagagg
+aaatacgccacattctccagtgaaattctacgggttatcgtctagtccaactatcaatta
+taactcacgagatataagtaaattctcgtacttggcctgatttttattatactttggatc
+cttagtaaacaggaagggagaaaccttcaacgaaaaacactggattttgttttactctca
+aagctcttatatgacggaaataccctgtcaagtcttaactttattactagactaatgaaa
+tgggcttggggtggccagaatcatagtacaatttagcggatacactattcggactttcct
+atcggctgtctggttggataagtatggggactaataggctagacatacctatacttaaac
+tatacaggcgtcatctatctctgcaactttggagttccctgatgttctcccgccctttgg
+gttcacatcttctataccgacacccctaataacgattagtttgtgggttagagtaaatta
+atacggttaatattaatgtatcgttgaaaagctggtgtcgccaataaggtaaccggctag
+gcagagtatatgtcacgaagtataactaccctaatgataagctgtaggaataaaattaat
+gctgtctctaagcgaagagatatttccgactctgttttaatgacgaatctcattacttct
+gacttgcaaatgttcaatatggcacggtttcacggcacctttgtgacgcatataatgaac
+ttagaagattataacgacggaactttatatgataatccgttacgattaaagaatctgtta
+aatatcataatggcattcagttctagaccgtgcatcatggtaaacttactttctctgcat
+ggcgacatacatttcgctattcaaattcgcgtgtggttacacccactcgcacctttggaa
+tattaagagaagatgatcagaaaatccattcgctcaatttttctgacgtacgtctaattt
+atcctaggagacaaatcgttttatgtctctcacatttttgaagaaaggttcgagagacaa
+tactcaggtcctgaactgctagaagatactcggtggagcgtggcaacaatgaaaaactcg
+tgacataaatgaatgatacttttccaagttcagttaagtgaatatgtttaacatacccgg
+cttttcgatcttaagctgacgctggacgtgcgagtaatgtcagtctcttacatacactag
+tgactccaagtttcgtcaaaaacgccccctcccttctcgagcccactcacgctatgtatt
+gacgcgaacttgttcgggatcagacttttcaggagttcggtcgcgtgtccctatgtgcta
+atatataagttagatcgcattagatgctaatctgaatacttatagacgaccttcaacgag
+aacgggtaccaccttgaggctagagttaggtgtgaaacgacaggtagggacatataaaat
+ttgagtgcggctttagttaagggtttaattacctactcaaacatcacgctcgcgcccttc
+gtacgtaatcgaccatctagaggctaaggggactgtactaggtagtgattaatgatatcc
+tagacgcacgtgccttagatcttcagactctgatggtccgcgatcaccgtaattgtagtc
+ctccaactcgatcactttgttggcgtcaaagaaattacgatatctaaatacttataatac
+aataaccaaggatgagaatgactcatcgcgttggagttatattgcttgaagttctatgga
+atgaaagcacgttatctgccgtcccaatatctccagtgagctaattcattggacggtcca
+ctttgatcaatccccgaggagatgttcggacactttagtctgtaacacttagcgttgaga
+ccacgaacaattgattactcagtcttgaaggtgttttccaaagttcattttaaataagac
+tacgataggcctttcctattgatataaactacccggctctgttgttcgtgtgagtcgtac
+ttctctgtgtttttctgattatagcaagattcgattcttagtgtaaacagcgatttttat
+ttgacccgtcaatgagaagcgcataggatctaagcaaaattatcaagttgtgccacaagg
+taagatctttccagttattgcaggtaggatgtatcccacgttgatagtatgaggtctgac
+gtcaactgtctaggagagttgaccgcgtgcgggtacaccggatttgcatcgatgttgaga
+acgcagaactcccactgtcgtggcggcgttcctgatatttagcaagaggcgttgataaag
+ccctcatcatctagatctcgacctcatctgccctcttgctccatcattttctacacagac
+tactttcctatctacgttagtataattgctttctatcttagtatcatttagagcttctcc
+gtcaacaggttcgtgctattaaagttagtacgaaagggacaacttgtagcaacgcattta
+atcggttttcgactacttcgcacaaaatcagataaagaagtttgtcattctattagacat
+tgaattgcgcaattgacttgtaccacttatgatcgaacactgaatcaagactgtgattaa
+ctaaaatagacaagccactatatcaactaataaaaacgcccctggtggtcgaacatagtt
+gactacaggataattaattggactggagccattacattctctacaatcgtatcacttccc
+aagtagacaactttgaccttgtagtttcatgtacaaaaaaatgctttcgcaggagcacat
+tggtagttcaatagtttcatgggaacctcttgagccgtcttctgtgggtgtgttcggata
+gtaggtactgataaagtcgtgtcgctttcgatgagagggaattcaccggaaaacaccttg
+gttaacaggatagtctatgtaaacttcgagacatgtttaagagttaccagcttaatccac
+ggtgctctactagtatcatcagctgtcttgcctcgcctagaaatatgcattctatcgtta
+tcctatcaacggttgccgtactgagcagccttattgtggaagagtaatatataaatgtag
+tcttgtctttacgaagcagacgtaagtaataatgacttggaataccaaaactaaacatag
+tggattatcatactcaagaactctccagataaataacagtttttacgatacgtcaccaat
+gagcttaaagattaggatcctcaaaactgatacaaacgctaattcatttgttattggatc
+cagtatcagttaaactgaatggagtgaagattgtagaatgttgttctggcctcgcatggg
+gtctaggtgatatacaatttctcatacttacacggtagtggaaatctgattctagcttcg
+tagctgactatactcaaggaaccactgctcaaggtaggagactagttccgaccctacagt
+caaagtggccgaagcttaaactatagactagttgttaaatgctgatttcaagatatcatc
+tatatacagtttggacaattatgtgtgcgaaactaaaattcatgctattcagatggattt
+cacttatgccttagaaacagatattgcccgagctcaatcaacagttttagccggaaacaa
+tcgaagcatagggacaatgtatcttttcctaaattgccatgtgcagatttctgagtgtca
+cgaagcgcataatagaatcttgtgttgcctcaactcgttgaaaagtttaaaacaatcgca
+gcagtctttttggggtctactgtgtgtttgcaaaataactgaaagaaacgcttgaacaac
+tctgaagtagctcgagtactcattaaagtgtaacacattagtgaatatcggccaatgaac
+caaacgcttcccggtacgctatctctctcatcgggaggcgatgtgcaggttatctacgaa
+agcatccctttacgttgagagtgtcgatgcatgaacctcattgtaacaatagcccagcaa
+attctcatacgtgcctcagggtccgggcgtactcctccatggaagggcgcgcatctagtg
+ttataccaactcgctttttaactactatgctgtagttctacaggcatagtggccagtatt
+ttctaacttctctggatagatgctctcactcctcatccatcacggcttcagtttacgtct
+tacttgcttgttcagcaacggatggaggcattaagtatcttcactgttccctaaaattgc
+tgttcaatatcaaagtaaggacgatacagggaaagctcaagcacactcattgaatactgc
+cccagttgcaacctcacttaatctgacaaaaataatgactactctaagtgttgcggaagc
+agtctcttccacgagcttgtctgtatcacttcgtataggcatgtaactcgatagacacga
+acaccgagtgagaaactatattcttgcttccgtgtgtgtgacaccaggtaattgatgcgg
+atataagctggagatcactcacgcccacacaaggcgctgctacctctttattccaatgtg
+taagaatttgctaacttcatttctagaccgcagctttgcggtcataatttcacggtacgg
+acccttgggttagagacttgataacacacttcgcagtttccaccgcgcacatgttttagt
+ggcttctaacatagaatttttgttgtgacataaagagtgcgtgggagacttgcccgaccg
+ttaagccataatcaattgaaagccccgtgagtcacatctaattggttgtactgcgcattt
+agctatcctttagctgactcgaagagattcgattcctaatataggttaattagatggctg
+ccgcgcgaagtaaaacgtgaaaaacgtagtgcgcagatctgcataactcgcgcttaatta
+cttatgagtagttccaagttcgctacgttatgagagagattggaattaagcaaatatgtt
+ttatggtgattttgggatgagaaggactgctaagtacggctactaaacaaatttctaaaa
+ccgccatctaccttatcttggagacatttaagttgtatatgtcactagtctagcttttgt
+ctgtgggacgcgttctcggaatgagggaaatgcaagagccgattcatcaaatgcttatct
+aagaaagtagtggactattacaccaagcacgaatgccagggaactgctttcttgctcagg
+acctcgcgacaaggtaccccgcataagtcctagaattacatttggtcagcaatgctgaca
+tttgaccgtgaaaacataattttaatcagaaggcagctcacccgcttgctctagatctta
+tctttgtatgaatgtcagaatttactgcaatatccgttccgaatagtgagggcttagtat
+agttctctgtatacaggtcacatcaaactccccctgtcctagtacagctctgagctttaa
+ttaattgcatacatttccttcaatcatcagatgaaaacaccgcgaatcatgctcttctcg
+tatagggcaagagaagcaacaaacaactagcccgactcacgttcatccgccgtatccttg
+ttcagttcttactccgtattaggtcagcgaaatctaatcagaataatcggtcgcgtatca
+aaattaaaatcccgcttgaggttgacaattaaaacgctgagcagttatcggctattagat
+agtggggtgaaagtaattggctggaattatgttaaaacgtgatattaagctaaaatacgc
+tacttgttgccgacctaattcagtcattcgatattcagttagagccaagaataacaagct
+tgtataaattgaacggggtgcactaaacgatgtgttactctaatattcagcttggagtat
+acctgaaggcgaattcatgtatcggccaataataagacgttgaagatcacaatttggact
+agcaaaagaaggtgatttatgcgtggggattgagtccactgtacgagtacggtctctgga
+aaattataggttcagggaatataaggaagtaaagataattaccaagagatttttggtatc
+gctatgacccagaggtgttctaacgtctgttttgatccgcagaatttctgcctcaatgca
+tatttgacggacttgaactagagcctctaaagttaaatggcgacgcaactgttcctaaac
+ttcaattattactactctttttttcctagggtattgtagaggccagtggacaaaataaat
+caaatttaagatgtttcggacattaacatcccccgtagcatagaaatcatcagttatcca
+atctctcatcgagcttttacaatttctgctggcgctatggacagcatatgccgcgagacc
+tccgcaagactcacttgatcactgtaagtatcttcattagaggttagagcctatagttaa
+gctgctgacctagtaaaattggtattttctaattttattgctcaagttaaaggttagtga
+agggataatgacgttatttttgaacaatgggttgtattcaattttatatcacgaatggaa
+cccttcattcccggcataatactagacgacacgaacaagctccgatctatcagccaggca
+cgtgttaaggtttaattccggcaaaccaatgaagcatcaaaaggtgacctgatgcaactt
+agggtcacgatgagtttttcaggactacttattacctattaataagttaacatgagcctt
+cataccccgtaagacaatacatactccaccaattagaattctgagccatcttatcttttt
+gtatcatcgaagggtatggccgaataggttaattagttactcctaacgtctctacaggca
+tgcatttgacgcaccttcgaaaatagtcaatctctcgccacacgcgtctagtatgcagca
+tcaaaaatatagtccacggtttccggattaccaaacgcggcaaagagaaacattgtatcg
+acggagataacttaatacagaaggaaggggcatcttcgaatacggatgaataattctatc
+tgtttattctgacatcttgttttcaggttaatcttacgcattcaaatgacgcctgcccca
+tgcgtgcgcaattattttctaatattgacgagagcaatctcactccttttgggtctattt
+atgttttattgaggcacaagcctatacagaacaggtactattaaggccgtgagtgtgaga
+ctcaaaccgtggaaacaaaggatgggttgttcttggtacaagttttagtgcatgtgggca
+atccttaccaaaatcagatgctatccttaactttgggctgcatttaagatggcggttgga
+ggcctgtgagaatcctgcgtgtcatctttaatgaccgaattcatccatgtagattcagat
+cacacactcattccttgatgttgtctaaacaaaagttgttgtggacgcattggagggagt
+taagtaacaacttgggatcgcatacttataaaaattatatgttaaactttcacaaacgct
+gaagtccaaagtaactagcccaaacgcctcgagagtcactaggtattaatggtgtttgag
+ttcctgtgaaatagtgttcgaaggtaaaatttatgtaccaaatcgaaagaacacttaata
+aggcttgcttgcacggaggtatgatgtttactgactctacaaccctaattttccagtacg
+tacattcattccaataggttagttctcaaagtgctatacaggctcctcaattgatgatat
+gcttcagccgctctatggatattagctcattttatttaggaagcccgcttagaggcttac
+tatgagggaaatgccaaaatgtcatacttttcggtgtgtcccatatgacaccgctttaca
+tagaatttgaattaaaacgcgctctcccgttcactaccatacttggtaccgtgcgcatat
+tacatatagatataggatcattttttaaagctgtactaggtttgatcgacaatcttatgc
+tatactatatgatgtaaccctcataatcaataccgatcgtacgatcctagcataggtggc
+aagcgattttatgccgattattgtgttaaatagtctgtgagtgtgattatcagggctacg
+ttggtagaggggttgtatagacctcgcacacattgtgacatacttaacaatatacgaaaa
+ctgatataataaatccccttacccaaacaccaatcccgttgaatcaactaccataacgtc
+tcccatataaattgcctacttgtttgcataaatctgaatacataacaccattgcaccttc
+ttgtgttccaatcccgttaagattgccttgtcagatgatatgcaagaacaatagcatttg
+ctagcaattattaacagctcttcgaattgcctccacataacgcgggagggtatattttaa
+tttggcaaatactaagtactgttggcgtcatatgctattaacggttggatattaagttat
+gtcagccgtaagcaagagtgggcgaaatattttgttacccagtgagagcactcttagagt
+ttggatacaataggccatatgttgacttaagaggacgtaactacgccgtacaccattgtt
+caaccgacttcttggcaaatagaatcgtattagcaatcttaagaatagagacacgttcgt
+gttagggtatactacaaatccgaaaatcttaagaggatcacctaaactgaaatttataca
+tatttcaacgtggatagatttaacataattcagccacctccaacctgggagtaattttca
+gtagatttactagatgattagtggcccaacgcacttgactatataagatctggggatcct
+aacctgacctatgagacaaaattggaaacgttaacagcccttatgtgtacaaagaaaagt
+aagttgttgctgttcaacagatgatagtcatgacgcgtaacttcactatagtaaattgaa
+acaaatacgcaatttagacagaatggtacggtcatgaatgacagtaattcgaagtgctag
+accaacttaaaataggtaaacgtgcccgaaaccccccttaacagaaagctgctatcatgg
+tgcagtatcgacgtgttcagaaacttgtaacttttgagcaggtccgagcacatggaagta
+tatcacgtgtttctgaaccggcttatccctaagatatatccgtcgcaaactttcgattta
+gtcccacgtagagcccaagcgttgtgcgactccacgtgcatgcccagaaatacgagttta
+aatttggttacatggttaattttgaccgaagcatcgcactttatgattgataattggatt
+caatatgtcgccctatgcgaatgcaacatgatccacaatttggctataagacgtttaatc
+cgtatcacactttgtttgcggctagtatagtaacgcccgtgcaccaagagtcagtaacaa
+ttataagtactccgcaggtacttcaaatataaaaactaatcaaacacgacccatatgatc
+atctgaagatatttggaactttctcgacaaccaccctcgtactcaatacttacactaatc
+gacaggcacacgcaacgtgtacagtcgcaccatattgagtcaagatttgcttagtggcga
+tgagcgtacacgcttatttctctagtcacaattagttatctacgagacatcacgagggag
+caaataagcgatgttatggctacacataggcacgtatgaatatgatataagccagttaaa
+cagtcgaaccatcgagcaaattctcatgcaccaacccacacgttgaggcacaaagagtaa
+gctgtttgaatgtaacttcttctgctgagcgggccccaacgtaaggatcaactagaagag
+aaaactcggtattagtttaaatgcgtcacggagcatgagtgcatttcactaagaatgtct
+gtgtaaccaatataacatctatttgttatctgattgcctacttatggctttgcggtcgtg
+gcgactaatgtctccaatccttttgaggtcggtaccaactccctttaaattacgctgtgc
+aggctcatgcactgcatacatatacggtagcaggtagggacctcacgcacccttattata
+atcaatagtagttatcagtcaacgaggcaggaatgctgaggtcgaggtgttggtatattt
+tctatgtgccgtctaggcgactatcacgcattaccaggcgagatttaagccaattttgaa
+tatagtcaacgtaatttttactatgggttccaccgaaacgccttgcacaactaagaatcc
+cataaaatatcgatatcaaataaaagattgtgtcaataccttcatatatattttttcggt
+tgactaacgtgaactaaggttaggggttttgtatgtctatataggaaacagtttcttttc
+tgtcctactttagtaaagtcttcaagccttactccaaaatcacggtgattaagccgttac
+tcagcagcatgattctgcctgctcgggtcctaaaatccagccttgtaagagtcgctgtgt
+attagctagggagacctttgttaaaaaggatatatcgcggcgggatgtgagtgcgtggcg
+catactcaatcttcagctcgtgtcattataatatctctcccccacgcttttcactagata
+tgccgtgtaagcaaacaccttatgcttaatttcgaaaatattggtacttgaaaaaagctg
+taggggtacttaatgtctggtaggagatcaggagagaattgagtgtaaaaccgtaaagcc
+ctcacctgacttcatgtaaatggcttagaagactccatgatttaataaatactacgaagg
+aaagactggatctaaagataactctagtaaggccaactcccttcaatgctgttgccagtt
+ataatccaagagctgtccttttctgaaccatagcggcttctgaagcgaactagaagcaaa
+gttggttctagccagacagccacataccctgtacgggtgtattactaaaactggtccggt
+attagttcaccaagggaggaattaggcaaaggatctaggtatgcaagtcggagtattaca
+tccctaccctgaatccatcaataggttcctctgtactggccttcgcaatgagtattcaag
+gttgtacagccgtataataataagatagtgactatgaacgggaagtaacccgctcacctt
+ccccaaaacattgttatatctaagtattaaagtctgccgtagtgttaatactcgaaaata
+aacaactggcaaattacaccgcacttaagccgcttttgatttatatttttccaatgcgct
+tttaaaaataattcagtcctacatactaattaagacccttaaacggagatatcacaagtt
+aagttttaaccatctcgactaggtggaactatagatacccaactcaatttatcattacct
+gtaatgttcctagaaggattgcatttcatgtcaagacggtggagtttcacagcgaaactt
+cagtgtgaacagattctgagaaatcacctaaacctattagtcagagcacccggttagaac
+cagttgtcaaaaaatagagcggttgcatgagacagaagtaacgatgagatccgttgtaac
+gttgagacatctggcctatcgtcaatacagtcctcccttaaaaatatttttaaatactag
+gcaaacccaacataggttagtcctatgtgatacgccacatggtatatcattttgtaacgt
+tacctagggataatcaggaagtggaattacgcaaaagtagacagtgaaatgcttagggtt
+atagtctagtccaaagataaaggataaagcacgtcagagaactatattagccgaatggga
+atcattgttaggagactgtggatcatgtctaaaaagcaacgcagaaacagtcatcgaaaa
+aatctcgtttttgtttgaatctaaaagagctttgatgaccgatagtacctgtatactagt
+tactgtattacgtgtctaatgatttcggattggggtccccagaatcagacgtcattgtag
+acgattcaagtttaccaatttaatttcccagctctccttggagaactatcgccaataatt
+gcagtcactttccttttctgaaacgataaagccgtcagagttctctgcaacgttggactt
+acctgaggttctaacccactttcggttctaatagtagttaacgacacaacgaataacctt
+tactgtggggctttcacgatattttttcgcttattattaatggttacgtcataagctggt
+gtccaaattaaggttaccggcttcgcagagtagttgtatccaagtataacttccctaatc
+ataagatcgaggtagaaaattaatgctgtctctaaccgaacagatatgtcccactatgtg
+gtatggacgttgctaattacttctgaagggaaattggtcattatggatacgtgtctacca
+tcaggtcggacgcagatatggttctgtcttcagttgatccaccgttctttataggataat
+aactgacgattaaagattatggtaaatagattaagccaattctcttcttgtcagtgaagc
+atccttaactgacttgctctgcagcccctcatacatttagctattcaaagtaccggctcg
+tttcaaactctcccacctttggaagaggttgtcaacttgataagtatatcatttacagca
+ttttttcggacgtacctctaatgtttcattgcagaaaattagttttttctatcgcacatt
+ttgcaagtaacgttagagacacaattatctgcgaatgaactgctagatctgacgaccggg
+agcctcgcaaatatcaaaaaagactgacatatatcaaggagtcgttgacaagtgctggta
+agtcaattggtttatctgtcccggcgtttcgatcttaagctgaccatgcacggcagagta
+atgtcactctcgttcttacaagtctgtctccaagggtcggcaaaaaagacccctccattc
+tcgagcccactcacgatatgtagggacgacaacttgtgcggcttatgaattgtctggact
+gcgggcgagggtccatatctccgaagttagaagggacatacctttagatgataagatcaa
+ttcttattgacgaaattcatccacaacggggaacaacttcaccctagacttacgtctgaa
+aagacacctagcgtcttataaaaggtcagtgccccgtttcgtaaggctggaattacctac
+gcaaacttaaacctcgcgcccttccttacgtatcgacaagatagaggctatcgcgaatgt
+actacggaggcatgaatcatatactagaaccaagtgcctgtgatattaacaagatgatcc
+gacgcgagcaccgtaattctaggcataaaactccagcaatttgggggccgaaaacaaatg
+acgttagctaattaattatatgacatgatcaaaggaggtcaatcacgcatcgagttcgac
+gtatattcattgaacttcgtgcgtttgaaagaaacttttatgaaggcaaaattgatcctg
+tctcctatttcatgcgtacctcctagttgataattccccgagcagtggttaggacacttt
+tgtcggtatcaagttccggtctcaaaacgtaaaattctgtaatctgtatggatggtctgt
+gaattagttaatttttatgaagtcgtcgagacgcagttcctattgatttattctaaacgg
+agatgtgcttcgtgggactcggaagtagatctgtgtttatgattattgctactttagatg
+ctgactgttaactccgtgttgtttttcaaccgtatatcacaaccgaattggatagaacct
+atagtttcaagttctgccacaaggtatcatatttacagttagtgctggttgcttctttca
+aacgtggtgagtttgtgctatcacgtcaacggtagagctcagtggaccgagtgcgcgttc
+aaccctgttccagagagggtgtgatagcacatataccacgctcgtcgaggcgttcatgat
+agtttgcaagagccggtgttaaacacatattattattgttatccaactaatcggacctat
+gcataaagcattgtctaaacagaataattgcctatatacggtagttttagtgatttatat
+cttagtatcagttagagcttcgaactcttcaggttcctcatatttaacgttcttcgaaag
+cgaaaacttctacaaacgaatgtaagcggttttccaagtagtacctataaatcacagaaa
+gatctgtctcagtatagttgaaatggtattcagctagtgacgtgtaccaattatcatagt
+tcactcaagcaagacgctcattaacgaatatagacaagacactatatcatataataaaaa
+agaacatggtgctcgaacatagttgaattcaccatattgaaggggaatgctgacatgtaa
+ttcgctactagacgatcaattccctacttgtcaaagttgaactggtacgttcttggaatt
+aaatatgattgcgctggaccaaattgcgacttcttgagtttcagggcaaacgattgagcc
+ggaggatgtccgtctcttacctttcttgcttatgataaacgacggtccctgtacatcact
+gggaattctcagcaaaaataattgggtaaatcgagactcgatgtattcggccacaaaggt
+gttagacgttaaagattattcaacggggcgataataggatcataaccggtatgcaagcgc
+attgaaagagccatgagatccttatccgataaacgctgcacggtatgtgcagccttattg
+tcgatcacgaatttataaatgtagtctgggctgtaagttgaagacctaagttataatgaa
+gtgcaataccaaatcgattcatagtggattatcagactcaagatatctcctgataaatta
+cagttgttaagatacggataaaatgagatttaagattagcagcctctaatctgtttcaat
+cccgttggaatgtggtatgcgatcaaggttaagttaaaatcaagcctgtcttcagtcttg
+attcttgttctgccatcgcatgcggtctacgtgagttaatatgtagcttacgttctagct
+tgtgctaatctgagtatagattcgtagaggaatattatcaagcttccacgcctcaacgta
+cgtgtattggtcacacaagacactaaaagtggaagtagcgtaaactatagtctagttgtt
+aaatgctcagttcttgttatattcgatatactcttggctaatttatgtctgagtatataa
+aattaatgatattaacttgcatttcacggatcccttagaaaaagattttgaccgagcgca
+ttataaacggttacaccgaatcaatagaagcatacccaatagctttctttgaatttattg
+cctgcgcaacttggctgactctctagatccgaataattctatatggtcgtgacgaaacta
+gttcattactgtttaaaatgccaacatgtcttttgggccgataatggctctttgcaaaat
+tactcaatgatacgattgatcaaagcggtagttgctagtggtagcatgtaagtctatcaa
+atgtctgattatccgaaaatcttccaaaagagtccacgtaccatatctatctcatagcga
+cgcgaggggaaccttatctaactatcattccatttaccgggtgactctcgatgcaggatc
+cgattgggataaattgcccagaaatggctcattcctgactaagggtaaggccgttctcag
+caagggaaccccgcgaatctaggcttataccatctagattgttaactacttgcctgtagt
+tctacagccatactggacagttgtttctaaatgatcgggattcatgctagcactcctctg
+aatgcaccgcgtaagtttaactattacgtccgtgggcagataaggatggaggctgtatgt
+atcttaactgttacctaatatggctggtaattatcaaagtaaggaccttaatgccatagc
+gctagcaatcgctttgtatactgaccatgtgccaacctctcttaatctgtaaaatataat
+gtcttagctaactgtggacgatcatgtctctgcctagagcttcgctgtatcaattcctat
+agccagcgtactagtgacacaacaacaccgtgtgagaaaagatattagtccttacgtctg
+tctctctacagcttattgatgaggattgaacatggacatatagctccccctcaaaagcag
+atgctacctctttattccattctcgaacatttgccgaacttaatttcgacaaacctgagg
+tcacgtcttaatttatcggtaacgtcacgtccctttgagactggataaatatattaccag
+gggccaacgagcaattgttggaggcgcttctataatacaaggtgtcttgtcaaagaaaga
+cggcgtgcgtctcgtgcaactcacttaaccaatattaatgtgaaacccccctctctcaca
+tcttatgcggtgtactgccctggtacatttcctgtacaggactccaacagtgtagattcc
+taagatagctgttggagttgcctcacgccagatcgaaaaactgaataaactagtgagctg
+agctgcagaaataccgcttaattacttatgactagttcaaagggacctacgtgatgtcag
+acattgcaaggaagaaattaggtttgtgcgtcattttggctggactagcactccttactt
+cccctactattcaaatgtcgtaaacagcatgagacaggatcgtgctgacatttaaggtct
+attgggaacgaggctacctttggtcgcgcgctcgcgttctccgaatgaccgaaatgcatg
+agcacagtatgcaattgcttatagatctaaggtctggtcgttgaaaccaagcacgtaggc
+ctgggaaatcagttcttcctcagcaactacacaaaagcgtccaagcattagtacttgtag
+taaatgtccgaacctatgcgctcatttgaaagtcaaaaaatatttttaagcagtaggcac
+ctaacccgattcctctacttagtagctttctttgattctcagaattgactgcaatatcac
+tgcacaattctgtgccattactagacttctctgtattaacgtctcatcttactaacactc
+gcctaggacacatctgagagtgaagtatttcaatacatttactgaaatcttcagttctaa
+aatccccgaataaggctcttatcggtttggccaacacaagaaaaaaacttcttgcaccac
+tcaccttcatacgcaggagcctggggaacttagtaataactatttcggcagacaaagctt
+ataacaagttgccggcgcgtataatatttaaaagaccccttgagctgctcaattaaaacg
+ctcacctggtataggctattagatagtgccgtcttagtaaggggcgggaattatcggata
+aactgatattttgataaaataaccgacttgttcacgacataagtcactaaggagatttta
+tctttctccaaagtatatcttccttggataatttcaaagcgctgcaatttaagttctgtt
+actagtttatgctgctgggaggtgaccggaaggcgtagtaatctagaggcaaattataag
+aagttcatcatatcattttcgactacaaaaacaaggtgttgtatgccggcgcattgtgta
+aactggacgagtaccctagatggaaaattatacgttaagccaagatttcgatgtaatgat
+aattacctacacatttttgctatccataggaacaagagctgttctataggctcgtggcat
+acgaacatttgctgccgctatgaatattggaagctcttcaactacagactctattcttaa
+ttgccgtcgaaaatgggccgaatcggctattattaatactcggtttttccgaggggattg
+ttgtcgacagtcgtaattattattaatattgatgttggtgaggtcatttaaatacaacct
+tgcagacaatgaataagggatccaatctctcatactccttttacaattgctcatgcccct
+atgcaaaccttatgccgccacacctccgcaactctctcttctgaactgtaagtagcttca
+ttactggtttgagactatactgaagctgatgacattctaaaatggctattttcgaatgtg
+attcataatgtttatcgtttgggatggcagaatcacgttatttttgatatagcccgggta
+ttctattgtatagaacgtatgctacaagtcattccccgaagaagactagaagtaaacaac
+atgcgaccatcgttaagccacgcaaggctgtagctttatttcccgataacctatcttcca
+taaatagcggacagcaggatactgacgctcaacatcagtggttatggtctaatttttaac
+ttttaataaggtaacttcagcaggcatacacagtaactctttaatttataatcaaattag
+aagtctgacacttcttatatttttctatcatccaacgcgatcgcccattagcttattgtg
+ttactaataacgtatctaaaccaatccttttcaagctactgcctatattgtcaatatata
+caaacaacaggatagtaggctgcttaaaaaatattgtcaaccgtgtacgctttacaatac
+ccggaaatcacaaactttgtagacaacgagtgaaatttatacactacgaagggccagcgt
+acaagacccatgaattaggcgatatgtttattctgacatattggtttatccttaatctgt
+cgctgtaaaatgaagccgcccccatccctgcgaattttttttcgaagattcacgactgaa
+atataaatacgtttggctatatttatgttggagggaggcaatagcctttactgttaaccg
+aagatttagccagtgagtgtgacactaaaacactggaataaatgcaggcgttcttctggg
+taaaaggtttagtcaatctcgcctataagttcatatagctctggatataattatctggcc
+catgcatttatcatggcgcttggtgccctgtgtgaagccggcctctcatattgaaggtcc
+gaagtattccatgtacattaagatcactctctcattcatgcatcttggcttaacaaatct
+ggttgtccaagctttccaggcacgtatggtacaaattcggatcgaatacttataaaaatg
+atatgttaaactgtctaaaacgctcatctacaaagtaaagtgcactaaccaatagagtct
+caagaccgtgtaatgctggtgcactgaatgtgtaatacggttagaagggattagttatgt
+tacaaatccattgaaaacttaagaagcattgcgtgctcggagggtgcatcttttatcaag
+agactaacattattttcaacgacgtacatgctttacaatagggtacttatcaaacgccga
+gaaacgcgcctatagtgatgttatgattatgacccgatatccattggaccgaattttatg
+taggttcccagcgtactcgcgtaatatctcggtattgccataatgtaatacttgtcggtc
+tctcccagatgaaaaagcgttacagagtatttcaatgaaaaacagcgcgcaacgtcaata
+cctttaggggtaacggccgctgatttcatatagatatacgataagttggtatagctctac
+taggtggcatccacaatcgttgcatttactatagctggttacaatcataatctataccgt
+tccttacatactaccatagcgggatagcgtttttttgccgttgattgggtttaagaggat
+gtcagtctcattatatccgattcggtgggagagccgttgttttcaaatcgcacactttgt
+gacataatgtacaagataacaaaactgatataagatataaactgtcaatatcaccttgac
+acttgaatcaaagtaaattaactcgcaaatataatttgactaattgggtgcagatttctc
+aattaataaaaaaatggcaccggatgggcttacaagccccttatcattcacttgtatcat
+gatttccaagaacaatagaatttgctagcaagtatgaacagagattcgaattgcatccac
+agtacgccggagcgtttattttaatgtggatatgacgatgtactgttggcggcatttgct
+agtaaccggtccttatttacgtagcgcacacgtaagcatgtctgggagaaatatggtggt
+acaatctcagagaaagattacagtttggtttaaataggacttatcgggtcggaagtggaa
+cttaataagcagtacacaattgggcaacagacgtcttgcctattacaataggattacaat
+gcgttagatttcagacacgttcgtgtttggctattcgtcaattccctaaatagttagacg
+atcaactattatcaaagtgattctttgttcatcctccattcatgtaacagatggcacact
+acgcataacgccgaggaattttaacgagatttaagagagcagttcgggcacaacccactt
+gactttataacagctcggcagcataaacggtaatatgtgacaaatttccaaacgttataa
+gaacgtatgtgtacttagaaaactaagtggttcatgttcaacagatgtgacgcagcaagc
+ctaacttatctattggttttgctataaaagaacaaagttacacagaatcctaagggcttg
+tttcacacttatgcctagtgcttcaccatcttaaaatagcgaaaccggcacgaatcaaac
+cttaaaacaatgcgcagatattggtgatggtgactccgggtatgataatggtaactgttg
+accagcgcccacctcatcgaagtatagaaagtggttaggataaggatgagaccgaactta
+tttccggccataactttagattttctacctagtacacaacatcagggcggacacgaaacc
+gccatcacatcatataccaggtttaatttgcttaatgggggaagtgtcaacgaaccttcg
+aactttagcaggcatatggccattatatatggccccagagcagaatgctacagcagacaa
+aatttggatttatgtagtttaatacctatcaaacttggtgtgaccatacttgtctaacga
+cagtgcacaaagtgtaagttacaattattactactcagcagcttctgcaatgataaaatc
+ttatcatacacgtcacatatgataatatctacttagggggaacgggctccacaacctaca
+tagtactcaatacttacactattcgacaggcacaccaaacctgtacagtcccaaaagatt
+gagtcaactttgcagtactgcagatcacagtaatagcttagttagcgagtcaaaattagt
+tttctacgagactgcacgaccgtgcaaatttccgatgtgttggctacaaatagcaacgta
+tgaatttgtttgaagccacgtaaactgtacaaccttagagataagtctcaggctactaaa
+aacacgttgtggcactaacaggatcatggttgattcttacttattcggctgaccggccca
+ataagtaaccttcaactagaacagaataatcgggagtagtttaattcagtcaaggtgcag
+gtctcattgtaactaacaagctctgtgtaaccaagttaaaatcgttttcttagcggattc
+cctacttatggatttgagctcgtccacaatattcgatacaagaagtttgtggtccgtaac
+aacgaaattttaattacgctgtgcagcctcatccaaggaattaatagaaggttgatggta
+ggctccgaacgctccatgattataatcaagtggactgtgcagtaaacgaggaaggtatcc
+tgacgtcgtggtgttcgtttttgttatttgtgccctatacgagtagataaaccatgaaca
+gcacagtgtgaacccatggttgattttaggctaccttatttttaatttccgttacacaga
+aacgaattccacaactaacatgccattaatttttcgatatcttataaaagatggtcgaaa
+ttcattcatttattttttttcggttctcgaaagtcaactaagctgtcgcgttttgtttct
+ctttagaggtaaaagtggctttgatctcctacgtttggatactagtcaaccattactcca
+tttgatccgtgagtatcacctgtctaacatccagcattatgactcctcggcgaagaaaag
+acacacttcttagagtcgatgtgtattagctagggacacagttgtttaatacgatagtga
+gcccagggagggcagtgcgtcccccagtagatttattcagctagtgtaagtataagatat
+ctcacccacgaggttcaagtgatatgcagtcttagaataatacttatcctgaatttcgat
+attatgggtacttcaataatccgctagcgctactttatgtctcgttggacagcaggacac
+atggcagtcttaaacactaaagacatcacctgaatgaatgtaatgggattacaagaatca
+atgaggtattatatacgacgtaggaaactctggatatatacagtaatctagttacgccat
+cgcacttcattcctctggaaacttagaagacatcagctgtacgtggaggaaccagacccc
+cgtatgtagccaaatagaaccaaagttgcttatacaaacacacccaatgacaatggaccg
+ctggagttcgtaaactcggaacgtagtactgcacaaacccagcatttagcaataggagct
+acgtatgcaactcccacgtggtaataccttcaagctatcaatatataggtgcctagctaa
+tcgcattcgcaagcagtattcaagcttgtaaaccagtataataattacagaggctctatg
+aaacccaactttccagctaaaagtcccaattaaatggttatttcgtacttttaaagtcgc
+ccgttctgttattacgcgaattgattctactccaaaattaaacacaaattatcaaccgtt
+tcatttatatttgtcaatgcagctgtttaaaataaggctctactaaattataattaagac
+acttattaccagatttctctagttaagtttgaaccagctcgactaccgcgaaagatacat
+tcccttctctatttttcagttcatctatgggtcagagaagcattgaatttattctattca
+ccctcgtcgttcacagcgaatcgtcagtgtgatcagtgtatgagaaatatcctaaaccgt
+ttagtcagaccacacgcttagaacaagtggtctaaaaagactgccctggaaggagtaaga
+agtatacagctgatccggtgtatccttcagtcatctgccctatactaattacacgacgca
+aggaaaaataggtttattttctaggcaaacccttcataggtgactccgatgtgttacgaa
+tcatgcttgagaatgtgctatcgttaccgacggataataacgatctccaatgaaccaaat
+gtagaatgtctattgattacccttttactattcgacttagagataggagatagaacctca
+gtgtacttttttagccgaatgggaatctttgggaggtgaatggccataaggtcgtaaatc
+caaccctcttaaagtcttccatattatatcgttgttcgtggaatcgataacagatttgtt
+gacccatagtaaatgtatactagtttatgttgtaagtgtagattgttttccgattgccgt
+ccaaactttatgtcgtaattgtagaccagtaaagttgaccaaggtaagtgcccagcgatc
+ctgcgagatcgatcgccaatttttccagtcactgtaagtgtaggtttagataaagccgta
+tgagttatatcataagggcctcggaaagcagcttcgaaccaaagttcccttataatagta
+gtttaactataaaagtatatactggtctgtcgccctttcacgatttgttttaccggttta
+tgaagcgttacgtcattagagcggctccaatttaaggttaacggcttccatgtgtagttg
+tatacaaggataacttaaagtatctgttcagcgagctagttaagttatcctcgatagaac
+acaactcagaggtcccaagatcgggtttgcaacttgctaatttattctcaaggcaaattg
+ggaattatcgatacctgtataccataaggtcgctcgatgtgatgcttatgtcttctggtg
+atcctaccttagttagtgctgattaacggaacattaatgtttatcgttttgagatttagc
+caattctctgattctaactcaagatgccttatctgacgtgctatgcagcccctaagtatt
+ttacattgtaataggacacgctcctttaaaactcgccaaaaggtcgttgtggttctctac
+tggttaactatataatttacagctttgttgagctagttcctctttggtttaagtcctcaa
+tattagttggttcgagcgataagttggctagttaccttagtcactatattagatccgaat
+gttatgcttcatctgaagaccgccaccctccaaaatttcttttaagactcacttattgca
+aggtgtaggtgaattcggctcgtttctcaagtggtgtatctgtacacgagtttccatatt
+ttcatcaacagccaccgcacacttatgtcactctaggtattaaaagtcgctctacaaggg
+gacgcaattaagaaacagacatgctagtcaaaaataaacatagcgaggcaccactaattc
+ggccgcttatcaatgggatgctctgcgcgagacgcgccagagctcagtagttagttcgga
+catacatttacttcagatgatcaattagttttctacaaatgcttactctaccccgaaaaa
+agtcaccagactcttacgtctctttagtatccttccgtcttatataaggtcagtcccccg
+tttcggtaccctggaatttactaagaataatgaaacagcccccaaggacgtacgtttaca
+aatgatagaccagatcgcctagcttattccgacgcatgttgcatagaattgaaccaacgg
+aatgtgagagtaactagatgagccgaccacagcacccgtttgcgtcgcagaatacgcctg
+atagttcggccacgaaatcatatgtcctttgagtattaagtatttgtaatgatcaatcga
+gctcaagcaagcttacacttcctcggatattcagggaacttagtgcctttgaaagatacg
+ttgatcaacgaaaaattgataatggctcatatggaatgcctacctcatagtgctgaatta
+acacagcactgcggacctaacttttcgaggtttcaagttcacgtctcaaaacctaatagg
+ctggaatatgtagggatcctcggtgaatttgtgattgggtttgttgtagtactgaccaag
+tgaatattctttttttctaaaagcagatctgctgccgggcactacgaaggagatctctgt
+gtatcattattgcttcttgacatgatgactcttaaatcactgtgggtgtgcaaaacgata
+gcacaacccaattcgatagtacatattgttgatacttcgcactaaaccgttcatatttaa
+aggttgtgctccttccttcgttaaatactggtgacttggtcctatctactattagctaga
+cctctggggaaccacgcccccgtaaaacctgtgcaagagagggggtcatacatcttagac
+atcgcgcctccaccagggaagcattgggtgattgaccaggtgtgtaacaaatatgattat
+tcttatactaatattagcaaagatgcataatgatttgtattaaatgtataattgaattga
+taagggtcttttagtcagtgatagagtagtataaggtagacattagaactcttaaccgga
+cgcagatttttcggtcttagtaagccaattagtcgacaaaacaaggtaagagcggttact
+agtagtacctataatgcactgaatcttcggtcgaagtatagttctaatgctatgcagatt
+gtgacggcgacaaatgttcagacttatatcatgaaacaagctcttgtaagtattgacaaa
+tgaaaagattgaatatttttaaatacaaaatgcgcctacttattaggggaattaaccaga
+ttgaaggccaatcctcacatgtaatgagataatagacgataaatgaaattcttgtaatag
+ttgaactgctacgtgatgggtattatatatgattgagatcctccaattgccgacgtcttg
+tcttgatgcccaaaagattgtcaacgaggagctccctcgcgtacctgtcgtccgtatcat
+aaacgacgcgacatgtacagcactccgaagtataagcaataataatgcgggtaatccaga
+ctagatcttttcggactcaatgcggtttcacggtaaacatgattaataccggagagtagt
+cgagcttatcagcgatgcaagcgaattcattgtgccaggagatacgttgcagataaaacc
+ggcaacgtatgtcaacaagttttggcgatctcgttgtttgtattcgacgaggcgcgggaa
+cttcaagaactatcgtatattcaagtccattaccttttagtttcagactggtggagctga
+ctaaagttatatcatcattttgtacactggtttagttaacgataatttcagatttaacat
+gaccagacgataatcgctgtatatccagttggaatgtggtttgccagaaaggttaactta
+taatcaagcctctcttcagtcttgattcgtcgtatcccatccattgcgctatacctcagt
+gtatttggagctgtagttataccgtgtgctaagatcagtagacatgacgagagcaatatt
+atctaccttacaagcatcaacggacgtctagtcggaacaaaagactctaaaactcgaact
+tcaggttaatatactatagttctgtattcagcagttattcttatattcgatattatcttg
+cctattggatgtctgactttagtatattaatcatagtatctgccatgtaaaggtgccagt
+actaaatctgtttcacagtgcgaattataaacggttacaaccattaaagacaacaagacc
+ctatagctttatttgaattttgtcaatgcgcaacttggagctcgcgatacatcccaatta
+gtctatagggtcgggacgattctacggcatttctggttataatgacaacatggattgtgg
+cccgagaatcgctctttcattaattaagcaatcattacagtcttataagcgctacttccg
+agtggtagcaggtaactcgatataaggtcgcatgagccgaatagcttaaaaaacaggcca
+ccgaacattgatagagaataccgaccacagcgcaacctttgattactttcattaaattgt
+acggctcactcgacatcaagcttaagattgcgataatgtgaactcaaatggatcagtact
+gaagaaccgtaacccacttcgcagaaagcgtacccagagaagatacgctgttacaatata
+cagggtgaaattattgcctgttcttcgtaaccatttcgccaaacttggttagaaatgata
+gccattcatgatagaaataagctgaatgataccagtatctttaactatgtagtcaggggg
+aagataacgatggtccatgtatgtttctgatatgtgacagtattggccgcgtaatttgct
+aacgaagctacttaatgcctttgagcttcatatagatttctttaatcaaaatcggcaaaa
+agatagtatgagctataatatatgctagtagagaactctggaccatcatctatatgaata
+ctgattcgagcgtgcaattactttagcctgcgtactactgactctacaaaacactctgag
+ataagtttgtagtcagtaagtcgctctctataaaccttttggatgaccattgtacagcca
+cttatagatcccaataaatagcacaggagacagagtttttcaatgctcgatcatttgccg
+atagtattttcgtctaacctcagggcacctattatttgatacctaacctaacggcccttt
+cacaatggagaaatatatgacatcgggacaaacacaaatggtgggtggccaggagatatg
+acatggtggcgtctctaagaaacacggactccctctaggcaaactcacgtaaccaatttt
+aatgtcaaacaaaacgctcgaaaagattttgccgtgtaatgacctggtacattgactggt
+caggaatacatcactgtagttgccgtagtgtcctgttggtgttccatcaagacacatcgt
+ataacgcaatttacgacggacatcagatcaagttatacagattatttaagtatcacgtgt
+gcattgggacataagggatctcacacatgccttggaacatttttgctttgtgccgctttt
+tcgctgcactaccaatccttacttaccagtatattcaaaggtcgttaacagaatgagaaa
+ggttagggctctaagttatcgtcgattgggatagacgagacatttgcgagcgccctccac
+ggatacgaatctcccatatcaatgtgaactggatgctatgcagtttagttcttacgtctc
+ctagtggtaaaaatcaaagtagcactcgcatagcagttattcagaacctaatacacaaaa
+ccgtcaaacattttctaattctaggtatgggccgatcataggagctaaggtgaaactcat
+aaatgttttgttagatctagcatcctaaaaagatgcatatactgagtagctggcgtgcat
+tctctcaattgtatcctttttaactgaactagtcggtcccatttcgtgactgagatctat
+taaccgataagattaataacactcgcattcgtatcagctcagagtgaagtttttcaataa
+tttgactgatatattaacttctaaaataaccctttaagcctcggatccgtttcccaatca
+catcaaaaattcttattccaactatctacggattaacaacgtgcatggggatcgtagtaa
+gaacttgttccgatcactttgagtatatcaagttgacggcccggttattattgaatagaa
+acattcacctgctaaattaaataccgcacatcggatacccgatttcagagggccgtctta
+ctaagggcaggctttgttcggtttaactgagatgttcattattttacagtatgcttcaac
+taatatgtaacgaaggacagtggatctgtctccatagtagatcttcagtcgtgaatttca
+taccgctcctatttaagttcgcgttcgagttgttgatcatggcacgtgaaagcaacccct
+agtattctagacgaaaattttttctagttcatctgataatttgccaattcaaaaacaacc
+gctggtttcccggcgcattctctaaaatggaagtcgaacctagagccattatttgtcggt
+aacccatgagttccttcttttcagaagttaatacactgtggtcctatacagaggaaaaac
+agcggttatatacgatcgtggcataacaacattggatcaagatagcaatttggctaccta
+ttctaattctcactagattcggtattccactacaatatcggcagattaggattggatgaa
+taatcggtgtttaagtccggttgcgtctccaatctcctaatttttattaatattgatctt
+ggtgacctattgtaaataaaaacttcaagactttgaataacggtgaaaagatagaagact
+catttgaaaatggatcatccacagatccaaacattagcaagacactaatccccaactagc
+tattctgatcgcgatcgtgctgcagtactcctgtcacaatagtctgttcatgatctaatt
+ctttttgggctttgttcgatggtgattcagaatctttatccggtcgcttccctgtagcta
+ctttgtggggatattgcccggggattatagggttgagatcgtttcctaaaagtatttaaa
+ccaagtagacttcaactaaactacatcagaacatcgtgaagacaccatacgcggtacctt
+tatttaccgataacatttcttcaagaaataccggtaagcagcataatgaccctaaacagc
+tcggggtatcgtcgtagttttaaattttatttaggttactgctcaaggaataaaaactaa
+ctatttaatttataataatattacaaggctcacactgattagatttgtctataagacttc
+gcgatcccccattaccggattgtcttaagaataaactagataaaccatgcattttctaga
+taaggcctttagtctaattagatacaaaaaacacgatagttgcatccttaatttattgtg
+tcaaacctggaaccttttaattacccgcaaatcactttatgtcgagactacctctgaaat
+ttattatctacctaccgcatgaggacttgaaccatcttgtaggagttatgtttattagct
+aagattcgtttatcctgtagcggtccatgtatattcaacaagcaaaaagcactcagaatt
+gtttttagttgagtcaagactgatatataaataagtttccctagttttttcgtggtggga
+cgatattgaattgaatcttaaccgaagagtttcccactctgtcgcacaataatacacgcc
+aatatttccagccctgcttatgccttaatcggttactcaatctcccattgaagttcattt
+tgatctgcatagaagtttcgggcccagccttttttctgccaccttcctccaagctctgta
+gacgcactctaagattgatgctcacatgtattaattctacattaacataaatatataagt
+catgcatcttcgagtaaaatatctggttctccaacatgtcctggcacgtatcgttataat
+gcccatacatgtagtattaaaatgattgggttaactggatattaagatcatcgaaattgt
+aaagtcaaattaacaatactgtctcaagaccgtgtattcctcgtgctcggaagggctatt
+acgcttacttccgttttggtatcttaatatgactttcaaaaattaagttgcagtgagtcc
+tacctgcgtgcatcggttagcaagagtataaaagttgtttaaacgaactacttgctttac
+aataccggtcgtatatatcgccgtgaatccagaagattgtcttctttggattatcaaccg
+agatcctgtggaccgatgttttgggaccttcacagaggactccaggtagagctcgctttt
+gcattaatctaagaattgtacctctctaaaagatctaaaacagtgaatgtgtatttcatg
+gaaaaacacagagaaacgtaaattactttaggccgaaaggcacatgagttattatacata
+tacgagatggtggtatacatcgaattcggggcatacactatagttgcattgtatttagct
+gctttaaataatatgatattaccttccttacataagacattaccggcataccctggtttt
+caacttgtggggctttttgacgatcgcactctcatttgatccgagtagggcggtgacccc
+tgcttttcaaatacaaaaatttcgctatgaaggtaatagattacttttcgctgttatgat
+agaaacggtaaatttaaaattgaaacttctagaaaagtaaagtaacgagaaatgattttg
+tgaataatgcggtcatgattgcgcaagtaagaaaaaaaggcaaaaggatgcgcggaatag
+aaacttatcagtcacgggtatcttgatttcattcttcttgtcaattgccgacataggatg
+aaatcagattccaatgcaatacacagtaacccccacccttgattgtaatgtcgatttgaa
+gttgtacgcgtcgacgaagtggatagtatacgggccttttgtacggtgcgatcaactatg
+aatctcggcgagttagatggtcgtacaatctcacacatagaggtcacttgcctgtaatga
+cgaattttcggctaggtactcgaactttattagaagtaaaaatgtgggcaaaagaaggat
+tccattttacaagacgattacaatgagttacatgtctctcaacgtagtctttccctagta
+gtctttgaactatttaggtactccagaaaattttagcaaagggtttctgtgtgaatccgc
+cattcatgtttatgatggaacaataagaataacgccctcgtatgttatcgacagtgaagt
+cagcagttcggccaaaaacatattcaatttagtacagatccccagaagttaagctaagtg
+ctctaaaatggcctaaacggttatcaaagtaggtctaattactatactaacgggtgcatc
+gtaataactgctgtcgatgcaacactatatgatagtgtcgttttgctatatatgtacaat
+gtgacaaagaagccttagcgattcttgcaaacttaggacttcggattctcaatcttaaat
+gtccgaaaacgcaaagattcaaaaatttaatctatgagcagatatgcctgatggtgacta
+cgcgtatgttaaggctaaatgttgacaaccgcacacataatcgaactattgatagtcggg
+agcataaccaggtgaacgtactttgttcacgacatttattgacatgttctaaatacgtct
+caaaatcacggcgcactagaaaacgcaatcaaatcattgtcctggtttaagggccgtaat
+gccggtagtgtcaaacttcatgagaactttagctggcttttggccagtatttagggacca
+agagcactagccttaagctgaatattttgccatttatctactgttataactttaaaactt
+ggtggcaccagacttgtcgatacacacgcatcaatctgtaacgtaaaaggtttactaaga
+acaagcgtaggaattgagtttatattatatttaaactaaaagatgatattagcttctgag
+ggcgatagggctccaaatcataaagaggaatatattattacacgattagaaacccacaac
+atacctcgaatcgcccaaaagtttgacgaaacttggcagtactccacatctcagtaatac
+agttgggagagtctcaaatgttgttttattactcaatgaaccaccctcataatttcactg
+ctgttccattaaatttgcaaacgatcatttgctttgaagaaacgtaaaatcgacaaaatt
+acagataagtagatgcataataaaaaaaactgctcgctataacacgatcatcgtgcattc
+ttacttaggagcatcacccgcacaataacgtaccttaaactacaacactattagaccgag
+tactgtaattcacgaaagctcaagctcgcattgtaaagaacttgctctctcgtaaaatgt
+gataatagtttgcggagaggattcaattattttccattgcacctactccactagattcga
+taaaagaaggtggtcctcccttaaaaagaaatgttaagtaacatcggaaccataagcaaa
+gcatgtaagtgaaccgtcatccttccctaagaaacataaaggtttttaataatgtcgact
+gtgaactataactgcatcctttcctgacctactccggttccttgttgttatttctgaacg
+agaccagtagataaacaatgtaaaccacagtgggtaccaatggtgcatgtgacgctaccg
+ttgttttaagtgcccgtacaaacataagaagtcataatcttacttgaaattaattttgcc
+ttttattttttttcaggctcgaaattaatgatttgttttttttgaccttctagttacgct
+aatatgcggtcgcctgtggtttctattgagtcctataacgggatgggatctaatacgttt
+ggttactagtaaacaaggtataaatttgataccggagtatcaactgtataacatcaagct
+ttatgactcatacgcgaagtaatgacacaaggctttcaggagatcgcgagtacagagcca
+ctaaggggtgtattacgatagtgacaccaccgagcgcactcactccccaagtagatttat
+gatcctacgctaagtattagatatataaccaaagaggttctagtcagtgcaactcttaga
+ataataattagccggttttgcctttttaggcctaatgcaatattcagctagcccttatgt
+atctcgcgttccacagcaccactcatggcacgcgtttaaactaatcaaatataatctatg
+aatgttatgccagtacttgaataaatcaggttttttataagtccttgcatactctcgtta
+tatactgttagagtcttaccccatagaaattctttcatctgcaaacttagaagaattctc
+agctacggggagcataaagtccccaggatgttgacaaatacaacaaatgtggcttataca
+aacactccatatgaaaatcgaaccctcgtggtagttttagccgaaccttgtacggataaa
+tccctccattttccaatagcagatacctatcctactacctcgtggtattaaattaaagct
+tgaaatatagagctgcatagcttatccaattcccaagcacgagtctaccgtcgtaaccac
+gatttgatttacagacgctagagcaaacccatctttaaacatataagtaaaaattaaagg
+gtgagtgcgtacgtgtttactagcaacttcgcttattaagacaattgtttataagccata
+attaaaaacatatgttcaacaggttcattgatatttgtaattgcacaggtttttaataag
+gatctacgtaagtataatgaacaaactttttaccagagttatattctgtactttgaaaat
+gctcctctaccgccttagagactttcaattagattttttgcagttaatctatgcgtaagt
+gaaccatgcaagggatgcgattcaaccgcctcgtgctaaccctatcgtctgtctcataac
+tgtaggtctaatataattttcagttttcgaacacataaccctttgaaaatctgctattta
+atgtctcacctgcatgcactatcttctatactgctcagaacggctatacgtcactatgct
+ccaagtgacgatttaaacgaagcaaggaataataggtttattttagtgcaaaacaattaa
+gtgcggactacgtgctctttacaataagccttgtgattgggctataggttaagtcccata
+ttaacgatctccaatgtacaaaatcgacaatcgctttgcattacccggttactagtcgaa
+ttacagatagctgttagatactcactctaattttggacaacaatcccaatcttggggtcg
+tctatcgcctgaagctcgtaaatccttccatcttaaacgattacatattatagacttgtt
+cggggtagagatatcacagttgtgcaaacattgtaaatcgatactagtttatgttggtag
+tctagttgcttttaccattccccgaaaaacttgatctactatttcgacaacagtaaactt
+gaactaggtaagtgaaaacagagaatgcctcatagtgccactatttgtccactatatgta
+agtgtagctttacataatccactatgactgagatcattacggcctaggaaagcagcgtag
+aaaaaaagggcccggatattacgactgtaactataaaactagttactggtagcgcgccat
+gtatagatttgttttaccggttgtggttgcgttaacgaatttcagccgcgaaaattgatc
+cgttaaccagtccatctcgacttctataaaacgataaagtaaagttgatgttcagcctcc
+ttcttatggttgcatcgagagtacactactcagtgggaaatagatcggggttcctacttc
+agattgtattatctaggcaattgccgattgtgccatacctggataaaataagctacctac
+atgtgatgcttatctattatcgtcatactaccttagggtgtcctgttgaacgctacatta
+atctttagccgtttgagatgttccaatggataggagtctaacgcatgatgaagtttagga
+aggcagagcatcccactaagtatgtgacagtgtatttcgaaacgagacgttataaataga
+aaaaaggtccttctggttctattctgctgaactattgaatggaaagattggttgacctac
+gtactatttgcttgaagtcatcaatttgacggggtgagagacatatggtgcatactttac
+ggactctatattttagatcagaagcttagcagtcttctctacaccccctcacgacataat
+tgcttttaagaatctatgtttgattcctctacgggaattcggatccgttcgcatgtgcgg
+tttatctaaaccaggggacatatgttcagctaaagcatacgaacactttgctaactagac
+gtatgtatagtagctataaatcccgacgatatttacaaaaagaaatgagactcaaatata
+tacatagcgaccctacacttattcgcaccctgatctaggcgatcctagcacccacacccg
+aaagtgagcactagtgtcttccgtattaaatttactgcagttgagattttagttgtctac
+taaggattactctaacccgtaataaggatcaagactcggtactagctttactatcattcc
+ctatgtgttttcctaactcacaagggtacgtaccagcctatgtaattacaataatgataa
+agacacaaaggaagtaactttacaaatgagtctccagttacactagcttagtccctccca
+tcttgctttgaagtctaaatacgcaatctctgaggatatacagcagaagaacactcataa
+cgttggagtccaagaattagactcatagggcccccaacatttaatatgtactgtgagttt
+gaaggtgttctattgttaattcctgctcttgatacatgacacgtactccgtgtttaaggc
+ttcggactgactttctttcataagttgagcaacgaaaatttcagaatcgataagttggat
+tcactaactaatacggctgattgaaaactccactccggacctatatggtcgacctttata
+cgtaaccgatataaaacttataggctggtatatcgagccttcctagcgcaatttcggatg
+gggtttcttctactactcaacaacggaatagtctttgtttagtaaaccagagctcaggac
+gcccaatacgtaggagagcgctgtggagcatgtgtcattatggactggagcactcttaaa
+tcactctgcgtgtgctaaacgatagatcataacatgtcctgagtaaattttcttgatacg
+tcgcaatataccgttattagttaaacgttctcatccgtcatgcgtgaaatacggctgtcg
+tgctcagatatactattagcgactcatctcgcctaacacgcacacgtataaactcggaat
+gactgccgctcttacatattagaaatacagactacaccacggaagcattgggtcattctc
+aaccgctgtataaaagatgattagtcttataataagattaccaaagaggcagaatcatgg
+gtagtaaatctattattcaagtgattaccgtcgtgtaggcagggagtgaggacgagatgg
+tactcaggacaaatattaaccggacgaagtggtttacgtcgtactttcactattagtagt
+aaatacaaggtaacaccggggaatagtactaaatataatgatatctatcttcgggagaac
+gagtcgtctattgctttgaacattctcaaggcgtaaaatgtgctgacttatagcatgata
+caaccgattgttacttttgtctattcaaaagattgaatagttttttatacaaaagccgca
+tacttatgacggctagtatacagtttcatcccctagcatcaatgctatggacagtattga
+acttataggaaattcttctaatagggcaaatccgtcgtgatgcctattttttttcagtca
+catcctcaaatggcactagtattgtcgggatcccattaacaggctcaaccacgagctcac
+gcgaggacatgtagtccgtatctttaacgaagcgacagcgacagaactcccatggataac
+caattataaggcccgtaatcctctagacatcgtttaccaataaatccgctttctccgtaa
+tcatgttgaataccccagagtagtccagatgataaccgatgaaacacaagtctttctcaa
+tgcacttacggtgaacttattaccgccaacgtagctcatcaaggttgcgacatctagttg
+tgtgtttgcgacgagcccagcgaacttcatcaactttcgtatattcaacgccttgtaatt
+ttactttaagacgcctggtgatgtagattcttagataatcagtttgttatcggctgtact
+ttaccataatttcacaggtttcaggtcaagaagattatagctgtatatacagttccatgc
+tcggtgcacagaaacgtgatcggataataatcaatcgcttatgtcgtctttaggcgtatc
+caatacatgccccgataccgcagtgtatttcgacatgtaggtataccgtcgcatttgagc
+tcgagtcaggacgtcagctagattagattccttaatagaatataccgacctctagtccga
+actaaactatagataacgccaacttcaggttaattgtctagtcgtctgtttgcagatggg
+attcttagatgagtgagtatcggccatattggttcgagcactttagtttttgatgcatag
+gatatgcaatgtatagctgaaagtactttatctgtttcaaactcacattgattaaaccgg
+taaacctttaaagactacaagaaaatattcagtgagggcaattttgtcaatcacaatctt
+ccagctagagatacttcacaatttgtcttgaggctacgcaacattagacggattttcgcg
+ttttattgaaataatcgaggggcccaagagtatccatagttcattttgtaagatttcttt
+acaggcttattacagcttcttcagactcctacatgcttacgagttatatgctagcatgtg
+aacaatagattaatatacaggaaaacgtacattgagagagatgaccctacacagcgcaac
+cgttgagtactttcattaaagggtaacgctctcgagacagcatccttaagatggccttat
+tgtcaaatcatttgcagaagtacgcaagatccctaaccaacgtagaagaatccctacaaa
+cacatgagacgcggtgaaaatagacagggtgttagtattcaatcttcggagtatcaattt
+cgccaatcttggtgagaaagcataccctttcttcagagaaagaagatcaatcataacact
+atctttaacgaggtacgcacgcgcatcattacctgcctccatggatctttaggatagcgg
+aaagtattggcagcgtattgtgatttcgttcctactttatcaatttcacattcatataca
+tgtcttttatcaaaatcgccaataagataggatgagctatattagatgctagtagagttc
+gcgccaacatcatcgataggaatactcaggacagcgtgataggacttttcaatccctaat
+actctctataattataactctctcttaagtttggaggcagtaacgcgctctatataatca
+gtttgctgcaccattcttcagcctctgatacatacaaataaattccacagcagtaagagg
+gtttaattgagacatcttgggaacttaggattttactctaacatcaccgaaacgattatt
+ggataccgtacctaaacgaactttctcaaggcagtaatataggacatccgcaataacaca
+aatgctgcctccccaggagttatgtcttcctggaggctatatcttacacccactcactat
+aggcaaactaaagtttaaatgttgattgtctaaaaaaaagatagataagagttggccggc
+gtagcacatgcgaaagtgaatcgtaagctataattctctggacttgaagttctgtcctgt
+tcctctgcaagaaacaaacttcctttaaagctatttacgacgcacatctcagcaagttat
+aaacatgttggaagtttctagtcggaattcccaaagaacggatctatctaatgcattcct
+acatttttcctgtctgccgatggtgccatcctattcaaagaatttcttaaaagtagatta
+aatgggacttttaacaatgagtaaccttacgcctctaagggttcctcgagtgccatacac
+cagtcaggtccgagccacatacacggagaacattctaacatagcattctcaactcgatca
+tttgcaggttacttctttcctatcctagtgctaaaaatcatacttgcaatcccatagcac
+ggattaagaacctaagaaacaattcagtaaaacatgttcgaattcttggtatgggaacat
+cattgcagctatggtctaacgcattaatgtttgggtacatcttccatcatataaacagga
+agagtctgacgacagggagtgcttgcgatcatgtctatcattgtgaaatcaaattgtagc
+tcacatgtcgtctatgagagcgtgtatccgataagatttagaaaaatagaagtcgtataa
+gatctcactgaacttttgaatgaatgtgaagcatatatgatctgctttaataaaacttta
+tccataggatacgtttccaaatcaattcaataattattagtcaaaatagataaggatgaa
+caacctgaaggccgatcggacgtagaaagtggtcccatcactttgagttgatattgttga
+accacacgttattatggttttcaaacagtctcaggatattgtatatacagataatccgat
+accagttgtctgacgcccctcttacgtaccccaccctttgtgacgtttaaagcagttgtt
+cagtattttaaactaggcggcaactaatttggaaagaagcacagtggatatgtctaaatt
+cttgttattcaggcctgaatttaatacaccgcatagttaacttcgcggtagagttgttca
+tcatgcctcctctaagctaccacttctatgatacaccaatagttgttctacggaatctga
+taattggccaagtcataaacttccgctgcgttcaacccccttgctcgaatatccaactcg
+aaaagacagccttttggtgtccggaacaaatcagttacttcttttctgatgttaattctc
+tgtggtcagatacagaccaaaaactccgcggatttaccatcctccaagaacaaatttgca
+tcaacatagcattttggctacatattctaagtctcaatagtttaggttttcaactacatt
+atcccaacattaggattggaggaataatagctgggtaagtccccttgcgtctacaatcga
+ctattttttatgaatatgcttctgccgcacctatggttattaaaaaagtcatgactttga
+agaaccctgaaaagatagatgaatcaggtgtaatggcagcagccaaagagcatataatta
+gcaacactctaagaacattatagatatgatgatagcgatcgtcatgatgttatccggtca
+caatagtagcttcatcagctaattcgttttgccagtggtgacttgcgctggaagaatcgt
+tatacggtcccttccctcttgatacggtgggggcttattcaaccgcgtggattgggttgt
+catacttgcattaaacgatgtaaaccatctagtagtcaactatactaaatcacaaaatag
+tgatcaatacatacccgcttcatggttttaaccatttaattgattaaagatattccgcta
+agaaccattatctacctaaactgatcgccgtatcctagtagtttgaaatttgatgtaccg
+taatgatcaacgaagtaaaacgttatattgtatgtagaataataggtcttggagctaaat
+gatgtgattggtagtgaagacttacccttacaactttaccggtttctcggaagaatatac
+tagagaatcaatgcatgggctacataagcactttagtctaatgagataaaaaatacacga
+gtcttccatcatgaattttttgtcgaaaaactcgaacctggtaatttaaaccatatatct
+ttatgtcgtcaataactctcatatgttttatataacttcccaatcacgacttgtaactgc
+ttgttcgactgagctgtttgagctatgaggccgggatccggttgagctacatctatttgc
+tacaagaaaaatgaaagcacatttgttgggagttctggctacactcatagagaaataagt
+ggcccgagtgggtgcggcctgcctccatattcaagtgtatcttaaaccaagtggttccaa
+cgctcgcgctaaagaattaaagcctttatttcctccacggagtagcccgtaatccggttc
+gaaagagaccattgaagttaattttcatatccagtgaagtttaggcacaagcatgtgttc
+tgccacatgcctcaaagcgctcttcaaccaagatatgattcatcctaacttcgatgaatg
+cgtctgtaacataaatatagaaggaatgattcggcgagttaattttcgccttctccaaca
+tggcatccctacgttcgttataaggaccatacatgtaggttttaaaggtttgcggttaat
+cgatatttacatcatagaaattctatagtcaaatttacaagactctagatactcactcgt
+tgcagccggctaggaagcgctttgtaccttacttcccttttcgttgcgtaatatgaattt
+catatagtaagttcaaggcactcatacctccgtgaagagggtagatagactattaaagtt
+gtttaatagtacgtattgatggaaatgacccgtaggagatttaccactcaatccacaaga
+ttcgctgctgtgcattatcaaaacagtgcatgtcgaaacatgggttgggtccttcaaaca
+cgaatccaggtagagatacctttgcaatttttcgatgaaggcgaccgagataaatgagct
+ataacactgtatgtcttttgattgctataaaacacagaaacggatattaatttaggccgt
+aaccaacatctgttatttgacatagaacagatggtcctttacagcgtattccggccttaa
+tattgaggtccagtgtattgtcctcctttaaagaagttgattgtaactgacttaaataag
+acatgtcacccattcactgggttgcaactgctggccctttttgtccatcgcacgctaatg
+tgataacagtaccgccctcacacctgcgtttaaaagacataaatgtcgctatgaaggtta
+ttcattaattttagctgttttcttagaaaaggtaaatttaaaattgaaaaggctagaaaa
+ctaaagttacgacaaatgtgtttgtcaagtaggcgggcatcattgagattgtaagaaata
+aagccataaccagccccggaatagaaaatgttaaggaaaggcgatcttctttgaattctt
+attgtcaagtgcagtcatacgttcttatcagaggacattgcaataaaatctaacaccctc
+ccttgtgtggttgggccatttgtacttcgaagcgtccaccatgtgcagaggataacggaa
+tgtggttccgtcccataaacgatcattctcgcccacttagtggcgcggtaaatcgctctc
+atagaggtaactggcctgtaatgtccaatgttaggctaccttctccaactttagtacaac
+gaataatgtccgattaacaaggagtcaatttgtcatgaccagttcattcaggtacttgta
+tctatacggacgcgttccagagtagtatttgaaattttgaggttctactgataagtttag
+ctatcgctgtatgtctgaataagaatttaatgtttatcttcgataaataacaattaacaa
+ctcctaggtgatacactgtgaagtctgctgttccccaaattacatatgctattttgttca
+cataccatgaagttaagctaagtgctctataatggcataaacggttatcaaactagctcg
+aatttcttttattacgccggaagcggattaactgctgtagatcaaacacgttaggatagt
+gtcgttttcatatatatctaaattcggtctaacatgcattacccatgcttgataacgtag
+cacttcgcagtctaattatgtaatgtccgtttaaccaaactttaaaaaagtttatctatc
+accagtgatgcctcatcgtgactacccggatctttagcctttagggtctaaacagaacta
+atattactacgtgtcatactccggagcttaaccaggtgaaacttatttgttaaccaaatt
+tagtgacagggtagaaatacgtatcaaattaacccagcaatacaataagcatgaaaataa
+ttgtaatcgggtttgggccggaatcccgcttggcgaaaacttaatgacatagtgtgatgc
+attttgcactggattgagccacaaactcaactagcattatgctcaatatttggccagtgt
+tctacggtttgaaatttataaaggccgcgcaaaagtcttgtagttacaaacgcataaatc
+tcgaacgtaataggtttaattagaacatccgtaggatttctgtttatagtagatttatac
+taaatgttctgattagattctgacggccttacccatacaattaataaagacgaatatatt
+agttatagtttactatccaaataaattaagcgaatcgaaataaactgtcacgatactggg
+cagttatcaacttatcacttatacagttcggacactctatattggtctgtgagtactcta
+tcaaactaactcataagttaactgcgcttccattaaatttcaatacgttcttgtgctgtg
+tacaaacctataatcgaataaatgacacatatggagatgcataataaaaaaaacggctcc
+atatttctcgttaatcgggcattcttaaggaggagcatctcaccaaaaataacgttcctg
+ataagtcttaactattagaccgtcttcgggaatgaacgaaacctcaagctagcatggtat
+agttcttgatagcgcgtaaattctgataatactgggcggacagctggaaattagttgcca
+gtgcacctacgcaaatagtttacataaatcaacgggctccgaacgtaaatacaaagggtt
+agttacatcgcaacaagatgaaaagcatgtatgtctaccgtcatccgtccctaacaaaca
+taaaggtggtgaagaatctcgtaggtcaactataactccatccttgaagcaactactccg
+cgtccgtgtgcgtagttcgcaacgagaacactactgaaaaaagctaaacaactctcggta
+caaatgcggcttgtgtcgataaagttggtggtagtgcacggaataacataacaaggaata
+ttatttattcaaattttttgtgactgttatttgttttctgcctagaatgtaaggatgtgt
+tttttgtgacctgatagttacgcttatttcaggtccacggtgcgtgagagtgtgtcctat
+aacggcaggggagcgaagtagtgtcctttagactattcaaggtagaattttgataacgct
+ctataaaaggtagaaaatcatgattgagcaataagaccccaacttatcaaaaaaggagtt
+ctcgacagcgcgtgtacagtccctataacggctgtatttcctgtgtcacaacaccctccc
+atcgcactcaaaatgtagatttatgatcagacgctaacttgttcttagagaaaaatacac
+gggatactctgtgcaacgatttcattaataaggtgcagcttgggacttttttggccgtag
+gctttattaacattcacagtaggtagcgagacttcctatgaaccaatcatgccacgcgtt
+ttaacgtttcaaatataagctaggaagcgtttgccaggacttctataatgcaccgttttt
+tttagtacttccttactagccttagtttatgttagagtctttccaattacaaaggattga
+atagccaaaatttctacaattctcagcgaacgccagcttaatctaaacacgagcttcaaa
+tattctacatatcggcaggagtcaatatataaatatgaaaatcgtaccatcctcgtactt
+ttagaccaaacgtcttcggataattaaatcctttttcaattaccacagtacgtgcattag
+aactactgctatgaaagtaaaccttgaaatatagtcctcaagagcgtatccaagtacatt
+gcacgtgtatacagtcgtataaacgagttgatgttctgacgctagagcttaccattcgtt
+aaacagataactaaaatttaatggctgagtgacttagtgttttcgacaaacgtcgcggat
+gtagactattgtttataagcaatttttaaaaacatatgttcaaaacggtatgggatatgt
+cgaattccacaggggtttatgtaccatagaagtatgtataaggtactaaaggtttaaatc
+tgtgatattcggttcggtgaaaatcagactagtcacacttagtgtctgtaaattagattg
+ggtgaaggtaagcgatcccgaactctacaaggcatgggatgagattctaccgactccgga
+taacactttacgatcgcgcataactctagctcttagataagtttaacttgtcgatctcat
+aaacagttcaaaatctgcgatttattgtatcaaatccatcctctatcttctataatcatc
+tgaaccgcgatacggcactatgagccaagtgaagattgaatccaagaaagctataattgg
+tttattttagtccatttaaattaagtccggtataagtgctctgtacaatatgcagtctca
+tgggcatatacgttaactaccttttgatacttcgaattggtaaaatatcgactatcgatt
+tgcagtaaaaggtgtagagtccaattactctttcctgttacatacgatctcttagtttgg
+acaactagcccatgatggcgctcctctagcgcatgaacctactttataattacatcttta
+tcgatgaatttttttagactgcggaggccttgagttttaacagggctgctaaatttctta
+agcgattagacggtagcgtcgtacgctacttgcttggaacaggcaccgaaaatattgatc
+tactattgcgtcaactctattctgctaatagcgatggcaaatcacagaagccctcttagt
+gacaatagttgtcaactatatctaagtcgacctttactgtatcaacgatcacggagagaa
+ttaccgaatacgaaacctcaggactaaaaaacggaaaggatttgtcgacggtaaatataa
+tacttgttaagggtagcgacacaggtatactttgggtgtaaacgtggtgcttcccggaac
+gattttcagaccagaaaattgttccggtaaccaggaaatctcgtctgcgttaattcgtgt
+tagtaaacttgatcttcagactccttcttttcgttgcagcgagacttaaattatatctgc
+gaaatagtgccccgtgcatacttcagatggtaggagataccatttggcccattgtgactt
+tacgcgattaattaaccgacatacatctgttcctgagctatgatcgtctgaataaattac
+ggtctcctcttgatacctaatggtttctggagacgtttctcatgttcaaatggatagcag
+gagatcgcttcatcaagtttagctacgcagagcatcaaaatatgtatgggaaagtcgatt
+tccaaaccagaagggataaagagaaataacggacttctccgtagattagcctgatatttt
+gatgggaatcatggcggcacatacgtaagagttgcgtgaacgaatattttggacggcggg
+agacacatatcggccattcgttaaggtctctatattggacatcacaagcttagcagtatg
+agctactaacactcaagacattattgattttttcaagatatgtttcattcctctaccgct
+attcccatacgttcgattcgccgggtgagcgaaaccacgggactgaggttaagctaatca
+ataacaactcgttgcgatagagacctatgtatactagagagaattccccaacatttttac
+aaaaacaaagcagactaaaatagatacagtccctccatacaattaggaccaacatgttat
+tgccgatcctagcacacacaccacaaactcagaacttctgtcttacctatgaaagggtct
+gcacttctgattgtacgtgtctaattagcattaatattaaaactaattaggataaactat
+aggtacgagctttactataagtcactaggtgttttccgatcgaaaaacgggaccttcaag
+ccttggtaagtacatttaggataaagaaaaaaaggaaggtacgtgactaatctgtctaaa
+ctgacaatagagtagtacctacatgcttcatgtcaagtcttaatacgcaagcgctctcgt
+tatactgctcaacaaaactcataaagttggactccatcatttagaatcatagggaccaaa
+acatttatttgctactgtcactttgtaggtgttctattctgaattcctcatattgataca
+tgaatcggaatacctgtggatcccttaggacgcacgtgctttctttacgtcagaatacat
+attgtcagaatcgagaagttccatgcaattaagaattcgcctctttgaaaactcatatcc
+ccacatatagggtccaccgttattcggaaacgatataataattattccagcgttgagcgt
+cccttaagagcgcattttcgcttggcctttcttctacgactctacaacgcaagtggctgt
+gtggagtttaccacagcgcagcaccccatagaactacctctgagagcgcgagatggtggc
+agtatgctctgcagctagcgtttagaacgcgcccgcgcattaaccagtcatattaaaatg
+gactgtcttaattgtcggcattaggagcaatattaactgatgagggtatcggtcgcagaa
+gtaatgacggaaatacgcctctagtccgcagagatacgattacagactcagatcccctaa
+caagcaaaacgattaaatcggaatcactccccctatgacatatttgaaatacacaagaaa
+ccacgcaacatgtcccgcattctcaaccgcgctttataagatgttgagtctgagaattag
+atgacctaactgcaagaatcatggcgagtttatctagtaggcaagtctgtaccctagggt
+tcgaacgctgtgacgtcgtgatcggtctaaggacttagatgataaccaagaactggttta
+ccgagtactttcactattaggagtaattacatgcgttcaccgcggaatacgacgaaattt
+tttcatatctttatgagcgagatcgtgtcgtctttgcattgcaacagtcgctaccagtaa
+ttgctgatcaattatagattcattatacagatgcttacttttctctattcaatactgtca
+tgagttgtttttaaataagcaccagaattatgtcgcctagtataatcttgcttccacttg
+aatcaatgcgatggacagtattctactgattgcaaagtagtctatttcggcttagcagta
+cgcatgcctatttttttgcaggcacagaataatatgcaactaggattctcggcatccaat
+taacaggctaaaacaccaccgaaagacaggtaatctacgaagttgatgtttactacagaa
+agcgaatgatatcacttggagaacattttagatgcccccttttaatctagactgagtgta
+ccaatatatcaccggtctaccgaatcagcttgaataaaccactctagtactcatgataac
+cgagcatacacatgtatttctcaatgcactgaaggtgaactgtttacaccataccttgcg
+aatcaacgtggcgacttatacttctgtctttgagtacagcacaccctaatgaatctaagt
+tagttgttgatacgaattgtaatttgactggatctcgcctcctcatctagattcttagag
+aagatgtttcttatagccggtactgtaactttattgatctggtttatggtaatcaacatt
+ttacctctatttaaacgtccttgcgccgtgcactcaatcctgatcggtttagattcaagc
+gattatcgagtctggaggccgagaaaagaaatgcacagagtaagctctctattgcgacat
+ctacgtagaaactcgcatttcagatcgagtaagcaactctcattgtgttgattcagtaat
+acaagattacctacgcttctacgaaatatactatagatttagcctacgtcacctttagtg
+tcgagtcggagctttgaagatcggatgcggtgtggactgtgtataggcaattttgctgcg
+agctcgtgacttttggttgatgtcgatatcaatgggatacctcaaacgtctttatctctg
+gataactcacattgagtataccggtaaaaatttattctattcatctaaatagtcagtgag
+ggctagggtcgcaatcacattaggccacatacacatacttaacatgttctattgacccga
+cccaactttagtagcattgtagccgtttatgcaaatatgccaggcgccaaacactagcca
+gagggcattttgttacatttatttaatcgattattacacagtcggaacacgcctacatgc
+gttcgacttatttgcgacatggtcaacaattcagtaatttaatccaaaacctaaagtcag
+agacatgacactaaaatcacattaaggtcagttagtgaaggaatggctaaccagctagag
+aatgcatcattaacaggcacttattgtcaaatattttccagatctaagcaacatcacgtt
+aaaaagtacaacaatcacttaaaacacatcagtccaggtgtaattagaaagccgcttagt
+aggcaagcgtaggagtataaatgtagacaatagtcgggacttagcagacactggatgcag
+tcatagaagatcttgcataacacgttagggttagagctacgaacgcccatcattaactgc
+ctaaagcgtgcgtgagcttagcgctaacttttccaacacgtttgtgatttcgttcataat
+gtatcaatttcacagtcatatacagggagtgtagaaaaatcgcaattaacatacgttgac
+ctatttttgttcagagttcagttagagcctaatgattcgagagcaataatcaggacagcc
+tcataggaagtgtcaatcacttagaagctatattattataaatcgctctttactgtcgtc
+gaaggaacgagcgagagagaatcagttgcctgcaactggcttaacaatatgatacataaa
+aatattttcatcaccactaagacggtggaattcagacttattggcaacttaggatgggac
+tattaaataacccataagatgttgggataaagttacgaaacgaaagggatatagcctgtt
+agataggaaatccccaataaaacatagccggcctccacagcagtgatctattccgccacg
+cgatatctttataccacgcaatataccaataataaaggttaaatgtggttgcgatttaaa
+aaagatacatatcagttgcaccgcgtagcaaatccgtatgtgaagcgtaacctagaatta
+tagcgtctgcaagttctctaagcttcctctgcaagatacaatatgactttttagcttttt
+tactaccaaatctcagaatcttagaaacaggttggtacgtgctactcggaattcccaaag
+taccctgctatatatgccattccttcattggtccgggctcaccatggggccatcatagta
+atagaaggtagtaaaactagttgatttccgacttttaacaatcactatcctgacccagat
+atgggttccgactggcccttactccagtaagggcagacacacagacaacgagaacttgat
+aactttgaattctcaaatcgatcattgcaacgtgacttatttactagcctactcctataa
+ttcatacgtcaaatacatttcaacggaggaagataataagtaaatattcactaaataatg
+gtcgaaggagtcctttgccaacataagtccacatatgcgctatagattttttcttggggt
+tcatattcaataagataaacagcaagagtatcacgtcagcgagtcattgagatcttggct
+agcattgtgatagcatattctacctaaatggtagtctagcacagagtggataagatatca
+gttagatatagacaagtactataacagatctcgcttcgttggattgtatggctagctttg
+atgatatgattttataaaaattgatccagacctgacctggccaattatattcatttttta
+tgagtaaaaatagataaccatgaaaatactcaagccccttaggacgtacaaagtggtaac
+ataaatttcaggtgttattctgcaaccacacctgttttgggttttcaaaaaggctaagca
+gattggttttacagataatccctgaacactggtatctcccaacgatgtcgttcccaaccc
+ttgctgaccttttaagctctgctgaagttttgtaaactaggcggaaaatatgttcgatag
+atccactcgcctgaggtagaaattcgtcttagtaacgcctctttggattacacagaatag
+tgtactgacacgtacactgctgcagcagccatacgctaacattaaaattcgttgagtcta
+catttgttgttattcggattatgttattgggaatagtatttttattcccctgcgtgaaac
+cacatggatagattagcctactcctaaagactcccttttggtctacggttcaattctctt
+actgagtttatgttcgtaattatatcggcgcagtgaatctcctaattatcaccggagtta
+ccagacgccatgaacttatggccagaaacattgcatgtggcctacataggattagtatca
+agagtttacgtttgcaacgacatttgaccaacttgaccattcctgcttgtagaccgcggg
+aactcccctgcacgcgactatagaagttggtggtggatgtggcttatgccgcaaatatgg
+ttttgaaaaaagtaatctattgcttgatacctgaattgagacatgtataagggctattgc
+cagatgaaaaactgcatataaggtcaaacaatataagaacattatacataggatcttagc
+gttcctcaggatggtatacgctataaagtctagcttcagcagctaaggagttttgccagt
+gcggacttccgctggaagattaggtttaaccgccctgacatcttcataaggtcgggcctg
+attcaaacccctggagtgccgtctcatacttgaattaatcgatggaaaacttcttctagt
+ctaatattattattaacaaatgacggttcaataaataacaccgtaagggtgggaaactgt
+taagtgatgaatcattttaacctatcatccattagctacagataatgataccccgatccg
+actagggggtaagtggttgttccgttaggataaaccatgtaaaacgttagagggtttgta
+gattaattggtattccagataaatgaggtcagggcgagtgatcaattacactgaaaaatt
+gtcagcttgcgcggtagttgttaagacagtataaatgaaggggattcagaagcaagtttc
+tcgattgactgaatttataaaccagtcgtcaatcatgatttttgtgtcgattaaagccta
+aatggtaatttaaaccattgatatttatcgagtctataaatatctttggttgtatattac
+ttcacaatcaccaattctaaatgattcttccactgtgcgggtggagatatcaggacgggt
+taaggttgacctacatcgttttgatacaacaaaaatcaaagcacatggctggggacttct
+cgatactatctttgagatagtacgggcaagagtgggtgacgcctccctacattttcaagt
+ctatcggataacttctcggtaaaacgctcgcgatatagttttaaagcattgatttaatcc
+acgcaggagcaagttttaccggtcgaatgagaaaattcaacgtaagtgtcatatccagtc
+atggttagccaaaagcatgggttatccaaaaggaataaaacagctcttcaacaaagagat
+gaggcttcataacttcgatgaatgcgtatggttctgatatatagatcgatgcatgaggac
+actttattttagccggcgaattaatggaatccatacgttacttatttggacatgacttct
+aggtgtttttgctgtcccgtttagcgatatttacagattagtatttcgtttctcatagtt
+aattgtatctagatactaactcgttgaagacgcataccttgccatttgtacaggacttaa
+ctgttccgtgcgtaatttgaatttcttataggttcttcaaggcacgaatacctcactcat
+gaccgttcatactctagttaaggtcgggaatactacgtatgcagggaattgtaacctagg
+agatttacaactctttaaacaagagtcgctgaggtccaggatcaaaacactgaatctcct
+aacttcgggtgcctccgtaaatcacctagaaacctactcatacatttgcaattttgagat
+gtaggcgaaagagagaaatctgctttttaacggtatctcttgggattccttttaaaaaca
+cataacgatagtaatgtaccaagtaaccaaaagctgggatgtgtctgtgtactgatccgc
+cgtgtcagagtagtccgccatgaatattgacgtcaaggctagtgtcatcaggtattgatg
+ttcattgtaaatgaaggaatgaactaatgtcaccaagtaaagggggtgaaaatgctcccc
+agggttctacagacatagagatggtcagaacacgacccccctctcaacgcagtgtatttg
+aaatatatggacatatctaccttattctgtaattttagatgtgttctgtgtataccgata
+ttgataagtcaataggcttgattacgtatcttaagacaaatctgtttcgcaagtaggacc
+gcatctttcagattgtttctttttatgccataacctgcccaggaattcaaaaggttatcg
+atacccgatatgctgtgaattattattctaatggccactcattcctgcttatatctggaa
+ttggcatgaatatcttacaacctaaagtctggcgttgcgccagttctacttcgtaccgga
+caccatctccagtcgttaaccgaaggtgggtacgtcacataaaagttcattagaccacac
+tttgtgccgacgtatatagatatattacacgtatagggaatgttttctcctaggtgaccc
+gaccttctactaaggttgtacatcgtataatggcccattaactacgaggaaagtggtatt
+gacctggtaatgcacgttcttcgatatataccgacgaggtaaagtctactattgcaaagt
+ttgacgttatactgataagtttagatttccctggatcgcgcatgaacaatgtatgcgtta
+tctgccatatataacatgttacaaatccttggggatactatcgctactatcatcggacca
+aaattaaataggctagtgtcttatcagaacatcatgtttaccgaactgatctattttcca
+atttaagctgatattacgtccgcgtatttattttagttccccggatgacgattatctgag
+ctacatcatacaagttagcatactcgccggtgcattgatttcttatttcgctatatcttc
+aagttcacaggcttcatatagttccaattagcagtataattaggttttgtaactttaacc
+atactttataaaaggttatattgcacaactgatcaagcatccgctataacccgagcttta
+ccagttagcggctaataacaaataagatgacttcgtgtcatacgaccgtcatgatcatgc
+tctaacttaggtgggaaccaaatttaggcaatgggtagtaataagtataaaatgatacca
+catatactataacaatgaaattatttgtaatccggtttgccaacgtatcccccttcgcga
+taaattaatgacatagggtcatccatgtgccaatcgtgtgtgccaaaatctcaaattcaa
+ttatcatcaatattggccaagtgttataagcgttgaaagtgatataggccgccaaaaagt
+agtctacttaaaaaccaatatttatcgttcgttattgctggtagtacaacatcacgagca
+tttctcttttgagttgatttatactatatctgctgatgtgattatgtcccacttacccag
+aatattaagaaagtcctagattgtaggtatacttgactataaatataatttaagactata
+caaataatctggctacattatgccatcgtagaaactgataacgtagtaacgtcggacact
+agattttggtcggggagtaatctagcatactaacgaatttgttaaatccgctgaaagtat
+atgtcattacctgcttggcctgtcttcaatacgtttagactattaaggactcatttcgag
+atccagtattaattatacgcatccatatttatactgaagacggattgagttaggacgaca
+agctaaacaaatattaagttaaggattagtattatattgtagaaactcgtcgggttggaa
+cgattcatcatcatagaatgcgttacttattcagagagacttaattcggttatgactggc
+agctcacctggaaagtaggtgaaaggcaacagaagaatattgttgactgaattctacggg
+ctacgaacgtaattacaaagcggttcgtaaagagcataaagatcaatacaatggatctct
+acagtattacgtaaataacatacataaacctggtgttgattcgactagctcatagattaa
+tcattaattgaagctacgaagacgcggaagtctgcggagtgagcaaacagtaatcgactg
+ataaatgcttataatatcgcgcttaaatgccgcatggtgtacattaacgtgggggtagtc
+aaaggaatatatttactaggaatattagttatgcaaatgttgtgtcaatgtgatgtgttt
+tatccagacattggatgcatggctgtgggggcacaggatacttaccattagttcacctac
+aagcggcgtgagagggtctcagttttagccagcgcagagaagtacgggcctttagacgat
+taatgctagaattgtcataaacctcgtgaaaagctagttaataatcatggtgctagaaga
+acacaacttttctataaaccagttctcgactgacagtcgtaactcactatatcgccgctt
+tgtactgtcgcaaaaaaacctcacatagaaagaaaaatctactgggtgcatcagtagaga
+tcgtgttctgagagataaatacaccggatacgatctgcatcgagttcatgtattaggtca
+agcttgggactgttgtgccagtagcattttttaacagtcaaagtagggtgagacacgtca
+tatcataatatatgccatcgaggtttaaagtttatatgataagctagcatgcgttgcaat
+cgtattcttgaatgctccgtggtttgtactaattcctttatagactgagtgtatcgtaca
+ctcggtacaattacaaaggatggaagagcaaataggtcttcaattataacagtaccccac
+cttaatctaaaaaccagcttcaattagtattaatttcgccaggagtatatatataaatat
+ctaaagactaaaagactcgtacttttacaacttacgtcgtagcataattaaatcatgggt
+aaatgtcatcagtaagtgcattagaaatactcctttgtaaggatacagtgaatgtgtctc
+agcaagtcagtagaaatggaaattcatactcgattaaggcctataaaactgttgttggta
+tctacagagtgattaaaattagtgaatcagattacgaaaatgttttcccgctcgcactta
+cgcgtttagacaaaagtacaggtggtacaattggctgtagtagaattttggtataaaata
+ggtgataaaccggatgggtgtgggcgaattcaaaagcggtttttgttccatagaactatg
+tagttggttataaaggttgtaatctcggagattaggttagggcttaatcagaatagtaac
+aatttctctatgtaaagtacagtgggtgatcgtatgagttcacgaactcttaatgccatg
+cctggacaggataaacaatacgcatataacttgacgatcgagcttatatcgacctatttg
+agaagtttaacgggtcgatataatatacaggtcttaatagccgattttttctagaaaagc
+aatcctatatcttagttaatcagatcaaccccgtgaacgatatatcagcaaactgaacat
+tgtatacaacattcctttttgtccgggtggggactccatttaaagtatctcacctagaac
+tcagcggtaatagatgcagtctcttgcccagttacggtaactaaatgttgatacttagaa
+ttgctaaattttagtctagacatttccaggtaaaccggtagacgacaatttctctgtcat
+ctgtcataagatcgcttagtgtgctcaaattgcaattgagggccctactatagacaatca
+tcagactttttaattaaatagttttccatgaatgtgttgtcaaggcggaccccttcactt
+ttatcacggctcataaatgtcgtatgactgtagtcggtagcggccttcgagtcttcaggg
+gaaatggaaaagaaattaggcttctaagatggactataatcgattaggctaattccgttc
+gcaaatcacagaagcaatcttactcaaaattgttggaatcgatagcgaacgcgaccgtga
+atgtttaaaagtgctcgcacagaattacccaatacctatcatcacgacttaaatacccaa
+agcagttgtagtcgcgtaatagattaagtctgaagcctagagacaaagggatactgggcg
+gggaaacctgctccttcacggtaacatggtaacaacagaatttggttaaggttaaaacga
+aatatactcggagtgaattactgttaggtttcgtcatcggatcaataagtagtttccgtg
+aagacactcttatattagatctccgaaattctgacccgtgcattaggcacttggtaggag
+attccatttggaacttgctcaatgtaagccagtaatgttccgaaataattcgctgcagga
+gcgaggagccgctgaataaaggaccctcgcatcttgttaccttatggttgagggtcaccg
+ttctctgcgtcaattccagagctggagatacattcatcaacgttacctacgcacagaata
+aaaagatcgagcgctaactcgttttcctaaacacaacggatttagacaaattaccgaatg
+cgccggagagtagcatcttagtgtcatgcctatcatggcggctcagtacgaagagttcag
+gcatcgaatattgtggtagcccgcactcaaagttccgccattaggtaagctatatattgt
+ggtcagaacttgaggacaactatgagctactaaaaataaacaattttgtcatttgttcta
+gatatgtggcattcatcgaacgcttgtaccagaagttacattcgcagcgtgagcgaataa
+acccgaatgagcgtaacattatcaataacatatagttcagatagagaacgaggtattcga
+cagagaattacccaacattggttattaatctatgcagaataatttagataatgtcactac
+ataatattaggaccaaaaggtgattccccagaagacaaaacaataaacaatctcacatat
+tcgctagtacctatgtatgggtatgatcttctgattggacggggataatttccaggtata
+ttaaaacttattaccataatctagacctaagagaggttatataagtaaagagctgtgttc
+cgatagaaaaacccgaccttaaagacttgcgaagtaaattttgctttaacaaaaaaacct
+acgtaagggaatattctgtataaactgaaaagtcaggtgtaactacatgagtcatgtctt
+cgattaattacaatgcgatctcgttattctgatcaactaatatcataaactgccactaca
+tcttgtacaatcattcgcaacaatacttttatgtgctaaggtcacgtgcttcctctgcta
+tgctgatttaatcagattcataaaggaatacgaataactctggatccattaccacgcaag
+ggatttatttacggctgattactttttggctgttgacagaactgccatgaaagtaagatg
+tcgcatcttgcataaataatagcacctaatatagccgacaaagtgattccgataacagat
+tttaagttgtccagccttgagactccatgaagaccgcttgggagcttccccgtgattaga
+agaatctaaatcccaagtggatggggggagtttaaatctcagcaccaacaaatagtactt
+cctctcagagcgcgtcatggtcgaaggagcctatcctgatagaggtttgaaagcgcacgc
+gcatttaactgtcatattaaattggaatctcgtaagtgtcggcagtacgacaaattttaa
+ctgatgtcggtatacggagaagaaggaagcacgcattgaagcagctacgcagaactgaga
+agatgacactctaagatacaattaatacaaaaacgttttaagcccaatctatcaacagat
+gtaagatgtctaatacacaagaataaaaccttcatgtcccgatgtataataacagcttta
+tttctgctggtcgaggtgaagtagtggaaattactccatcttgctgcgcgtctttatagt
+gttggctactctgtaaccgacgcgtccatccctctctcctagtgatccgtatatccaatt
+agaggataaccaacatctgcgttaccgacgaatttaaatttttcgactatttaattccgt
+tcaaacccgtattcgtagtaagtgtttcatagatttatgaccgacatcgtgtacgagttg
+cagtgcatatgtagataccactaattgctgatctaggatacatgctttataaacatgctt
+acttggctattttatttactgtcatgtgggggtttttattttcaacaagtatgtgctacc
+attggataatctggcttcaaattgaagatatgcgttccaaacttgtctactgtttgctaa
+gtaggagttgtcccattagaactacgcagcacgtggtttgtgatcgaaaagaataattgg
+caaatacgaggctagccttcaaatttaatgcagattactcctcagaaacacacgtaagcg
+acgaacgtgatgtttactacacaatgcgtatcatagaaattcgtgataatttttgttcca
+acctttgaatctagactgagtggaaaaagatttcaccgggataccgtttatgctggtttt
+aaaaactcgtcgaatcatcttataactgcattcaaatggatttctcaatcatctgtacgt
+caactgttttaacaataacgtcagaataaaccggcacaatgagacggcggtctttcacta
+caccacacccttaggattataagtgacgtgtggattcgaattctaaggtgacgggatcta
+caagcctcagctacattaggtctgaagatctttcgtatagccgcgtatgttactgtttgg
+atatgggttatgctaatcaacagttgacagcgagtgaaacggccttgcgacctgaaatct
+ttacggttaccttttgattcaagacaggatcgacgatggaccacgtgaaatgaattcaaa
+actgtaacatcgcttgtgcctcagcgaccgagtaacgacaagttcacatcctctatgcaa
+ctatcattgtggtcattaaggtattcaagattaactaagagtcgaccatatattctagag
+ttttacaattaggaaccgttagtctagactaggagcgtgcaacatcgcaggaggtgtgga
+ctgtcttgacccaagttgcctgacacatagtgtcttttgcttcatgtccttagcaatgcg
+atacctcaatcgtagttttatcgggataaataacatggtgtttaaccctattaatggttt
+ctattaatctaaattgtaaggcagcccttgggtcgaaagcacattaggccacatacacag
+tatgaaattgttcgagtgtccagaccataattgactaccatggtacacggtgttgctatt
+atgactcccgcaaaactcttgacagagggaattttggtacattgatgtaatcgatgattt
+aacagtaggaactagacgtcatccgttagactgagttccgacatgctcaaattgtcagga
+tttttatccaataactaatggctctcacatgtaaataaaatcacattaacgtcacttagt
+gatggattcgctaaacagatagactatcattcatgaactggcactgtttcgattatattt
+gcaacatcgaacatacttaaagttaaatacgacatcattcaattaaaaaaattcagtaca
+cctctaatgagtatcccgctttggaggaaagagtagcactttaaatggacaatttaggcc
+ggactttcctgtaaatggatgaagtcattgtacagcttgaataaatcgttagggttagtc
+cttacatccaccatatgttaatgaataaagcctgagggaccttagagctaacttgtccaa
+cacgttgctcatttacttaataaggttgaaatgtatcagtaagtgacagcgagtgtagat
+tttgaccatttaactgaccttcacagttttgtcttcagacgtcacttacaccataatgat
+gacagagcttgtagatgcacacactcattcctagtgtaaatcaagtagtagctagattat
+tataaagagatattttctggcgtcgaacgtaacacagagagagtataaggggcatgataa
+tggcttatcaatatgtgtaagaaaaagtttttaatatcatctaactcggtggaatgcaca
+cttatggccaactgaccttgggacgagttaagataccataagaggttgcctgtaagttaa
+gataacaaagggatattccatctttgtgtgctaagaacctatttatatttgcagccataa
+aaacctctgtgctatgcagccaccagagttatttatacaaagaaagagaccatttagata
+cgttaattctgcttgcgatttattaaacagacatttcacgtccaaccactacaaaagccc
+tatcgcaagacgatcattgtattatagcctatgcaacgtagctaagcggccgaggaatca
+taaaatatgaattgttacattgtttactacatatgatcacaatctttgtaaaaggttcgt
+tcgtgatactaccatgtacctaactaacctgagatatatgcaatgacttatggggtcagc
+gcgcaacatccgcaaagcatagtaatacaaggtaggaaaacttctggatttcccaaggtt
+ataatgctctatactgaccaagagatccgttacgactcgcaatgaatactctaagggcac
+tcacaaagaaaaccactaattgataaatttcaatgataatatcctgaattgcatcgtgta
+tgagttacgagaagtcgcatttaatgaattagtcatagaaatgtcatagcaggaacataa
+ttactatattttaacgatttaatcgtagttggagtcctttcccaaattatgtcatcagtt
+ccgatttagatgttttcgggcccttcttagtaaagaagttaatatccaagactagctcct
+cacccacgcatgcacatattcgcgagaagtctgatagaatattcgacagaaatgcgactc
+tagctcacactcgttaactgatcaggtacttatagacaagtacgttatcagatatcgctt
+cggggcattgttgcgctacctttgtgcatagcagttttgaaaaattgttcaagacctgaa
+cgggaaaatgatattatttttttaggaggaataatacagtaccatgtaaatactcaacca
+ccttacgtacttcttacgccgaacatatatggcacgtgttattcggctaacaaaactgtt
+gtgccttttctataaggataagcagattcgttttaaacatatgacctgtaaactgggatc
+tacaaaagaggtacttaaaataaattgcgcaacggtttagatctgcggatctttggttaa
+agagcaccattagatgtgccatacttcctatcgcctgagcgagaatttagtctgaggaac
+cactcttgggatttaaaacaattcggttaggacacctactcggcggatgaagcaatacga
+taacattaaaagtcgttcagtctaattttggtcgtagtacgatgagctgatggccaattg
+tatttttattaacagcactgaaacaaaatggagactttagactaatactaaagtctcaat
+gttcgtcgaaccttaaatgctcggaatgaggggatcttcggaagtatagcgccgaagtgt
+atctcattattataacaccagtgtacagacgacatctaattatggccagaaactgtcatt
+gtgccattaagaggattagtagatagtctggaccgtggaatagaattttgaccaaattga
+ccagtcctgcttgtagacagcgcgatctaaactgcacgagaatatacaagttggtggtgc
+ttgtggctgagcacgctaagatgcgtttgtttttacgattctagtgcttcttaacgcaat
+tcagtcttctagatccgctattccaacatcaatatctcaatttaaggtcaatatatataa
+caaaattagacagagcagctgacacttacgaagcatcgtagaaccgatatagtcgacctt
+atgatgatatggacgtgtccaagtccgcacttccgatgcatcttgacggtgaaccgaaat
+gaaatcttcattagggcccccatgtgtcaaaccactcgagtcccgtctctgaagtcaagt
+attactgcgaaaaattcgtctactattagtttattatgaacttatgacgcttaaataaat
+taaacagtaagcctgggaaaatgttaaggcaggaatctttgtaacagttcataatgttgc
+taaagattatcagaccccgtgaagacttcgggctttgggcttcgtaccgtagcataatac
+atctatatagttagaggcttgcgtgttgttgtgctattccacatatagcagctctgggcg
+actcttcaatgaaaatgaaaaatggtaacctggcgacctacttgttaagtcagtttaatt
+caaggggattaagtaccaagggtcgagtttctctgtatttattatactgtaggcaagaag
+cttttttggcgagatttaagacttaagcctatggtaaaaatttgatagtgagcgactata
+gtaagagatttgggtggttagtaattaaaattctcctatgctaaatcaggcgtacaatct
+gagggtgcacatttctcgacgcgtgaaccttcaccgaaagcgtgtggattatacaaattt
+caaacatattggcggggcacttatccataatagatttctgtttgtacgccaaactctgcc
+tcacccctccataaattgtattggctagaggttaaattctccgtaaatagagacacatat
+agttttatacaattgtttgaatcaaagcacgagaaacttttaaccgtacattgacaaatg
+tcttcggatggggcagagcatctcttcgtgacccaaatcaatcgctgagcaataagcaag
+aaaacacagattatacaaagagatctggatgaagatattcgtgcaatcactatcgttatg
+ttagagagttccatgcatgaggactcgttttttgaccaggagaattaagccaagaaataa
+ctgacgtatttccaaatgaattctacgtgtttttcctgtcacctttagccagtgttaaag
+atgactatggagtttcgaataggttattctatagacattataacgagtggaacacccata
+ccttcacagtgctaaaggtaggaacgggtacgtcaggtagttcaagggattttaggttct
+taatccaacgaagaaataacgcatcacccgtcattctattgttttcgtcgggattactta
+gtaggcagggtattctaacctacctgagttacaaatctttaaaaaactggccatgaggtc
+atggtgataaaatctgaatcgcctaaattcgcgtccctaaggaaatatactagaatccgt
+ctcagaaagtgcaaaggttgacttcttcccctaacacagaattctcagttttatagctat
+ctagtggcattcctttttataaaactttacgtttgtaagggtccaactttacaaaagctc
+ggatgtgtatgtgtaatcttccgccgtgtaagacttggaacccatgtatattgacggcat
+ggcgtggctaagcaggtattgatcttcagtgtaaagcaaggtatgttctaatctaacaat
+gtaaagccggggattagccgccaaaggggtctaatgacatagagatgctctgaaatcgta
+ccaactataaaagcacgggatttgaaatatagcgacagatcttccgtattctgttagttg
+acatctgtgctgtctttaccgattgtgatttggctttagcagtcatttagtttcgttact
+cattgctcgtgcgatagttccaccgaatatggcacattcgttctttttttccattttact
+gcaaaccttttcaaaagctgatcgataccactgatgatggcattgattagtcgattggca
+actatgtcctgcttatatctccaattgcattgaatatagtaaaaaataaaggctcgcctt
+cccaatgggctacggagtacacgaaaaaatcgcaactcgtttaaccaagcgccgtaccta
+acatataagtgattgagacaaatagttctccagacgtattgagatatatgtctcctatag
+gcaagcgtttctaattgctgaccagaaattagaattaggttgttaatactatattcgacc
+attttattccacgaatgtgctattctactggtattgctccgtatgcgatatataaccaac
+acggaaagtcgtcgattgcaaagtggctccgtagaatcatttctggtcatttaccgggag
+cgcgcttgaacaatggatgcggtatctgccatattgttattgttaaaaagacttccgctt
+actatcgcttcgatcatcggaaaaatattaatgaggattgggtcgtataagaaaatcatc
+ttttcagttcgcagatttttgccaatttaaccggttatttcgtcagacttggtagtgtag
+ttacaagcatcacgattatatcagctacagaattaaactgtcctgactcgacggggcagt
+gtgtgagtattgcgctatatattcaaggtaacaggaggcatataggtcatagtacaagga
+taatgaggtttgctaactttaaaaattattgatttaacggttgattgaaaatctctgcaa
+gatgacgctagaacacctgatgttcaagtttgccgataataacatataagatgaattact
+gtctttagaccctcatgttaatccgctaacttagggcggaaacaatgttaggctatgcgg
+agtaagtactatattatgataccacatagaatttaacattcatatgatgtctaatacccg
+ttcccaaccttgcaaccgtcccgattaattaagcaattacggtcatcaatgggccaatcc
+tgtctcaaaaattatcatattcaaggttcagctattttggcaatgggtgagtaccgttct
+tagtgatttacgaacccataatctaggcgacttaatatacaagatttagagttacgtttt
+ccgggtagtacatattaacgaccatggatcgggtgaggtgttgtattagttatctgatct
+tgtcagtagctcccaatgtcccagaatattatgtttctactagagtgttcgtatactgga
+atttaaatattatgtaagactagacaaattttatggatacattaggccatcgtagaatat
+gatatagttgtaacgtccctctatagattttcggagggcaggtatattgcttaataaaga
+tgttcggaaatcagcggaaaggatttgtaattaactgatgcgcagcgcttaaataagttt
+agactattaagctatatgttcgacagcatgtagttttttttaccagaaagtgttatactg
+atgacccatggaggtagctcctcatgataaaaatattgttacttaagcattactattata
+gtgttcaaactagtaccgttgcatactttaagaatcagacatggcgtttcttatgcagac
+acacttttttagctgttgacgcccacctcacatccatagtaggtcaatcgcataagaaca
+atattctggactgttttattacccagaagaaagttttttctttccggttcgttaagacaa
+taaagatcatttcattcgttctcttaacgatgaactaaagtacttaaagtatccgcctct
+tgtttcgactagcgcatagtgtaataattaaggcaagataagaagaacaggaacgcgcac
+gtcggagataactctaatagtctctttattccgtttaatatagcccgtaattgcaccatg
+cgctacagtaacggccgccttcgcaaacctatttatgtaattccaagtttaggtatgcaa
+tggttggggcaatgtgaggggttttatcaagactttcgttgcttcgcggggggcgcaaag
+cagactttacagtagttaaccgaaaaccgcagggagtcgctctaagtgttaccaacccct
+cactactacgcgaaggtactcgattattccttgaatgggctgaaacatcgtgattagcgt
+cttatgattcaggctgatagaagaaaacttattttctatattccacgtatacaatcacac
+tcgtaactaaatagttcccagcgttgtaatgtcgctataataaataaaatacaaagaaaa
+ttcgtctgggtgcataagtacagttagtcgtctgtcacataaataatccgcagtcgatct
+cattacaggtattgttgttggtcaaccttcgcaaggtggtccaagtagcattgttgaaca
+gtaaaactaccgtcacacaaggaatatcataatagatgccatacacggttttacttgata
+tgtttacagtccttgagttgcaatcgtagtattgtttcatccggggtgtgtacgaagtaa
+tttagacaaggtgtgtagcggtcactaggtaaaatgacttaggatggatgagcatttagg
+tattctatgataacactaaccatcatgtttctaaaatcctcaggaaatttgtattatttt
+accaacctgtatttatagaaagtgcttttgacttaaagaagccgaagtgttcaaattaag
+gagtacctgattgaaagaatggggaattgtaatctgtaactcaattacaaataagccgtt
+ctaaggattaaggctttgtgtctaagcaactcacgtgaattcgaaattcatactcgatta
+acgactttaatactcttctgcgtatctacagactcatttaaattacggaatatgttttcg
+tttttggtttccagctcgcacgtacgcgtttacaaataaggacacctggtacaattggct
+ggagtacaatgttggtttttatttgctgattatcccgatccctgtgggcgttggcataac
+cgggttttcttcaagactactttcgtgttgcttatatacctggtaatatcggtgagtagc
+ttagggcttaatcacaatactaacaagttctctatggattggacagggcggcatccgttg
+actgaacgatctattaatccattccctgcactggataaacaagacccatttaaattgacc
+atagagatgttagcgtcatatttctgttcgtgatagggtacatatattataaacggatta
+tgagcagtggttttctagaaaagcattcatagttaggagtgtatcagatcataccactga
+accatagagcacaattctctactggctatacttcattcctttttgtccgggtggggacga
+aatttaaaggttctaacctagaacgcagagcgaattgatcaaggcgctggccaagtgaac
+ggttctaaatgttcttaatgagaattgcgtattttgactattgacagggcatcgtaaacc
+gctactcgacttggtatctgtaatctgtatgtagatagagtacgggcctataattcaaat
+tcagccaccgaagattcacaatcttcagacgtttgaaggaaagaggtttactggtatgtg
+gtgtcaagccccacccattctctgttatatccgagcattaatgtagtttcactgtactac
+ggtcacgccgtagagtcggcagggcaaatccaaaacaatttaggctgagaagtggcacta
+taatagtttagcctaagtcccttcgctaataactcaacaaagatgacgcaaaagtcggcg
+aatagattgcgttcgcgtaagggtatcttgaatactgatagctctcatggtaccaagaac
+tttcataacctctttatttaccaaacctgttctactagcgttagtgttttagtctgtagc
+cgacacaaaaaccgagaatggccggcgtaaccggcgcctgcaagctaacatgggatcaaa
+actattggcttaacgtttaatcgaatgagactagcactgtattactctttcgtttcggca
+gcggatcaataaggaggtgacggcatcactctcttatagtagatatcacttattctcaca
+acggaagtaggatcttccgtcctcattaaatttgcaactggctcaatgtaacactgtaat
+gttaacaaagtatgagctgaaggtcagagcagacgatgtagtaaggtccctcgaagctgc
+ttacagtatccttgaggctcaacgggctatgcggaaattccagacctcgagttacattat
+gaaacgtgtcattccatctcattaaatagttcgtgccctatcgccttgtaatataaacaa
+ccgtttttgtctattttcccaaggagaaggagagtagcagcttagtggcttgcctatatg
+gccccctaagtacgtactcggcacgcttagaagattgggctaccccgcactatatgttcc
+caaagtaggtaacctagatagtgtcgtatgaaattcaggtcatcgatgagagtataaaaa
+tatacaattttggcaggggttatacattgcgggcatgaagagtaacattggacatgaacg
+gacattcgaaccctgtgagtttaataccctatctccggatcattataaagtaaatatacg
+tcacttactctacgtgcgtttagacagtctttgaaactaaattggttatttttctttcat
+ctagatttgtctgtatctaactaaattatagttccacataaagctgattcaactgaagac
+ataaatataaactttctaacatagtagcgaggaaagagctatgcctagcatcggatcatg
+cgtccgcgagtagttcctggtagagttaaaagtttttccagaatctagaccgaacacagg
+gtagtgaacgaaagtgcgcggtgaacatacataataccgaacgtaaacaattccgttcgt
+attgttgctgtatctatatttcctacgtaaggctatttgatctataatatgaaaagtcac
+gtcgaaataaatcaggaagcgcttcgagtatgtacattcagatctccttagtatcatcaa
+attatagattttacggccacgaattattggtctagatgtcccaaaaataatttgatgtca
+gtagcgatcgtgcttcctcggagttgaggttggaagaagagtcattatgctataccaaga
+actctccatccagtacctagaaaggcaggtatgtaccgctcattaattttgcgatcttga
+cagatctgcatgcaaagtaacttgtaccagatggcttttataatagaaactaagtttccc
+gaataacggtgtacgataacagatttttaggtgtacagacgtctgactcaatgaacacac
+attgggacctgccccgggaggagtagtagataattaccttctccagcgcgggtcttttaa
+tatcacaacataaaaatactaattaatatcacacaccctcatcctcgatggagcctagca
+tcatacacgtttgatagacaacgccaattttactgtaatatgatattcgaatctagtatg
+tggacgctgtaccacattgtttaaaggagctccctttaccgacatgaacgaagcaagctt
+tgtacaagatacgaagaactcagtactggtaactataagagacaatttatacataaaagt
+gttaagaccattatataaaaagaggtatgaggtctttgtaactacaataatacattcatc
+gaacgatggagaataacagagttatttctgctgctcgagctctagttctgctaatttctc
+aatcttgatgccactcgtttgagtcttccattcgctcttaacgacgcgtacatccctctc
+tcctactcttacctatatcctattactggttaacctacatctccgggaaagacgtaggta
+aagtggtccacgattgtattcacttataacacctagtagtactatgtgttgctgagagtg
+aggacacacttactctacgagttcaagtccatatggacattacactttttcagcatctag
+gtgtcatgatgtattaacagccgttaggggctatttgattttatcgattgtcggcgtgtg
+tattttcaacaactaggtgctacaattcgtgaataggcatgaaaattcaagattgcagtt
+cctatcttgtataatctttcctttggacgagttgtaccatttcaactaacctgcaagtgg
+ggggtcatccatatgaagatttgccaaatacctggagaccctgaaaagtttatccagatt
+aataataacaaacaaacctaagcgaagaacgtcagctttaataaactatcactatcatag
+aaattcctgttaattgttcttccaaacgttgaatagactatcacgggtaatagattgaac
+acggagaacgtttatccggcttgtaaaatatcgtcgaatctgctgataactcaattatat
+tcgatggagaattcatatctaccgcttagcttttaaaaattaagtcagattattccgcca
+caatgagaaggcgcgagtgcactaatcaaatcacttaggattattacggacgtctgcatt
+acaatgctttggggtagggttatacaagcatatgattctttaggtctcttgatcgggcgt
+ttaccaccgtagcttaatgttggcatatccgtgatcctaatattctgttgtcagcgtgtg
+tataggaatgcacaacgcaaatctttaagctgacctgttcatgaaagacaggagacacga
+ggcaccacctcaattctatgcaaaactctaacatagcgtggcactatgagtacgtgtaac
+gacaaggtctcatactcgatcctaagataattctcgtctggaaggttttaatctttaact
+aagagtagaacttagtttattgacttttacaattaggatacggttcgcgactctaccaca
+gggcatcatacctggagctctgctatctcgtgaccaaagtggcagcacacatagggtcgg
+gtcctgcatctactgagcaatccctttaagcattcctagtttgagagccatttagatatt
+gctgtttaaaccgattaatggtttctattattataaagtgtaacgctcccattcgggaca
+ttgaaaattagcaataagacaatgtatgatattcggcgagtctcaacaacattatggtct
+accatgggacaaggggttgatatgatgaatccacaaaaaatagtcaaacacccatggttc
+gttaagtgagggtatccaggtgttataaggacgatctagaagtattcaggtacacggtgt
+tcagacatgctctaattgtcaggttgtttataatttaacgtatcgctctctattctaaat
+aatataaaattaaccgctcgtagggatgctttccagtaaaagatacactatcattaaggt
+tatgcaaatgtggcgatttgatttgaatcttagtacattcttaaacttaaatacgtatta
+tttaaagtaaatatattatctaaaccgcttttgtctatccacatttcgtcgaatcacgac
+ctcgttaatgcgacaatttacgaccctctttcatctaaagcgatcatctatttcttctga
+ttgatgtaatactgacccttactccgtacatacaaatgatggtaagcaagaatgactgac
+gctcctgtcacctttcgtggcaatcaactggcgctggtactgaagtagcttgaaagggat
+atggatgtgtatgccaggcttcattttgacaatttttctgtcctgctcagtgttgtctga
+agtcgtatcgtacacaataatgatgactctcattgtagatccaatcacgctttcctacgc
+taatgaaagttctagatagtgtaggtgttagacagaggttagcgcctacatccttacaca
+cacagtgttgaacggcaagcataatcgagtatcaatagctgtatgtatttgtttggaata
+tcatatttctcccgcctttgaacaatgatgccaaaatgtcctgccctagagttatgataa
+aataactgctgccctgtaacttaagtttacaaaccgatattcaatcgttgtgtcctatga
+aaatatttatatttgcaccaagaaaatcatctgtgcgatgaacaaaacacagtgatttat
+aaatacaaagagtacatttagttaccggattgcggcttgacatttattttacagaatttt
+atcggcaaaacacttcatatgaactatcgcttcacgataagtctatgatagactagcatt
+cgtagagaacaggaagagcaatcattatatatgaagtgttacagtgggtactacatatga
+gatcattaggtctatatccggccttcctcataagaccttggaaatatcttacatcagaga
+tatcaaaggaagtatgggcgaacccagaaaaagccccaaagaatagtaattcatcggacg
+taatagtctggttttaactaggggttattgatatttaagctaaaagagttccctgaacac
+tcgaaatgtataatctatcccaactaaaaaagtatacctctaattcagaaatgtcattga
+gattagactgatgtcaatacgctaggaggtaagacaagtagaagtttttgatttaggaat
+tgaaatgtaatacctccatcttaagttctatattttaaagttttatgcggacttcgagta
+agtgcacaaatgatggcataagtgcccagttacatgtttgcggccccgtatgagtaatga
+tctgtttatcaatctctagctactatcccacgaatgcactgatgccagtcatggcgctta
+cattagtcgacagaaatccgacgatacctatcacgcgtgaactgttctggttcttattca
+attcgaagtgatctcagatacattacggccatgcttgcccttcatgtctgctgagcagtt
+ttgttataggctgaatctcctctaagcgaaattgataggatttttggtggtcgatttagt
+ctgtacctgcttattaagattcaaaatgacctacttcttacgccgaaatgatagggatcg
+gctgaggaggataaatatacgctggtgcctggtatttatccagaacaagttgcctgtgta
+tcagatgaactctaatctccgagataaaaaacaggtacgtaaaataaaggccgcaaaggg
+ttacatctcaggatcgtggcgtatagtccaccattagttctgacttacttaatatagact
+gaccgagattgtagtatgtggatccaagcttgccatgtaaaacatgtcggttagcaaaac
+gtataggagcatgatcaaagaagagttaattaatagtactgcactataattgtcggcgga
+gtaccatgagctgttgcccaattcgatgtttattaacagcacgcataaaaaatccagact
+tttcaattagaattaactataaatggtccgcgaaccttaaatgatcggaaggacgggatc
+tgccgttgtatagaccccaactctatctaatttttataacacctctgtaatcaacaaatc
+ttattatgccatcattatgtcattcgccaagtaagtccagttcgagattctctggaccgt
+gcaatagtattgtcaaattatggtaatggaatccttcttctaacacccttagaaaagcca
+cgagaattgacaagttgggcgtgcttgtccaggagcaacataagtgccgtttctttttac
+gatgatagggattcttaaagcttttctctattctagatcccagttgccatcatcaatatc
+tcaattgatgctcattatatagttcttatttagtatgtccagatgtcactgaagatcctg
+cctagaaccgatattctcgacaggatcatcagttcgacggggcaaacgcacctatgcaca
+tccatcttgaccgtgaaacgaaaggaaagagtcagtaccgacccaatgtggaaaaaaact
+cctgtccacgatatgtaggcaagttttactgcctttaattagtagtcgattagtgtagtt
+tgatattatctaccttatagaatgtaaacagtaacccggccttaatggtttggcaggatt
+ctttgtaaaagttaataatgttcataaactttatcagaaaacctgaagtagtccgccttt
+cgcctgcgtaacgttgcagattaattcgttttacggagtggcttgcgtcttgttgtccga
+gtacacatattgctcctctcccccactcttctaggaaaatcaattatgctaacctgcaga
+ccttcttctttactatctttaatgcatgcccagtatgttcatagggtagacttgctatct
+attttgtataatctacgaatgatgcttggggcgcgacttttaacaattaagccgttgggt
+ataatttgagagggtgccacgatagtaagagatttccggcgtgagtaaggaaaatgataa
+taggattaagcaggcgtaatagctcaccctcctcagttctccaaccctgaaccggctaag
+tatgactgtgcagtattaattttgaatacatattgcagcccctaggatacattatagatg
+tctctttcttacccaaactcgcccgcaccaagaaagaatgtggattcgattgaggttaaa
+ttagccggaattacagacacagattcttgtttacaattgtgggaagaaaaccacctcaaa
+cgttgaaacctacattcacaaatggattacgttggggatgagaatcgattccggtcaaaa
+atcatgcccggagcaataaccaagaattcacagaggattaatacacttctccatgaagat
+aggactgcttgcactatccttatctttgtgtcttccttcaagcaccaatcgtttggggac
+aaccacaattatgccaagaaataacggaaggtgttccaaatctatgagtccgcggtttca
+tcgcaacgtttcactgtgggtatcatgactttggactttagatttgggtattctagagac
+tgtagaaagactgcaacaacaagacattcacagggcgaaacctaggaaaggggaccgcac
+gttgtgctagggatgtttccttaggaatccatacatgtaagaaagaatcaaccgtaatta
+tagtgttttcggccccttgaattacgtgcatgcctttgctaaaagacctctgggaaatag
+attgaatattctggacagcagcgaatcctgattatatctcaagcgaatatatgacccgca
+agaaggatttatactagaataagtctaagaaagggcattgggtcacttcttccactaaca
+cacttttatcagttttataccttgagagtcccatgcatttttatatatatttaactttcg
+ttgcgtaaaactttaaatatgatccgtgctctatctctaatctgaacaacggtatcacgt
+cgaacaaatctagtggctacgaatcgcgtcgctaagaacggtttcttctgctggcgttag
+ctacgtatcttctatgctaaaaatgtatagccccgcattagcagcaaaaccgggagaatc
+aaatacacatccgatgaaatcgtaacaaagataaaacaacgcgatttctatgtttgccaa
+agtgattaagttgtatcgtaggggtcagcgctgatgtcttttcagtttgggttttggatt
+taccagtcttttagtttcggtactatttgatcgggacattcgtccaaacatgatggctca
+ttcgttctttttttcaattttaatcaaaaccttgtatttacctgatacattaaactgagc
+atcgcatggaggtggagattcccatatatgtaatcatttgatatcctattccattctttt
+tagttataaataaacgctccactgcacaatgggagtaggacttcaccaataattagcatc
+tactgtaaacaagcgccgtaacgaaatgattactgattgagaaaaataggtctcaacaac
+ttttgacagatatgtatccgatacccaagcgttgctaattgcgcaaaagtaagtagaatt
+acggtcgtattacttgttgccaaatggttattactccaatgggctattctaatccgatgg
+atacgtaggagagagtgtacctacaccgaaactcgtagtgggcttagtggctacgtagaa
+gctgttcgggtcagttacagcgtgcgaccttgtaaaatcgatcacggtgatgaattattg
+ttattgtttaaaagaagtcccctgaatagcccttagataatacgaaaatttgttatgtcc
+agtcgctcgtatatcaaaagattcggttaagttcgcagagttttgccaagtttacaggtg
+atttactaacacttgggagggtacgtacaaccatcacctggttagcagagaatgaattat
+acggtcatgtcgcgaagggcaagtgtgtgagtattgaccgagttattaaacgtaaatgca
+ggcatttacgtcataggacatcgagtttgtcctttgcgaaatgttaaatttatggttttt
+tccgttgagtgataatagctgcaacatgaagatagtaaaactgaggttaaactttcacca
+tattaaattatatgttcaattacgcgatgtacaaactaatgttaatcagatttaggagcg
+cgcttaatatgggtccctatcccgactttgtacgagattttgataaaaaatagtattgta
+aattcatttgatggcgtagaaccgggcaaaaccttgaaaaaggacacatttaggatgcta
+tttccctaagaaagcggaaaatcctggctcaatatttataatagtaatggttaagattgt
+ggcccaatcgctgagtacccgtcttacgctttttccaacacataatcgacgagaatgtat
+ttaaatgtttgagacttacgttttccgcgtacttattattaaagtcattggagagggtgt
+cgtctgggtgtagttttctcatctgctcaggagctaaaaatgtaaatctattggttgttt
+ctaattctgtcgtccgtgtaggctatttaatttttatggtacacttgaatatgtttagcc
+ataatgtagccaatactacaatatcagatacttgtatacgacctatagacttttgccgac
+cgctcgtagagtgatttagaaagatgttcggatagcacagcaatcgtttgcgaatgtaag
+catgcgaagcgagtatttaactgttgactattttgctatatgttactctgaatgttgttt
+tttttaccagaatgtgttataatgatcaaccatgcacgttcctactaatcatataaattt
+tgttacgtaagcttttctatgatagtggtctaaagactacccttgcatactttaagatta
+agacatgcactttaggaggaactcacacgttttgagctgttctagcccacctataagcca
+ttcgtccgcaatcccataactacaatagtcggcaatcttttattacccagaactaacgtt
+tttatttcccggtacgtatcacattaatcttaatttaatgcgtgagagtaacgatgaacg
+aaagttatttatgtttaagccgcttcttgagaatacagattactgttagaatgaaggcat
+cataactagaacaccaacgcgcacctcgcacattactctaatagtagctttattcagttt
+aatatagacagtatttgaaccaggcgctaatgttaaggcccccttcgaaaaccttgttat
+gttattccatgtggtcggaggatttgcggggcgatagcgctgggcggggatcaacaattt
+cgttcatgcgagcgcccccataaccagtaggtacagttcggaaaagaaaaccccacgcac
+tcgctagaagtgttacaatcacatcacttcgtaccgaagggactactgtattccgtcttg
+gggatgtaacagactgattacagtcttatgatgaagcctcattcatctaaaattagttga
+tttattccacggatactatcacactcctatagaaagagttaccaccgtgggaagctagat
+ataataaataaaagacatacaatattagtatggctcatgatctacacttactcggatctc
+tctttttttataaccagtagatcgcattacacgtattgttgttccgcatcaggccctagg
+ggctcaaacttccatggtggataactaaaacgtccgtcactaaacgaagatattaataga
+tgaaatacacgggtttacttgatttctgttcagtcattcacgggaaatcctaggagtctt
+tcataacggcggtcttagtaggaatgtagtcaagctctgtagaggtctcgacggaattgg
+tatttcctggcatcacaatttacctagtattggagatcacttaaaataatgttgagataa
+taatcaggatatttctagtatgtgacaaacctctatttagtgattgtgattttcaattaa
+acaagacgtaggggtcaaattaacgactacatgttggaaagaaggccgaattgtaatatc
+taactcatgtactaagaagaagtgctttcgtttaaggctttctgtctaacattctaacgt
+caattcctatgtaatactactgtaaccaagttattactcggctgcgtagataaagtctca
+tgtaaatgacggtttatctgttacttttgggtttcaacctagctaggacgccggtactaa
+ttacgacacctgcgtatagtgcagggtgttcaatgtgcctttttatgtccggattataac
+catccctctcccacttggaatatcaccgggttcttaatgacttagttcgtcttccttatt
+ttccgggtaagatcgctgtggaccggacccattttgatctagtctaaaaaggtatatagc
+gtttcgtctggcccgcttacgttcactgaaacttagattaatcaatgcactgcactggat
+taacaagaacatgttatagtgtactgacacatgttagactaagaggtctgttcgggttag
+ccgacttatatgtttaaccgattttgacaactgggttgagagataacaatgaagagtgag
+gactgtagaagatcttaaaactgtaccatagtgctcaattcgctaatggcttgaattatt
+taattgttctaaccctggcgtcgaatttttttggttcgaaaatacttagcacagcgtatt
+gttcaacgagatgcacaactgtaccgttagaaagcggcttaatgacaaggcagtattgtg
+actattgacagggaatcctaaaaagctactcgaattggtatatggaagaggtatgtactg
+agaggtcgcgcctattagtcaaattctgccaaagaagagtcaaaagcttaactagtttga
+tggtatgaggtttaatgctaggtggtctataccaccaaaaagtatatgggatatcccaga
+atttatcgactttcaatcgtctaccgtcacgacgtacactaggcagccctaatccaaaac
+ttttgaggatgagtactgccactattatactgtaccatttgtaacttacattttatatct
+tcaaagaggtagatattgtcggccattactgtcacttacactaagggtagcttgattact
+gatacctctcatggtaaaaagtaatttaagaacctatttttttacataacctctgctact
+accgttagtgttttagtcggttcaagtcacaaaatccctgtagcgcacccctataagcag
+aaggaaaccttaatgcggataaaaacttttgccggaaccgttaatcctatgagaatacca
+ctcttggaatcggtcctttaggctgaggatatagaacgaggggaacgcatcaatctaggt
+taggtgagagaactttgtatcaaaacgcaagtaccatatgccgtcctcagtaaattgcca
+aatgcagaaatcttacactcttttcttaactaagtatgagagcaacctcactcctgaaca
+gcttgttacctaacgagaagaggctttaagtagcctggagcctcaaccggatatccggat
+ttgactctcatccacttacatgatgattacggtcattacatctcatgattttctgagtgc
+cctatagactgggaatttaatctaccctgtttctatttgttaacaaggagaaccactggt
+caagatgacgcgcttccatttatgccaccataagtaagttctcggaacccttacatgatt
+ggcctaccaacctatatatgtgaccaatgtacggtacatagagtgtggcctatcatattc
+aggtcatcgagctcagtatttaaagattatatggtcgctgggggtattcagtgcgcgatg
+gaagactaacattggaaatcaacggaattgacaacacgctcactttaataacctatctca
+ggataagtttaatgtaattagacggaactttctctaactccgtgtactaactctttgaaa
+ataatgtgggtatttttatttcatctagatttgtctgtatcgaaagaaagtattggtcca
+aataatcctcagtaaaatcaagtcataaatataaaatttagatcttaggacagaggaaag
+tgctttcccgagcataggatctggcctacgccagtagttcatgcttgtgttaaaagttgt
+tactgtttatagtccgtactcagggtagtgttcgatactcagcggggaactgacatatta
+cactaaggaatcaaggcccttcgtatgggtcatgtttatatatttaattacttacgctat
+ttgatcgagaatagctatagtaacgtcgtaagaatgcaggatgcgattcgagtttgtaaa
+ttcacagatactgtgtatcatattattatagatgttaaggcatagaattattggtattga
+tgtacaaaaaattatgggtgggcagtaccgataggcattacgagcagtgcagcttggaag
+aactggatgtatcctataactagtaagagccttaaaggtactacatacccagggatgtta
+ccatcattaatttggccatcttcaatcttcgcaatgcatactttcttctacaagatgcct
+tttagaagacaaaataagtgtcaacaataacgctgtaacttaactctgttgtacgtggaa
+tcaagtctcactaaagcaactaacattccgacatgcaaacgcaggactactagattatta
+aattcgccagcccgcctcgtttaatataacatcataaaaattctaagtaatatctcacac
+actaatccgccatcgtccatagcatcagtcacctgtcttacacaaacacatgtttaatcg
+atgttgttatgccaagctagtttcgcgaccatgtaactaattgtggaaagctgctacctt
+gaacgacatcaaccatcctacctttgtacaacagaccaacatctctgtactggtaaatag
+atctgaaaagttataaatataactgttttcacattgatagaaaaacagctatgtgctatt
+tgtatatactataataaattaagcgaaacatggagattaaaacagtgttttctcatcctc
+cacctcttgttctgctaatttataattcttgatgccactcgtgtgagtcgtccattcgat
+cgtaaagaacccgacataaatagatacgacgctgaacgagatcctatttctcctgaaaat
+tattagcacggtaactcctagggatagtggtactagttggtatgaacgtataaaaacttg
+tactactttctcgggatgtgagggagcaaactattactcgaccagtgcaacgcattatcg
+acagtaaaagttttcagctgatacctgtctggatggattatatgcaggtaggcgagagtg
+gattgtagcgatgctcggcgggggtattttaaaaatctaggtgataaaagtcctgtttag
+ccaggaaaagtcatcattgcactgcatatcgtcgattagctgtcatttcgtccactggta
+ccagttcaacgtacatcaaagtccgggcgcatccatatcaagttttgcaatagtactcca
+gaccatgaaatggttatccagattaataataacttaatatactttcactacatactcagc
+gggtattaaatttcactttatgtcaaaggactcttatgtggtcttcaaaaaggtctagag
+tctatcacgcctaattgtgtgaaaaccgagtaacttgatcagccttgtaaaatatagtag
+aatatgatgttaaatcatttatattccagggagattgaatagcttacgattagctggtat
+aatttaactcacatgattaagcaaatatctgtaggaccgagggaaagaataaaataaagt
+accatgagttcggaacgctgcattacatggcgttgggctagcctgatacaagaagatgag
+tatggagctctcttcatcgggacgtgacaaccctagcgtaatcttggcagatcccggagc
+agatgattatcgtctaacactgtctttaccaatgcacaacgcatagatttaacctgaact
+gttctggattcactcctgactacagcctacaactcatttctatgcataactcttaaagac
+agtcgcaatatcagtacctctatacacatcggatcagactagatcataagataagtctcc
+tctggatccttgtattctgttaagtacactacaaatttgtttagtgtctgggacaattac
+gataagggtcgcgactagaccacagggcatatgacctccaccgctcctagcgagtctcca
+atctgcaagcactcatacgctaggggcatgaatcgactgtcaatgcactgtaagatttac
+gagggtgagacccatttagatatgcctcgtttaaccgttttaggcttgataggatgagtt
+tgtcgatccatcaaattcccgacattcatattgtccaataagtatatctagcttattcgg
+actcgctaaactaaattatggtataaatgccgtcaaccggtgcatttgttcaatcaacaa
+attatagtcaatctcccatggggccttatggcagcgtatacagctggtataacgaccata
+tacaactatgaacggactagctgtgaactaagcagattattggatccttgtgtataattt
+taagtttcgatctatatgctatagtatagaaaatgttccgatcgtacgcttcctttacag
+ttaaacagtctatatcatgaagcttatccaaagctggacatttgatggcaatcttactta
+attatgaaacttaattacctattattgaaagtatttatatgatcgaataagatttgctct
+ataaacaggtcgtccattcacgacctagtgattgcgtaaattgaccaacctaggtaatct
+aaagcctgcatctatttcttatcattcatgttatactgacccgttctcagtacttaaaaa
+tgatcgtaagcaagaatcactcacgctcatgtcacatttagtcgaaataaactgccgatg
+ggaaggaagttccgtcattgcgatatcgatgtctatcccacgcgtcattttcaaattggt
+tatctacggataactgtgcgatgaactactataggtcaaaattatcttcaatctcattct
+agatcatataaagatgtccttcgcgattgatacgtctacagtgtgttggtgttacacaga
+gggtagcgactacttacttactaactctctcttgatccgcaagcataagccaggttaaag
+tgctctatctttttctgtggattataatagttataccgccttgcatctaggtgcccatta
+ggtaatgccctagtgttttcataaatttactcctgccatctaacgttactttaatttccc
+agattcaataggtctctcatttgaaaattgttatatgtcaacaaagaatataatagctga
+gtggaacaatacactgtgagggagtaatacatactctaaattttctttacggtttgcgcc
+tgcacagttttttttatctatgtgatccgcataaaaagtaatttcaacgttccattcaag
+ttaagtcttggtgacactagcattaggagagatcaccaagaccattatttatttagctag
+ggtttaagtcggttagaaatatcagataatgaggtctttatccggccttacgcagtagaa
+attggaaatttcgtaaagcactgagttcaatggaagtatggccgaacccacataatgcac
+aaatcaagtcgatttcttccgtccttttagtctcctgggaactacgggttattcatagtt
+aagctaaatcagttaacggaactagacaaatgtataatagttcccaaatatatatctata
+aatcttatgcagttagggaatgcagatttgaatcatggcaatacgctagctcggaactca
+actacaagtgttggatgtacgaattcaaaggtattacatccttatgatgttcttttttgg
+atacttttatgacgacttccacgaagtgaaattatgttcgaatatctgaacagttacttg
+gttgagcccaaggatgacgaatgttctgtttataattctcgtcataatataaatacaagc
+atatgaggccagtcatggagctttcatttggactaacatttccgtagagtcatatcacgc
+ctgtaatctgatccgtctttttctattcgaagtgttatcagatacatgacgcccttgcgt
+gacattcatggctcctgacatcgggtcttttaggctgaatctaatctaacccaatttgtt
+tggattgtgggtcctccattttgtctgttaatgcttattaagattaaaaatgtactacgt
+atttagacctaatgattgcgatacgctgtggaccattaatataagctgcgccaggggatt
+tttccagatcatctggcctgtgtatatgttcaaatctaatagccgagagaaattactccg
+acggaaaataaaggcagataagcgtttcagagcaccatcgtggcgtttagtcaaccttta
+gttcggaatttattaatatacaatctcactctttggacgagctccttaaaagatgccctt
+gtatatcatgtcccgtacctaaaagtataccagcatcatcaaagaacagttaaggaatac
+gactgctctataattgtccgaggagtaccttctcatctgccaatagtcgttgggttggaa
+aacaacgcattaatatgccacacttgtcaattagaagtttctataaaggggacgagtaac
+tgatttgagacctagcacggcagaggacgttcgtgtgacaacatctctttataagtttga
+gataaaatcgctaatctacaatgattatttgccaatcattatcgaatgcgcaaagtatct
+cctgttcgtgattctagcctaaggccattactatggtcaaattatgctaatcgaagcagt
+cttctaacacccttagaaaagcaaacactattgaatactgccgccgcattcgccagcacc
+aacataactgcacgtgcttttttccatgattggcattatgaaagatttgatctatgattc
+ttaccagttgcaatattcaatttagcatgtgttcctaattattgtgttattatggtctat
+ctcatcatgtaaatgaagatcatgacgtcaacacagattctagtcaggatcatcagttcc
+tcggggaaatcgcacctaggaacagccttatgcaaccgctaaacaaagcaatgaggatgt
+accgacaaaagctcgatttaaaagcctcgaaacgagatgtacgaatcgtttactgccttt
+tatgaggagtcgagtactgttggttcatatttgctacatgattgtatgtaataacgatcc
+cgccctttatcggttcgatcctttatggcgataagttatgaatcgtcagtatctttagat
+caaaaactcaactagtacccagttccccggaggaacggtcatgattaatgcgttttacgg
+tctcccgtccctcttcttgtcagaggaatcagtttcatccgatcccactcgatgattggt
+atagctatttgccgaaaagccacaacgtattcggtactatcttgtttgattcccctgtat
+cttaattcgcgacacttgatatcttttgtgtttaatcgacgaatcatcctgggggcgaca
+cttgttacaattatccagttgcgtttaatggctgtgggtcacaagattgttagacaggtc
+ccgcgtgtcgtaggaaattgataattggagtttgcaggacgaatagctcacccgcctaag
+tgatccaaccctcatcaggataactatcactgggcagtattatttttgatttcatatgcc
+accccctaggagactgtagtcatgtatctttcttacccaatctagcccgaaacaagaaag
+aatgtcgattccagtcaccttttattagaccgatttacacacaaagtgtcttggtttaaa
+ggctggcatgaatacatactcaaaagttgaaaacgacttgctctattcgattaccttcgc
+gatctcaatcgattacgctaaattttaatgcccgctgaaatatccaacatttaaaacagg
+attaattctctgatccatgaacttaggactcattgcacgtgacttatctttctctcttaa
+ttcatgctccaatacggtgggctaaaccacttttatcacatgaatgtacgcaacgtgtta
+ataagctatgagtacgcgggggcagcgaaacgggtcaatctgggtatcttctattgggac
+ggtacatttcggttttatagactatgtagttacacggcatcaacatgtaattaaaacggc
+gtaacctaggaaagccgaacgcaccttgggattgccatgtgtccggaggattacatacat
+ctaagaaacattctaaactatgtatagtcgtttacgacccttgtagtacgtgcatccctt
+ggcgaaaagtactctgggtattagagtgtatattatcgacagcaccgaatcctcatttta
+tagcttgacaatttatgacccgaaagaaccttttataagtctataagtatatctaacgca
+attgcggcactgagtccactaactatctttgagcagtgttatacagtgagacgccatgga
+aggggtttatatattttactgtcgttccctaaaaagttaattatcagacctgcgcgatct
+cgtagatgaacaacgcgatctagtcgaaaaatgcttgtggctaccattccagtcgagatc
+aaccgtttctgcggatcgcgttacattccttgcttatttgcgataaatcgatacaacccc
+attaccagaaaaacccggagaatcaattactctgcagatcttatactaaaaaagagatta
+caacccctgttctatgtgtcccaaagtgagtaacgtggagcgttggggtaagagcggagc
+gattttaactttcgcttttccattttccagtattgtactttacgttatatttgagcggca
+cattcgtcaaaacatgatccatatggactgaggtgtttaaatgttaatcaaataattgta
+ttttcagctgactttaaaatctgcagccattggaggtggagattccaatagatgtaagca
+ggtgatatcatatgcaattcttgtgacttattaagataccagacacggcacaatcgcagt
+agcacgtaaacaataatgacaatcgacggttaaattccgaacgtaagatatgtttacgga
+tgcactaaaataggtagcaacaacgtttctctgagatgtataagttaccaaacactggag
+aattccgctaaactaaggacaatttccgtcgtattaattgttgacaaatggttagtaata
+cattcgcagtggataatccgttgcatacctagcactgagtgtaaataaaaccaatcgact
+actggcatttcgggctaacgactagatgttagcctatgtgaaagcctcacacatgcttat
+tgccttcacggtgagcaatgtttcttattcgttattagaagtcacctgtagagacagtag
+agatgacctaaatttggtttgtccagtcccgaggtgatctaatgattaggttaacttaga
+acagtggtcaattggttaaagctgatttacgaacacttccgaggggtcgtaaaacattaa
+actggtgagaacagtatgatgtattcggtcatctagacaaccccatcgctgggagtttgg
+acagtgttatgattcgtaaatccaccatgtgtccgaattcgaaatcctgttgctccgggg
+agatagggttaatttaggcttttttacggtgtggcatattagctcaaacatcaacattct
+taaaatcagcgtaaacggtcaccagttgatatttgttctgctaggaagcgatgtacaaaa
+taagcttaataagatttaggtccgaccttaatttcggtccatagcacctctttctaagtg
+ttttgcttaaataattgtattgttattgattttctgcgagttgaacacggaaaataagtc
+aaaaaggacacttttaggttcatatgtaccgatgaatgcgcaatagaatcgagaaatttt
+tagattagtaatcgtgatgattgtggccaaatcccgcactaaacggctttcgctgtttcc
+aaaaaattttagtccactaggtatttaaatgttggacactgaacgtggaagccgtcgtat
+tatgaaactaatggcagaggggctcctctgcgtgtactttgagcagatgctatcgtcaga
+aaaaggtaaatcttttggttctttataattctggcgtccgtgtagcctagtgaatgtgtt
+tggttcaagtgaatttgtttagccagaatggaccaattacgtcattagctgttacgtcta
+tacgaaatatagactgtggacgacccatcgtagagtcatgtagttacatgtgaccttaga
+acaccaatcgtgtgcgattgtaagcaggacaacacagtattgtactggtcaattggttca
+tagatctgactatgaatcttcgtttttgtacaacaatctcggtgaagcttcaaaaagcct
+ccttcctaataatcagttaatttttcgtaaggttcctgttcgaggttagtcgtataaaga
+cgaaacggccttaatgtaacattaactattccactgtaggtggatctaacaaggttggac
+atgtgctaccaataagataagaatttcgtccgcaatacaatatctacttttgtagcctat
+cttggattaacaacaacttacgttggtatttcaccggacgtatcaaatgattctgatttt
+aatgactgagagtaaacatcaacgaatcttatgtatctttaagccgctgcttgacaagtc
+acattactgttagaatgaacgcttcattactacaaaacctaccaccaactcccacattaa
+tattatactagatgtttgaagtttatttgacaaaggttttcaaaaagcacagaatcgtta
+cgaacacgtacattaaattgttagggtattaattgtggtcggtgcatttccggccccata
+gcgctccgcggggagaaactatggccttcatgacagcccccccataacatctaggtaatg
+gtcggataactataaacaaccctctccagagaactgtgaaaataaaatctcttagtacac
+aagcgtatactggtttaagtcttgcccatcttaaagactcttttcactattttcttgatg
+cctcattcttctaatattaggtgattttttaatccgagaatataaaaagacgatagaaag
+tgttaaaacacggcgtagcgacatattttaaagaaatgaaatactttttgactatccctc
+atgatctaaacttacgcggagctatctttttgtataacatgtacagagaattaatccgat
+gcttcttccgattaaggacatagcgccgaaaacgtcatggcggcttatcgatatcgtaac
+gcactataccaagtgattaagtgatcaatgaatacgggtttcgggatttctgttaagtca
+tgcacggcaaatacttggagtcttgaataacgccgcgcgtagtacgaaggttctcaagct
+cgcgtgacgtatagaccgtattgctatttcctgccttctcaattgtccgaggattgctga
+taacttaaaataaggttgagtttttaataacgatttgtcgagtttgggaaaatcctcgtt
+tgtgtgtttgtcattttcaagttatcaagaactacgggtataatttacgacgtaatgttg
+gtttgatgcccgattgcgaatatcgtacgaatggtatttgtacaactgctttcctttatc
+gattgctcgagaacattataaagtctattactatggattaagactgtatacaagtgttta
+agcggagcccgtgataatctataaggttttggtacctttatctgttacttttgccttgaa
+acatacatacgtacacgggaatatttacctaaacgccgtatagtccagcctcgtatttgg
+gccgtgttttgtcagcattttaaactgaaagcgcccacttgcattataacccggtgcgga
+atctcttagtgactcgtcaggagtttacgcctttgagacctctcgacaggacccattttg
+atctagtcgttataggtagagtgcctttcctatcgcaccattaccttctagcaaacttag
+agtattcaatgaaatcatatcctgtttatactaaatgttataggctaatgacacagctga
+cactaagaggtctcttcgggttacccgaatgagttgtttatacgatgttgacaactcggg
+ggagtcatttcaatgaagactgaggactcttgatcagattaaaacgcttaatgactgata
+atttagattatgccgtgtattatttaagtgggcgaaccctcccctagaatgggtttcctg
+agaaaagtcttagaacacagtattctgaatccagatgcaaatcgctaacgttagtaagcg
+gctgtagctcttggcagtttggtcaatagtcaatcgcaatccgtttaaccgtctactatt
+cctagagcgaagagctatgttctgacacgtccccaatattaggcaaaggctccaaaagaa
+cagtcaattgattaactacgggcttggtttctccgtgaatccttgcgccgctataccaca
+taaaaggatagcggtgataccacaagtttgcgacgttaaagcgtcgaccctcaacaagta
+cactagcaaccccttagcaattaattttgtccatcactactgccaagagttgactggacc
+agttggaaatgacatttgatatattaatagagctacatattgtaccactttactgtcact
+tacactaaccctagcgtgattactcatacatatattcgtaaattctaagttatgatacta
+gttttgtaaatttaatcggcgaagacacgttctcttgtacgagcttcaactaaatatttc
+actgtagccaaccactttaaccagaaggataccttaatgccgatataatattgtccagga
+aacgttaatactttcacaagacaaagcttggaagaggtactttacgatcacctgatagat
+cgaccggaacgattctatataggtttggtctgagaaatttgtagctaaaaccatgttcca
+taggaactcctctgtaatgggcaaaatgcagatagcgttcaatcgttgcttaactatcta
+tcacagcatcctaactcctcaacagcttctttcctaaagacatcagcaggtaagttgacg
+gcacccgataacccagagcacgattggaatctaatactctgtatggatcattacgctaag
+taaatataatgattttctgactcaaagttacactgcgaattttatattaactggttctat
+ttgttaaataccacaacctctcgtcaacaggtcgcgatgcaagtgatccaaaaatatcta
+acttataccaaccattacttctggcgcagaaaaacatagatatctgaacaatcgaccgtt
+aagactgtctcgccgatcttaggaacctaatactgctcagtagttattgtttatttgggc
+catccccggattatgtcagccatggaacactaaaagtcctaatctaacctatggacaaaa
+agctcacttttataaaattgctcaccttatgttgattgttatttgtccgaaatgtctata
+actcagtgtactatctattggaaaattatggccggagttttattgaatatacttttgtat
+gttgagaaagaatgttgtcgtaataattatcagctggaaaatcatctaatatatattata
+ttgagatattacgacagacctaagtgctttcccgtcatgagcagatggactaacactctt
+ggtaatccttctcgttttagttggtaatgtttagtctaagtaatatcccgactcttactt
+actcagagcggaaatgactttttaaactaacgtttaaaggcacttagtatgcgtcagggt
+tatttttttaattacgtacccttgtgcagagagtttagctattcgatcctacttagtatg
+aaccatgagagtacaggttggtaattcacagagaaggtcgagaagattatttttgatgtt
+taccaatactatgaggcgtattcatcgaaataattttatggctgcgcacttcacatacgc
+aggaagaccactgcagcttgctagatctggatgtatcattgtacttctaagagcctgaaa
+ggtaatacattcccagcgagcgtaacagattgtatggggacatattcaatcttagcaatg
+cattcgttcttcgaaatcaggcatttttgatgtcataagttctgtcaactataaccctgg
+aactttaatctgttgttcgtcgaatcaaggatcaagaaagcttctaaaaggcccaaagca
+aaacccaccactacttcagttttaaattagaatcacaccctagggtattagataataatt
+aaatgtcttaggaagagatatcaaaagatgcagacatcctcaagtgaataagtctccggt
+ctttcacaaacacatggttaagcgatgtggttttgactagagacgttcgccaccatcgta
+atatttctggttacctgcgaacgtgaaccaaatcttacttcatacattgcttaaacagta
+caacttatctcttatcctatagagatctcaaaagtttgtatttttactggtttcaaattg
+agagaaaaactgcgttctccgatttctatattattgtttaaatgatgccaaacatccagt
+ttaaaacacggtgtgatcagccgactcagattcgtatcctatgttagaatgagtcatcaa
+actacggtcacgcgtacattacagagtaaactacacgaatgaaagagataagaagatgaa
+agagttaataggtctcctgttaattatgagaaccctaactactacggattggcctactag
+tgggttggaacggatataaaattcgactaagttcgcggcatgtcaggctcctaaatatga
+agagaactcggcatcgaattatccacagtaatagttggaacatgattcctctatgcatgg
+tgtatatccacgtacgccagtgtgcagtgtagccatgcgaccacgggcgttgtgaatatt
+cttcctcagaaaaggactgttgagcaaggaattggattctgtgaacggaatatagtcgag
+tagatggaatttcctacactgcgaaaaggtcatagtaaatcaaacgccgcgcgcagacat
+atcttcttggcaattagtactccactaaatcaattggttataaacttttagaatatcttt
+atataagttcactacttacgctgcgggtagtatatttaaagtgatgtcttaggaatctta
+tggcggcggaataaacggcttgactatagataccctaattctggcataaccctgtaacgt
+gtgaagcatgctttaatagacgactagatcagcttatagaatggatatgactgccacatt
+gaagagattaacattagcgggtataatgttacgaacttgtttaacaaaatagctctacca
+cacacgcatagtataatataaaggtcctggagttcgctacgagcctggaattgcagttcc
+cctaccctgagtaaacaagatcagtatggacctatcttctgacccacgtgtaaaaactac
+cgttagcggccctgagaacggtgaagttgattatcggctaacactcgctttaccaaggaa
+caaacaattgatggaacaggtaagcggctggattctatcctgaatacagcataataatat
+ttgctttcaatatatagttatgacactcccaatatcactaactctttacaaatcggatat
+gaagagtgaattagagatggagccgatcgttccttgtattctggtaagtactcgactaat
+gtgtgtagtctaggggtaaaggtccttaaccgtcgagtctagaactcacgcattatgaaa
+tcctccgagcatagagactctaaattcgccaagcaataagtcccgacgcgaaggatgaga
+agctcattgaactgtaacatttacgtcgggctcaccatgttacatatgcagcgggtaaaa
+gtttttgcctggagtggttgagtttcgcgatacataaaaggccccactttcatatggtca
+aatatctatatcgtgctttggacgactcgataaactaaagtagcctagtaatgccctaaa
+ccgctgcatttgtgcaataaaaaatttagagtatatataacttccggacgtatggctgcc
+ttgaatcctcggatatcgtccttatacaacgatgaacggtatagctcggaactatgcaga
+ttaggcgatccttgggttgaatttttagtttccatagatatgagttagttttgatatggt
+taccatacgtccctgcattgaaacttaatctgtatattgattgatccttagcaatagcgg
+cacatttctgggcaatatgacttaattaggttacggtttttactatgatggatacgtttt
+atatgatagaataacagttgctatttaaacaggtactacattcaactaatactgtttcac
+tattgtgtccaacatagggaatatattgcctgaatagatgtattatcaggcatcttttac
+gctccaggtagaactaattaaaaatgatccttagaaactttcaagcaacataagctaaaa
+gttacgccaattataagccacatcggtaggatcttcaggcattcccatatccttctctat
+caatcccgtctgttgctaattggttatctaagcatatcgcggcgagcatctacgataggt
+ataaagttgctgctatctaattcgtcataatatatacatggaattacagattcatacgtc
+ttcagtctcgtggtgtttctaagagcggacccaagaattacgtaatatctctctcgtgtt
+acccaagaagttgacacgtgattgtcagctatctttttctggcgatgttaatagttataa
+acaattgcatatagctgcaaattagctaatcaaatactcgtttcttaaatgttatcagca
+aagctttaggttctgtaatttcactgtgtaaagagggcgctaagttcaaaattggttttt
+ggcaacaaacaatttaatagcgcagtgcaaaaataatatctcagggtgtaattatttctc
+taattggtctttacggttggaccaggcaatgggttttttatctatgtgataccaattaaa
+agtaatttcaaagtgacattaaacttaagtattgctgtcaagaccattacgacacttcac
+caacacatttatgtattgtgctacgcggtatggcccgtagtaatttctgatattgaccgc
+gttatcagcaagtacgctgtacaaatgccaaatttagtaaagctctgtgtgcattccaag
+gtgcccacatcacacattatcaacatatcatgtcgttgtattacgtccttttactagcct
+gggaaataccggtgattcagagtgaacataaatctctgaaagctactagacaaagctagt
+atagttaaaatatatatttcttttaatattaggatctttgcgattgcacatttcaagcat
+cgcattaacctacctccgtactcttctacaacggttgcatgtacgatttctatgcgatga
+aatacttatgttcttagtttggggttactttgttcacctagtcctcgaacgcaaattagc
+ttcgaatatctgaaaagtgtatgcgggcaccaaaacgatctcgattcttaggtttataat
+tatagtcagaagataaatacatgcatatctggacactcttccacatgtcatgtcgactaa
+ctttgaactacagtcatatatagactgttatctgatccgtatgtgtctattactactctt
+atctgagaaaggacccaatggagtcacagtaagcgatcatgtcatcggggctttttccct
+gattataagattacactattgctgtgcttggggcctcctactttttctatcttaatcatt
+ttgtacattaaaaagctaagaagtaggtacaacttatctttcccatacgagctggaccat
+taatttaacagccgcaaggcgagttttaatgttaatctggaagggctttatgttctaagc
+ttttagcactgagaaattaatccgtaggaaattaatcccacataacccggtaagagaacc
+ttacgccccgttactaataatgttctgcgcaatgtaggaagtgacaagctcactcttgcg
+acgagctccttaatacaggccctgcgttatattcgaccgtacctataactagaccaccat
+cttaaatgtacagttatggttttcgacgcatagagtatgggaccacctcgaaatgctcag
+ctgcaaattgtactgggggtggttatcaaacatttaatatgaatctatggtaaagtacta
+gtttatagatagccgaacactaaaggtttgcagaccttcctcccctgaggaacttcgtgt
+cacaaattagattgagaaggtggtgataaaatcgcgtatctacaatgatttggtgcaaat
+atttatcgattgcccaatcgttctactcgtactctttatagcctaacgccttttcttggc
+gctaattagcctaatccaagaaggagtctaacaaaattacttaaccatactcttgtctat
+tcggcccacgcatgcgcaagctcaaaaagttctcaacgggcgtttttacttgagtcccag
+gaggtaacattggatctatgagtcttaacagtggaaatatgatttttagattgtgttcag
+atttattgtcttattttggtctatctcatcagctatagctacataatgacgtcttaactg
+tttcgactaaccttcagatctgactaccccaaatacaacatagcaaaagaatgatgctaa
+cgcttaactatcctttcacgatcttaacaaaaaagctccatttaaaagaatcgaaaacag
+atctaccattcgtggaatcaatttttggacgagtactggtcgggtcgtgcttatttgcta
+caggattgtttcgtataacgttcaagcactttagcggttccatccttgatggcgttaact
+gatgatgcgtaagtttatggtgatctaaaactctactacgaaccaggtcccagcacgaaa
+cgtcatctttaatgagtttttaggtctccaggcactaggctgcgaagtggaatatgtgtc
+atcagagacaaatagatgattcctatagctttttgcagttaagccactaagtaggcggtt
+ctatagggtttcattcaaatcgatcgtaattcccgactctgcatagcgtgggtcttgtat
+agaccattcttcaggcccgccacaatggtttcaagtttcaacttccgtttattggctgtc
+cctcaatagagtcgttctcagggcacgactctcgttcgttattcataagtccagtttgat
+ccacgaatacagaacacgcatatctgataataaaagcttaacgataactttcacgcgcat
+ggtttatttttgatttattaggcaaccaaataccagaatgtagtcagcgatatgtagtaa
+aatttagacaaacataaaacaaagtatcgccattacagtctcctgttaggagaacctttt
+tatcaatatgtgtaggcgtgtattggcgcccttgatttaataataattacggctaaacgt
+attgatattttccaggaactgccccatctcatgagatgaccctaaattttattcacacct
+catttttaattcttttatatcacgattatttatctgagcaagcatctttgcaagcattca
+tagtgacggtgctgtctctatgaatgcatgctaatatacggtgcgctaaacatattggtt
+caattcaatgtaagctacctcggaatttgcttgcactaagacggggaagccaaaacggta
+aatcgccgtatatgctagtgccaagggacttgtccgttggagtcactatggagttacaag
+cattataaatctaaggaaatcgcagtatcagtccttaccccaaagatacttcgcattccc
+tggggtacggaccatgaaatacttctttcatacatgataaacgatggagactcggttacc
+accctggtagttactccatcaattggagttaactaagatcgctattacaggctttattag
+ccaatcatcacaagcctctttttagagattcacaagttagcaaaccaaagttcctttgat
+aagtctttaacgagatctatcccaattccggctaggagtaaaatttatatatttgagatc
+ggggttaaagtcacacgcaatgcaaggggtttttatatggtaatgtccttccctaattag
+gtaattttcagacctccgagagagagtagatcaacaacgcgttatactcctaaaatgctt
+gtcgataacatgacactacagatcatccctggatgagcatcgactttcattacttgatta
+gttcagttaattcgtttcaaaccattttcaacaaaatcccccagtagatatgtatatgca
+catcttagactaaataacagttttcataccctgggatttgtgtcactatctcaggaacgt
+cgagacgtcccctatcaccgcagcgagggtaactggccctgttccattgtaatcgatggg
+acgggacgttatattgcagacccaaagtagtaataaattcagccatatggacggaggggg
+ggaattgttaagaatataattcgattttcagctgaatgtaaaagctccagccattcctcc
+tccacttgacattagttcgaagaaggtctgagaattggaattgcttgtgacgttttttgt
+ttccagacaaggaaatagcccagtaccaagtataatattatgacaatagaagcttaaatt
+cacaacgtaacatatctgttagcatgctctaatagaccgagaaaataagtgtctatgtgt
+gcgagaactgtcaattcacggcagtagtcacctaatctaacgtctagttcccgactatga
+agtcttcacaaatggttagtaataatttcccagtggagtagaagtggcataacgtgcact
+ctctgttaataatacctttagactactcccatttcgccagaacgtcttgatggtacccta
+tgggaaacactcacacatgcttattgcctgcaacctcagcaatgtgtcgtatgcggtatt
+tctacgaacagctagtgaaaggactgatgacctaattttggtttctcaagtccagacgtg
+atattttgatgaccgtatctgacatctctgggcaattcggttaacctctggtacgaaata
+gtccgtcgcgtaggtaaaaatgataatgctgtcatcactatcatgttttagctaagctac
+actaccccatcgctcgcacgtggcaaagtgtgaggattccgatatcatccatgtgtacga
+attcctaatactcttgctcagggcacttagggttattgtagcctgtgttaccgtctcgca
+tattagatcattaatcaacagtcttataatcaccgtaatcggtaaacagttgttatttgt
+tctgataggtagacagctaataaagatgctgttgaacagttacgtcccacctttattgcc
+ctacagtgaaactagttcttactctgttgctgtaatatgtctagggttattgatttgctg
+ccacttcaaaacggaaattaagtcattaacgaaaatggttccttcataggtaaagatcaa
+tccccaattgaagccagaaattttgagatgtcgattcctgatcattcgccaaatttacag
+ctcgtaaacgagttccatgtgtaaaaaaatgttgagtccactagcttgtttattctggct
+caaggtacgtggaacacgtagtattttgatactaatgccagacccgctacgatccctgta
+ctgtgagcagagccgatcctcagaaatagctaaatcttgtgcttcgttagaagtctcgac
+tacgtgtagcctagtgtttgtgttgcgttatagtctatttgtggacacagtatggtcaaa
+tgacgtcttttgatctgacggcgttaacaaagatactctgggcaacacacatacttctct
+catgttgtttcttcggacctttcataacctttcctggcacatggttagctgcacatcaca
+ggattgtaagggtctagtggttcagtgagcggaatatcattcgtcggtggtgttaatcta
+tctcggtgtagcttataaatgcatccgtaagaatattatgtttatttgtcggtacgttca
+tggtagtggtgtcgccgatttagacgtaaaggcatgtatggatcttgatctatgcaaagg
+taggtccatctatatacgttgcacagcggatacaaataagataagaatttactaacattt
+aaattttcttattgtcgagcatagattggaggaaaaacttatttacttggtatttaaacg
+gaagtttctaatgtttatgattggatgcacggacagtttactgcttactttcttaggttt
+cttgaacaacaggatgcactagtaacatgtctcgttcatgcttccattaagttcttctta
+aacttacacaaactacctaatttagagttgacgagatggttgaacgtgttgtgacaaacg
+tttgcaaaatgcacagtatcgttaccaaaaagtacatttaagtgtgtgcgtaggaattct
+gctacgtccattgcaggccacattcacatcccacccctgaatatatggactgaatcacac
+acaccaaatttcatctaccttatcgtagcataactattaacaaacatatacagacttcgc
+ggtaaataaaatatattagtacacaaccgtatactggttgaactattgcccagctttaag
+acgcttttaactaggtgcttgatcaagaagtattattatatgacggcagtgtgtaatacc
+tgaatagatatagacgttagattgtctgaaaacacgccgtagagacatttttgttagata
+tgtatttctttttgacgagccagcatcttagtatctgaagacgagctatatgtttgtaga
+aaatcgactgacattgtatacgaggcggcgtaagattaaccaaattccccagaattagta
+atggcgccttatcgatttactaacgatatataacttgtgatgttgtctgcaatgtatacc
+cgtgtaggctgtgctcttatcgaaggaaacgcattgaagtccaggctggatgaaaccacc
+gcgtacttccatgcgtctatacatagcgtcaccgatactacgttttgctatgtaatccat
+tctaatgggtaagaggattcctcttatagtaaaatatgcttgactttttaagaaccattg
+ggagtggttggcaaaataatagtgggtgtctttctcagtgtatagttttctacaactacc
+cctattaggttacaagtaatctggctttcttgccacttggcgatgatagttagattcgta
+tttctacaacgcagttactgtatccatggcgcgagataattagatacgatttgaatttgg
+atgtagactcgttactactgttgtagaccagcacgtgagtatctagatgggtttgctacc
+ttgttagcggacttttgccgggaaaaagacatacgtacaaccgtatattttactataagc
+agtattggccaccctcgtattgcggcagggtgtgctcacctggttaaaatgaaagagaaa
+aattccattttaaaacccggaggaatctattactgacgaggaaggtgtttaacccgttga
+gacatctcctaacgtaaaaggttcatattctagttattccgagagtcactttcctatcca
+aacatgaactgatagcataatgacaggttgaatggaaagcatatcctgtttattctaaat
+ctgtttcgctaatcaatatgctgtcacgaactcggagcttacccttacaactatgtgttc
+tgtttaccaggtgctaatatcccggcactcttttcatgcatgtcgctcctagcgtcatct
+gatttaatagcttaatgtctcatattttacagtagccagtgtagtatggaaggcggcgaa
+ccagcccctacattgggtttcctgacataagtattacatatcacttgtctgattacacag
+caaaatcgctaaccttactttgcgcatgtagctattggaactttgggctagtgtctatcc
+cattaagtttaacagtagactagtccgtgagcgatcaccgagcttatgtctcgtacccaa
+gttttggatttggatcaaaaactactcgatattcatgatctacgggcttcctttctccgg
+gtatcattgcgccgagattaaaaataaaacgatagcgctgtgaaaacatgtttgacacgg
+gatagcgtagaaactaaacaacgaatagaccatccaatttgaattttattgggtccagca
+cttcgccatagtgttgaatggtaaagttcgaaaggaaatttgttatattaattctgctac
+attttcgaccacttgtatctcaaggacaatatcccttgaggcttttagcagaaagagatg
+ccgtaattctaagggatgataataggttgggaaatttaagagcagtagtaacggtcgcgg
+gttcgaccttaaactatatatttaaatctagccaaacaagttaacaacaaccataaagtt
+atgaccttattatattggcaagcttaacgttttaattgctctagtaatagagtggtagag
+gtaagggaccatcacctgattcttcctccgcaaccattatatagacgtgtcgtctgacaa
+atttcgagataaaacattcgtccttagcaacgaatatcgaatggcaattagccacattga
+gttaaatagttgaggatatttcttgcacagaatcagatctaatctaatgattcgttacta
+aacacttcaccaggtatcgtgaaggctcaagattacccagagaacctttgcaatataaga
+atatgtatgcagcattaccctaagtaattatattctttttctgactcaaagtgacaagcc
+ctagtgtatattaaatcggtatatttgggaaattcctcaaactatcctaatcaggtagcc
+atgaaagtgatcaaaaaagttcgtacttataccatacatgaattctggccaagtaaaaaa
+tagattgcgcaaaattcgtaccttaagtctctcgccaagatattaggatcctattactca
+tatcgtgtttttctttattgccgccatccccggagtatctcacccatccttctcttaaag
+gcctaatattacctatgcaaataaacatatattgttgaaaattgagaacctgatcgtgat
+tcttatgtgtaccatatgtatagtaatcacgcgactatatagtgctttagtatcgcccgt
+gggtgagtgaatattctgggctagcgtgagatagtttcttgtcctaatatttttcagatc
+gaatagcttctatttttgtgtttattgacatatgtcgaaactccttactcagtgaaagtc
+atgaccagatccacgaacaatcttcggaatcagtctcgttttacggcggaatcttgagtc
+taacttatatcccgtcgcttactttctaacaccccttatgtatttttaaaattacgttta
+ttcgaacgtacttggcggaagcgttattttttgaagtaagttacattgggcagactcttg
+acattttcgatacgactttctttcatccatcacaggactcgttcgtattgatatcagaag
+ctcgtgatgattagttgtcttctttaccaatactttgaggcctattctgcgaaatttttg
+ttgccctgcgaacttcacataccaaggaacacctcgcaacatgccttcatatccatcgtt
+cattgtaattcttacacaatgaatcctaagtaattacatccctgcgtaaaagatggtagg
+ggcactgaggatatattaccaagcatttagttatgagtaatcagcaatgtttcttgtatt
+aagttctctaaaatagttacatcgtaatgttatctcgggttccgcgaataaacgagatag
+attcattatatatggccctaagcaaaaacctcctcgtattctgttggtaattagaatcac
+acaatacgggttgagatattaattatttgtagtacgaagagatataaaaagatgaacaat
+tactcaagtcaagatgtatacgggatttataataaaaatcgggtagagatctgctttgca
+attcagacgtgccactaaatcgtaatatgtcgcgttacatcagaaagggtaactattatt
+aattaataaagggcttaatcactacatattagatcttatccgatagtcttatctattcgt
+tgtatttttaagcggttctaattcagtcattatatcagtgctccgagttctttattattg
+ttttaaggatgacaaaatgcctcttgttataacgctgggagaagcagactaagagtcgga
+gcagttggtagaatgaggctgcaaaagacggtctcgacgaatggacagactttactaaac
+caatgaaagacagaagtagagcaaagtctgaagtggtatcagcttaattatgacaaccct
+taatacttccctttcgccgaatactggcgtggaaaggttttaaaagtcgaagtagttaga
+ggcatctctcgctcataaataggtagactactcgcaatccaatgtgactatgtaatactg
+ggaacatcagtccgcgatgcagcgtgtttatcaaccgtccccactcgcctggggagacat
+gagaccacccccgtggggattattagtccgcagtaatcgactcttgacaatccttttcga
+ttatgtcatagcaatttacgacagttcagcgaagtgactactcggcgaaatggtattact
+aaagcattcgaacccacatgaatgtgattcttggcaatttctaatccactaaagcttttc
+cgttgaatctggttgtagatatttatataagttcactaattaagatcacggtagtatatt
+gatagtgatgtctttgcaagaggttggccgaggaatttacggattctctattgatacaat
+ttgtctggcttataactcttaaggctgaaccaggcgtttttagacgacttgatcagctgt
+tagaatggtttggactccctctttcatgtcagtaacatttcagccgttattgttacgata
+tgcttgaacaatattgatctaccacacacccatagtatattttataggtcatgctgttac
+ctacgagcatggtattccacttcccattcaatgagtattcaacatcactagcctcagaga
+tgatgacccacctctaataacgtcacgttgcggccatgtgaaacctgaacttgagtagac
+gatatcaagcgctttaaattgcatataacatttgagggtaaagctaagcggatgctttat
+ataatcaatactcaataataagatttgattgcattttagagttatgacacgacatagttc
+actaacgagttactattcccagatctagactgaagtactgatcgagacgatccttacgtc
+gatgatcgttagttatcgacttaggtcgggtctctagcggtattggtacttaaccggaca
+ctatactaataacccatgatcaaagcataacagaatacagacgataatttcgccaacata
+tatgtacagaccccaagcatgagaagctcattgaaagctatcattgaagtcccgctcaca
+atgtgtcttttccagacggtttaactggttcccgggagtcctggagtttcgacttacata
+aatggaaacaatgtattttgctaatttatctatagcgtcatttggaccaatacagaatat
+tatgttgcctagtaatccactataacccgcaagtgctgatagaaaatttttagacgattt
+ataaatgccccaagtatccctcccgtgaatcctccgttatactaattagtattcgttcat
+acgtataccgcgcatatatgaacatttggcgataaggcgcgtgaattgttacgtgacaga
+gatagcagtttcttgtgatatggttaacagacgtacatgaagggaaactttatatctata
+gtgatgcttccgtagaaataccgccactggtctgccaatgatgaagtatgtagctttagg
+tttgtactatgaggctttcgtttgtttgcagagtataacagttgcgagtgaaaaaccgac
+gaatttatactaatacgctttcactattggctacaaaatagggaagagtttcaatcatga
+gagggagtatatggatgctttgtagctaaaggtagaacgtatgtatatgctgccgttcat
+tcttgaaagatacataagcgataagttacgacaattataagcaacatccctaccttcgta
+acgatttcactgttactgcgcttgaaatacactatggggctattggcggagagaagcaga
+tcgcgccgagcatatacgagacctataatgttgatgatagagaaggcgtctgaattgata
+catcgaagtacactttctttcgtagtatctctcgtcctctttctatctccggacacaaga
+attaagttatatatatagagtcttaccaatcatgttgaatcctgattctcagagttcttt
+ggcgggccttgtgatgactgagaaacaatgcaatattgctccaaatttcctaagcaaatt
+ctcggttatgttatgttatcagcaaagcgttacgttatgttatttaaatctggaatgacg
+gagcgaagttcttatgtcggtgtgggaataattcttttgaagacagcactccttaaataa
+tatcgctccgtgtttgtatttatcgaatgggtctgtaaccttgcacaagcaaatcggtgg
+tgtatatatcggataacaattaatacgatgttcatagtgacagtatactgatcgagtcct
+ctaaagtcaattacctcacttaacaatctcattgatgttgtgtcattcccggtatcgccc
+gtagtatgtgctctgattgaccgagtgtgaaccaaggaacatctactaatgcctttgtta
+ggtaagatctctctgaattccttcgtgccaacttaaaacattatcaaaatttcttctact
+tggattaactacttttacgagcatggcaaattcccctgtggaagacggttcattattatc
+ggaaaccttatagaaattgcgtgttgactgaaattagatttttattgtaagagttgcatc
+tttgcgattcctctggtctagcttccaatgaacagtcctcccttctattcgacatcgggt
+ccttcgtacatgtctttgcgatgtaataattaggttcggagtgtggccttaatgggtgca
+actaggaatacaacgcaaatttgctgacatgatagcaaatcggtatgccggcaccaaaac
+gtgctccttgcttagcttgtgaatgagactcagtagttaaataaatccatatctgcaatc
+gattccacaggtattgtccactatctttgaactactctaagagatacaagcttagctgag
+accgaggtgtatatgactacgctgatatctgtaaggtaccaatgcaggcaaagtatgcga
+gaagctaataccggctgtttccagctttataagattaaaatttggctgtcctggcggcct
+cagaattgttctatcgtaatcagttggttcattaattagctaagtacgaggtacaactta
+tctgtcccagaacagctccacaagtttttttacagccgaaacccctgtgtgaatcttaat
+atccaagcgcgttatctgattagagtttacaactcagtattttatcagtacgttttgttt
+ccaacattacccggtatgacaaaatgacgccacgtgtcgaataatggtctgaccaatgta
+ggaagtgaaaagataaatattgcctacacatactgaattcaggcaatgcgttttattcga
+aaggtcatataactagaaaacatgatgaattcttatcggatccttttactagcatagtgt
+tggcgaacacctcgtaatgctcagcggcaaattggactgcgggtccttatcatacatttt
+ttttcaatataggcgattggtctaggttagtgattccccaacacttaaggtttgctgaca
+ttcataccctcagcaacttcctctcaaaaattagagtgagttggtggtcttataagaccg
+ttgattatttgaggtggtcaaatgatggtgcgatgcacaaatcgttataatcgtactctg
+tagacaataacccattgtagtgccgattttgtgcataatacaagaaggaggatataaaaa
+tgacttttcaataatattggctattagcaacaagaaggagaatcctcattaagttagcaa
+ccgcagggggtactgcagtccaaggaggtttcattggagagagcagtatgaaaacggcaa
+ttatgattgtgagattcgctgaagattgtgtctctgattttcctagatagaataagctat
+agctacttaatcaactcttaactgtggagactatcctgatgatctgaataccccatttac
+aaaattccatatcaatgaggctaacgcttaaatttcatttctccatcgtaacaaaaatca
+gcctttttatacaagacaaaacactgcttccattacgggtagcaatggttgctcgactac
+tggtagcgtcgtgatgtggtgataaagctgtcttgcgtttatacttaaacaaattttgac
+ctgacataatggagcgacttatcggatgttgccgatctttagggtcatctattaagctta
+tacgaaaaagggacaagcacgttacgtaatctggtaggactgggtacctagaaacgcaag
+aggaggcgaactccaatatctgtaagaacagaaaaatacaggagtccttttcatttttca
+agttaacaatataagtaggagcttagagaggcttgcatgaaaatcgttaggaattacaga
+ataggcagagagtggggcgtgtagactacattcttcaggccccacaatatgggttatagg
+ttaaactgcactttttgcgatctcccgaaatactgtcgttctctgcgaaccacgctcgtt
+ccttttgctgtagtccacgttcatccaactattcagataaacaagatcgcagaattaaag
+cttaaccatatcttgatagcccatcgtgtatggggcatgtatgtgcaaacaaaagacctc
+aatcttgtctgcgagagggaggaaaatttagacaaacataattcattctttcgactggac
+acgctaaggtttggacaaactttgtatctatatctggaggcctgtattccagcccttctt
+ttaataagatttacggcttaaactatggatatttgccaggaaatgacactgctattgaca
+ggaacataattttgattcaaacctcattgttaattattttatatctcctgtttttatatc
+agaatgcttctgtcctagaaggcatactcaaggtgagggctcgaggaatgaatcataata
+gaccggcccctattaatattggttcaattctttcttacataacgcggaatttgattgcac
+gaacaccgggaacacataaccgtatagcgcccgttatgctagtgcctagcgactgggacc
+gtggagtctatatcgtctttctaccattattaatctaaggatataccactttaagtcctt
+tcaactaacataaggcgcattccatgcgctaaggaccttgaatttattatttcttacatg
+ataaaagatcgagtcgacgggaacaaaaggctacgtactcaataaagtgcagtttactaa
+gagccctttttctggcttgtggagactatcataacatgaagatgttttgacattcaatag
+tttgcaaaacaaacttactttgtgtagtattgaacgagatctttccaattgccccatagc
+aggaatagttatatattgcagatcgcggtgtaacgcactccaaatccatcgcggtgtgtg
+agggtaagcgacttaaagaattacggtttttgatcaaagcacagtgagagttgagcaaat
+tacagttatacgacttaattcagtctccataaattgaaacgacacttcttaacgggagga
+ccagacacgttcattaagtgaggagtgcactttttgactttaaaaacatggtaatcaatt
+taaaccacttgatatgtatatgaacagatttgaagttatttctgttttaatacactggga
+gttctgtcaatatcgcaggaaccgcctgacgtcccctatcacacctcagagggtaaaggg
+acaggggaaagggtaatcgaggggtagggaacgtagttggcacacccaatggacgaataa
+atgctgccatatccacggagggcgggattgcggttgattttaaggcgatggtaacctgaa
+tgtaatagatcatcaaatgcctcctccactggaaattactgcgtacatccgctgagaatt
+gcaatggagtgtctcggtttttctttaaacaaaaccaaattgacaacttcatagtataat
+ttttgcacattacaagcgttaattaacaaacttactttgctgttagctgcctatatttgt
+ccgacaatataactggatatctctgcgagaactgtaaattaacggcacttggaacataat
+agttcctattggtaacgacgttgtaggcggcaattatccggtggaagaattgacaactgc
+agttgaactgcatgaaagtcaaatctctcgtaagtataactttagaagactccaaggtac
+ccagaacctcttcagcggacacgatcgctatcaatcaataaggattattcactgaaaccg
+ctcatatctggaggtggacgtttttcttcgaaaagcttgtcaaaggactcatcaaatttt
+tggccgtgctaatcgacacacctgttattttcatgaccggataggacatctcgcggaaat
+tcgggtaacagctgggtagatataggacctcccctacgtattaatgataagcctgtcata
+actagcttggtttaccgaagagacaataaacattcgagcgctcgtgccaaactcggtgca
+ttacgtttgaataaatcggtaacatgtactattactctgcctaacggcacttacccgttt
+gggtccatggggtaaccgctcgatgttgacagaattatgctaaagtcgtttaagatcccg
+attaccgaaaatctggttatgtctgagcattcgtacactgcgtattaagatcaggttgaa
+caggttcctaacaaattttgtgacctaaagtgaaactaggtcgtactctgggcatgtttt
+atgtcgtggcgtatgcatgtgctgacacttctaaaaccaaattaaggctttatccaatat
+gggtccttaagtgctaaacatcattcacaatttcaagacagattgttggtcttgtcgatt
+ccgcatctgtcgccaaattgacacatcgtaaaccaggtacatcggtaattatatgttgac
+taaactaccgtgtgtattctggctctaggtacggcgaacaagtacgatgtgcttaagaag
+ccctcaccccagacgagcccgcgtaggtcacatcagcagatcctaagtaattccgtttta
+ttgtcctgagggagtaggatcgacgaactctacaagtcgctttgtcgtgccttataggct
+atttcgggtcaatgtagcgtcaaatgaactattgtcatctgtacgagttaactaagtgtc
+tatcgccaactaaaagacgtctcgatggttctttatgcggacctgtcatatcattgactg
+gcacttgcttacatccaaataacacgtttgttagcggatagtcgttaagtgtgcgcaaga
+tcatgaggcggggggggtaatatttcgccctctacatgataaatgaataagtaagaagat
+gatctttttgtggcggtaccttaagcgtactcctgtcgacgagttactactaaaggaatg
+tagggttctggatctatgaaaagcgacctccatatatatacgggcctaagcggagtaaaa
+taagtgatcaatggactaacattgaaatgttagtattgtcgaccattgagggctggtaaa
+tcttatttacgggcgtgggaaaacgaacgtgatatggtttagcatgggatgcaagcactc
+gttaatgcttactttagttggttgcgggaacaacaggaggctatactaactggtagcgtt
+cttgcttccattatgttattattataattaaaaataagacatatggtagagttgtagtca
+gggtggatcgggttgtctataacgttggaataatcaaaactatcgttaacaaaaacgaaa
+tttaagtcggtgcggtggaatgcgcctacctcatgtgcaccacacattcacagcacaccc
+ctcattataggcaaggaagcaaacaaaaaaaagttaatcgaccgtatccgaccttaaatt
+ttaaaataaatagaaacacttagcggtaatgaaaagataggactaaaattcactagtatc
+ctggaacgaggcaacagagttatctagatggtaacgaggtgctgcatcaagatgtatgat
+ttttggtccgctgtgtggaatacctctattgatatacaagtgactttctcggtaataacg
+cacttcacaatgtgttgtttcttttctatgtattttgcaagagaaagaagcttagtatag
+gtacacctcagagatgtttcgtgtaaatcgtatcacatggtataactgcaggaggaacat
+tatccaaattcaccacaattactaatccacccttttacttttactaaagatatattaatt
+ctcatgttgtctgaattgtataacccggtaccctgggagcgtatcgaaggataccaattg
+aagtcctcgaggcatgttacaacacacgacttccttccgtctattcagacactcaacgag
+actaacttttcctaggtaatcaatgatattgggtaactcgtggcatcttatagttattga
+tccggctcttttgtagatcctgtgcgactcgtgcgctaattaagactggctctcttgcgc
+aggggatacgtttattctacgtacccgatttggttactactaagcggcctttcttcaaac
+ttgcagttgtgacttacattcctatttcttcaaagcagggaagggttacagggagagact
+tattgagatacgattggaatttccatgtacaatcgttaatacgcttgtagaccagcaact
+cagtatagagatccgtttcctaaagggtgagcggtaggggcaaggcaataagaaattact
+aaaaccctagttgttaatataagaacgattcgaaacaataggattgcccaagggggtgcg
+aacatggtgtaaatcaaagagaaataggcattgttaaaacccgcacgtttctagtacgca
+agaggaacgtcggtaaccagttctcaaagatcctaacctaaaaggggcttattctacttt
+ttccgacactcaatggacgagacaaacatgaacggatagctttaggtctcgttgaatgca
+aagaatagaatcgttattattaatcggtttccattatctatatgcggtatagatctccga
+gaggaccctgtaaactagctctgcggtttaactggtgctaatagaccgccactatgttat
+tgcttctagctcctagcgtcttatcatgttatacattaatgtcgcatattggacagtagc
+caggcttggatggatcgccgacaaaaagaaaagactttccctgtaaggacttaactatta
+catataacttggatcattaatctgcaaattagagtaacggtctttcaccagcttcatatt
+ccaacgtggcgctagtcgatatcccatgaagtttaaaactagaattggcagtctcacttc
+acagtgcgtatctatacgacaaaagtggtcgatttgcataaatatcttatcgatattcag
+gttattaccgattccttgctaacgctagaagtcacaccagagtaataataattccagaca
+cctgtgaaataatcggtcactacggatagactagtaacgataatacgtatagtccataaa
+agttgaattttaggggctaaagatattagcaatactggtctagcctaatcgtcgatagca
+aagggctgtgaggatttctcctacattttcgaccaattgtatcgataggaatagttacag
+tcacgcttgtagatgtaagagatgacgttattcttagggttcttaagtcggggggtaatt
+taagaccactagtaaaggtagaggcgtacacagtaaacgatattttgaaatcgtcaaaaa
+aaagtttacaacatcctttaagttagcaactgattttagtggcaaccttaacggttgaat
+tgatctactaatacaggcctacaccgaagggtacagataatgattcttactaccctaaca
+tgatagagtcctgtcctatctcataggtcgacattttaaattcgtaatgagcaacgaaga
+tcgtttcccaatttgcaacattcacttatagacttcaggttatttcgtgctaacattaag
+atagaatataatcagtcgttaagaaactattatccagctttcgtcaaccataaagattaa
+aaactgaaacttggcaagatatgaatagctatcctgctttaaccgatcgtatgagatgct
+ttgtagcaagaaaagtgactagcacttgtgtttagtaaagcgggagagtgcggtaattaa
+tattaatatactattaagctacacagcaaaggctgcaataatgttagtaagtagaacata
+aaggtattctccacaagtaataaatagtgtgagctaattgactaacttaactctcgcgac
+aagtgatgtggataagatgactcatatcgtctttttctgtagtgccgacatcccacctgg
+atcgaacaattccttctagttatcgactttgattacctatcctattaaacagatagggtt
+gtaaagtcagaaaatgatcggcttgcgttggtctaccatagctagagttagaacgcgtag
+atagaggccttttgttgccaacgtgggggtgggatgagtctgggcgagcgtgactttctt
+tcgtgtccgaatttgtttaacatccattagattagatgtttgtgttttgggtctgatgtc
+ctaactactttctcagtgaaactaatgtcatcatccaagtaaaatagtccgatgaagtct
+ccgttttcggccgaagcttgtctataacgtatataaagtcgctgaatttagaacacacct
+tatctatgttgtaaagttactttattccaaaggacgtgcacgaagcgtgagtgtgggaag
+gaacttaaagtcggatcactcttgtcagtgtagataagaatttctttcatacttcactgg
+aatccggcgtatggatatctctaccgcgtcatctggtggtgtctgcggtaaaaagtcttg
+ctgcacgagtctgagaaatttttggtgccatcacatcgtaactgtacaacgaacaaatag
+catcaggccttcttatccagcgtgaagtctaattatttcacaagctttcctaagtatgta
+aatccctcacttaatgatgcttgcgccaatgaggatagaggacattgcatgtacgtagga
+ctattctccaaggggtcttctattttgttagcgaaaattgttacagcctaatgttagagc
+ggcgtacgactttataccagatactttcattagatatgcaaatatccaattaaatcatag
+tagtatcgtggtatggacaatcaaaaaagacccgttgtgatatgatgtttttctagttcg
+ttctcatatatatagatcaacaatgaataatctcatgatctataaccgatgtatatttat
+attccggttgactgctccggtgcaattcactacggacactaatgactaatatggcgcctt
+tcatcagaaacgctaaatatgattaatgaattaagggagtattatctaattattagagag
+tagcagttagtctgatattttcggtgtatgtgttagccgttataatgctgtctttttatc
+agtgagaacagggagtgtgtagtgttgtatgcttcactttatgactctggttatatccct
+cggagaacaagaataagagtacgagaagttcggtcattgaggatgaaatagaaccgctag
+acgaatggactcacgtttataaaactatgtatcacagtactacagctaactctgaagtcc
+gagaagcttttgtaggacaaaacgttataagtacctttcgcagaatacggccgtgcatac
+ctgttataaggcgtagtagggacaccatgctatccctcatatagagctacactaatacca
+ttacatggtgactatcgtttacggccatcatctgtaagcgatcatgcctcgttagcatcc
+gtacaatctcgcatggcgtcactgcagaaaaaccccgtgcggattttgagtcagaactat
+tcgaagcttctcaatccttttccattatggcatagcaagtgacgactcgtcagccatggg
+aataatagcactaatccgattacttatgaattagaacccacatgaatgtgattctgcgaa
+ttgtctaagaatctaatgattttccggtgaatatggttgttgttatttattgaacttata
+ttattaacatcacccttcgttagtgatagtcagctatttccaagaggttccccgagcatt
+tttaccattctctagtcatacaagttggagcgcttttaaatctttaggctgatcaaggcg
+ttttgtctagaattctgcagatgttagattcgtgtgcaatccctcttgcatgtcagtaac
+aggtcacccgtttttcgttacatatgctggtaaaatattcatagtaataactacaatact
+tgatttgttacgtaatgctcgtacataacacaatcgtattccacggaacagtaaagctct
+attattctgatcgagcctaagagaggatcacactacgctattaaagtcacgttcacgaaa
+tctcaaacctcaactgctggtgaccagttatagacagtgtaattccatattacatgtcag
+gcttaagctaacccgagcctttatataagctataatcaagaattagattggagtgcattt
+tagacttatctatcgaaatagtgatagtaagagtttatatgacctgatctagactgatgt
+tctcttccacaacagccttaaggcgtggagcctttcttatactattaggtcgcgtcgaga
+gccctattcgtaatgttaacgacactagactaatatacaatgagctaagaataacacaag
+tcacaagataatttacaaatcatatatctacagtccacaaccatcactagcgattgcaaa
+gcgttattggtactaccgctctaaatcggtatgtgcaagacgcgttaactggttcaagcc
+tctcctgctcgtgagactgaaagaaatcgaaaatatggatgtgcctaattgttcttgtga
+gtcatgtgcaactatacagtttagtttggtcaagactatgcaactattaacagcatgtgc
+gcattgaatatttggtgtcgattgataaatgccccaacgttccatcacgtctataagccg
+tgttactaatgtgtattagtgcatacctattcagaccatagttcaactgttggactgaag
+gcccgtcttggggttcgtgaatgagagtgcagtttcttgtcttttccttaactgacctaa
+atgaaggcaatcggtttatctagagtcatgcttaaggtgaatttcagccaatgggctccc
+attgagctagtatggtgctttacctttgtaagtggtggctttccttggtgtgctgacttt
+aacacggcagagtgattatccgaagaatggataataagacgctggcaatattggctaata
+aagtccgatgagtttcaatcatgactgcgaggagatccatgcggtgtacctaaacctaca
+tcgtatgtatttgctgacgttcattcttgatacataaagatccgatatcggtccactttg
+tttaccaaaagccctaccttcgtaacgatggaaatgtgaatgagagtgaaatacacgatg
+gggatattgccggtgagtacaagttagaccacacattagaactgacctatattcgtcatc
+atagagatggagtatgaattgattctgcgaagtacactggctttacgagtatctagacgc
+cgcggtatatctcccgtcaatactatgaaggtatatatatagaggctgaaaattcatgtt
+caatcctctttctaagagtgagtgggagccccttctgttgtcggagtaaaaaggcattat
+tcctcaaattgtcagaagcaaagtatacgtgatgtttgcttagaacaaaagagttacctt
+agggtaggtaaatctcgattcaccgagagaagtgattttggcggtgtgcgattaattctt
+ttgatgacagatctcattattttatatagctccctctttgtatttagagtttgcgtaggt
+aacctggcaaaaccatatcccggggggagagtgcgctgaacattttatacgatgtgatta
+ctcaaaggataaggttcgaggcctctatactcatggaactatcttataattataatggat
+cgtggctcattccacctatccaaacttctttgtgatctgatgctacgagtgtgaacaaac
+gtacatcttctaaggaatttgggacgtttcatagctcgcatttcattcctgaaaacttaa
+atatttttaaaaattgattctactgcgaggaactaaggtgtagacaagcccttagtaacc
+ggtggatgtcgcttcagttttatagcaaacattattcaatttcagtcttgactgaaatta
+gtttgttagtgttagaggtccatatgtcacatgcatatggtctagatgccattgtacagt
+aataccttagattagtattagcggcatgcgtacttggatttcacttgtaagaatgagctt
+aggacggtcgcctgtagggctgcaaataggaatacttacaatttttgatgacttgttagc
+atatcgctatcacccataaaaaacctgatacttgatgagcgggtgattgagactatgtac
+tgatataattcaatagctccaatagatgaaacagctatgcgcctatttatgtcaaataat
+cgatgtgatacaagcttagagctgaacgagcgcgagtggaattagcggtgatctctatcc
+taaaaagccacgaaatcgatcccagaagctaatacccgaggtgtcaagcttgagttcagt
+taaatttgcatctcatgccccacgaagaatgggtagagagtttgaaggtgcttctggatt
+ttcctaagtacgtggtaaaaatttgatgtaaatgaacacctcctaatggttgtgttaacc
+acaaacccctgggtgaatctgattagccaacccagtgatctgatttcagttgtcaaatct
+cttttttataactaccttttgtttccataatttaaccggatctcataatgaacaaacggg
+tagaataatggtagcacatagcgagcttgtctattcagaaatatggcctactcagaatgt
+attctccaaatcagtgttatgcgaaacgtaattttacgtgtaataatgatgatttcttat
+cggttccttgtactacaatactcttgcccaacaaatactaagcataacagcaaaattcga
+atccccctccttttaataaatggtttttcaatatagccgattcgtattcgttagtctttc
+accaactattaacctggcatctaattaataaaatcaccaaaggactctataatatgacag
+tcacttcggcctcttttaagacagttgattattgcaggtccgcaattgatggtgacatgc
+acaattagttagaatccgactatggagacaattaacaattgtagtgcccatttggtccag
+ttgacttcaaccacgagttataaaggtattttaatttatagtcgatagtaccaacaacaa
+gcacaatcataattatgttagaaaacccagggggtaatgctctaaatccagctttaaggc
+cagagtgcactatgaaatcgccattgatcattgtgtcattcgctgaacttggtgtctagg
+aggtgccgagtgagaatatcagataccttatgaagcaacgattatatctggactagatca
+tgatgatcggaataaaacattgaaataagtccttatcaaggagcataaacattttattta
+atttatacttcgtaaataaattcagaattttttttcaagacattaatctgagtaaatgac
+ggctagaaagggttcctactcgaatcgtagcctacgcatgtgggcagtaacctggcttgc
+gtttttactgaaacaaaggttcaccggaaagaaggctgccacttttagcttcttgacgat
+ctttagcgtcatatttttagattagtcgaaaaacggaaaacaaacttaacgaagctggtt
+gcacggggtaccgagaaaccaaagagcaggacaactccttgatcgggaagaactgaaata
+gacagctgtcattttcattggtcaacttatcaatataacgaccaccgtagtgacgcttgc
+atgaaaatactgaggatgtaaactatagccagtcaggcccgcgtgttgactaattgatga
+agcaaacaaaatagccggtattcgttaaaaggaacgggttgccagctacagatatactct
+aggtatatcccaaacaagagacgtcctttggctgttgtaatcggtcataatacttgtcac
+ataaacaagatcgctgaattaaacattaaacagttagtgatacacaatcgtggttggggc
+tgggatgtgcaataaaaagtcatctatcgtctatcacagagcgacgtaaatttagacaaa
+cattattatttcttgacaatggaatcgataagcgttcctctaacttggtatatatatctc
+gaccccgggattccagccattcttgtatgaagatttaaccatttaactatgcatagttga
+atggtaaggaaaatgatattgactgcaacagattttggatgcaaaaatatttgtgaatta
+ttggttatatactggttgtatagcacaatcattaggtcctagaaggcatactcaacctca
+gcgagagagctagcatgcataattgtaccgcccatattaatattcctgaaatgatttctt
+acattacgcccaatttcagtcatcgaacacccccatcaatttacccgatagagaacgtga
+tcatacgcaataccctatgcgaacgtccactctatagcgtctgtatacaatgattattcg
+ttccatttacaacgttaagtaatttaaacttacataaggacaaggaaatccgcgaacctc
+ctggaatgtatgagttatttatgcagttaacttcgtctcgaccggaactaaaggcgtcgt
+acgaatgaaaggccacttttagaagagacctttgtatccattgtggagaatatcataaat
+tcaagatggggtgtcatgctattcggtcctaaacattcttaatggctgttctattgttag
+tctgatttaaaatggaaccatagcacgaatagttagatagggctcatacccctgtaacga
+tctacaaatccttccccgggtgtgtgcgttagcgacggaaagttttacggtttgtgatca
+aagaacactcacacgtcagattattacactgatacgaattatttcagtcgacagtaattg
+aatagaaacttattaacgccagcacctgacacggtaagtaaggcaggtctgaactgtttg
+actgtaaaaaaatggtaatatttttaaaaatcttgatttctatatcaaatgatgtgtagt
+tttttctctgttattaaaatcccagtgcgcgaaatttagatcgttacgactcacgtacaa
+gatcacacatcacacgcgttagcgaaagcggaatggctaatacagccctacgcaacgtag
+tgggatcaacatatggacgaatttatgctcaatgagccaacctcccccgcattgcggttc
+attttaaggcctgggtaacatctatcgtttagataatcaaaggaatccgactatgcaatt
+gtctgacttcatccgctctcaagtccaatgcaggcgctacgtgtttctttaatcaatacc
+atattgaaatcgtaatacgataattgttgctattgactacaggttatgaaaaaacttact
+ttgcgggtacatgcatatttttgtaccacattattacgcgatatctctcagtgtactcta
+aattaaaccctcttcgaacattttagttcctattcgtaaacacgtgctacgcggcaattt
+gccggtcgtagaatggacaactccagttcaactgcatgtaactcatagctcgcgttagta
+taaattgactagtagccatgggacaaagtaactagtcagcggaaaagatccctttaaaga
+tatatgcaggttgcaagcataaagctcattgctcgaggtgcaccgtggtattccaaaagc
+gtctctatcgtatcttctaattttgggccgtgagaatcgaaactactctgatttgctgca
+cacgttaggtaatatcgcccattttcccgtataagctccgtacttatacgaactacacga
+ccttttaagcattagccgctcatatcgtgattcgtgtacagatgagtctattaaaattac
+agacatactccatatctcgctccttgaactttgaataatgcgctaacttgtactatgaat
+aggcagaacccaactttcccgtttgcgtcaagcggggaaacgatacatgttgtcagattt
+atgattatctagttttagatcacgtttaccgataatcggctgtggtctgagcagtcctac
+actgagtatttacttcagcttcatatcggtccgaaaaaaggttgtgaccgaatgtcaaaa
+tacggagtacgatgggcatcttttttcgagtcgcggttgcagggcagcaaaaggcttaaa
+ccatttttacgatttttactatagcggtcatgaagtgcgaaactgcttgcaaattttcta
+cacacattgtggctcttgtccttgaagcttatggcgaaaatttgaaacatagtataccag
+ggaaagcgcgaattatttggtgactaatagtccgtgggtttgagccatatacctaacgcc
+ataaactacgtggtgctttagatgcaatctaaacagaacagaaagcgtagcgctcatcag
+cacagactaactttttcagtttgagtcgccggagggacttcgagacaagaacgcgtcaag
+tcgcttgcgcggcacggattcgattgggcggctcaatcttgcctaatttctactattgtc
+agctgtacgactgtactaagtgtatagccccaaataaaagaagtatcgatgcgtctttat
+gaccaaaggtcttataattgaagcgcacttccgttcatcaaattaaatcctggcttaccc
+gattctccggaagtctgacctagagattgacgacggccgcgtattattgagacctcttca
+ggattaatcaataacgaagtagttgatctgtttggcgacgtaccttaagccgactccgct
+acacgagtttctactaaaccaatgtagccttatgcttagatgaataccgtcctaattaga
+tattccggcataacagcagtaaattatctgttcaatggacgaacattgaattgttagtat
+tctacacaagtcaggcctcgtaaatattaggtaaggccgtgggataacctacgtgatatg
+cttgagcttgcgttgcaagctctcgttaatcattaatttaggtgcgtgagggttaaacac
+cagcatattctatatgctagacgtcttccttaaaggatcgtagtattataattaataata
+agaaatatggttgacgtctagtcagcgggcatacgctgctctatatactggcattattca
+aaacttgacggtaaaaaaacgaattttaaggcgctcacgtcgaatgagccgaactcatgg
+gaaccaaaatgtcacagaaaacacctctttattgccaagcatgcaataaaaaaaatgtta
+atagtacgtttacgacattttattttataataaagagaaactattacacctattgatatg
+ataggacgtaaattaacgagtagcctgcatagaggcaaatgaggtttctacatggtatag
+acctgatgctgaaacatcgatgagttttggtcccctcgctcgttgaaatctagtcattta
+ctactgtctttcgagctattataccacttcactatgtggtgtttctttgctatgtatggg
+gctagtcaaacatgatgactatagctacaactcagagagcgggcgtgttaagagtatctc
+atgctagaactgcacgacgaacttgatacaaagtaacaacatttacgattccacaaggtg
+actttgaagaaacatagtttaattctctgcttcgatcatttctataaaccggtaccatcg
+cagcggatagatgcataacatttctactactccaggcatcttaaaacacacgtagtactt
+cactagattaagacacgataagtgtataacttggcagtgggaagcaaggagattggcgaa
+ctcctggcatctgttacgttttgttcaggctcggttgttgataatgtccgactcctgcca
+tattgaagactcgctcgagggagatcgggattcgttgattataagtacacgtgttccgta
+atactatgaggcagtgattcaaaatggcacttctgacttacatgactaggtattattacc
+acggaagcgttaaaggcacactcttatggacttaagattgcaagtgccttcttctagcct
+gaattcgcgggttcaacacaaactctctttagacatccgttgcctaaaggctgagacgta
+ggggcaaccctttaactatgtactaaaaaactagttggtaatttaacaacgtgtccaatc
+aagacgatgcaccaacgcggtgcgaaaatcgggttaagcaaacacaaataggaattgtga
+taaaccccaccttgagaggtcgcaagaccaacctcgggaacaacggctctaagagaataa
+cctaaatccggatgagtagactgtgtaactctctaaagggaagtgaaaaaaagctaagca
+tacatttaggtctcctgcattgcattcaattgaatcgtttgtattatgagctgtacagta
+gctatatcagctatagttatcccagaggaacaggtaaactagctctgagcgtgaaatccg
+gatattagaacccctagatgggattgattctagctaatacaggcttatctggttttacag
+ttatctagatgattggtaaggtgaaacgcttggtgccttccaccacttaaacaaaagtat
+tgcccgggaagctattttctaggtattataaagtcgagcattaatatcaatttgacagta
+aaggtctttcaccagcttcatatgccatagggcccatactcgatttaaattgaacggttt
+aacgagtattggaactctcacttataactgagtagctatacgaaaaatctggtccatttc
+cagaaatttattatcgatttgctgcttagtacccaggaagtgataacccttgaaggcaca
+acactgtaataagttttcctgtcacatctgtaatattcggtcactacgcattcacgacta
+aagataattactatactaattaaaagttcaatgttagggccgaatcatagtagaaattct
+cgtctagcctaatcggacttacctatgggctgtgaggatttatcagtatgtggacaaaaa
+tgctagagataggtatagttaaagtcaccatggtacatctatgtgaggaagtttgtagtt
+cgcttctttagtccgggcgtttgggatgacaactactatacgtagagccgtactcaggat
+tagatagtgtgaaagagtcaaataaaagggttaatattaatttaacgttgcaaatgtgtt
+taggccaaacattaaccgttgtagggatattctaatacaggccttcaccgaaccctaatg
+ataatctgtcttaataacattaaatgattgtctccgctacgagctcttagggcctcattt
+taaatgactaatgtccaaagaagagactttcccaatttcaatctgtcacgtatagacggc
+accttagtgagtcatatcattaagatagaagattatcaggagggaagtttctattatcaa
+ccgttacgcaaccataaacttttaaatctcataatggcattgagatcaagagctttcatg
+atggtaaagttcgtatgtgatgctggggagctagatatcggtataccacttcggttgtgg
+taagcccgagtgggccgttagtaatattaatagacgattatccgacaatgcattcgctga
+aataatcttacttaggagaaattaatgctatgagccaaaactatttatgtctgtcacatt
+attgactaaagtatctatcgacaaaactgatgtccataagttgtagcagatagtcggtgt
+atggtgtcaccaatgaaaacctcgagcgaaaaatgaattatagttatccaatttgagtaa
+attgcctattatacagataggcttgtttagtcagataaggttccgcttgaggtgctctaa
+cttagcgagagttagaaagcctagtgagaggcattttggtgccaaactccggctcgcatg
+agtaggccagagagtcactttctttcgtcgaagaagttggtgaacagccttttgattagt
+tgtttgtcttgtggctatgtgctactatataagttagaacgcaaactaatctaatcagca
+aagtaaaataggaccttgaacgagacggggtacgccgttgaggctcgagatagtagataa
+actagaggaatgtagataaaacattagctagggggtttagttactggattacataggaag
+tgcaccatcacggtgtgggggttcgtacgtaaagtcgcatcaatattgtcagtggactta
+acaagttcgtgcataatgaaatcctatacggactttgcatatctctaccgactcatctgg
+tcgtctatgcgggtaattgtattgctccaagtggatgactattttggcgtcccagcacat
+agtaaatgtaaatccttataatagcataagcaattattagactgcgtgaagtcttagtag
+ttctcaagctttacgttgtatgtaaataactcacgtaatcagccgtccccaaatcaccat
+tgaggtcattgaatgtacggagcactattatcaatgcggtatgcgattttctgagcgatt
+attgttaaagacttagcgttgagccccggaacacttgattacagattctttaaggagtta
+tccaaatatcattttaaataatagtagtatcgtgctttggacaataaaaaaagacccgtt
+ctcttatgttgttttgcgacgtacttctctgatatatacttcaactatgaagattctatt
+catcgataacccaggtatatttatatgcccgttcactgcgcagggcaaattatctacgga
+caataatgacgtagttggacccggtaagaactaacgcttaatatgattaaggatgtatgc
+cagtattatcttattatgtcagagtagaagtttctctgagattttccgtcgttgtggtac
+accggatttggctctctttttagaactgagaactcggagtgtgtagtcttgtttccttca
+atttatcaatatgcttttataccgccctcatcaactataacaggacgacaagttccgtct
+tgctccatcatatactaccgatacaccaatcgtatcaagtttagtatacttgctttctct
+cttctacagcttactcgcttgtccgagaagcggttggtgctcataaagttagtagtaaat
+gtacaactagtagccagtccttacctgtttttacgactactacggacaccatgagataca
+gaagttagtgctacaattataccattacatgctcaatatcgttgtcggccataagatcga
+agagtgcatcacgcgtgtgaatacgtaaaatctaccatcccgtcaatgcacaaaaacaca
+ctccccttgttgactaacatcttttacaagaggctaaatcattgtccaggatcgaatacc
+ttgtgtacaatcgtcacccatcggaagaataccacttttccgatgtagtatgatttacaa
+aaaacatctatgtgagtaggccaattgtagtagaatatattcatttgaccgtcattagcc
+ttcttcttaggttgtgtacggatagtaggtacataaaccgtcgtgtggcatacgctgcga
+tttcatacagctgccaacaccttttttaccaggctagagtcagaaaagttggagccatgt
+taaatagttaccatcataaaccactgttgtctactagtctgatcagctttcatgcctgtg
+caagcaatatggattctcacgtaatggtaacaactgttgcgttacttaggctggttaatt
+tgtcagagtaataaatacatgtcttgttgtgtttcctaatcctcggaaagtacacaagcc
+taggaataggaaaagtaaagctcttttattctgatagtgactaactcaggatctaaatac
+gcgattatactaaccttcaccaaagctcaaaaatcatctgctggtgaccagttatagaca
+gggtaattcaatatttaatgtctcccttaacatttcaccagcatggattgaagatagtat
+aaagttttacatggcagtcattgtgtcacggttctatacaaattctgatagttagacggt
+atttgaaatgtgcttctagcatggtatcttacacaactgaatgaacgactggagccgttc
+gtatactatttgcgagcctcgagaccccgtttcctaatgttaacgaatatagtataatat
+aaattgtgatatgaataacacaagtaactacagtttggacaattaattgttctaaactaa
+aaatcattcacttcagatggcatagagttatggctactacacatataaagcggtatgtga
+aacacccgttttagccggaaaccctctactgctcgggacaatgaatgatttccaaaatat
+ggatgtgcagaattgttagtgtgactcaggtccaaatagacactttagtttcgtcaagtc
+gttgcaaagtttaaaaccatcgcagcattctttatttggtctacattgagaaatgaaaaa
+acgtgacagaaagtctagaagaactgtgaataatgtctattactgattaactagtaagac
+attagtgcatctggtccactgaagcacccgcttggcgttaggcaatctctgtgaactgtc
+gtggctgttccggtaatgtacgaaagcaagcctataggttgatcgagtcgcttcattaag
+gtcaatttcacaatatccgatcacattgtgctaggttcgtcctttaccttgcttagtgct
+gcatgtacggggtgtcatgacttgttatcggcagactctttatcccaagaatggataata
+tgtacatggaaagtgtccataattaagtcccttcactgtaaagaatgactgccacgtgat
+ccatgaggtctacagaaaccgacttacttgctttttgatcaacttaattatggattcata
+aagttcagatatcggtacaattggtgtacaatatgaaattaatgaggaaacatggaaatc
+tgaatgacagtgatagaaaagatccccatttgcccggtcagttcatgttacaccactcat
+tagtactgtaagtgtttcgtcagcattgagatccacgatcatgtgtttatgccttcgaaa
+ctggatgtacgacgatcgagacgaagaggtatatataacctaaatactaggtacgttgtt
 agagagacgatgaaaattaatcgtcaatacgctggcgaacactgagggggacccaatgct
 cttctcggtctaaaaaggaatgtgtcagaaattggtcagttcaaaagtagaccggatctt
 tgcggagaacaattcacggaacgtagcgttgggaaatatcctttctaccacacatcggat
@@ -1668,4 +16332,340 @@ ggaagcgctttgtaccttacttcccttttcgttgcgtaatatgaatttcatatagtaagt
 tcaaggcactcatacctccgtgaagagggtagatagactattaaagttgtttaatagtac
 gtattgatggaaatgacccgtaggagatttaccactcaatccacaagattcgctgctgtg
 cattatcaaaacagtgcatgtcgaaacatgggttgggtccttcaaacacgaatccaggta
-gagatacctttgcaattttt
+gagatacctttgcaatttttcgatgaaggcgaccgagataaatgagctataacactgtat
+gtcttttgattgctataaaacacagaaacggatattaatttaggccgtaaccaacatctg
+ttatttgacatagaacagatggtcctttacagcgtattccggccttaatattgaggtcca
+gtgtattgtcctcctttaaagaagttgattgtaactgacttaaataagacatgtcaccca
+ttcactgggttgcaactgctggccctttttgtccatcgcacgctaatgtgataacagtac
+cgccctcacacctgcgtttaaaagacataaatgtcgctatgaaggttattcattaatttt
+agctgttttcttagaaaaggtaaatttaaaattgaaaaggctagaaaactaaagttacga
+caaatgtgtttgtcaagtaggcgggcatcattgagattgtaagaaataaagccataacca
+gccccggaatagaaaatgttaaggaaaggcgatcttctttgaattcttattgtcaagtgc
+agtcatacgttcttatcagaggacattgcaataaaatctaacaccctcccttgtgtggtt
+gggccatttgtacttcgaagcgtccaccatgtgcagaggataacggaatgtggttccgtc
+ccataaacgatcattctcgcccacttagtggcgcggtaaatcgctctcatagaggtaact
+ggcctgtaatgtccaatgttaggctaccttctccaactttagtacaacgaataatgtccg
+attaacaaggagtcaatttgtcatgaccagttcattcaggtacttgtatctatacggacg
+cgttccagagtagtatttgaaattttgaggttctactgataagtttagctatcgctgtat
+gtctgaataagaatttaatgtttatcttcgataaataacaattaacaactcctaggtgat
+acactgtgaagtctgctgttccccaaattacatatgctattttgttcacataccatgaag
+ttaagctaagtgctctataatggcataaacggttatcaaactagctcgaatttcttttat
+tacgccggaagcggattaactgctgtagatcaaacacgttaggatagtgtcgttttcata
+tatatctaaattcggtctaacatgcattacccatgcttgataacgtagcacttcgcagtc
+taattatgtaatgtccgtttaaccaaactttaaaaaagtttatctatcaccagtgatgcc
+tcatcgtgactacccggatctttagcctttagggtctaaacagaactaatattactacgt
+gtcatactccggagcttaaccaggtgaaacttatttgttaaccaaatttagtgacagggt
+agaaatacgtatcaaattaacccagcaatacaataagcatgaaaataattgtaatcgggt
+ttgggccggaatcccgcttggcgaaaacttaatgacatagtgtgatgcattttgcactgg
+attgagccacaaactcaactagcattatgctcaatatttggccagtgttctacggtttga
+aatttataaaggccgcgcaaaagtcttgtagttacaaacgcataaatctcgaacgtaata
+ggtttaattagaacatccgtaggatttctgtttatagtagatttatactaaatgttctga
+ttagattctgacggccttacccatacaattaataaagacgaatatattagttatagttta
+ctatccaaataaattaagcgaatcgaaataaactgtcacgatactgggcagttatcaact
+tatcacttatacagttcggacactctatattggtctgtgagtactctatcaaactaactc
+ataagttaactgcgcttccattaaatttcaatacgttcttgtgctgtgtacaaacctata
+atcgaataaatgacacatatggagatgcataataaaaaaaacggctccatatttctcgtt
+aatcgggcattcttaaggaggagcatctcaccaaaaataacgttcctgataagtcttaac
+tattagaccgtcttcgggaatgaacgaaacctcaagctagcatggtatagttcttgatag
+cgcgtaaattctgataatactgggcggacagctggaaattagttgccagtgcacctacgc
+aaatagtttacataaatcaacgggctccgaacgtaaatacaaagggttagttacatcgca
+acaagatgaaaagcatgtatgtctaccgtcatccgtccctaacaaacataaaggtggtga
+agaatctcgtaggtcaactataactccatccttgaagcaactactccgcgtccgtgtgcg
+tagttcgcaacgagaacactactgaaaaaagctaaacaactctcggtacaaatgcggctt
+gtgtcgataaagttggtggtagtgcacggaataacataacaaggaatattatttattcaa
+attttttgtgactgttatttgttttctgcctagaatgtaaggatgtgttttttgtgacct
+gatagttacgcttatttcaggtccacggtgcgtgagagtgtgtcctataacggcagggga
+gcgaagtagtgtcctttagactattcaaggtagaattttgataacgctctataaaaggta
+gaaaatcatgattgagcaataagaccccaacttatcaaaaaaggagttctcgacagcgcg
+tgtacagtccctataacggctgtatttcctgtgtcacaacaccctcccatcgcactcaaa
+atgtagatttatgatcagacgctaacttgttcttagagaaaaatacacgggatactctgt
+gcaacgatttcattaataaggtgcagcttgggacttttttggccgtaggctttattaaca
+ttcacagtaggtagcgagacttcctatgaaccaatcatgccacgcgttttaacgtttcaa
+atataagctaggaagcgtttgccaggacttctataatgcaccgttttttttagtacttcc
+ttactagccttagtttatgttagagtctttccaattacaaaggattgaatagccaaaatt
+tctacaattctcagcgaacgccagcttaatctaaacacgagcttcaaatattctacatat
+cggcaggagtcaatatataaatatgaaaatcgtaccatcctcgtacttttagaccaaacg
+tcttcggataattaaatcctttttcaattaccacagtacgtgcattagaactactgctat
+gaaagtaaaccttgaaatatagtcctcaagagcgtatccaagtacattgcacgtgtatac
+agtcgtataaacgagttgatgttctgacgctagagcttaccattcgttaaacagataact
+aaaatttaatggctgagtgacttagtgttttcgacaaacgtcgcggatgtagactattgt
+ttataagcaatttttaaaaacatatgttcaaaacggtatgggatatgtcgaattccacag
+gggtttatgtaccatagaagtatgtataaggtactaaaggtttaaatctgtgatattcgg
+ttcggtgaaaatcagactagtcacacttagtgtctgtaaattagattgggtgaaggtaag
+cgatcccgaactctacaaggcatgggatgagattctaccgactccggataacactttacg
+atcgcgcataactctagctcttagataagtttaacttgtcgatctcataaacagttcaaa
+atctgcgatttattgtatcaaatccatcctctatcttctataatcatctgaaccgcgata
+cggcactatgagccaagtgaagattgaatccaagaaagctataattggtttattttagtc
+catttaaattaagtccggtataagtgctctgtacaatatgcagtctcatgggcatatacg
+ttaactaccttttgatacttcgaattggtaaaatatcgactatcgatttgcagtaaaagg
+tgtagagtccaattactctttcctgttacatacgatctcttagtttggacaactagccca
+tgatggcgctcctctagcgcatgaacctactttataattacatctttatcgatgaatttt
+tttagactgcggaggccttgagttttaacagggctgctaaatttcttaagcgattagacg
+gtagcgtcgtacgctacttgcttggaacaggcaccgaaaatattgatctactattgcgtc
+aactctattctgctaatagcgatggcaaatcacagaagccctcttagtgacaatagttgt
+caactatatctaagtcgacctttactgtatcaacgatcacggagagaattaccgaatacg
+aaacctcaggactaaaaaacggaaaggatttgtcgacggtaaatataatacttgttaagg
+gtagcgacacaggtatactttgggtgtaaacgtggtgcttcccggaacgattttcagacc
+agaaaattgttccggtaaccaggaaatctcgtctgcgttaattcgtgttagtaaacttga
+tcttcagactccttcttttcgttgcagcgagacttaaattatatctgcgaaatagtgccc
+cgtgcatacttcagatggtaggagataccatttggcccattgtgactttacgcgattaat
+taaccgacatacatctgttcctgagctatgatcgtctgaataaattacggtctcctcttg
+atacctaatggtttctggagacgtttctcatgttcaaatggatagcaggagatcgcttca
+tcaagtttagctacgcagagcatcaaaatatgtatgggaaagtcgatttccaaaccagaa
+gggataaagagaaataacggacttctccgtagattagcctgatattttgatgggaatcat
+ggcggcacatacgtaagagttgcgtgaacgaatattttggacggcgggagacacatatcg
+gccattcgttaaggtctctatattggacatcacaagcttagcagtatgagctactaacac
+tcaagacattattgattttttcaagatatgtttcattcctctaccgctattcccatacgt
+tcgattcgccgggtgagcgaaaccacgggactgaggttaagctaatcaataacaactcgt
+tgcgatagagacctatgtatactagagagaattccccaacatttttacaaaaacaaagca
+gactaaaatagatacagtccctccatacaattaggaccaacatgttattgccgatcctag
+cacacacaccacaaactcagaacttctgtcttacctatgaaagggtctgcacttctgatt
+gtacgtgtctaattagcattaatattaaaactaattaggataaactataggtacgagctt
+tactataagtcactaggtgttttccgatcgaaaaacgggaccttcaagccttggtaagta
+catttaggataaagaaaaaaaggaaggtacgtgactaatctgtctaaactgacaatagag
+tagtacctacatgcttcatgtcaagtcttaatacgcaagcgctctcgttatactgctcaa
+caaaactcataaagttggactccatcatttagaatcatagggaccaaaacatttatttgc
+tactgtcactttgtaggtgttctattctgaattcctcatattgatacatgaatcggaata
+cctgtggatcccttaggacgcacgtgctttctttacgtcagaatacatattgtcagaatc
+gagaagttccatgcaattaagaattcgcctctttgaaaactcatatccccacatataggg
+tccaccgttattcggaaacgatataataattattccagcgttgagcgtcccttaagagcg
+cattttcgcttggcctttcttctacgactctacaacgcaagtggctgtgtggagtttacc
+acagcgcagcaccccatagaactacctctgagagcgcgagatggtggcagtatgctctgc
+agctagcgtttagaacgcgcccgcgcattaaccagtcatattaaaatggactgtcttaat
+tgtcggcattaggagcaatattaactgatgagggtatcggtcgcagaagtaatgacggaa
+atacgcctctagtccgcagagatacgattacagactcagatcccctaacaagcaaaacga
+ttaaatcggaatcactccccctatgacatatttgaaatacacaagaaaccacgcaacatg
+tcccgcattctcaaccgcgctttataagatgttgagtctgagaattagatgacctaactg
+caagaatcatggcgagtttatctagtaggcaagtctgtaccctagggttcgaacgctgtg
+acgtcgtgatcggtctaaggacttagatgataaccaagaactggtttaccgagtactttc
+actattaggagtaattacatgcgttcaccgcggaatacgacgaaattttttcatatcttt
+atgagcgagatcgtgtcgtctttgcattgcaacagtcgctaccagtaattgctgatcaat
+tatagattcattatacagatgcttacttttctctattcaatactgtcatgagttgttttt
+aaataagcaccagaattatgtcgcctagtataatcttgcttccacttgaatcaatgcgat
+ggacagtattctactgattgcaaagtagtctatttcggcttagcagtacgcatgcctatt
+tttttgcaggcacagaataatatgcaactaggattctcggcatccaattaacaggctaaa
+acaccaccgaaagacaggtaatctacgaagttgatgtttactacagaaagcgaatgatat
+cacttggagaacattttagatgcccccttttaatctagactgagtgtaccaatatatcac
+cggtctaccgaatcagcttgaataaaccactctagtactcatgataaccgagcatacaca
+tgtatttctcaatgcactgaaggtgaactgtttacaccataccttgcgaatcaacgtggc
+gacttatacttctgtctttgagtacagcacaccctaatgaatctaagttagttgttgata
+cgaattgtaatttgactggatctcgcctcctcatctagattcttagagaagatgtttctt
+atagccggtactgtaactttattgatctggtttatggtaatcaacattttacctctattt
+aaacgtccttgcgccgtgcactcaatcctgatcggtttagattcaagcgattatcgagtc
+tggaggccgagaaaagaaatgcacagagtaagctctctattgcgacatctacgtagaaac
+tcgcatttcagatcgagtaagcaactctcattgtgttgattcagtaatacaagattacct
+acgcttctacgaaatatactatagatttagcctacgtcacctttagtgtcgagtcggagc
+tttgaagatcggatgcggtgtggactgtgtataggcaattttgctgcgagctcgtgactt
+ttggttgatgtcgatatcaatgggatacctcaaacgtctttatctctggataactcacat
+tgagtataccggtaaaaatttattctattcatctaaatagtcagtgagggctagggtcgc
+aatcacattaggccacatacacatacttaacatgttctattgacccgacccaactttagt
+agcattgtagccgtttatgcaaatatgccaggcgccaaacactagccagagggcattttg
+ttacatttatttaatcgattattacacagtcggaacacgcctacatgcgttcgacttatt
+tgcgacatggtcaacaattcagtaatttaatccaaaacctaaagtcagagacatgacact
+aaaatcacattaaggtcagttagtgaaggaatggctaaccagctagagaatgcatcatta
+acaggcacttattgtcaaatattttccagatctaagcaacatcacgttaaaaagtacaac
+aatcacttaaaacacatcagtccaggtgtaattagaaagccgcttagtaggcaagcgtag
+gagtataaatgtagacaatagtcgggacttagcagacactggatgcagtcatagaagatc
+ttgcataacacgttagggttagagctacgaacgcccatcattaactgcctaaagcgtgcg
+tgagcttagcgctaacttttccaacacgtttgtgatttcgttcataatgtatcaatttca
+cagtcatatacagggagtgtagaaaaatcgcaattaacatacgttgacctatttttgttc
+agagttcagttagagcctaatgattcgagagcaataatcaggacagcctcataggaagtg
+tcaatcacttagaagctatattattataaatcgctctttactgtcgtcgaaggaacgagc
+gagagagaatcagttgcctgcaactggcttaacaatatgatacataaaaatattttcatc
+accactaagacggtggaattcagacttattggcaacttaggatgggactattaaataacc
+cataagatgttgggataaagttacgaaacgaaagggatatagcctgttagataggaaatc
+cccaataaaacatagccggcctccacagcagtgatctattccgccacgcgatatctttat
+accacgcaatataccaataataaaggttaaatgtggttgcgatttaaaaaagatacatat
+cagttgcaccgcgtagcaaatccgtatgtgaagcgtaacctagaattatagcgtctgcaa
+gttctctaagcttcctctgcaagatacaatatgactttttagcttttttactaccaaatc
+tcagaatcttagaaacaggttggtacgtgctactcggaattcccaaagtaccctgctata
+tatgccattccttcattggtccgggctcaccatggggccatcatagtaatagaaggtagt
+aaaactagttgatttccgacttttaacaatcactatcctgacccagatatgggttccgac
+tggcccttactccagtaagggcagacacacagacaacgagaacttgataactttgaattc
+tcaaatcgatcattgcaacgtgacttatttactagcctactcctataattcatacgtcaa
+atacatttcaacggaggaagataataagtaaatattcactaaataatggtcgaaggagtc
+ctttgccaacataagtccacatatgcgctatagattttttcttggggttcatattcaata
+agataaacagcaagagtatcacgtcagcgagtcattgagatcttggctagcattgtgata
+gcatattctacctaaatggtagtctagcacagagtggataagatatcagttagatataga
+caagtactataacagatctcgcttcgttggattgtatggctagctttgatgatatgattt
+tataaaaattgatccagacctgacctggccaattatattcattttttatgagtaaaaata
+gataaccatgaaaatactcaagccccttaggacgtacaaagtggtaacataaatttcagg
+tgttattctgcaaccacacctgttttgggttttcaaaaaggctaagcagattggttttac
+agataatccctgaacactggtatctcccaacgatgtcgttcccaacccttgctgaccttt
+taagctctgctgaagttttgtaaactaggcggaaaatatgttcgatagatccactcgcct
+gaggtagaaattcgtcttagtaacgcctctttggattacacagaatagtgtactgacacg
+tacactgctgcagcagccatacgctaacattaaaattcgttgagtctacatttgttgtta
+ttcggattatgttattgggaatagtatttttattcccctgcgtgaaaccacatggataga
+ttagcctactcctaaagactcccttttggtctacggttcaattctcttactgagtttatg
+ttcgtaattatatcggcgcagtgaatctcctaattatcaccggagttaccagacgccatg
+aacttatggccagaaacattgcatgtggcctacataggattagtatcaagagtttacgtt
+tgcaacgacatttgaccaacttgaccattcctgcttgtagaccgcgggaactcccctgca
+cgcgactatagaagttggtggtggatgtggcttatgccgcaaatatggttttgaaaaaag
+taatctattgcttgatacctgaattgagacatgtataagggctattgccagatgaaaaac
+tgcatataaggtcaaacaatataagaacattatacataggatcttagcgttcctcaggat
+ggtatacgctataaagtctagcttcagcagctaaggagttttgccagtgcggacttccgc
+tggaagattaggtttaaccgccctgacatcttcataaggtcgggcctgattcaaacccct
+ggagtgccgtctcatacttgaattaatcgatggaaaacttcttctagtctaatattatta
+ttaacaaatgacggttcaataaataacaccgtaagggtgggaaactgttaagtgatgaat
+cattttaacctatcatccattagctacagataatgataccccgatccgactagggggtaa
+gtggttgttccgttaggataaaccatgtaaaacgttagagggtttgtagattaattggta
+ttccagataaatgaggtcagggcgagtgatcaattacactgaaaaattgtcagcttgcgc
+ggtagttgttaagacagtataaatgaaggggattcagaagcaagtttctcgattgactga
+atttataaaccagtcgtcaatcatgatttttgtgtcgattaaagcctaaatggtaattta
+aaccattgatatttatcgagtctataaatatctttggttgtatattacttcacaatcacc
+aattctaaatgattcttccactgtgcgggtggagatatcaggacgggttaaggttgacct
+acatcgttttgatacaacaaaaatcaaagcacatggctggggacttctcgatactatctt
+tgagatagtacgggcaagagtgggtgacgcctccctacattttcaagtctatcggataac
+ttctcggtaaaacgctcgcgatatagttttaaagcattgatttaatccacgcaggagcaa
+gttttaccggtcgaatgagaaaattcaacgtaagtgtcatatccagtcatggttagccaa
+aagcatgggttatccaaaaggaataaaacagctcttcaacaaagagatgaggcttcataa
+cttcgatgaatgcgtatggttctgatatatagatcgatgcatgaggacactttattttag
+ccggcgaattaatggaatccatacgttacttatttggacatgacttctaggtgtttttgc
+tgtcccgtttagcgatatttacagattagtatttcgtttctcatagttaattgtatctag
+atactaactcgttgaagacgcataccttgccatttgtacaggacttaactgttccgtgcg
+taatttgaatttcttataggttcttcaaggcacgaatacctcactcatgaccgttcatac
+tctagttaaggtcgggaatactacgtatgcagggaattgtaacctaggagatttacaact
+ctttaaacaagagtcgctgaggtccaggatcaaaacactgaatctcctaacttcgggtgc
+ctccgtaaatcacctagaaacctactcatacatttgcaattttgagatgtaggcgaaaga
+gagaaatctgctttttaacggtatctcttgggattccttttaaaaacacataacgatagt
+aatgtaccaagtaaccaaaagctgggatgtgtctgtgtactgatccgccgtgtcagagta
+gtccgccatgaatattgacgtcaaggctagtgtcatcaggtattgatgttcattgtaaat
+gaaggaatgaactaatgtcaccaagtaaagggggtgaaaatgctccccagggttctacag
+acatagagatggtcagaacacgacccccctctcaacgcagtgtatttgaaatatatggac
+atatctaccttattctgtaattttagatgtgttctgtgtataccgatattgataagtcaa
+taggcttgattacgtatcttaagacaaatctgtttcgcaagtaggaccgcatctttcaga
+ttgtttctttttatgccataacctgcccaggaattcaaaaggttatcgatacccgatatg
+ctgtgaattattattctaatggccactcattcctgcttatatctggaattggcatgaata
+tcttacaacctaaagtctggcgttgcgccagttctacttcgtaccggacaccatctccag
+tcgttaaccgaaggtgggtacgtcacataaaagttcattagaccacactttgtgccgacg
+tatatagatatattacacgtatagggaatgttttctcctaggtgacccgaccttctacta
+aggttgtacatcgtataatggcccattaactacgaggaaagtggtattgacctggtaatg
+cacgttcttcgatatataccgacgaggtaaagtctactattgcaaagtttgacgttatac
+tgataagtttagatttccctggatcgcgcatgaacaatgtatgcgttatctgccatatat
+aacatgttacaaatccttggggatactatcgctactatcatcggaccaaaattaaatagg
+ctagtgtcttatcagaacatcatgtttaccgaactgatctattttccaatttaagctgat
+attacgtccgcgtatttattttagttccccggatgacgattatctgagctacatcataca
+agttagcatactcgccggtgcattgatttcttatttcgctatatcttcaagttcacaggc
+ttcatatagttccaattagcagtataattaggttttgtaactttaaccatactttataaa
+aggttatattgcacaactgatcaagcatccgctataacccgagctttaccagttagcggc
+taataacaaataagatgacttcgtgtcatacgaccgtcatgatcatgctctaacttaggt
+gggaaccaaatttaggcaatgggtagtaataagtataaaatgataccacatatactataa
+caatgaaattatttgtaatccggtttgccaacgtatcccccttcgcgataaattaatgac
+atagggtcatccatgtgccaatcgtgtgtgccaaaatctcaaattcaattatcatcaata
+ttggccaagtgttataagcgttgaaagtgatataggccgccaaaaagtagtctacttaaa
+aaccaatatttatcgttcgttattgctggtagtacaacatcacgagcatttctcttttga
+gttgatttatactatatctgctgatgtgattatgtcccacttacccagaatattaagaaa
+gtcctagattgtaggtatacttgactataaatataatttaagactatacaaataatctgg
+ctacattatgccatcgtagaaactgataacgtagtaacgtcggacactagattttggtcg
+gggagtaatctagcatactaacgaatttgttaaatccgctgaaagtatatgtcattacct
+gcttggcctgtcttcaatacgtttagactattaaggactcatttcgagatccagtattaa
+ttatacgcatccatatttatactgaagacggattgagttaggacgacaagctaaacaaat
+attaagttaaggattagtattatattgtagaaactcgtcgggttggaacgattcatcatc
+atagaatgcgttacttattcagagagacttaattcggttatgactggcagctcacctgga
+aagtaggtgaaaggcaacagaagaatattgttgactgaattctacgggctacgaacgtaa
+ttacaaagcggttcgtaaagagcataaagatcaatacaatggatctctacagtattacgt
+aaataacatacataaacctggtgttgattcgactagctcatagattaatcattaattgaa
+gctacgaagacgcggaagtctgcggagtgagcaaacagtaatcgactgataaatgcttat
+aatatcgcgcttaaatgccgcatggtgtacattaacgtgggggtagtcaaaggaatatat
+ttactaggaatattagttatgcaaatgttgtgtcaatgtgatgtgttttatccagacatt
+ggatgcatggctgtgggggcacaggatacttaccattagttcacctacaagcggcgtgag
+agggtctcagttttagccagcgcagagaagtacgggcctttagacgattaatgctagaat
+tgtcataaacctcgtgaaaagctagttaataatcatggtgctagaagaacacaacttttc
+tataaaccagttctcgactgacagtcgtaactcactatatcgccgctttgtactgtcgca
+aaaaaacctcacatagaaagaaaaatctactgggtgcatcagtagagatcgtgttctgag
+agataaatacaccggatacgatctgcatcgagttcatgtattaggtcaagcttgggactg
+ttgtgccagtagcattttttaacagtcaaagtagggtgagacacgtcatatcataatata
+tgccatcgaggtttaaagtttatatgataagctagcatgcgttgcaatcgtattcttgaa
+tgctccgtggtttgtactaattcctttatagactgagtgtatcgtacactcggtacaatt
+acaaaggatggaagagcaaataggtcttcaattataacagtaccccaccttaatctaaaa
+accagcttcaattagtattaatttcgccaggagtatatatataaatatctaaagactaaa
+agactcgtacttttacaacttacgtcgtagcataattaaatcatgggtaaatgtcatcag
+taagtgcattagaaatactcctttgtaaggatacagtgaatgtgtctcagcaagtcagta
+gaaatggaaattcatactcgattaaggcctataaaactgttgttggtatctacagagtga
+ttaaaattagtgaatcagattacgaaaatgttttcccgctcgcacttacgcgtttagaca
+aaagtacaggtggtacaattggctgtagtagaattttggtataaaataggtgataaaccg
+gatgggtgtgggcgaattcaaaagcggtttttgttccatagaactatgtagttggttata
+aaggttgtaatctcggagattaggttagggcttaatcagaatagtaacaatttctctatg
+taaagtacagtgggtgatcgtatgagttcacgaactcttaatgccatgcctggacaggat
+aaacaatacgcatataacttgacgatcgagcttatatcgacctatttgagaagtttaacg
+ggtcgatataatatacaggtcttaatagccgattttttctagaaaagcaatcctatatct
+tagttaatcagatcaaccccgtgaacgatatatcagcaaactgaacattgtatacaacat
+tcctttttgtccgggtggggactccatttaaagtatctcacctagaactcagcggtaata
+gatgcagtctcttgcccagttacggtaactaaatgttgatacttagaattgctaaatttt
+agtctagacatttccaggtaaaccggtagacgacaatttctctgtcatctgtcataagat
+cgcttagtgtgctcaaattgcaattgagggccctactatagacaatcatcagacttttta
+attaaatagttttccatgaatgtgttgtcaaggcggaccccttcacttttatcacggctc
+ataaatgtcgtatgactgtagtcggtagcggccttcgagtcttcaggggaaatggaaaag
+aaattaggcttctaagatggactataatcgattaggctaattccgttcgcaaatcacaga
+agcaatcttactcaaaattgttggaatcgatagcgaacgcgaccgtgaatgtttaaaagt
+gctcgcacagaattacccaatacctatcatcacgacttaaatacccaaagcagttgtagt
+cgcgtaatagattaagtctgaagcctagagacaaagggatactgggcggggaaacctgct
+ccttcacggtaacatggtaacaacagaatttggttaaggttaaaacgaaatatactcgga
+gtgaattactgttaggtttcgtcatcggatcaataagtagtttccgtgaagacactctta
+tattagatctccgaaattctgacccgtgcattaggcacttggtaggagattccatttgga
+acttgctcaatgtaagccagtaatgttccgaaataattcgctgcaggagcgaggagccgc
+tgaataaaggaccctcgcatcttgttaccttatggttgagggtcaccgttctctgcgtca
+attccagagctggagatacattcatcaacgttacctacgcacagaataaaaagatcgagc
+gctaactcgttttcctaaacacaacggatttagacaaattaccgaatgcgccggagagta
+gcatcttagtgtcatgcctatcatggcggctcagtacgaagagttcaggcatcgaatatt
+gtggtagcccgcactcaaagttccgccattaggtaagctatatattgtggtcagaacttg
+aggacaactatgagctactaaaaataaacaattttgtcatttgttctagatatgtggcat
+tcatcgaacgcttgtaccagaagttacattcgcagcgtgagcgaataaacccgaatgagc
+gtaacattatcaataacatatagttcagatagagaacgaggtattcgacagagaattacc
+caacattggttattaatctatgcagaataatttagataatgtcactacataatattagga
+ccaaaaggtgattccccagaagacaaaacaataaacaatctcacatattcgctagtacct
+atgtatgggtatgatcttctgattggacggggataatttccaggtatattaaaacttatt
+accataatctagacctaagagaggttatataagtaaagagctgtgttccgatagaaaaac
+ccgaccttaaagacttgcgaagtaaattttgctttaacaaaaaaacctacgtaagggaat
+attctgtataaactgaaaagtcaggtgtaactacatgagtcatgtcttcgattaattaca
+atgcgatctcgttattctgatcaactaatatcataaactgccactacatcttgtacaatc
+attcgcaacaatacttttatgtgctaaggtcacgtgcttcctctgctatgctgatttaat
+cagattcataaaggaatacgaataactctggatccattaccacgcaagggatttatttac
+ggctgattactttttggctgttgacagaactgccatgaaagtaagatgtcgcatcttgca
+taaataatagcacctaatatagccgacaaagtgattccgataacagattttaagttgtcc
+agccttgagactccatgaagaccgcttgggagcttccccgtgattagaagaatctaaatc
+ccaagtggatggggggagtttaaatctcagcaccaacaaatagtacttcctctcagagcg
+cgtcatggtcgaaggagcctatcctgatagaggtttgaaagcgcacgcgcatttaactgt
+catattaaattggaatctcgtaagtgtcggcagtacgacaaattttaactgatgtcggta
+tacggagaagaaggaagcacgcattgaagcagctacgcagaactgagaagatgacactct
+aagatacaattaatacaaaaacgttttaagcccaatctatcaacagatgtaagatgtcta
+atacacaagaataaaaccttcatgtcccgatgtataataacagctttatttctgctggtc
+gaggtgaagtagtggaaattactccatcttgctgcgcgtctttatagtgttggctactct
+gtaaccgacgcgtccatccctctctcctagtgatccgtatatccaattagaggataacca
+acatctgcgttaccgacgaatttaaatttttcgactatttaattccgttcaaacccgtat
+tcgtagtaagtgtttcatagatttatgaccgacatcgtgtacgagttgcagtgcatatgt
+agataccactaattgctgatctaggatacatgctttataaacatgcttacttggctattt
+tatttactgtcatgtgggggtttttattttcaacaagtatgtgctaccattggataatct
+ggcttcaaattgaagatatgcgttccaaacttgtctactgtttgctaagtaggagttgtc
+ccattagaactacgcagcacgtggtttgtgatcgaaaagaataattggcaaatacgaggc
+tagccttcaaatttaatgcagattactcctcagaaacacacgtaagcgacgaacgtgatg
+tttactacacaatgcgtatcatagaaattcgtgataatttttgttccaacctttgaatct
+agactgagtggaaaaagatttcaccgggataccgtttatgctggttttaaaaactcgtcg
+aatcatcttataactgcattcaaatggatttctcaatcatctgtacgtcaactgttttaa
+caataacgtcagaataaaccggcacaatgagacggcggtctttcactacaccacaccctt
+aggattataagtgacgtgtggattcgaattctaaggtgacgggatctacaagcctcagct
+acattaggtctgaagatctttcgtatagccgcgtatgttactgtttggatatgggttatg
+ctaatcaacagttgacagcgagtgaaacggccttgcgacctgaaatctttacggttacct
+tttgattcaagacaggatcgacgatggaccacgtgaaatgaattcaaaactgtaacatcg
+cttgtgcctcagcgaccgagtaacgacaagttcacatcctctatgcaactatcattgtgg
+tcattaaggtattcaagattaactaagagtcgaccatatattctagagttttacaattag
+gaaccgttagtctagactaggagcgtgcaacatcgcaggaggtgtggactgtcttgaccc
+aagttgcctgacacatagtgtcttttgcttcatgtccttagcaatgcgatacctcaatcg
+tagttttatcgggataaataacatggtgtttaaccctattaatggtttctattaatctaa
+attgtaaggcagcccttgggtcgaaagcacattaggccacatacacagtatgaaattgtt
+cgagtgtccagaccataattgactaccatggtacacggtgttgctattatgactcccgca
+aaactcttgacagagggaattttggtacattgatgtaatcgatgatttaacagtaggaac
+tagacgtcatccgttagactgagttccgacatgctcaaattgtcaggatttttatccaat
+aactaatggctctcacatgtaaataaaatcacattaacgtcacttagtgatggattcgct
+aaacagatagactatcattcatgaactggcactgtttcgattatatttgcaacatcgaac
+atacttaaagttaaatacgacatcattcaattaaaaaaattcagtacacctctaatgagt
+atcccgctttggaggaaagagtagcactttaaatggacaatttaggccggactttcctgt
+aaatggatgaagtcattgtacagcttgaataaatcgttagggttagtccttacatccacc
+atatgttaatgaataaagcctgagggaccttagagctaacttgtccaacacgttgctcat
+ttacttaataaggttgaaatgtatcagtaagtgacagcgagtgtagattttgaccattta
+actgaccttcacagttttgtcttcagacgtcacttacaccataatgatgacagagcttgt
+agatgcacacactcattcctagtgtaaatcaagtagtagctagattattataaagagata
+ttttctggcgtcgaacgtaacacagagagagtataaggggcatgataatggcttatcaat
+atgtgtaagaaaaagtttttaatatcatctaactcggtggaatgcacacttatggccaac
+tgaccttgggacgagttaagataccataagaggttgcctgtaagttaagataacaaaggg
+atattccatctttgtgtgct
index 70fa1bb061b367cac6f1a825ef3a5efc546819fc..a161635ffe4361974f65a6165ece81fd25a57d42 100644 (file)
@@ -1,15 +1,12 @@
-USING: kernel locals io io.files splitting strings io.encodings.ascii
-       hashtables sequences assocs math namespaces prettyprint
-       math.parser combinators arrays sorting unicode.case ;
-
+! Copyright (C) 2008, 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: ascii kernel io io.files splitting strings
+io.encodings.ascii hashtables sequences assocs math
+math.statistics namespaces math.parser combinators arrays
+sorting formatting grouping fry ;
 IN: benchmark.knucleotide
 
-: float>string ( float places -- string )
-    swap >float number>string
-    "." split1 rot
-    over length over <
-    [ CHAR: 0 pad-tail ] 
-    [ head ] if "." glue ;
+CONSTANT: knucleotide-in "vocab:benchmark/knucleotide/knucleotide-input.txt"
 
 : discard-lines ( -- )
     readln
@@ -20,40 +17,28 @@ IN: benchmark.knucleotide
     ">" read-until drop
     CHAR: \n swap remove >upper ;
 
-: tally ( x exemplar -- b )
-    clone [ [ inc-at ] curry each ] keep ;
-
-: small-groups ( x n -- b )
-    swap
-    [ length swap - 1 + iota ] 2keep
-    [ [ over + ] dip subseq ] 2curry map ;
-
 : handle-table ( inputs n -- )
-    small-groups
-    [ length ] keep
-    H{ } tally >alist
-    sort-values reverse
-    [
-      dup first write bl
-      second 100 * over / 3 float>string print
-    ] each
-    drop ;
+    <clumps>
+    [ histogram >alist sort-values reverse ] [ length ] bi
+    '[
+        [ first write bl ]
+        [ second 100 * _ /f "%.3f" printf nl ] bi
+    ] each ;
 
-:: handle-n ( inputs x -- )
-    inputs x length small-groups :> groups
-    groups H{ } tally :> b
-    x b at [ 0 ] unless*
-    number>string 8 CHAR: \s pad-tail write ;
+: handle-n ( input x -- )
+    [ nip ] [ length <clumps> histogram ] 2bi at 0 or "%d\t" printf ;
 
 : process-input ( input -- )
-    dup 1 handle-table nl
-    dup 2 handle-table nl
-    { "GGT" "GGTA" "GGTATT" "GGTATTTTAATT" "GGTATTTTAATTTATAGT" }
-    [ [ dupd handle-n ] keep print ] each
-    drop ;
+    [ 1 handle-table nl ]
+    [ 2 handle-table nl ]
+    [
+        { "GGT" "GGTA" "GGTATT" "GGTATTTTAATT" "GGTATTTTAATTTATAGT" }
+        [ [ handle-n ] keep print ] with each
+    ]
+    tri ;
 
 : knucleotide ( -- )
-    "resource:extra/benchmark/knucleotide/knucleotide-input.txt"
+    knucleotide-in
     ascii [ read-input ] with-file-reader
     process-input ;
 
diff --git a/extra/benchmark/nbody-simd/deploy.factor b/extra/benchmark/nbody-simd/deploy.factor
new file mode 100644 (file)
index 0000000..6055077
--- /dev/null
@@ -0,0 +1,15 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-ui? f }
+    { deploy-word-defs? f }
+    { deploy-threads? t }
+    { deploy-math? t }
+    { deploy-io 2 }
+    { deploy-reflection 1 }
+    { deploy-unicode? f }
+    { "stop-after-last-window?" t }
+    { deploy-console? t }
+    { deploy-word-props? f }
+    { deploy-c-types? f }
+    { deploy-name "benchmark.nbody-simd" }
+}
index 37fb1d0ce3a5b2fefb9c75d020d17b6f117dd916..ee290b144dadd0ceacbe3181e9c35bdf078b9b92 100644 (file)
@@ -1,9 +1,9 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types fry kernel locals math
 math.constants math.functions math.vectors math.vectors.simd
-math.vectors.simd.cords prettyprint combinators.smart sequences
-hints classes.struct specialized-arrays ;
+math.vectors.simd.cords math.parser combinators.smart sequences
+hints classes.struct specialized-arrays io ;
 IN: benchmark.nbody-simd
 
 : solar-mass ( -- x ) 4 pi sq * ; inline
@@ -58,7 +58,7 @@ SPECIALIZED-ARRAY: body
     body-array{ } output>sequence
     dup init-bodies ; inline
 
-:: each-pair ( bodies pair-quot: ( other-body body -- ) each-quot: ( body -- ) -- )
+:: each-pair ( ... bodies pair-quot: ( ... other-body body -- ... ) each-quot: ( ... body -- ... ) -- )
     bodies [| body i |
         body each-quot call
         bodies i 1 + tail-slice [
@@ -94,7 +94,9 @@ SPECIALIZED-ARRAY: body
 : nbody ( n -- )
     >fixnum
     <nbody-system>
-    [ energy . ] [ '[ _ 0.01 advance ] times ] [ energy . ] tri ;
+    [ energy number>string print ]
+    [ '[ _ 0.01 advance ] times ]
+    [ energy number>string print ] tri ;
 
 : nbody-main ( -- ) 1000000 nbody ;
 
index 256fa9ec28a35930a86d1bb92ac8c4133e89330d..79a5a131f9b12ef3ac1f6ba593319652a2e47185 100644 (file)
@@ -58,7 +58,7 @@ TUPLE: nbody-system { bodies array read-only } ;
     [ <sun> <jupiter> <saturn> <uranus> <neptune> ] output>array nbody-system boa
     dup bodies>> init-bodies ; inline
 
-:: each-pair ( bodies pair-quot: ( other-body body -- ) each-quot: ( body -- ) -- )
+:: each-pair ( ... bodies pair-quot: ( ... other-body body -- ... ) each-quot: ( ... body -- ... ) -- ... )
     bodies [| body i |
         body each-quot call
         bodies i 1 + tail-slice [
index 5f9fddf1a8ab9fcef468d41807171a8c0233daf6..fe30aeff10aab85697eba4e821b519dfb1971c2a 100644 (file)
@@ -1,14 +1,15 @@
 USING: tools.deploy.config ;
 H{
+    { deploy-ui? f }
     { deploy-word-defs? f }
+    { deploy-threads? t }
+    { deploy-math? t }
+    { deploy-io 3 }
+    { deploy-reflection 1 }
+    { deploy-unicode? f }
+    { "stop-after-last-window?" t }
+    { deploy-console? t }
     { deploy-word-props? f }
-    { deploy-math? f }
-    { deploy-ui? f }
     { deploy-c-types? f }
-    { "stop-after-last-window?" t }
-    { deploy-reflection 1 }
     { deploy-name "benchmark.regex-dna" }
-    { deploy-io 2 }
-    { deploy-threads? f }
-    { deploy-unicode? f }
 }
index 24e77597831e5f180a64ef74eacaf5199d8156a3..af5a5b61aa4c9f9d65e9707d702f282b674f9ad5 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors io io.encodings.ascii io.files kernel sequences
-assocs math.parser namespaces regexp ;
+assocs math.parser namespaces regexp benchmark.knucleotide ;
 IN: benchmark.regex-dna
 
 ! Based on http://shootout.alioth.debian.org/gp4/benchmark.php?test=regexdna&lang=ruby&id=1
@@ -55,6 +55,6 @@ SYMBOL: clen
     length number>string print ;
 
 : regex-dna-main ( -- )
-    "resource:extra/benchmark/regex-dna/regex-dna-test-in.txt" regex-dna ;
+    knucleotide-in regex-dna ;
 
 MAIN: regex-dna-main
diff --git a/extra/benchmark/reverse-complement/deploy.factor b/extra/benchmark/reverse-complement/deploy.factor
new file mode 100644 (file)
index 0000000..c92199d
--- /dev/null
@@ -0,0 +1,15 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-ui? f }
+    { deploy-word-defs? f }
+    { deploy-threads? t }
+    { deploy-math? t }
+    { deploy-io 3 }
+    { deploy-reflection 1 }
+    { deploy-unicode? f }
+    { "stop-after-last-window?" t }
+    { deploy-console? t }
+    { deploy-word-props? f }
+    { deploy-c-types? f }
+    { deploy-name "benchmark.reverse-complement" }
+}
diff --git a/extra/benchmark/spectral-norm-simd/authors.txt b/extra/benchmark/spectral-norm-simd/authors.txt
new file mode 100644 (file)
index 0000000..7852139
--- /dev/null
@@ -0,0 +1 @@
+Marc Fauconneau
diff --git a/extra/benchmark/spectral-norm-simd/spectral-norm-simd.factor b/extra/benchmark/spectral-norm-simd/spectral-norm-simd.factor
new file mode 100644 (file)
index 0000000..ce91813
--- /dev/null
@@ -0,0 +1,68 @@
+! Copyright (C) 2010 Marc Fauconneau.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types specialized-arrays kernel math
+math.functions math.vectors sequences sequences.private
+prettyprint words typed locals math.vectors.simd
+math.vectors.simd.cords ;
+SPECIALIZED-ARRAYS: double double-4 ;
+IN: benchmark.spectral-norm-simd
+
+:: inner-loop ( u n quot -- seq )
+    n 4 /i iota [| i |
+        n iota [| j | u i j quot call ] [ v+ ] map-reduce
+    ] double-4-array{ } map-as ; inline
+
+: eval-A ( i j -- n )
+    [ >float ] bi@
+    [ drop ] [ + [ ] [ 1 + ] bi * 0.5 * ] 2bi
+    + 1 + ; inline
+
+: vrecip ( u -- v ) double-4{ 1.0 1.0 1.0 1.0 } swap v/ ; inline
+
+:: eval4-A ( i j -- n )
+    i 4 * 0 + j eval-A
+    i 4 * 1 + j eval-A
+    i 4 * 2 + j eval-A
+    i 4 * 3 + j eval-A
+    double-4-boa vrecip ; inline
+
+: (eval-A-times-u) ( u i j -- x )
+    [ swap nth-unsafe ] [ eval4-A ] bi-curry bi* n*v ; inline
+
+: eval-A-times-u ( n u -- seq )
+    [ (eval-A-times-u) ] inner-loop ; inline
+    
+:: eval4-A' ( i j -- n )
+    j i 4 * 0 + eval-A
+    j i 4 * 1 + eval-A
+    j i 4 * 2 + eval-A
+    j i 4 * 3 + eval-A
+    double-4-boa vrecip ; inline
+
+: (eval-At-times-u) ( u i j -- x )
+    [ swap nth-unsafe ] [ eval4-A' ] bi-curry bi* n*v ; inline
+
+: eval-At-times-u ( u n -- seq )
+    [ double-array-cast ] dip [ (eval-At-times-u) ] inner-loop ; inline
+
+: eval-AtA-times-u ( u n -- seq )
+    [ double-array-cast ] dip [ eval-A-times-u ] [ eval-At-times-u ] bi ; inline
+
+: ones ( n -- seq )
+    4 /i [ double-4{ 1.0 1.0 1.0 1.0 } ] double-4-array{ } replicate-as ; inline
+
+:: u/v ( n -- u v )
+    n ones dup
+    10 [
+        drop
+        n eval-AtA-times-u
+        [ n eval-AtA-times-u ] keep
+    ] times ; inline
+
+TYPED: spectral-norm ( n: fixnum -- norm )
+    u/v [ double-array-cast ] bi@ [ v. ] [ norm-sq ] bi /f sqrt ;
+
+: spectral-norm-main ( -- )
+    2000 spectral-norm . ;
+
+MAIN: spectral-norm-main
diff --git a/extra/benchmark/spectral-norm/deploy.factor b/extra/benchmark/spectral-norm/deploy.factor
new file mode 100644 (file)
index 0000000..7ae0b19
--- /dev/null
@@ -0,0 +1,15 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-ui? f }
+    { deploy-word-defs? f }
+    { deploy-threads? t }
+    { deploy-math? t }
+    { deploy-io 2 }
+    { deploy-reflection 1 }
+    { deploy-unicode? f }
+    { "stop-after-last-window?" t }
+    { deploy-console? t }
+    { deploy-word-props? f }
+    { deploy-c-types? f }
+    { deploy-name "benchmark.spectral-norm" }
+}
index 386ffb0ae10c6aa4498bc2515e4620c6ecc5c188..70489456e439e0b2351c13f2f10f735f907d7db5 100644 (file)
@@ -1,8 +1,11 @@
+! Copyright (C) 2008, 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+!
 ! Factor port of
 ! http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all
-USING: alien.c-types specialized-arrays kernel math
-math.functions math.vectors sequences prettyprint words hints
-locals ;
+USING: alien.c-types io kernel math math.functions math.parser
+math.vectors sequences sequences.private specialized-arrays
+typed locals ;
 SPECIALIZED-ARRAY: double
 IN: benchmark.spectral-norm
 
@@ -19,13 +22,13 @@ IN: benchmark.spectral-norm
     + 1 + recip ; inline
 
 : (eval-A-times-u) ( u i j -- x )
-    [ swap nth ] [ eval-A ] bi-curry bi* * ; inline
+    [ swap nth-unsafe ] [ eval-A ] bi-curry bi* * ; inline
 
 : eval-A-times-u ( n u -- seq )
     [ (eval-A-times-u) ] inner-loop ; inline
 
 : (eval-At-times-u) ( u i j -- x )
-    [ swap nth ] [ swap eval-A ] bi-curry bi* * ; inline
+    [ swap nth-unsafe ] [ swap eval-A ] bi-curry bi* * ; inline
 
 : eval-At-times-u ( u n -- seq )
     [ (eval-At-times-u) ] inner-loop ; inline
@@ -43,12 +46,10 @@ IN: benchmark.spectral-norm
         [ n eval-AtA-times-u ] keep
     ] times ; inline
 
-: spectral-norm ( n -- norm )
+TYPED: spectral-norm ( n: fixnum -- norm )
     u/v [ v. ] [ norm-sq ] bi /f sqrt ;
 
-HINTS: spectral-norm fixnum ;
-
 : spectral-norm-main ( -- )
-    2000 spectral-norm . ;
+    2000 spectral-norm number>string print ;
 
 MAIN: spectral-norm-main
index b182b4f832ee703b18df1f437498400e3393ded7..4a5a0285fcf912baa4321cc8335f8aa3fc50b803 100644 (file)
@@ -1,11 +1,12 @@
 ! Copyright (C) Chris Double.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien.accessors alien.c-types alien.syntax byte-arrays
-destructors generalizations hints kernel libc locals math math.order
-sequences sequences.private classes.struct accessors alien.data ;
+destructors generalizations kernel libc locals math math.order
+sequences sequences.private classes.struct accessors alien.data
+typed ;
 IN: benchmark.yuv-to-rgb
 
-STRUCT: yuv_buffer
+STRUCT: yuv-buffer
     { y_width int }
     { y_height int }
     { y_stride int }
@@ -19,7 +20,7 @@ STRUCT: yuv_buffer
 :: fake-data ( -- rgb yuv )
     1600 :> w
     1200 :> h
-    yuv_buffer <struct> :> buffer
+    yuv-buffer <struct> :> buffer
     w h * 3 * <byte-array> :> rgb
     rgb buffer
         w >>y_width
@@ -79,14 +80,12 @@ STRUCT: yuv_buffer
     pick y_width>> iota
     [ yuv>rgb-pixel ] with with with with each ; inline
 
-: yuv>rgb ( rgb yuv -- )
+TYPED: yuv>rgb ( rgb: byte-array yuv: yuv-buffer -- )
     [ 0 ] 2dip
     dup y_height>> iota
     [ yuv>rgb-row ] with with each
     drop ;
 
-HINTS: yuv>rgb byte-array yuv_buffer ;
-
 : yuv>rgb-benchmark ( -- )
     [ fake-data yuv>rgb ] with-destructors ;
 
diff --git a/extra/bit/ly/authors.txt b/extra/bit/ly/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/bit/ly/ly.factor b/extra/bit/ly/ly.factor
new file mode 100644 (file)
index 0000000..0220fba
--- /dev/null
@@ -0,0 +1,33 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs http.client json.reader kernel namespaces urls ;
+IN: bit.ly
+
+SYMBOLS: login api-key ;
+
+<PRIVATE
+
+: of ( assoc key -- value ) swap at ;
+
+: make-request ( long-url -- request )
+    "http://api.bit.ly/v3/shorten" >url
+        login get "login" set-query-param
+        api-key get "apiKey" set-query-param
+        "json" "format" set-query-param
+        swap "longUrl" set-query-param ;
+
+ERROR: bad-response json status ;
+
+: check-response ( json -- json )
+    dup "status_code" of 200 = [
+        dup "status_txt" of
+        bad-response
+    ] unless ;
+
+: parse-response ( response data -- short-url )
+    nip json> check-response "data" of "url" of ;
+
+PRIVATE>
+
+: shorten-url ( long-url -- short-url )
+    make-request http-get parse-response ;
diff --git a/extra/bit/ly/summary.txt b/extra/bit/ly/summary.txt
new file mode 100644 (file)
index 0000000..29020a6
--- /dev/null
@@ -0,0 +1 @@
+Wrapper for bit.ly URL shortening web service
diff --git a/extra/bit/ly/tags.txt b/extra/bit/ly/tags.txt
new file mode 100644 (file)
index 0000000..0a8d552
--- /dev/null
@@ -0,0 +1 @@
+web services
diff --git a/extra/boyer-moore/authors.txt b/extra/boyer-moore/authors.txt
new file mode 100644 (file)
index 0000000..e1702c7
--- /dev/null
@@ -0,0 +1 @@
+Dmitry Shubin
diff --git a/extra/boyer-moore/boyer-moore-docs.factor b/extra/boyer-moore/boyer-moore-docs.factor
new file mode 100644 (file)
index 0000000..d87f431
--- /dev/null
@@ -0,0 +1,59 @@
+! Copyright (C) 2010 Dmitry Shubin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: boyer-moore.private help.markup help.syntax kernel sequences ;
+IN: boyer-moore
+
+HELP: <boyer-moore>
+{ $values
+  { "pat" sequence } { "bm" boyer-moore }
+}
+{ $description
+  "Given a pattern performs pattern preprocessing and returns "
+  "results as an (opaque) object that is reusable across "
+  "searches in different sequences via " { $link search-from }
+  " generic word."
+} ;
+
+HELP: search-from
+{ $values
+  { "seq" sequence }
+  { "from" "a non-negative integer" }
+  { "obj" object }
+  { "i/f" "the index of first match or " { $link f }  }
+}
+{ $description "Performs an attempt to find the first "
+  "occurence of pattern in " { $snippet "seq" }
+  " starting from " { $snippet "from" } " using "
+  "Boyer-Moore search algorithm. Output is the index "
+  "if the attempt was  succeessful and " { $link f }
+  " otherwise."
+} ;
+
+HELP: search
+{ $values
+  { "seq" sequence }
+  { "obj" object }
+  { "i/f" "the index of first match or " { $link f } }
+}
+{ $description "A simpler variant of " { $link search-from }
+  " that starts searching from the beginning of the sequence."
+} ;
+
+ARTICLE: "boyer-moore" "The Boyer-Moore algorithm"
+{ $heading "Summary" }
+"The " { $vocab-link "boyer-moore" } " vocabulary "
+"implements a Boyer-Moore string search algorithm with "
+"so-called 'strong good suffix shift rule'. Since algorithm is "
+"alphabet-independent it is applicable to searching in any "
+"collection that implements " { $links "sequence-protocol" } "."
+
+{ $heading "Complexity" }
+"Let " { $snippet "n" } " and " { $snippet "m" } " be lengths "
+"of the sequences being searched " { $emphasis "in" } " and "
+{ $emphasis "for" } " respectively. Then searching runs in "
+{ $snippet "O(n)" } " time in its worst case using additional "
+{ $snippet "O(m)" } " space. The preprocessing phase runs in "
+{ $snippet "O(m)" } " time."
+;
+
+ABOUT: "boyer-moore"
diff --git a/extra/boyer-moore/boyer-moore-tests.factor b/extra/boyer-moore/boyer-moore-tests.factor
new file mode 100644 (file)
index 0000000..e444c35
--- /dev/null
@@ -0,0 +1,10 @@
+! Copyright (C) 2010 Dmitry Shubin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: tools.test boyer-moore ;
+IN: boyer-moore.tests
+
+[ 0 ] [ "qwerty" "" search ] unit-test
+[ 0 ] [ "" "" search ] unit-test
+[ f ] [ "qw" "qwerty" search ] unit-test
+[ 3 ] [ "qwerty" "r" search ] unit-test
+[ 8 ] [ "qwerasdfqwer" 2 "qwe" search-from ] unit-test
diff --git a/extra/boyer-moore/boyer-moore.factor b/extra/boyer-moore/boyer-moore.factor
new file mode 100644 (file)
index 0000000..aba3f61
--- /dev/null
@@ -0,0 +1,78 @@
+! Copyright (C) 2010 Dmitry Shubin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays assocs kernel locals math math.order
+math.ranges sequences sequences.private z-algorithm ;
+IN: boyer-moore
+
+<PRIVATE
+
+:: (normal-suffixes) ( i zs ss -- )
+    i zs nth-unsafe ss
+    [ [ i ] unless* ] change-nth-unsafe ; inline
+
+: normal-suffixes ( zs -- ss )
+    [ length [ f <array> ] [ [1,b) ] bi ] keep pick
+    [ (normal-suffixes) ] 2curry each ; inline
+
+:: (partial-suffixes) ( len old elt i -- len old/new old )
+    len elt i 1 + = [ len elt - ] [ old ] if old ; inline
+
+: partial-suffixes ( zs -- ss )
+    [ length dup ] [ <reversed> ] bi
+    [ (partial-suffixes) ] map-index 2nip ; inline
+
+: <gs-table> ( seq -- table )
+    z-values [ partial-suffixes ] [ normal-suffixes ] bi
+    [ [ nip ] when* ] 2map reverse! ; inline
+
+: insert-bc-shift ( table elt len i -- table )
+    1 + swap - swap pick 2dup key?
+    [ 3drop ] [ set-at ] if ; inline
+
+: <bc-table> ( seq -- table )
+    H{ } clone swap [ length ] keep
+    [ insert-bc-shift ] with each-index ; inline
+
+TUPLE: boyer-moore pattern bc-table gs-table ;
+
+: gs-shift ( i c bm -- s ) nip gs-table>> nth-unsafe ; inline
+
+: bc-shift ( i c bm -- s ) bc-table>> at dup 1 ? + ; inline
+
+: do-shift ( pos i c bm -- newpos )
+    [ gs-shift ] [ bc-shift ] bi-curry 2bi max + ; inline
+
+: match? ( i1 s1 i2 s2 -- ? ) [ nth-unsafe ] 2bi@ = ; inline
+
+:: mismatch? ( s1 s2 pos len -- i/f )
+    len 1 - [ [ pos + s1 ] keep s2 match? not ]
+    find-last-integer ; inline
+
+:: (search-from) ( seq from bm -- i/f )
+    bm pattern>>      :> pat
+    pat length        :> plen
+    seq length plen - :> lim
+    from
+    [
+        dup lim <=
+        [
+            seq pat pick plen mismatch?
+            [ 2dup + seq nth-unsafe bm do-shift t ] [ f ] if*
+        ] [ drop f f ] if
+    ] loop ; inline
+
+PRIVATE>
+
+: <boyer-moore> ( pat -- bm )
+    dup <reversed> [ <bc-table> ] [ <gs-table> ] bi
+    boyer-moore boa ;
+
+GENERIC: search-from ( seq from obj -- i/f )
+
+M: sequence search-from
+    dup length zero?
+    [ 3drop 0 ] [ <boyer-moore> (search-from) ] if ;
+
+M: boyer-moore search-from (search-from) ;
+
+: search ( seq obj -- i/f ) [ 0 ] dip search-from ;
diff --git a/extra/boyer-moore/summary.txt b/extra/boyer-moore/summary.txt
new file mode 100644 (file)
index 0000000..298fcc3
--- /dev/null
@@ -0,0 +1 @@
+Boyer-Moore string search algorithm
diff --git a/extra/boyer-moore/tags.txt b/extra/boyer-moore/tags.txt
new file mode 100644 (file)
index 0000000..49b4f23
--- /dev/null
@@ -0,0 +1 @@
+algorithms
index a07057994331203de6b0101b8f44cdc3539e0a10..2ae8737c70bd03d249a71bb93ddf748c01d8effd 100644 (file)
@@ -32,22 +32,22 @@ PRIVATE>
 : ensure-buffer ( -- )
     (buffer) drop ; inline
 
-: with-buffer ( quot: ( -- ) -- byte-vector )
+: with-buffer ( ..a quot: ( ..a -- ..b ) -- ..b byte-vector )
     [ (buffer) [ reset-buffer ] keep dup ] dip
     with-output-stream* ; inline
 
-: with-length ( quot: ( -- ) -- bytes-written start-index )
+: with-length ( ..a quot: ( ..a -- ..b ) -- ..b bytes-written start-index )
     [ (buffer) [ length ] keep ] dip
     call length swap [ - ] keep ; inline
 
-: (with-length-prefix) ( quot: ( -- ) length-quot: ( bytes-written -- length ) -- )
+: (with-length-prefix) ( ..a quot: ( ..a -- ..b ) length-quot: ( bytes-written -- length ) -- ..b )
     [ [ B{ 0 0 0 0 } write ] prepose with-length ] dip swap
     [ call ] dip (buffer) copy ; inline
 
-: with-length-prefix ( quot: ( -- ) -- )
+: with-length-prefix ( ..a quot: ( ..a -- ..b ) -- ..b )
     [ INT32-SIZE >le ] (with-length-prefix) ; inline
     
-: with-length-prefix-excl ( quot: ( -- ) -- )
+: with-length-prefix-excl ( ..a quot: ( ..a -- ..b ) -- ..b )
     [ INT32-SIZE [ - ] keep >le ] (with-length-prefix) ; inline
     
 <PRIVATE
@@ -152,4 +152,4 @@ PRIVATE>
 
 : mdb-special-value? ( value -- ? )
    { [ timestamp? ] [ quotation? ] [ mdbregexp? ]
-     [ oid? ] [ byte-array? ] } 1|| ; inline
\ No newline at end of file
+     [ oid? ] [ byte-array? ] } 1|| ; inline
diff --git a/extra/build-support/authors.txt b/extra/build-support/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/build-support/build-support-tests.factor b/extra/build-support/build-support-tests.factor
new file mode 100644 (file)
index 0000000..1f855d5
--- /dev/null
@@ -0,0 +1,6 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: build-support sequences tools.test ;
+IN: build-support.tests
+
+[ f ] [ factor.sh-make-target empty? ] unit-test
diff --git a/extra/build-support/build-support.factor b/extra/build-support/build-support.factor
new file mode 100644 (file)
index 0000000..177042e
--- /dev/null
@@ -0,0 +1,10 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays io io.backend io.encodings.utf8 io.launcher ;
+IN: build-support
+
+CONSTANT: factor.sh-path "resource:build-support/factor.sh"
+
+: factor.sh-make-target ( -- string )
+    factor.sh-path normalize-path "make-target" 2array
+    utf8 [ readln ] with-process-reader ;
diff --git a/extra/build-support/platforms.txt b/extra/build-support/platforms.txt
new file mode 100644 (file)
index 0000000..509143d
--- /dev/null
@@ -0,0 +1 @@
+unix
index 57894217bd17f6cc5e4e47af7eee79d268975c61..a42c422bb8be58f5a8a20871d5cbe8cf00a564b1 100644 (file)
@@ -2,8 +2,8 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors combinators combinators.short-circuit
 generalizations kernel locals math.order math.ranges
-sequences.parser sequences sorting.functor sorting.slots
-unicode.categories ;
+sequences.parser sequences sequences.generalizations
+sorting.functor sorting.slots unicode.categories ;
 IN: c.lexer
 
 : take-c-comment ( sequence-parser -- seq/f )
@@ -54,7 +54,7 @@ IN: c.lexer
     sequence-parser current quote-char = [
         sequence-parser advance* string
     ] [
-        start-n sequence-parser (>>n) f
+        start-n sequence-parser n<< f
     ] if ;
 
 : (take-token) ( sequence-parser -- string )
index a4fb19c5979204b93e63f466c3ece97651d6b261..538836952f339fd842262eb8d12bc8598867083a 100644 (file)
@@ -33,7 +33,7 @@ HOLIDAY-NAME: new-years-day us-federal "New Year's Day"
 HOLIDAY: martin-luther-king-day january 3 monday-of-month ;
 HOLIDAY-NAME: martin-luther-king-day us-federal "Martin Luther King Day"
 
-HOLIDAY: inauguration-day year dup 4 neg rem + january 20 >>day ;
+HOLIDAY: inauguration-day january 20 >>day [ dup 4 neg rem + ] change-year ;
 HOLIDAY-NAME: inauguration-day us "Inauguration Day"
 
 HOLIDAY: washingtons-birthday february 3 monday-of-month ;
diff --git a/extra/chipmunk/chipmunk.factor b/extra/chipmunk/chipmunk.factor
deleted file mode 100644 (file)
index c56e15e..0000000
+++ /dev/null
@@ -1,845 +0,0 @@
-! Copyright (C) 2010 Erik Charlebois
-! See http:// factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types alien.syntax classes.struct combinators
-combinators.short-circuit kernel math math.order sequences
-specialized-arrays.instances.alien.c-types.void* typed
-specialized-arrays locals system alien.libraries ;
-IN: chipmunk
-
-<< "chipmunk" {
-        { [ os windows? ] [ "chipmunk.dll" ] }
-        { [ os macosx? ] [ "libchipmunk.dylib"  ] }
-        { [ os unix?  ] [ "libchipmunk.so" ] }
-    } cond "cdecl" add-library >>
-LIBRARY: chipmunk
-
-! chipmunk_types.h
-TYPEDEF: double cpFloat
-STRUCT: cpVect
-    { x cpFloat }
-    { y cpFloat } ;
-SPECIALIZED-ARRAY: cpVect
-
-TYPEDEF: uint cpHashValue
-TYPEDEF: void* cpDataPointer
-TYPEDEF: uint cpCollisionType
-TYPEDEF: uint cpLayers
-TYPEDEF: uint cpGroup
-
-CONSTANT: CP_NO_GROUP 0
-CONSTANT: CP_ALL_LAYERS HEX: ffffffff
-
-! cpVect.h
-TYPED: cpv ( x y -- v: cpVect )
-    cpVect <struct-boa> ; inline
-
-TYPED: cpvzero ( -- v: cpVect )
-    0.0 0.0 cpv ; inline
-
-FUNCTION: cpFloat cpvlength ( cpVect v ) ;
-FUNCTION: cpVect cpvslerp ( cpVect v1, cpVect v2, cpFloat t ) ;
-FUNCTION: cpVect cpvslerpconst ( cpVect v1, cpVect v2, cpFloat a ) ;
-FUNCTION: cpVect cpvforangle ( cpFloat a ) ;
-FUNCTION: cpFloat cpvtoangle ( cpVect v ) ;
-FUNCTION: char* cpvstr ( cpVect v ) ;
-
-TYPED: cpvadd ( v1: cpVect v2: cpVect -- v3: cpVect )
-    [ [ x>> ] bi@ + ]
-    [ [ y>> ] bi@ + ] 2bi cpv ; inline
-
-TYPED: cpvneg ( v1: cpVect -- v2: cpVect )
-    [ x>> ] [ y>> ] bi [ neg ] bi@ cpv ; inline
-
-TYPED: cpvsub ( v1: cpVect v2: cpVect -- v3: cpVect )
-    [ [ x>> ] bi@ - ]
-    [ [ y>> ] bi@ - ] 2bi cpv ; inline
-
-TYPED: cpvmult ( v1: cpVect s -- v2: cpVect )
-    [ swap x>> * ]
-    [ swap y>> * ] 2bi cpv ; inline
-
-TYPED: cpvdot ( v1: cpVect v2: cpVect -- s )
-    [ [ x>> ] bi@ * ]
-    [ [ y>> ] bi@ * ] 2bi + ; inline
-
-TYPED: cpvcross ( v1: cpVect v2: cpVect -- s )
-    [ [ x>> ] [ y>> ] bi* * ]
-    [ [ y>> ] [ x>> ] bi* * ] 2bi - ; inline
-
-TYPED: cpvperp ( v1: cpVect -- v2: cpVect )
-    [ y>> neg ] [ x>> ] bi cpv ; inline
-
-TYPED: cpvrperp ( v1: cpVect -- v2: cpVect )
-    [ y>> ] [ x>> neg ] bi cpv ; inline
-
-TYPED: cpvproject ( v1: cpVect v2: cpVect -- v3: cpVect )
-    [ nip ]
-    [ cpvdot ]
-    [ nip dup cpvdot ]
-    2tri / cpvmult ; inline
-
-TYPED: cpvrotate ( v1: cpVect v2: cpVect -- v3: cpVect )
-    [
-        [ [ x>> ] bi@ * ]
-        [ [ y>> ] bi@ * ] 2bi -
-    ]
-    [
-        [ [ x>> ] [ y>> ] bi* * ]
-        [ [ y>> ] [ x>> ] bi* * ] 2bi +
-    ] 2bi cpv ; inline
-
-TYPED: cpvunrotate ( v1: cpVect v2: cpVect -- v3: cpVect )
-    [
-        [ [ x>> ] bi@ * ]
-        [ [ y>> ] bi@ * ] 2bi +
-    ]
-    [
-        [ [ y>> ] [ x>> ] bi* * ]
-        [ [ x>> ] [ y>> ] bi* * ] 2bi -
-    ] 2bi cpv ; inline
-
-TYPED: cpvlengthsq ( v: cpVect -- s )
-    dup cpvdot ; inline
-
-TYPED: cpvlerp ( v1: cpVect v2: cpVect s -- v3: cpVect )
-    [ nip 1.0 swap - cpvmult ]
-    [ cpvmult nip ] 3bi cpvadd ; inline
-
-TYPED: cpvnormalize ( v1: cpVect -- v2: cpVect )
-    dup cpvlength 1.0 swap / cpvmult ; inline
-
-TYPED: cpvnormalize_safe ( v1: cpVect -- v2: cpVect )
-    dup [ x>> 0.0 = ] [ y>> 0.0 = ] bi and
-    [ drop cpvzero ]
-    [ cpvnormalize ] if ; inline
-
-TYPED: cpvclamp ( v1: cpVect len -- v2: cpVect )
-    2dup
-    [ dup cpvdot ]
-    [ sq ] 2bi* >
-    [ [ cpvnormalize ] dip cpvmult ]
-    [ drop ] if ; inline
-
-TYPED: cpvlerpconst ( v1: cpVect v2: cpVect d -- v3: cpVect )
-    [ 2drop ]
-    [ [ swap cpvsub ] dip cpvclamp ] 3bi cpvadd ; inline
-
-TYPED: cpvdist ( v1: cpVect v2: cpVect -- dist )
-    cpvsub cpvlength ; inline
-
-TYPED: cpvdistsq ( v1: cpVect v2: cpVect -- distsq )
-    cpvsub cpvlengthsq ; inline
-
-TYPED: cpvnear ( v1: cpVect v2: cpVect dist -- ? )
-    [ cpvdistsq ] dip sq < ; inline
-
-! cpBB.h
-STRUCT: cpBB
-    { l cpFloat }
-    { b cpFloat }
-    { r cpFloat }
-    { t cpFloat } ;
-
-TYPED: cpBBNew ( l b r t -- cpbb: cpBB )
-    cpBB <struct-boa> ; inline
-
-TYPED: cpBBintersects ( a: cpBB b: cpBB -- ? )
-    {
-        [ [ l>> ] [ r>> ] bi* <= ]
-        [ [ r>> ] [ l>> ] bi*  > ]
-        [ [ b>> ] [ t>> ] bi* <= ]
-        [ [ t>> ] [ b>> ] bi*  > ]
-    } 2&& ; inline
-
-TYPED: cpBBcontainsBB ( bb: cpBB other: cpBB -- ? )
-    {
-        [ [ l>> ] bi@ < ]
-        [ [ r>> ] bi@ > ]
-        [ [ b>> ] bi@ < ]
-        [ [ t>> ] bi@ > ]
-    } 2&& ; inline
-
-TYPED: cpBBcontainsVect ( bb: cpBB v: cpVect -- ? )
-    {
-        [ [ l>> ] [ x>> ] bi* < ]
-        [ [ r>> ] [ x>> ] bi* > ]
-        [ [ b>> ] [ y>> ] bi* < ]
-        [ [ t>> ] [ y>> ] bi* > ]
-    } 2&& ; inline
-
-TYPED: cpBBmerge ( a: cpBB b: cpBB -- c: cpBB )
-    {
-        [ [ l>> ] bi@ min ]
-        [ [ b>> ] bi@ min ]
-        [ [ r>> ] bi@ max ]
-        [ [ t>> ] bi@ max ]
-    } 2cleave cpBBNew ; inline
-
-TYPED: cpBBexpand ( bb: cpBB v: cpVect -- b: cpBB )
-    {
-        [ [ l>> ] [ x>> ] bi* min ]
-        [ [ b>> ] [ y>> ] bi* min ]
-        [ [ r>> ] [ x>> ] bi* max ]
-        [ [ t>> ] [ y>> ] bi* max ]
-    } 2cleave cpBBNew ; inline
-
-FUNCTION: cpVect cpBBClampVect ( cpBB bb, cpVect v ) ;
-FUNCTION: cpVect cpBBWrapVect ( cpBB bb, cpVect v ) ;
-
-! cpBody.h
-C-TYPE: cpBody
-CALLBACK: void cpBodyVelocityFunc ( cpBody* body, cpVect gravity, cpFloat damping, cpFloat dt ) ;
-CALLBACK: void cpBodyPositionFunc ( cpBody* body, cpFloat dt ) ;
-
-STRUCT: cpBody
-    { velocity_func cpBodyVelocityFunc }
-    { position_func cpBodyPositionFunc }
-    { m             cpFloat            }
-    { m_inv         cpFloat            }
-    { i             cpFloat            }
-    { i_inv         cpFloat            }
-    { p             cpVect             }
-    { v             cpVect             }
-    { f             cpVect             }
-    { a             cpFloat            }
-    { w             cpFloat            }
-    { t             cpFloat            }
-    { rot           cpVect             }
-    { data          cpDataPointer      }
-    { v_limit       cpFloat            }
-    { w_limit       cpFloat            }
-    { v_bias        cpVect             }
-    { w_bias        cpFloat            } ;
-
-FUNCTION: cpBody* cpBodyAlloc ( ) ;
-FUNCTION: cpBody* cpBodyInit ( cpBody* body, cpFloat m, cpFloat i ) ;
-FUNCTION: cpBody* cpBodyNew ( cpFloat m, cpFloat i ) ;
-FUNCTION: void cpBodyDestroy ( cpBody* body ) ;
-FUNCTION: void cpBodyFree ( cpBody* body ) ;
-FUNCTION: void cpBodySetMass ( cpBody* body, cpFloat m ) ;
-FUNCTION: void cpBodySetMoment ( cpBody* body, cpFloat i ) ;
-FUNCTION: void cpBodySetAngle ( cpBody* body, cpFloat a ) ;
-FUNCTION: void cpBodySlew ( cpBody* body, cpVect pos, cpFloat dt ) ;
-FUNCTION: void cpBodyUpdateVelocity ( cpBody* body, cpVect gravity, cpFloat damping, cpFloat dt ) ;
-FUNCTION: void cpBodyUpdatePosition ( cpBody* body, cpFloat dt ) ;
-
-TYPED: cpBodyLocal2World ( body: cpBody v: cpVect -- v2: cpVect )
-    [ drop p>> ]
-    [ swap rot>> cpvrotate ] 2bi cpvadd ; inline
-
-TYPED: cpBodyWorld2Local ( body: cpBody v: cpVect -- v2: cpVect )
-    [ swap p>> cpvsub ]
-    [ drop rot>> ] 2bi cpvunrotate ; inline
-
-TYPED: cpBodyApplyImpulse ( body: cpBody j: cpVect r: cpVect -- )
-    [
-        drop
-        [ drop dup v>> ]
-        [ swap m_inv>> cpvmult ] 2bi cpvadd >>v drop
-    ]
-    [
-        [ 2drop dup w_bias>> ]
-        [ swap cpvcross [ i_inv>> ] dip * ] 3bi + >>w_bias drop
-    ] 3bi ; inline
-
-FUNCTION: void cpBodyResetForces ( cpBody* body ) ;
-FUNCTION: void cpBodyApplyForce ( cpBody* body, cpVect f, cpVect r ) ;
-FUNCTION: void cpApplyDampedSpring ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat rlen, cpFloat k, cpFloat dmp, cpFloat dt ) ;
-
-! cpArray.h
-STRUCT: cpArray
-    { num int    }
-    { max int    }
-    { arr void** } ;
-
-CALLBACK: void cpArrayIter ( void* ptr, void* data ) ;
-
-FUNCTION: cpArray* cpArrayAlloc ( ) ;
-FUNCTION: cpArray* cpArrayInit ( cpArray* arr, int size ) ;
-FUNCTION: cpArray* cpArrayNew ( int size ) ;
-FUNCTION: void cpArrayDestroy ( cpArray* arr ) ;
-FUNCTION: void cpArrayFree ( cpArray* arr ) ;
-FUNCTION: void cpArrayPush ( cpArray* arr, void* object ) ;
-FUNCTION: void cpArrayDeleteIndex ( cpArray* arr, int idx ) ;
-FUNCTION: void cpArrayDeleteObj ( cpArray* arr, void* obj ) ;
-FUNCTION: void cpArrayEach ( cpArray* arr, cpArrayIter iterFunc, void* data ) ;
-FUNCTION: int cpArrayContains ( cpArray* arr, void* ptr ) ;
-
-! cpHashSet.h
-STRUCT: cpHashSetBin
-    { elt  void*         }
-    { hash cpHashValue   }
-    { next cpHashSetBin* } ;
-
-CALLBACK: int cpHashSetEqlFunc ( void* ptr, void* elt ) ;
-CALLBACK: void* cpHashSetTransFunc ( void* ptr, void* data ) ;
-CALLBACK: void cpHashSetIterFunc ( void* elt, void* data ) ;
-CALLBACK: int cpHashSetFilterFunc ( void* elt, void* data ) ;
-
-STRUCT: cpHashSet
-    { entries       int                }
-    { size          int                }
-    { eql           cpHashSetEqlFunc   }
-    { trans         cpHashSetTransFunc }
-    { default_value void*              }
-    { table         cpHashSetBin**     } ;
-
-FUNCTION: void cpHashSetDestroy ( cpHashSet* set ) ;
-FUNCTION: void cpHashSetFree ( cpHashSet* set ) ;
-FUNCTION: cpHashSet* cpHashSetAlloc ( ) ;
-FUNCTION: cpHashSet* cpHashSetInit ( cpHashSet* set, int size, cpHashSetEqlFunc eqlFunc, cpHashSetTransFunc trans ) ;
-FUNCTION: cpHashSet* cpHashSetNew ( int size, cpHashSetEqlFunc eqlFunc, cpHashSetTransFunc trans ) ;
-FUNCTION: void* cpHashSetInsert ( cpHashSet* set, cpHashValue hash, void* ptr, void* data ) ;
-FUNCTION: void* cpHashSetRemove ( cpHashSet* set, cpHashValue hash, void* ptr ) ;
-FUNCTION: void* cpHashSetFind ( cpHashSet* set, cpHashValue hash, void* ptr ) ;
-FUNCTION: void cpHashSetEach ( cpHashSet* set, cpHashSetIterFunc func, void* data ) ;
-FUNCTION: void cpHashSetFilter ( cpHashSet* set, cpHashSetFilterFunc func, void* data ) ;
-
-! cpSpaceHash.h
-STRUCT: cpHandle
-    { obj    void* }
-    { retain int   }
-    { stamp  int   } ;
-
-STRUCT: cpSpaceHashBin
-    { handle cpHandle*       }
-    { next   cpSpaceHashBin* } ;
-
-CALLBACK: cpBB cpSpaceHashBBFunc ( void* obj ) ;
-
-STRUCT: cpSpaceHash
-    { numcells  int               }
-    { celldim   cpFloat           }
-    { bbfunc    cpSpaceHashBBFunc }
-    { handleSet cpHashSet*        }
-    { table     cpSpaceHashBin**  }
-    { bins      cpSpaceHashBin*   }
-    { stamp     int               } ;
-
-FUNCTION: cpSpaceHash* cpSpaceHashAlloc ( ) ;
-FUNCTION: cpSpaceHash* cpSpaceHashInit ( cpSpaceHash* hash, cpFloat celldim, int cells, cpSpaceHashBBFunc bbfunc ) ;
-FUNCTION: cpSpaceHash* cpSpaceHashNew ( cpFloat celldim, int cells, cpSpaceHashBBFunc bbfunc ) ;
-FUNCTION: void cpSpaceHashDestroy ( cpSpaceHash* hash ) ;
-FUNCTION: void cpSpaceHashFree ( cpSpaceHash* hash ) ;
-FUNCTION: void cpSpaceHashResize ( cpSpaceHash* hash, cpFloat celldim, int numcells ) ;
-FUNCTION: void cpSpaceHashInsert ( cpSpaceHash* hash, void* obj, cpHashValue id, cpBB bb ) ;
-FUNCTION: void cpSpaceHashRemove ( cpSpaceHash* hash, void* obj, cpHashValue id ) ;
-CALLBACK: void cpSpaceHashIterator ( void* obj, void* data ) ;
-FUNCTION: void cpSpaceHashEach ( cpSpaceHash* hash, cpSpaceHashIterator func, void* data ) ;
-FUNCTION: void cpSpaceHashRehash ( cpSpaceHash* hash ) ;
-FUNCTION: void cpSpaceHashRehashObject ( cpSpaceHash* hash, void* obj, cpHashValue id ) ;
-CALLBACK: void cpSpaceHashQueryFunc ( void* obj1, void* obj2, void* data ) ;
-FUNCTION: void cpSpaceHashPointQuery ( cpSpaceHash* hash, cpVect point, cpSpaceHashQueryFunc func, void* data ) ;
-FUNCTION: void cpSpaceHashQuery ( cpSpaceHash* hash, void* obj, cpBB bb, cpSpaceHashQueryFunc func, void* data ) ;
-FUNCTION: void cpSpaceHashQueryRehash ( cpSpaceHash* hash, cpSpaceHashQueryFunc func, void* data ) ;
-CALLBACK: cpFloat cpSpaceHashSegmentQueryFunc ( void* obj1, void* obj2, void* data ) ;
-FUNCTION: void cpSpaceHashSegmentQuery ( cpSpaceHash* hash, void* obj, cpVect a, cpVect b, cpFloat t_exit, cpSpaceHashSegmentQueryFunc func, void* data ) ;
-
-! cpShape.h
-C-TYPE: cpShape
-C-TYPE: cpShapeClass
-
-STRUCT: cpSegmentQueryInfo
-    { shape cpShape* }
-    { t     cpFloat  }
-    { n     cpVect   } ;
-
-C-ENUM:
-    CP_CIRCLE_SHAPE
-    CP_SEGMENT_SHAPE
-    CP_POLY_SHAPE
-    CP_NUM_SHAPES ;
-TYPEDEF: int cpShapeType
-
-CALLBACK: cpBB cacheData_cb ( cpShape* shape, cpVect p, cpVect rot ) ;
-CALLBACK: void destroy_cb ( cpShape* shape ) ;
-CALLBACK: int pointQuery_cb ( cpShape* shape, cpVect p ) ;
-CALLBACK: void segmentQuery_cb ( cpShape* shape, cpVect a, cpVect b, cpSegmentQueryInfo* info ) ;
-
-STRUCT: cpShapeClass
-    { type         cpShapeType     }
-    { cacheData    cacheData_cb    }
-    { destroy      destroy_cb      }
-    { pointQuery   pointQuery_cb   }
-    { segmentQuery segmentQuery_cb } ;
-
-STRUCT: cpShape
-    { klass          cpShapeClass*   }
-    { body           cpBody*         }
-    { bb             cpBB            }
-    { sensor         int             }
-    { e              cpFloat         }
-    { u              cpFloat         }
-    { surface_v      cpVect          }
-    { data           cpDataPointer   }
-    { collision_type cpCollisionType }
-    { group          cpGroup         }
-    { layers         cpLayers        }
-    { hashid         cpHashValue     } ;
-
-FUNCTION: cpShape* cpShapeInit ( cpShape* shape, cpShapeClass* klass, cpBody* body ) ;
-FUNCTION: void cpShapeDestroy ( cpShape* shape ) ;
-FUNCTION: void cpShapeFree ( cpShape* shape ) ;
-FUNCTION: cpBB cpShapeCacheBB ( cpShape* shape ) ;
-FUNCTION: int cpShapePointQuery ( cpShape* shape, cpVect p ) ;
-
-STRUCT: cpCircleShape
-    { shape cpShape }
-    { c     cpVect  }
-    { r     cpFloat }
-    { tc    cpVect  } ;
-
-FUNCTION: cpCircleShape* cpCircleShapeAlloc ( ) ;
-FUNCTION: cpCircleShape* cpCircleShapeInit ( cpCircleShape* circle, cpBody* body, cpFloat radius, cpVect offset ) ;
-FUNCTION: cpShape* cpCircleShapeNew ( cpBody* body, cpFloat radius, cpVect offset ) ;
-
-STRUCT: cpSegmentShape
-    { shape cpShape }
-    { a     cpVect  }
-    { b     cpVect  }
-    { n     cpVect  }
-    { r     cpFloat }
-    { ta    cpVect  }
-    { tb    cpVect  }
-    { tn    cpVect  } ;
-
-FUNCTION: cpSegmentShape* cpSegmentShapeAlloc ( ) ;
-FUNCTION: cpSegmentShape* cpSegmentShapeInit ( cpSegmentShape* seg, cpBody* body, cpVect a, cpVect b, cpFloat radius ) ;
-FUNCTION: cpShape* cpSegmentShapeNew ( cpBody* body, cpVect a, cpVect b, cpFloat radius ) ;
-FUNCTION: void cpResetShapeIdCounter ( ) ;
-FUNCTION: void cpSegmentQueryInfoPrint ( cpSegmentQueryInfo* info ) ;
-FUNCTION: int cpShapeSegmentQuery ( cpShape* shape, cpVect a, cpVect b, cpSegmentQueryInfo* info ) ;
-
-TYPED: cpSegmentQueryHitPoint ( start: cpVect end: cpVect info: cpSegmentQueryInfo -- hit-point: cpVect )
-    t>> cpvlerp ; inline
-
-TYPED: cpSegmentQueryHitDist ( start: cpVect end: cpVect info: cpSegmentQueryInfo -- hit-dist )
-    t>> [ cpvdist ] dip * ; inline
-
-! cpPolyShape.h
-STRUCT: cpPolyShapeAxis
-    { n cpVect  }
-    { d cpFloat } ;
-SPECIALIZED-ARRAY: cpPolyShapeAxis
-
-STRUCT: cpPolyShape
-    { shape    cpShape          }
-    { numVerts int              }
-    { verts    cpVect*          }
-    { axes     cpPolyShapeAxis* }
-    { tVerts   cpVect*          }
-    { tAxes    cpPolyShapeAxis* } ;
-
-FUNCTION: cpPolyShape* cpPolyShapeAlloc ( ) ;
-FUNCTION: cpPolyShape* cpPolyShapeInit ( cpPolyShape* poly, cpBody* body, int numVerts, cpVect* verts, cpVect offset ) ;
-FUNCTION: cpShape* cpPolyShapeNew ( cpBody* body, int numVerts, cpVect* verts, cpVect offset ) ;
-FUNCTION: int cpPolyValidate ( cpVect* verts, int numVerts ) ;
-FUNCTION: int cpPolyShapeGetNumVerts ( cpShape* shape ) ;
-FUNCTION: cpVect cpPolyShapeGetVert ( cpShape* shape, int idx ) ;
-
-TYPED: cpPolyShapeValueOnAxis ( poly: cpPolyShape n: cpVect d -- min-dist )
-    swap rot [ numVerts>> ] [ tVerts>> swap <direct-cpVect-array> ] bi swap
-    [ cpvdot ] curry [ min ] reduce swap - ; inline
-
-TYPED: cpPolyShapeContainsVert ( poly: cpPolyShape v: cpVect -- ? )
-    swap [ numVerts>> ] [ tAxes>> swap <direct-cpPolyShapeAxis-array> ] bi swap
-    [
-        [ [ n>> ] dip cpvdot ] [ drop d>> ] 2bi -
-    ] curry [ max ] reduce 0.0 <= ; inline
-
-TYPED: cpPolyShapeContainsVertPartial ( poly: cpPolyShape v: cpVect n: cpVect -- ? )
-    rot [ numVerts>> ] [ tAxes>> swap <direct-cpPolyShapeAxis-array> ] bi -rot
-    [| axis v n |
-        axis n>> n cpvdot 0.0 < 0
-        [ 0.0 ]
-        [ axis n>> v cpvdot axis d>> - ]
-        if
-    ] 2curry [ max ] reduce 0.0 <= ; inline
-
-! cpArbiter.h
-C-TYPE: cpArbiter
-C-TYPE: cpSpace
-C-TYPE: cpCollisionHandler
-
-STRUCT: cpContact
-    { p      cpVect      }
-    { n      cpVect      }
-    { dist   cpFloat     }
-    { r1     cpVect      }
-    { r2     cpVect      }
-    { nMass  cpFloat     }
-    { tMass  cpFloat     }
-    { bounce cpFloat     }
-    { jnAcc  cpFloat     }
-    { jtAcc  cpFloat     }
-    { jBias  cpFloat     }
-    { bias   cpFloat     }
-    { hash   cpHashValue } ;
-
-FUNCTION: cpContact* cpContactInit ( cpContact* con, cpVect p, cpVect n, cpFloat dist, cpHashValue hash ) ;
-
-C-ENUM:
-    cpArbiterStateNormal
-    cpArbiterStateFirstColl
-    cpArbiterStateIgnore ;
-TYPEDEF: int cpArbiterState
-
-STRUCT: cpArbiter
-    { numContacts int                 }
-    { contacts    cpContact*          }
-    { a           cpShape*            }
-    { b           cpShape*            }
-    { e           cpFloat             }
-    { u           cpFloat             }
-    { surface_vr  cpVect              }
-    { stamp       int                 }
-    { handler     cpCollisionHandler* }
-    { swappedColl char                }
-    { state       char                } ;
-
-FUNCTION: cpArbiter* cpArbiterAlloc ( ) ;
-FUNCTION: cpArbiter* cpArbiterInit ( cpArbiter* arb, cpShape* a, cpShape* b ) ;
-FUNCTION: cpArbiter* cpArbiterNew ( cpShape* a, cpShape* b ) ;
-FUNCTION: void cpArbiterDestroy ( cpArbiter* arb ) ;
-FUNCTION: void cpArbiterFree ( cpArbiter* arb ) ;
-FUNCTION: void cpArbiterUpdate ( cpArbiter* arb, cpContact* contacts, int numContacts, cpCollisionHandler* handler, cpShape* a, cpShape* b ) ;
-FUNCTION: void cpArbiterPreStep ( cpArbiter* arb, cpFloat dt_inv ) ;
-FUNCTION: void cpArbiterApplyCachedImpulse ( cpArbiter* arb ) ;
-FUNCTION: void cpArbiterApplyImpulse ( cpArbiter* arb, cpFloat eCoef ) ;
-FUNCTION: cpVect cpArbiterTotalImpulse ( cpArbiter* arb ) ;
-FUNCTION: cpVect cpArbiterTotalImpulseWithFriction ( cpArbiter* arb ) ;
-FUNCTION: void cpArbiterIgnore ( cpArbiter* arb ) ;
-
-TYPED: cpArbiterGetShapes ( arb: cpArbiter -- a: cpShape b: cpShape )
-    dup swappedColl>> 0 = [
-        [ a>> cpShape memory>struct ] [ b>> cpShape memory>struct ] bi
-    ] [
-        [ b>> cpShape memory>struct ] [ a>> cpShape memory>struct ] bi
-    ] if ; inline
-
-TYPED: cpArbiterIsFirstContact ( arb: cpArbiter -- ? )
-    state>> cpArbiterStateFirstColl = ; inline
-
-TYPED: cpArbiterGetNormal ( arb: cpArbiter i -- n: cpVect )
-    [
-        swap
-        [ numContacts>> ]
-        [ contacts>> swap <direct-void*-array> ] bi nth cpContact memory>struct n>>
-    ]
-    [
-        drop swappedColl>> 0 = [ ] [ cpvneg ] if
-    ] 2bi ; inline
-
-TYPED: cpArbiterGetPoint ( arb: cpArbiter i -- p: cpVect )
-    swap
-    [ numContacts>> ]
-    [ contacts>> swap <direct-void*-array> ] bi
-    nth cpContact memory>struct p>> ; inline
-
-! cpCollision.h
-FUNCTION: int cpCollideShapes ( cpShape* a, cpShape* b, cpContact** arr ) ;
-
-! cpConstraint.h
-
-C-TYPE: cpConstraintClass
-C-TYPE: cpConstraint
-
-CALLBACK: void cpConstraintPreStepFunction ( cpConstraint* constraint, cpFloat dt, cpFloat dt_inv ) ;
-CALLBACK: void cpConstraintApplyImpulseFunction ( cpConstraint* constraint ) ;
-CALLBACK: cpFloat cpConstraintGetImpulseFunction ( cpConstraint* constraint ) ;
-
-STRUCT: cpConstraintClass
-    { preStep      cpConstraintPreStepFunction      }
-    { applyImpulse cpConstraintApplyImpulseFunction }
-    { getImpulse   cpConstraintGetImpulseFunction   } ;
-
-STRUCT: cpConstraint
-    { klass    cpConstraintClass* }
-    { a        cpBody*            }
-    { b        cpBody*            }
-    { maxForce cpFloat            }
-    { biasCoef cpFloat            }
-    { maxBias  cpFloat            }
-    { data     cpDataPointer      } ;
-
-FUNCTION: void cpConstraintDestroy ( cpConstraint* constraint ) ;
-FUNCTION: void cpConstraintFree ( cpConstraint* constraint ) ;
-FUNCTION: void cpConstraintCheckCast ( cpConstraint* constraint, cpConstraintClass* klass ) ;
-
-! cpPinJoint.h
-FUNCTION: cpConstraintClass* cpPinJointGetClass ( ) ;
-
-STRUCT: cpPinJoint
-    { constraint cpConstraint }
-    { anchr1     cpVect       }
-    { anchr2     cpVect       }
-    { dist       cpFloat      }
-    { r1         cpVect       }
-    { r2         cpVect       }
-    { n          cpVect       }
-    { nMass      cpFloat      }
-    { jnAcc      cpFloat      }
-    { jnMax      cpFloat      }
-    { bias       cpFloat      } ;
-
-FUNCTION: cpPinJoint* cpPinJointAlloc ( ) ;
-FUNCTION: cpPinJoint* cpPinJointInit ( cpPinJoint* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
-FUNCTION: cpConstraint* cpPinJointNew ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
-
-! cpSlideJoint.h
-FUNCTION: cpConstraintClass* cpSlideJointGetClass ( ) ;
-
-STRUCT: cpSlideJoint
-    { constraint cpConstraint }
-    { anchr1     cpVect       }
-    { anchr2     cpVect       }
-    { min        cpFloat      }
-    { max        cpFloat      }
-    { r1         cpVect       }
-    { r2         cpVect       }
-    { n          cpVect       }
-    { nMass      cpFloat      }
-    { jnAcc      cpFloat      }
-    { jnMax      cpFloat      }
-    { bias       cpFloat      } ;
-
-FUNCTION: cpSlideJoint* cpSlideJointAlloc ( ) ;
-FUNCTION: cpSlideJoint* cpSlideJointInit ( cpSlideJoint* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max ) ;
-FUNCTION: cpConstraint* cpSlideJointNew ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max ) ;
-
-! cpPivotJoint.h
-FUNCTION: cpConstraintClass* cpPivotJointGetClass ( ) ;
-
-STRUCT: cpPivotJoint
-    { constraint cpConstraint }
-    { anchr1     cpVect       }
-    { anchr2     cpVect       }
-    { r1         cpVect       }
-    { r2         cpVect       }
-    { k1         cpVect       }
-    { k2         cpVect       }
-    { jAcc       cpVect       }
-    { jMaxLen    cpFloat      }
-    { bias       cpVect       } ;
-
-FUNCTION: cpPivotJoint* cpPivotJointAlloc ( ) ;
-FUNCTION: cpPivotJoint* cpPivotJointInit ( cpPivotJoint* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
-FUNCTION: cpConstraint* cpPivotJointNew ( cpBody* a, cpBody* b, cpVect pivot ) ;
-FUNCTION: cpConstraint* cpPivotJointNew2 ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
-
-! cpGrooveJoint.h
-FUNCTION: cpConstraintClass* cpGrooveJointGetClass ( ) ;
-
-STRUCT: cpGrooveJoint
-    { constraint   cpConstraint   }
-    { grv_n        cpVect         }
-    { grv_a        cpVect         }
-    { grv_b        cpVect         }
-    { anchr2       cpVect         }
-    { grv_tn       cpVect         }
-    { clamp        cpFloat        }
-    { r1           cpVect         }
-    { r2           cpVect         }
-    { k1           cpVect         }
-    { k2           cpVect         }
-    { jAcc         cpVect         }
-    { jMaxLen      cpFloat        }
-    { bias         cpVect         } ;
-
-FUNCTION: cpGrooveJoint* cpGrooveJointAlloc ( ) ;
-FUNCTION: cpGrooveJoint* cpGrooveJointInit ( cpGrooveJoint* joint, cpBody* a, cpBody* b, cpVect groove_a, cpVect groove_b, cpVect anchr2 ) ;
-FUNCTION: cpConstraint* cpGrooveJointNew ( cpBody* a, cpBody* b, cpVect groove_a, cpVect groove_b, cpVect anchr2 ) ;
-
-! cpDampedSpring.h
-CALLBACK: cpFloat cpDampedSpringForceFunc ( cpConstraint* spring, cpFloat dist ) ;
-FUNCTION: cpConstraintClass* cpDampedSpringGetClass ( ) ;
-
-STRUCT: cpDampedSpring
-    { constraint      cpConstraint            }
-    { anchr1          cpVect                  }
-    { anchr2          cpVect                  }
-    { restLength      cpFloat                 }
-    { stiffness       cpFloat                 }
-    { damping         cpFloat                 }
-    { springForceFunc cpDampedSpringForceFunc }
-    { dt              cpFloat                 }
-    { target_vrn      cpFloat                 }
-    { r1              cpVect                  }
-    { r2              cpVect                  }
-    { nMass           cpFloat                 }
-    { n               cpVect                  } ;
-
-FUNCTION: cpDampedSpring* cpDampedSpringAlloc ( ) ;
-FUNCTION: cpDampedSpring* cpDampedSpringInit ( cpDampedSpring* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping ) ;
-FUNCTION: cpConstraint* cpDampedSpringNew ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping ) ;
-
-! cpDampedRotarySpring.h
-CALLBACK: cpFloat cpDampedRotarySpringTorqueFunc ( cpConstraint* spring, cpFloat relativeAngle ) ;
-FUNCTION: cpConstraintClass* cpDampedRotarySpringGetClass ( ) ;
-
-STRUCT: cpDampedRotarySpring
-    { constraint       cpConstraint                   }
-    { restAngle        cpFloat                        }
-    { stiffness        cpFloat                        }
-    { damping          cpFloat                        }
-    { springTorqueFunc cpDampedRotarySpringTorqueFunc }
-    { dt               cpFloat                        }
-    { target_wrn       cpFloat                        }
-    { iSum             cpFloat                        } ;
-
-FUNCTION: cpDampedRotarySpring* cpDampedRotarySpringAlloc ( ) ;
-FUNCTION: cpDampedRotarySpring* cpDampedRotarySpringInit ( cpDampedRotarySpring* joint, cpBody* a, cpBody* b, cpFloat restAngle, cpFloat stiffness, cpFloat damping ) ;
-FUNCTION: cpConstraint* cpDampedRotarySpringNew ( cpBody* a, cpBody* b, cpFloat restAngle, cpFloat stiffness, cpFloat damping ) ;
-
-! cpRotaryLimitJoint.h
-FUNCTION: cpConstraintClass* cpRotaryLimitJointGetClass ( ) ;
-
-STRUCT: cpRotaryLimitJoint
-    { constraint cpConstraint   }
-    { min        cpFloat        }
-    { max        cpFloat        }
-    { iSum       cpFloat        }
-    { bias       cpFloat        }
-    { jAcc       cpFloat        }
-    { jMax       cpFloat        } ;
-
-FUNCTION: cpRotaryLimitJoint* cpRotaryLimitJointAlloc ( ) ;
-FUNCTION: cpRotaryLimitJoint* cpRotaryLimitJointInit ( cpRotaryLimitJoint* joint, cpBody* a, cpBody* b, cpFloat min, cpFloat max ) ;
-FUNCTION: cpConstraint* cpRotaryLimitJointNew ( cpBody* a, cpBody* b, cpFloat min, cpFloat max ) ;
-
-! cpRatchetJoint.h
-FUNCTION: cpConstraintClass* cpRatchetJointGetClass ( ) ;
-
-STRUCT: cpRatchetJoint
-    { constraint cpConstraint }
-    { angle      cpFloat      }
-    { phase      cpFloat      }
-    { ratchet    cpFloat      }
-    { iSum       cpFloat      }
-    { bias       cpFloat      }
-    { jAcc       cpFloat      }
-    { jMax       cpFloat      } ;
-
-FUNCTION: cpRatchetJoint* cpRatchetJointAlloc ( ) ;
-FUNCTION: cpRatchetJoint* cpRatchetJointInit ( cpRatchetJoint* joint, cpBody* a, cpBody* b, cpFloat phase, cpFloat ratchet ) ;
-FUNCTION: cpConstraint* cpRatchetJointNew ( cpBody* a, cpBody* b, cpFloat phase, cpFloat ratchet ) ;
-
-! cpGearJoint.h
-FUNCTION: cpConstraintClass* cpGearJointGetClass ( ) ;
-
-STRUCT: cpGearJoint
-    { constraint cpConstraint }
-    { phase      cpFloat      }
-    { ratio      cpFloat      }
-    { ratio_inv  cpFloat      }
-    { iSum       cpFloat      }
-    { bias       cpFloat      }
-    { jAcc       cpFloat      }
-    { jMax       cpFloat      } ;
-
-FUNCTION: cpGearJoint* cpGearJointAlloc ( ) ;
-FUNCTION: cpGearJoint* cpGearJointInit ( cpGearJoint* joint, cpBody* a, cpBody* b, cpFloat phase, cpFloat ratio ) ;
-FUNCTION: cpConstraint* cpGearJointNew ( cpBody* a, cpBody* b, cpFloat phase, cpFloat ratio ) ;
-FUNCTION: void cpGearJointSetRatio ( cpConstraint* constraint, cpFloat value ) ;
-
-! cpSimpleMotor.h
-FUNCTION: cpConstraintClass* cpSimpleMotorGetClass ( ) ;
-
-STRUCT: cpSimpleMotor
-    { constraint cpConstraint }
-    { rate       cpFloat      }
-    { iSum       cpFloat      }
-    { jAcc       cpFloat      }
-    { jMax       cpFloat      } ;
-
-FUNCTION: cpSimpleMotor* cpSimpleMotorAlloc ( ) ;
-FUNCTION: cpSimpleMotor* cpSimpleMotorInit ( cpSimpleMotor* joint, cpBody* a, cpBody* b, cpFloat rate ) ;
-FUNCTION: cpConstraint* cpSimpleMotorNew ( cpBody* a, cpBody* b, cpFloat rate ) ;
-
-! cpSpace.h
-C-TYPE: cpSpace
-
-CALLBACK: int cpCollisionBeginFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
-CALLBACK: int cpCollisionPreSolveFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
-CALLBACK: void cpCollisionPostSolveFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
-CALLBACK: void cpCollisionSeparateFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
-
-STRUCT: cpCollisionHandler
-    { a         cpCollisionType          }
-    { b         cpCollisionType          }
-    { begin     cpCollisionBeginFunc     }
-    { preSolve  cpCollisionPreSolveFunc  }
-    { postSolve cpCollisionPostSolveFunc }
-    { separate  cpCollisionSeparateFunc  }
-    { data      void*                    } ;
-
-STRUCT: cpSpace
-    { iterations        int                }
-    { elasticIterations int                }
-    { gravity           cpVect             }
-    { damping           cpFloat            }
-    { stamp             int                }
-    { staticShapes      cpSpaceHash*       }
-    { activeShapes      cpSpaceHash*       }
-    { bodies            cpArray*           }
-    { arbiters          cpArray*           }
-    { contactSet        cpHashSet*         }
-    { constraints       cpArray*           }
-    { collFuncSet       cpHashSet*         }
-    { defaultHandler    cpCollisionHandler }
-    { postStepCallbacks cpHashSet*         } ;
-
-FUNCTION: cpSpace* cpSpaceAlloc ( ) ;
-FUNCTION: cpSpace* cpSpaceInit ( cpSpace* space ) ;
-FUNCTION: cpSpace* cpSpaceNew ( ) ;
-FUNCTION: void cpSpaceDestroy ( cpSpace* space ) ;
-FUNCTION: void cpSpaceFree ( cpSpace* space ) ;
-FUNCTION: void cpSpaceFreeChildren ( cpSpace* space ) ;
-FUNCTION: void cpSpaceSetDefaultCollisionHandler (
-    cpSpace*                 space,
-    cpCollisionBeginFunc     begin,
-    cpCollisionPreSolveFunc  preSolve,
-    cpCollisionPostSolveFunc postSolve,
-    cpCollisionSeparateFunc  separate,
-    void*                    data ) ;
-FUNCTION: void cpSpaceAddCollisionHandler (
-    cpSpace*                 space,
-    cpCollisionType          a,
-    cpCollisionType          b,
-    cpCollisionBeginFunc     begin,
-    cpCollisionPreSolveFunc  preSolve,
-    cpCollisionPostSolveFunc postSolve,
-    cpCollisionSeparateFunc  separate,
-    void*                    data ) ;
-FUNCTION: void cpSpaceRemoveCollisionHandler ( cpSpace* space, cpCollisionType a, cpCollisionType b ) ;
-FUNCTION: cpShape* cpSpaceAddShape ( cpSpace* space, cpShape* shape ) ;
-FUNCTION: cpShape* cpSpaceAddStaticShape ( cpSpace* space, cpShape* shape ) ;
-FUNCTION: cpBody* cpSpaceAddBody ( cpSpace* space, cpBody* body ) ;
-FUNCTION: cpConstraint* cpSpaceAddConstraint ( cpSpace* space, cpConstraint* constraint ) ;
-FUNCTION: void cpSpaceRemoveShape ( cpSpace* space, cpShape* shape ) ;
-FUNCTION: void cpSpaceRemoveStaticShape ( cpSpace* space, cpShape* shape ) ;
-FUNCTION: void cpSpaceRemoveBody ( cpSpace* space, cpBody* body ) ;
-FUNCTION: void cpSpaceRemoveConstraint ( cpSpace* space, cpConstraint* constraint ) ;
-CALLBACK: void cpPostStepFunc ( cpSpace* space, void* obj, void* data ) ;
-FUNCTION: void cpSpaceAddPostStepCallback ( cpSpace* space, cpPostStepFunc func, void* obj, void* data ) ;
-CALLBACK: void cpSpacePointQueryFunc ( cpShape* shape, void* data ) ;
-FUNCTION: void cpSpacePointQuery ( cpSpace* space, cpVect point, cpLayers layers, cpGroup group, cpSpacePointQueryFunc func, void* data ) ;
-FUNCTION: cpShape* cpSpacePointQueryFirst ( cpSpace* space, cpVect point, cpLayers layers, cpGroup group ) ;
-CALLBACK: void cpSpaceSegmentQueryFunc ( cpShape* shape, cpFloat t, cpVect n, void* data ) ;
-FUNCTION: int cpSpaceSegmentQuery ( cpSpace* space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSpaceSegmentQueryFunc func, void* data ) ;
-FUNCTION: cpShape* cpSpaceSegmentQueryFirst ( cpSpace* space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSegmentQueryInfo* out ) ;
-CALLBACK: void cpSpaceBBQueryFunc ( cpShape* shape, void* data ) ;
-FUNCTION: void cpSpaceBBQuery ( cpSpace* space, cpBB bb, cpLayers layers, cpGroup group, cpSpaceBBQueryFunc func, void* data ) ;
-CALLBACK: void cpSpaceBodyIterator ( cpBody* body, void* data ) ;
-FUNCTION: void cpSpaceEachBody ( cpSpace* space, cpSpaceBodyIterator func, void* data ) ;
-FUNCTION: void cpSpaceResizeStaticHash ( cpSpace* space, cpFloat dim, int count ) ;
-FUNCTION: void cpSpaceResizeActiveHash ( cpSpace* space, cpFloat dim, int count ) ;
-FUNCTION: void cpSpaceRehashStatic ( cpSpace* space ) ;
-FUNCTION: void cpSpaceStep ( cpSpace* space, cpFloat dt ) ;
-
-! chipmunk.h
-FUNCTION: void cpInitChipmunk ( ) ;
-FUNCTION: cpFloat cpMomentForCircle ( cpFloat m, cpFloat r1, cpFloat r2, cpVect offset ) ;
-FUNCTION: cpFloat cpMomentForSegment ( cpFloat m, cpVect a, cpVect b ) ;
-FUNCTION: cpFloat cpMomentForPoly ( cpFloat m, int numVerts, cpVect* verts, cpVect offset ) ;
-
index 06f3c32dbe330802dd48e0450b6ae26c1b65c1cc..7d11b116fbfb04155c2998a16e958ae6d986fd50 100644 (file)
@@ -1,9 +1,10 @@
 ! Copyright (C) 2010 Erik Charlebois
 ! See http:// factorcode.org/license.txt for BSD license.
-USING: accessors chipmunk classes.struct game.worlds kernel locals
-math method-chains opengl.gl random sequences specialized-arrays
-specialized-arrays.instances.alien.c-types.void* ui ui.gadgets.worlds
+USING: accessors alien chipmunk.ffi classes.struct game.loop
+game.worlds kernel literals locals math method-chains opengl.gl
+random sequences specialized-arrays ui ui.gadgets.worlds
 ui.pixel-formats ;
+SPECIALIZED-ARRAY: void*
 IN: chipmunk.demo
 
 CONSTANT: image-width      188
@@ -50,10 +51,13 @@ CONSTANT: image-bitmap B{
     x bitnot 7 bitand neg shift 1 bitand 1 = ;
 
 :: make-ball ( x y -- shape )
-    cpBodyAlloc 1.0 NAN: 0 cpBodyInit cpBody memory>struct
+    cpBodyAlloc 1.0 NAN: 0 cpBodyInit
     x y cpv >>p :> body
-    cpCircleShapeAlloc body 0.95 0 0 cpv cpCircleShapeInit cpCircleShape memory>struct
-    [ shape>> 0 >>e ] [ shape>> 0 >>u ] bi drop ;
+    cpCircleShapeAlloc body 0.95 0 0 cpv cpCircleShapeInit
+    dup shape>>
+        0 >>e
+        0 >>u
+        drop ;
 
 TUPLE: chipmunk-world < game-world
     space ;
@@ -76,7 +80,7 @@ M:: chipmunk-world draw-world* ( world -- )
     3 glPointSize
     0 0 0 glColor3f
     GL_POINTS glBegin
-    space bodies>> cpArray memory>struct
+    space bodies>>
     [ num>> ] [ arr>> swap <direct-void*-array> ] bi [
         cpBody memory>struct p>> [ x>> ] [ y>> ] bi glVertex2f
     ] each
@@ -85,10 +89,10 @@ M:: chipmunk-world draw-world* ( world -- )
     2 glPointSize
     1 0 0 glColor3f
     GL_POINTS glBegin
-    space arbiters>> cpArray memory>struct
+    space arbiters>>
     [ num>> ] [ arr>> swap <direct-void*-array> ] bi [
         cpArbiter memory>struct
-        [ numContacts>> ] [ contacts>> swap <direct-cpContact-array> ] bi [
+        [ numContacts>> ] [ contacts>> >c-ptr swap <direct-cpContact-array> ] bi [
             p>> [ x>> ] [ y>> ] bi glVertex2f
         ] each
     ] each
@@ -97,7 +101,7 @@ M:: chipmunk-world draw-world* ( world -- )
 M:: chipmunk-world begin-game-world ( world -- )
     cpInitChipmunk
 
-    cpSpaceAlloc cpSpaceInit cpSpace memory>struct :> space
+    cpSpaceAlloc cpSpaceInit :> space
 
     world space >>space drop
     space 2.0 10000 cpSpaceResizeActiveHash
@@ -109,20 +113,22 @@ M:: chipmunk-world begin-game-world ( world -- )
                 x image-width 2 / - 0.05 0.0 1.0 uniform-random-float * + 2 *
                 image-height 2 / y - 0.05 0.0 1.0 uniform-random-float * + 2 *
                 make-ball :> shape
-                space shape body>> cpSpaceAddBody drop
+                space shape shape>> body>> cpSpaceAddBody drop
                 space shape cpSpaceAddShape drop
             ] when
         ] each
     ] each
     
-    space cpBodyAlloc NAN: 0 dup cpBodyInit cpSpaceAddBody cpBody memory>struct :> body
+    space cpBodyAlloc NAN: 0 dup cpBodyInit cpSpaceAddBody :> body
     body -1000 -10 cpv >>p drop
     body 400 0 cpv >>v drop
 
-    space cpCircleShapeAlloc body 8 0 0 cpv cpCircleShapeInit cpSpaceAddShape cpCircleShape memory>struct :> shape
-    shape
-    [ shape>> 0 >>e drop ]
-    [ shape>> 0 >>u drop ] bi ;
+    space cpCircleShapeAlloc [ body 8 0 0 cpv cpCircleShapeInit cpSpaceAddShape drop ] keep
+        :> shape
+    shape shape>>
+        0 >>e
+        0 >>u
+        drop ;
 
 M: chipmunk-world end-game-world
     space>>
@@ -139,9 +145,10 @@ M: chipmunk-world end-game-world
              { windowed double-buffered }
            }
            { pref-dim { 640 480 } }
-           { tick-interval-micros 16666 }
+           { tick-interval-nanos $[ 60 fps ] }
         }
         clone
         open-window
     ] with-ui ;
 
+MAIN: chipmunk-demo
diff --git a/extra/chipmunk/ffi/ffi.factor b/extra/chipmunk/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..ea7c6fb
--- /dev/null
@@ -0,0 +1,848 @@
+! Copyright (C) 2010 Erik Charlebois
+! See http:// factorcode.org/license.txt for BSD license.
+USING: accessors alien alien.c-types alien.libraries
+alien.syntax classes.struct combinators combinators.short-circuit
+kernel math math.order sequences typed specialized-arrays locals
+system ;
+SPECIALIZED-ARRAY: void*
+IN: chipmunk.ffi
+
+<<
+"chipmunk" {
+    { [ os windows? ] [ "chipmunk.dll" ] }
+    { [ os macosx? ] [ "libchipmunk.dylib"  ] }
+    { [ os unix?  ] [ "libchipmunk.so" ] }
+} cond cdecl add-library
+
+"chipmunk" deploy-library
+>>
+LIBRARY: chipmunk
+
+! chipmunk_types.h
+TYPEDEF: double cpFloat
+STRUCT: cpVect
+    { x cpFloat }
+    { y cpFloat } ;
+SPECIALIZED-ARRAY: cpVect
+
+TYPEDEF: uint cpHashValue
+TYPEDEF: void* cpDataPointer
+TYPEDEF: uint cpCollisionType
+TYPEDEF: uint cpLayers
+TYPEDEF: uint cpGroup
+
+CONSTANT: CP_NO_GROUP 0
+CONSTANT: CP_ALL_LAYERS HEX: ffffffff
+
+! cpVect.h
+TYPED: cpv ( x y -- v: cpVect )
+    cpVect <struct-boa> ; inline
+
+TYPED: cpvzero ( -- v: cpVect )
+    0.0 0.0 cpv ; inline
+
+FUNCTION: cpFloat cpvlength ( cpVect v ) ;
+FUNCTION: cpVect cpvslerp ( cpVect v1, cpVect v2, cpFloat t ) ;
+FUNCTION: cpVect cpvslerpconst ( cpVect v1, cpVect v2, cpFloat a ) ;
+FUNCTION: cpVect cpvforangle ( cpFloat a ) ;
+FUNCTION: cpFloat cpvtoangle ( cpVect v ) ;
+FUNCTION: c-string cpvstr ( cpVect v ) ;
+
+TYPED: cpvadd ( v1: cpVect v2: cpVect -- v3: cpVect )
+    [ [ x>> ] bi@ + ]
+    [ [ y>> ] bi@ + ] 2bi cpv ; inline
+
+TYPED: cpvneg ( v1: cpVect -- v2: cpVect )
+    [ x>> ] [ y>> ] bi [ neg ] bi@ cpv ; inline
+
+TYPED: cpvsub ( v1: cpVect v2: cpVect -- v3: cpVect )
+    [ [ x>> ] bi@ - ]
+    [ [ y>> ] bi@ - ] 2bi cpv ; inline
+
+TYPED: cpvmult ( v1: cpVect s -- v2: cpVect )
+    [ swap x>> * ]
+    [ swap y>> * ] 2bi cpv ; inline
+
+TYPED: cpvdot ( v1: cpVect v2: cpVect -- s )
+    [ [ x>> ] bi@ * ]
+    [ [ y>> ] bi@ * ] 2bi + ; inline
+
+TYPED: cpvcross ( v1: cpVect v2: cpVect -- s )
+    [ [ x>> ] [ y>> ] bi* * ]
+    [ [ y>> ] [ x>> ] bi* * ] 2bi - ; inline
+
+TYPED: cpvperp ( v1: cpVect -- v2: cpVect )
+    [ y>> neg ] [ x>> ] bi cpv ; inline
+
+TYPED: cpvrperp ( v1: cpVect -- v2: cpVect )
+    [ y>> ] [ x>> neg ] bi cpv ; inline
+
+TYPED: cpvproject ( v1: cpVect v2: cpVect -- v3: cpVect )
+    [ nip ]
+    [ cpvdot ]
+    [ nip dup cpvdot ]
+    2tri / cpvmult ; inline
+
+TYPED: cpvrotate ( v1: cpVect v2: cpVect -- v3: cpVect )
+    [
+        [ [ x>> ] bi@ * ]
+        [ [ y>> ] bi@ * ] 2bi -
+    ]
+    [
+        [ [ x>> ] [ y>> ] bi* * ]
+        [ [ y>> ] [ x>> ] bi* * ] 2bi +
+    ] 2bi cpv ; inline
+
+TYPED: cpvunrotate ( v1: cpVect v2: cpVect -- v3: cpVect )
+    [
+        [ [ x>> ] bi@ * ]
+        [ [ y>> ] bi@ * ] 2bi +
+    ]
+    [
+        [ [ y>> ] [ x>> ] bi* * ]
+        [ [ x>> ] [ y>> ] bi* * ] 2bi -
+    ] 2bi cpv ; inline
+
+TYPED: cpvlengthsq ( v: cpVect -- s )
+    dup cpvdot ; inline
+
+TYPED: cpvlerp ( v1: cpVect v2: cpVect s -- v3: cpVect )
+    [ nip 1.0 swap - cpvmult ]
+    [ cpvmult nip ] 3bi cpvadd ; inline
+
+TYPED: cpvnormalize ( v1: cpVect -- v2: cpVect )
+    dup cpvlength 1.0 swap / cpvmult ; inline
+
+TYPED: cpvnormalize_safe ( v1: cpVect -- v2: cpVect )
+    dup [ x>> 0.0 = ] [ y>> 0.0 = ] bi and
+    [ drop cpvzero ]
+    [ cpvnormalize ] if ; inline
+
+TYPED: cpvclamp ( v1: cpVect len -- v2: cpVect )
+    2dup
+    [ dup cpvdot ]
+    [ sq ] 2bi* >
+    [ [ cpvnormalize ] dip cpvmult ]
+    [ drop ] if ; inline
+
+TYPED: cpvlerpconst ( v1: cpVect v2: cpVect d -- v3: cpVect )
+    [ 2drop ]
+    [ [ swap cpvsub ] dip cpvclamp ] 3bi cpvadd ; inline
+
+TYPED: cpvdist ( v1: cpVect v2: cpVect -- dist )
+    cpvsub cpvlength ; inline
+
+TYPED: cpvdistsq ( v1: cpVect v2: cpVect -- distsq )
+    cpvsub cpvlengthsq ; inline
+
+TYPED: cpvnear ( v1: cpVect v2: cpVect dist -- ? )
+    [ cpvdistsq ] dip sq < ; inline
+
+! cpBB.h
+STRUCT: cpBB
+    { l cpFloat }
+    { b cpFloat }
+    { r cpFloat }
+    { t cpFloat } ;
+
+TYPED: cpBBNew ( l b r t -- cpbb: cpBB )
+    cpBB <struct-boa> ; inline
+
+TYPED: cpBBintersects ( a: cpBB b: cpBB -- ? )
+    {
+        [ [ l>> ] [ r>> ] bi* <= ]
+        [ [ r>> ] [ l>> ] bi*  > ]
+        [ [ b>> ] [ t>> ] bi* <= ]
+        [ [ t>> ] [ b>> ] bi*  > ]
+    } 2&& ; inline
+
+TYPED: cpBBcontainsBB ( bb: cpBB other: cpBB -- ? )
+    {
+        [ [ l>> ] bi@ < ]
+        [ [ r>> ] bi@ > ]
+        [ [ b>> ] bi@ < ]
+        [ [ t>> ] bi@ > ]
+    } 2&& ; inline
+
+TYPED: cpBBcontainsVect ( bb: cpBB v: cpVect -- ? )
+    {
+        [ [ l>> ] [ x>> ] bi* < ]
+        [ [ r>> ] [ x>> ] bi* > ]
+        [ [ b>> ] [ y>> ] bi* < ]
+        [ [ t>> ] [ y>> ] bi* > ]
+    } 2&& ; inline
+
+TYPED: cpBBmerge ( a: cpBB b: cpBB -- c: cpBB )
+    {
+        [ [ l>> ] bi@ min ]
+        [ [ b>> ] bi@ min ]
+        [ [ r>> ] bi@ max ]
+        [ [ t>> ] bi@ max ]
+    } 2cleave cpBBNew ; inline
+
+TYPED: cpBBexpand ( bb: cpBB v: cpVect -- b: cpBB )
+    {
+        [ [ l>> ] [ x>> ] bi* min ]
+        [ [ b>> ] [ y>> ] bi* min ]
+        [ [ r>> ] [ x>> ] bi* max ]
+        [ [ t>> ] [ y>> ] bi* max ]
+    } 2cleave cpBBNew ; inline
+
+FUNCTION: cpVect cpBBClampVect ( cpBB bb, cpVect v ) ;
+FUNCTION: cpVect cpBBWrapVect ( cpBB bb, cpVect v ) ;
+
+! cpBody.h
+C-TYPE: cpBody
+CALLBACK: void cpBodyVelocityFunc ( cpBody* body, cpVect gravity, cpFloat damping, cpFloat dt ) ;
+CALLBACK: void cpBodyPositionFunc ( cpBody* body, cpFloat dt ) ;
+
+STRUCT: cpBody
+    { velocity_func cpBodyVelocityFunc }
+    { position_func cpBodyPositionFunc }
+    { m             cpFloat            }
+    { m_inv         cpFloat            }
+    { i             cpFloat            }
+    { i_inv         cpFloat            }
+    { p             cpVect             }
+    { v             cpVect             }
+    { f             cpVect             }
+    { a             cpFloat            }
+    { w             cpFloat            }
+    { t             cpFloat            }
+    { rot           cpVect             }
+    { data          cpDataPointer      }
+    { v_limit       cpFloat            }
+    { w_limit       cpFloat            }
+    { v_bias        cpVect             }
+    { w_bias        cpFloat            } ;
+
+FUNCTION: cpBody* cpBodyAlloc ( ) ;
+FUNCTION: cpBody* cpBodyInit ( cpBody* body, cpFloat m, cpFloat i ) ;
+FUNCTION: cpBody* cpBodyNew ( cpFloat m, cpFloat i ) ;
+FUNCTION: void cpBodyDestroy ( cpBody* body ) ;
+FUNCTION: void cpBodyFree ( cpBody* body ) ;
+FUNCTION: void cpBodySetMass ( cpBody* body, cpFloat m ) ;
+FUNCTION: void cpBodySetMoment ( cpBody* body, cpFloat i ) ;
+FUNCTION: void cpBodySetAngle ( cpBody* body, cpFloat a ) ;
+FUNCTION: void cpBodySlew ( cpBody* body, cpVect pos, cpFloat dt ) ;
+FUNCTION: void cpBodyUpdateVelocity ( cpBody* body, cpVect gravity, cpFloat damping, cpFloat dt ) ;
+FUNCTION: void cpBodyUpdatePosition ( cpBody* body, cpFloat dt ) ;
+
+TYPED: cpBodyLocal2World ( body: cpBody v: cpVect -- v2: cpVect )
+    [ drop p>> ]
+    [ swap rot>> cpvrotate ] 2bi cpvadd ; inline
+
+TYPED: cpBodyWorld2Local ( body: cpBody v: cpVect -- v2: cpVect )
+    [ swap p>> cpvsub ]
+    [ drop rot>> ] 2bi cpvunrotate ; inline
+
+TYPED: cpBodyApplyImpulse ( body: cpBody j: cpVect r: cpVect -- )
+    [
+        drop
+        [ drop dup v>> ]
+        [ swap m_inv>> cpvmult ] 2bi cpvadd >>v drop
+    ]
+    [
+        [ 2drop dup w_bias>> ]
+        [ swap cpvcross [ i_inv>> ] dip * ] 3bi + >>w_bias drop
+    ] 3bi ; inline
+
+FUNCTION: void cpBodyResetForces ( cpBody* body ) ;
+FUNCTION: void cpBodyApplyForce ( cpBody* body, cpVect f, cpVect r ) ;
+FUNCTION: void cpApplyDampedSpring ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat rlen, cpFloat k, cpFloat dmp, cpFloat dt ) ;
+
+! cpArray.h
+STRUCT: cpArray
+    { num int    }
+    { max int    }
+    { arr void** } ;
+
+CALLBACK: void cpArrayIter ( void* ptr, void* data ) ;
+
+FUNCTION: cpArray* cpArrayAlloc ( ) ;
+FUNCTION: cpArray* cpArrayInit ( cpArray* arr, int size ) ;
+FUNCTION: cpArray* cpArrayNew ( int size ) ;
+FUNCTION: void cpArrayDestroy ( cpArray* arr ) ;
+FUNCTION: void cpArrayFree ( cpArray* arr ) ;
+FUNCTION: void cpArrayPush ( cpArray* arr, void* object ) ;
+FUNCTION: void cpArrayDeleteIndex ( cpArray* arr, int idx ) ;
+FUNCTION: void cpArrayDeleteObj ( cpArray* arr, void* obj ) ;
+FUNCTION: void cpArrayEach ( cpArray* arr, cpArrayIter iterFunc, void* data ) ;
+FUNCTION: int cpArrayContains ( cpArray* arr, void* ptr ) ;
+
+! cpHashSet.h
+STRUCT: cpHashSetBin
+    { elt  void*         }
+    { hash cpHashValue   }
+    { next cpHashSetBin* } ;
+
+CALLBACK: int cpHashSetEqlFunc ( void* ptr, void* elt ) ;
+CALLBACK: void* cpHashSetTransFunc ( void* ptr, void* data ) ;
+CALLBACK: void cpHashSetIterFunc ( void* elt, void* data ) ;
+CALLBACK: int cpHashSetFilterFunc ( void* elt, void* data ) ;
+
+STRUCT: cpHashSet
+    { entries       int                }
+    { size          int                }
+    { eql           cpHashSetEqlFunc   }
+    { trans         cpHashSetTransFunc }
+    { default_value void*              }
+    { table         cpHashSetBin**     } ;
+
+FUNCTION: void cpHashSetDestroy ( cpHashSet* set ) ;
+FUNCTION: void cpHashSetFree ( cpHashSet* set ) ;
+FUNCTION: cpHashSet* cpHashSetAlloc ( ) ;
+FUNCTION: cpHashSet* cpHashSetInit ( cpHashSet* set, int size, cpHashSetEqlFunc eqlFunc, cpHashSetTransFunc trans ) ;
+FUNCTION: cpHashSet* cpHashSetNew ( int size, cpHashSetEqlFunc eqlFunc, cpHashSetTransFunc trans ) ;
+FUNCTION: void* cpHashSetInsert ( cpHashSet* set, cpHashValue hash, void* ptr, void* data ) ;
+FUNCTION: void* cpHashSetRemove ( cpHashSet* set, cpHashValue hash, void* ptr ) ;
+FUNCTION: void* cpHashSetFind ( cpHashSet* set, cpHashValue hash, void* ptr ) ;
+FUNCTION: void cpHashSetEach ( cpHashSet* set, cpHashSetIterFunc func, void* data ) ;
+FUNCTION: void cpHashSetFilter ( cpHashSet* set, cpHashSetFilterFunc func, void* data ) ;
+
+! cpSpaceHash.h
+STRUCT: cpHandle
+    { obj    void* }
+    { retain int   }
+    { stamp  int   } ;
+
+STRUCT: cpSpaceHashBin
+    { handle cpHandle*       }
+    { next   cpSpaceHashBin* } ;
+
+CALLBACK: cpBB cpSpaceHashBBFunc ( void* obj ) ;
+
+STRUCT: cpSpaceHash
+    { numcells  int               }
+    { celldim   cpFloat           }
+    { bbfunc    cpSpaceHashBBFunc }
+    { handleSet cpHashSet*        }
+    { table     cpSpaceHashBin**  }
+    { bins      cpSpaceHashBin*   }
+    { stamp     int               } ;
+
+FUNCTION: cpSpaceHash* cpSpaceHashAlloc ( ) ;
+FUNCTION: cpSpaceHash* cpSpaceHashInit ( cpSpaceHash* hash, cpFloat celldim, int cells, cpSpaceHashBBFunc bbfunc ) ;
+FUNCTION: cpSpaceHash* cpSpaceHashNew ( cpFloat celldim, int cells, cpSpaceHashBBFunc bbfunc ) ;
+FUNCTION: void cpSpaceHashDestroy ( cpSpaceHash* hash ) ;
+FUNCTION: void cpSpaceHashFree ( cpSpaceHash* hash ) ;
+FUNCTION: void cpSpaceHashResize ( cpSpaceHash* hash, cpFloat celldim, int numcells ) ;
+FUNCTION: void cpSpaceHashInsert ( cpSpaceHash* hash, void* obj, cpHashValue id, cpBB bb ) ;
+FUNCTION: void cpSpaceHashRemove ( cpSpaceHash* hash, void* obj, cpHashValue id ) ;
+CALLBACK: void cpSpaceHashIterator ( void* obj, void* data ) ;
+FUNCTION: void cpSpaceHashEach ( cpSpaceHash* hash, cpSpaceHashIterator func, void* data ) ;
+FUNCTION: void cpSpaceHashRehash ( cpSpaceHash* hash ) ;
+FUNCTION: void cpSpaceHashRehashObject ( cpSpaceHash* hash, void* obj, cpHashValue id ) ;
+CALLBACK: void cpSpaceHashQueryFunc ( void* obj1, void* obj2, void* data ) ;
+FUNCTION: void cpSpaceHashPointQuery ( cpSpaceHash* hash, cpVect point, cpSpaceHashQueryFunc func, void* data ) ;
+FUNCTION: void cpSpaceHashQuery ( cpSpaceHash* hash, void* obj, cpBB bb, cpSpaceHashQueryFunc func, void* data ) ;
+FUNCTION: void cpSpaceHashQueryRehash ( cpSpaceHash* hash, cpSpaceHashQueryFunc func, void* data ) ;
+CALLBACK: cpFloat cpSpaceHashSegmentQueryFunc ( void* obj1, void* obj2, void* data ) ;
+FUNCTION: void cpSpaceHashSegmentQuery ( cpSpaceHash* hash, void* obj, cpVect a, cpVect b, cpFloat t_exit, cpSpaceHashSegmentQueryFunc func, void* data ) ;
+
+! cpShape.h
+C-TYPE: cpShape
+C-TYPE: cpShapeClass
+
+STRUCT: cpSegmentQueryInfo
+    { shape cpShape* }
+    { t     cpFloat  }
+    { n     cpVect   } ;
+
+ENUM: cpShapeType
+    CP_CIRCLE_SHAPE
+    CP_SEGMENT_SHAPE
+    CP_POLY_SHAPE
+    CP_NUM_SHAPES ;
+
+CALLBACK: cpBB cacheData_cb ( cpShape* shape, cpVect p, cpVect rot ) ;
+CALLBACK: void destroy_cb ( cpShape* shape ) ;
+CALLBACK: int pointQuery_cb ( cpShape* shape, cpVect p ) ;
+CALLBACK: void segmentQuery_cb ( cpShape* shape, cpVect a, cpVect b, cpSegmentQueryInfo* info ) ;
+
+STRUCT: cpShapeClass
+    { type         cpShapeType     }
+    { cacheData    cacheData_cb    }
+    { destroy      destroy_cb      }
+    { pointQuery   pointQuery_cb   }
+    { segmentQuery segmentQuery_cb } ;
+
+STRUCT: cpShape
+    { klass          cpShapeClass*   }
+    { body           cpBody*         }
+    { bb             cpBB            }
+    { sensor         int             }
+    { e              cpFloat         }
+    { u              cpFloat         }
+    { surface_v      cpVect          }
+    { data           cpDataPointer   }
+    { collision_type cpCollisionType }
+    { group          cpGroup         }
+    { layers         cpLayers        }
+    { hashid         cpHashValue     } ;
+
+FUNCTION: cpShape* cpShapeInit ( cpShape* shape, cpShapeClass* klass, cpBody* body ) ;
+FUNCTION: void cpShapeDestroy ( cpShape* shape ) ;
+FUNCTION: void cpShapeFree ( cpShape* shape ) ;
+FUNCTION: cpBB cpShapeCacheBB ( cpShape* shape ) ;
+FUNCTION: int cpShapePointQuery ( cpShape* shape, cpVect p ) ;
+
+STRUCT: cpCircleShape
+    { shape cpShape }
+    { c     cpVect  }
+    { r     cpFloat }
+    { tc    cpVect  } ;
+
+FUNCTION: cpCircleShape* cpCircleShapeAlloc ( ) ;
+FUNCTION: cpCircleShape* cpCircleShapeInit ( cpCircleShape* circle, cpBody* body, cpFloat radius, cpVect offset ) ;
+FUNCTION: cpShape* cpCircleShapeNew ( cpBody* body, cpFloat radius, cpVect offset ) ;
+
+STRUCT: cpSegmentShape
+    { shape cpShape }
+    { a     cpVect  }
+    { b     cpVect  }
+    { n     cpVect  }
+    { r     cpFloat }
+    { ta    cpVect  }
+    { tb    cpVect  }
+    { tn    cpVect  } ;
+
+FUNCTION: cpSegmentShape* cpSegmentShapeAlloc ( ) ;
+FUNCTION: cpSegmentShape* cpSegmentShapeInit ( cpSegmentShape* seg, cpBody* body, cpVect a, cpVect b, cpFloat radius ) ;
+FUNCTION: cpShape* cpSegmentShapeNew ( cpBody* body, cpVect a, cpVect b, cpFloat radius ) ;
+FUNCTION: void cpResetShapeIdCounter ( ) ;
+FUNCTION: void cpSegmentQueryInfoPrint ( cpSegmentQueryInfo* info ) ;
+FUNCTION: int cpShapeSegmentQuery ( cpShape* shape, cpVect a, cpVect b, cpSegmentQueryInfo* info ) ;
+
+TYPED: cpSegmentQueryHitPoint ( start: cpVect end: cpVect info: cpSegmentQueryInfo -- hit-point: cpVect )
+    t>> cpvlerp ; inline
+
+TYPED: cpSegmentQueryHitDist ( start: cpVect end: cpVect info: cpSegmentQueryInfo -- hit-dist )
+    t>> [ cpvdist ] dip * ; inline
+
+! cpPolyShape.h
+STRUCT: cpPolyShapeAxis
+    { n cpVect  }
+    { d cpFloat } ;
+SPECIALIZED-ARRAY: cpPolyShapeAxis
+
+STRUCT: cpPolyShape
+    { shape    cpShape          }
+    { numVerts int              }
+    { verts    cpVect*          }
+    { axes     cpPolyShapeAxis* }
+    { tVerts   cpVect*          }
+    { tAxes    cpPolyShapeAxis* } ;
+
+FUNCTION: cpPolyShape* cpPolyShapeAlloc ( ) ;
+FUNCTION: cpPolyShape* cpPolyShapeInit ( cpPolyShape* poly, cpBody* body, int numVerts, cpVect* verts, cpVect offset ) ;
+FUNCTION: cpShape* cpPolyShapeNew ( cpBody* body, int numVerts, cpVect* verts, cpVect offset ) ;
+FUNCTION: int cpPolyValidate ( cpVect* verts, int numVerts ) ;
+FUNCTION: int cpPolyShapeGetNumVerts ( cpShape* shape ) ;
+FUNCTION: cpVect cpPolyShapeGetVert ( cpShape* shape, int idx ) ;
+
+TYPED: cpPolyShapeValueOnAxis ( poly: cpPolyShape n: cpVect d -- min-dist )
+    swap rot [ numVerts>> ] [ tVerts>> swap <direct-cpVect-array> ] bi swap
+    [ cpvdot ] curry [ min ] reduce swap - ; inline
+
+TYPED: cpPolyShapeContainsVert ( poly: cpPolyShape v: cpVect -- ? )
+    swap [ numVerts>> ] [ tAxes>> swap <direct-cpPolyShapeAxis-array> ] bi swap
+    [
+        [ [ n>> ] dip cpvdot ] [ drop d>> ] 2bi -
+    ] curry [ max ] reduce 0.0 <= ; inline
+
+TYPED: cpPolyShapeContainsVertPartial ( poly: cpPolyShape v: cpVect n: cpVect -- ? )
+    rot [ numVerts>> ] [ tAxes>> swap <direct-cpPolyShapeAxis-array> ] bi -rot
+    [| axis v n |
+        axis n>> n cpvdot 0.0 < 0
+        [ 0.0 ]
+        [ axis n>> v cpvdot axis d>> - ]
+        if
+    ] 2curry [ max ] reduce 0.0 <= ; inline
+
+! cpArbiter.h
+C-TYPE: cpArbiter
+C-TYPE: cpSpace
+C-TYPE: cpCollisionHandler
+
+STRUCT: cpContact
+    { p      cpVect      }
+    { n      cpVect      }
+    { dist   cpFloat     }
+    { r1     cpVect      }
+    { r2     cpVect      }
+    { nMass  cpFloat     }
+    { tMass  cpFloat     }
+    { bounce cpFloat     }
+    { jnAcc  cpFloat     }
+    { jtAcc  cpFloat     }
+    { jBias  cpFloat     }
+    { bias   cpFloat     }
+    { hash   cpHashValue } ;
+
+FUNCTION: cpContact* cpContactInit ( cpContact* con, cpVect p, cpVect n, cpFloat dist, cpHashValue hash ) ;
+
+ENUM: cpArbiterState
+    cpArbiterStateNormal
+    cpArbiterStateFirstColl
+    cpArbiterStateIgnore ;
+
+STRUCT: cpArbiter
+    { numContacts int                 }
+    { contacts    cpContact*          }
+    { a           cpShape*            }
+    { b           cpShape*            }
+    { e           cpFloat             }
+    { u           cpFloat             }
+    { surface_vr  cpVect              }
+    { stamp       int                 }
+    { handler     cpCollisionHandler* }
+    { swappedColl char                }
+    { state       char                } ;
+
+FUNCTION: cpArbiter* cpArbiterAlloc ( ) ;
+FUNCTION: cpArbiter* cpArbiterInit ( cpArbiter* arb, cpShape* a, cpShape* b ) ;
+FUNCTION: cpArbiter* cpArbiterNew ( cpShape* a, cpShape* b ) ;
+FUNCTION: void cpArbiterDestroy ( cpArbiter* arb ) ;
+FUNCTION: void cpArbiterFree ( cpArbiter* arb ) ;
+FUNCTION: void cpArbiterUpdate ( cpArbiter* arb, cpContact* contacts, int numContacts, cpCollisionHandler* handler, cpShape* a, cpShape* b ) ;
+FUNCTION: void cpArbiterPreStep ( cpArbiter* arb, cpFloat dt_inv ) ;
+FUNCTION: void cpArbiterApplyCachedImpulse ( cpArbiter* arb ) ;
+FUNCTION: void cpArbiterApplyImpulse ( cpArbiter* arb, cpFloat eCoef ) ;
+FUNCTION: cpVect cpArbiterTotalImpulse ( cpArbiter* arb ) ;
+FUNCTION: cpVect cpArbiterTotalImpulseWithFriction ( cpArbiter* arb ) ;
+FUNCTION: void cpArbiterIgnore ( cpArbiter* arb ) ;
+
+TYPED: cpArbiterGetShapes ( arb: cpArbiter -- a: cpShape b: cpShape )
+    dup swappedColl>> 0 = [
+        [ a>> ] [ b>> ] bi
+    ] [
+        [ b>> ] [ a>> ] bi
+    ] if ; inline
+
+TYPED: cpArbiterIsFirstContact ( arb: cpArbiter -- ? )
+    state>> cpArbiterStateFirstColl = ; inline
+
+TYPED: cpArbiterGetNormal ( arb: cpArbiter i -- n: cpVect )
+    [
+        swap
+        [ numContacts>> ]
+        [ contacts>> swap <direct-void*-array> ] bi nth cpContact memory>struct n>>
+    ]
+    [
+        drop swappedColl>> 0 = [ ] [ cpvneg ] if
+    ] 2bi ; inline
+
+TYPED: cpArbiterGetPoint ( arb: cpArbiter i -- p: cpVect )
+    swap
+    [ numContacts>> ]
+    [ contacts>> swap <direct-void*-array> ] bi
+    nth cpContact memory>struct p>> ; inline
+
+! cpCollision.h
+FUNCTION: int cpCollideShapes ( cpShape* a, cpShape* b, cpContact** arr ) ;
+
+! cpConstraint.h
+
+C-TYPE: cpConstraintClass
+C-TYPE: cpConstraint
+
+CALLBACK: void cpConstraintPreStepFunction ( cpConstraint* constraint, cpFloat dt, cpFloat dt_inv ) ;
+CALLBACK: void cpConstraintApplyImpulseFunction ( cpConstraint* constraint ) ;
+CALLBACK: cpFloat cpConstraintGetImpulseFunction ( cpConstraint* constraint ) ;
+
+STRUCT: cpConstraintClass
+    { preStep      cpConstraintPreStepFunction      }
+    { applyImpulse cpConstraintApplyImpulseFunction }
+    { getImpulse   cpConstraintGetImpulseFunction   } ;
+
+STRUCT: cpConstraint
+    { klass    cpConstraintClass* }
+    { a        cpBody*            }
+    { b        cpBody*            }
+    { maxForce cpFloat            }
+    { biasCoef cpFloat            }
+    { maxBias  cpFloat            }
+    { data     cpDataPointer      } ;
+
+FUNCTION: void cpConstraintDestroy ( cpConstraint* constraint ) ;
+FUNCTION: void cpConstraintFree ( cpConstraint* constraint ) ;
+FUNCTION: void cpConstraintCheckCast ( cpConstraint* constraint, cpConstraintClass* klass ) ;
+
+! cpPinJoint.h
+FUNCTION: cpConstraintClass* cpPinJointGetClass ( ) ;
+
+STRUCT: cpPinJoint
+    { constraint cpConstraint }
+    { anchr1     cpVect       }
+    { anchr2     cpVect       }
+    { dist       cpFloat      }
+    { r1         cpVect       }
+    { r2         cpVect       }
+    { n          cpVect       }
+    { nMass      cpFloat      }
+    { jnAcc      cpFloat      }
+    { jnMax      cpFloat      }
+    { bias       cpFloat      } ;
+
+FUNCTION: cpPinJoint* cpPinJointAlloc ( ) ;
+FUNCTION: cpPinJoint* cpPinJointInit ( cpPinJoint* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
+FUNCTION: cpConstraint* cpPinJointNew ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
+
+! cpSlideJoint.h
+FUNCTION: cpConstraintClass* cpSlideJointGetClass ( ) ;
+
+STRUCT: cpSlideJoint
+    { constraint cpConstraint }
+    { anchr1     cpVect       }
+    { anchr2     cpVect       }
+    { min        cpFloat      }
+    { max        cpFloat      }
+    { r1         cpVect       }
+    { r2         cpVect       }
+    { n          cpVect       }
+    { nMass      cpFloat      }
+    { jnAcc      cpFloat      }
+    { jnMax      cpFloat      }
+    { bias       cpFloat      } ;
+
+FUNCTION: cpSlideJoint* cpSlideJointAlloc ( ) ;
+FUNCTION: cpSlideJoint* cpSlideJointInit ( cpSlideJoint* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max ) ;
+FUNCTION: cpConstraint* cpSlideJointNew ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max ) ;
+
+! cpPivotJoint.h
+FUNCTION: cpConstraintClass* cpPivotJointGetClass ( ) ;
+
+STRUCT: cpPivotJoint
+    { constraint cpConstraint }
+    { anchr1     cpVect       }
+    { anchr2     cpVect       }
+    { r1         cpVect       }
+    { r2         cpVect       }
+    { k1         cpVect       }
+    { k2         cpVect       }
+    { jAcc       cpVect       }
+    { jMaxLen    cpFloat      }
+    { bias       cpVect       } ;
+
+FUNCTION: cpPivotJoint* cpPivotJointAlloc ( ) ;
+FUNCTION: cpPivotJoint* cpPivotJointInit ( cpPivotJoint* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
+FUNCTION: cpConstraint* cpPivotJointNew ( cpBody* a, cpBody* b, cpVect pivot ) ;
+FUNCTION: cpConstraint* cpPivotJointNew2 ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
+
+! cpGrooveJoint.h
+FUNCTION: cpConstraintClass* cpGrooveJointGetClass ( ) ;
+
+STRUCT: cpGrooveJoint
+    { constraint   cpConstraint   }
+    { grv_n        cpVect         }
+    { grv_a        cpVect         }
+    { grv_b        cpVect         }
+    { anchr2       cpVect         }
+    { grv_tn       cpVect         }
+    { clamp        cpFloat        }
+    { r1           cpVect         }
+    { r2           cpVect         }
+    { k1           cpVect         }
+    { k2           cpVect         }
+    { jAcc         cpVect         }
+    { jMaxLen      cpFloat        }
+    { bias         cpVect         } ;
+
+FUNCTION: cpGrooveJoint* cpGrooveJointAlloc ( ) ;
+FUNCTION: cpGrooveJoint* cpGrooveJointInit ( cpGrooveJoint* joint, cpBody* a, cpBody* b, cpVect groove_a, cpVect groove_b, cpVect anchr2 ) ;
+FUNCTION: cpConstraint* cpGrooveJointNew ( cpBody* a, cpBody* b, cpVect groove_a, cpVect groove_b, cpVect anchr2 ) ;
+
+! cpDampedSpring.h
+CALLBACK: cpFloat cpDampedSpringForceFunc ( cpConstraint* spring, cpFloat dist ) ;
+FUNCTION: cpConstraintClass* cpDampedSpringGetClass ( ) ;
+
+STRUCT: cpDampedSpring
+    { constraint      cpConstraint            }
+    { anchr1          cpVect                  }
+    { anchr2          cpVect                  }
+    { restLength      cpFloat                 }
+    { stiffness       cpFloat                 }
+    { damping         cpFloat                 }
+    { springForceFunc cpDampedSpringForceFunc }
+    { dt              cpFloat                 }
+    { target_vrn      cpFloat                 }
+    { r1              cpVect                  }
+    { r2              cpVect                  }
+    { nMass           cpFloat                 }
+    { n               cpVect                  } ;
+
+FUNCTION: cpDampedSpring* cpDampedSpringAlloc ( ) ;
+FUNCTION: cpDampedSpring* cpDampedSpringInit ( cpDampedSpring* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping ) ;
+FUNCTION: cpConstraint* cpDampedSpringNew ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping ) ;
+
+! cpDampedRotarySpring.h
+CALLBACK: cpFloat cpDampedRotarySpringTorqueFunc ( cpConstraint* spring, cpFloat relativeAngle ) ;
+FUNCTION: cpConstraintClass* cpDampedRotarySpringGetClass ( ) ;
+
+STRUCT: cpDampedRotarySpring
+    { constraint       cpConstraint                   }
+    { restAngle        cpFloat                        }
+    { stiffness        cpFloat                        }
+    { damping          cpFloat                        }
+    { springTorqueFunc cpDampedRotarySpringTorqueFunc }
+    { dt               cpFloat                        }
+    { target_wrn       cpFloat                        }
+    { iSum             cpFloat                        } ;
+
+FUNCTION: cpDampedRotarySpring* cpDampedRotarySpringAlloc ( ) ;
+FUNCTION: cpDampedRotarySpring* cpDampedRotarySpringInit ( cpDampedRotarySpring* joint, cpBody* a, cpBody* b, cpFloat restAngle, cpFloat stiffness, cpFloat damping ) ;
+FUNCTION: cpConstraint* cpDampedRotarySpringNew ( cpBody* a, cpBody* b, cpFloat restAngle, cpFloat stiffness, cpFloat damping ) ;
+
+! cpRotaryLimitJoint.h
+FUNCTION: cpConstraintClass* cpRotaryLimitJointGetClass ( ) ;
+
+STRUCT: cpRotaryLimitJoint
+    { constraint cpConstraint   }
+    { min        cpFloat        }
+    { max        cpFloat        }
+    { iSum       cpFloat        }
+    { bias       cpFloat        }
+    { jAcc       cpFloat        }
+    { jMax       cpFloat        } ;
+
+FUNCTION: cpRotaryLimitJoint* cpRotaryLimitJointAlloc ( ) ;
+FUNCTION: cpRotaryLimitJoint* cpRotaryLimitJointInit ( cpRotaryLimitJoint* joint, cpBody* a, cpBody* b, cpFloat min, cpFloat max ) ;
+FUNCTION: cpConstraint* cpRotaryLimitJointNew ( cpBody* a, cpBody* b, cpFloat min, cpFloat max ) ;
+
+! cpRatchetJoint.h
+FUNCTION: cpConstraintClass* cpRatchetJointGetClass ( ) ;
+
+STRUCT: cpRatchetJoint
+    { constraint cpConstraint }
+    { angle      cpFloat      }
+    { phase      cpFloat      }
+    { ratchet    cpFloat      }
+    { iSum       cpFloat      }
+    { bias       cpFloat      }
+    { jAcc       cpFloat      }
+    { jMax       cpFloat      } ;
+
+FUNCTION: cpRatchetJoint* cpRatchetJointAlloc ( ) ;
+FUNCTION: cpRatchetJoint* cpRatchetJointInit ( cpRatchetJoint* joint, cpBody* a, cpBody* b, cpFloat phase, cpFloat ratchet ) ;
+FUNCTION: cpConstraint* cpRatchetJointNew ( cpBody* a, cpBody* b, cpFloat phase, cpFloat ratchet ) ;
+
+! cpGearJoint.h
+FUNCTION: cpConstraintClass* cpGearJointGetClass ( ) ;
+
+STRUCT: cpGearJoint
+    { constraint cpConstraint }
+    { phase      cpFloat      }
+    { ratio      cpFloat      }
+    { ratio_inv  cpFloat      }
+    { iSum       cpFloat      }
+    { bias       cpFloat      }
+    { jAcc       cpFloat      }
+    { jMax       cpFloat      } ;
+
+FUNCTION: cpGearJoint* cpGearJointAlloc ( ) ;
+FUNCTION: cpGearJoint* cpGearJointInit ( cpGearJoint* joint, cpBody* a, cpBody* b, cpFloat phase, cpFloat ratio ) ;
+FUNCTION: cpConstraint* cpGearJointNew ( cpBody* a, cpBody* b, cpFloat phase, cpFloat ratio ) ;
+FUNCTION: void cpGearJointSetRatio ( cpConstraint* constraint, cpFloat value ) ;
+
+! cpSimpleMotor.h
+FUNCTION: cpConstraintClass* cpSimpleMotorGetClass ( ) ;
+
+STRUCT: cpSimpleMotor
+    { constraint cpConstraint }
+    { rate       cpFloat      }
+    { iSum       cpFloat      }
+    { jAcc       cpFloat      }
+    { jMax       cpFloat      } ;
+
+FUNCTION: cpSimpleMotor* cpSimpleMotorAlloc ( ) ;
+FUNCTION: cpSimpleMotor* cpSimpleMotorInit ( cpSimpleMotor* joint, cpBody* a, cpBody* b, cpFloat rate ) ;
+FUNCTION: cpConstraint* cpSimpleMotorNew ( cpBody* a, cpBody* b, cpFloat rate ) ;
+
+! cpSpace.h
+C-TYPE: cpSpace
+
+CALLBACK: int cpCollisionBeginFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
+CALLBACK: int cpCollisionPreSolveFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
+CALLBACK: void cpCollisionPostSolveFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
+CALLBACK: void cpCollisionSeparateFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
+
+STRUCT: cpCollisionHandler
+    { a         cpCollisionType          }
+    { b         cpCollisionType          }
+    { begin     cpCollisionBeginFunc     }
+    { preSolve  cpCollisionPreSolveFunc  }
+    { postSolve cpCollisionPostSolveFunc }
+    { separate  cpCollisionSeparateFunc  }
+    { data      void*                    } ;
+
+STRUCT: cpSpace
+    { iterations        int                }
+    { elasticIterations int                }
+    { gravity           cpVect             }
+    { damping           cpFloat            }
+    { stamp             int                }
+    { staticShapes      cpSpaceHash*       }
+    { activeShapes      cpSpaceHash*       }
+    { bodies            cpArray*           }
+    { arbiters          cpArray*           }
+    { contactSet        cpHashSet*         }
+    { constraints       cpArray*           }
+    { collFuncSet       cpHashSet*         }
+    { defaultHandler    cpCollisionHandler }
+    { postStepCallbacks cpHashSet*         } ;
+
+FUNCTION: cpSpace* cpSpaceAlloc ( ) ;
+FUNCTION: cpSpace* cpSpaceInit ( cpSpace* space ) ;
+FUNCTION: cpSpace* cpSpaceNew ( ) ;
+FUNCTION: void cpSpaceDestroy ( cpSpace* space ) ;
+FUNCTION: void cpSpaceFree ( cpSpace* space ) ;
+FUNCTION: void cpSpaceFreeChildren ( cpSpace* space ) ;
+FUNCTION: void cpSpaceSetDefaultCollisionHandler (
+    cpSpace*                 space,
+    cpCollisionBeginFunc     begin,
+    cpCollisionPreSolveFunc  preSolve,
+    cpCollisionPostSolveFunc postSolve,
+    cpCollisionSeparateFunc  separate,
+    void*                    data ) ;
+FUNCTION: void cpSpaceAddCollisionHandler (
+    cpSpace*                 space,
+    cpCollisionType          a,
+    cpCollisionType          b,
+    cpCollisionBeginFunc     begin,
+    cpCollisionPreSolveFunc  preSolve,
+    cpCollisionPostSolveFunc postSolve,
+    cpCollisionSeparateFunc  separate,
+    void*                    data ) ;
+FUNCTION: void cpSpaceRemoveCollisionHandler ( cpSpace* space, cpCollisionType a, cpCollisionType b ) ;
+FUNCTION: cpShape* cpSpaceAddShape ( cpSpace* space, cpShape* shape ) ;
+FUNCTION: cpShape* cpSpaceAddStaticShape ( cpSpace* space, cpShape* shape ) ;
+FUNCTION: cpBody* cpSpaceAddBody ( cpSpace* space, cpBody* body ) ;
+FUNCTION: cpConstraint* cpSpaceAddConstraint ( cpSpace* space, cpConstraint* constraint ) ;
+FUNCTION: void cpSpaceRemoveShape ( cpSpace* space, cpShape* shape ) ;
+FUNCTION: void cpSpaceRemoveStaticShape ( cpSpace* space, cpShape* shape ) ;
+FUNCTION: void cpSpaceRemoveBody ( cpSpace* space, cpBody* body ) ;
+FUNCTION: void cpSpaceRemoveConstraint ( cpSpace* space, cpConstraint* constraint ) ;
+CALLBACK: void cpPostStepFunc ( cpSpace* space, void* obj, void* data ) ;
+FUNCTION: void cpSpaceAddPostStepCallback ( cpSpace* space, cpPostStepFunc func, void* obj, void* data ) ;
+CALLBACK: void cpSpacePointQueryFunc ( cpShape* shape, void* data ) ;
+FUNCTION: void cpSpacePointQuery ( cpSpace* space, cpVect point, cpLayers layers, cpGroup group, cpSpacePointQueryFunc func, void* data ) ;
+FUNCTION: cpShape* cpSpacePointQueryFirst ( cpSpace* space, cpVect point, cpLayers layers, cpGroup group ) ;
+CALLBACK: void cpSpaceSegmentQueryFunc ( cpShape* shape, cpFloat t, cpVect n, void* data ) ;
+FUNCTION: int cpSpaceSegmentQuery ( cpSpace* space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSpaceSegmentQueryFunc func, void* data ) ;
+FUNCTION: cpShape* cpSpaceSegmentQueryFirst ( cpSpace* space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSegmentQueryInfo* out ) ;
+CALLBACK: void cpSpaceBBQueryFunc ( cpShape* shape, void* data ) ;
+FUNCTION: void cpSpaceBBQuery ( cpSpace* space, cpBB bb, cpLayers layers, cpGroup group, cpSpaceBBQueryFunc func, void* data ) ;
+CALLBACK: void cpSpaceBodyIterator ( cpBody* body, void* data ) ;
+FUNCTION: void cpSpaceEachBody ( cpSpace* space, cpSpaceBodyIterator func, void* data ) ;
+FUNCTION: void cpSpaceResizeStaticHash ( cpSpace* space, cpFloat dim, int count ) ;
+FUNCTION: void cpSpaceResizeActiveHash ( cpSpace* space, cpFloat dim, int count ) ;
+FUNCTION: void cpSpaceRehashStatic ( cpSpace* space ) ;
+FUNCTION: void cpSpaceStep ( cpSpace* space, cpFloat dt ) ;
+
+! chipmunk.h
+FUNCTION: void cpInitChipmunk ( ) ;
+FUNCTION: cpFloat cpMomentForCircle ( cpFloat m, cpFloat r1, cpFloat r2, cpVect offset ) ;
+FUNCTION: cpFloat cpMomentForSegment ( cpFloat m, cpVect a, cpVect b ) ;
+FUNCTION: cpFloat cpMomentForPoly ( cpFloat m, int numVerts, cpVect* verts, cpVect offset ) ;
+
index 1b3aa86eff8394c7ef87b4b640c3d96a8050859c..4d083faa5d563b4b47b9ccea64fc525c010807e6 100644 (file)
@@ -1,6 +1,7 @@
 ! (c)2009 Joe Groff bsd license
 USING: accessors alien.c-types classes.struct classes.struct.vectored
-kernel sequences specialized-arrays tools.test ;
+kernel sequences specialized-arrays tools.test vocabs compiler.units ;
+FROM: specialized-arrays.private => specialized-array-vocab ;
 SPECIALIZED-ARRAYS: int ushort float ;
 IN: classes.struct.vectored.tests
 
@@ -71,3 +72,9 @@ VECTORED-STRUCT: foo
         { w ushort-array{ 15   25   35   45   } }
     } third vectored-element>
 ] unit-test
+
+[ ] [
+    [
+        foo specialized-array-vocab forget-vocab
+    ] with-compilation-unit
+] unit-test
index 16ff95b1c0091f97af4794dffda6894dcd1c2468..e6f45ab245c539b7a8c1fec8a0e5f6aa939faee4 100644 (file)
@@ -45,13 +45,13 @@ MACRO: (vectored-element>) ( struct-class -- quot: ( elt -- struct ) )
 SLOT: (n)
 SLOT: (vectored)
 
-FUNCTOR: define-vectored-accessors ( S>> (>>S) T -- )
+FUNCTOR: define-vectored-accessors ( S>> S<< T -- )
 
 WHERE
 
 M: T S>>
     [ (n)>> ] [ (vectored)>> S>> ] bi nth-unsafe ; inline
-M: T (>>S)
+M: T S<<
     [ (n)>> ] [ (vectored)>> S>> ] bi set-nth-unsafe ; inline
 
 ;FUNCTOR
diff --git a/extra/closures/closures.factor b/extra/closures/closures.factor
deleted file mode 100644 (file)
index faa8ec0..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-USING: assocs io.pathnames fry namespaces namespaces.private kernel sequences parser hashtables ;
-IN: closures
-SYMBOL: |
-
-! Selective Binding
-: delayed-bind-with ( vars quot -- quot' ) '[ _ dup [ get ] map zip >hashtable [ _ bind ] curry ] ;
-SYNTAX: C[ | parse-until parse-quotation delayed-bind-with append! ;
-! Common ones
-SYNTAX: DIR[ parse-quotation { current-directory } swap delayed-bind-with append! ;
-
-! Namespace Binding
-: bind-to-namespace ( quot -- quot' ) '[ namespace [ _ bind ] curry ] ;
-SYNTAX: NS[ parse-quotation bind-to-namespace append! ;
index 7378d3284c36eb0a7243ec2965ed5d1a38a681fe..3e9dbc28491b5efdfca89feb19f75f253ce53e38 100644 (file)
@@ -58,7 +58,7 @@ IN: compiler.graphviz
 
 : cfg-vertex, ( bb -- )
     [ number>> number>string ]
-    [ kill-block? { "color=grey" "style=filled" } { } ? ]
+    [ kill-block?>> { "color=grey" "style=filled" } { } ? ]
     bi node-style, ;
 
 : cfgs ( cfgs -- )
@@ -78,8 +78,8 @@ IN: compiler.graphviz
 : optimized-cfg ( quot -- cfgs )
     {
         { [ dup cfg? ] [ 1array ] }
-        { [ dup quotation? ] [ test-cfg [ dup cfg set optimize-cfg ] map ] }
-        { [ dup word? ] [ test-cfg [ dup cfg set optimize-cfg ] map ] }
+        { [ dup quotation? ] [ test-optimizer ] }
+        { [ dup word? ] [ test-optimizer ] }
         [ ]
     } cond ;
 
index 1e098645bf56f783af0732108e388200a8ded93d..0ad83a6c5fa4a9c57bcab9a9f34617367b44afec 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test constructors calendar kernel accessors
-combinators.short-circuit initializers math ;
+USING: accessors calendar combinators.short-circuit
+constructors eval initializers kernel math tools.test ;
 IN: constructors.tests
 
 TUPLE: stock-spread stock spread timestamp ;
@@ -41,3 +41,21 @@ CONSTRUCTOR: ct4 ( a b c d -- obj )
 [ 2 ] [ 0 0 <ct2> a>> ] unit-test
 [ 3 ] [ 0 0 0 <ct3> a>> ] unit-test
 [ 4 ] [ 0 0 0 0 <ct4> a>> ] unit-test
+
+[
+    """USE: constructors
+IN: constructors.tests
+TUPLE: foo a b ;
+CONSTRUCTOR: foo ( a a -- obj ) ;""" eval( -- )
+] [
+    error>> repeated-constructor-parameters?
+] must-fail-with
+
+[
+    """USE: constructors
+IN: constructors.tests
+TUPLE: foo a b ;
+CONSTRUCTOR: foo ( a c -- obj ) ;""" eval( -- )
+] [
+    error>> unknown-constructor-parameters?
+] must-fail-with
index 747c8f53fc1bdc47603e915a0af07e30e652a441..6701e613249d2fec2f15b7eeb130cb4442c5cf7e 100644 (file)
@@ -1,8 +1,9 @@
 ! Copyright (C) 2009 Slava Pestov, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs classes classes.tuple effects.parser
-fry generalizations generic.standard kernel lexer locals macros
-parser sequences slots vocabs words arrays ;
+USING: accessors arrays assocs classes classes.tuple
+effects.parser fry generalizations sequences.generalizations
+generic.standard kernel lexer locals macros parser sequences
+sets slots vocabs words ;
 IN: constructors
 
 ! An experiment
@@ -38,6 +39,15 @@ MACRO:: slots>constructor ( class slots -- quot )
         default-params swap assoc-union values _ firstn class boa
     ] ;
 
+ERROR: repeated-constructor-parameters class effect ;
+
+ERROR: unknown-constructor-parameters class effect unknown ;
+
+: ensure-constructor-parameters ( class effect -- class effect )
+    dup in>> all-unique? [ repeated-constructor-parameters ] unless
+    2dup [ all-slots [ name>> ] map ] [ in>> ] bi* swap diff
+    [ unknown-constructor-parameters ] unless-empty ;
+
 :: (define-constructor) ( constructor-word class effect def -- word quot )
     constructor-word
     class def define-initializer
@@ -53,7 +63,8 @@ MACRO:: slots>constructor ( class slots -- quot )
     scan-word [ name>> "<" ">" surround create-in dup reset-generic ] keep ;
 
 : parse-constructor ( -- class word effect def )
-    scan-constructor complete-effect parse-definition ;
+    scan-constructor complete-effect ensure-constructor-parameters
+    parse-definition ;
 
 SYNTAX: CONSTRUCTOR: parse-constructor f define-constructor ;
 
index 97f4edc521f5de13c2feaaa309c62334c58221d5..1ca62beef396e8050d9e9e3232ef021e4b7336a0 100644 (file)
@@ -11,7 +11,7 @@ IN: contributors
     ] with-directory ;
 
 : patch-counts ( authors -- assoc )
-    dup prune
+    dup members
     [ dup rot [ = ] with count ] with
     { } map>assoc ;
 
index 5d77766703db1089fff42575eddc9e6ad0296848..700f0dc9a51791cf38d9f83773492519cc0f09b2 100644 (file)
@@ -1 +1 @@
-untested
+not tested
index ddea7e762a338002e682d84050bc7789483e5952..015d98157f67363ccebb48635796b63ecc3a48ca 100644 (file)
@@ -63,7 +63,7 @@ CONSTANT: sign-flag         HEX: 80
   #! Return the 16-bit pseudo register AF.
   [ a>> 8 shift ] keep f>> bitor ;
 
-: (>>af) ( value cpu -- )
+: af<< ( value cpu -- )
   #! Set the value of the 16-bit pseudo register AF
   [ >word< ] dip swap >>f swap >>a drop ;
 
@@ -71,7 +71,7 @@ CONSTANT: sign-flag         HEX: 80
   #! Return the 16-bit pseudo register BC.
   [ b>> 8 shift ] keep c>> bitor ;
 
-: (>>bc) ( value cpu -- )
+: bc<< ( value cpu -- )
   #! Set the value of the 16-bit pseudo register BC
   [ >word< ] dip swap >>c swap >>b drop ;
 
@@ -79,7 +79,7 @@ CONSTANT: sign-flag         HEX: 80
   #! Return the 16-bit pseudo register DE.
   [ d>> 8 shift ] keep e>> bitor ;
 
-: (>>de) ( value cpu -- )
+: de<< ( value cpu -- )
   #! Set the value of the 16-bit pseudo register DE
   [ >word< ] dip swap >>e swap >>d drop ;
 
@@ -87,7 +87,7 @@ CONSTANT: sign-flag         HEX: 80
   #! Return the 16-bit pseudo register HL.
   [ h>> 8 shift ] keep l>> bitor ;
 
-: (>>hl) ( value cpu -- )
+: hl<< ( value cpu -- )
   #! Set the value of the 16-bit pseudo register HL
   [ >word< ] dip swap >>l swap >>h drop ;
 
@@ -150,14 +150,14 @@ CONSTANT: sign-flag         HEX: 80
   [ pc>> ] keep
   [ read-byte ] keep 
   [ pc>> 1 + ] keep
-  (>>pc) ;
+  pc<< ;
 
 : next-word ( cpu -- word )
   #! Return the value of the word at PC, and increment PC.
   [ pc>> ] keep
   [ read-word ] keep 
   [ pc>> 2 + ] keep
-  (>>pc) ;
+  pc<< ;
 
 
 : write-byte ( value addr cpu -- )
@@ -176,43 +176,43 @@ CONSTANT: sign-flag         HEX: 80
 
 : cpu-a-bitand ( quot cpu -- )
   #! A &= quot call 
-  [ a>> swap call bitand ] keep (>>a) ; inline
+  [ a>> swap call bitand ] keep a<< ; inline
 
 : cpu-a-bitor ( quot cpu -- )
   #! A |= quot call 
-  [ a>> swap call bitor ] keep (>>a) ; inline
+  [ a>> swap call bitor ] keep a<< ; inline
 
 : cpu-a-bitxor ( quot cpu -- )
   #! A ^= quot call 
-  [ a>> swap call bitxor ] keep (>>a) ; inline
+  [ a>> swap call bitxor ] keep a<< ; inline
 
 : cpu-a-bitxor= ( value cpu -- )
   #! cpu-a ^= value
-  [ a>> bitxor ] keep (>>a) ;
+  [ a>> bitxor ] keep a<< ;
 
 : cpu-f-bitand ( quot cpu -- )
   #! F &= quot call 
-  [ f>> swap call bitand ] keep (>>f) ; inline
+  [ f>> swap call bitand ] keep f<< ; inline
 
 : cpu-f-bitor ( quot cpu -- )
   #! F |= quot call 
-  [ f>> swap call bitor ] keep (>>f) ; inline
+  [ f>> swap call bitor ] keep f<< ; inline
 
 : cpu-f-bitxor ( quot cpu -- )
   #! F |= quot call 
-  [ f>> swap call bitxor ] keep (>>f) ; inline
+  [ f>> swap call bitxor ] keep f<< ; inline
 
 : cpu-f-bitor= ( value cpu -- )
   #! cpu-f |= value
-  [ f>> bitor ] keep (>>f) ;
+  [ f>> bitor ] keep f<< ;
 
 : cpu-f-bitand= ( value cpu -- )
   #! cpu-f &= value
-  [ f>> bitand ] keep (>>f) ;
+  [ f>> bitand ] keep f<< ;
 
 : cpu-f-bitxor= ( value cpu -- )
   #! cpu-f ^= value
-  [ f>> bitxor ] keep (>>f) ;
+  [ f>> bitxor ] keep f<< ;
 
 : set-flag ( cpu flag -- )
   swap cpu-f-bitor= ;
@@ -361,7 +361,7 @@ CONSTANT: sign-flag         HEX: 80
 : decrement-sp ( n cpu -- )
   #! Decrement the stackpointer by n.  
   [ sp>> ] keep 
-  [ swap - ] dip (>>sp) ;
+  [ swap - ] dip sp<< ;
 
 : save-pc ( cpu -- )
   #! Save the value of the PC on the stack.
@@ -393,24 +393,24 @@ CONSTANT: sign-flag         HEX: 80
 : call-sub ( addr cpu -- )
   #! Call the address as a subroutine.
   dup push-pc 
-  [ HEX: FFFF bitand ] dip (>>pc) ;
+  [ HEX: FFFF bitand ] dip pc<< ;
 
 : ret-from-sub ( cpu -- )
-  [ pop-pc ] keep (>>pc) ;
+  [ pop-pc ] keep pc<< ;
  
 : interrupt ( number cpu -- )
   #! Perform a hardware interrupt
 !  "***Interrupt: " write over 16 >base print 
   dup f>> interrupt-flag bitand 0 = not [
     dup push-pc
-    (>>pc)
+    pc<<
   ] [
     2drop
   ] if ;
 
 : inc-cycles ( n cpu -- )
   #! Increment the number of cpu cycles
-  [ cycles>> + ] keep (>>cycles) ;
+  [ cycles>> + ] keep cycles<< ;
   
 : instruction-cycles ( -- vector )
   #! Return a 256 element vector containing the cycles for
@@ -496,7 +496,7 @@ SYMBOL: rom-root
   #! Read the next instruction from the cpu's program 
   #! counter, and increment the program counter.
   [ pc>> ] keep ! pc cpu
-  [ over 1 + swap (>>pc) ] keep
+  [ over 1 + swap pc<< ] keep
   read-byte ;
 
 : get-cycles ( n -- opcode )
@@ -514,11 +514,11 @@ SYMBOL: rom-root
   over 16667 < [
     2drop
   ] [ 
-    [ [ 16667 - ] dip (>>cycles) ] keep
+    [ [ 16667 - ] dip cycles<< ] keep
     dup last-interrupt>> HEX: 10 = [
-      HEX: 08 over (>>last-interrupt) HEX: 08 swap interrupt
+      HEX: 08 over last-interrupt<< HEX: 08 swap interrupt
     ] [
-      HEX: 10 over (>>last-interrupt) HEX: 10 swap interrupt
+      HEX: 10 over last-interrupt<< HEX: 10 swap interrupt
     ] if     
   ] if ;
 
@@ -561,18 +561,18 @@ SYMBOL: rom-root
   #! where the 1st item is the getter and the 2nd is the setter
   #! for that register.
   H{
-    { "A"  { a>>  (>>a)  } }
-    { "B"  { b>>  (>>b)  } }
-    { "C"  { c>>  (>>c)  } }
-    { "D"  { d>>  (>>d)  } }
-    { "E"  { e>>  (>>e)  } }
-    { "H"  { h>>  (>>h)  } }
-    { "L"  { l>>  (>>l)  } }
-    { "AF" { af>> (>>af) } }
-    { "BC" { bc>> (>>bc) } }
-    { "DE" { de>> (>>de) } }
-    { "HL" { hl>> (>>hl) } }
-    { "SP" { sp>> (>>sp) } }
+    { "A"  { a>>  a<<  } }
+    { "B"  { b>>  b<<  } }
+    { "C"  { c>>  c<<  } }
+    { "D"  { d>>  d<<  } }
+    { "E"  { e>>  e<<  } }
+    { "H"  { h>>  h<<  } }
+    { "L"  { l>>  l<<  } }
+    { "AF" { af>> af<< } }
+    { "BC" { bc>> bc<< } }
+    { "DE" { de>> de<< } }
+    { "HL" { hl>> hl<< } }
+    { "SP" { sp>> sp<< } }
   } at ;
 
 
@@ -580,14 +580,14 @@ SYMBOL: rom-root
   #! Given a string containing a flag name, return a vector
   #! where the 1st item is a word that tests that flag.
   H{
-    { "NZ"  { flag-nz?  } }
-    { "NC"  { flag-nc?  } }
-    { "PO"  { flag-po?  } }
-    { "PE"  { flag-pe?  } }
+    { "NZ" { flag-nz?  } }
+    { "NC" { flag-nc?  } }
+    { "PO" { flag-po?  } }
+    { "PE" { flag-pe?  } }
     { "Z"  { flag-z?  } }
     { "C"  { flag-c? } }
     { "P"  { flag-p?  } }
-    { "M" { flag-m?  } }
+    { "M"  { flag-m?  } }
   } at ;
 
 SYMBOLS: $1 $2 $3 $4 ;
@@ -606,19 +606,19 @@ SYMBOLS: $1 $2 $3 $4 ;
 : (emulate-RST) ( n cpu -- )
   #! RST nn
   [ sp>> 2 - dup ] keep ! sp sp cpu
-  [ (>>sp) ] keep ! sp cpu
+  [ sp<< ] keep ! sp cpu
   [ pc>> ] keep ! sp pc cpu
   swapd [ write-word ] keep ! cpu
-  [ 8 * ] dip (>>pc) ;
+  [ 8 * ] dip pc<< ;
 
 : (emulate-CALL) ( cpu -- )
   #! 205 - CALL nn
   [ next-word HEX: FFFF bitand ] keep ! addr cpu
   [ sp>> 2 - dup ] keep ! addr sp sp cpu
-  [ (>>sp) ] keep ! addr sp cpu
+  [ sp<< ] keep ! addr sp cpu
   [ pc>> ] keep ! addr sp pc cpu
   swapd [ write-word ] keep ! addr cpu
-  (>>pc) ;
+  pc<< ;
 
 : (emulate-RLCA) ( cpu -- )
   #! The content of the accumulator is rotated left
@@ -628,7 +628,7 @@ SYMBOLS: $1 $2 $3 $4 ;
   [ a>> -7 shift ] keep 
   over 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
   [ a>> 1 shift HEX: FF bitand ] keep 
-  [ bitor ] dip (>>a) ;
+  [ bitor ] dip a<< ;
 
 : (emulate-RRCA) ( cpu -- )
   #! The content of the accumulator is rotated right
@@ -638,7 +638,7 @@ SYMBOLS: $1 $2 $3 $4 ;
   [ a>> 1 bitand 7 shift ] keep 
   over 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
   [ a>> 254 bitand -1 shift ] keep 
-  [ bitor ] dip (>>a) ;
+  [ bitor ] dip a<< ;
 
 : (emulate-RLA) ( cpu -- )  
   #! The content of the accumulator is rotated left
@@ -650,7 +650,7 @@ SYMBOLS: $1 $2 $3 $4 ;
   [ carry-flag swap flag-set? [ 1 ] [ 0 ] if ] keep 
   [ a>> 127 bitand 7 shift ] keep 
   dup a>> 128 bitand 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
-  [ bitor ] dip (>>a) ;
+  [ bitor ] dip a<< ;
 
 : (emulate-RRA) ( cpu -- )  
   #! The content of the accumulator is rotated right
@@ -661,7 +661,7 @@ SYMBOLS: $1 $2 $3 $4 ;
   [ carry-flag swap flag-set? [ BIN: 10000000 ] [ 0 ] if ] keep 
   [ a>> 254 bitand -1 shift ] keep 
   dup a>> 1 bitand 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
-  [ bitor ] dip (>>a) ;
+  [ bitor ] dip a<< ;
 
 : (emulate-CPL) ( cpu -- )  
   #! The contents of the accumulator are complemented
@@ -679,93 +679,93 @@ SYMBOLS: $1 $2 $3 $4 ;
   ] keep 
   [ a>> + ] keep
   [ update-flags ] 2keep  
-  [ swap HEX: FF bitand swap (>>a) ] keep 
+  [ swap HEX: FF bitand swap a<< ] keep 
   [
     dup carry-flag swap flag-set? swap 
     a>> -4 shift BIN: 1111 bitand 9 > or [ 96 ] [ 0 ] if 
   ] keep 
   [ a>> + ] keep
   [ update-flags ] 2keep  
-  swap HEX: FF bitand swap (>>a) ;
+  swap HEX: FF bitand swap a<< ;
   
 : patterns ( -- hashtable )
   #! table of code quotation patterns for each type of instruction.
   H{
-    { "NOP"          [ drop ]               }
-    { "RET-NN"          [ ret-from-sub  ]               }
-    { "RST-0"      [ 0 swap (emulate-RST) ] }
-    { "RST-8"      [ 8 swap (emulate-RST) ] }
-    { "RST-10H"      [ HEX: 10 swap (emulate-RST) ] }
-    { "RST-18H"      [ HEX: 18 swap (emulate-RST) ] }
-    { "RST-20H"      [ HEX: 20 swap (emulate-RST) ] }
-    { "RST-28H"      [ HEX: 28 swap (emulate-RST) ] }
-    { "RST-30H"      [ HEX: 30 swap (emulate-RST) ] }
-    { "RST-38H"      [ HEX: 38 swap (emulate-RST) ] }
-    { "RET-F|FF"      [ dup $1 [ 6 over inc-cycles ret-from-sub ] [ drop ] if ] }
-    { "CP-N"      [ [ a>> ] keep [ next-byte ] keep sub-byte drop ] }
-    { "CP-R"      [ [ a>> ] keep [ $1 ] keep sub-byte drop  ] }
-    { "CP-(RR)"      [ [ a>> ] keep [ $1 ] keep [ read-byte ] keep sub-byte drop ] }
-    { "OR-N"      [ [ a>> ] keep [ next-byte ] keep [ or-byte ] keep (>>a) ] }
-    { "OR-R"      [ [ a>> ] keep [ $1 ] keep [ or-byte ] keep (>>a) ] }
-    { "OR-(RR)"      [ [ a>> ] keep [ $1 ] keep [ read-byte ] keep [ or-byte ] keep (>>a)  ] }
-    { "XOR-N"      [ [ a>> ] keep [ next-byte ] keep [ xor-byte ] keep (>>a) ] }
-    { "XOR-R"      [ [ a>> ] keep [ $1 ] keep [ xor-byte ] keep (>>a) ] }
-    { "XOR-(RR)"   [ [ a>> ] keep [ $1 ] keep [ read-byte ] keep [ xor-byte ] keep (>>a)  ] }
-    { "AND-N"      [ [ a>> ] keep [ next-byte ] keep [ and-byte ] keep (>>a)  ] }
-    { "AND-R"      [ [ a>> ] keep [ $1 ] keep [ and-byte ] keep (>>a) ] }
-    { "AND-(RR)"      [ [ a>> ] keep [ $1 ] keep [ read-byte ] keep [ and-byte ] keep (>>a)  ] }
-    { "ADC-R,N"      [ [ $1 ] keep [ next-byte ] keep [ add-byte-with-carry ] keep $2 ] }
-    { "ADC-R,R"      [ [ $1 ] keep [ $3 ] keep [ add-byte-with-carry ] keep $2 ] }
-    { "ADC-R,(RR)"      [ [ $1 ] keep [ $3 ] keep [ read-byte ] keep [ add-byte-with-carry ] keep $2 ] }
-    { "ADD-R,N"      [ [ $1 ] keep [ next-byte ] keep [ add-byte ] keep $2 ] }
-    { "ADD-R,R"      [ [ $1 ] keep [ $3 ] keep [ add-byte ] keep $2 ] }
-    { "ADD-RR,RR"    [ [ $1 ] keep [ $3 ] keep [ add-word ] keep $2 ] }
-    { "ADD-R,(RR)"    [ [ $1 ] keep [ $3 ] keep [ read-byte ] keep [ add-byte ] keep $2   ]  }
-    { "SBC-R,N"      [ [ $1 ] keep [ next-byte ] keep [ sub-byte-with-carry ] keep $2 ] }
-    { "SBC-R,R"      [ [ $1 ] keep [ $3 ] keep [ sub-byte-with-carry ] keep $2 ] }
-    { "SBC-R,(RR)"      [ [ $1 ] keep [ $3 ] keep [ read-byte ] keep [ sub-byte-with-carry ] keep $2 ] }
-    { "SUB-R"      [ [ a>> ] keep [ $1 ] keep [ sub-byte ] keep (>>a) ] }
-    { "SUB-(RR)"      [ [ a>> ] keep [ $1 ] keep [ read-byte ] keep [ sub-byte ] keep (>>a) ] }
-    { "SUB-N"      [ [ a>> ] keep [ next-byte ] keep [ sub-byte ] keep (>>a) ] }
-    { "CPL"          [ (emulate-CPL) ]               }
-    { "DAA"          [ (emulate-DAA) ]               }
-    { "RLA"          [ (emulate-RLA) ]               }
-    { "RRA"          [ (emulate-RRA) ]               }
-    { "CCF"          [ carry-flag swap cpu-f-bitxor= ]               }
-    { "SCF"          [ carry-flag swap cpu-f-bitor= ]               }
-    { "RLCA"          [ (emulate-RLCA) ]               }
-    { "RRCA"          [ (emulate-RRCA) ]               }
-    { "HALT"          [ drop  ]               }
-    { "DI"          [ [ 255 interrupt-flag - ] swap cpu-f-bitand  ]               }
-    { "EI"          [ [ interrupt-flag ] swap cpu-f-bitor  ]  }  
-    { "POP-RR"     [ [ pop-sp ] keep $2 ] }
-    { "PUSH-RR"     [ [ $1 ] keep push-sp ] }
-    { "INC-R"     [ [ $1 ] keep [ inc-byte ] keep $2 ] }
-    { "DEC-R"     [ [ $1 ] keep [ dec-byte ] keep $2 ] }
-    { "INC-RR"     [ [ $1 ] keep [ inc-word ] keep $2 ] }
-    { "DEC-RR"     [ [ $1 ] keep [ dec-word ] keep $2 ] }
-    { "DEC-(RR)"     [ [ $1 ] keep [ read-byte ] keep [ dec-byte ] keep [ $1 ] keep write-byte ] }
-    { "INC-(RR)" [ [ $1 ] keep [ read-byte ] keep [ inc-byte ] keep  [ $1 ] keep write-byte ] }
-    { "JP-NN"           [ [ pc>> ] keep [ read-word ] keep (>>pc) ]               }
-    { "JP-F|FF,NN"      [ [ $1 ] keep swap [ [ next-word ] keep [ (>>pc) ] keep [ cycles>> ] keep swap 5 + swap (>>cycles) ] [ [ pc>> 2 + ] keep (>>pc) ] if ] }
-    { "JP-(RR)"      [ [ $1 ] keep (>>pc) ] }
-    { "CALL-NN"         [ (emulate-CALL) ] }
-    { "CALL-F|FF,NN"    [ [ $1 ] keep swap [ 7 over inc-cycles (emulate-CALL) ] [ [ pc>> 2 + ] keep (>>pc) ] if ]   }
-    { "LD-RR,NN"     [ [ next-word ] keep $2 ] }
-    { "LD-RR,RR"     [ [ $3 ] keep $2 ] }
-    { "LD-R,N"     [ [ next-byte ] keep $2 ] }
-    { "LD-(RR),N"    [ [ next-byte ] keep [ $1 ] keep write-byte ] }
-    { "LD-(RR),R"    [ [ $3 ] keep [ $1 ] keep write-byte ] }
-    { "LD-R,R"    [ [ $3 ] keep $2 ] }
-    { "LD-R,(RR)"    [ [ $3 ] keep [ read-byte ] keep $2  ] }
-    { "LD-(NN),RR"    [ [ $1 ] keep [ next-word ] keep write-word ] }
-    { "LD-(NN),R"    [  [ $1 ] keep [ next-word ] keep write-byte ] }
-    { "LD-RR,(NN)"    [ [ next-word ] keep [ read-word ] keep $2 ]  }
-    { "LD-R,(NN)"    [ [ next-word ] keep [ read-byte ] keep $2 ] }
-    { "OUT-(N),R"    [ [ $1 ] keep [ next-byte ] keep write-port ] }
-    { "IN-R,(N)"    [ [ next-byte ] keep [ read-port ] keep (>>a) ] }
-    { "EX-(RR),RR"  [  [ $1 ] keep [ read-word ] keep [ $3 ] keep [ $1 ] keep [ write-word ] keep $4 ] }
-    { "EX-RR,RR"    [ [ $1 ] keep [ $3 ] keep [ $2 ] keep $4 ] }
+    { "NOP" [ drop ] }
+    { "RET-NN" [ ret-from-sub ] }
+    { "RST-0" [ 0 swap (emulate-RST) ] }
+    { "RST-8" [ 8 swap (emulate-RST) ] }
+    { "RST-10H" [ HEX: 10 swap (emulate-RST) ] }
+    { "RST-18H" [ HEX: 18 swap (emulate-RST) ] }
+    { "RST-20H" [ HEX: 20 swap (emulate-RST) ] }
+    { "RST-28H" [ HEX: 28 swap (emulate-RST) ] }
+    { "RST-30H" [ HEX: 30 swap (emulate-RST) ] }
+    { "RST-38H" [ HEX: 38 swap (emulate-RST) ] }
+    { "RET-F|FF" [ dup $1 [ 6 over inc-cycles ret-from-sub ] [ drop ] if ] }
+    { "CP-N" [ [ a>> ] keep [ next-byte ] keep sub-byte drop ] }
+    { "CP-R" [ [ a>> ] keep [ $1 ] keep sub-byte drop ] }
+    { "CP-(RR)" [ [ a>> ] keep [ $1 ] keep [ read-byte ] keep sub-byte drop ] }
+    { "OR-N" [ [ a>> ] keep [ next-byte ] keep [ or-byte ] keep a<< ] }
+    { "OR-R" [ [ a>> ] keep [ $1 ] keep [ or-byte ] keep a<< ] }
+    { "OR-(RR)" [ [ a>> ] keep [ $1 ] keep [ read-byte ] keep [ or-byte ] keep a<< ] }
+    { "XOR-N" [ [ a>> ] keep [ next-byte ] keep [ xor-byte ] keep a<< ] }
+    { "XOR-R" [ [ a>> ] keep [ $1 ] keep [ xor-byte ] keep a<< ] }
+    { "XOR-(RR)" [ [ a>> ] keep [ $1 ] keep [ read-byte ] keep [ xor-byte ] keep a<< ] }
+    { "AND-N" [ [ a>> ] keep [ next-byte ] keep [ and-byte ] keep a<< ] }
+    { "AND-R" [ [ a>> ] keep [ $1 ] keep [ and-byte ] keep a<< ] }
+    { "AND-(RR)" [ [ a>> ] keep [ $1 ] keep [ read-byte ] keep [ and-byte ] keep a<< ] }
+    { "ADC-R,N" [ [ $1 ] keep [ next-byte ] keep [ add-byte-with-carry ] keep $2 ] }
+    { "ADC-R,R" [ [ $1 ] keep [ $3 ] keep [ add-byte-with-carry ] keep $2 ] }
+    { "ADC-R,(RR)" [ [ $1 ] keep [ $3 ] keep [ read-byte ] keep [ add-byte-with-carry ] keep $2 ] }
+    { "ADD-R,N" [ [ $1 ] keep [ next-byte ] keep [ add-byte ] keep $2 ] }
+    { "ADD-R,R" [ [ $1 ] keep [ $3 ] keep [ add-byte ] keep $2 ] }
+    { "ADD-RR,RR" [ [ $1 ] keep [ $3 ] keep [ add-word ] keep $2 ] }
+    { "ADD-R,(RR)" [ [ $1 ] keep [ $3 ] keep [ read-byte ] keep [ add-byte ] keep $2 ] }
+    { "SBC-R,N" [ [ $1 ] keep [ next-byte ] keep [ sub-byte-with-carry ] keep $2 ] }
+    { "SBC-R,R" [ [ $1 ] keep [ $3 ] keep [ sub-byte-with-carry ] keep $2 ] }
+    { "SBC-R,(RR)" [ [ $1 ] keep [ $3 ] keep [ read-byte ] keep [ sub-byte-with-carry ] keep $2 ] }
+    { "SUB-R" [ [ a>> ] keep [ $1 ] keep [ sub-byte ] keep a<< ] }
+    { "SUB-(RR)" [ [ a>> ] keep [ $1 ] keep [ read-byte ] keep [ sub-byte ] keep a<< ] }
+    { "SUB-N" [ [ a>> ] keep [ next-byte ] keep [ sub-byte ] keep a<< ] }
+    { "CPL" [ (emulate-CPL) ] }
+    { "DAA" [ (emulate-DAA) ] }
+    { "RLA" [ (emulate-RLA) ] }
+    { "RRA" [ (emulate-RRA) ] }
+    { "CCF" [ carry-flag swap cpu-f-bitxor= ] }
+    { "SCF" [ carry-flag swap cpu-f-bitor= ] }
+    { "RLCA" [ (emulate-RLCA) ] }
+    { "RRCA" [ (emulate-RRCA) ] }
+    { "HALT" [ drop ] }
+    { "DI" [ [ 255 interrupt-flag - ] swap cpu-f-bitand ] }
+    { "EI" [ [ interrupt-flag ] swap cpu-f-bitor ] } 
+    { "POP-RR" [ [ pop-sp ] keep $2 ] }
+    { "PUSH-RR" [ [ $1 ] keep push-sp ] }
+    { "INC-R" [ [ $1 ] keep [ inc-byte ] keep $2 ] }
+    { "DEC-R" [ [ $1 ] keep [ dec-byte ] keep $2 ] }
+    { "INC-RR" [ [ $1 ] keep [ inc-word ] keep $2 ] }
+    { "DEC-RR" [ [ $1 ] keep [ dec-word ] keep $2 ] }
+    { "DEC-(RR)" [ [ $1 ] keep [ read-byte ] keep [ dec-byte ] keep [ $1 ] keep write-byte ] }
+    { "INC-(RR)" [ [ $1 ] keep [ read-byte ] keep [ inc-byte ] keep [ $1 ] keep write-byte ] }
+    { "JP-NN" [ [ pc>> ] keep [ read-word ] keep pc<< ] }
+    { "JP-F|FF,NN" [ [ $1 ] keep swap [ [ next-word ] keep [ pc<< ] keep [ cycles>> ] keep swap 5 + swap cycles<< ] [ [ pc>> 2 + ] keep pc<< ] if ] }
+    { "JP-(RR)" [ [ $1 ] keep pc<< ] }
+    { "CALL-NN" [ (emulate-CALL) ] }
+    { "CALL-F|FF,NN" [ [ $1 ] keep swap [ 7 over inc-cycles (emulate-CALL) ] [ [ pc>> 2 + ] keep pc<< ] if ] }
+    { "LD-RR,NN" [ [ next-word ] keep $2 ] }
+    { "LD-RR,RR" [ [ $3 ] keep $2 ] }
+    { "LD-R,N" [ [ next-byte ] keep $2 ] }
+    { "LD-(RR),N" [ [ next-byte ] keep [ $1 ] keep write-byte ] }
+    { "LD-(RR),R" [ [ $3 ] keep [ $1 ] keep write-byte ] }
+    { "LD-R,R" [ [ $3 ] keep $2 ] }
+    { "LD-R,(RR)" [ [ $3 ] keep [ read-byte ] keep $2 ] }
+    { "LD-(NN),RR" [ [ $1 ] keep [ next-word ] keep write-word ] }
+    { "LD-(NN),R" [ [ $1 ] keep [ next-word ] keep write-byte ] }
+    { "LD-RR,(NN)" [ [ next-word ] keep [ read-word ] keep $2 ] }
+    { "LD-R,(NN)" [ [ next-word ] keep [ read-byte ] keep $2 ] }
+    { "OUT-(N),R" [ [ $1 ] keep [ next-byte ] keep write-port ] }
+    { "IN-R,(N)" [ [ next-byte ] keep [ read-port ] keep a<< ] }
+    { "EX-(RR),RR" [ [ $1 ] keep [ read-word ] keep [ $3 ] keep [ $1 ] keep [ write-word ] keep $4 ] }
+    { "EX-RR,RR" [ [ $1 ] keep [ $3 ] keep [ $2 ] keep $4 ] }
   } ;
 
 : 8-bit-registers ( -- parser )
index 6be74156be5b0a6d4e71afeedcd6093e22c7f5de..2fcb9434b70f46ce4259556f0464559c6bfd6986 100644 (file)
@@ -20,7 +20,7 @@ IN: cpu.8080.test
   over get-cycles over inc-cycles\r
   [ swap instructions nth call( cpu -- ) ] keep\r
   [ pc>> HEX: FFFF bitand ] keep \r
-  [ (>>pc) ] keep \r
+  [ pc<< ] keep \r
   process-interrupts ;\r
 \r
 : test-step ( cpu -- cpu )\r
diff --git a/extra/cuda/authors.txt b/extra/cuda/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/cuda/contexts/contexts.factor b/extra/cuda/contexts/contexts.factor
new file mode 100644 (file)
index 0000000..7a9ab59
--- /dev/null
@@ -0,0 +1,34 @@
+! (c)2010 Joe Groff bsd license
+USING: alien.c-types alien.data continuations cuda cuda.ffi
+cuda.libraries alien.destructors fry kernel namespaces ;
+IN: cuda.contexts
+
+: set-up-cuda-context ( -- )
+    H{ } clone cuda-modules set-global
+    H{ } clone cuda-functions set-global ; inline
+
+: create-context ( device flags -- context )
+    swap
+    [ CUcontext <c-object> ] 2dip
+    [ cuCtxCreate cuda-error ] 3keep 2drop *void* ; inline
+
+: sync-context ( -- )
+    cuCtxSynchronize cuda-error ; inline
+
+: context-device ( -- n )
+    CUdevice <c-object> [ cuCtxGetDevice cuda-error ] keep *int ; inline
+
+: destroy-context ( context -- ) cuCtxDestroy cuda-error ; inline
+
+: clean-up-context ( context -- )
+    [ sync-context ] ignore-errors destroy-context ; inline
+
+DESTRUCTOR: destroy-context
+DESTRUCTOR: clean-up-context
+
+: (with-cuda-context) ( context quot -- )
+    swap '[ _ clean-up-context ] [ ] cleanup ; inline
+
+: with-cuda-context ( device flags quot -- )
+    [ set-up-cuda-context create-context ] dip (with-cuda-context) ; inline
+
diff --git a/extra/cuda/cuda-tests.factor b/extra/cuda/cuda-tests.factor
new file mode 100644 (file)
index 0000000..28fe222
--- /dev/null
@@ -0,0 +1,7 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: cuda kernel tools.test ;
+IN: cuda.tests
+
+! [ ] [ [ 0 0 [ drop ] with-cuda-context ] with-cuda ] unit-test
+! [ ] [ 100 cuda-malloc cuda-free ] unit-test
diff --git a/extra/cuda/cuda.factor b/extra/cuda/cuda.factor
new file mode 100644 (file)
index 0000000..2e2cdd6
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien alien.data alien.parser alien.strings
+alien.syntax arrays assocs byte-arrays classes.struct
+combinators continuations cuda.ffi
+destructors fry init io io.backend io.encodings.string
+io.encodings.utf8 kernel lexer locals macros math math.parser
+namespaces opengl.gl.extensions parser prettyprint quotations
+sequences words ;
+QUALIFIED-WITH: alien.c-types c
+IN: cuda
+
+TUPLE: cuda-error code ;
+
+: cuda-error ( code -- )
+    dup CUDA_SUCCESS = [ drop ] [ \ cuda-error boa throw ] if ;
+
+: cuda-version ( -- n )
+    c:int <c-object> [ cuDriverGetVersion cuda-error ] keep c:*int ;
+
+: init-cuda ( -- )
+    0 cuInit cuda-error ; inline
+
diff --git a/extra/cuda/demos/hello-world/authors.txt b/extra/cuda/demos/hello-world/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/cuda/demos/hello-world/hello-world.factor b/extra/cuda/demos/hello-world/hello-world.factor
new file mode 100644 (file)
index 0000000..8a7adb7
--- /dev/null
@@ -0,0 +1,26 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types alien.strings byte-arrays cuda
+cuda.contexts cuda.devices cuda.libraries cuda.memory cuda.syntax
+destructors io io.encodings.string io.encodings.utf8 kernel locals
+math math.parser namespaces sequences strings ;
+IN: cuda.demos.hello-world
+
+CUDA-LIBRARY: hello cuda32 vocab:cuda/demos/hello-world/hello.ptx
+
+CUDA-FUNCTION: helloWorld ( char* string-ptr ) ;
+
+: cuda-hello-world ( -- )
+    init-cuda
+    [
+        [
+            context-device number>string
+            "CUDA device " ": " surround write
+            "Hello World!" >byte-array [ - ] map-index host>device &cuda-free
+
+            [ { 2 1 } { 6 1 1 } <grid> helloWorld ]
+            [ 12 device>host >string print ] bi
+        ] with-destructors
+    ] with-each-cuda-device ;
+
+MAIN: cuda-hello-world
diff --git a/extra/cuda/demos/hello-world/hello.cu b/extra/cuda/demos/hello-world/hello.cu
new file mode 100644 (file)
index 0000000..1f3cd67
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ World using CUDA
+** 
+** The string "Hello World!" is mangled then restored using a common CUDA idiom
+**
+** Byron Galbraith
+** 2009-02-18
+*/
+#include <cuda.h>
+#include <stdio.h>
+
+// Prototypes
+extern "C" __global__ void helloWorld(char*);
+
+// Host function
+int
+main(int argc, char** argv)
+{
+  int i;
+
+  // desired output
+  char str[] = "Hello World!";
+
+  // mangle contents of output
+  // the null character is left intact for simplicity
+  for(i = 0; i < 12; i++)
+    str[i] -= i;
+
+  // allocate memory on the device 
+  char *d_str;
+  size_t size = sizeof(str);
+  cudaMalloc((void**)&d_str, size);
+
+  // copy the string to the device
+  cudaMemcpy(d_str, str, size, cudaMemcpyHostToDevice);
+
+  // set the grid and block sizes
+  dim3 dimGrid(2);   // one block per word  
+  dim3 dimBlock(6); // one thread per character
+  
+  // invoke the kernel
+  helloWorld<<< dimGrid, dimBlock >>>(d_str);
+
+  // retrieve the results from the device
+  cudaMemcpy(str, d_str, size, cudaMemcpyDeviceToHost);
+
+  // free up the allocated memory on the device
+  cudaFree(d_str);
+  
+  // everyone's favorite part
+  printf("%s\n", str);
+
+  return 0;
+}
+
+// Device kernel
+__global__ void
+helloWorld(char* str)
+{
+  // determine where in the thread grid we are
+  int idx = blockIdx.x * blockDim.x + threadIdx.x;
+
+  // unmangle output
+  str[idx] += idx;
+}
diff --git a/extra/cuda/demos/hello-world/hello.ptx b/extra/cuda/demos/hello-world/hello.ptx
new file mode 100644 (file)
index 0000000..049bb5e
--- /dev/null
@@ -0,0 +1,71 @@
+       .version 1.4
+       .target sm_10, map_f64_to_f32
+       // compiled with /usr/local/cuda/bin/../open64/lib//be
+       // nvopencc 3.0 built on 2010-03-11
+
+       //-----------------------------------------------------------
+       // Compiling /tmp/tmpxft_00000eab_00000000-7_hello.cpp3.i (/var/folders/KD/KDnx4D80Eh0fsORqNrFWBE+++TI/-Tmp-/ccBI#.AYqbdQ)
+       //-----------------------------------------------------------
+
+       //-----------------------------------------------------------
+       // Options:
+       //-----------------------------------------------------------
+       //  Target:ptx, ISA:sm_10, Endian:little, Pointer Size:32
+       //  -O3 (Optimization level)
+       //  -g0 (Debug level)
+       //  -m2 (Report advisories)
+       //-----------------------------------------------------------
+
+       .file   1       "<command-line>"
+       .file   2       "/tmp/tmpxft_00000eab_00000000-6_hello.cudafe2.gpu"
+       .file   3       "/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stddef.h"
+       .file   4       "/usr/local/cuda/bin/../include/crt/device_runtime.h"
+       .file   5       "/usr/local/cuda/bin/../include/host_defines.h"
+       .file   6       "/usr/local/cuda/bin/../include/builtin_types.h"
+       .file   7       "/usr/local/cuda/bin/../include/device_types.h"
+       .file   8       "/usr/local/cuda/bin/../include/driver_types.h"
+       .file   9       "/usr/local/cuda/bin/../include/texture_types.h"
+       .file   10      "/usr/local/cuda/bin/../include/vector_types.h"
+       .file   11      "/usr/local/cuda/bin/../include/device_launch_parameters.h"
+       .file   12      "/usr/local/cuda/bin/../include/crt/storage_class.h"
+       .file   13      "/usr/include/i386/_types.h"
+       .file   14      "/usr/include/time.h"
+       .file   15      "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
+       .file   16      "/usr/local/cuda/bin/../include/common_functions.h"
+       .file   17      "/usr/local/cuda/bin/../include/crt/func_macro.h"
+       .file   18      "/usr/local/cuda/bin/../include/math_functions.h"
+       .file   19      "/usr/local/cuda/bin/../include/device_functions.h"
+       .file   20      "/usr/local/cuda/bin/../include/math_constants.h"
+       .file   21      "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
+       .file   22      "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
+       .file   23      "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
+       .file   24      "/usr/local/cuda/bin/../include/common_types.h"
+       .file   25      "/usr/local/cuda/bin/../include/sm_20_atomic_functions.h"
+       .file   26      "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
+       .file   27      "/usr/local/cuda/bin/../include/math_functions_dbl_ptx1.h"
+       .file   28      "hello.cu"
+
+
+       .entry helloWorld (
+               .param .u32 __cudaparm_helloWorld_str)
+       {
+       .reg .u16 %rh<4>;
+       .reg .u32 %r<9>;
+       .loc    28      58      0
+$LBB1_helloWorld:
+       .loc    28      64      0
+       mov.u16         %rh1, %ctaid.x;
+       mov.u16         %rh2, %ntid.x;
+       mul.wide.u16    %r1, %rh1, %rh2;
+       cvt.u32.u16     %r2, %tid.x;
+       add.u32         %r3, %r2, %r1;
+       ld.param.u32    %r4, [__cudaparm_helloWorld_str];
+       add.u32         %r5, %r4, %r3;
+       ld.global.s8    %r6, [%r5+0];
+       add.s32         %r7, %r6, %r3;
+       st.global.s8    [%r5+0], %r7;
+       .loc    28      65      0
+       exit;
+$LDWend_helloWorld:
+       } // helloWorld
+
diff --git a/extra/cuda/demos/prefix-sum/authors.txt b/extra/cuda/demos/prefix-sum/authors.txt
new file mode 100644 (file)
index 0000000..2d6d456
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Joe Groff
diff --git a/extra/cuda/demos/prefix-sum/prefix-sum.cu b/extra/cuda/demos/prefix-sum/prefix-sum.cu
new file mode 100644 (file)
index 0000000..a77a67f
--- /dev/null
@@ -0,0 +1,103 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <cuda_runtime.h>
+
+static const int LOG_BANK_COUNT = 4;
+
+static inline __device__ __host__ unsigned shared_offset(unsigned i)
+{
+    return i + (i >> LOG_BANK_COUNT);
+}
+
+static inline __device__ __host__ unsigned offset_a(unsigned offset, unsigned i)
+{
+    return shared_offset(offset * (2*i + 1) - 1);
+}
+
+static inline __device__ __host__ unsigned offset_b(unsigned offset, unsigned i)
+{
+    return shared_offset(offset * (2*i + 2) - 1);
+}
+
+static inline __device__ __host__ unsigned lpot(unsigned x)
+{
+    --x; x |= x>>1; x|=x>>2; x|=x>>4; x|=x>>8; x|=x>>16; return ++x;
+}
+
+template<typename T>
+__global__ void prefix_sum_block(T *in, T *out, unsigned n)
+{
+    extern __shared__ T temp[];
+
+    int idx = threadIdx.x;
+    int blocksize = blockDim.x;
+
+    temp[shared_offset(idx            )] = (idx             < n) ? in[idx            ] : 0;
+    temp[shared_offset(idx + blocksize)] = (idx + blocksize < n) ? in[idx + blocksize] : 0;
+
+    int offset, d;
+    for (offset = 1, d = blocksize; d > 0; d >>= 1, offset <<= 1) {
+        __syncthreads();
+        if (idx < d) {
+            unsigned a = offset_a(offset, idx), b = offset_b(offset, idx);
+            temp[b] += temp[a];
+        }
+    }
+
+    if (idx == 0) temp[shared_offset(blocksize*2 - 1)] = 0;
+
+    for (d = 1; d <= blocksize; d <<= 1) {
+        offset >>= 1;
+        __syncthreads();
+
+        if (idx < d) {
+            unsigned a = offset_a(offset, idx), b = offset_b(offset, idx);
+            unsigned t = temp[a];
+            temp[a] = temp[b];
+            temp[b] += t;
+        }
+    }
+    __syncthreads();
+
+    if (idx             < n) out[idx            ] = temp[shared_offset(idx            )];
+    if (idx + blocksize < n) out[idx + blocksize] = temp[shared_offset(idx + blocksize)];
+}
+
+template<typename T>
+void prefix_sum(T *in, T *out, unsigned n)
+{
+    char *device_values;
+    unsigned n_lpot = lpot(n);
+    size_t n_pitch;
+
+    cudaError_t error = cudaMallocPitch((void**)&device_values, &n_pitch, sizeof(T)*n, 2);
+    if (error != 0) {
+        printf("error %u allocating width %lu height %u\n", error, sizeof(T)*n, 2);
+        exit(1);
+    }
+
+    cudaMemcpy(device_values, in, sizeof(T)*n, cudaMemcpyHostToDevice);
+
+    prefix_sum_block<<<1, n_lpot/2, shared_offset(n_lpot)*sizeof(T)>>>
+        ((T*)device_values, (T*)(device_values + n_pitch), n);
+
+    cudaMemcpy(out, device_values + n_pitch, sizeof(T)*n, cudaMemcpyDeviceToHost);
+    cudaFree(device_values);
+}
+
+int main()
+{
+    sranddev();
+
+    static unsigned in_values[1024], out_values[1024];
+
+    for (int i = 0; i < 1024; ++i)
+        in_values[i] = rand() >> 21;
+
+    prefix_sum(in_values, out_values, 1024);
+
+    for (int i = 0; i < 1024; ++i)
+        printf("%5d => %5d\n", in_values[i], out_values[i]);
+
+    return 0;
+}
diff --git a/extra/cuda/demos/prefix-sum/prefix-sum.factor b/extra/cuda/demos/prefix-sum/prefix-sum.factor
new file mode 100644 (file)
index 0000000..d217f61
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types cuda cuda.contexts cuda.libraries cuda.syntax locals ;
+IN: cuda.demos.prefix-sum
+
+CUDA-LIBRARY: prefix-sum cuda32 vocab:cuda/demos/prefix-sum/prefix-sum.ptx
+
+CUDA-FUNCTION: prefix_sum_block ( uint* in, uint* out, uint n ) ;
+
+:: cuda-prefix-sum ( -- )
+    init-cuda
+    0 0 [
+        ! { 1 1 1 } { 2 1 } 0 <grid-shared> prefix_sum_block
+    ] with-cuda-context ;
+
+MAIN: cuda-prefix-sum
diff --git a/extra/cuda/demos/prefix-sum/prefix-sum.ptx b/extra/cuda/demos/prefix-sum/prefix-sum.ptx
new file mode 100644 (file)
index 0000000..d189179
--- /dev/null
@@ -0,0 +1,222 @@
+       .version 1.4
+       .target sm_10, map_f64_to_f32
+       // compiled with /usr/local/cuda/bin/../open64/lib//be
+       // nvopencc 3.0 built on 2010-03-11
+
+       //-----------------------------------------------------------
+       // Compiling /tmp/tmpxft_00000236_00000000-7_prefix-sum.cpp3.i (/var/folders/K6/K6oI14wZ2RWhSE+BYqTjA++++TI/-Tmp-/ccBI#.0ATpGM)
+       //-----------------------------------------------------------
+
+       //-----------------------------------------------------------
+       // Options:
+       //-----------------------------------------------------------
+       //  Target:ptx, ISA:sm_10, Endian:little, Pointer Size:32
+       //  -O3 (Optimization level)
+       //  -g0 (Debug level)
+       //  -m2 (Report advisories)
+       //-----------------------------------------------------------
+
+       .file   1       "<command-line>"
+       .file   2       "/tmp/tmpxft_00000236_00000000-6_prefix-sum.cudafe2.gpu"
+       .file   3       "/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stddef.h"
+       .file   4       "/usr/local/cuda/bin/../include/crt/device_runtime.h"
+       .file   5       "/usr/local/cuda/bin/../include/host_defines.h"
+       .file   6       "/usr/local/cuda/bin/../include/builtin_types.h"
+       .file   7       "/usr/local/cuda/bin/../include/device_types.h"
+       .file   8       "/usr/local/cuda/bin/../include/driver_types.h"
+       .file   9       "/usr/local/cuda/bin/../include/texture_types.h"
+       .file   10      "/usr/local/cuda/bin/../include/vector_types.h"
+       .file   11      "/usr/local/cuda/bin/../include/device_launch_parameters.h"
+       .file   12      "/usr/local/cuda/bin/../include/crt/storage_class.h"
+       .file   13      "/usr/include/i386/_types.h"
+       .file   14      "/usr/include/time.h"
+       .file   15      "prefix-sum.cu"
+       .file   16      "/usr/local/cuda/bin/../include/common_functions.h"
+       .file   17      "/usr/local/cuda/bin/../include/crt/func_macro.h"
+       .file   18      "/usr/local/cuda/bin/../include/math_functions.h"
+       .file   19      "/usr/local/cuda/bin/../include/device_functions.h"
+       .file   20      "/usr/local/cuda/bin/../include/math_constants.h"
+       .file   21      "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
+       .file   22      "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
+       .file   23      "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
+       .file   24      "/usr/local/cuda/bin/../include/common_types.h"
+       .file   25      "/usr/local/cuda/bin/../include/sm_20_atomic_functions.h"
+       .file   26      "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
+       .file   27      "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
+       .file   28      "/usr/local/cuda/bin/../include/math_functions_dbl_ptx1.h"
+
+       .extern .shared .align 4 .b8 temp[];
+
+       .entry _Z16prefix_sum_blockIjEvPT_S1_j (
+               .param .u32 __cudaparm__Z16prefix_sum_blockIjEvPT_S1_j_in,
+               .param .u32 __cudaparm__Z16prefix_sum_blockIjEvPT_S1_j_out,
+               .param .u32 __cudaparm__Z16prefix_sum_blockIjEvPT_S1_j_n)
+       {
+       .reg .u32 %r<81>;
+       .reg .pred %p<11>;
+       .loc    15      28      0
+$LBB1__Z16prefix_sum_blockIjEvPT_S1_j:
+       ld.param.u32    %r1, [__cudaparm__Z16prefix_sum_blockIjEvPT_S1_j_n];
+       cvt.s32.u16     %r2, %tid.x;
+       setp.lt.u32     %p1, %r2, %r1;
+       @!%p1 bra       $Lt_0_7938;
+       .loc    15      35      0
+       ld.param.u32    %r3, [__cudaparm__Z16prefix_sum_blockIjEvPT_S1_j_in];
+       mul24.lo.u32    %r4, %r2, 4;
+       add.u32         %r5, %r3, %r4;
+       ld.global.u32   %r6, [%r5+0];
+       bra.uni         $Lt_0_7682;
+$Lt_0_7938:
+       mov.u32         %r6, 0;
+$Lt_0_7682:
+       mov.u32         %r7, temp;
+       shr.u32         %r8, %r2, 4;
+       add.u32         %r9, %r2, %r8;
+       mul.lo.u32      %r10, %r9, 4;
+       add.u32         %r11, %r10, %r7;
+       st.shared.u32   [%r11+0], %r6;
+       cvt.s32.u16     %r12, %ntid.x;
+       add.s32         %r13, %r12, %r2;
+       .loc    15      28      0
+       ld.param.u32    %r1, [__cudaparm__Z16prefix_sum_blockIjEvPT_S1_j_n];
+       .loc    15      35      0
+       setp.lt.u32     %p2, %r13, %r1;
+       @!%p2 bra       $Lt_0_8450;
+       .loc    15      36      0
+       ld.param.u32    %r14, [__cudaparm__Z16prefix_sum_blockIjEvPT_S1_j_in];
+       mul.lo.u32      %r15, %r13, 4;
+       add.u32         %r16, %r14, %r15;
+       ld.global.u32   %r17, [%r16+0];
+       bra.uni         $Lt_0_8194;
+$Lt_0_8450:
+       mov.u32         %r17, 0;
+$Lt_0_8194:
+       shr.u32         %r18, %r13, 4;
+       add.u32         %r19, %r13, %r18;
+       mul.lo.u32      %r20, %r19, 4;
+       add.u32         %r21, %r20, %r7;
+       st.shared.u32   [%r21+0], %r17;
+       .loc    15      39      0
+       mov.s32         %r22, %r12;
+       mov.u32         %r23, 0;
+       setp.le.s32     %p3, %r12, %r23;
+       mov.s32         %r24, 1;
+       @%p3 bra        $Lt_0_13314;
+$Lt_0_9218:
+ //<loop> Loop body line 39, nesting depth: 1, estimated iterations: unknown
+       .loc    15      40      0
+       bar.sync        0;
+       setp.le.s32     %p4, %r22, %r2;
+       @%p4 bra        $Lt_0_9474;
+ //<loop> Part of loop body line 39, head labeled $Lt_0_9218
+       .loc    15      43      0
+       mul24.lo.u32    %r25, %r2, 2;
+       add.u32         %r26, %r25, 1;
+       add.u32         %r27, %r25, 2;
+       mul.lo.u32      %r28, %r24, %r26;
+       mul.lo.u32      %r29, %r24, %r27;
+       sub.u32         %r30, %r29, 1;
+       shr.u32         %r31, %r30, 4;
+       add.u32         %r32, %r29, %r31;
+       mul.lo.u32      %r33, %r32, 4;
+       add.u32         %r34, %r33, %r7;
+       ld.shared.u32   %r35, [%r34+-4];
+       sub.u32         %r36, %r28, 1;
+       shr.u32         %r37, %r36, 4;
+       add.u32         %r38, %r28, %r37;
+       mul.lo.u32      %r39, %r38, 4;
+       add.u32         %r40, %r7, %r39;
+       ld.shared.u32   %r41, [%r40+-4];
+       add.u32         %r42, %r35, %r41;
+       st.shared.u32   [%r34+-4], %r42;
+$Lt_0_9474:
+ //<loop> Part of loop body line 39, head labeled $Lt_0_9218
+       .loc    15      39      0
+       shr.s32         %r22, %r22, 1;
+       shl.b32         %r24, %r24, 1;
+       mov.u32         %r43, 0;
+       setp.gt.s32     %p5, %r22, %r43;
+       @%p5 bra        $Lt_0_9218;
+       bra.uni         $Lt_0_8706;
+$Lt_0_13314:
+$Lt_0_8706:
+       mov.u32         %r44, 0;
+       setp.ne.s32     %p6, %r2, %r44;
+       @%p6 bra        $Lt_0_10242;
+       .loc    15      47      0
+       mul24.lo.s32    %r45, %r12, 2;
+       mov.u32         %r46, 0;
+       sub.u32         %r47, %r45, 1;
+       shr.u32         %r48, %r47, 4;
+       add.u32         %r49, %r45, %r48;
+       mul.lo.u32      %r50, %r49, 4;
+       add.u32         %r51, %r7, %r50;
+       st.shared.u32   [%r51+-4], %r46;
+$Lt_0_10242:
+       mov.u32         %r52, 1;
+       setp.lt.s32     %p7, %r12, %r52;
+       @%p7 bra        $Lt_0_10754;
+       mov.s32         %r22, 1;
+$Lt_0_11266:
+ //<loop> Loop body line 47, nesting depth: 1, estimated iterations: unknown
+       .loc    15      50      0
+       shr.s32         %r24, %r24, 1;
+       .loc    15      51      0
+       bar.sync        0;
+       setp.le.s32     %p8, %r22, %r2;
+       @%p8 bra        $Lt_0_11522;
+ //<loop> Part of loop body line 47, head labeled $Lt_0_11266
+       .loc    15      55      0
+       mul24.lo.u32    %r53, %r2, 2;
+       add.u32         %r54, %r53, 1;
+       mul.lo.u32      %r55, %r24, %r54;
+       sub.u32         %r56, %r55, 1;
+       shr.u32         %r57, %r56, 4;
+       add.u32         %r58, %r55, %r57;
+       mul.lo.u32      %r59, %r58, 4;
+       add.u32         %r60, %r59, %r7;
+       ld.shared.u32   %r61, [%r60+-4];
+       .loc    15      56      0
+       add.u32         %r62, %r53, 2;
+       mul.lo.u32      %r63, %r24, %r62;
+       sub.u32         %r64, %r63, 1;
+       shr.u32         %r65, %r64, 4;
+       add.u32         %r66, %r63, %r65;
+       mul.lo.u32      %r67, %r66, 4;
+       add.u32         %r68, %r67, %r7;
+       ld.shared.u32   %r69, [%r68+-4];
+       st.shared.u32   [%r60+-4], %r69;
+       .loc    15      57      0
+       ld.shared.u32   %r70, [%r68+-4];
+       add.u32         %r71, %r70, %r61;
+       st.shared.u32   [%r68+-4], %r71;
+$Lt_0_11522:
+ //<loop> Part of loop body line 47, head labeled $Lt_0_11266
+       .loc    15      49      0
+       shl.b32         %r22, %r22, 1;
+       setp.le.s32     %p9, %r22, %r12;
+       @%p9 bra        $Lt_0_11266;
+$Lt_0_10754:
+       .loc    15      60      0
+       bar.sync        0;
+       @!%p1 bra       $Lt_0_12290;
+       .loc    15      62      0
+       ld.shared.u32   %r72, [%r11+0];
+       ld.param.u32    %r73, [__cudaparm__Z16prefix_sum_blockIjEvPT_S1_j_out];
+       mul24.lo.u32    %r74, %r2, 4;
+       add.u32         %r75, %r73, %r74;
+       st.global.u32   [%r75+0], %r72;
+$Lt_0_12290:
+       @!%p2 bra       $Lt_0_12802;
+       .loc    15      63      0
+       ld.shared.u32   %r76, [%r21+0];
+       ld.param.u32    %r77, [__cudaparm__Z16prefix_sum_blockIjEvPT_S1_j_out];
+       mul.lo.u32      %r78, %r13, 4;
+       add.u32         %r79, %r77, %r78;
+       st.global.u32   [%r79+0], %r76;
+$Lt_0_12802:
+       .loc    15      64      0
+       exit;
+$LDWend__Z16prefix_sum_blockIjEvPT_S1_j:
+       } // _Z16prefix_sum_blockIjEvPT_S1_j
+
diff --git a/extra/cuda/devices/authors.txt b/extra/cuda/devices/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/cuda/devices/devices-tests.factor b/extra/cuda/devices/devices-tests.factor
new file mode 100644 (file)
index 0000000..fc648d4
--- /dev/null
@@ -0,0 +1,13 @@
+! (c)2010 Joe Groff bsd license
+USING: cuda.devices tools.test ;
+IN: cuda.devices.tests
+
+[ 1  5 100 ] [  5 20 100 10 (distribute-jobs) ] unit-test 
+[ 2  5 100 ] [ 10 20 100 10 (distribute-jobs) ] unit-test 
+[ 2  5 100 ] [ 10 20 200  5 (distribute-jobs) ] unit-test 
+[ 2  5 100 ] [ 10 20 300  6 (distribute-jobs) ] unit-test 
+[ 2  6 120 ] [ 11 20 300  6 (distribute-jobs) ] unit-test 
+[ 1 10 200 ] [ 10 20 200 10 (distribute-jobs) ] unit-test 
+[ 1 10   0 ] [ 10  0 200 10 (distribute-jobs) ] unit-test 
+[ 2  5   0 ] [ 10  0 200  9 (distribute-jobs) ] unit-test 
+
diff --git a/extra/cuda/devices/devices.factor b/extra/cuda/devices/devices.factor
new file mode 100644 (file)
index 0000000..4e7a50e
--- /dev/null
@@ -0,0 +1,90 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types alien.data alien.strings arrays
+assocs byte-arrays classes.struct combinators cuda
+cuda.contexts cuda.ffi cuda.libraries fry io io.encodings.utf8
+kernel locals math math.order math.parser namespaces
+prettyprint sequences ;
+IN: cuda.devices
+
+: #cuda-devices ( -- n )
+    int <c-object> [ cuDeviceGetCount cuda-error ] keep *int ;
+
+: n>cuda-device ( n -- device )
+    [ CUdevice <c-object> ] dip [ cuDeviceGet cuda-error ] 2keep drop *int ;
+
+: enumerate-cuda-devices ( -- devices )
+    #cuda-devices iota [ n>cuda-device ] map ;
+
+: with-each-cuda-device ( quot -- )
+    [ enumerate-cuda-devices ] dip '[ 0 _ with-cuda-context ] each ; inline
+
+: cuda-device-properties ( n -- properties )
+    [ CUdevprop <struct> ] dip
+    [ cuDeviceGetProperties cuda-error ] 2keep drop ;
+
+: cuda-devices ( -- assoc )
+    enumerate-cuda-devices [ dup cuda-device-properties ] { } map>assoc ;
+
+: cuda-device-name ( n -- string )
+    [ 256 [ <byte-array> ] keep ] dip
+    [ cuDeviceGetName cuda-error ]
+    [ 2drop utf8 alien>string ] 3bi ;
+
+: cuda-device-capability ( n -- pair )
+    [ int <c-object> int <c-object> ] dip
+    [ cuDeviceComputeCapability cuda-error ]
+    [ drop [ *int ] bi@ ] 3bi 2array ;
+
+: cuda-device-memory ( n -- bytes )
+    [ uint <c-object> ] dip
+    [ cuDeviceTotalMem cuda-error ]
+    [ drop *uint ] 2bi ;
+
+: cuda-device-attribute ( attribute n -- n )
+    [ int <c-object> ] 2dip
+    [ cuDeviceGetAttribute cuda-error ]
+    [ 2drop *int ] 3bi ;
+
+: cuda-device. ( n -- )
+    {
+        [ "Device: " write number>string print ]
+        [ "Name: " write cuda-device-name print ]
+        [ "Memory: " write cuda-device-memory number>string print ]
+        [
+            "Capability: " write
+            cuda-device-capability [ number>string ] map " " join print
+        ]
+        [ "Properties: " write cuda-device-properties . ]
+        [
+            "CU_DEVICE_ATTRIBUTE_GPU_OVERLAP: " write
+            CU_DEVICE_ATTRIBUTE_GPU_OVERLAP swap
+            cuda-device-attribute number>string print
+        ]
+    } cleave ;
+
+: cuda. ( -- )
+    init-cuda
+    "CUDA Version: " write cuda-version number>string print nl
+    #cuda-devices iota [ nl ] [ cuda-device. ] interleave ;
+
+: up/i ( x y -- z )
+    [ 1 - + ] keep /i ; inline
+
+: context-device-properties ( -- props )
+    context-device cuda-device-properties ; inline
+
+:: (distribute-jobs) ( job-count per-job-shared max-shared-size max-block-size
+                       -- grid-size block-size per-block-shared )
+    per-job-shared [ max-block-size ] [ max-shared-size swap /i max-block-size min ] if-zero
+        job-count min :> job-max-block-size
+    job-count job-max-block-size up/i :> grid-size
+    job-count grid-size up/i          :> block-size
+    block-size per-job-shared *       :> per-block-shared
+
+    grid-size block-size per-block-shared ; inline
+
+: distribute-jobs ( job-count per-job-shared -- launcher )
+    context-device-properties
+    [ sharedMemPerBlock>> ] [ maxThreadsPerBlock>> ] bi
+    (distribute-jobs) <grid-shared> ; inline
diff --git a/extra/cuda/ffi/ffi.factor b/extra/cuda/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..c0537be
--- /dev/null
@@ -0,0 +1,453 @@
+! (c)2010 Joe Groff bsd license
+USING: accessors alien alien.c-types alien.libraries alien.syntax
+classes.struct combinators kernel system ;
+IN: cuda.ffi
+
+<<
+"cuda" {
+    { [ os windows? ] [ "nvcuda.dll" stdcall ] }
+    { [ os macosx? ] [ "/usr/local/cuda/lib/libcuda.dylib" cdecl ] }
+    { [ os unix? ] [ "libcuda.so" cdecl ] }
+} cond add-library
+>>
+
+LIBRARY: cuda
+
+TYPEDEF: uint CUdeviceptr
+TYPEDEF: int CUdevice
+TYPEDEF: void* CUcontext
+TYPEDEF: void* CUmodule
+TYPEDEF: void* CUfunction
+TYPEDEF: void* CUarray
+TYPEDEF: void* CUtexref
+TYPEDEF: void* CUevent
+TYPEDEF: void* CUstream
+TYPEDEF: void* CUgraphicsResource
+
+! versions of double and longlong that always 8-byte align
+
+SYMBOLS: CUdouble CUlonglong CUulonglong ;
+
+<<
+: always-8-byte-align ( c-type -- c-type )
+    8 >>align 8 >>align-first ;
+
+longlong  c-type clone always-8-byte-align \ CUlonglong  typedef
+ulonglong c-type clone always-8-byte-align \ CUulonglong typedef
+double    c-type clone always-8-byte-align \ CUdouble    typedef
+>>
+
+STRUCT: CUuuid
+    { bytes char[16] } ;
+
+ENUM: CUctx_flags
+    { CU_CTX_SCHED_AUTO  0 }
+    { CU_CTX_SCHED_SPIN  1 }
+    { CU_CTX_SCHED_YIELD 2 }
+    { CU_CTX_SCHED_MASK  3 }
+    { CU_CTX_BLOCKING_SYNC 4 }
+    { CU_CTX_MAP_HOST      8 }
+    { CU_CTX_LMEM_RESIZE_TO_MAX 16 }
+    { CU_CTX_FLAGS_MASK  HEX: 1f } ;
+
+ENUM: CUevent_flags
+    { CU_EVENT_DEFAULT       0 }
+    { CU_EVENT_BLOCKING_SYNC 1 } ;
+
+ENUM: CUarray_format
+    { CU_AD_FORMAT_UNSIGNED_INT8  HEX: 01 }
+    { CU_AD_FORMAT_UNSIGNED_INT16 HEX: 02 }
+    { CU_AD_FORMAT_UNSIGNED_INT32 HEX: 03 }
+    { CU_AD_FORMAT_SIGNED_INT8    HEX: 08 }
+    { CU_AD_FORMAT_SIGNED_INT16   HEX: 09 }
+    { CU_AD_FORMAT_SIGNED_INT32   HEX: 0a }
+    { CU_AD_FORMAT_HALF           HEX: 10 }
+    { CU_AD_FORMAT_FLOAT          HEX: 20 } ;
+
+ENUM: CUaddress_mode
+    { CU_TR_ADDRESS_MODE_WRAP   0 }
+    { CU_TR_ADDRESS_MODE_CLAMP  1 }
+    { CU_TR_ADDRESS_MODE_MIRROR 2 } ;
+
+ENUM: CUfilter_mode
+    { CU_TR_FILTER_MODE_POINT  0 }
+    { CU_TR_FILTER_MODE_LINEAR 1 } ;
+
+ENUM: CUdevice_attribute
+    { CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK 1 }
+    { CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X 2 }
+    { CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y 3 }
+    { CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z 4 }
+    { CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X 5 }
+    { CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y 6 }
+    { CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z 7 }
+    { CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK 8 }
+    { CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK 8 }
+    { CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY 9 }
+    { CU_DEVICE_ATTRIBUTE_WARP_SIZE 10 }
+    { CU_DEVICE_ATTRIBUTE_MAX_PITCH 11 }
+    { CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK 12 }
+    { CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK 12 }
+    { CU_DEVICE_ATTRIBUTE_CLOCK_RATE 13 }
+    { CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT 14 }
+
+    { CU_DEVICE_ATTRIBUTE_GPU_OVERLAP 15 }
+    { CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT 16 }
+    { CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT 17 }
+    { CU_DEVICE_ATTRIBUTE_INTEGRATED 18 }
+    { CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY 19 }
+    { CU_DEVICE_ATTRIBUTE_COMPUTE_MODE 20 }
+    { CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH 21 }
+    { CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH 22 }
+    { CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT 23 }
+    { CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH 24 }
+    { CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT 25 }
+    { CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH 26 }
+    { CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH 27 }
+    { CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT 28 }
+    { CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES 29 }
+    { CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT 30 }
+    { CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS 31 }
+    { CU_DEVICE_ATTRIBUTE_ECC_ENABLED 32 } ;
+
+STRUCT: CUdevprop
+    { maxThreadsPerBlock int }
+    { maxThreadsDim int[3] }
+    { maxGridSize int[3] }
+    { sharedMemPerBlock int }
+    { totalConstantMemory int }
+    { SIMDWidth int }
+    { memPitch int }
+    { regsPerBlock int }
+    { clockRate int }
+    { textureAlign int } ;
+
+ENUM: CUfunction_attribute
+    { CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK 0 }
+    { CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES 1     }
+    { CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES 2      }
+    { CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES 3      }
+    { CU_FUNC_ATTRIBUTE_NUM_REGS 4              }
+    { CU_FUNC_ATTRIBUTE_PTX_VERSION 5           }
+    { CU_FUNC_ATTRIBUTE_BINARY_VERSION 6        }
+    CU_FUNC_ATTRIBUTE_MAX ;
+
+ENUM: CUfunc_cache
+    { CU_FUNC_CACHE_PREFER_NONE   HEX: 00 }
+    { CU_FUNC_CACHE_PREFER_SHARED HEX: 01 }
+    { CU_FUNC_CACHE_PREFER_L1     HEX: 02 } ;
+
+ENUM: CUmemorytype
+    { CU_MEMORYTYPE_HOST   HEX: 01 }
+    { CU_MEMORYTYPE_DEVICE HEX: 02 }
+    { CU_MEMORYTYPE_ARRAY  HEX: 03 } ;
+
+ENUM: CUcomputemode
+    { CU_COMPUTEMODE_DEFAULT    0 }
+    { CU_COMPUTEMODE_EXCLUSIVE  1 }
+    { CU_COMPUTEMODE_PROHIBITED 2 } ;
+
+ENUM: CUjit_option
+    { CU_JIT_MAX_REGISTERS 0 }
+    CU_JIT_THREADS_PER_BLOCK
+    CU_JIT_WALL_TIME
+    CU_JIT_INFO_LOG_BUFFER
+    CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES
+    CU_JIT_ERROR_LOG_BUFFER
+    CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES
+    CU_JIT_OPTIMIZATION_LEVEL
+    CU_JIT_TARGET_FROM_CUCONTEXT
+    CU_JIT_TARGET
+    CU_JIT_FALLBACK_STRATEGY ;
+
+ENUM: CUjit_target
+    { CU_TARGET_COMPUTE_10 0 }
+    CU_TARGET_COMPUTE_11
+    CU_TARGET_COMPUTE_12
+    CU_TARGET_COMPUTE_13
+    CU_TARGET_COMPUTE_20 ;
+
+ENUM: CUjit_fallback
+    { CU_PREFER_PTX 0 }
+    CU_PREFER_BINARY ;
+
+ENUM: CUgraphicsRegisterFlags
+    { CU_GRAPHICS_REGISTER_FLAGS_NONE 0 } ;
+
+ENUM: CUgraphicsMapResourceFlags
+    { CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE          HEX: 00 }
+    { CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY     HEX: 01 }
+    { CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD HEX: 02 } ;
+
+ENUM: CUarray_cubemap_face
+    { CU_CUBEMAP_FACE_POSITIVE_X  HEX: 00 }
+    { CU_CUBEMAP_FACE_NEGATIVE_X  HEX: 01 }
+    { CU_CUBEMAP_FACE_POSITIVE_Y  HEX: 02 }
+    { CU_CUBEMAP_FACE_NEGATIVE_Y  HEX: 03 }
+    { CU_CUBEMAP_FACE_POSITIVE_Z  HEX: 04 }
+    { CU_CUBEMAP_FACE_NEGATIVE_Z  HEX: 05 } ;
+
+ENUM: CUresult
+    { CUDA_SUCCESS                    0 }
+    { CUDA_ERROR_INVALID_VALUE        1 }
+    { CUDA_ERROR_OUT_OF_MEMORY        2 }
+    { CUDA_ERROR_NOT_INITIALIZED      3 }
+    { CUDA_ERROR_DEINITIALIZED        4 }
+
+    { CUDA_ERROR_NO_DEVICE            100 }
+    { CUDA_ERROR_INVALID_DEVICE       101 }
+
+    { CUDA_ERROR_INVALID_IMAGE        200 }
+    { CUDA_ERROR_INVALID_CONTEXT      201 }
+    { CUDA_ERROR_CONTEXT_ALREADY_CURRENT 202 }
+    { CUDA_ERROR_MAP_FAILED           205 }
+    { CUDA_ERROR_UNMAP_FAILED         206 }
+    { CUDA_ERROR_ARRAY_IS_MAPPED      207 }
+    { CUDA_ERROR_ALREADY_MAPPED       208 }
+    { CUDA_ERROR_NO_BINARY_FOR_GPU    209 }
+    { CUDA_ERROR_ALREADY_ACQUIRED     210 }
+    { CUDA_ERROR_NOT_MAPPED           211 }
+    { CUDA_ERROR_NOT_MAPPED_AS_ARRAY  212 }
+    { CUDA_ERROR_NOT_MAPPED_AS_POINTER 213 }
+    { CUDA_ERROR_ECC_UNCORRECTABLE    214 }
+
+    { CUDA_ERROR_INVALID_SOURCE       300 }
+    { CUDA_ERROR_FILE_NOT_FOUND       301 }
+
+    { CUDA_ERROR_INVALID_HANDLE       400 }
+
+    { CUDA_ERROR_NOT_FOUND            500 }
+
+    { CUDA_ERROR_NOT_READY            600 }
+
+    { CUDA_ERROR_LAUNCH_FAILED        700 }
+    { CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES 701 }
+    { CUDA_ERROR_LAUNCH_TIMEOUT       702 }
+    { CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING 703 }
+
+    { CUDA_ERROR_POINTER_IS_64BIT     800 }
+    { CUDA_ERROR_SIZE_IS_64BIT        801 }
+
+    { CUDA_ERROR_UNKNOWN              999 } ;
+
+CONSTANT: CU_MEMHOSTALLOC_PORTABLE        HEX: 01
+CONSTANT: CU_MEMHOSTALLOC_DEVICEMAP       HEX: 02
+CONSTANT: CU_MEMHOSTALLOC_WRITECOMBINED   HEX: 04
+
+STRUCT: CUDA_MEMCPY2D
+    { srcXInBytes uint }
+    { srcY        uint }
+    { srcMemoryType CUmemorytype }
+    { srcHost void* }
+    { srcDevice CUdeviceptr }
+    { srcArray CUarray }
+    { srcPitch uint }
+    { dstXInBytes uint }
+    { dstY uint }
+    { dstMemoryType CUmemorytype }
+    { dstHost void* }
+    { dstDevice CUdeviceptr }
+    { dstArray CUarray }
+    { dstPitch uint }
+    { WidthInBytes uint }
+    { Height uint } ;
+
+STRUCT: CUDA_MEMCPY3D
+    { srcXInBytes uint }
+    { srcY        uint }
+    { srcZ        uint }
+    { srcLOD      uint }
+    { srcMemoryType CUmemorytype }
+    { srcHost void* }
+    { srcDevice CUdeviceptr }
+    { srcArray CUarray }
+    { reserved0 void* }
+    { srcPitch uint }
+    { srcHeight uint }
+    { dstXInBytes uint }
+    { dstY uint }
+    { dstZ uint }
+    { dstLOD uint }
+    { dstMemoryType CUmemorytype }
+    { dstHost void* }
+    { dstDevice CUdeviceptr }
+    { dstArray CUarray }
+    { reserved1 void* }
+    { dstPitch uint }
+    { dstHeight uint }
+    { WidthInBytes uint }
+    { Height uint }
+    { Depth uint } ;
+
+STRUCT: CUDA_ARRAY_DESCRIPTOR
+    { Width uint }
+    { Height uint }
+    { Format CUarray_format }
+    { NumChannels uint } ;
+
+STRUCT: CUDA_ARRAY3D_DESCRIPTOR
+    { Width uint }
+    { Height uint }
+    { Depth uint }
+    { Format CUarray_format }
+    { NumChannels uint }
+    { Flags uint } ;
+
+CONSTANT: CUDA_ARRAY3D_2DARRAY    HEX: 01
+CONSTANT: CU_TRSA_OVERRIDE_FORMAT HEX: 01
+CONSTANT: CU_TRSF_READ_AS_INTEGER         HEX: 01
+CONSTANT: CU_TRSF_NORMALIZED_COORDINATES  HEX: 02
+CONSTANT: CU_PARAM_TR_DEFAULT -1
+
+FUNCTION: CUresult cuInit ( uint Flags ) ;
+
+FUNCTION: CUresult cuDriverGetVersion ( int* driverVersion ) ;
+
+FUNCTION: CUresult cuDeviceGet ( CUdevice* device, int ordinal ) ;
+FUNCTION: CUresult cuDeviceGetCount ( int* count ) ;
+FUNCTION: CUresult cuDeviceGetName ( char* name, int len, CUdevice dev ) ;
+FUNCTION: CUresult cuDeviceComputeCapability ( int* major, int* minor, CUdevice dev ) ;
+FUNCTION: CUresult cuDeviceTotalMem ( uint* bytes, CUdevice dev ) ;
+FUNCTION: CUresult cuDeviceGetProperties ( CUdevprop* prop, CUdevice dev ) ;
+FUNCTION: CUresult cuDeviceGetAttribute ( int* pi, CUdevice_attribute attrib, CUdevice dev ) ;
+        
+FUNCTION: CUresult cuCtxCreate ( CUcontext* pctx, uint flags, CUdevice dev ) ;
+FUNCTION: CUresult cuCtxDestroy ( CUcontext ctx ) ;
+FUNCTION: CUresult cuCtxAttach ( CUcontext* pctx, uint flags ) ;
+FUNCTION: CUresult cuCtxDetach ( CUcontext ctx ) ;
+FUNCTION: CUresult cuCtxPushCurrent ( CUcontext ctx ) ;
+FUNCTION: CUresult cuCtxPopCurrent ( CUcontext* pctx ) ;
+FUNCTION: CUresult cuCtxGetDevice ( CUdevice* device ) ;
+FUNCTION: CUresult cuCtxSynchronize ( ) ;
+
+FUNCTION: CUresult cuModuleLoad ( CUmodule* module, c-string fname ) ;
+FUNCTION: CUresult cuModuleLoadData ( CUmodule* module, void* image ) ;
+FUNCTION: CUresult cuModuleLoadDataEx ( CUmodule* module, void* image, uint numOptions, CUjit_option* options, void** optionValues ) ;
+FUNCTION: CUresult cuModuleLoadFatBinary ( CUmodule* module, void* fatCubin ) ;
+FUNCTION: CUresult cuModuleUnload ( CUmodule hmod ) ;
+FUNCTION: CUresult cuModuleGetFunction ( CUfunction* hfunc, CUmodule hmod, c-string name ) ;
+FUNCTION: CUresult cuModuleGetGlobal ( CUdeviceptr* dptr, uint* bytes, CUmodule hmod, char* name ) ;
+FUNCTION: CUresult cuModuleGetTexRef ( CUtexref* pTexRef, CUmodule hmod, char* name ) ;
+    
+FUNCTION: CUresult cuMemGetInfo ( uint* free, uint* total ) ;
+
+FUNCTION: CUresult cuMemAlloc ( CUdeviceptr* dptr, uint bytesize ) ;
+FUNCTION: CUresult cuMemAllocPitch ( CUdeviceptr* dptr, 
+                                      uint* pPitch,
+                                      uint WidthInBytes, 
+                                      uint Height, 
+                                      uint ElementSizeBytes
+                                     ) ;
+FUNCTION: CUresult cuMemFree ( CUdeviceptr dptr ) ;
+FUNCTION: CUresult cuMemGetAddressRange ( CUdeviceptr* pbase, uint* psize, CUdeviceptr dptr ) ;
+
+FUNCTION: CUresult cuMemAllocHost ( void** pp, uint bytesize ) ;
+FUNCTION: CUresult cuMemFreeHost ( void* p ) ;
+
+FUNCTION: CUresult cuMemHostAlloc ( void** pp, size_t bytesize, uint Flags ) ;
+FUNCTION: CUresult cuMemHostGetDevicePointer ( CUdeviceptr* pdptr, void* p, uint Flags ) ;
+FUNCTION: CUresult cuMemHostGetFlags ( uint* pFlags, void* p ) ;
+
+FUNCTION: CUresult  cuMemcpyHtoD ( CUdeviceptr dstDevice, void* srcHost, uint ByteCount ) ;
+FUNCTION: CUresult  cuMemcpyDtoH ( void* dstHost, CUdeviceptr srcDevice, uint ByteCount ) ;
+
+FUNCTION: CUresult  cuMemcpyDtoD ( CUdeviceptr dstDevice, CUdeviceptr srcDevice, uint ByteCount ) ;
+
+FUNCTION: CUresult  cuMemcpyDtoA ( CUarray dstArray, uint dstIndex, CUdeviceptr srcDevice, uint ByteCount ) ;
+FUNCTION: CUresult  cuMemcpyAtoD ( CUdeviceptr dstDevice, CUarray hSrc, uint SrcIndex, uint ByteCount ) ;
+
+FUNCTION: CUresult  cuMemcpyHtoA ( CUarray dstArray, uint dstIndex, void* pSrc, uint ByteCount ) ;
+FUNCTION: CUresult  cuMemcpyAtoH ( void* dstHost, CUarray srcArray, uint srcIndex, uint ByteCount ) ;
+
+FUNCTION: CUresult  cuMemcpyAtoA ( CUarray dstArray, uint dstIndex, CUarray srcArray, uint srcIndex, uint ByteCount ) ;
+
+FUNCTION: CUresult  cuMemcpy2D ( CUDA_MEMCPY2D* pCopy ) ;
+FUNCTION: CUresult  cuMemcpy2DUnaligned ( CUDA_MEMCPY2D* pCopy ) ;
+
+FUNCTION: CUresult  cuMemcpy3D ( CUDA_MEMCPY3D* pCopy ) ;
+
+FUNCTION: CUresult  cuMemcpyHtoDAsync ( CUdeviceptr dstDevice, 
+            void* srcHost, uint ByteCount, CUstream hStream ) ;
+FUNCTION: CUresult  cuMemcpyDtoHAsync ( void* dstHost, 
+            CUdeviceptr srcDevice, uint ByteCount, CUstream hStream ) ;
+
+FUNCTION: CUresult cuMemcpyDtoDAsync ( CUdeviceptr dstDevice,
+            CUdeviceptr srcDevice, uint ByteCount, CUstream hStream ) ;
+
+FUNCTION: CUresult  cuMemcpyHtoAAsync ( CUarray dstArray, uint dstIndex, 
+            void* pSrc, uint ByteCount, CUstream hStream ) ;
+FUNCTION: CUresult  cuMemcpyAtoHAsync ( void* dstHost, CUarray srcArray, uint srcIndex, 
+            uint ByteCount, CUstream hStream ) ;
+
+FUNCTION: CUresult  cuMemcpy2DAsync ( CUDA_MEMCPY2D* pCopy, CUstream hStream ) ;
+FUNCTION: CUresult  cuMemcpy3DAsync ( CUDA_MEMCPY3D* pCopy, CUstream hStream ) ;
+
+FUNCTION: CUresult  cuMemsetD8 ( CUdeviceptr dstDevice, uchar uc, uint N ) ;
+FUNCTION: CUresult  cuMemsetD16 ( CUdeviceptr dstDevice, ushort us, uint N ) ;
+FUNCTION: CUresult  cuMemsetD32 ( CUdeviceptr dstDevice, uint ui, uint N ) ;
+
+FUNCTION: CUresult  cuMemsetD2D8 ( CUdeviceptr dstDevice, uint dstPitch, uchar uc, uint Width, uint Height ) ;
+FUNCTION: CUresult  cuMemsetD2D16 ( CUdeviceptr dstDevice, uint dstPitch, ushort us, uint Width, uint Height ) ;
+FUNCTION: CUresult  cuMemsetD2D32 ( CUdeviceptr dstDevice, uint dstPitch, uint ui, uint Width, uint Height ) ;
+
+FUNCTION: CUresult cuFuncSetBlockShape ( CUfunction hfunc, int x, int y, int z ) ;
+FUNCTION: CUresult cuFuncSetSharedSize ( CUfunction hfunc, uint bytes ) ;
+FUNCTION: CUresult cuFuncGetAttribute ( int* pi, CUfunction_attribute attrib, CUfunction hfunc ) ;
+FUNCTION: CUresult cuFuncSetCacheConfig ( CUfunction hfunc, CUfunc_cache config ) ;
+
+FUNCTION: CUresult  cuArrayCreate ( CUarray* pHandle, CUDA_ARRAY_DESCRIPTOR* pAllocateArray ) ;
+FUNCTION: CUresult  cuArrayGetDescriptor ( CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray ) ;
+FUNCTION: CUresult  cuArrayDestroy ( CUarray hArray ) ;
+
+FUNCTION: CUresult  cuArray3DCreate ( CUarray* pHandle, CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray ) ;
+FUNCTION: CUresult  cuArray3DGetDescriptor ( CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray ) ;
+
+FUNCTION: CUresult  cuTexRefCreate ( CUtexref* pTexRef ) ;
+FUNCTION: CUresult  cuTexRefDestroy ( CUtexref hTexRef ) ;
+    
+FUNCTION: CUresult  cuTexRefSetArray ( CUtexref hTexRef, CUarray hArray, uint Flags ) ;
+FUNCTION: CUresult  cuTexRefSetAddress ( uint* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, uint bytes ) ;
+FUNCTION: CUresult  cuTexRefSetAddress2D ( CUtexref hTexRef, CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, uint Pitch ) ;
+FUNCTION: CUresult  cuTexRefSetFormat ( CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents ) ;
+FUNCTION: CUresult  cuTexRefSetAddressMode ( CUtexref hTexRef, int dim, CUaddress_mode am ) ;
+FUNCTION: CUresult  cuTexRefSetFilterMode ( CUtexref hTexRef, CUfilter_mode fm ) ;
+FUNCTION: CUresult  cuTexRefSetFlags ( CUtexref hTexRef, uint Flags ) ;
+
+FUNCTION: CUresult  cuTexRefGetAddress ( CUdeviceptr* pdptr, CUtexref hTexRef ) ;
+FUNCTION: CUresult  cuTexRefGetArray ( CUarray* phArray, CUtexref hTexRef ) ;
+FUNCTION: CUresult  cuTexRefGetAddressMode ( CUaddress_mode* pam, CUtexref hTexRef, int dim ) ;
+FUNCTION: CUresult  cuTexRefGetFilterMode ( CUfilter_mode* pfm, CUtexref hTexRef ) ;
+FUNCTION: CUresult  cuTexRefGetFormat ( CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef ) ;
+FUNCTION: CUresult  cuTexRefGetFlags ( uint* pFlags, CUtexref hTexRef ) ;
+
+FUNCTION: CUresult  cuParamSetSize ( CUfunction hfunc, uint numbytes ) ;
+FUNCTION: CUresult  cuParamSeti    ( CUfunction hfunc, int offset, uint value ) ;
+FUNCTION: CUresult  cuParamSetf    ( CUfunction hfunc, int offset, float value ) ;
+FUNCTION: CUresult  cuParamSetv    ( CUfunction hfunc, int offset, void* ptr, uint numbytes ) ;
+FUNCTION: CUresult  cuParamSetTexRef ( CUfunction hfunc, int texunit, CUtexref hTexRef ) ;
+
+FUNCTION: CUresult cuLaunch ( CUfunction f ) ;
+FUNCTION: CUresult cuLaunchGrid ( CUfunction f, int grid_width, int grid_height ) ;
+FUNCTION: CUresult cuLaunchGridAsync ( CUfunction f, int grid_width, int grid_height, CUstream hStream ) ;
+
+FUNCTION: CUresult cuEventCreate ( CUevent* phEvent, uint Flags ) ;
+FUNCTION: CUresult cuEventRecord ( CUevent hEvent, CUstream hStream ) ;
+FUNCTION: CUresult cuEventQuery ( CUevent hEvent ) ;
+FUNCTION: CUresult cuEventSynchronize ( CUevent hEvent ) ;
+FUNCTION: CUresult cuEventDestroy ( CUevent hEvent ) ;
+FUNCTION: CUresult cuEventElapsedTime ( float* pMilliseconds, CUevent hStart, CUevent hEnd ) ;
+
+FUNCTION: CUresult  cuStreamCreate ( CUstream* phStream, uint Flags ) ;
+FUNCTION: CUresult  cuStreamQuery ( CUstream hStream ) ;
+FUNCTION: CUresult  cuStreamSynchronize ( CUstream hStream ) ;
+FUNCTION: CUresult  cuStreamDestroy ( CUstream hStream ) ;
+
+FUNCTION: CUresult cuGraphicsUnregisterResource ( CUgraphicsResource resource ) ;
+FUNCTION: CUresult cuGraphicsSubResourceGetMappedArray ( CUarray* pArray, CUgraphicsResource resource, uint arrayIndex, uint mipLevel ) ;
+FUNCTION: CUresult cuGraphicsResourceGetMappedPointer ( CUdeviceptr* pDevPtr, uint* pSize, CUgraphicsResource resource ) ;
+FUNCTION: CUresult cuGraphicsResourceSetMapFlags ( CUgraphicsResource resource, uint flags ) ; 
+FUNCTION: CUresult cuGraphicsMapResources ( uint count, CUgraphicsResource* resources, CUstream hStream ) ;
+FUNCTION: CUresult cuGraphicsUnmapResources ( uint count, CUgraphicsResource* resources, CUstream hStream ) ;
+
+FUNCTION: CUresult cuGetExportTable ( void** ppExportTable, CUuuid* pExportTableId ) ;
diff --git a/extra/cuda/ffi/tags.txt b/extra/cuda/ffi/tags.txt
new file mode 100644 (file)
index 0000000..f74dbee
--- /dev/null
@@ -0,0 +1,2 @@
+not tested
+bindings
diff --git a/extra/cuda/gl/ffi/ffi.factor b/extra/cuda/gl/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..8c20efd
--- /dev/null
@@ -0,0 +1,10 @@
+! (c)2010 Joe Groff bsd license
+USING: alien.c-types alien.syntax cuda.ffi opengl.gl ;
+IN: cuda.gl.ffi
+
+LIBRARY: cuda
+
+FUNCTION: CUresult cuGLCtxCreate ( CUcontext* pCtx, uint Flags, CUdevice device ) ;
+FUNCTION: CUresult cuGraphicsGLRegisterBuffer ( CUgraphicsResource* pCudaResource, GLuint buffer, uint Flags ) ;
+FUNCTION: CUresult cuGraphicsGLRegisterImage ( CUgraphicsResource* pCudaResource, GLuint image, GLenum target, uint Flags ) ;
+
diff --git a/extra/cuda/gl/gl.factor b/extra/cuda/gl/gl.factor
new file mode 100644 (file)
index 0000000..d4943e1
--- /dev/null
@@ -0,0 +1,55 @@
+! (c)2010 Joe Groff bsd license
+USING: accessors alien alien.c-types alien.data alien.destructors
+alien.enums continuations cuda cuda.contexts cuda.ffi
+cuda.gl.ffi destructors fry gpu.buffers kernel ;
+IN: cuda.gl
+
+: create-gl-cuda-context ( device flags -- context )
+    swap
+    [ CUcontext <c-object> ] 2dip
+    [ cuGLCtxCreate cuda-error ] 3keep 2drop *void* ; inline
+
+: with-gl-cuda-context ( device flags quot -- )
+    [ set-up-cuda-context create-gl-cuda-context ] dip (with-cuda-context) ; inline 
+
+: gl-buffer>resource ( gl-buffer flags -- resource )
+    enum>number
+    [ CUgraphicsResource <c-object> ] 2dip
+    [ cuGraphicsGLRegisterBuffer cuda-error ] 3keep 2drop *void* ; inline
+
+: buffer>resource ( buffer flags -- resource )
+    [ handle>> ] dip gl-buffer>resource ; inline
+
+: map-resource ( resource -- device-ptr size )
+    [ 1 swap <void*> f cuGraphicsMapResources cuda-error ] [
+        [ CUdeviceptr <c-object> uint <c-object> ] dip
+        [ cuGraphicsResourceGetMappedPointer cuda-error ] 3keep drop
+        [ *uint ] [ *uint ] bi*
+    ] bi ; inline
+
+: unmap-resource ( resource -- )
+    1 swap <void*> f cuGraphicsUnmapResources cuda-error ; inline
+
+DESTRUCTOR: unmap-resource
+
+: free-resource ( resource -- )
+    cuGraphicsUnregisterResource cuda-error ; inline
+
+DESTRUCTOR: free-resource
+
+: with-mapped-resource ( ..a resource quot: ( ..a device-ptr size -- ..b ) -- ..b )
+    over [ map-resource ] 2dip '[ _ unmap-resource ] [ ] cleanup ; inline
+
+TUPLE: cuda-buffer
+    { buffer buffer }
+    { resource pinned-c-ptr } ;
+
+: <cuda-buffer> ( upload usage kind size initial-data flags -- buffer )
+    [ <buffer> dup ] dip buffer>resource cuda-buffer boa ; inline
+
+M: cuda-buffer dispose
+    [ [ free-resource ] when* f ] change-resource
+    buffer>> dispose ; inline
+
+: with-mapped-cuda-buffer ( ..a cuda-buffer quot: ( ..a device-ptr size -- ..b ) -- ..b )
+    [ resource>> ] dip with-mapped-resource ; inline
diff --git a/extra/cuda/libraries/authors.txt b/extra/cuda/libraries/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/cuda/libraries/libraries.factor b/extra/cuda/libraries/libraries.factor
new file mode 100644 (file)
index 0000000..e930745
--- /dev/null
@@ -0,0 +1,203 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.data alien.parser arrays assocs
+byte-arrays classes.struct combinators combinators.short-circuit
+cuda cuda.ffi fry generalizations io.backend kernel macros math
+namespaces sequences variants words ;
+FROM: classes.struct.private => compute-struct-offsets write-struct-slot ;
+QUALIFIED-WITH: alien.c-types c
+IN: cuda.libraries
+
+VARIANT: cuda-abi
+    cuda32 cuda64 ;
+
+SYMBOL: cuda-modules
+SYMBOL: cuda-functions
+
+SYMBOL: cuda-libraries
+cuda-libraries [ H{ } clone ] initialize
+
+SYMBOL: current-cuda-library
+
+: ?delete-at ( key assoc -- old/key ? )
+    2dup delete-at* [ 2nip t ] [ 2drop f ] if ; inline
+
+: cuda-param-size ( function n -- )
+    cuParamSetSize cuda-error ; inline
+
+: cuda-vector ( function offset ptr n -- )
+    cuParamSetv cuda-error ; inline
+
+: launch-function-grid ( function width height -- )
+    cuLaunchGrid cuda-error ; inline
+
+: function-block-shape ( function x y z -- )
+    cuFuncSetBlockShape cuda-error ; inline
+
+: function-shared-size ( function n -- )
+    cuFuncSetSharedSize cuda-error ; inline
+
+TUPLE: grid
+    { dim-grid read-only }
+    { dim-block read-only }
+    { shared-size read-only initial: 0 }
+    { stream read-only } ;
+
+: <grid> ( dim-grid dim-block -- grid )
+    0 f grid boa ; inline
+
+: <grid-shared> ( dim-grid dim-block shared-size -- grid )
+    f grid boa ; inline
+
+: <grid-shared-stream> ( dim-grid dim-block shared-size stream -- grid )
+    grid boa ; inline
+
+<PRIVATE
+GENERIC: block-dim ( block-size -- x y z ) foldable
+M: integer block-dim 1 1 ; inline
+M: sequence block-dim
+    dup length {
+        { 0 [ drop 1 1 1 ] }
+        { 1 [ first 1 1 ] }
+        { 2 [ first2 1 ] }
+        [ drop first3 ]
+    } case ; inline
+
+GENERIC: grid-dim ( grid-size -- x y ) foldable
+M: integer grid-dim 1 ; inline
+M: sequence grid-dim
+    dup length {
+        { 0 [ drop 1 1 ] }
+        { 1 [ first 1 ] }
+        [ drop first2 ]
+    } case ; inline
+PRIVATE>
+
+: load-module ( path -- module )
+    [ CUmodule <c-object> ] dip
+    [ cuModuleLoad cuda-error ] 2keep drop c:*void* ;
+
+: unload-module ( module -- )
+    cuModuleUnload cuda-error ;
+
+: load-cuda-library ( library -- handle )
+    path>> load-module ;
+
+ERROR: no-cuda-library name ;
+
+: lookup-cuda-library ( name -- cuda-library )
+    cuda-libraries get ?at [ no-cuda-library ] unless ;
+
+: remove-cuda-library ( name -- library )
+    cuda-libraries get ?delete-at [ no-cuda-library ] unless ;
+
+: unload-cuda-library ( name -- )
+    remove-cuda-library handle>> unload-module ;
+
+: launch-function ( function -- ) cuLaunch cuda-error ; inline
+
+: run-grid ( grid function -- )
+    swap
+    {
+        [ dim-block>> block-dim function-block-shape ]
+        [ shared-size>> function-shared-size ]
+        [
+            dim-grid>>
+            [ grid-dim launch-function-grid ]
+            [ launch-function ] if*
+        ]
+    } 2cleave ; inline
+
+<PRIVATE
+: make-param-buffer ( function size -- buffer size )
+    [ cuda-param-size ] [ (byte-array) ] [ ] tri ; inline
+
+: fill-param-buffer ( values... buffer quots... n -- )
+    [ cleave-curry ] [ spread* ] bi ; inline
+
+: pointer-argument-type? ( c-type -- ? )
+    { [ c:void* = ] [ CUdeviceptr = ] [ c:pointer? ] } 1|| ;
+
+: abi-pointer-type ( abi -- type )
+    {
+        { cuda32 [ c:uint ] }
+        { cuda64 [ CUulonglong ] }
+    } case ;
+
+: >argument-type ( c-type abi -- c-type' )
+    swap {
+        { [ dup pointer-argument-type? ] [ drop abi-pointer-type ] }
+        { [ dup c:double    = ] [ 2drop CUdouble ] }
+        { [ dup c:longlong  = ] [ 2drop CUlonglong ] }
+        { [ dup c:ulonglong = ] [ 2drop CUulonglong ] }
+        [ nip ]
+    } cond ;
+
+: >argument-struct-slot ( c-type abi -- slot )
+    >argument-type "cuda-arg" swap { } <struct-slot-spec> ;
+
+: [cuda-arguments] ( c-types abi -- quot )
+    '[ _ >argument-struct-slot ] map
+    [ compute-struct-offsets ]
+    [ [ '[ _ write-struct-slot ] ] [ ] map-as ]
+    [ length ] tri
+    '[
+        [ _ make-param-buffer [ drop @ _ fill-param-buffer ] 2keep ]
+        [ '[ _ 0 ] 2dip cuda-vector ] bi
+    ] ;
+PRIVATE>
+
+MACRO: cuda-arguments ( c-types abi -- quot: ( args... function -- ) )
+    [ [ 0 cuda-param-size ] ] swap '[ _ [cuda-arguments] ] if-empty ;
+
+: get-function-ptr ( module string -- function )
+    [ CUfunction <c-object> ] 2dip
+    [ cuModuleGetFunction cuda-error ] 3keep 2drop c:*void* ;
+
+: cached-module ( module-name -- alien )
+    lookup-cuda-library
+    cuda-modules get-global [ load-cuda-library ] cache ;
+
+: cached-function ( module-name function-name -- alien )
+    [ cached-module ] dip
+    2array cuda-functions get [ first2 get-function-ptr ] cache ;
+
+MACRO: cuda-invoke ( module-name function-name arguments -- )
+    pick lookup-cuda-library abi>> '[
+        _ _ cached-function
+        [ nip _ _ cuda-arguments ]
+        [ run-grid ] 2bi
+    ] ;
+
+: cuda-global* ( module-name symbol-name -- device-ptr size )
+    [ CUdeviceptr <c-object> c:uint <c-object> ] 2dip
+    [ cached-module ] dip 
+    '[ _ _ cuModuleGetGlobal cuda-error ] 2keep [ c:*uint ] bi@ ; inline
+
+: cuda-global ( module-name symbol-name -- device-ptr )
+    cuda-global* drop ; inline
+
+: define-cuda-function ( word module-name function-name arguments -- )
+    [ '[ _ _ _ cuda-invoke ] ]
+    [ 2nip \ grid suffix c:void function-effect ]
+    3bi define-inline ;
+
+: define-cuda-global ( word module-name symbol-name -- )
+    '[ _ _ cuda-global ] (( -- device-ptr )) define-inline ;
+
+TUPLE: cuda-library name abi path handle ;
+ERROR: bad-cuda-abi abi ;
+
+: check-cuda-abi ( abi -- abi )
+    dup cuda-abi? [ bad-cuda-abi ] unless ; inline
+
+: <cuda-library> ( name abi path -- obj )
+    \ cuda-library new
+        swap >>path
+        swap check-cuda-abi >>abi
+        swap >>name ; inline
+
+: add-cuda-library ( name abi path -- )
+    normalize-path <cuda-library>
+    dup name>> cuda-libraries get-global set-at ;
+
diff --git a/extra/cuda/memory/authors.txt b/extra/cuda/memory/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/cuda/memory/memory.factor b/extra/cuda/memory/memory.factor
new file mode 100644 (file)
index 0000000..f3c4520
--- /dev/null
@@ -0,0 +1,52 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien alien.data alien.destructors assocs
+byte-arrays cuda cuda.ffi destructors fry io.encodings.string
+io.encodings.utf8 kernel locals math namespaces sequences
+strings ;
+QUALIFIED-WITH: alien.c-types c
+IN: cuda.memory
+
+: cuda-malloc ( n -- ptr )
+    [ CUdeviceptr <c-object> ] dip
+    '[ _ cuMemAlloc cuda-error ] keep
+    c:*int ; inline
+
+: cuda-malloc-type ( n type -- ptr )
+    c:heap-size * cuda-malloc ; inline
+
+: cuda-free ( ptr -- )
+    cuMemFree cuda-error ; inline
+
+DESTRUCTOR: cuda-free
+
+: memcpy-device>device ( dest-ptr src-ptr count -- )
+    cuMemcpyDtoD cuda-error ; inline
+
+: memcpy-device>array ( dest-array dest-index src-ptr count -- )
+    cuMemcpyDtoA cuda-error ; inline
+
+: memcpy-array>device ( dest-ptr src-array src-index count -- )
+    cuMemcpyAtoD cuda-error ; inline
+
+: memcpy-array>host ( dest-ptr src-array src-index count -- )
+    cuMemcpyAtoH cuda-error ; inline
+
+: memcpy-host>array ( dest-array dest-index src-ptr count -- )
+    cuMemcpyHtoA cuda-error ; inline
+
+: memcpy-array>array ( dest-array dest-index src-array src-ptr count -- )
+    cuMemcpyAtoA cuda-error ; inline
+
+: memcpy-host>device ( dest-ptr src-ptr count -- )
+    cuMemcpyHtoD cuda-error ; inline
+
+: memcpy-device>host ( dest-ptr src-ptr count -- )
+    cuMemcpyDtoH cuda-error ; inline
+
+: host>device ( data -- ptr )
+    [ >c-ptr ] [ byte-length ] bi
+    [ nip cuda-malloc dup ] [ memcpy-host>device ] 2bi ; inline
+
+: device>host ( ptr len -- byte-array )
+    [ nip <byte-array> dup ] [ memcpy-device>host ] 2bi ; inline
diff --git a/extra/cuda/nvcc/authors.txt b/extra/cuda/nvcc/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/cuda/nvcc/nvcc.factor b/extra/cuda/nvcc/nvcc.factor
new file mode 100644 (file)
index 0000000..c1e35c3
--- /dev/null
@@ -0,0 +1,31 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays combinators.smart io.backend io.directories
+io.launcher io.pathnames kernel locals math sequences splitting
+system ;
+IN: cuda.nvcc
+
+HOOK: nvcc-path os ( -- path )
+
+M: object nvcc-path "nvcc" ;
+
+M: macosx nvcc-path "/usr/local/cuda/bin/nvcc" ;
+
+: cu>ptx ( path -- path' )
+    ".cu" ?tail drop ".ptx" append ;
+
+: nvcc-command ( path -- seq )
+    [
+        [ nvcc-path "--ptx" "-o" ] dip
+        [ cu>ptx ] [ file-name ] bi
+    ] output>array ;
+
+ERROR: nvcc-failed n path ;
+
+:: compile-cu ( path -- path' )
+    path normalize-path :> path2
+    path2 parent-directory [
+        path2 nvcc-command
+        run-process wait-for-process [ path2 nvcc-failed ] unless-zero
+        path2 cu>ptx
+    ] with-directory ;
diff --git a/extra/cuda/ptx/ptx-tests.factor b/extra/cuda/ptx/ptx-tests.factor
new file mode 100644 (file)
index 0000000..1ba7ecf
--- /dev/null
@@ -0,0 +1,1104 @@
+USING: cuda.ptx io.streams.string tools.test ;
+IN: cuda.ptx.tests
+
+[ """  .version 2.0
+       .target sm_20
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20, .texmode_independent
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } { texmode .texmode_independent } } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_11, map_f64_to_f32
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target
+            { arch sm_11 }
+            { map_f64_to_f32? t }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_11, map_f64_to_f32, .texmode_independent
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target
+            { arch sm_11 }
+            { map_f64_to_f32? t }
+            { texmode .texmode_independent }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       .global .f32 foo[9000];
+       .extern .align 16 .shared .v4.f32 bar[];
+       .func (.reg .f32 sum) zap (.reg .f32 a, .reg .f32 b)
+       {
+       add.rn.f32 sum, a, b;
+       ret;
+       }
+       .func frob (.align 8 .param .u64 in, .align 8 .param .u64 out, .align 8 .param .u64 len)
+       {
+       ret;
+       }
+       .func twib
+       {
+       ret;
+       }
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ ptx-variable
+                { storage-space .global }
+                { type .f32 }
+                { name "foo" }
+                { dim 9000 }
+            }
+            T{ ptx-variable
+                { extern? t }
+                { align 16 }
+                { storage-space .shared }
+                { type T{ .v4 f .f32 } }
+                { name "bar" }
+                { dim 0 }
+            }
+            T{ ptx-func
+                { return T{ ptx-variable { storage-space .reg } { type .f32 } { name "sum" } } }
+                { name "zap" }
+                { params {
+                    T{ ptx-variable { storage-space .reg } { type .f32 } { name "a" } }
+                    T{ ptx-variable { storage-space .reg } { type .f32 } { name "b" } }
+                } }
+                { body {
+                    T{ add { round .rn } { type .f32 } { dest "sum" } { a "a" } { b "b" } }
+                    T{ ret }
+                } }
+            }
+            T{ ptx-func
+                { name "frob" }
+                { params {
+                    T{ ptx-variable { align 8 } { storage-space .param } { type .u64 } { name "in" } }
+                    T{ ptx-variable { align 8 } { storage-space .param } { type .u64 } { name "out" } }
+                    T{ ptx-variable { align 8 } { storage-space .param } { type .u64 } { name "len" } }
+                } }
+                { body {
+                    T{ ret }
+                } }
+            }
+            T{ ptx-func
+                { name "twib" }
+                { body {
+                    T{ ret }
+                } }
+            }
+        } }
+    } ptx>string
+] unit-test
+
+[ "a" ] [ [ "a" write-ptx-operand ] with-string-writer ] unit-test
+[ "2" ] [ [ 2 write-ptx-operand ] with-string-writer ] unit-test
+[ "0d4000000000000000" ] [ [ 2.0 write-ptx-operand ] with-string-writer ] unit-test
+[ "!a" ] [ [ T{ ptx-negation f "a" } write-ptx-operand ] with-string-writer ] unit-test
+[ "{a, b, c, d}" ] [ [ T{ ptx-vector f { "a" "b" "c" "d" } } write-ptx-operand ] with-string-writer ] unit-test
+[ "[a]" ] [ [ T{ ptx-indirect f "a" 0 } write-ptx-operand ] with-string-writer ] unit-test
+[ "[a+1]" ] [ [ T{ ptx-indirect f "a" 1 } write-ptx-operand ] with-string-writer ] unit-test
+[ "[a-1]" ] [ [ T{ ptx-indirect f "a" -1 } write-ptx-operand ] with-string-writer ] unit-test
+[ "a[1]" ] [ [ T{ ptx-element f "a" 1 } write-ptx-operand ] with-string-writer ] unit-test
+[ "{a, b[2], 3, 0d4000000000000000}" ] [ [ T{ ptx-vector f { "a" T{ ptx-element f "b" 2 } 3 2.0 } } write-ptx-operand ] with-string-writer ] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       abs.s32 a, b;
+       @p abs.s32 a, b;
+       @!p abs.s32 a, b;
+foo:   abs.s32 a, b;
+       abs.ftz.f32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ abs { type .s32 } { dest "a" } { a "b" } }
+            T{ abs
+                { predicate "p" }
+                { type .s32 } { dest "a" } { a "b" }
+            }
+            T{ abs
+                { predicate T{ ptx-negation f "p" } }
+                { type .s32 } { dest "a" } { a "b" }
+            }
+            T{ abs
+                { label "foo" }
+                { type .s32 } { dest "a" } { a "b" }
+            }
+            T{ abs { type .f32 } { dest "a" } { a "b" } { ftz? t } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       add.s32 a, b, c;
+       add.cc.s32 a, b, c;
+       add.sat.s32 a, b, c;
+       add.ftz.f32 a, b, c;
+       add.ftz.sat.f32 a, b, c;
+       add.rz.sat.f32 a, b, c;
+       add.rz.ftz.sat.f32 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ add { type .s32 } { dest "a" } { a "b" } { b "c" } }
+            T{ add { cc? t } { type .s32 } { dest "a" } { a "b" } { b "c" } }
+            T{ add { sat? t } { type .s32 } { dest "a" } { a "b" } { b "c" } }
+            T{ add { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ add { ftz? t } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ add { round .rz } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ add { round .rz } { ftz? t } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       addc.s32 a, b, c;
+       addc.cc.s32 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ addc { type .s32 } { dest "a" } { a "b" } { b "c" } }
+            T{ addc { cc? t } { type .s32 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       and.b32 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ and { type .b32 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       atom.and.u32 a, [b], c;
+       atom.global.or.u32 a, [b], c;
+       atom.shared.cas.u32 a, [b], c, d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ atom { op .and } { type .u32 } { dest "a" } { a T{ ptx-indirect f "b" } } { b "c" } }
+            T{ atom { storage-space .global } { op .or } { type .u32 } { dest "a" } { a T{ ptx-indirect f "b" } } { b "c" } }
+            T{ atom { storage-space .shared } { op .cas } { type .u32 } { dest "a" } { a T{ ptx-indirect f "b" } } { b "c" } { c "d" } }
+
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       bar.arrive a, b;
+       bar.red.popc.u32 a, b, d;
+       bar.red.popc.u32 a, b, !d;
+       bar.red.popc.u32 a, b, c, !d;
+       bar.sync a;
+       bar.sync a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ bar.arrive { a "a" } { b "b" } }
+            T{ bar.red { op .popc } { type .u32 } { dest "a" } { a "b" } { c "d" } }
+            T{ bar.red { op .popc } { type .u32 } { dest "a" } { a "b" } { c T{ ptx-negation f "d" } } }
+            T{ bar.red { op .popc } { type .u32 } { dest "a" } { a "b" } { b "c" } { c T{ ptx-negation f "d" } } }
+            T{ bar.sync { a "a" } }
+            T{ bar.sync { a "a" } { b "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       bfe.u32 a, b, c, d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ bfe { type .u32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       bfi.u32 a, b, c, d, e;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ bfi { type .u32 } { dest "a" } { a "b" } { b "c" } { c "d" } { d "e" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       bfind.u32 a, b;
+       bfind.shiftamt.u32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ bfind { type .u32 } { dest "a" } { a "b" } }
+            T{ bfind { type .u32 } { shiftamt? t } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       bra foo;
+       bra.uni bar;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ bra { target "foo" } }
+            T{ bra { uni? t } { target "bar" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       brev.b32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ brev { type .b32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       brkpt;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ brkpt }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       call foo;
+       call.uni foo;
+       call (a), foo;
+       call (a), foo, (b);
+       call (a), foo, (b, c);
+       call (a), foo, (b, c, d);
+       call (a[2]), foo, (b, c, d[3]);
+       call foo, (b, c, d);
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ call { target "foo" } }
+            T{ call { uni? t } { target "foo" } }
+            T{ call { return "a" } { target "foo" } }
+            T{ call { return "a" } { target "foo" } { params { "b" } } }
+            T{ call { return "a" } { target "foo" } { params { "b" "c" } } }
+            T{ call { return "a" } { target "foo" } { params { "b" "c" "d" } } }
+            T{ call { return T{ ptx-element f "a" 2 } } { target "foo" } { params { "b" "c" T{ ptx-element f "d" 3 } } } }
+            T{ call { target "foo" } { params { "b" "c" "d" } } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       clz.b32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ clz { type .b32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       cnot.b32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ cnot { type .b32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       copysign.f64 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ copysign { type .f64 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       cos.approx.f32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ cos { round .approx } { type .f32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       cvt.f32.s32 a, b;
+       cvt.s32.f32 a, b;
+       cvt.rp.f32.f64 a, b;
+       cvt.rpi.s32.f32 a, b;
+       cvt.ftz.f32.f64 a, b;
+       cvt.sat.f32.f64 a, b;
+       cvt.ftz.sat.f32.f64 a, b;
+       cvt.rp.ftz.sat.f32.f64 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ cvt { dest-type .f32 } { type .s32 } { dest "a" } { a "b" } }
+            T{ cvt { dest-type .s32 } { type .f32 } { dest "a" } { a "b" } }
+            T{ cvt { round .rp } { dest-type .f32 } { type .f64 } { dest "a" } { a "b" } }
+            T{ cvt { round .rpi } { dest-type .s32 } { type .f32 } { dest "a" } { a "b" } }
+            T{ cvt { ftz? t } { dest-type .f32 } { type .f64 } { dest "a" } { a "b" } }
+            T{ cvt { sat? t } { dest-type .f32 } { type .f64 } { dest "a" } { a "b" } }
+            T{ cvt { ftz? t } { sat? t } { dest-type .f32 } { type .f64 } { dest "a" } { a "b" } }
+            T{ cvt { round .rp } { ftz? t } { sat? t } { dest-type .f32 } { type .f64 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       cvta.global.u64 a, b;
+       cvta.shared.u64 a, b;
+       cvta.to.shared.u64 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ cvta { storage-space .global } { type .u64 } { dest "a" } { a "b" } }
+            T{ cvta { storage-space .shared } { type .u64 } { dest "a" } { a "b" } }
+            T{ cvta { to? t } { storage-space .shared } { type .u64 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       div.u32 a, b, c;
+       div.approx.f32 a, b, c;
+       div.approx.ftz.f32 a, b, c;
+       div.full.f32 a, b, c;
+       div.full.ftz.f32 a, b, c;
+       div.f32 a, b, c;
+       div.rz.f32 a, b, c;
+       div.ftz.f32 a, b, c;
+       div.rz.ftz.f32 a, b, c;
+       div.f64 a, b, c;
+       div.rz.f64 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ div { type .u32 } { dest "a" } { a "b" } { b "c" } }
+            T{ div { round .approx } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ div { round .approx } { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ div { round .full } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ div { round .full } { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ div { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ div { round .rz } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ div { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ div { round .rz } { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ div { type .f64 } { dest "a" } { a "b" } { b "c" } }
+            T{ div { round .rz } { type .f64 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       ex2.approx.f32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ ex2 { round .approx } { type .f32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       exit;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ exit }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       fma.f32 a, b, c, d;
+       fma.sat.f32 a, b, c, d;
+       fma.ftz.f32 a, b, c, d;
+       fma.ftz.sat.f32 a, b, c, d;
+       fma.rz.sat.f32 a, b, c, d;
+       fma.rz.ftz.sat.f32 a, b, c, d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ fma { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ fma { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ fma { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ fma { ftz? t } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ fma { round .rz } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ fma { round .rz } { ftz? t } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       isspacep.shared a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ isspacep { storage-space .shared } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       ld.u32 a, [b];
+       ld.v2.u32 a, [b];
+       ld.v4.u32 a, [b];
+       ld.v4.u32 {a, b, c, d}, [e];
+       ld.lu.u32 a, [b];
+       ld.const.lu.u32 a, [b];
+       ld.volatile.const[5].u32 a, [b];
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ ld { type .u32 } { dest "a" } { a T{ ptx-indirect f "b" } } }
+            T{ ld { type T{ .v2 { of .u32 } } } { dest "a" } { a T{ ptx-indirect f "b" } } }
+            T{ ld { type T{ .v4 { of .u32 } } } { dest "a" } { a T{ ptx-indirect f "b" } } }
+            T{ ld { type T{ .v4 { of .u32 } } } { dest T{ ptx-vector f { "a" "b" "c" "d" } } } { a "[e]" } }
+            T{ ld { cache-op .lu } { type .u32 } { dest "a" } { a "[b]" } }
+            T{ ld { storage-space T{ .const } } { cache-op .lu } { type .u32 } { dest "a" } { a T{ ptx-indirect f "b" } } }
+            T{ ld { volatile? t } { storage-space T{ .const { bank 5 } } } { type .u32 } { dest "a" } { a T{ ptx-indirect f "b" } } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       ldu.u32 a, [b];
+       ldu.v2.u32 a, [b];
+       ldu.v4.u32 a, [b];
+       ldu.v4.u32 {a, b, c, d}, [e];
+       ldu.lu.u32 a, [b];
+       ldu.const.lu.u32 a, [b];
+       ldu.volatile.const[5].u32 a, [b];
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ ldu { type .u32 } { dest "a" } { a T{ ptx-indirect f "b" } } }
+            T{ ldu { type T{ .v2 { of .u32 } } } { dest "a" } { a T{ ptx-indirect f "b" } } }
+            T{ ldu { type T{ .v4 { of .u32 } } } { dest "a" } { a T{ ptx-indirect f "b" } } }
+            T{ ldu { type T{ .v4 { of .u32 } } } { dest T{ ptx-vector f { "a" "b" "c" "d" } } } { a "[e]" } }
+            T{ ldu { cache-op .lu } { type .u32 } { dest "a" } { a "[b]" } }
+            T{ ldu { storage-space T{ .const } } { cache-op .lu } { type .u32 } { dest "a" } { a T{ ptx-indirect f "b" } } }
+            T{ ldu { volatile? t } { storage-space T{ .const { bank 5 } } } { type .u32 } { dest "a" } { a T{ ptx-indirect f "b" } } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       lg2.approx.f32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ lg2 { round .approx } { type .f32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       mad.s32 a, b, c, d;
+       mad.lo.s32 a, b, c, d;
+       mad.sat.s32 a, b, c, d;
+       mad.hi.sat.s32 a, b, c, d;
+       mad.ftz.f32 a, b, c, d;
+       mad.ftz.sat.f32 a, b, c, d;
+       mad.rz.sat.f32 a, b, c, d;
+       mad.rz.ftz.sat.f32 a, b, c, d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ mad { type .s32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ mad { mode .lo } { type .s32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ mad { sat? t } { type .s32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ mad { mode .hi } { sat? t } { type .s32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ mad { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ mad { ftz? t } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ mad { round .rz } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ mad { round .rz } { ftz? t } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       mad24.s32 a, b, c, d;
+       mad24.lo.s32 a, b, c, d;
+       mad24.sat.s32 a, b, c, d;
+       mad24.hi.sat.s32 a, b, c, d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ mad24 { type .s32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ mad24 { mode .lo } { type .s32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ mad24 { sat? t } { type .s32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ mad24 { mode .hi } { sat? t } { type .s32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       neg.s32 a, b;
+       neg.f32 a, b;
+       neg.ftz.f32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ neg { type .s32 } { dest "a" } { a "b" } }
+            T{ neg { type .f32 } { dest "a" } { a "b" } }
+            T{ neg { ftz? t } { type .f32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       not.b32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ not { type .b32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       or.b32 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ or { type .b32 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       pmevent a;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ pmevent { a "a" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       popc.b64 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ popc { type .b64 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       prefetch.L1 [a];
+       prefetch.local.L2 [a];
+       prefetchu.L1 [a];
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ prefetch { level .L1 } { a T{ ptx-indirect f "a" } } }
+            T{ prefetch { storage-space .local } { level .L2 } { a T{ ptx-indirect f "a" } } }
+            T{ prefetchu { level .L1 } { a T{ ptx-indirect f "a" } } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       prmt.b32 a, b, c, d;
+       prmt.b32.f4e a, b, c, d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ prmt { type .b32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ prmt { type .b32 } { mode .f4e } { dest "a" } { a "b" } { b "c" } { c "d" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       rcp.approx.f32 a, b;
+       rcp.approx.ftz.f32 a, b;
+       rcp.f32 a, b;
+       rcp.rz.f32 a, b;
+       rcp.ftz.f32 a, b;
+       rcp.rz.ftz.f32 a, b;
+       rcp.f64 a, b;
+       rcp.rz.f64 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ rcp { round .approx } { type .f32 } { dest "a" } { a "b" } }
+            T{ rcp { round .approx } { ftz? t } { type .f32 } { dest "a" } { a "b" } }
+            T{ rcp { type .f32 } { dest "a" } { a "b" } }
+            T{ rcp { round .rz } { type .f32 } { dest "a" } { a "b" } }
+            T{ rcp { ftz? t } { type .f32 } { dest "a" } { a "b" } }
+            T{ rcp { round .rz } { ftz? t } { type .f32 } { dest "a" } { a "b" } }
+            T{ rcp { type .f64 } { dest "a" } { a "b" } }
+            T{ rcp { round .rz } { type .f64 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       red.and.u32 [a], b;
+       red.global.and.u32 [a], b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ red { op .and } { type .u32 } { dest T{ ptx-indirect f "a" } } { a "b" } }
+            T{ red { storage-space .global } { op .and } { type .u32 } { dest T{ ptx-indirect f "a" } } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       rsqrt.approx.f32 a, b;
+       rsqrt.approx.ftz.f32 a, b;
+       rsqrt.approx.f64 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ rsqrt { round .approx } { type .f32 } { dest "a" } { a "b" } }
+            T{ rsqrt { round .approx } { ftz? t } { type .f32 } { dest "a" } { a "b" } }
+            T{ rsqrt { round .approx } { type .f64 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       rsqrt.approx.f32 a, b;
+       rsqrt.approx.ftz.f32 a, b;
+       rsqrt.approx.f64 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ rsqrt { round .approx } { type .f32 } { dest "a" } { a "b" } }
+            T{ rsqrt { round .approx } { ftz? t } { type .f32 } { dest "a" } { a "b" } }
+            T{ rsqrt { round .approx } { type .f64 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       sad.u32 a, b, c, d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ sad { type .u32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       selp.u32 a, b, c, d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ selp { type .u32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       set.gt.u32.s32 a, b, c;
+       set.gt.ftz.u32.f32 a, b, c;
+       set.gt.and.ftz.u32.f32 a, b, c, d;
+       set.gt.and.ftz.u32.f32 a, b, c, !d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ set { cmp-op .gt } { dest-type .u32 } { type .s32 } { dest "a" } { a "b" } { b "c" } }
+            T{ set { cmp-op .gt } { ftz? t } { dest-type .u32 } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ set { cmp-op .gt } { bool-op .and } { ftz? t } { dest-type .u32 } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ set { cmp-op .gt } { bool-op .and } { ftz? t } { dest-type .u32 } { type .f32 } { dest "a" } { a "b" } { b "c" } { c T{ ptx-negation f "d" } } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       setp.gt.s32 a, b, c;
+       setp.gt.s32 a|z, b, c;
+       setp.gt.ftz.f32 a, b, c;
+       setp.gt.and.ftz.f32 a, b, c, d;
+       setp.gt.and.ftz.f32 a, b, c, !d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ setp { cmp-op .gt } { type .s32 } { dest "a" } { a "b" } { b "c" } }
+            T{ setp { cmp-op .gt } { type .s32 } { dest "a" } { |dest "z" } { a "b" } { b "c" } }
+            T{ setp { cmp-op .gt } { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ setp { cmp-op .gt } { bool-op .and } { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ setp { cmp-op .gt } { bool-op .and } { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } { c "!d" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       shl.b32 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ shl { type .b32 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       shr.b32 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ shr { type .b32 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       sin.approx.f32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ sin { round .approx } { type .f32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       slct.f32.s32 a, b, c, d;
+       slct.ftz.f32.s32 a, b, c, d;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ slct { dest-type .f32 } { type .s32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+            T{ slct { ftz? t } { dest-type .f32 } { type .s32 } { dest "a" } { a "b" } { b "c" } { c "d" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       sqrt.approx.f32 a, b;
+       sqrt.approx.ftz.f32 a, b;
+       sqrt.f32 a, b;
+       sqrt.rz.f32 a, b;
+       sqrt.ftz.f32 a, b;
+       sqrt.rz.ftz.f32 a, b;
+       sqrt.f64 a, b;
+       sqrt.rz.f64 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ sqrt { round .approx } { type .f32 } { dest "a" } { a "b" } }
+            T{ sqrt { round .approx } { ftz? t } { type .f32 } { dest "a" } { a "b" } }
+            T{ sqrt { type .f32 } { dest "a" } { a "b" } }
+            T{ sqrt { round .rz } { type .f32 } { dest "a" } { a "b" } }
+            T{ sqrt { ftz? t } { type .f32 } { dest "a" } { a "b" } }
+            T{ sqrt { round .rz } { ftz? t } { type .f32 } { dest "a" } { a "b" } }
+            T{ sqrt { type .f64 } { dest "a" } { a "b" } }
+            T{ sqrt { round .rz } { type .f64 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       st.u32 [a], b;
+       st.v2.u32 [a], b;
+       st.v4.u32 [a], b;
+       st.v4.u32 [a], {b, c, d, e};
+       st.lu.u32 [a], b;
+       st.local.lu.u32 [a], b;
+       st.volatile.local.u32 [a], b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ st { type .u32 } { dest T{ ptx-indirect f "a" } } { a "b" } }
+            T{ st { type T{ .v2 { of .u32 } } } { dest T{ ptx-indirect f "a" } } { a "b" } }
+            T{ st { type T{ .v4 { of .u32 } } } { dest T{ ptx-indirect f "a" } } { a "b" } }
+            T{ st { type T{ .v4 { of .u32 } } } { dest T{ ptx-indirect f "a" } } { a T{ ptx-vector f { "b" "c" "d" "e" } } } }
+            T{ st { cache-op .lu } { type .u32 } { dest T{ ptx-indirect f "a" } } { a "b" } }
+            T{ st { storage-space .local } { cache-op .lu } { type .u32 } { dest T{ ptx-indirect f "a" } } { a "b" } }
+            T{ st { volatile? t } { storage-space .local } { type .u32 } { dest T{ ptx-indirect f "a" } } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       sub.s32 a, b, c;
+       sub.cc.s32 a, b, c;
+       sub.sat.s32 a, b, c;
+       sub.ftz.f32 a, b, c;
+       sub.ftz.sat.f32 a, b, c;
+       sub.rz.sat.f32 a, b, c;
+       sub.rz.ftz.sat.f32 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ sub { type .s32 } { dest "a" } { a "b" } { b "c" } }
+            T{ sub { cc? t } { type .s32 } { dest "a" } { a "b" } { b "c" } }
+            T{ sub { sat? t } { type .s32 } { dest "a" } { a "b" } { b "c" } }
+            T{ sub { ftz? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ sub { ftz? t } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ sub { round .rz } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+            T{ sub { round .rz } { ftz? t } { sat? t } { type .f32 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       subc.s32 a, b, c;
+       subc.cc.s32 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ subc { type .s32 } { dest "a" } { a "b" } { b "c" } }
+            T{ subc { cc? t } { type .s32 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       testp.finite.f32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ testp { op .finite } { type .f32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       trap;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ trap }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       vote.all.pred a, b;
+       vote.all.pred a, !b;
+       vote.ballot.b32 a, b;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ vote { mode .all } { type .pred } { dest "a" } { a "b" } }
+            T{ vote { mode .all } { type .pred } { dest "a" } { a "!b" } }
+            T{ vote { mode .ballot } { type .b32 } { dest "a" } { a "b" } }
+        } }
+    } ptx>string
+] unit-test
+
+[ """  .version 2.0
+       .target sm_20
+       xor.b32 a, b, c;
+""" ] [
+    T{ ptx
+        { version "2.0" }
+        { target T{ ptx-target { arch sm_20 } } }
+        { body {
+            T{ xor { type .b32 } { dest "a" } { a "b" } { b "c" } }
+        } }
+    } ptx>string
+] unit-test
+
diff --git a/extra/cuda/ptx/ptx.factor b/extra/cuda/ptx/ptx.factor
new file mode 100644 (file)
index 0000000..49a53d7
--- /dev/null
@@ -0,0 +1,815 @@
+! (c)2010 Joe Groff bsd license
+USING: accessors arrays combinators io io.streams.string kernel
+math math.parser roles sequences strings variants words ;
+FROM: roles => TUPLE: ;
+IN: cuda.ptx
+
+UNION: dim integer sequence ;
+UNION: ?integer POSTPONE: f integer ;
+UNION: ?string POSTPONE: f string ;
+
+VARIANT: ptx-type
+    .s8 .s16 .s32 .s64
+    .u8 .u16 .u32 .u64
+        .f16 .f32 .f64
+    .b8 .b16 .b32 .b64
+    .pred
+    .texref .samplerref .surfref
+    .v2: { { of ptx-type } }
+    .v4: { { of ptx-type } }
+    .struct: { { name string } } ;
+
+VARIANT: ptx-arch
+    sm_10 sm_11 sm_12 sm_13 sm_20 ;
+UNION: ?ptx-arch POSTPONE: f ptx-arch ;
+
+VARIANT: ptx-texmode
+    .texmode_unified .texmode_independent ;
+UNION: ?ptx-texmode POSTPONE: f ptx-texmode ;
+
+VARIANT: ptx-storage-space
+    .reg
+    .sreg
+    .const: { { bank ?integer } }
+    .global
+    .local
+    .param
+    .shared
+    .tex ;
+UNION: ?ptx-storage-space POSTPONE: f ptx-storage-space ;
+
+TUPLE: ptx-target
+    { arch ?ptx-arch }
+    { map_f64_to_f32? boolean }
+    { texmode ?ptx-texmode } ;
+
+TUPLE: ptx
+    { version string }
+    { target ptx-target }
+    body ;
+
+TUPLE: ptx-struct-definition
+    { name string }
+    members ;
+
+TUPLE: ptx-variable
+    { extern? boolean }
+    { visible? boolean }
+    { align ?integer }
+    { storage-space ptx-storage-space }
+    { type ptx-type }
+    { name string }
+    { parameter ?integer }
+    { dim dim }
+    { initializer ?string } ;
+UNION: ?ptx-variable POSTPONE: f ptx-variable ;
+
+TUPLE: ptx-negation
+    { var string } ; 
+
+TUPLE: ptx-vector
+    elements ;
+
+TUPLE: ptx-element
+    { var string }
+    { index integer } ;
+
+UNION: ptx-var
+    string ptx-element ;
+
+TUPLE: ptx-indirect
+    { base ptx-var }
+    { offset integer } ;
+
+UNION: ptx-operand
+    integer float ptx-var ptx-negation ptx-vector ptx-indirect ;
+UNION: ?ptx-operand POSTPONE: f ptx-operand ;
+
+TUPLE: ptx-instruction
+    { label ?string }
+    { predicate ?ptx-operand } ;
+
+TUPLE: ptx-entry
+    { name string }
+    params
+    directives
+    body ;
+
+TUPLE: ptx-func < ptx-entry
+    { return ?ptx-variable } ;
+
+TUPLE: ptx-directive ;
+
+TUPLE: .file         < ptx-directive
+    { info string } ;
+TUPLE: .loc          < ptx-directive
+    { info string } ;
+TUPLE: .maxnctapersm < ptx-directive
+    { ncta integer } ;
+TUPLE: .minnctapersm < ptx-directive
+    { ncta integer } ;
+TUPLE: .maxnreg      < ptx-directive
+    { n integer } ;
+TUPLE: .maxntid      < ptx-directive
+    { dim dim } ;
+TUPLE: .pragma       < ptx-directive
+    { pragma string } ;
+
+VARIANT: ptx-float-rounding-mode
+    .rn .rz .rm .rp .approx .full ;
+VARIANT: ptx-int-rounding-mode
+    .rni .rzi .rmi .rpi ;
+UNION: ?ptx-float-rounding-mode POSTPONE: f ptx-float-rounding-mode ;
+UNION: ?ptx-int-rounding-mode POSTPONE: f ptx-int-rounding-mode ;
+
+UNION: ptx-rounding-mode
+    ptx-float-rounding-mode ptx-int-rounding-mode ;
+UNION: ?ptx-rounding-mode POSTPONE: f ptx-rounding-mode ;
+
+TUPLE: ptx-typed-instruction < ptx-instruction
+    { type ptx-type }
+    { dest ptx-operand } ;
+
+TUPLE: ptx-2op-instruction < ptx-typed-instruction
+    { a ptx-operand } ;
+
+TUPLE: ptx-3op-instruction < ptx-typed-instruction
+    { a ptx-operand }
+    { b ptx-operand } ;
+
+TUPLE: ptx-4op-instruction < ptx-typed-instruction
+    { a ptx-operand }
+    { b ptx-operand }
+    { c ptx-operand } ;
+
+TUPLE: ptx-5op-instruction < ptx-typed-instruction
+    { a ptx-operand }
+    { b ptx-operand }
+    { c ptx-operand }
+    { d ptx-operand } ;
+
+TUPLE: ptx-addsub-instruction < ptx-3op-instruction
+    { sat? boolean }
+    { cc? boolean } ;
+
+VARIANT: ptx-mul-mode
+    .wide ;
+UNION: ?ptx-mul-mode POSTPONE: f ptx-mul-mode ;
+
+TUPLE: ptx-mul-instruction < ptx-3op-instruction
+    { mode ?ptx-mul-mode } ;
+
+TUPLE: ptx-mad-instruction < ptx-4op-instruction
+    { mode ?ptx-mul-mode }
+    { sat? boolean } ;
+
+VARIANT: ptx-prmt-mode
+    .f4e .b4e .rc8 .ecl .ecr .rc16 ;
+UNION: ?ptx-prmt-mode POSTPONE: f ptx-prmt-mode ;
+
+ROLE: ptx-float-ftz
+    { ftz? boolean } ;
+ROLE: ptx-float-env < ptx-float-ftz
+    { round ?ptx-float-rounding-mode } ;
+
+VARIANT: ptx-testp-op
+    .finite .infinite .number .notanumber .normal .subnormal ;
+
+VARIANT: ptx-cmp-op
+    .eq .ne
+    .lt .le .gt .ge
+    .ls .hs
+    .equ .neu
+    .ltu .leu .gtu .geu
+    .num .nan ;
+
+VARIANT: ptx-op
+    .and .or .xor .cas .exch .add .inc .dec .min .max
+    .popc ;
+UNION: ?ptx-op POSTPONE: f ptx-op ;
+
+SINGLETONS: .lo .hi ;
+INSTANCE: .lo ptx-mul-mode
+INSTANCE: .lo ptx-cmp-op
+INSTANCE: .hi ptx-mul-mode
+INSTANCE: .hi ptx-cmp-op
+
+TUPLE: ptx-set-instruction < ptx-3op-instruction
+    { cmp-op ptx-cmp-op }
+    { bool-op ?ptx-op }
+    { c ?ptx-operand }
+    { ftz? boolean } ;
+
+VARIANT: ptx-cache-op
+    .ca .cg .cs .lu .cv
+    .wb .wt ;
+UNION: ?ptx-cache-op POSTPONE: f ptx-cache-op ;
+
+TUPLE: ptx-ldst-instruction < ptx-2op-instruction
+    { volatile? boolean }
+    { storage-space ?ptx-storage-space }
+    { cache-op ?ptx-cache-op } ;
+
+VARIANT: ptx-cache-level
+    .L1 .L2 ;
+
+TUPLE: ptx-branch-instruction < ptx-instruction
+    { target string }
+    { uni? boolean } ;
+
+VARIANT: ptx-membar-level
+    .cta .gl .sys ;
+
+VARIANT: ptx-vote-mode
+    .all .any .uni .ballot ;
+
+TUPLE: ptx-instruction-not-supported-yet < ptx-instruction ;
+
+TUPLE: abs       <{ ptx-2op-instruction ptx-float-ftz } ;
+TUPLE: add       <{ ptx-addsub-instruction ptx-float-env } ;
+TUPLE: addc      < ptx-addsub-instruction ;
+TUPLE: and       < ptx-3op-instruction ;
+TUPLE: atom      < ptx-3op-instruction
+    { storage-space ?ptx-storage-space }
+    { op ptx-op }
+    { c ?ptx-operand } ;
+TUPLE: bar.arrive < ptx-instruction
+    { a ptx-operand }
+    { b ptx-operand } ;
+TUPLE: bar.red   < ptx-2op-instruction
+    { op ptx-op }
+    { b ?ptx-operand }
+    { c ptx-operand } ;
+TUPLE: bar.sync  < ptx-instruction
+    { a ptx-operand }
+    { b ?ptx-operand } ;
+TUPLE: bfe       < ptx-4op-instruction ;
+TUPLE: bfi       < ptx-5op-instruction ;
+TUPLE: bfind     < ptx-2op-instruction
+    { shiftamt? boolean } ;
+TUPLE: bra       < ptx-branch-instruction ;
+TUPLE: brev      < ptx-2op-instruction ;
+TUPLE: brkpt     < ptx-instruction ;
+TUPLE: call      < ptx-branch-instruction
+    { return ?ptx-operand }
+    params ;
+TUPLE: clz       < ptx-2op-instruction ;
+TUPLE: cnot      < ptx-2op-instruction ;
+TUPLE: copysign  < ptx-3op-instruction ;
+TUPLE: cos       <{ ptx-2op-instruction ptx-float-env } ;
+TUPLE: cvt       < ptx-2op-instruction
+    { round ?ptx-rounding-mode }
+    { ftz? boolean }
+    { sat? boolean }
+    { dest-type ptx-type } ;
+TUPLE: cvta      < ptx-2op-instruction
+    { to? boolean }
+    { storage-space ?ptx-storage-space } ;
+TUPLE: div       <{ ptx-3op-instruction ptx-float-env } ;
+TUPLE: ex2       <{ ptx-2op-instruction ptx-float-env } ;
+TUPLE: exit      < ptx-instruction ;
+TUPLE: fma       <{ ptx-mad-instruction ptx-float-env } ;
+TUPLE: isspacep  < ptx-instruction
+    { storage-space ptx-storage-space }
+    { dest ptx-operand }
+    { a ptx-operand } ;
+TUPLE: ld        < ptx-ldst-instruction ;
+TUPLE: ldu       < ptx-ldst-instruction ;
+TUPLE: lg2       <{ ptx-2op-instruction ptx-float-env } ;
+TUPLE: mad       <{ ptx-mad-instruction ptx-float-env } ;
+TUPLE: mad24     < ptx-mad-instruction ;
+TUPLE: max       <{ ptx-3op-instruction ptx-float-ftz } ;
+TUPLE: membar    < ptx-instruction
+    { level ptx-membar-level } ;
+TUPLE: min       <{ ptx-3op-instruction ptx-float-ftz } ;
+TUPLE: mov       < ptx-2op-instruction ;
+TUPLE: mul       <{ ptx-mul-instruction ptx-float-env } ;
+TUPLE: mul24     < ptx-mul-instruction ;
+TUPLE: neg       <{ ptx-2op-instruction ptx-float-ftz } ;
+TUPLE: not       < ptx-2op-instruction ;
+TUPLE: or        < ptx-3op-instruction ;
+TUPLE: pmevent   < ptx-instruction
+    { a ptx-operand } ;
+TUPLE: popc      < ptx-2op-instruction ;
+TUPLE: prefetch  < ptx-instruction
+    { a ptx-operand }
+    { storage-space ?ptx-storage-space }
+    { level ptx-cache-level } ;
+TUPLE: prefetchu < ptx-instruction
+    { a ptx-operand }
+    { level ptx-cache-level } ;
+TUPLE: prmt      < ptx-4op-instruction
+    { mode ?ptx-prmt-mode } ;
+TUPLE: rcp       <{ ptx-2op-instruction ptx-float-env } ;
+TUPLE: red       < ptx-2op-instruction
+    { storage-space ?ptx-storage-space }
+    { op ptx-op } ;
+TUPLE: rem       < ptx-3op-instruction ;
+TUPLE: ret       < ptx-instruction ;
+TUPLE: rsqrt     <{ ptx-2op-instruction ptx-float-env } ;
+TUPLE: sad       < ptx-4op-instruction ;
+TUPLE: selp      < ptx-4op-instruction ;
+TUPLE: set       < ptx-set-instruction
+    { dest-type ptx-type } ;
+TUPLE: setp      < ptx-set-instruction
+    { |dest ?ptx-operand } ;
+TUPLE: shl       < ptx-3op-instruction ;
+TUPLE: shr       < ptx-3op-instruction ;
+TUPLE: sin       <{ ptx-2op-instruction ptx-float-env } ;
+TUPLE: slct      < ptx-4op-instruction
+    { dest-type ptx-type }
+    { ftz? boolean } ;
+TUPLE: sqrt      <{ ptx-2op-instruction ptx-float-env } ;
+TUPLE: st        < ptx-ldst-instruction ;
+TUPLE: sub       <{ ptx-addsub-instruction ptx-float-env } ;
+TUPLE: subc      < ptx-addsub-instruction  ;
+TUPLE: suld      < ptx-instruction-not-supported-yet ;
+TUPLE: sured     < ptx-instruction-not-supported-yet ;
+TUPLE: sust      < ptx-instruction-not-supported-yet ;
+TUPLE: suq       < ptx-instruction-not-supported-yet ;
+TUPLE: testp     < ptx-2op-instruction
+    { op ptx-testp-op } ;
+TUPLE: tex       < ptx-instruction-not-supported-yet ;
+TUPLE: txq       < ptx-instruction-not-supported-yet ;
+TUPLE: trap      < ptx-instruction ;
+TUPLE: vabsdiff  < ptx-instruction-not-supported-yet ;
+TUPLE: vadd      < ptx-instruction-not-supported-yet ;
+TUPLE: vmad      < ptx-instruction-not-supported-yet ;
+TUPLE: vmax      < ptx-instruction-not-supported-yet ;
+TUPLE: vmin      < ptx-instruction-not-supported-yet ;
+TUPLE: vset      < ptx-instruction-not-supported-yet ;
+TUPLE: vshl      < ptx-instruction-not-supported-yet ;
+TUPLE: vshr      < ptx-instruction-not-supported-yet ;
+TUPLE: vsub      < ptx-instruction-not-supported-yet ;
+TUPLE: vote      < ptx-2op-instruction
+    { mode ptx-vote-mode } ;
+TUPLE: xor       < ptx-3op-instruction ;
+
+GENERIC: ptx-element-label ( elt -- label )
+M: object ptx-element-label  drop f ;
+
+GENERIC: ptx-semicolon? ( elt -- ? )
+M: object ptx-semicolon? drop t ;
+M: ptx-target ptx-semicolon? drop f ;
+M: ptx-entry ptx-semicolon? drop f ;
+M: ptx-func ptx-semicolon? drop f ;
+M: .file ptx-semicolon? drop f ;
+M: .loc ptx-semicolon? drop f ;
+
+GENERIC: write-ptx-operand ( operand -- )
+
+M: string write-ptx-operand write ;
+M: integer write-ptx-operand number>string write ;
+M: float write-ptx-operand "0d" write double>bits >hex 16 CHAR: 0 pad-head write ;
+M: ptx-negation write-ptx-operand "!" write var>> write ;
+M: ptx-vector write-ptx-operand
+    "{" write
+    elements>> [ ", " write ] [ write-ptx-operand ] interleave
+    "}" write ;
+M: ptx-element write-ptx-operand dup var>> write "[" write index>> number>string write "]" write ;
+M: ptx-indirect write-ptx-operand
+    "[" write
+    dup base>> write-ptx-operand
+    offset>> {
+        { [ dup zero? ] [ drop ] }
+        { [ dup 0 < ] [ number>string write ] }
+        [ "+" write number>string write ]
+    } cond
+    "]" write ;
+
+GENERIC: (write-ptx-element) ( elt -- )
+
+: write-ptx-element ( elt -- )
+    dup ptx-element-label [ write ":" write ] when*
+    "\t" write dup (write-ptx-element) 
+    ptx-semicolon? [ ";" print ] [ nl ] if ;
+
+: write-ptx ( ptx -- )
+    "\t.version " write dup version>> print
+    dup target>> write-ptx-element
+    body>> [ write-ptx-element ] each ;
+
+: write-ptx-symbol ( symbol/f -- )
+    [ name>> write ] when* ;
+
+M: f (write-ptx-element)
+    drop ;
+
+M: word (write-ptx-element)
+    name>> write ;
+
+M: .const (write-ptx-element)
+    ".const" write
+    bank>> [ "[" write number>string write "]" write ] when* ;
+M: .v2 (write-ptx-element)
+    ".v2" write of>> (write-ptx-element) ;
+M: .v4 (write-ptx-element)
+    ".v4" write of>> (write-ptx-element) ;
+M: .struct (write-ptx-element)
+    ".struct " write name>> write ;
+
+M: ptx-target (write-ptx-element)
+    ".target " write
+    [ arch>> [ name>> ] [ f ] if* ]
+    [ map_f64_to_f32?>> [ "map_f64_to_f32" ] [ f ] if ]
+    [ texmode>> [ name>> ] [ f ] if* ] tri
+    3array sift [ ", " write ] [ write ] interleave ;
+
+: write-ptx-dim ( dim -- )
+    {
+        { [ dup zero? ] [ drop "[]" write ] }
+        { [ dup sequence? ] [ [ "[" write number>string write "]" write ] each ] }
+        [ "[" write number>string write "]" write ]
+    } cond ;
+
+M: ptx-variable (write-ptx-element)
+    dup extern?>> [ ".extern " write ] when
+    dup visible?>> [ ".visible " write ] when
+    dup align>> [ ".align " write number>string write " " write ] when*
+    dup storage-space>> (write-ptx-element) " " write
+    dup type>> (write-ptx-element) " " write
+    dup name>> write
+    dup parameter>> [ "<" write number>string write ">" write ] when*
+    dup dim>> [ write-ptx-dim ] when*
+    dup initializer>> [ " = " write write ] when*
+    drop ;
+
+: write-params ( params -- )
+    "(" write unclip (write-ptx-element)
+    [ ", " write (write-ptx-element) ] each
+    ")" write ;
+
+: write-body ( params -- )
+    "\t{" print
+    [ write-ptx-element ] each
+    "\t}" write ;
+
+: write-entry ( entry -- )
+    dup name>> write
+    dup params>> [  " " write write-params ] when* nl
+    dup directives>> [ (write-ptx-element) nl ] each
+    dup body>> write-body
+    drop ;
+
+M: ptx-entry (write-ptx-element)
+    ".entry " write
+    write-entry ;
+
+M: ptx-func (write-ptx-element)
+    ".func " write
+    dup return>> [ "(" write (write-ptx-element) ") " write ] when*
+    write-entry ;
+
+M: .file (write-ptx-element)
+    ".file " write info>> write ;
+M: .loc (write-ptx-element)
+    ".loc " write info>> write ;
+M: .maxnctapersm (write-ptx-element)
+    ".maxnctapersm " write ncta>> number>string write ;
+M: .minnctapersm (write-ptx-element)
+    ".minnctapersm " write ncta>> number>string write ;
+M: .maxnreg (write-ptx-element)
+    ".maxnreg " write n>> number>string write ;
+M: .maxntid (write-ptx-element)
+    ".maxntid " write
+    dup sequence? [ [ ", " write ] [ number>string write ] interleave ] [ number>string write ] if ;
+M: .pragma (write-ptx-element)
+    ".pragma \"" write pragma>> write "\"" write ;
+
+M: ptx-instruction ptx-element-label
+    label>> ;
+
+: write-insn ( insn name -- insn )
+    over predicate>>
+    [ "@" write write-ptx-operand " " write ] when*
+    write ;
+
+: write-2op ( insn -- )
+    dup type>> (write-ptx-element) " " write
+    dup dest>> write-ptx-operand ", " write
+    dup a>> write-ptx-operand
+    drop ;
+
+: write-3op ( insn -- )
+    dup write-2op ", " write
+    dup b>> write-ptx-operand
+    drop ;
+
+: write-4op ( insn -- )
+    dup write-3op ", " write
+    dup c>> write-ptx-operand
+    drop ;
+
+: write-5op ( insn -- )
+    dup write-4op ", " write
+    dup d>> write-ptx-operand
+    drop ;
+
+: write-ftz ( insn -- )
+    ftz?>> [ ".ftz" write ] when ;
+
+: write-sat ( insn -- )
+    sat?>> [ ".sat" write ] when ;
+
+: write-float-env ( insn -- )
+    dup round>> (write-ptx-element)
+    write-ftz ;
+
+: write-int-addsub ( insn -- )
+    dup write-sat
+    dup cc?>>  [ ".cc"  write ] when
+    write-3op ;
+
+: write-addsub ( insn -- )
+    dup write-float-env
+    write-int-addsub ;
+
+: write-ldst ( insn -- )
+    dup volatile?>> [ ".volatile" write ] when
+    dup storage-space>> (write-ptx-element)
+    dup cache-op>> (write-ptx-element)
+    write-2op ;
+
+: (write-mul) ( insn -- )
+    dup mode>> (write-ptx-element)
+    drop ;
+
+: write-mul ( insn -- )
+    dup write-float-env
+    dup (write-mul)
+    write-3op ;
+
+: write-mad ( insn -- )
+    dup write-float-env
+    dup (write-mul)
+    dup write-sat
+    write-4op ;
+
+: write-uni ( insn -- )
+    uni?>> [ ".uni" write ] when ;
+
+: write-set ( insn -- )
+    dup cmp-op>> (write-ptx-element)
+    dup bool-op>> (write-ptx-element)
+    write-ftz ;
+
+M: abs (write-ptx-element)
+    "abs" write-insn
+    dup write-ftz
+    write-2op ;
+M: add (write-ptx-element)
+    "add" write-insn
+    write-addsub ;
+M: addc (write-ptx-element)
+    "addc" write-insn
+    write-int-addsub ;
+M: and (write-ptx-element)
+    "and" write-insn
+    write-3op ;
+M: atom (write-ptx-element)
+    "atom" write-insn
+    dup storage-space>> (write-ptx-element)
+    dup op>> (write-ptx-element)
+    dup write-3op
+    c>> [ ", " write write-ptx-operand ] when* ;
+M: bar.arrive (write-ptx-element)
+    "bar.arrive " write-insn
+    dup a>> write-ptx-operand ", " write
+    dup b>> write-ptx-operand
+    drop ;
+M: bar.red (write-ptx-element)
+    "bar.red" write-insn
+    dup op>> (write-ptx-element)
+    dup write-2op
+    dup b>> [ ", " write write-ptx-operand ] when*
+    ", " write c>> write-ptx-operand ;
+M: bar.sync (write-ptx-element)
+    "bar.sync " write-insn
+    dup a>> write-ptx-operand
+    dup b>> [ ", " write write-ptx-operand ] when*
+    drop ;
+M: bfe (write-ptx-element)
+    "bfe" write-insn
+    write-4op ;
+M: bfi (write-ptx-element)
+    "bfi" write-insn
+    write-5op ;
+M: bfind (write-ptx-element)
+    "bfind" write-insn
+    dup shiftamt?>> [ ".shiftamt" write ] when
+    write-2op ;
+M: bra (write-ptx-element)
+    "bra" write-insn
+    dup write-uni " " write
+    target>> write ;
+M: brev (write-ptx-element)
+    "brev" write-insn
+    write-2op ;
+M: brkpt (write-ptx-element)
+    "brkpt" write-insn drop ;
+M: call (write-ptx-element)
+    "call" write-insn
+    dup write-uni " " write
+    dup return>> [ "(" write write-ptx-operand "), " write ] when*
+    dup target>> write
+    dup params>> [ ", (" write [ ", " write ] [ write-ptx-operand ] interleave ")" write ] unless-empty
+    drop ;
+M: clz (write-ptx-element)
+    "clz" write-insn
+    write-2op ;
+M: cnot (write-ptx-element)
+    "cnot" write-insn
+    write-2op ;
+M: copysign (write-ptx-element)
+    "copysign" write-insn
+    write-3op ;
+M: cos (write-ptx-element)
+    "cos" write-insn
+    dup write-float-env
+    write-2op ;
+M: cvt (write-ptx-element)
+    "cvt" write-insn
+    dup round>> (write-ptx-element)
+    dup write-ftz
+    dup write-sat
+    dup dest-type>> (write-ptx-element)
+    write-2op ;
+M: cvta (write-ptx-element)
+    "cvta" write-insn
+    dup to?>> [ ".to" write ] when
+    dup storage-space>> (write-ptx-element)
+    write-2op ;
+M: div (write-ptx-element)
+    "div" write-insn
+    dup write-float-env
+    write-3op ;
+M: ex2 (write-ptx-element)
+    "ex2" write-insn
+    dup write-float-env
+    write-2op ;
+M: exit (write-ptx-element)
+    "exit" write-insn drop ;
+M: fma (write-ptx-element)
+    "fma" write-insn
+    write-mad ;
+M: isspacep (write-ptx-element)
+    "isspacep" write-insn
+    dup storage-space>> (write-ptx-element)
+    " " write
+    dup dest>> write-ptx-operand ", " write a>> write-ptx-operand ;
+M: ld (write-ptx-element)
+    "ld" write-insn
+    write-ldst ;
+M: ldu (write-ptx-element)
+    "ldu" write-insn
+    write-ldst ;
+M: lg2 (write-ptx-element)
+    "lg2" write-insn
+    dup write-float-env
+    write-2op ;
+M: mad (write-ptx-element)
+    "mad" write-insn
+    write-mad ;
+M: mad24 (write-ptx-element)
+    "mad24" write-insn
+    dup (write-mul)
+    dup write-sat
+    write-4op ;
+M: max (write-ptx-element)
+    "max" write-insn
+    dup write-ftz
+    write-3op ;
+M: membar (write-ptx-element)
+    "membar" write-insn
+    dup level>> (write-ptx-element)
+    drop ;
+M: min (write-ptx-element)
+    "min" write-insn
+    dup write-ftz
+    write-3op ;
+M: mov (write-ptx-element)
+    "mov" write-insn
+    write-2op ;
+M: mul (write-ptx-element)
+    "mul" write-insn
+    write-mul ;
+M: mul24 (write-ptx-element)
+    "mul24" write-insn
+    dup (write-mul)
+    write-3op ;
+M: neg (write-ptx-element)
+    "neg" write-insn
+    dup write-ftz
+    write-2op ;
+M: not (write-ptx-element)
+    "not" write-insn
+    write-2op ;
+M: or (write-ptx-element)
+    "or" write-insn
+    write-3op ;
+M: pmevent (write-ptx-element)
+    "pmevent" write-insn " " write a>> write ;
+M: popc (write-ptx-element)
+    "popc" write-insn
+    write-2op ;
+M: prefetch (write-ptx-element)
+    "prefetch" write-insn
+    dup storage-space>> (write-ptx-element)
+    dup level>> (write-ptx-element)
+    " " write a>> write-ptx-operand ;
+M: prefetchu (write-ptx-element)
+    "prefetchu" write-insn
+    dup level>> (write-ptx-element)
+    " " write a>> write-ptx-operand ;
+M: prmt (write-ptx-element)
+    "prmt" write-insn
+    dup type>> (write-ptx-element)
+    dup mode>> (write-ptx-element) " " write
+    dup dest>> write-ptx-operand ", " write
+    dup a>> write-ptx-operand ", " write
+    dup b>> write-ptx-operand ", " write
+    dup c>> write-ptx-operand
+    drop ;
+M: rcp (write-ptx-element)
+    "rcp" write-insn
+    dup write-float-env
+    write-2op ;
+M: red (write-ptx-element)
+    "red" write-insn
+    dup storage-space>> (write-ptx-element)
+    dup op>> (write-ptx-element)
+    write-2op ;
+M: rem (write-ptx-element)
+    "rem" write-insn
+    write-3op ;
+M: ret (write-ptx-element)
+    "ret" write-insn drop ;
+M: rsqrt (write-ptx-element)
+    "rsqrt" write-insn
+    dup write-float-env
+    write-2op ;
+M: sad (write-ptx-element)
+    "sad" write-insn
+    write-4op ;
+M: selp (write-ptx-element)
+    "selp" write-insn
+    write-4op ;
+M: set (write-ptx-element)
+    "set" write-insn
+    dup write-set
+    dup dest-type>> (write-ptx-element)
+    dup write-3op
+    c>> [ ", " write write-ptx-operand ] when* ;
+M: setp (write-ptx-element)
+    "setp" write-insn
+    dup write-set
+    dup type>> (write-ptx-element) " " write
+    dup dest>> write-ptx-operand
+    dup |dest>> [ "|" write write-ptx-operand ] when* ", " write
+    dup a>> write-ptx-operand ", " write
+    dup b>> write-ptx-operand
+    c>> [ ", " write write-ptx-operand ] when* ;
+M: shl (write-ptx-element)
+    "shl" write-insn
+    write-3op ;
+M: shr (write-ptx-element)
+    "shr" write-insn
+    write-3op ;
+M: sin (write-ptx-element)
+    "sin" write-insn
+    dup write-float-env
+    write-2op ;
+M: slct (write-ptx-element)
+    "slct" write-insn
+    dup write-ftz
+    dup dest-type>> (write-ptx-element)
+    write-4op ;
+M: sqrt (write-ptx-element)
+    "sqrt" write-insn
+    dup write-float-env
+    write-2op ;
+M: st (write-ptx-element)
+    "st" write-insn
+    write-ldst ;
+M: sub (write-ptx-element)
+    "sub" write-insn
+    write-addsub ;
+M: subc (write-ptx-element)
+    "subc" write-insn
+    write-int-addsub ;
+M: testp (write-ptx-element)
+    "testp" write-insn
+    dup op>> (write-ptx-element)
+    write-2op ;
+M: trap (write-ptx-element)
+    "trap" write-insn drop ;
+M: vote (write-ptx-element)
+    "vote" write-insn
+    dup mode>> (write-ptx-element)
+    write-2op ;
+M: xor (write-ptx-element)
+    "xor" write-insn
+    write-3op ;
+
+: ptx>string ( ptx -- string )
+    [ write-ptx ] with-string-writer ;
diff --git a/extra/cuda/syntax/authors.txt b/extra/cuda/syntax/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/cuda/syntax/syntax.factor b/extra/cuda/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..09b7786
--- /dev/null
@@ -0,0 +1,18 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.parser cuda cuda.libraries io.backend
+fry kernel lexer namespaces parser ;
+IN: cuda.syntax
+
+SYNTAX: CUDA-LIBRARY:
+    scan scan-word scan
+    '[ _ _ add-cuda-library ]
+    [ current-cuda-library set-global ] bi ;
+
+SYNTAX: CUDA-FUNCTION:
+    scan [ create-in current-cuda-library get ] keep
+    ";" scan-c-args drop define-cuda-function ;
+
+SYNTAX: CUDA-GLOBAL:
+    scan [ create-in current-cuda-library get ] keep
+    define-cuda-global ;
diff --git a/extra/cuda/tags.txt b/extra/cuda/tags.txt
new file mode 100644 (file)
index 0000000..700f0dc
--- /dev/null
@@ -0,0 +1 @@
+not tested
diff --git a/extra/cuda/types/types.factor b/extra/cuda/types/types.factor
new file mode 100644 (file)
index 0000000..7d16685
--- /dev/null
@@ -0,0 +1,292 @@
+! (c)2010 Joe Groff bsd license
+USING: accessors alien.c-types classes.struct kernel math ;
+FROM: alien.c-types => float ;
+IN: cuda.types
+
+STRUCT: char1
+    { x char } ;
+STRUCT: char2
+    { x char }
+    { y char } ;
+STRUCT: char3
+    { x char }
+    { y char }
+    { z char } ;
+STRUCT: char4
+    { x char }
+    { y char }
+    { z char }
+    { w char } ;
+
+STRUCT: uchar1
+    { x uchar } ;
+STRUCT: uchar2
+    { x uchar }
+    { y uchar } ;
+STRUCT: uchar3
+    { x uchar }
+    { y uchar }
+    { z uchar } ;
+STRUCT: uchar4
+    { x uchar }
+    { y uchar }
+    { z uchar }
+    { w uchar } ;
+
+STRUCT: short1
+    { x short } ;
+STRUCT: short2
+    { x short }
+    { y short } ;
+STRUCT: short3
+    { x short }
+    { y short }
+    { z short } ;
+STRUCT: short4
+    { x short }
+    { y short }
+    { z short }
+    { w short } ;
+
+STRUCT: ushort1
+    { x ushort } ;
+STRUCT: ushort2
+    { x ushort }
+    { y ushort } ;
+STRUCT: ushort3
+    { x ushort }
+    { y ushort }
+    { z ushort } ;
+STRUCT: ushort4
+    { x ushort }
+    { y ushort }
+    { z ushort }
+    { w ushort } ;
+
+STRUCT: int1
+    { x int } ;
+STRUCT: int2
+    { x int }
+    { y int } ;
+STRUCT: int3
+    { x int }
+    { y int }
+    { z int } ;
+STRUCT: int4
+    { x int }
+    { y int }
+    { z int }
+    { w int } ;
+
+STRUCT: uint1
+    { x uint } ;
+STRUCT: uint2
+    { x uint }
+    { y uint } ;
+STRUCT: uint3
+    { x uint }
+    { y uint }
+    { z uint } ;
+STRUCT: uint4
+    { x uint }
+    { y uint }
+    { z uint }
+    { w uint } ;
+
+STRUCT: long1
+    { x long } ;
+STRUCT: long2
+    { x long }
+    { y long } ;
+STRUCT: long3
+    { x long }
+    { y long }
+    { z long } ;
+STRUCT: long4
+    { x long }
+    { y long }
+    { z long }
+    { w long } ;
+
+STRUCT: ulong1
+    { x ulong } ;
+STRUCT: ulong2
+    { x ulong }
+    { y ulong } ;
+STRUCT: ulong3
+    { x ulong }
+    { y ulong }
+    { z ulong } ;
+STRUCT: ulong4
+    { x ulong }
+    { y ulong }
+    { z ulong }
+    { w ulong } ;
+
+STRUCT: longlong1
+    { x longlong } ;
+STRUCT: longlong2
+    { x longlong }
+    { y longlong } ;
+STRUCT: longlong3
+    { x longlong }
+    { y longlong }
+    { z longlong } ;
+STRUCT: longlong4
+    { x longlong }
+    { y longlong }
+    { z longlong }
+    { w longlong } ;
+
+STRUCT: ulonglong1
+    { x ulonglong } ;
+STRUCT: ulonglong2
+    { x ulonglong }
+    { y ulonglong } ;
+STRUCT: ulonglong3
+    { x ulonglong }
+    { y ulonglong }
+    { z ulonglong } ;
+STRUCT: ulonglong4
+    { x ulonglong }
+    { y ulonglong }
+    { z ulonglong }
+    { w ulonglong } ;
+
+STRUCT: float1
+    { x float } ;
+STRUCT: float2
+    { x float }
+    { y float } ;
+STRUCT: float3
+    { x float }
+    { y float }
+    { z float } ;
+STRUCT: float4
+    { x float }
+    { y float }
+    { z float }
+    { w float } ;
+
+STRUCT: double1
+    { x double } ;
+STRUCT: double2
+    { x double }
+    { y double } ;
+STRUCT: double3
+    { x double }
+    { y double }
+    { z double } ;
+STRUCT: double4
+    { x double }
+    { y double }
+    { z double }
+    { w double } ;
+
+char2 c-type 
+    2 >>align
+    2 >>align-first
+    drop
+char4 c-type 
+    4 >>align
+    4 >>align-first
+    drop
+
+uchar2 c-type 
+    2 >>align
+    2 >>align-first
+    drop
+uchar4 c-type 
+    4 >>align
+    4 >>align-first
+    drop
+
+short2 c-type 
+    4 >>align
+    4 >>align-first
+    drop
+short4 c-type 
+    8 >>align
+    8 >>align-first
+    drop
+
+ushort2 c-type 
+    4 >>align
+    4 >>align-first
+    drop
+ushort4 c-type 
+    8 >>align
+    8 >>align-first
+    drop
+
+int2 c-type 
+    8 >>align
+    8 >>align-first
+    drop
+int4 c-type 
+    16 >>align
+    16 >>align-first
+    drop
+
+uint2 c-type 
+    8 >>align
+    8 >>align-first
+    drop
+uint4 c-type 
+    16 >>align
+    16 >>align-first
+    drop
+
+long2 c-type 
+    long heap-size 2 * >>align
+    long heap-size 2 * >>align-first
+    drop
+long4 c-type 
+    16 >>align
+    16 >>align-first
+    drop
+
+ulong2 c-type 
+    long heap-size 2 * >>align
+    long heap-size 2 * >>align-first
+    drop
+ulong4 c-type 
+    16 >>align
+    16 >>align-first
+    drop
+
+longlong2 c-type 
+    16 >>align
+    16 >>align-first
+    drop
+longlong4 c-type 
+    16 >>align
+    16 >>align-first
+    drop
+
+ulonglong2 c-type 
+    16 >>align
+    16 >>align-first
+    drop
+ulonglong4 c-type 
+    16 >>align
+    16 >>align-first
+    drop
+
+float2 c-type 
+    8 >>align
+    8 >>align-first
+    drop
+float4 c-type 
+    16 >>align
+    16 >>align-first
+    drop
+
+double2 c-type 
+    16 >>align
+    16 >>align-first
+    drop
+double4 c-type 
+    16 >>align
+    16 >>align-first
+    drop
diff --git a/extra/cuda/utils/authors.txt b/extra/cuda/utils/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
index a9edc2e92b1316646ec5eced97aac243725a803f..2b52d0ec566d3a84b5afd096f489ce447bf0e679 100644 (file)
@@ -8,7 +8,7 @@ IN: curses.ffi
     { [ os winnt? ]  [ "libcurses.dll" ] }
     { [ os macosx? ] [ "libcurses.dylib" ] }
     { [ os unix?  ]  [ "libcurses.so" ] }
-} cond "cdecl" add-library >>
+} cond cdecl add-library >>
 
 C-TYPE: WINDOW
 C-TYPE: SCREEN
@@ -58,7 +58,7 @@ STRUCT: c-window
     { _use_keypad bool    }
     { _delay int     }
 
-    { _line char* }
+    { _line c-string }
     { _regtop NCURSES_SIZE_T }
     { _regbottom NCURSES_SIZE_T }
 
@@ -79,7 +79,7 @@ C-GLOBAL: void* stdscr
 FUNCTION: WINDOW* initscr ( ) ;
 FUNCTION: int endwin ( ) ;
 FUNCTION: bool isendwin ( ) ;
-FUNCTION: SCREEN* newterm ( char* type, FILE* outfd, FILE* infd ) ;
+FUNCTION: SCREEN* newterm ( c-string type, FILE* outfd, FILE* infd ) ;
 FUNCTION: SCREEN* set_term ( SCREEN* new ) ;
 FUNCTION: void delscreen ( SCREEN* sp ) ;
 
@@ -157,21 +157,21 @@ FUNCTION: int mvwgetch ( WINDOW* win, int y, int x ) ;
 FUNCTION: int ungetch ( int ch ) ;
 FUNCTION: int has_key ( int ch ) ;
 
-FUNCTION: int getstr ( char* str ) ;
-FUNCTION: int getnstr ( char* str, int n ) ;
-FUNCTION: int wgetstr ( WINDOW* win, char* str ) ;
-FUNCTION: int wgetnstr ( WINDOW* win, char* str, int n ) ;
-FUNCTION: int mvgetstr ( int y, int x, char* str ) ;
-FUNCTION: int mvwgetstr ( WINDOW* win, int y, int x, char* str ) ;
-FUNCTION: int mvgetnstr ( int y, int x, char* str, int n ) ;
-FUNCTION: int mvwgetnstr ( WINDOW* win, int y, int x, char* str, int n ) ;
-
-FUNCTION: int printw ( char* fmt, int lol ) ;
-FUNCTION: int wprintw ( WINDOW* win, char* fmt, int lol ) ;
-FUNCTION: int mvprintw ( int y, int x, char* fmt, int lol ) ;
-FUNCTION: int mvwprintw ( WINDOW* win, int y, int x, char* fmt, int lol ) ;
-FUNCTION: int vwprintw ( WINDOW* win, char* fmt, va_list varglist ) ;
-FUNCTION: int vw_printw ( WINDOW* win, char* fmt, va_list varglist ) ;
+FUNCTION: int getstr ( c-string str ) ;
+FUNCTION: int getnstr ( c-string str, int n ) ;
+FUNCTION: int wgetstr ( WINDOW* win, c-string str ) ;
+FUNCTION: int wgetnstr ( WINDOW* win, c-string str, int n ) ;
+FUNCTION: int mvgetstr ( int y, int x, c-string str ) ;
+FUNCTION: int mvwgetstr ( WINDOW* win, int y, int x, c-string str ) ;
+FUNCTION: int mvgetnstr ( int y, int x, c-string str, int n ) ;
+FUNCTION: int mvwgetnstr ( WINDOW* win, int y, int x, c-string str, int n ) ;
+
+FUNCTION: int printw ( c-string fmt, int lol ) ;
+FUNCTION: int wprintw ( WINDOW* win, c-string fmt, int lol ) ;
+FUNCTION: int mvprintw ( int y, int x, c-string fmt, int lol ) ;
+FUNCTION: int mvwprintw ( WINDOW* win, int y, int x, c-string fmt, int lol ) ;
+FUNCTION: int vwprintw ( WINDOW* win, c-string fmt, va_list varglist ) ;
+FUNCTION: int vw_printw ( WINDOW* win, c-string fmt, va_list varglist ) ;
 
 FUNCTION: int move ( int y, int x ) ;
 FUNCTION: int wmove ( WINDOW* win, int y, int x ) ;
@@ -221,11 +221,11 @@ FUNCTION: int winsdelln ( WINDOW* win, int n ) ;
 FUNCTION: int insertln ( ) ;
 FUNCTION: int winsertln ( WINDOW* win ) ;
 
-FUNCTION: int addstr ( char* str ) ;
-FUNCTION: int addnstr ( char* str, int n ) ;
-FUNCTION: int waddstr ( WINDOW* win, char* str ) ;
-FUNCTION: int waddnstr ( WINDOW* win, char* str, int n ) ;
-FUNCTION: int mvaddstr ( int y, int x, char* str ) ;
-FUNCTION: int mvaddnstr ( int y, int x, char* str, int n ) ;
-FUNCTION: int mvwaddstr ( WINDOW* win, int y, int x, char* str ) ;
-FUNCTION: int mvwaddnstr ( WINDOW* win, int y, int x, char* str, int n ) ;
+FUNCTION: int addstr ( c-string str ) ;
+FUNCTION: int addnstr ( c-string str, int n ) ;
+FUNCTION: int waddstr ( WINDOW* win, c-string str ) ;
+FUNCTION: int waddnstr ( WINDOW* win, c-string str, int n ) ;
+FUNCTION: int mvaddstr ( int y, int x, c-string str ) ;
+FUNCTION: int mvaddnstr ( int y, int x, c-string str, int n ) ;
+FUNCTION: int mvwaddstr ( WINDOW* win, int y, int x, c-string str ) ;
+FUNCTION: int mvwaddnstr ( WINDOW* win, int y, int x, c-string str, int n ) ;
index b4bd0e7b35e6a8f0d41992b7e7faba52bb7d25da..f13c9c1e77f7b880a3377fd0ad6283a5d9c7b616 100644 (file)
@@ -1 +1 @@
-Doug Coleman
\ No newline at end of file
+Joe Groff
index 8821d4570cf7f21e68b6f6c233c809f279637553..df168a900878da7c5f4e0c52c252c79917b4f6d8 100644 (file)
@@ -1,44 +1,68 @@
-! Copyright (C) 2009 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: cursors math tools.test make ;
+! (c)2010 Joe Groff bsd license
+USING: accessors cursors kernel make math sequences sorting tools.test ;
+FROM: cursors => each map assoc-each assoc>map ;
 IN: cursors.tests
 
-[ 2 t ] [ { 2 3 } [ even? ] find ] unit-test
-[ 3 t ] [ { 2 3 } [ odd? ] find ] unit-test
-[ f f ] [ { 2 4 } [ odd? ] find ] unit-test
+[ { 1 2 3 4 } ] [
+    [ T{ linear-cursor f 1 1 } T{ linear-cursor f 5 1 } [ value>> , ] -each ]
+    { } make
+] unit-test
 
-[ { 2 3 } ] [ { 1 2 } [ 1 + ] map ] unit-test
-[ { 2 3 } ] [ { 1 2 } [ [ 1 + , ] each ] { 2 3 } make ] unit-test
+[ T{ linear-cursor f 3 1 } ] [
+    T{ linear-cursor f 1 1 } T{ linear-cursor f 5 1 } [ value>> 3 mod zero? ] -find
+] unit-test
 
-[ t ] [ { } [ odd? ] all? ] unit-test
-[ t ] [ { 1 3 5 } [ odd? ] all? ] unit-test
-[ f ] [ { 1 3 5 6 } [ odd? ] all? ] unit-test
+[ T{ linear-cursor f 5 1 } ] [
+    T{ linear-cursor f 1 1 } T{ linear-cursor f 5 1 } [ value>> 6 = ] -find
+] unit-test
 
-[ t ] [ { } [ odd? ] all? ] unit-test
-[ t ] [ { 1 3 5 } [ odd? ] any? ] unit-test
-[ f ] [ { 2 4 6 } [ odd? ] any? ] unit-test
+[ { 1 3 } ] [
+    [ T{ linear-cursor f 1 2 } T{ linear-cursor f 5 2 } [ value>> , ] -each ]
+    { } make
+] unit-test
 
-[ { 1 3 5 } ] [ { 1 2 3 4 5 6 } [ odd? ] filter ] unit-test
+[ B{ 1 2 3 4 5 } ] [ [ { 1 2 3 4 5 } [ , ] each ] B{ } make ] unit-test
+[ B{ } ] [ [ { } [ , ] each ] B{ } make ] unit-test
+[ { 2 4 6 8 10 } ] [ { 1 2 3 4 5 } [ 2 * ] map ] unit-test
 
-[ { } ]
-[ { 1 2 } { } [ + ] 2map ] unit-test
+[ { "roses: lutefisk" "tulips: lox" } ]
+[
+    [
+        H{ { "roses" "lutefisk" } { "tulips" "lox" } }
+        [ ": " glue , ] assoc-each
+    ] { } make natural-sort
+] unit-test
 
-[ { 11 } ]
-[ { 1 2 } { 10 } [ + ] 2map ] unit-test
+[ { "roses: lutefisk" "tulips: lox" } ]
+[
+    H{ { "roses" "lutefisk" } { "tulips" "lox" } }
+    [ ": " glue ] { } assoc>map natural-sort
+] unit-test
 
-[ { 11 22 } ]
-[ { 1 2 } { 10 20 } [ + ] 2map ] unit-test
+: compile-test-each ( xs -- )
+    [ , ] each ;
 
-[ { } ]
-[ { 1 2 } { } { } [ + + ] 3map ] unit-test
+: compile-test-map ( xs -- ys )
+    [ 2 * ] map ;
 
-[ { 111 } ]
-[ { 1 2 } { 10 } { 100 200 } [ + + ] 3map ] unit-test
+: compile-test-assoc-each ( xs -- )
+    [ ": " glue , ] assoc-each ;
 
-[ { 111 222 } ]
-[ { 1 2 } { 10 20 } { 100 200 } [ + + ] 3map ] unit-test
+: compile-test-assoc>map ( xs -- ys )
+    [ ": " glue ] { } assoc>map ;
 
-: test-3map ( -- seq )
-     { 1 2 } { 10 20 } { 100 200 } [ + + ] 3map ;
+[ B{ 1 2 3 4 5 } ] [ [ { 1 2 3 4 5 } compile-test-each ] B{ } make ] unit-test
+[ { 2 4 6 8 10 } ] [ { 1 2 3 4 5 } compile-test-map ] unit-test
+
+[ { "roses: lutefisk" "tulips: lox" } ]
+[
+    [ H{ { "roses" "lutefisk" } { "tulips" "lox" } } compile-test-assoc-each ]
+    { } make natural-sort
+] unit-test
+
+[ { "roses: lutefisk" "tulips: lox" } ]
+[
+    H{ { "roses" "lutefisk" } { "tulips" "lox" } } compile-test-assoc>map
+    natural-sort
+] unit-test
 
-[ { 111 222 } ] [ test-3map ] unit-test
index 77defb081d952a977e2a11f73ed1e183ed7ebb1f..776a5523c4a5f6b91d2c2831f488431168ea7251 100644 (file)
-! Copyright (C) 2009 Slava Pestov, Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays generalizations kernel math sequences
-sequences.private fry ;
+! (c)2010 Joe Groff bsd license
+USING: accessors arrays assocs combinators.short-circuit fry
+hashtables kernel locals macros math math.functions math.order
+generalizations sequences ;
+FROM: sequences.private => nth-unsafe set-nth-unsafe ;
+FROM: hashtables.private => tombstone? ;
 IN: cursors
 
-GENERIC: cursor-done? ( cursor -- ? )
-GENERIC: cursor-get-unsafe ( cursor -- obj )
-GENERIC: cursor-advance ( cursor -- )
+!
+! basic cursor protocol
+!
+
+MIXIN: cursor
+
+GENERIC: cursor-compatible? ( cursor cursor -- ? )
 GENERIC: cursor-valid? ( cursor -- ? )
-GENERIC: cursor-write ( obj cursor -- )
+GENERIC: cursor= ( cursor cursor -- ? )
+GENERIC: cursor<= ( cursor cursor -- ? )
+GENERIC: cursor>= ( cursor cursor -- ? )
+GENERIC: cursor-distance-hint ( cursor cursor -- n )
+
+M: cursor cursor<= cursor= ; inline
+M: cursor cursor>= cursor= ; inline
+M: cursor cursor-distance-hint 2drop 0 ; inline
+
+!
+! cursor iteration
+!
+
+MIXIN: forward-cursor
+INSTANCE: forward-cursor cursor
+
+GENERIC: inc-cursor ( cursor -- cursor' )
+
+MIXIN: bidirectional-cursor
+INSTANCE: bidirectional-cursor forward-cursor
+
+GENERIC: dec-cursor ( cursor -- cursor' )
+
+MIXIN: random-access-cursor
+INSTANCE: random-access-cursor bidirectional-cursor
+
+GENERIC# cursor+ 1 ( cursor n -- cursor' )
+GENERIC# cursor- 1 ( cursor n -- cursor' )
+GENERIC: cursor-distance ( cursor cursor -- n )
+GENERIC: cursor<  ( cursor cursor -- ? )
+GENERIC: cursor>  ( cursor cursor -- ? )
+
+M: random-access-cursor inc-cursor  1 cursor+ ; inline
+M: random-access-cursor dec-cursor -1 cursor+ ; inline
+M: random-access-cursor cursor- neg cursor+ ; inline
+M: random-access-cursor cursor<= { [ cursor= ] [ cursor< ] } 2|| ; inline
+M: random-access-cursor cursor>= { [ cursor= ] [ cursor> ] } 2|| ; inline
+M: random-access-cursor cursor-distance-hint cursor-distance ; inline
+
+!
+! input cursors
+!
+
+ERROR: invalid-cursor cursor ;
+
+MIXIN: input-cursor
+
+GENERIC: cursor-key-value ( cursor -- key value )
+<PRIVATE
+GENERIC: cursor-key-value-unsafe ( cursor -- key value )
+PRIVATE>
+M: input-cursor cursor-key-value-unsafe cursor-key-value ; inline
+M: input-cursor cursor-key-value
+    dup cursor-valid? [ cursor-key-value-unsafe ] [ invalid-cursor ] if ; inline
+
+: cursor-key ( cursor -- key ) cursor-key-value drop ;
+: cursor-value ( cursor -- key ) cursor-key-value nip ;
+
+: cursor-key-unsafe ( cursor -- key ) cursor-key-value-unsafe drop ;
+: cursor-value-unsafe ( cursor -- key ) cursor-key-value-unsafe nip ;
+
+!
+! output cursors
+!
+
+MIXIN: output-cursor
+
+GENERIC: set-cursor-value ( value cursor -- )
+<PRIVATE
+GENERIC: set-cursor-value-unsafe ( value cursor -- )
+PRIVATE>
+M: output-cursor set-cursor-value-unsafe set-cursor-value ; inline
+M: output-cursor set-cursor-value
+    dup cursor-valid? [ set-cursor-value-unsafe ] [ invalid-cursor ] if ; inline
+
+!
+! stream cursors
+!
+
+MIXIN: stream-cursor
+INSTANCE: stream-cursor forward-cursor
+
+M: stream-cursor cursor-compatible? 2drop f ; inline
+M: stream-cursor cursor-valid? drop t ; inline
+M: stream-cursor cursor= 2drop f ; inline
+
+MIXIN: infinite-stream-cursor
+INSTANCE: infinite-stream-cursor stream-cursor
+
+M: infinite-stream-cursor inc-cursor ; inline
+
+MIXIN: finite-stream-cursor
+INSTANCE: finite-stream-cursor stream-cursor
+
+SINGLETON: end-of-stream
+
+GENERIC: cursor-stream-ended? ( cursor -- ? )
+
+M: finite-stream-cursor inc-cursor
+    dup cursor-stream-ended? [ drop end-of-stream ] when ; inline
+
+INSTANCE: end-of-stream finite-stream-cursor
+
+M: end-of-stream cursor-compatible? drop finite-stream-cursor? ; inline
+M: end-of-stream cursor-valid? drop f ; inline
+M: end-of-stream cursor= eq? ; inline
+M: end-of-stream inc-cursor ; inline
+M: end-of-stream cursor-stream-ended? drop t ; inline
+
+!
+! basic iterators
+!
+
+: -each ( ... begin end quot: ( ... cursor -- ... ) -- ... )
+    [ '[ dup _ cursor>= ] ]
+    [ '[ _ keep inc-cursor ] ] bi* until drop ; inline
+
+: -find ( ... begin end quot: ( ... cursor -- ... ? ) -- ... cursor )
+    '[ dup _ cursor>= [ t ] [ dup @ ] if ] [ inc-cursor ] until ; inline
+
+: -in- ( quot -- quot' )
+    '[ cursor-value-unsafe @ ] ; inline
+
+: -out- ( quot -- quot' )
+    '[ _ keep set-cursor-value-unsafe ] ; inline
+
+: -out ( ... begin end quot: ( ... cursor -- ... value ) -- ... )
+    -out- -each ; inline
+
+!
+! numeric cursors
+!
+
+TUPLE: numeric-cursor
+    { value read-only } ;
+
+M: numeric-cursor cursor-valid? drop t ; inline
+
+M: numeric-cursor cursor=  [ value>> ] bi@ =  ; inline
+
+M: numeric-cursor cursor<= [ value>> ] bi@ <= ; inline
+M: numeric-cursor cursor<  [ value>> ] bi@ <  ; inline
+M: numeric-cursor cursor>  [ value>> ] bi@ >  ; inline
+M: numeric-cursor cursor>= [ value>> ] bi@ >= ; inline
+
+INSTANCE: numeric-cursor input-cursor
+
+M: numeric-cursor cursor-key-value value>> dup ; inline
+
+!
+! linear cursor
+!
+
+TUPLE: linear-cursor < numeric-cursor
+    { delta read-only } ;
+C: <linear-cursor> linear-cursor
+
+INSTANCE: linear-cursor random-access-cursor
+
+M: linear-cursor cursor-compatible?
+    [ linear-cursor? ] both? ; inline
+
+M: linear-cursor inc-cursor
+    [ value>> ] [ delta>> ] bi [ + ] keep <linear-cursor> ; inline
+M: linear-cursor dec-cursor
+    [ value>> ] [ delta>> ] bi [ - ] keep <linear-cursor> ; inline
+M: linear-cursor cursor+
+    [ [ value>> ] [ delta>> ] bi ] dip [ * + ] keep <linear-cursor> ; inline
+M: linear-cursor cursor-
+    [ [ value>> ] [ delta>> ] bi ] dip [ * - ] keep <linear-cursor> ; inline
+
+GENERIC: up/i ( distance delta -- distance' )
+M: integer up/i [ 1 - + ] keep /i ; inline
+M: real up/i / ceiling >integer ; inline
+
+M: linear-cursor cursor-distance
+    [ [ value>> ] bi@ - ] [ nip delta>> ] 2bi up/i ; inline
+
+!
+! quadratic cursor
+!
+
+TUPLE: quadratic-cursor < numeric-cursor
+    { delta read-only }
+    { delta2 read-only } ;
+
+C: <quadratic-cursor> quadratic-cursor
+
+INSTANCE: quadratic-cursor bidirectional-cursor
+
+M: quadratic-cursor cursor-compatible?
+    [ linear-cursor? ] both? ; inline
+
+M: quadratic-cursor inc-cursor
+    [ value>> ] [ delta>> [ + ] keep ] [ delta2>> [ + ] keep ] tri <quadratic-cursor> ; inline
+
+M: quadratic-cursor dec-cursor
+    [ value>> ] [ delta>> ] [ delta2>> ] tri [ - [ - ] keep ] keep <quadratic-cursor> ; inline
+
+!
+! collections
+!
+
+MIXIN: collection
+
+GENERIC: begin-cursor ( collection -- cursor )
+GENERIC: end-cursor ( collection -- cursor )
+
+: all ( collection -- begin end )
+    [ begin-cursor ] [ end-cursor ] bi ; inline
+
+: all- ( collection quot -- begin end quot )
+    [ all ] dip ; inline
+
+!
+! containers
+!
+
+MIXIN: container
+INSTANCE: container collection
+
+: in- ( container quot -- begin end quot' )
+    all- -in- ; inline
+
+: each ( ... container quot: ( ... x -- ... ) -- ... ) in- -each ; inline
+
+INSTANCE: finite-stream-cursor container
+
+M: finite-stream-cursor begin-cursor ; inline
+M: finite-stream-cursor end-cursor drop end-of-stream ; inline
+
+!
+! sequence cursor
+!
+
+TUPLE: sequence-cursor
+    { seq read-only }
+    { n fixnum read-only } ;
+C: <sequence-cursor> sequence-cursor
+    
+INSTANCE: sequence container
+
+M: sequence begin-cursor 0 <sequence-cursor> ; inline
+M: sequence end-cursor dup length <sequence-cursor> ; inline
+
+INSTANCE: sequence-cursor random-access-cursor
+
+M: sequence-cursor cursor-compatible?
+    {
+        [ [ sequence-cursor? ] both? ]
+        [ [ seq>> ] bi@ eq? ]
+    } 2&& ; inline
+
+M: sequence-cursor cursor-valid?
+    [ n>> ] [ seq>> ] bi bounds-check? ; inline
+
+M: sequence-cursor cursor=  [ n>> ] bi@ =  ; inline
+M: sequence-cursor cursor<= [ n>> ] bi@ <= ; inline
+M: sequence-cursor cursor>= [ n>> ] bi@ >= ; inline
+M: sequence-cursor cursor<  [ n>> ] bi@ <  ; inline
+M: sequence-cursor cursor>  [ n>> ] bi@ >  ; inline
+M: sequence-cursor inc-cursor [ seq>> ] [ n>> ] bi 1 + <sequence-cursor> ; inline
+M: sequence-cursor dec-cursor [ seq>> ] [ n>> ] bi 1 - <sequence-cursor> ; inline
+M: sequence-cursor cursor+ [ [ seq>> ] [ n>> ] bi ] dip + <sequence-cursor> ; inline
+M: sequence-cursor cursor- [ [ seq>> ] [ n>> ] bi ] dip - <sequence-cursor> ; inline
+M: sequence-cursor cursor-distance ( cursor cursor -- n )
+    [ n>> ] bi@ - ; inline
+
+INSTANCE: sequence-cursor input-cursor
+
+M: sequence-cursor cursor-key-value-unsafe [ n>> dup ] [ seq>> ] bi nth-unsafe ; inline
+M: sequence-cursor cursor-key-value [ n>> dup ] [ seq>> ] bi nth ; inline
+
+INSTANCE: sequence-cursor output-cursor
+
+M: sequence-cursor set-cursor-value-unsafe [ n>> ] [ seq>> ] bi set-nth-unsafe ; inline
+M: sequence-cursor set-cursor-value [ n>> ] [ seq>> ] bi set-nth ; inline
+
+!
+! map cursor
+!
+
+TUPLE: map-cursor
+    { from read-only }
+    { to read-only } ;
+C: <map-cursor> map-cursor
+
+INSTANCE: map-cursor forward-cursor
+
+M: map-cursor cursor-compatible? [ from>> ] bi@ cursor-compatible? ; inline
+M: map-cursor cursor-valid? [ from>> ] [ to>> ] bi [ cursor-valid? ] both? ; inline
+M: map-cursor cursor= [ from>> ] bi@ cursor= ; inline
+M: map-cursor inc-cursor [ from>> inc-cursor ] [ to>> inc-cursor ] bi <map-cursor> ; inline
+
+INSTANCE: map-cursor output-cursor
+
+M: map-cursor set-cursor-value-unsafe to>> set-cursor-value-unsafe ; inline
+M: map-cursor set-cursor-value        to>> set-cursor-value        ; inline
+
+: -map- ( begin end quot to -- begin' end' quot' )
+    swap [ '[ _ <map-cursor> ] bi@ ] dip '[ from>> @ ] -out- ; inline
+
+: -map ( begin end quot to -- begin' end' quot' )
+    -map- -each ; inline
+
+!
+! pusher cursor
+!
+
+TUPLE: pusher-cursor
+    { growable read-only } ;
+C: <pusher-cursor> pusher-cursor
+
+INSTANCE: pusher-cursor infinite-stream-cursor
+INSTANCE: pusher-cursor output-cursor
+
+M: pusher-cursor set-cursor-value growable>> push ; inline
+
+!
+! Create cursors into new sequences
+!
+
+: new-growable-cursor ( begin end exemplar -- cursor result )
+    [ swap cursor-distance-hint ] dip new-resizable [ <pusher-cursor> ] keep ; inline
+
+GENERIC# new-sequence-cursor 1 ( begin end exemplar -- cursor result )
+
+M: random-access-cursor new-sequence-cursor
+    [ swap cursor-distance ] dip new-sequence [ begin-cursor ] keep ; inline
+M: forward-cursor new-sequence-cursor
+    new-growable-cursor ; inline
+
+: -into-sequence- ( begin end quot exemplar -- begin' end' quot' cursor result )
+    [ 2over ] dip new-sequence-cursor ; inline
+
+: -into-growable- ( begin end quot exemplar -- begin' end' quot' cursor result )
+    [ 2over ] dip new-growable-cursor ; inline
+
+!
+! map combinators
+!
+
+! XXX generalize exemplar
+: -map-as ( ... begin end quot: ( ... cursor -- ... value ) exemplar -- ... newseq )
+    [ -into-sequence- [ -map ] dip ] keep like ; inline
+
+: map! ( ... container quot: ( ... x -- ... newx ) -- ... container )
+    [ in- -out ] keep ; inline
+: map-as ( ... container quot: ( ... x -- ... newx ) exemplar -- ... newseq )
+    [ in- ] dip -map-as ; inline
+: map ( ... container quot: ( ... x -- ... newx ) -- ... newcontainer )
+    over map-as ; inline
+
+!
+! assoc combinators
+!
+
+: -assoc- ( quot -- quot' )
+    '[ cursor-key-value @ ] ; inline
+
+: assoc- ( assoc quot -- begin end quot' )
+    all- -assoc- ; inline
+
+: assoc-each ( ... assoc quot: ( ... k v -- ... ) -- ... )
+    assoc- -each ; inline
+: assoc>map ( ... assoc quot: ( ... k v -- ... newx ) exemplar -- ... newcontainer )
+    [ assoc- ] dip -map-as ; inline
 
-ERROR: cursor-ended cursor ;
+!
+! hashtable cursor
+!
 
-: cursor-get ( cursor -- obj )
-    dup cursor-done?
-    [ cursor-ended ] [ cursor-get-unsafe ] if ; inline
+TUPLE: hashtable-cursor
+    { hashtable hashtable read-only }
+    { n fixnum read-only } ;
+<PRIVATE
+C: <hashtable-cursor> hashtable-cursor
+PRIVATE>
 
-: find-done? ( cursor quot -- ? )
-    over cursor-done?
-    [ 2drop t ] [ [ cursor-get-unsafe ] dip call ] if ; inline
+INSTANCE: hashtable-cursor forward-cursor
 
-: cursor-until ( cursor quot -- )
-    [ find-done? not ]
-    [ drop cursor-advance ] bi-curry bi-curry while ; inline
-: cursor-each ( cursor quot -- )
-    [ f ] compose cursor-until ; inline
+M: hashtable-cursor cursor-compatible?
+    {
+        [ [ hashtable-cursor? ] both? ]
+        [ [ hashtable>> ] bi@ eq? ]
+    } 2&& ; inline
 
-: cursor-find ( cursor quot -- obj ? )
-    [ cursor-until ] [ drop ] 2bi
-    dup cursor-done? [ drop f f ] [ cursor-get t ] if ; inline
+M: hashtable-cursor cursor-valid? ( cursor -- ? )
+    [ n>> ] [ hashtable>> array>> ] bi bounds-check? ; inline
 
-: cursor-any? ( cursor quot -- ? )
-    cursor-find nip ; inline
+M: hashtable-cursor cursor= ( cursor cursor -- ? )
+    [ n>> ] bi@ = ; inline
+M: hashtable-cursor cursor-distance-hint ( cursor cursor -- n )
+    nip hashtable>> assoc-size ; inline
 
-: cursor-all? ( cursor quot -- ? )
-    [ not ] compose cursor-any? not ; inline
+<PRIVATE
+: (inc-hashtable-cursor) ( array n -- n' )
+    [ 2dup swap { [ length < ] [ nth-unsafe tombstone? ] } 2&& ] [ 2 + ] while nip ; inline
+PRIVATE>
 
-: cursor-map-quot ( quot to -- quot' )
-    [ [ call ] dip cursor-write ] 2curry ; inline
+M: hashtable-cursor inc-cursor ( cursor -- cursor' )
+    [ hashtable>> dup array>> ] [ n>> 2 + ] bi
+    (inc-hashtable-cursor) <hashtable-cursor> ; inline
 
-: cursor-map ( from to quot -- )
-    swap cursor-map-quot cursor-each ; inline
+INSTANCE: hashtable-cursor input-cursor
 
-: cursor-write-if ( obj quot to -- )
-    [ over [ call ] dip ] dip
-    [ cursor-write ] 2curry when ; inline
+M: hashtable-cursor cursor-key-value-unsafe
+    [ n>> ] [ hashtable>> array>> ] bi
+    [ nth-unsafe ] [ [ 1 + ] dip nth-unsafe ] 2bi ; inline
 
-: cursor-filter-quot ( quot to -- quot' )
-    [ cursor-write-if ] 2curry ; inline
+INSTANCE: hashtable container
 
-: cursor-filter ( from to quot -- )
-    swap cursor-filter-quot cursor-each ; inline
+M: hashtable begin-cursor
+    dup array>> 0 (inc-hashtable-cursor) <hashtable-cursor> ; inline
+M: hashtable end-cursor
+    dup array>> length <hashtable-cursor> ; inline
 
-TUPLE: from-sequence { seq sequence } { n integer } ;
+!
+! zip cursor
+!
 
-: >from-sequence< ( from-sequence -- n seq )
-    [ n>> ] [ seq>> ] bi ; inline
+TUPLE: zip-cursor
+    { keys   read-only }
+    { values read-only } ;
+C: <zip-cursor> zip-cursor
 
-M: from-sequence cursor-done? ( cursor -- ? )
-    >from-sequence< length >= ;
+INSTANCE: zip-cursor forward-cursor
 
-M: from-sequence cursor-valid?
-    >from-sequence< bounds-check? not ;
+M: zip-cursor cursor-compatible? ( cursor cursor -- ? )
+    {
+        [ [ zip-cursor? ] both? ]
+        [ [ keys>> ] bi@ cursor-compatible? ]
+        [ [ values>> ] bi@ cursor-compatible? ]
+    } 2&& ; inline
 
-M: from-sequence cursor-get-unsafe
-    >from-sequence< nth-unsafe ;
+M: zip-cursor cursor-valid? ( cursor -- ? )
+    [ keys>> ] [ values>> ] bi [ cursor-valid? ] both? ; inline
+M: zip-cursor cursor= ( cursor cursor -- ? )
+    {
+        [ [ keys>> ] bi@ cursor= ]
+        [ [ values>> ] bi@ cursor= ]
+    } 2|| ; inline
 
-M: from-sequence cursor-advance
-    [ 1 + ] change-n drop ;
+M: zip-cursor cursor-distance-hint ( cursor cursor -- n )
+    [ [ keys>> ] bi@ cursor-distance-hint ]
+    [ [ values>> ] bi@ cursor-distance-hint ] 2bi max ; inline
 
-: >input ( seq -- cursor )
-    0 from-sequence boa ; inline
+M: zip-cursor inc-cursor ( cursor -- cursor' )
+    [ keys>> inc-cursor ] [ values>> inc-cursor ] bi <zip-cursor> ; inline
+    
+INSTANCE: zip-cursor input-cursor
 
-: iterate ( seq quot iterator -- )
-    [ >input ] 2dip call ; inline
+M: zip-cursor cursor-key-value
+    [ keys>> cursor-value-unsafe ] [ values>> cursor-value-unsafe ] bi ; inline
 
-: each ( seq quot -- ) [ cursor-each ] iterate ; inline
-: find ( seq quot -- ? ) [ cursor-find ] iterate ; inline
-: any? ( seq quot -- ? ) [ cursor-any? ] iterate ; inline
-: all? ( seq quot -- ? ) [ cursor-all? ] iterate ; inline
+: zip-cursors ( a-begin a-end b-begin b-end -- begin end )
+    [ <zip-cursor> ] bi-curry@ bi* ; inline
 
-TUPLE: to-sequence { seq sequence } { exemplar sequence } ;
+: 2all ( a b -- begin end )
+    [ all ] bi@ zip-cursors ; inline
 
-M: to-sequence cursor-write
-    seq>> push ;
+: 2all- ( a b quot -- begin end quot )
+    [ 2all ] dip ; inline
 
-: freeze ( cursor -- seq )
-    [ seq>> ] [ exemplar>> ] bi like ; inline
+ALIAS: -2in- -assoc-
 
-: >output ( seq -- cursor )
-    [ [ length ] keep new-resizable ] keep
-    to-sequence boa ; inline
+: 2in- ( a b quot -- begin end quot' )
+    2all- -2in- ; inline
 
-: transform ( seq quot transformer -- newseq )
-    [ [ >input ] [ >output ] bi ] 2dip
-    [ call ]
-    [ 2drop freeze ] 3bi ; inline
+: 2each ( ... a b quot: ( ... x y -- ... ) -- ... )
+    2in- -each ; inline
 
-: map ( seq quot -- ) [ cursor-map ] transform ; inline
-: filter ( seq quot -- newseq ) [ cursor-filter ] transform ; inline
+: 2map-as ( ... a b quot: ( ... x y -- ... z ) exemplar -- ... c )
+    [ 2in- ] dip -map-as ; inline
 
-: find-done2? ( cursor cursor quot -- ? )
-    2over [ cursor-done? ] either?
-    [ 3drop t ] [ [ [ cursor-get-unsafe ] bi@ ] dip call ] if ; inline
+: 2map ( ... a b quot: ( ... x y -- ... z ) -- ... c )
+    pick 2map-as ; inline 
 
-: cursor-until2 ( cursor cursor quot -- )
-    [ find-done2? not ]
-    [ drop [ cursor-advance ] bi@ ] bi-curry bi-curry bi-curry while ; inline
+!
+! generalized zips
+!
 
-: cursor-each2 ( cursor cursor quot -- )
-    [ f ] compose cursor-until2 ; inline
+: -unzip- ( quot -- quot' )
+    '[ [ keys>> cursor-value-unsafe ] [ values>> ] bi @ ] ; inline
 
-: cursor-map2 ( from to quot -- )
-    swap cursor-map-quot cursor-each2 ; inline
+MACRO: nzip-cursors ( n -- ) 1 - [ zip-cursors ] n*quot ;
 
-: iterate2 ( seq1 seq2 quot iterator -- )
-    [ [ >input ] bi@ ] 2dip call ; inline
+: nall ( seqs... n -- begin end ) [ [ all ] swap napply ] [ nzip-cursors ] bi ; inline
 
-: transform2 ( seq1 seq2 quot transformer -- newseq )
-    [ over >output [ [ >input ] [ >input ] bi* ] dip ] 2dip
-    [ call ]
-    [ 2drop nip freeze ] 4 nbi ; inline
+: nall- ( seqs... quot n -- begin end quot ) swap [ nall ] dip ; inline
 
-: 2each ( seq1 seq2 quot -- ) [ cursor-each2 ] iterate2 ; inline
-: 2map ( seq1 seq2 quot -- ) [ cursor-map2 ] transform2 ; inline
+MACRO: -nin- ( n -- )
+    1 - [ -unzip- ] n*quot [ -in- ] prepend ;
 
-: find-done3? ( cursor1 cursor2 cursor3 quot -- ? )
-    [ 3 ndrop t ] swap '[ [ cursor-get-unsafe ] tri@ @ ]
-    [ 3 ndup 3 narray [ cursor-done? ] any? ] 2dip if ; inline
+: nin- ( seqs... quot n -- begin end quot ) [ nall- ] [ -nin- ] bi ; inline
 
-: cursor-until3 ( cursor cursor quot -- )
-    [ find-done3? not ]
-    [ drop [ cursor-advance ] tri@ ]
-    bi-curry bi-curry bi-curry bi-curry while ; inline
+: neach ( seqs... quot n -- ) nin- -each ; inline
+: nmap-as ( seqs... quot exemplar n -- newseq )
+    swap [ nin- ] dip -map-as ; inline
+: nmap ( seqs... quot n -- newseq )
+    dup [ npick ] curry [ dip swap ] curry dip nmap-as ; inline
 
-: cursor-each3 ( cursor cursor quot -- )
-    [ f ] compose cursor-until3 ; inline
+!
+! utilities
+!
 
-: cursor-map3 ( from to quot -- )
-    swap cursor-map-quot cursor-each3 ; inline
+: -with- ( invariant begin end quot -- begin end quot' )
+    [ rot ] dip '[ [ _ ] dip @ ] ; inline
 
-: iterate3 ( seq1 seq2 seq3 quot iterator -- )
-    [ [ >input ] tri@ ] 2dip call ; inline
+: -2with- ( invariant invariant begin end quot -- begin end quot' )
+    -with- -with- ; inline
 
-: transform3 ( seq1 seq2 seq3 quot transformer -- newseq )
-    [ pick >output [ [ >input ] [ >input ] [ >input ] tri* ] dip ] 2dip
-    [ call ]
-    [ 2drop 2nip freeze ] 5 nbi ; inline
+MACRO: -nwith- ( n -- )
+    [ -with- ] n*quot ;
 
-: 3each ( seq1 seq2 seq3 quot -- ) [ cursor-each3 ] iterate3 ; inline
-: 3map ( seq1 seq2 seq3 quot -- ) [ cursor-map3 ] transform3 ; inline
diff --git a/extra/db/info/info.factor b/extra/db/info/info.factor
deleted file mode 100644 (file)
index 4d17b6b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-USING: accessors sequences generalizations io.encodings.utf8 db.postgresql parser combinators vocabs.parser db.sqlite
-io.files ;
-IN: db.info
-! having sensative (and likely to change) information directly in source code seems a bad idea
-: get-info ( -- lines ) current-vocab name>> "vocab:" "/dbinfo.txt" surround utf8 file-lines ;
-SYNTAX: get-psql-info <postgresql-db> get-info 5 firstn
-    {
-        [ >>host ]
-        [ >>port ]
-        [ >>username ]
-        [ [ f ] [ ] if-empty >>password ]
-        [ >>database ]
-    } spread suffix! ;
-
-SYNTAX: get-sqlite-info get-info first <sqlite-db> suffix! ;
index 9c60d8ad1a7eedcbd3d8e2f8520674b7ec8114e9..87f977d362a2704345738ba3a4ec758979149f10 100644 (file)
@@ -1,9 +1,9 @@
 USING: kernel fry sequences vocabs.loader help.vocabs ui
 ui.gadgets ui.gadgets.buttons ui.gadgets.packs ui.gadgets.borders
-ui.gadgets.scrollers ui.tools.listener accessors ;
+ui.gadgets.scrollers ui.tools.listener accessors assocs ;
 IN: demos
 
-: demo-vocabs ( -- seq ) "demos" tagged [ second ] map concat [ name>> ] map ;
+: demo-vocabs ( -- seq ) "demos" tagged values concat [ name>> ] map ;
 
 : <run-vocab-button> ( vocab-name -- button )
     dup '[ drop [ _ run ] \ run call-listener ] <border-button> ;
index 0756c5c97528994fc3040d5876c761ed3c1def2b..dec94d76bf854cc5223f9b627a30bc9d30910323 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (c) 2008 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: words kernel sequences locals locals.parser fry
-locals.definitions accessors parser namespaces continuations
-summary definitions generalizations arrays prettyprint debugger io
-effects tools.annotations ;
+USING: words kernel sequences sequences.generalizations locals
+locals.parser fry locals.definitions accessors parser namespaces
+continuations summary definitions generalizations arrays
+prettyprint debugger io effects tools.annotations effects.parser ;
 IN: descriptive
 
 ERROR: descriptive-error args underlying word ;
diff --git a/extra/dwarf/authors.txt b/extra/dwarf/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/dwarf/dwarf.factor b/extra/dwarf/dwarf.factor
new file mode 100644 (file)
index 0000000..f6c6c46
--- /dev/null
@@ -0,0 +1,791 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: ;
+IN: dwarf
+
+CONSTANT: DW_TAG_array_type               HEX: 01
+CONSTANT: DW_TAG_class_type               HEX: 02
+CONSTANT: DW_TAG_entry_point              HEX: 03
+CONSTANT: DW_TAG_enumeration_type         HEX: 04
+CONSTANT: DW_TAG_formal_parameter         HEX: 05
+CONSTANT: DW_TAG_imported_declaration     HEX: 08
+CONSTANT: DW_TAG_label                    HEX: 0a
+CONSTANT: DW_TAG_lexical_block            HEX: 0b
+CONSTANT: DW_TAG_member                   HEX: 0d
+CONSTANT: DW_TAG_pointer_type             HEX: 0f
+CONSTANT: DW_TAG_reference_type           HEX: 10
+CONSTANT: DW_TAG_compile_unit             HEX: 11
+CONSTANT: DW_TAG_string_type              HEX: 12
+CONSTANT: DW_TAG_structure_type           HEX: 13
+CONSTANT: DW_TAG_subroutine_type          HEX: 15
+CONSTANT: DW_TAG_typedef                  HEX: 16
+CONSTANT: DW_TAG_union_type               HEX: 17
+CONSTANT: DW_TAG_unspecified_parameters   HEX: 18
+CONSTANT: DW_TAG_variant                  HEX: 19
+CONSTANT: DW_TAG_common_block             HEX: 1a
+CONSTANT: DW_TAG_common_inclusion         HEX: 1b
+CONSTANT: DW_TAG_inheritance              HEX: 1c
+CONSTANT: DW_TAG_inlined_subroutine       HEX: 1d
+CONSTANT: DW_TAG_module                   HEX: 1e
+CONSTANT: DW_TAG_ptr_to_member_type       HEX: 1f
+CONSTANT: DW_TAG_set_type                 HEX: 20
+CONSTANT: DW_TAG_subrange_type            HEX: 21
+CONSTANT: DW_TAG_with_stmt                HEX: 22
+CONSTANT: DW_TAG_access_declaration       HEX: 23
+CONSTANT: DW_TAG_base_type                HEX: 24
+CONSTANT: DW_TAG_catch_block              HEX: 25
+CONSTANT: DW_TAG_const_type               HEX: 26
+CONSTANT: DW_TAG_constant                 HEX: 27
+CONSTANT: DW_TAG_enumerator               HEX: 28
+CONSTANT: DW_TAG_file_type                HEX: 29
+CONSTANT: DW_TAG_friend                   HEX: 2a
+CONSTANT: DW_TAG_namelist                 HEX: 2b
+CONSTANT: DW_TAG_namelist_item            HEX: 2c
+CONSTANT: DW_TAG_packed_type              HEX: 2d
+CONSTANT: DW_TAG_subprogram               HEX: 2e
+CONSTANT: DW_TAG_template_type_parameter  HEX: 2f
+CONSTANT: DW_TAG_template_value_parameter HEX: 30
+CONSTANT: DW_TAG_thrown_type              HEX: 31
+CONSTANT: DW_TAG_try_block                HEX: 32
+CONSTANT: DW_TAG_variant_part             HEX: 33
+CONSTANT: DW_TAG_variable                 HEX: 34
+CONSTANT: DW_TAG_volatile_type            HEX: 35
+CONSTANT: DW_TAG_dwarf_procedure          HEX: 36
+CONSTANT: DW_TAG_restrict_type            HEX: 37
+CONSTANT: DW_TAG_interface_type           HEX: 38
+CONSTANT: DW_TAG_namespace                HEX: 39
+CONSTANT: DW_TAG_imported_module          HEX: 3a
+CONSTANT: DW_TAG_unspecified_type         HEX: 3b
+CONSTANT: DW_TAG_partial_unit             HEX: 3c
+CONSTANT: DW_TAG_imported_unit            HEX: 3d
+CONSTANT: DW_TAG_condition                HEX: 3f
+CONSTANT: DW_TAG_shared_type              HEX: 40
+CONSTANT: DW_TAG_type_unit                HEX: 41
+CONSTANT: DW_TAG_rvalue_reference_type    HEX: 42
+CONSTANT: DW_TAG_template_alias           HEX: 43
+
+CONSTANT: DW_TAG_lo_user                  HEX: 4080
+
+CONSTANT: DW_TAG_MIPS_loop                HEX: 4081
+CONSTANT: DW_TAG_HP_array_descriptor      HEX: 4090
+CONSTANT: DW_TAG_format_label             HEX: 4101
+CONSTANT: DW_TAG_function_template        HEX: 4102
+CONSTANT: DW_TAG_class_template           HEX: 4103
+CONSTANT: DW_TAG_GNU_BINCL                HEX: 4104
+CONSTANT: DW_TAG_GNU_EINCL                HEX: 4105
+CONSTANT: DW_TAG_GNU_template_template_parameter  HEX: 4106
+CONSTANT: DW_TAG_GNU_template_parameter_pack      HEX: 4107
+CONSTANT: DW_TAG_GNU_formal_parameter_pack        HEX: 4108
+CONSTANT: DW_TAG_ALTIUM_circ_type         HEX: 5101
+CONSTANT: DW_TAG_ALTIUM_mwa_circ_type     HEX: 5102
+CONSTANT: DW_TAG_ALTIUM_rev_carry_type    HEX: 5103
+CONSTANT: DW_TAG_ALTIUM_rom               HEX: 5111
+CONSTANT: DW_TAG_upc_shared_type          HEX: 8765
+CONSTANT: DW_TAG_upc_strict_type          HEX: 8766
+CONSTANT: DW_TAG_upc_relaxed_type         HEX: 8767
+CONSTANT: DW_TAG_PGI_kanji_type           HEX: a000
+CONSTANT: DW_TAG_PGI_interface_block      HEX: a020
+CONSTANT: DW_TAG_SUN_function_template    HEX: 4201
+CONSTANT: DW_TAG_SUN_class_template       HEX: 4202
+CONSTANT: DW_TAG_SUN_struct_template      HEX: 4203
+CONSTANT: DW_TAG_SUN_union_template       HEX: 4204
+CONSTANT: DW_TAG_SUN_indirect_inheritance HEX: 4205
+CONSTANT: DW_TAG_SUN_codeflags            HEX: 4206
+CONSTANT: DW_TAG_SUN_memop_info           HEX: 4207
+CONSTANT: DW_TAG_SUN_omp_child_func       HEX: 4208
+CONSTANT: DW_TAG_SUN_rtti_descriptor      HEX: 4209
+CONSTANT: DW_TAG_SUN_dtor_info            HEX: 420a
+CONSTANT: DW_TAG_SUN_dtor                 HEX: 420b
+CONSTANT: DW_TAG_SUN_f90_interface        HEX: 420c
+CONSTANT: DW_TAG_SUN_fortran_vax_structure HEX: 420d
+CONSTANT: DW_TAG_SUN_hi                   HEX: 42ff
+    
+CONSTANT: DW_TAG_hi_user                  HEX: ffff
+
+CONSTANT: DW_children_no  0
+CONSTANT: DW_children_yes 1
+
+CONSTANT: DW_FORM_addr                    HEX: 01
+CONSTANT: DW_FORM_block2                  HEX: 03
+CONSTANT: DW_FORM_block4                  HEX: 04
+CONSTANT: DW_FORM_data2                   HEX: 05
+CONSTANT: DW_FORM_data4                   HEX: 06
+CONSTANT: DW_FORM_data8                   HEX: 07
+CONSTANT: DW_FORM_string                  HEX: 08
+CONSTANT: DW_FORM_block                   HEX: 09
+CONSTANT: DW_FORM_block1                  HEX: 0a
+CONSTANT: DW_FORM_data1                   HEX: 0b
+CONSTANT: DW_FORM_flag                    HEX: 0c
+CONSTANT: DW_FORM_sdata                   HEX: 0d
+CONSTANT: DW_FORM_strp                    HEX: 0e
+CONSTANT: DW_FORM_udata                   HEX: 0f
+CONSTANT: DW_FORM_ref_addr                HEX: 10
+CONSTANT: DW_FORM_ref1                    HEX: 11
+CONSTANT: DW_FORM_ref2                    HEX: 12
+CONSTANT: DW_FORM_ref4                    HEX: 13
+CONSTANT: DW_FORM_ref8                    HEX: 14
+CONSTANT: DW_FORM_ref_udata               HEX: 15
+CONSTANT: DW_FORM_indirect                HEX: 16
+CONSTANT: DW_FORM_sec_offset              HEX: 17
+CONSTANT: DW_FORM_exprloc                 HEX: 18
+CONSTANT: DW_FORM_flag_present            HEX: 19
+CONSTANT: DW_FORM_ref_sig8                HEX: 20
+
+CONSTANT: DW_AT_sibling                           HEX: 01
+CONSTANT: DW_AT_location                          HEX: 02
+CONSTANT: DW_AT_name                              HEX: 03
+CONSTANT: DW_AT_ordering                          HEX: 09
+CONSTANT: DW_AT_subscr_data                       HEX: 0a
+CONSTANT: DW_AT_byte_size                         HEX: 0b
+CONSTANT: DW_AT_bit_offset                        HEX: 0c
+CONSTANT: DW_AT_bit_size                          HEX: 0d
+CONSTANT: DW_AT_element_list                      HEX: 0f
+CONSTANT: DW_AT_stmt_list                         HEX: 10
+CONSTANT: DW_AT_low_pc                            HEX: 11
+CONSTANT: DW_AT_high_pc                           HEX: 12
+CONSTANT: DW_AT_language                          HEX: 13
+CONSTANT: DW_AT_member                            HEX: 14
+CONSTANT: DW_AT_discr                             HEX: 15
+CONSTANT: DW_AT_discr_value                       HEX: 16
+CONSTANT: DW_AT_visibility                        HEX: 17
+CONSTANT: DW_AT_import                            HEX: 18
+CONSTANT: DW_AT_string_length                     HEX: 19
+CONSTANT: DW_AT_common_reference                  HEX: 1a
+CONSTANT: DW_AT_comp_dir                          HEX: 1b
+CONSTANT: DW_AT_const_value                       HEX: 1c
+CONSTANT: DW_AT_containing_type                   HEX: 1d
+CONSTANT: DW_AT_default_value                     HEX: 1e
+CONSTANT: DW_AT_inline                            HEX: 20
+CONSTANT: DW_AT_is_optional                       HEX: 21
+CONSTANT: DW_AT_lower_bound                       HEX: 22
+CONSTANT: DW_AT_producer                          HEX: 25
+CONSTANT: DW_AT_prototyped                        HEX: 27
+CONSTANT: DW_AT_return_addr                       HEX: 2a
+CONSTANT: DW_AT_start_scope                       HEX: 2c
+CONSTANT: DW_AT_bit_stride                        HEX: 2e
+CONSTANT: DW_AT_upper_bound                       HEX: 2f
+CONSTANT: DW_AT_abstract_origin                   HEX: 31
+CONSTANT: DW_AT_accessibility                     HEX: 32
+CONSTANT: DW_AT_address_class                     HEX: 33
+CONSTANT: DW_AT_artificial                        HEX: 34
+CONSTANT: DW_AT_base_types                        HEX: 35
+CONSTANT: DW_AT_calling_convention                HEX: 36
+CONSTANT: DW_AT_count                             HEX: 37
+CONSTANT: DW_AT_data_member_location              HEX: 38
+CONSTANT: DW_AT_decl_column                       HEX: 39
+CONSTANT: DW_AT_decl_file                         HEX: 3a
+CONSTANT: DW_AT_decl_line                         HEX: 3b
+CONSTANT: DW_AT_declaration                       HEX: 3c
+CONSTANT: DW_AT_discr_list                        HEX: 3d
+CONSTANT: DW_AT_encoding                          HEX: 3e
+CONSTANT: DW_AT_external                          HEX: 3f
+CONSTANT: DW_AT_frame_base                        HEX: 40
+CONSTANT: DW_AT_friend                            HEX: 41
+CONSTANT: DW_AT_identifier_case                   HEX: 42
+CONSTANT: DW_AT_macro_info                        HEX: 43
+CONSTANT: DW_AT_namelist_item                     HEX: 44
+CONSTANT: DW_AT_priority                          HEX: 45
+CONSTANT: DW_AT_segment                           HEX: 46
+CONSTANT: DW_AT_specification                     HEX: 47
+CONSTANT: DW_AT_static_link                       HEX: 48
+CONSTANT: DW_AT_type                              HEX: 49
+CONSTANT: DW_AT_use_location                      HEX: 4a
+CONSTANT: DW_AT_variable_parameter                HEX: 4b
+CONSTANT: DW_AT_virtuality                        HEX: 4c
+CONSTANT: DW_AT_vtable_elem_location              HEX: 4d
+CONSTANT: DW_AT_allocated                         HEX: 4e
+CONSTANT: DW_AT_associated                        HEX: 4f
+CONSTANT: DW_AT_data_location                     HEX: 50
+CONSTANT: DW_AT_byte_stride                       HEX: 51
+CONSTANT: DW_AT_entry_pc                          HEX: 52
+CONSTANT: DW_AT_use_UTF8                          HEX: 53
+CONSTANT: DW_AT_extension                         HEX: 54
+CONSTANT: DW_AT_ranges                            HEX: 55
+CONSTANT: DW_AT_trampoline                        HEX: 56
+CONSTANT: DW_AT_call_column                       HEX: 57
+CONSTANT: DW_AT_call_file                         HEX: 58
+CONSTANT: DW_AT_call_line                         HEX: 59
+CONSTANT: DW_AT_description                       HEX: 5a
+CONSTANT: DW_AT_binary_scale                      HEX: 5b
+CONSTANT: DW_AT_decimal_scale                     HEX: 5c
+CONSTANT: DW_AT_small                             HEX: 5d
+CONSTANT: DW_AT_decimal_sign                      HEX: 5e
+CONSTANT: DW_AT_digit_count                       HEX: 5f
+CONSTANT: DW_AT_picture_string                    HEX: 60
+CONSTANT: DW_AT_mutable                           HEX: 61
+CONSTANT: DW_AT_threads_scaled                    HEX: 62
+CONSTANT: DW_AT_explicit                          HEX: 63
+CONSTANT: DW_AT_object_pointer                    HEX: 64
+CONSTANT: DW_AT_endianity                         HEX: 65
+CONSTANT: DW_AT_elemental                         HEX: 66
+CONSTANT: DW_AT_pure                              HEX: 67
+CONSTANT: DW_AT_recursive                         HEX: 68
+CONSTANT: DW_AT_signature                         HEX: 69
+CONSTANT: DW_AT_main_subprogram                   HEX: 6a
+CONSTANT: DW_AT_data_bit_offset                   HEX: 6b
+CONSTANT: DW_AT_const_expr                        HEX: 6c
+CONSTANT: DW_AT_enum_class                        HEX: 6d
+CONSTANT: DW_AT_linkage_name                      HEX: 6e
+
+CONSTANT: DW_AT_HP_block_index                    HEX: 2000
+
+CONSTANT: DW_AT_lo_user                           HEX: 2000
+
+CONSTANT: DW_AT_MIPS_fde                          HEX: 2001
+CONSTANT: DW_AT_MIPS_loop_begin                   HEX: 2002
+CONSTANT: DW_AT_MIPS_tail_loop_begin              HEX: 2003
+CONSTANT: DW_AT_MIPS_epilog_begin                 HEX: 2004
+CONSTANT: DW_AT_MIPS_loop_unroll_factor           HEX: 2005
+CONSTANT: DW_AT_MIPS_software_pipeline_depth      HEX: 2006
+CONSTANT: DW_AT_MIPS_linkage_name                 HEX: 2007
+CONSTANT: DW_AT_MIPS_stride                       HEX: 2008
+CONSTANT: DW_AT_MIPS_abstract_name                HEX: 2009
+CONSTANT: DW_AT_MIPS_clone_origin                 HEX: 200a
+CONSTANT: DW_AT_MIPS_has_inlines                  HEX: 200b
+CONSTANT: DW_AT_MIPS_stride_byte                  HEX: 200c
+CONSTANT: DW_AT_MIPS_stride_elem                  HEX: 200d
+CONSTANT: DW_AT_MIPS_ptr_dopetype                 HEX: 200e
+CONSTANT: DW_AT_MIPS_allocatable_dopetype         HEX: 200f
+CONSTANT: DW_AT_MIPS_assumed_shape_dopetype       HEX: 2010
+CONSTANT: DW_AT_MIPS_assumed_size                 HEX: 2011
+
+CONSTANT: DW_AT_HP_unmodifiable                   HEX: 2001
+CONSTANT: DW_AT_HP_actuals_stmt_list              HEX: 2010
+CONSTANT: DW_AT_HP_proc_per_section               HEX: 2011
+CONSTANT: DW_AT_HP_raw_data_ptr                   HEX: 2012
+CONSTANT: DW_AT_HP_pass_by_reference              HEX: 2013
+CONSTANT: DW_AT_HP_opt_level                      HEX: 2014
+CONSTANT: DW_AT_HP_prof_version_id                HEX: 2015
+CONSTANT: DW_AT_HP_opt_flags                      HEX: 2016
+CONSTANT: DW_AT_HP_cold_region_low_pc             HEX: 2017
+CONSTANT: DW_AT_HP_cold_region_high_pc            HEX: 2018
+CONSTANT: DW_AT_HP_all_variables_modifiable       HEX: 2019
+CONSTANT: DW_AT_HP_linkage_name                   HEX: 201a
+CONSTANT: DW_AT_HP_prof_flags                     HEX: 201b
+
+CONSTANT: DW_AT_CPQ_discontig_ranges              HEX: 2001
+CONSTANT: DW_AT_CPQ_semantic_events               HEX: 2002
+CONSTANT: DW_AT_CPQ_split_lifetimes_var           HEX: 2003
+CONSTANT: DW_AT_CPQ_split_lifetimes_rtn           HEX: 2004
+CONSTANT: DW_AT_CPQ_prologue_length               HEX: 2005
+
+CONSTANT: DW_AT_INTEL_other_endian                HEX: 2026
+
+CONSTANT: DW_AT_sf_names                          HEX: 2101
+CONSTANT: DW_AT_src_info                          HEX: 2102
+CONSTANT: DW_AT_mac_info                          HEX: 2103
+CONSTANT: DW_AT_src_coords                        HEX: 2104
+CONSTANT: DW_AT_body_begin                        HEX: 2105
+CONSTANT: DW_AT_body_end                          HEX: 2106
+CONSTANT: DW_AT_GNU_vector                        HEX: 2107
+CONSTANT: DW_AT_GNU_template_name                 HEX: 2108
+
+CONSTANT: DW_AT_ALTIUM_loclist    HEX: 2300         
+
+CONSTANT: DW_AT_SUN_template                      HEX: 2201
+CONSTANT: DW_AT_VMS_rtnbeg_pd_address             HEX: 2201
+CONSTANT: DW_AT_SUN_alignment                     HEX: 2202
+CONSTANT: DW_AT_SUN_vtable                        HEX: 2203
+CONSTANT: DW_AT_SUN_count_guarantee               HEX: 2204
+CONSTANT: DW_AT_SUN_command_line                  HEX: 2205
+CONSTANT: DW_AT_SUN_vbase                         HEX: 2206
+CONSTANT: DW_AT_SUN_compile_options               HEX: 2207
+CONSTANT: DW_AT_SUN_language                      HEX: 2208
+CONSTANT: DW_AT_SUN_browser_file                  HEX: 2209
+CONSTANT: DW_AT_SUN_vtable_abi                    HEX: 2210
+CONSTANT: DW_AT_SUN_func_offsets                  HEX: 2211
+CONSTANT: DW_AT_SUN_cf_kind                       HEX: 2212
+CONSTANT: DW_AT_SUN_vtable_index                  HEX: 2213
+CONSTANT: DW_AT_SUN_omp_tpriv_addr                HEX: 2214
+CONSTANT: DW_AT_SUN_omp_child_func                HEX: 2215
+CONSTANT: DW_AT_SUN_func_offset                   HEX: 2216
+CONSTANT: DW_AT_SUN_memop_type_ref                HEX: 2217
+CONSTANT: DW_AT_SUN_profile_id                    HEX: 2218
+CONSTANT: DW_AT_SUN_memop_signature               HEX: 2219
+CONSTANT: DW_AT_SUN_obj_dir                       HEX: 2220
+CONSTANT: DW_AT_SUN_obj_file                      HEX: 2221
+CONSTANT: DW_AT_SUN_original_name                 HEX: 2222
+CONSTANT: DW_AT_SUN_hwcprof_signature             HEX: 2223
+CONSTANT: DW_AT_SUN_amd64_parmdump                HEX: 2224
+CONSTANT: DW_AT_SUN_part_link_name                HEX: 2225
+CONSTANT: DW_AT_SUN_link_name                     HEX: 2226
+CONSTANT: DW_AT_SUN_pass_with_const               HEX: 2227
+CONSTANT: DW_AT_SUN_return_with_const             HEX: 2228
+CONSTANT: DW_AT_SUN_import_by_name                HEX: 2229
+CONSTANT: DW_AT_SUN_f90_pointer                   HEX: 222a
+CONSTANT: DW_AT_SUN_pass_by_ref                   HEX: 222b
+CONSTANT: DW_AT_SUN_f90_allocatable               HEX: 222c
+CONSTANT: DW_AT_SUN_f90_assumed_shape_array       HEX: 222d
+CONSTANT: DW_AT_SUN_c_vla                         HEX: 222e
+CONSTANT: DW_AT_SUN_return_value_ptr              HEX: 2230
+CONSTANT: DW_AT_SUN_dtor_start                    HEX: 2231
+CONSTANT: DW_AT_SUN_dtor_length                   HEX: 2232
+CONSTANT: DW_AT_SUN_dtor_state_initial            HEX: 2233
+CONSTANT: DW_AT_SUN_dtor_state_final              HEX: 2234
+CONSTANT: DW_AT_SUN_dtor_state_deltas             HEX: 2235
+CONSTANT: DW_AT_SUN_import_by_lname               HEX: 2236
+CONSTANT: DW_AT_SUN_f90_use_only                  HEX: 2237
+CONSTANT: DW_AT_SUN_namelist_spec                 HEX: 2238
+CONSTANT: DW_AT_SUN_is_omp_child_func             HEX: 2239
+CONSTANT: DW_AT_SUN_fortran_main_alias            HEX: 223a
+CONSTANT: DW_AT_SUN_fortran_based                 HEX: 223b
+
+CONSTANT: DW_AT_upc_threads_scaled                HEX: 3210
+
+CONSTANT: DW_AT_PGI_lbase                         HEX: 3a00
+CONSTANT: DW_AT_PGI_soffset                       HEX: 3a01 
+CONSTANT: DW_AT_PGI_lstride                       HEX: 3a02 
+
+CONSTANT: DW_AT_APPLE_closure                     HEX: 3fe4
+CONSTANT: DW_AT_APPLE_major_runtime_vers          HEX: 3fe5
+CONSTANT: DW_AT_APPLE_runtime_class               HEX: 3fe6
+
+CONSTANT: DW_AT_hi_user                           HEX: 3fff
+
+CONSTANT: DW_OP_addr                      HEX: 03
+CONSTANT: DW_OP_deref                     HEX: 06
+CONSTANT: DW_OP_const1u                   HEX: 08
+CONSTANT: DW_OP_const1s                   HEX: 09
+CONSTANT: DW_OP_const2u                   HEX: 0a
+CONSTANT: DW_OP_const2s                   HEX: 0b
+CONSTANT: DW_OP_const4u                   HEX: 0c
+CONSTANT: DW_OP_const4s                   HEX: 0d
+CONSTANT: DW_OP_const8u                   HEX: 0e
+CONSTANT: DW_OP_const8s                   HEX: 0f
+CONSTANT: DW_OP_constu                    HEX: 10
+CONSTANT: DW_OP_consts                    HEX: 11
+CONSTANT: DW_OP_dup                       HEX: 12
+CONSTANT: DW_OP_drop                      HEX: 13
+CONSTANT: DW_OP_over                      HEX: 14
+CONSTANT: DW_OP_pick                      HEX: 15
+CONSTANT: DW_OP_swap                      HEX: 16
+CONSTANT: DW_OP_rot                       HEX: 17
+CONSTANT: DW_OP_xderef                    HEX: 18
+CONSTANT: DW_OP_abs                       HEX: 19
+CONSTANT: DW_OP_and                       HEX: 1a
+CONSTANT: DW_OP_div                       HEX: 1b
+CONSTANT: DW_OP_minus                     HEX: 1c
+CONSTANT: DW_OP_mod                       HEX: 1d
+CONSTANT: DW_OP_mul                       HEX: 1e
+CONSTANT: DW_OP_neg                       HEX: 1f
+CONSTANT: DW_OP_not                       HEX: 20
+CONSTANT: DW_OP_or                        HEX: 21
+CONSTANT: DW_OP_plus                      HEX: 22
+CONSTANT: DW_OP_plus_uconst               HEX: 23
+CONSTANT: DW_OP_shl                       HEX: 24
+CONSTANT: DW_OP_shr                       HEX: 25
+CONSTANT: DW_OP_shra                      HEX: 26
+CONSTANT: DW_OP_xor                       HEX: 27
+CONSTANT: DW_OP_bra                       HEX: 28
+CONSTANT: DW_OP_eq                        HEX: 29
+CONSTANT: DW_OP_ge                        HEX: 2a
+CONSTANT: DW_OP_gt                        HEX: 2b
+CONSTANT: DW_OP_le                        HEX: 2c
+CONSTANT: DW_OP_lt                        HEX: 2d
+CONSTANT: DW_OP_ne                        HEX: 2e
+CONSTANT: DW_OP_skip                      HEX: 2f
+CONSTANT: DW_OP_lit0                      HEX: 30
+CONSTANT: DW_OP_lit1                      HEX: 31
+CONSTANT: DW_OP_lit2                      HEX: 32
+CONSTANT: DW_OP_lit3                      HEX: 33
+CONSTANT: DW_OP_lit4                      HEX: 34
+CONSTANT: DW_OP_lit5                      HEX: 35
+CONSTANT: DW_OP_lit6                      HEX: 36
+CONSTANT: DW_OP_lit7                      HEX: 37
+CONSTANT: DW_OP_lit8                      HEX: 38
+CONSTANT: DW_OP_lit9                      HEX: 39
+CONSTANT: DW_OP_lit10                     HEX: 3a
+CONSTANT: DW_OP_lit11                     HEX: 3b
+CONSTANT: DW_OP_lit12                     HEX: 3c
+CONSTANT: DW_OP_lit13                     HEX: 3d
+CONSTANT: DW_OP_lit14                     HEX: 3e
+CONSTANT: DW_OP_lit15                     HEX: 3f
+CONSTANT: DW_OP_lit16                     HEX: 40
+CONSTANT: DW_OP_lit17                     HEX: 41
+CONSTANT: DW_OP_lit18                     HEX: 42
+CONSTANT: DW_OP_lit19                     HEX: 43
+CONSTANT: DW_OP_lit20                     HEX: 44
+CONSTANT: DW_OP_lit21                     HEX: 45
+CONSTANT: DW_OP_lit22                     HEX: 46
+CONSTANT: DW_OP_lit23                     HEX: 47
+CONSTANT: DW_OP_lit24                     HEX: 48
+CONSTANT: DW_OP_lit25                     HEX: 49
+CONSTANT: DW_OP_lit26                     HEX: 4a
+CONSTANT: DW_OP_lit27                     HEX: 4b
+CONSTANT: DW_OP_lit28                     HEX: 4c
+CONSTANT: DW_OP_lit29                     HEX: 4d
+CONSTANT: DW_OP_lit30                     HEX: 4e
+CONSTANT: DW_OP_lit31                     HEX: 4f
+CONSTANT: DW_OP_reg0                      HEX: 50
+CONSTANT: DW_OP_reg1                      HEX: 51
+CONSTANT: DW_OP_reg2                      HEX: 52
+CONSTANT: DW_OP_reg3                      HEX: 53
+CONSTANT: DW_OP_reg4                      HEX: 54
+CONSTANT: DW_OP_reg5                      HEX: 55
+CONSTANT: DW_OP_reg6                      HEX: 56
+CONSTANT: DW_OP_reg7                      HEX: 57
+CONSTANT: DW_OP_reg8                      HEX: 58
+CONSTANT: DW_OP_reg9                      HEX: 59
+CONSTANT: DW_OP_reg10                     HEX: 5a
+CONSTANT: DW_OP_reg11                     HEX: 5b
+CONSTANT: DW_OP_reg12                     HEX: 5c
+CONSTANT: DW_OP_reg13                     HEX: 5d
+CONSTANT: DW_OP_reg14                     HEX: 5e
+CONSTANT: DW_OP_reg15                     HEX: 5f
+CONSTANT: DW_OP_reg16                     HEX: 60
+CONSTANT: DW_OP_reg17                     HEX: 61
+CONSTANT: DW_OP_reg18                     HEX: 62
+CONSTANT: DW_OP_reg19                     HEX: 63
+CONSTANT: DW_OP_reg20                     HEX: 64
+CONSTANT: DW_OP_reg21                     HEX: 65
+CONSTANT: DW_OP_reg22                     HEX: 66
+CONSTANT: DW_OP_reg23                     HEX: 67
+CONSTANT: DW_OP_reg24                     HEX: 68
+CONSTANT: DW_OP_reg25                     HEX: 69
+CONSTANT: DW_OP_reg26                     HEX: 6a
+CONSTANT: DW_OP_reg27                     HEX: 6b
+CONSTANT: DW_OP_reg28                     HEX: 6c
+CONSTANT: DW_OP_reg29                     HEX: 6d
+CONSTANT: DW_OP_reg30                     HEX: 6e
+CONSTANT: DW_OP_reg31                     HEX: 6f
+CONSTANT: DW_OP_breg0                     HEX: 70
+CONSTANT: DW_OP_breg1                     HEX: 71
+CONSTANT: DW_OP_breg2                     HEX: 72
+CONSTANT: DW_OP_breg3                     HEX: 73
+CONSTANT: DW_OP_breg4                     HEX: 74
+CONSTANT: DW_OP_breg5                     HEX: 75
+CONSTANT: DW_OP_breg6                     HEX: 76
+CONSTANT: DW_OP_breg7                     HEX: 77
+CONSTANT: DW_OP_breg8                     HEX: 78
+CONSTANT: DW_OP_breg9                     HEX: 79
+CONSTANT: DW_OP_breg10                    HEX: 7a
+CONSTANT: DW_OP_breg11                    HEX: 7b
+CONSTANT: DW_OP_breg12                    HEX: 7c
+CONSTANT: DW_OP_breg13                    HEX: 7d
+CONSTANT: DW_OP_breg14                    HEX: 7e
+CONSTANT: DW_OP_breg15                    HEX: 7f
+CONSTANT: DW_OP_breg16                    HEX: 80
+CONSTANT: DW_OP_breg17                    HEX: 81
+CONSTANT: DW_OP_breg18                    HEX: 82
+CONSTANT: DW_OP_breg19                    HEX: 83
+CONSTANT: DW_OP_breg20                    HEX: 84
+CONSTANT: DW_OP_breg21                    HEX: 85
+CONSTANT: DW_OP_breg22                    HEX: 86
+CONSTANT: DW_OP_breg23                    HEX: 87
+CONSTANT: DW_OP_breg24                    HEX: 88
+CONSTANT: DW_OP_breg25                    HEX: 89
+CONSTANT: DW_OP_breg26                    HEX: 8a
+CONSTANT: DW_OP_breg27                    HEX: 8b
+CONSTANT: DW_OP_breg28                    HEX: 8c
+CONSTANT: DW_OP_breg29                    HEX: 8d
+CONSTANT: DW_OP_breg30                    HEX: 8e
+CONSTANT: DW_OP_breg31                    HEX: 8f
+CONSTANT: DW_OP_regx                      HEX: 90
+CONSTANT: DW_OP_fbreg                     HEX: 91
+CONSTANT: DW_OP_bregx                     HEX: 92
+CONSTANT: DW_OP_piece                     HEX: 93
+CONSTANT: DW_OP_deref_size                HEX: 94
+CONSTANT: DW_OP_xderef_size               HEX: 95
+CONSTANT: DW_OP_nop                       HEX: 96
+CONSTANT: DW_OP_push_object_address       HEX: 97
+CONSTANT: DW_OP_call2                     HEX: 98
+CONSTANT: DW_OP_call4                     HEX: 99
+CONSTANT: DW_OP_call_ref                  HEX: 9a
+CONSTANT: DW_OP_form_tls_address          HEX: 9b
+CONSTANT: DW_OP_call_frame_cfa            HEX: 9c
+CONSTANT: DW_OP_bit_piece                 HEX: 9d
+CONSTANT: DW_OP_implicit_value            HEX: 9e
+CONSTANT: DW_OP_stack_value               HEX: 9f
+
+
+CONSTANT: DW_OP_lo_user                   HEX: e0
+CONSTANT: DW_OP_GNU_push_tls_address      HEX: e0
+CONSTANT: DW_OP_HP_unknown                HEX: e0
+CONSTANT: DW_OP_HP_is_value               HEX: e1
+CONSTANT: DW_OP_HP_fltconst4              HEX: e2
+CONSTANT: DW_OP_HP_fltconst8              HEX: e3
+CONSTANT: DW_OP_HP_mod_range              HEX: e4
+CONSTANT: DW_OP_HP_unmod_range            HEX: e5
+CONSTANT: DW_OP_HP_tls                    HEX: e6
+CONSTANT: DW_OP_INTEL_bit_piece           HEX: e8
+CONSTANT: DW_OP_APPLE_uninit              HEX: f0
+CONSTANT: DW_OP_hi_user                   HEX: ff
+
+CONSTANT: DW_ATE_address                  HEX: 1
+CONSTANT: DW_ATE_boolean                  HEX: 2
+CONSTANT: DW_ATE_complex_float            HEX: 3
+CONSTANT: DW_ATE_float                    HEX: 4
+CONSTANT: DW_ATE_signed                   HEX: 5
+CONSTANT: DW_ATE_signed_char              HEX: 6
+CONSTANT: DW_ATE_unsigned                 HEX: 7
+CONSTANT: DW_ATE_unsigned_char            HEX: 8
+CONSTANT: DW_ATE_imaginary_float          HEX: 9
+CONSTANT: DW_ATE_packed_decimal           HEX: a
+CONSTANT: DW_ATE_numeric_string           HEX: b
+CONSTANT: DW_ATE_edited                   HEX: c
+CONSTANT: DW_ATE_signed_fixed             HEX: d
+CONSTANT: DW_ATE_unsigned_fixed           HEX: e
+CONSTANT: DW_ATE_decimal_float            HEX: f
+
+CONSTANT: DW_ATE_lo_user                HEX: 80
+CONSTANT: DW_ATE_ALTIUM_fract           HEX: 80
+CONSTANT: DW_ATE_ALTIUM_accum           HEX: 81
+CONSTANT: DW_ATE_HP_float80             HEX: 80
+CONSTANT: DW_ATE_HP_complex_float80     HEX: 81
+CONSTANT: DW_ATE_HP_float128            HEX: 82
+CONSTANT: DW_ATE_HP_complex_float128    HEX: 83
+CONSTANT: DW_ATE_HP_floathpintel        HEX: 84
+CONSTANT: DW_ATE_HP_imaginary_float80   HEX: 85
+CONSTANT: DW_ATE_HP_imaginary_float128  HEX: 86
+CONSTANT: DW_ATE_SUN_interval_float     HEX: 91
+CONSTANT: DW_ATE_SUN_imaginary_float    HEX: 92
+CONSTANT: DW_ATE_hi_user                HEX: ff
+
+CONSTANT: DW_DS_unsigned                  HEX: 01
+CONSTANT: DW_DS_leading_overpunch         HEX: 02
+CONSTANT: DW_DS_trailing_overpunch        HEX: 03
+CONSTANT: DW_DS_leading_separate          HEX: 04
+CONSTANT: DW_DS_trailing_separate         HEX: 05
+
+CONSTANT: DW_END_default                  HEX: 00
+CONSTANT: DW_END_big                      HEX: 01
+CONSTANT: DW_END_little                   HEX: 02
+CONSTANT: DW_END_lo_user                  HEX: 40
+CONSTANT: DW_END_hi_user                  HEX: ff
+
+CONSTANT: DW_ATCF_lo_user                 HEX: 40
+CONSTANT: DW_ATCF_SUN_mop_bitfield        HEX: 41
+CONSTANT: DW_ATCF_SUN_mop_spill           HEX: 42
+CONSTANT: DW_ATCF_SUN_mop_scopy           HEX: 43
+CONSTANT: DW_ATCF_SUN_func_start          HEX: 44
+CONSTANT: DW_ATCF_SUN_end_ctors           HEX: 45
+CONSTANT: DW_ATCF_SUN_branch_target       HEX: 46
+CONSTANT: DW_ATCF_SUN_mop_stack_probe     HEX: 47
+CONSTANT: DW_ATCF_SUN_func_epilog         HEX: 48
+CONSTANT: DW_ATCF_hi_user                 HEX: ff
+
+CONSTANT: DW_ACCESS_public                HEX: 01
+CONSTANT: DW_ACCESS_protected             HEX: 02
+CONSTANT: DW_ACCESS_private               HEX: 03
+
+CONSTANT: DW_VIS_local                    HEX: 01
+CONSTANT: DW_VIS_exported                 HEX: 02
+CONSTANT: DW_VIS_qualified                HEX: 03
+
+CONSTANT: DW_VIRTUALITY_none              HEX: 00
+CONSTANT: DW_VIRTUALITY_virtual           HEX: 01
+CONSTANT: DW_VIRTUALITY_pure_virtual      HEX: 02
+
+CONSTANT: DW_LANG_C89                     HEX: 0001
+CONSTANT: DW_LANG_C                       HEX: 0002
+CONSTANT: DW_LANG_Ada83                   HEX: 0003
+CONSTANT: DW_LANG_C_plus_plus             HEX: 0004
+CONSTANT: DW_LANG_Cobol74                 HEX: 0005
+CONSTANT: DW_LANG_Cobol85                 HEX: 0006
+CONSTANT: DW_LANG_Fortran77               HEX: 0007
+CONSTANT: DW_LANG_Fortran90               HEX: 0008
+CONSTANT: DW_LANG_Pascal83                HEX: 0009
+CONSTANT: DW_LANG_Modula2                 HEX: 000a
+CONSTANT: DW_LANG_Java                    HEX: 000b
+CONSTANT: DW_LANG_C99                     HEX: 000c
+CONSTANT: DW_LANG_Ada95                   HEX: 000d
+CONSTANT: DW_LANG_Fortran95               HEX: 000e
+CONSTANT: DW_LANG_PLI                     HEX: 000f
+CONSTANT: DW_LANG_ObjC                    HEX: 0010
+CONSTANT: DW_LANG_ObjC_plus_plus          HEX: 0011
+CONSTANT: DW_LANG_UPC                     HEX: 0012
+CONSTANT: DW_LANG_D                       HEX: 0013
+CONSTANT: DW_LANG_Python                  HEX: 0014
+CONSTANT: DW_LANG_lo_user                 HEX: 8000
+CONSTANT: DW_LANG_Mips_Assembler          HEX: 8001
+CONSTANT: DW_LANG_Upc                     HEX: 8765
+CONSTANT: DW_LANG_ALTIUM_Assembler        HEX: 9101 
+CONSTANT: DW_LANG_SUN_Assembler           HEX: 9001
+CONSTANT: DW_LANG_hi_user                 HEX: ffff
+
+CONSTANT: DW_ID_case_sensitive            HEX: 00
+CONSTANT: DW_ID_up_case                   HEX: 01
+CONSTANT: DW_ID_down_case                 HEX: 02
+CONSTANT: DW_ID_case_insensitive          HEX: 03
+
+CONSTANT: DW_CC_normal                    HEX: 01
+CONSTANT: DW_CC_program                   HEX: 02
+CONSTANT: DW_CC_nocall                    HEX: 03
+
+CONSTANT: DW_CC_lo_user                   HEX: 40
+CONSTANT: DW_CC_ALTIUM_interrupt          HEX: 65 
+CONSTANT: DW_CC_ALTIUM_near_system_stack  HEX: 66 
+CONSTANT: DW_CC_ALTIUM_near_user_stack    HEX: 67 
+CONSTANT: DW_CC_ALTIUM_huge_user_stack    HEX: 68 
+CONSTANT: DW_CC_hi_user                   HEX: ff
+
+CONSTANT: DW_INL_not_inlined              HEX: 00
+CONSTANT: DW_INL_inlined                  HEX: 01
+CONSTANT: DW_INL_declared_not_inlined     HEX: 02
+CONSTANT: DW_INL_declared_inlined         HEX: 03
+
+CONSTANT: DW_ORD_row_major                HEX: 00
+CONSTANT: DW_ORD_col_major                HEX: 01
+
+CONSTANT: DW_DSC_label                    HEX: 00
+CONSTANT: DW_DSC_range                    HEX: 01
+
+CONSTANT: DW_LNS_copy                     HEX: 01
+CONSTANT: DW_LNS_advance_pc               HEX: 02
+CONSTANT: DW_LNS_advance_line             HEX: 03
+CONSTANT: DW_LNS_set_file                 HEX: 04
+CONSTANT: DW_LNS_set_column               HEX: 05
+CONSTANT: DW_LNS_negate_stmt              HEX: 06
+CONSTANT: DW_LNS_set_basic_block          HEX: 07
+CONSTANT: DW_LNS_const_add_pc             HEX: 08
+CONSTANT: DW_LNS_fixed_advance_pc         HEX: 09
+CONSTANT: DW_LNS_set_prologue_end         HEX: 0a
+CONSTANT: DW_LNS_set_epilogue_begin       HEX: 0b
+CONSTANT: DW_LNS_set_isa                  HEX: 0c
+
+CONSTANT: DW_LNE_end_sequence             HEX: 01
+CONSTANT: DW_LNE_set_address              HEX: 02
+CONSTANT: DW_LNE_define_file              HEX: 03
+CONSTANT: DW_LNE_set_discriminator        HEX: 04 
+
+CONSTANT: DW_LNE_HP_negate_is_UV_update       HEX: 11
+CONSTANT: DW_LNE_HP_push_context              HEX: 12
+CONSTANT: DW_LNE_HP_pop_context               HEX: 13
+CONSTANT: DW_LNE_HP_set_file_line_column      HEX: 14
+CONSTANT: DW_LNE_HP_set_routine_name          HEX: 15
+CONSTANT: DW_LNE_HP_set_sequence              HEX: 16
+CONSTANT: DW_LNE_HP_negate_post_semantics     HEX: 17
+CONSTANT: DW_LNE_HP_negate_function_exit      HEX: 18
+CONSTANT: DW_LNE_HP_negate_front_end_logical  HEX: 19
+CONSTANT: DW_LNE_HP_define_proc               HEX: 20
+
+CONSTANT: DW_LNE_lo_user                  HEX: 80
+CONSTANT: DW_LNE_hi_user                  HEX: ff
+
+CONSTANT: DW_MACINFO_define               HEX: 01
+CONSTANT: DW_MACINFO_undef                HEX: 02
+CONSTANT: DW_MACINFO_start_file           HEX: 03
+CONSTANT: DW_MACINFO_end_file             HEX: 04
+CONSTANT: DW_MACINFO_vendor_ext           HEX: ff
+
+CONSTANT: DW_CFA_advance_loc        HEX: 40
+CONSTANT: DW_CFA_offset             HEX: 80
+CONSTANT: DW_CFA_restore            HEX: c0
+CONSTANT: DW_CFA_extended           HEX: 00
+
+CONSTANT: DW_CFA_nop              HEX: 00
+CONSTANT: DW_CFA_set_loc          HEX: 01
+CONSTANT: DW_CFA_advance_loc1     HEX: 02
+CONSTANT: DW_CFA_advance_loc2     HEX: 03
+CONSTANT: DW_CFA_advance_loc4     HEX: 04
+CONSTANT: DW_CFA_offset_extended  HEX: 05
+CONSTANT: DW_CFA_restore_extended HEX: 06
+CONSTANT: DW_CFA_undefined        HEX: 07
+CONSTANT: DW_CFA_same_value       HEX: 08
+CONSTANT: DW_CFA_register         HEX: 09
+CONSTANT: DW_CFA_remember_state   HEX: 0a
+CONSTANT: DW_CFA_restore_state    HEX: 0b
+CONSTANT: DW_CFA_def_cfa          HEX: 0c
+CONSTANT: DW_CFA_def_cfa_register HEX: 0d
+CONSTANT: DW_CFA_def_cfa_offset   HEX: 0e
+CONSTANT: DW_CFA_def_cfa_expression HEX: 0f
+CONSTANT: DW_CFA_expression       HEX: 10
+CONSTANT: DW_CFA_offset_extended_sf HEX: 11
+CONSTANT: DW_CFA_def_cfa_sf       HEX: 12
+CONSTANT: DW_CFA_def_cfa_offset_sf HEX: 13
+CONSTANT: DW_CFA_val_offset        HEX: 14
+CONSTANT: DW_CFA_val_offset_sf     HEX: 15
+CONSTANT: DW_CFA_val_expression    HEX: 16
+
+CONSTANT: DW_CFA_lo_user           HEX: 1c
+CONSTANT: DW_CFA_MIPS_advance_loc8 HEX: 1d
+CONSTANT: DW_CFA_GNU_window_save   HEX: 2d
+CONSTANT: DW_CFA_GNU_args_size     HEX: 2e
+CONSTANT: DW_CFA_GNU_negative_offset_extended  HEX: 2f
+CONSTANT: DW_CFA_high_user         HEX: 3f
+
+CONSTANT: DW_EH_PE_absptr   HEX: 00
+CONSTANT: DW_EH_PE_uleb128  HEX: 01
+CONSTANT: DW_EH_PE_udata2   HEX: 02
+CONSTANT: DW_EH_PE_udata4   HEX: 03
+CONSTANT: DW_EH_PE_udata8   HEX: 04
+CONSTANT: DW_EH_PE_sleb128  HEX: 09
+CONSTANT: DW_EH_PE_sdata2   HEX: 0A
+CONSTANT: DW_EH_PE_sdata4   HEX: 0B
+CONSTANT: DW_EH_PE_sdata8   HEX: 0C
+CONSTANT: DW_EH_PE_pcrel    HEX: 10
+CONSTANT: DW_EH_PE_textrel  HEX: 20
+CONSTANT: DW_EH_PE_datarel  HEX: 30
+CONSTANT: DW_EH_PE_funcrel  HEX: 40
+CONSTANT: DW_EH_PE_aligned  HEX: 50
+CONSTANT: DW_EH_PE_omit     HEX: ff
+
+CONSTANT: DW_FRAME_CFA_COL 0  
+
+CONSTANT: DW_FRAME_REG1   1
+CONSTANT: DW_FRAME_REG2   2
+CONSTANT: DW_FRAME_REG3   3
+CONSTANT: DW_FRAME_REG4   4
+CONSTANT: DW_FRAME_REG5   5
+CONSTANT: DW_FRAME_REG6   6
+CONSTANT: DW_FRAME_REG7   7
+CONSTANT: DW_FRAME_REG8   8
+CONSTANT: DW_FRAME_REG9   9
+CONSTANT: DW_FRAME_REG10  10
+CONSTANT: DW_FRAME_REG11  11
+CONSTANT: DW_FRAME_REG12  12
+CONSTANT: DW_FRAME_REG13  13
+CONSTANT: DW_FRAME_REG14  14
+CONSTANT: DW_FRAME_REG15  15
+CONSTANT: DW_FRAME_REG16  16
+CONSTANT: DW_FRAME_REG17  17
+CONSTANT: DW_FRAME_REG18  18
+CONSTANT: DW_FRAME_REG19  19
+CONSTANT: DW_FRAME_REG20  20
+CONSTANT: DW_FRAME_REG21  21
+CONSTANT: DW_FRAME_REG22  22
+CONSTANT: DW_FRAME_REG23  23
+CONSTANT: DW_FRAME_REG24  24
+CONSTANT: DW_FRAME_REG25  25
+CONSTANT: DW_FRAME_REG26  26
+CONSTANT: DW_FRAME_REG27  27
+CONSTANT: DW_FRAME_REG28  28
+CONSTANT: DW_FRAME_REG29  29
+CONSTANT: DW_FRAME_REG30  30
+CONSTANT: DW_FRAME_REG31  31
+CONSTANT: DW_FRAME_FREG0  32
+CONSTANT: DW_FRAME_FREG1  33
+CONSTANT: DW_FRAME_FREG2  34
+CONSTANT: DW_FRAME_FREG3  35
+CONSTANT: DW_FRAME_FREG4  36
+CONSTANT: DW_FRAME_FREG5  37
+CONSTANT: DW_FRAME_FREG6  38
+CONSTANT: DW_FRAME_FREG7  39
+CONSTANT: DW_FRAME_FREG8  40
+CONSTANT: DW_FRAME_FREG9  41
+CONSTANT: DW_FRAME_FREG10 42
+CONSTANT: DW_FRAME_FREG11 43
+CONSTANT: DW_FRAME_FREG12 44
+CONSTANT: DW_FRAME_FREG13 45
+CONSTANT: DW_FRAME_FREG14 46
+CONSTANT: DW_FRAME_FREG15 47
+CONSTANT: DW_FRAME_FREG16 48
+CONSTANT: DW_FRAME_FREG17 49
+CONSTANT: DW_FRAME_FREG18 50
+CONSTANT: DW_FRAME_FREG19 51
+CONSTANT: DW_FRAME_FREG20 52
+CONSTANT: DW_FRAME_FREG21 53
+CONSTANT: DW_FRAME_FREG22 54
+CONSTANT: DW_FRAME_FREG23 55
+CONSTANT: DW_FRAME_FREG24 56
+CONSTANT: DW_FRAME_FREG25 57
+CONSTANT: DW_FRAME_FREG26 58
+CONSTANT: DW_FRAME_FREG27 59
+CONSTANT: DW_FRAME_FREG28 60
+CONSTANT: DW_FRAME_FREG29 61
+CONSTANT: DW_FRAME_FREG30 62
+CONSTANT: DW_FRAME_FREG31 63
+
+CONSTANT: DW_CHILDREN_no        HEX: 00
+CONSTANT: DW_CHILDREN_yes       HEX: 01
+CONSTANT: DW_ADDR_none          HEX: 00
index 8e285a0904a35625acb1a1e31237aaae582895a3..547b7b9ae926d2b1f234142b2cd947d3e38a7d3b 100644 (file)
@@ -67,7 +67,7 @@ PRIVATE>
 :: ecdsa-sign ( DGST -- sig )
     ec-key-handle :> KEY
     KEY ECDSA_size dup ssl-error <byte-array> :> SIG
-    "uint" <c-object> :> LEN
+    0 <uint> :> LEN
     0 DGST dup length SIG LEN KEY ECDSA_sign ssl-error
     LEN *uint SIG resize ;
 
index 5d77766703db1089fff42575eddc9e6ad0296848..700f0dc9a51791cf38d9f83773492519cc0f09b2 100644 (file)
@@ -1 +1 @@
-untested
+not tested
diff --git a/extra/elf/a.elf b/extra/elf/a.elf
new file mode 100755 (executable)
index 0000000..0f10a2f
Binary files /dev/null and b/extra/elf/a.elf differ
diff --git a/extra/elf/authors.txt b/extra/elf/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/elf/elf-tests.factor b/extra/elf/elf-tests.factor
new file mode 100644 (file)
index 0000000..4d1bb5b
--- /dev/null
@@ -0,0 +1,182 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors byte-arrays elf kernel sequences system tools.test ;
+IN: elf.tests
+
+cpu ppc? [
+{
+    {
+        ""
+        ".interp"
+        ".note.ABI-tag"
+        ".note.gnu.build-id"
+        ".hash"
+        ".gnu.hash"
+        ".dynsym"
+        ".dynstr"
+        ".gnu.version"
+        ".gnu.version_r"
+        ".rela.dyn"
+        ".rela.plt"
+        ".init"
+        ".plt"
+        ".text"
+        ".fini"
+        ".rodata"
+        ".eh_frame_hdr"
+        ".eh_frame"
+        ".ctors"
+        ".dtors"
+        ".jcr"
+        ".dynamic"
+        ".got"
+        ".got.plt"
+        ".data"
+        ".bss"
+        ".comment"
+        ".debug_aranges"
+        ".debug_pubnames"
+        ".debug_info"
+        ".debug_abbrev"
+        ".debug_line"
+        ".debug_str"
+        ".shstrtab"
+        ".symtab"
+        ".strtab"
+    }
+}
+[
+    "resource:extra/elf/a.elf" [
+        sections [ name>> ] map
+    ] with-mapped-elf
+]
+unit-test
+
+{
+    {
+        ".interp"
+        ".note.ABI-tag"
+        ".note.gnu.build-id"
+        ".hash"
+        ".gnu.hash"
+        ".dynsym"
+        ".dynstr"
+        ".gnu.version"
+        ".gnu.version_r"
+        ".rela.dyn"
+        ".rela.plt"
+        ".init"
+        ".plt"
+        ".text"
+        ".fini"
+        ".rodata"
+        ".eh_frame_hdr"
+        ".eh_frame"
+    }
+}
+[
+    "resource:extra/elf/a.elf" [
+        segments [ program-header>> p_type>> PT_LOAD = ] find nip
+        sections [ name>> ] map
+    ] with-mapped-elf
+]
+unit-test
+
+{
+    {
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        ""
+        "init.c"
+        "call_gmon_start"
+        "crtstuff.c"
+        "__CTOR_LIST__"
+        "__DTOR_LIST__"
+        "__JCR_LIST__"
+        "__do_global_dtors_aux"
+        "completed.7342"
+        "dtor_idx.7344"
+        "frame_dummy"
+        "crtstuff.c"
+        "__CTOR_END__"
+        "__FRAME_END__"
+        "__JCR_END__"
+        "__do_global_ctors_aux"
+        "test.c"
+        "_GLOBAL_OFFSET_TABLE_"
+        "__init_array_end"
+        "__init_array_start"
+        "_DYNAMIC"
+        "data_start"
+        "printf@@GLIBC_2.2.5"
+        "__libc_csu_fini"
+        "_start"
+        "__gmon_start__"
+        "_Jv_RegisterClasses"
+        "_fini"
+        "__libc_start_main@@GLIBC_2.2.5"
+        "_IO_stdin_used"
+        "__data_start"
+        "__dso_handle"
+        "__DTOR_END__"
+        "__libc_csu_init"
+        "__bss_start"
+        "_end"
+        "_edata"
+        "main"
+        "_init"
+    }
+}
+[
+    "resource:extra/elf/a.elf" [
+        sections ".symtab" find-section symbols
+        [ name>> ] map
+    ] with-mapped-elf
+]
+unit-test
+
+{
+    B{
+        85 72 137 229 184 44 6 64 0 72 137 199 184 0 0 0 0 232 222
+        254 255 255 201 195
+    }
+}
+[
+    "resource:extra/elf/a.elf" [
+        sections ".symtab" "main" find-section-symbol
+        symbol-data >byte-array
+    ] with-mapped-elf
+]
+unit-test
+] unless
diff --git a/extra/elf/elf.factor b/extra/elf/elf.factor
new file mode 100644 (file)
index 0000000..d2437d9
--- /dev/null
@@ -0,0 +1,626 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien alien.c-types alien.strings alien.syntax arrays
+classes.struct fry io.encodings.ascii io.mmap kernel locals math
+math.intervals sequences specialized-arrays strings typed assocs ;
+IN: elf
+
+! FFI data
+CONSTANT: EI_NIDENT 16
+CONSTANT: EI_MAG0       0
+CONSTANT: EI_MAG1       1
+CONSTANT: EI_MAG2       2
+CONSTANT: EI_MAG3       3
+CONSTANT: EI_CLASS      4
+CONSTANT: EI_DATA       5
+CONSTANT: EI_VERSION    6
+CONSTANT: EI_OSABI      7
+CONSTANT: EI_ABIVERSION 8
+CONSTANT: EI_PAD        9
+
+CONSTANT: ELFMAG0       HEX: 7f
+CONSTANT: ELFMAG1       HEX: 45
+CONSTANT: ELFMAG2       HEX: 4c
+CONSTANT: ELFMAG3       HEX: 46
+
+CONSTANT: ELFCLASS32 1
+CONSTANT: ELFCLASS64 2
+
+CONSTANT: ELFDATA2LSB 1
+CONSTANT: ELFDATA2MSB 2
+
+CONSTANT: ELFOSABI_SYSV       0
+CONSTANT: ELFOSABI_HPUX       1
+CONSTANT: ELFOSABI_NETBSD     2
+CONSTANT: ELFOSABI_LINUX      3
+CONSTANT: ELFOSABI_SOLARIS    6
+CONSTANT: ELFOSABI_AIX        7
+CONSTANT: ELFOSABI_IRIX       8
+CONSTANT: ELFOSABI_FREEBSD    9
+CONSTANT: ELFOSABI_TRU64      10
+CONSTANT: ELFOSABI_MODESTO    11
+CONSTANT: ELFOSABI_OPENBSD    12
+CONSTANT: ELFOSABI_OPENVMS    13
+CONSTANT: ELFOSABI_NSK        14
+CONSTANT: ELFOSABI_AROS       15
+CONSTANT: ELFOSABI_ARM_AEABI  64
+CONSTANT: ELFOSABI_ARM        97
+CONSTANT: ELFOSABI_STANDALONE 255
+
+CONSTANT: ET_NONE   0
+CONSTANT: ET_REL    1
+CONSTANT: ET_EXEC   2
+CONSTANT: ET_DYN    3
+CONSTANT: ET_CORE   4
+CONSTANT: ET_LOOS   HEX: FE00
+CONSTANT: ET_HIOS   HEX: FEFF
+CONSTANT: ET_LOPROC HEX: FF00
+CONSTANT: ET_HIPROC HEX: FFFF
+
+CONSTANT: EM_NONE         0
+CONSTANT: EM_M32          1
+CONSTANT: EM_SPARC        2
+CONSTANT: EM_386          3
+CONSTANT: EM_68K          4
+CONSTANT: EM_88K          5
+CONSTANT: EM_486          6
+CONSTANT: EM_860          7
+CONSTANT: EM_MIPS         8
+CONSTANT: EM_S370         9
+CONSTANT: EM_MIPS_RS3_LE  10
+CONSTANT: EM_SPARC64      11
+CONSTANT: EM_PARISC       15
+CONSTANT: EM_VPP500       17
+CONSTANT: EM_SPARC32PLUS  18
+CONSTANT: EM_960          19
+CONSTANT: EM_PPC          20
+CONSTANT: EM_PPC64        21
+CONSTANT: EM_S390         22
+CONSTANT: EM_SPU          23
+CONSTANT: EM_V800         36
+CONSTANT: EM_FR20         37
+CONSTANT: EM_RH32         38
+CONSTANT: EM_RCE          39
+CONSTANT: EM_ARM          40
+CONSTANT: EM_ALPHA        41
+CONSTANT: EM_SH           42
+CONSTANT: EM_SPARCV9      43
+CONSTANT: EM_TRICORE      44
+CONSTANT: EM_ARC          45
+CONSTANT: EM_H8_300       46
+CONSTANT: EM_H8_300H      47
+CONSTANT: EM_H8S          48
+CONSTANT: EM_H8_500       49
+CONSTANT: EM_IA_64        50
+CONSTANT: EM_MIPS_X       51
+CONSTANT: EM_COLDFIRE     52
+CONSTANT: EM_68HC12       53
+CONSTANT: EM_MMA          54
+CONSTANT: EM_PCP          55
+CONSTANT: EM_NCPU         56
+CONSTANT: EM_NDR1         57
+CONSTANT: EM_STARCORE     58
+CONSTANT: EM_ME16         59
+CONSTANT: EM_ST100        60
+CONSTANT: EM_TINYJ        61
+CONSTANT: EM_X86_64       62
+CONSTANT: EM_PDSP         63
+CONSTANT: EM_FX66         66
+CONSTANT: EM_ST9PLUS      67
+CONSTANT: EM_ST7          68
+CONSTANT: EM_68HC16       69
+CONSTANT: EM_68HC11       70
+CONSTANT: EM_68HC08       71
+CONSTANT: EM_68HC05       72
+CONSTANT: EM_SVX          73
+CONSTANT: EM_ST19         74
+CONSTANT: EM_VAX          75
+CONSTANT: EM_CRIS         76
+CONSTANT: EM_JAVELIN      77
+CONSTANT: EM_FIREPATH     78
+CONSTANT: EM_ZSP          79
+CONSTANT: EM_MMIX         80
+CONSTANT: EM_HUANY        81
+CONSTANT: EM_PRISM        82
+CONSTANT: EM_AVR          83
+CONSTANT: EM_FR30         84
+CONSTANT: EM_D10V         85
+CONSTANT: EM_D30V         86
+CONSTANT: EM_V850         87
+CONSTANT: EM_M32R         88
+CONSTANT: EM_MN10300      89
+CONSTANT: EM_MN10200      90
+CONSTANT: EM_PJ           91
+CONSTANT: EM_OPENRISC     92
+CONSTANT: EM_ARC_A5       93
+CONSTANT: EM_XTENSA       94
+CONSTANT: EM_VIDEOCORE    95
+CONSTANT: EM_TMM_GPP      96
+CONSTANT: EM_NS32K        97
+CONSTANT: EM_TPC          98
+CONSTANT: EM_SNP1K        99
+CONSTANT: EM_ST200        100
+CONSTANT: EM_IP2K         101
+CONSTANT: EM_MAX          102
+CONSTANT: EM_CR           103
+CONSTANT: EM_F2MC16       104
+CONSTANT: EM_MSP430       105
+CONSTANT: EM_BLACKFIN     106
+CONSTANT: EM_SE_C33       107
+CONSTANT: EM_SEP          108
+CONSTANT: EM_ARCA         109
+CONSTANT: EM_UNICORE      110
+
+CONSTANT: EV_NONE    0
+CONSTANT: EV_CURRENT 1
+
+CONSTANT: EF_ARM_EABIMASK HEX: ff000000
+CONSTANT: EF_ARM_BE8      HEX: 00800000
+
+CONSTANT: SHN_UNDEF  HEX: 0000
+CONSTANT: SHN_LOPROC HEX: FF00
+CONSTANT: SHN_HIPROC HEX: FF1F
+CONSTANT: SHN_LOOS   HEX: FF20
+CONSTANT: SHN_HIOS   HEX: FF3F
+CONSTANT: SHN_ABS    HEX: FFF1
+CONSTANT: SHN_COMMON HEX: FFF2
+
+CONSTANT: SHT_NULL               0
+CONSTANT: SHT_PROGBITS           1
+CONSTANT: SHT_SYMTAB             2
+CONSTANT: SHT_STRTAB             3
+CONSTANT: SHT_RELA               4
+CONSTANT: SHT_HASH               5
+CONSTANT: SHT_DYNAMIC            6
+CONSTANT: SHT_NOTE               7
+CONSTANT: SHT_NOBITS             8
+CONSTANT: SHT_REL                9
+CONSTANT: SHT_SHLIB              10
+CONSTANT: SHT_DYNSYM             11
+CONSTANT: SHT_LOOS               HEX: 60000000
+CONSTANT: SHT_GNU_LIBLIST        HEX: 6ffffff7
+CONSTANT: SHT_CHECKSUM           HEX: 6ffffff8
+CONSTANT: SHT_LOSUNW             HEX: 6ffffffa
+CONSTANT: SHT_SUNW_move          HEX: 6ffffffa
+CONSTANT: SHT_SUNW_COMDAT        HEX: 6ffffffb
+CONSTANT: SHT_SUNW_syminfo       HEX: 6ffffffc
+CONSTANT: SHT_GNU_verdef         HEX: 6ffffffd
+CONSTANT: SHT_GNU_verneed        HEX: 6ffffffe
+CONSTANT: SHT_GNU_versym         HEX: 6fffffff
+CONSTANT: SHT_HISUNW             HEX: 6fffffff
+CONSTANT: SHT_HIOS               HEX: 6fffffff
+CONSTANT: SHT_LOPROC             HEX: 70000000
+CONSTANT: SHT_ARM_EXIDX          HEX: 70000001
+CONSTANT: SHT_ARM_PREEMPTMAP     HEX: 70000002
+CONSTANT: SHT_ARM_ATTRIBUTES     HEX: 70000003
+CONSTANT: SHT_ARM_DEBUGOVERLAY   HEX: 70000004
+CONSTANT: SHT_ARM_OVERLAYSECTION HEX: 70000005
+CONSTANT: SHT_HIPROC             HEX: 7fffffff
+CONSTANT: SHT_LOUSER             HEX: 80000000
+CONSTANT: SHT_HIUSER             HEX: 8fffffff
+
+CONSTANT: SHF_WRITE            1
+CONSTANT: SHF_ALLOC            2
+CONSTANT: SHF_EXECINSTR        4
+CONSTANT: SHF_MERGE            16
+CONSTANT: SHF_STRINGS          32
+CONSTANT: SHF_INFO_LINK        64
+CONSTANT: SHF_LINK_ORDER       128
+CONSTANT: SHF_OS_NONCONFORMING 256
+CONSTANT: SHF_GROUP            512
+CONSTANT: SHF_TLS              1024
+CONSTANT: SHF_MASKOS           HEX: 0f000000
+CONSTANT: SHF_MASKPROC         HEX: f0000000
+
+CONSTANT: STB_LOCAL  0
+CONSTANT: STB_GLOBAL 1
+CONSTANT: STB_WEAK   2
+CONSTANT: STB_LOOS   10
+CONSTANT: STB_HIOS   12
+CONSTANT: STB_LOPROC 13
+CONSTANT: STB_HIPROC 15
+
+CONSTANT: STT_NOTYPE   0
+CONSTANT: STT_OBJECT   1
+CONSTANT: STT_FUNC     2
+CONSTANT: STT_SECTION  3
+CONSTANT: STT_FILE     4
+CONSTANT: STT_COMMON   5
+CONSTANT: STT_TLS      6
+CONSTANT: STT_LOOS    10
+CONSTANT: STT_HIOS    12
+CONSTANT: STT_LOPROC  13
+CONSTANT: STT_HIPROC  15
+
+CONSTANT: STN_UNDEF 0
+
+CONSTANT: STV_DEFAULT   0
+CONSTANT: STV_INTERNAL  1
+CONSTANT: STV_HIDDEN    2
+CONSTANT: STV_PROTECTED 3
+
+CONSTANT: PT_NULL        0
+CONSTANT: PT_LOAD        1
+CONSTANT: PT_DYNAMIC     2
+CONSTANT: PT_INTERP      3
+CONSTANT: PT_NOTE        4
+CONSTANT: PT_SHLIB       5
+CONSTANT: PT_PHDR        6
+CONSTANT: PT_TLS         7
+CONSTANT: PT_LOOS        HEX: 60000000
+CONSTANT: PT_HIOS        HEX: 6fffffff
+CONSTANT: PT_LOPROC      HEX: 70000000
+CONSTANT: PT_ARM_ARCHEXT HEX: 70000000
+CONSTANT: PT_ARM_EXIDX   HEX: 70000001
+CONSTANT: PT_ARM_UNWIND  HEX: 70000001
+CONSTANT: PT_HIPROC      HEX: 7fffffff
+
+CONSTANT: PT_ARM_ARCHEXT_FMTMSK       HEX: ff000000
+CONSTANT: PT_ARM_ARCHEXT_PROFMSK      HEX: 00ff0000
+CONSTANT: PT_ARM_ARCHEXT_ARCHMSK      HEX: 000000ff
+CONSTANT: PT_ARM_ARCHEXT_FMT_OS       HEX: 00000000
+CONSTANT: PT_ARM_ARCHEXT_FMT_ABI      HEX: 01000000
+CONSTANT: PT_ARM_ARCHEXT_PROF_NONE    HEX: 00000000
+CONSTANT: PT_ARM_ARCHEXT_PROF_ARM     HEX: 00410000
+CONSTANT: PT_ARM_ARCHEXT_PROF_RT      HEX: 00520000
+CONSTANT: PT_ARM_ARCHEXT_PROF_MC      HEX: 004d0000
+CONSTANT: PT_ARM_ARCHEXT_PROF_CLASSIC HEX: 00530000
+
+CONSTANT: PT_ARM_ARCHEXT_ARCH_UNKN      HEX: 00
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv4    HEX: 01
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv4T   HEX: 02
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv5T   HEX: 03
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv5TE  HEX: 04
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv5TEJ HEX: 05
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv6    HEX: 06
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv6KZ  HEX: 07
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv6T2  HEX: 08
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv6K   HEX: 09
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv7    HEX: 0A
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv6M   HEX: 0B
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv6SM  HEX: 0C
+CONSTANT: PT_ARM_ARCHEXT_ARCH_ARCHv7EM  HEX: 0D
+
+CONSTANT: PF_X        1
+CONSTANT: PF_W        2
+CONSTANT: PF_R        4
+CONSTANT: PF_MASKOS   HEX: 00ff0000
+CONSTANT: PF_MASKPROC HEX: ff000000
+
+CONSTANT: DT_NULL            0
+CONSTANT: DT_NEEDED          1
+CONSTANT: DT_PLTRELSZ        2
+CONSTANT: DT_PLTGOT          3
+CONSTANT: DT_HASH            4
+CONSTANT: DT_STRTAB          5
+CONSTANT: DT_SYMTAB          6
+CONSTANT: DT_RELA            7
+CONSTANT: DT_RELASZ          8
+CONSTANT: DT_RELAENT         9
+CONSTANT: DT_STRSZ           10
+CONSTANT: DT_SYMENT          11
+CONSTANT: DT_INIT            12
+CONSTANT: DT_FINI            13
+CONSTANT: DT_SONAME          14
+CONSTANT: DT_RPATH           15
+CONSTANT: DT_SYMBOLIC        16
+CONSTANT: DT_REL             17
+CONSTANT: DT_RELSZ           18
+CONSTANT: DT_RELENT          19
+CONSTANT: DT_PLTREL          20
+CONSTANT: DT_DEBUG           21
+CONSTANT: DT_TEXTREL         22
+CONSTANT: DT_JMPREL          23
+CONSTANT: DT_BIND_NOW        24
+CONSTANT: DT_INIT_ARRAY      25
+CONSTANT: DT_FINI_ARRAY      26
+CONSTANT: DT_INIT_ARRAYSZ    27
+CONSTANT: DT_FINI_ARRAYSZ    28
+CONSTANT: DT_RUNPATH         29
+CONSTANT: DT_FLAGS           30
+CONSTANT: DT_ENCODING        32
+CONSTANT: DT_PREINIT_ARRAY   32
+CONSTANT: DT_PREINIT_ARRAYSZ 33
+CONSTANT: DT_LOOS            HEX: 60000000
+CONSTANT: DT_HIOS            HEX: 6fffffff
+CONSTANT: DT_LOPROC          HEX: 70000000
+CONSTANT: DT_ARM_RESERVED1   HEX: 70000000
+CONSTANT: DT_ARM_SYMTABSZ    HEX: 70000001
+CONSTANT: DT_ARM_PREEMPTYMAP HEX: 70000002
+CONSTANT: DT_ARM_RESERVED2   HEX: 70000003
+CONSTANT: DT_HIPROC          HEX: 7fffffff
+
+TYPEDEF: ushort    Elf32_Half
+TYPEDEF: uint      Elf32_Word
+TYPEDEF: int       Elf32_Sword
+TYPEDEF: uint      Elf32_Off
+TYPEDEF: uint      Elf32_Addr
+TYPEDEF: ushort    Elf64_Half
+TYPEDEF: uint      Elf64_Word
+TYPEDEF: ulonglong Elf64_Xword
+TYPEDEF: longlong  Elf64_Sxword
+TYPEDEF: ulonglong Elf64_Off
+TYPEDEF: ulonglong Elf64_Addr
+
+STRUCT: Elf32_Ehdr
+    { e_ident     uchar[16]  }
+    { e_type      Elf32_Half }
+    { e_machine   Elf32_Half }
+    { e_version   Elf32_Word }
+    { e_entry     Elf32_Addr }
+    { e_phoff     Elf32_Off  }
+    { e_shoff     Elf32_Off  }
+    { e_flags     Elf32_Word }
+    { e_ehsize    Elf32_Half }
+    { e_phentsize Elf32_Half }
+    { e_phnum     Elf32_Half }
+    { e_shentsize Elf32_Half }
+    { e_shnum     Elf32_Half }
+    { e_shstrndx  Elf32_Half } ;
+
+STRUCT: Elf64_Ehdr
+    { e_ident     uchar[16]  }
+    { e_type      Elf64_Half }
+    { e_machine   Elf64_Half }
+    { e_version   Elf64_Word }
+    { e_entry     Elf64_Addr }
+    { e_phoff     Elf64_Off  }
+    { e_shoff     Elf64_Off  }
+    { e_flags     Elf64_Word }
+    { e_ehsize    Elf64_Half }
+    { e_phentsize Elf64_Half }
+    { e_phnum     Elf64_Half }
+    { e_shentsize Elf64_Half }
+    { e_shnum     Elf64_Half }
+    { e_shstrndx  Elf64_Half } ;
+
+STRUCT: Elf32_Shdr
+    { sh_name      Elf32_Word  }
+    { sh_type      Elf32_Word  }
+    { sh_flags     Elf32_Word  }
+    { sh_addr      Elf32_Addr  }
+    { sh_offset    Elf32_Off   }
+    { sh_size      Elf32_Word  }
+    { sh_link      Elf32_Word  }
+    { sh_info      Elf32_Word  }
+    { sh_addralign Elf32_Word  }
+    { sh_entsize   Elf32_Word  } ;
+
+STRUCT: Elf64_Shdr
+    { sh_name      Elf64_Word  }
+    { sh_type      Elf64_Word  }
+    { sh_flags     Elf64_Xword }
+    { sh_addr      Elf64_Addr  }
+    { sh_offset    Elf64_Off   }
+    { sh_size      Elf64_Xword }
+    { sh_link      Elf64_Word  }
+    { sh_info      Elf64_Word  }
+    { sh_addralign Elf64_Xword }
+    { sh_entsize   Elf64_Xword } ;
+
+STRUCT: Elf32_Sym
+    { st_name  Elf32_Word }
+    { st_value Elf32_Addr }
+    { st_size  Elf32_Word }
+    { st_info  uchar      }
+    { st_other uchar      }
+    { st_shndx Elf32_Half } ;
+
+STRUCT: Elf64_Sym
+    { st_name  Elf64_Word  }
+    { st_info  uchar       }
+    { st_other uchar       }
+    { st_shndx Elf64_Half  }
+    { st_value Elf64_Addr  }
+    { st_size  Elf64_Xword } ;
+
+STRUCT: Elf32_Rel
+    { r_offset Elf32_Addr }
+    { r_info   Elf32_Word } ;
+
+STRUCT: Elf32_Rela
+    { r_offset Elf32_Addr  }
+    { r_info   Elf32_Word  }
+    { r_addend Elf32_Sword } ;
+
+STRUCT: Elf64_Rel
+    { r_offset Elf64_Addr  }
+    { r_info   Elf64_Xword } ;
+
+STRUCT: Elf64_Rela
+    { r_offset Elf64_Addr   }
+    { r_info   Elf64_Xword  }
+    { r_addend Elf64_Sxword } ;
+
+STRUCT: Elf32_Phdr
+    { p_type   Elf32_Word  }
+    { p_offset Elf32_Off   }
+    { p_vaddr  Elf32_Addr  }
+    { p_paddr  Elf32_Addr  }
+    { p_filesz Elf32_Word  }
+    { p_memsz  Elf32_Word  }
+    { p_flags  Elf32_Word  }
+    { p_align  Elf32_Word  } ;
+
+STRUCT: Elf64_Phdr
+    { p_type   Elf64_Word  }
+    { p_flags  Elf64_Word  }
+    { p_offset Elf64_Off   }
+    { p_vaddr  Elf64_Addr  }
+    { p_paddr  Elf64_Addr  }
+    { p_filesz Elf64_Xword }
+    { p_memsz  Elf64_Xword }
+    { p_align  Elf64_Xword } ;
+
+STRUCT: Elf32_Dyn
+    { d_tag Elf32_Sword }
+    { d_val Elf32_Word  } ;
+
+STRUCT: Elf64_Dyn
+    { d_tag Elf64_Sxword }
+    { d_val Elf64_Xword  } ;
+
+! Low-level interface
+SPECIALIZED-ARRAYS: Elf32_Shdr Elf64_Shdr Elf32_Sym Elf64_Sym Elf32_Phdr Elf64_Phdr uchar ;
+UNION: Elf32/64_Ehdr Elf32_Ehdr Elf64_Ehdr ;
+UNION: Elf32/64_Shdr Elf32_Shdr Elf64_Shdr ;
+UNION: Elf32/64_Shdr-array Elf32_Shdr-array Elf64_Shdr-array ;
+UNION: Elf32/64_Sym Elf32_Sym Elf64_Sym ;
+UNION: Elf32/64_Sym-array Elf32_Sym-array Elf64_Sym-array ;
+UNION: Elf32/64_Phdr Elf32_Phdr Elf64_Phdr ;
+UNION: Elf32/64_Phdr-array Elf32_Phdr-array Elf64_Phdr-array ;
+
+TYPED: 64-bit? ( elf: Elf32/64_Ehdr -- ? )
+    e_ident>> EI_CLASS swap nth ELFCLASS64 = ;
+
+TYPED: elf-header ( c-ptr -- elf: Elf32/64_Ehdr )
+    [ Elf64_Ehdr memory>struct 64-bit? ] keep swap
+    [ Elf64_Ehdr memory>struct ]
+    [ Elf32_Ehdr memory>struct ] if ;
+
+TYPED:: elf-section-headers ( elf: Elf32/64_Ehdr -- headers: Elf32/64_Shdr-array )
+    elf [ e_shoff>> ] [ e_shnum>> ] bi :> ( off num )
+    off elf >c-ptr <displaced-alien> num
+    elf 64-bit?
+    [ <direct-Elf64_Shdr-array> ]
+    [ <direct-Elf32_Shdr-array> ] if ;
+
+TYPED:: elf-program-headers ( elf: Elf32/64_Ehdr -- headers: Elf32/64_Phdr-array )
+    elf [ e_phoff>> ] [ e_phnum>> ] bi :> ( off num )
+    off elf >c-ptr <displaced-alien> num
+    elf 64-bit?
+    [ <direct-Elf64_Phdr-array> ]
+    [ <direct-Elf32_Phdr-array> ] if ;
+
+TYPED: elf-loadable-segments ( headers: Elf32/64_Phdr-array -- headers: Elf32/64_Phdr-array )
+    [ p_type>> PT_LOAD = ] filter ;
+
+TYPED:: elf-segment-sections ( segment: Elf32/64_Phdr sections: Elf32/64_Shdr-array -- sections )
+    segment [ p_offset>> dup ] [ p_filesz>> + ] bi [a,b)                            :> segment-interval
+    sections [ dup [ sh_offset>> dup ] [ sh_size>> + ] bi [a,b) 2array ] { } map-as :> section-intervals
+    section-intervals [ second segment-interval interval-intersect empty-interval = not ]
+    filter keys ;
+
+TYPED:: virtual-address-segment ( elf: Elf32/64_Ehdr address -- program-header/f )
+    elf elf-program-headers elf-loadable-segments [
+        [ p_vaddr>> dup ] [ p_memsz>> + ] bi [a,b)
+        address swap interval-contains?
+    ] filter [ f ] [ first ] if-empty ;
+
+TYPED:: virtual-address-section ( elf: Elf32/64_Ehdr address -- section-header/f )
+    elf address virtual-address-segment :> segment
+    segment elf elf-section-headers elf-segment-sections :> sections
+    address segment p_vaddr>> - segment p_offset>> + :> faddress
+    sections [
+        [ sh_offset>> dup ] [ sh_size>> + ] bi [a,b)
+        faddress swap interval-contains?
+    ] filter [ f ] [ first ] if-empty ;
+
+TYPED:: elf-segment-data ( elf: Elf32/64_Ehdr header: Elf32/64_Phdr -- uchar-array/f )
+    header [ p_offset>> elf >c-ptr <displaced-alien> ] [ p_filesz>> ] bi <direct-uchar-array> ;
+
+TYPED:: elf-section-data ( elf: Elf32/64_Ehdr header: Elf32/64_Shdr -- uchar-array/f )
+    header [ sh_offset>> elf >c-ptr <displaced-alien> ] [ sh_size>> ] bi <direct-uchar-array> ;
+
+TYPED:: elf-section-data-by-index ( elf: Elf32/64_Ehdr index -- header/f uchar-array/f )
+    elf elf-section-headers     :> sections
+    index sections nth          :> header
+    elf header elf-section-data :> data
+    header data ;
+
+TYPED:: elf-section-name ( elf: Elf32/64_Ehdr header: Elf32/64_Shdr -- name: string )
+    elf elf e_shstrndx>> elf-section-data-by-index nip >c-ptr :> section-names
+    header sh_name>> section-names <displaced-alien> ascii alien>string ;
+
+TYPED:: elf-section-data-by-name ( elf: Elf32/64_Ehdr name: string -- header/f uchar-array/f )
+    elf elf-section-headers                      :> sections
+    elf e_shstrndx>>                             :> ndx
+    elf ndx sections nth elf-section-data >c-ptr :> section-names
+    sections 1 tail [
+        sh_name>> section-names <displaced-alien> ascii alien>string name =
+    ] find nip
+    [ dup elf swap elf-section-data ]
+    [ f f ] if* ;
+
+TYPED:: elf-sections ( elf: Elf32/64_Ehdr -- sections )
+    elf elf-section-headers                                   :> sections
+    elf elf e_shstrndx>> elf-section-data-by-index nip >c-ptr :> section-names
+    sections [
+        [ sh_name>> section-names <displaced-alien>
+          ascii alien>string ] keep 2array
+    ] { } map-as ;
+
+TYPED:: elf-symbols ( elf: Elf32/64_Ehdr section-data: uchar-array -- symbols )
+    elf ".strtab" elf-section-data-by-name nip >c-ptr :> strings
+    section-data [ >c-ptr ] [ length ] bi
+    elf 64-bit?
+    [ Elf64_Sym heap-size / <direct-Elf64_Sym-array> ]
+    [ Elf32_Sym heap-size / <direct-Elf32_Sym-array> ] if
+    [ [ st_name>> strings <displaced-alien> ascii alien>string ] keep 2array ] { } map-as ;
+
+! High level interface
+TUPLE: elf elf-header ;
+TUPLE: section name elf-header section-header data ;
+TUPLE: segment elf-header program-header data ;
+TUPLE: symbol name elf-header sym data ;
+
+GENERIC: sections ( obj -- sections )
+    
+: <elf> ( c-ptr -- elf )
+    elf-header elf boa ;
+
+M:: elf sections ( elf -- sections )
+    elf elf-header>> elf-sections
+    [
+        first2 :> ( name header )
+        elf elf-header>> header elf-section-data :> data
+        name elf elf-header>> header data section boa
+    ] { } map-as ;
+
+:: segments ( elf -- segments )
+    elf elf-header>> elf-program-headers
+    [| header |
+        elf elf-header>> header elf-segment-data :> data
+        elf elf-header>> header data segment boa
+    ] { } map-as ;
+
+M:: segment sections ( segment -- sections )
+    segment program-header>>
+    segment elf-header>> elf-section-headers
+    elf-segment-sections
+
+    [| header |
+        segment elf-header>> header elf-section-name :> name
+        segment elf-header>> header elf-section-data :> data
+        name segment elf-header>> header data section boa
+    ] { } map-as ;
+
+:: symbols ( section -- symbols )
+    section elf-header>>
+    section data>>
+    elf-symbols
+    [
+        first2 :> ( name sym )
+        name section elf-header>> sym f symbol boa
+    ] { } map-as ;
+    
+:: symbol-data ( symbol -- data )
+    symbol [ elf-header>> ] [ sym>> st_value>> ] bi virtual-address-segment :> segment
+    symbol sym>> st_value>> segment p_vaddr>> - segment p_offset>> + :> faddress
+    faddress symbol elf-header>> >c-ptr <displaced-alien>
+    symbol sym>> st_size>> <direct-uchar-array> ;
+
+: find-section ( sections name -- section/f )
+    '[ name>> _ = ] find nip ; inline
+
+: find-symbol ( symbols name -- symbol/f )
+    '[ name>> _ = ] find nip ; inline
+
+: find-section-symbol ( sections section symbol -- symbol/f )
+    [ find-section ] dip over [
+        [ symbols ] dip find-symbol ] [ 2drop f ] if ;
+
+: with-mapped-elf ( path quot -- )
+    '[
+        address>> <elf> @
+    ] with-mapped-file ; inline
diff --git a/extra/elf/nm/authors.txt b/extra/elf/nm/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/elf/nm/nm-docs.factor b/extra/elf/nm/nm-docs.factor
new file mode 100644 (file)
index 0000000..31ca3de
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: elf help.markup help.syntax ;
+IN: elf.nm
+
+HELP: elf-nm
+{ $values
+    { "path" "a pathname string" }
+}
+{ $description "Prints information about the symbols in the ELF object at the given path." } ;
+
+HELP: print-symbol
+{ $values
+    { "sections" "sequence of section" } { "symbol" symbol }
+}
+{ $description "Prints the value, section and name of the given symbol." } ;
+
+ARTICLE: "elf.nm" "ELF nm"
+"The " { $vocab-link "elf.nm" } " vocab prints the values, sections and names of the symbols in a given ELF file. In an ELF executable or shared library, the symbol values are typically their virtual addresses. In a relocatable ELF object, they are section-relative offsets."
+{ $subsections elf-nm }
+;
+
+ABOUT: "elf.nm"
diff --git a/extra/elf/nm/nm-tests.factor b/extra/elf/nm/nm-tests.factor
new file mode 100644 (file)
index 0000000..90d9634
--- /dev/null
@@ -0,0 +1,53 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: elf.nm io io.streams.string kernel literals multiline strings
+system tools.test ;
+IN: elf.nm.tests
+
+STRING: validation-output
+0000000000000000 absolute         init.c
+000000000040046c .text            call_gmon_start
+0000000000000000 absolute         crtstuff.c
+0000000000600e18 .ctors           __CTOR_LIST__
+0000000000600e28 .dtors           __DTOR_LIST__
+0000000000600e38 .jcr             __JCR_LIST__
+0000000000400490 .text            __do_global_dtors_aux
+0000000000601020 .bss             completed.7342
+0000000000601028 .bss             dtor_idx.7344
+0000000000400500 .text            frame_dummy
+0000000000000000 absolute         crtstuff.c
+0000000000600e20 .ctors           __CTOR_END__
+00000000004006d8 .eh_frame        __FRAME_END__
+0000000000600e38 .jcr             __JCR_END__
+00000000004005e0 .text            __do_global_ctors_aux
+0000000000000000 absolute         test.c
+0000000000600fe8 .got.plt         _GLOBAL_OFFSET_TABLE_
+0000000000600e14 .ctors           __init_array_end
+0000000000600e14 .ctors           __init_array_start
+0000000000600e40 .dynamic         _DYNAMIC
+0000000000601010 .data            data_start
+0000000000000000 undefined        printf@@GLIBC_2.2.5
+0000000000400540 .text            __libc_csu_fini
+0000000000400440 .text            _start
+0000000000000000 undefined        __gmon_start__
+0000000000000000 undefined        _Jv_RegisterClasses
+0000000000400618 .fini            _fini
+0000000000000000 undefined        __libc_start_main@@GLIBC_2.2.5
+0000000000400628 .rodata          _IO_stdin_used
+0000000000601010 .data            __data_start
+0000000000601018 .data            __dso_handle
+0000000000600e30 .dtors           __DTOR_END__
+0000000000400550 .text            __libc_csu_init
+0000000000601020 absolute         __bss_start
+0000000000601030 absolute         _end
+0000000000601020 absolute         _edata
+0000000000400524 .text            main
+00000000004003f0 .init            _init
+
+;
+
+cpu ppc? [
+    { $ validation-output }
+    [ <string-writer> dup [ "resource:extra/elf/a.elf" elf-nm ] with-output-stream >string ]
+    unit-test
+] unless
diff --git a/extra/elf/nm/nm.factor b/extra/elf/nm/nm.factor
new file mode 100644 (file)
index 0000000..52e1c66
--- /dev/null
@@ -0,0 +1,24 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors combinators elf formatting io.mmap kernel sequences ;
+IN: elf.nm
+
+: print-symbol ( sections symbol -- )
+    [ sym>> st_value>> "%016x " printf ]
+    [
+        sym>> st_shndx>>
+        {
+            { SHN_UNDEF [ drop "undefined" ] }
+            { SHN_ABS [ drop "absolute" ] }
+            { SHN_COMMON [ drop "common" ] }
+            [ swap nth name>> ]
+        } case "%-16s " printf
+    ]
+    [ name>> "%s\n" printf ] tri ;
+    
+: elf-nm ( path -- )
+    [
+        sections dup ".symtab" find-section
+        symbols [ name>> empty? not ] filter
+        [ print-symbol ] with each
+    ] with-mapped-elf ;
diff --git a/extra/elf/nm/summary.txt b/extra/elf/nm/summary.txt
new file mode 100644 (file)
index 0000000..7d378d3
--- /dev/null
@@ -0,0 +1 @@
+UNIX nm-like utility.
diff --git a/extra/elf/summary.txt b/extra/elf/summary.txt
new file mode 100644 (file)
index 0000000..5cb6b84
--- /dev/null
@@ -0,0 +1 @@
+Constants and structs related to the ELF object format.
diff --git a/extra/enter/authors.txt b/extra/enter/authors.txt
deleted file mode 100644 (file)
index ce0899f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Sam Anklesaria
\ No newline at end of file
diff --git a/extra/enter/enter.factor b/extra/enter/enter.factor
deleted file mode 100644 (file)
index 845182c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-! Copyright (C) 2009 Sam Anklesaria.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel parser vocabs.parser words ;
-IN: enter
-! main words are usually only used for entry, doing initialization, etc
-! it makes sense, then to define it all at once, rather than factoring it out into a seperate word
-! and then declaring it main
-SYNTAX: ENTER: gensym [ parse-definition (( -- )) define-declared ] keep current-vocab (>>main) ;
\ No newline at end of file
diff --git a/extra/fluids/authors.txt b/extra/fluids/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/fluids/colors.ppm b/extra/fluids/colors.ppm
new file mode 100644 (file)
index 0000000..c12c455
Binary files /dev/null and b/extra/fluids/colors.ppm differ
diff --git a/extra/fluids/fluids.factor b/extra/fluids/fluids.factor
new file mode 100644 (file)
index 0000000..f76ee06
--- /dev/null
@@ -0,0 +1,120 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays classes.struct destructors game.loop
+game.worlds gpu gpu.buffers gpu.effects.blur gpu.framebuffers
+gpu.render gpu.shaders gpu.state gpu.textures gpu.util images
+images.loader kernel literals locals make math math.rectangles
+math.vectors namespaces opengl.gl sequences specialized-arrays
+ui.gadgets.worlds ui.gestures ui.pixel-formats gpu.effects.step
+images.pgm images.ppm ;
+FROM: alien.c-types => float ;
+SPECIALIZED-ARRAY: float
+IN: fluids
+
+STRUCT: particle_t
+    { p float[2] }
+    { v float[2] }
+    { m float    } ;
+SPECIALIZED-ARRAY: particle_t
+
+CONSTANT: gravity { 0.0 -0.1 }
+
+:: verlet-integrate-particle ( particle dt -- particle' )
+    particle [ p>> ] [ v>> ] bi dt v*n v+
+    gravity dt dt * particle m>> 2 * / v*n v+ :> p'
+    p' particle p>> v- dt v/n :> v'
+    p' v' particle m>> particle_t <struct-boa> ; inline
+
+CONSTANT: initial-particles
+particle_t-array{
+    S{ particle_t f float-array{ 0.5 0.6 } float-array{ 0 0.1 } 1.0 }
+    S{ particle_t f float-array{ 0.5 0.6 } float-array{ 0.1 0 } 3.0 }
+    
+    S{ particle_t f float-array{ 0.5 0.5 } float-array{ 0.1 0.1 } 2.0 }
+    S{ particle_t f float-array{ 0.5 0.6 } float-array{ -0.1 0 } 1.0 }
+    S{ particle_t f float-array{ 0.6 0.5 } float-array{ 0 -0.1 } 3.0 }
+    S{ particle_t f float-array{ 0.7 0.5 } float-array{ 0.1 0.1 } 1.0 }
+    S{ particle_t f float-array{ 0.1 0.5 } float-array{ -0.1 -0.1 } 5.0 }
+    S{ particle_t f float-array{ 0.2 0.5 } float-array{ 0 0 } 1.0 }
+    S{ particle_t f float-array{ 0.3 0.3 } float-array{ 0 0 } 4.0 }
+    S{ particle_t f float-array{ 0.5 0.15 } float-array{ 0 0 } 1.0 }
+    S{ particle_t f float-array{ 0.5 0.1 } float-array{ 0 0 } 9.0 }
+}
+
+: integrate-particles! ( particles dt -- particles )
+    [ verlet-integrate-particle ] curry map! ;
+
+TUPLE: fluids-world < game-world
+    particles texture ramp { paused boolean initial: f } ;
+
+: make-texture ( pathname -- texture )
+    load-image
+    [
+        [ component-order>> ]
+        [ component-type>> ] bi
+        T{ texture-parameters
+           { wrap clamp-texcoord-to-edge }
+           { min-filter filter-nearest }
+           { mag-filter filter-nearest }
+           { min-mipmap-filter f } }
+        <texture-2d>
+    ]
+    [
+        0 swap [ allocate-texture-image ] 3keep 2drop
+    ] bi ;
+
+SYMBOL: fluid
+
+: integrate ( world -- )
+    particles>> 1/60 integrate-particles! drop ;
+
+: pause ( -- )
+    fluid get [ not ] change-paused drop ;
+
+: step ( -- )
+    fluid get paused>> [ fluid get integrate ] when ;
+
+M: fluids-world begin-game-world
+    dup fluid set
+    init-gpu
+    initial-particles clone >>particles
+    "vocab:fluids/particle2.pgm" make-texture >>texture
+    "vocab:fluids/colors.ppm" make-texture >>ramp
+    drop ;
+
+M: fluids-world end-game-world
+    drop ;
+
+M: fluids-world tick-game-world
+    dup paused>> [ drop ] [ integrate ] if ;
+
+M:: fluids-world draw-world* ( world -- )
+    world particles>> [
+        [ p>> [ first , ] [ second , ] bi ] each
+    ] curry float-array{ } make :> verts
+    
+    [ 
+        verts world texture>> 30.0 world dim>> { 4 4 } v/
+        blended-point-sprite-batch &dispose
+        blend-state new set-gpu-state
+        gaussian-blur &dispose
+        world ramp>> world dim>> step-texture &dispose
+        world dim>> draw-texture
+    ] with-destructors ;
+
+GAME: fluids {
+    { world-class fluids-world }
+    { title "Fluids Test" }
+    { pixel-format-attributes {
+        windowed double-buffered T{ depth-bits { value 24 } } } }
+    { pref-dim { 1024 768 } }
+    { tick-interval-nanos $[ 60 fps ] }
+} ;
+
+fluids-world H{
+    { T{ button-down } [ [
+        hand-loc get >float-array
+        world get dim>> >float-array v/ 2 v*n 1 v-n { 1 -1 } v*
+        float-array{ 0 0.2 } 2.0 particle_t <struct-boa> suffix
+    ] change-particles drop ] }
+} set-gestures
diff --git a/extra/fluids/particle2.pgm b/extra/fluids/particle2.pgm
new file mode 100644 (file)
index 0000000..a45dc41
Binary files /dev/null and b/extra/fluids/particle2.pgm differ
diff --git a/extra/fluids/resources.txt b/extra/fluids/resources.txt
new file mode 100644 (file)
index 0000000..f37e692
--- /dev/null
@@ -0,0 +1,2 @@
+particle2.pgm
+colors.ppm
index 23dd62b3401133ff39b76756e522ad541b6852b9..e7b59ca60fbee282424a89010abaad2055e3cf53 100644 (file)
@@ -5,8 +5,8 @@ alien.libraries classes.struct ;
 IN: freetype
 
 << "freetype" {
-    { [ os macosx? ] [ "/usr/X11R6/lib/libfreetype.6.dylib" "cdecl" add-library ] }
-    { [ os windows? ] [ "freetype6.dll" "cdecl" add-library ] }
+    { [ os macosx? ] [ "/usr/X11R6/lib/libfreetype.6.dylib" cdecl add-library ] }
+    { [ os windows? ] [ "freetype6.dll" cdecl add-library ] }
     { [ t ] [ drop ] }
 } cond >>
 
@@ -83,7 +83,7 @@ STRUCT: glyph
     { n-points short }
 
     { points void* }
-    { tags char* }
+    { tags c-string }
     { contours short* }
 
     { outline-flags int }
@@ -166,7 +166,7 @@ STRUCT: FT_Bitmap
     { palette_mode char }
     { palette void* } ;
 
-TYPEDEF: void* FT_Face*
+C-TYPE: FT_Face
 
 FUNCTION: FT_Error FT_New_Face ( void* library, FT_Char* font, FT_Long index, face* face ) ;
 
@@ -176,21 +176,19 @@ FUNCTION: FT_Error FT_Set_Char_Size ( face* face, FT_F26Dot6 char_width, FT_F26D
 
 FUNCTION: FT_Error FT_Load_Char ( face* face, FT_ULong charcode, FT_Int32 load_flags ) ;
 
-C-ENUM:
-    FT_RENDER_MODE_NORMAL
-    FT_RENDER_MODE_LIGHT
-    FT_RENDER_MODE_MONO
-    FT_RENDER_MODE_LCD
-    FT_RENDER_MODE_LCD_V ;
-
-C-ENUM:
-    FT_PIXEL_MODE_NONE
-    FT_PIXEL_MODE_MONO
-    FT_PIXEL_MODE_GRAY
-    FT_PIXEL_MODE_GRAY2
-    FT_PIXEL_MODE_GRAY4
-    FT_PIXEL_MODE_LCD
-    FT_PIXEL_MODE_LCD_V ;
+CONSTANT: FT_RENDER_MODE_NORMAL 0
+CONSTANT: FT_RENDER_MODE_LIGHT 1
+CONSTANT: FT_RENDER_MODE_MONO 2
+CONSTANT: FT_RENDER_MODE_LCD 3
+CONSTANT: FT_RENDER_MODE_LCD_V 4
+
+CONSTANT: FT_PIXEL_MODE_NONE 0
+CONSTANT: FT_PIXEL_MODE_MONO 1
+CONSTANT: FT_PIXEL_MODE_GRAY 2
+CONSTANT: FT_PIXEL_MODE_GRAY2 3
+CONSTANT: FT_PIXEL_MODE_GRAY4 4
+CONSTANT: FT_PIXEL_MODE_LCD 5
+CONSTANT: FT_PIXEL_MODE_LCD_V 6
 
 FUNCTION: int FT_Render_Glyph ( glyph* slot, int render_mode ) ;
 
diff --git a/extra/fries/authors.txt b/extra/fries/authors.txt
deleted file mode 100644 (file)
index ce0899f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Sam Anklesaria
\ No newline at end of file
diff --git a/extra/fries/fries.factor b/extra/fries/fries.factor
deleted file mode 100644 (file)
index 3f970a8..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-USING: arrays vectors combinators effects kernel math sequences splitting
-strings.parser parser fry sequences.extras ;
-
-! a b c glue => acb
-! c b a [ append ] dip prepend
-
-IN: fries
-: str-fry ( str on -- quot ) split
-    [ unclip-last [ [ [ append ] [ prepend ] bi* ] reduce-r ] 2curry ]
-    [ length 1 - 1 <effect> [ call-effect ] 2curry ] bi ;
-: gen-fry ( str on -- quot ) split
-    [ unclip-last [ [ [ 1array ] [ append ] [ prepend ] tri* ] reduce-r ] 2curry ]
-    [ length 1 - 1 <effect> [ call-effect ] 2curry ] bi ;
-
-SYNTAX: i" parse-string rest "_" str-fry append! ;
-SYNTAX: i{ \ } parse-until >array { _ } gen-fry append! ;
-SYNTAX: iV{ \ } parse-until >vector V{ _ } gen-fry append! ;
diff --git a/extra/fries/summary.txt b/extra/fries/summary.txt
deleted file mode 100644 (file)
index 44e9456..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Generalized Frying
\ No newline at end of file
index 2934d5d43c7de3c3c578a866a604be65f572c764..1c0dc9c480d9427890ec9baa7ab743d4806c9d7a 100644 (file)
@@ -55,14 +55,14 @@ SYMBOL: :uses-suggestions
 
 PRIVATE>
 
-: fuel-use-suggested-vocabs ( suggestions quot -- ... )
+: fuel-use-suggested-vocabs ( ..a suggestions quot: ( ..a -- ..b ) -- ..b )
     [ :uses-suggestions set ] dip
     [ try-suggested-restarts rethrow ] recover ; inline
 
 : fuel-run-file ( path -- )
     [ fuel-set-use-hook run-file ] curry with-scope ; inline
 
-: fuel-with-autouse ( ... quot: ( ... -- ... ) -- ... )
+: fuel-with-autouse ( ..a quot: ( ..a -- ..b ) -- ..b )
     [ auto-use? on fuel-set-use-hook call ] curry with-scope ; inline
 
 : fuel-get-uses ( lines -- )
@@ -162,6 +162,10 @@ PRIVATE>
     [ scaffold-summary ]
     [ drop [ vocab-summary-path ] keep swap vocab-append-path absolute-path fuel-eval-set-result ] 2bi ;
 
+: fuel-scaffold-platforms ( name platforms -- )
+    [ scaffold-platforms ]
+    [ drop [ vocab-platforms-path ] keep swap vocab-append-path absolute-path fuel-eval-set-result ] 2bi ;
+
 : fuel-scaffold-get-root ( name -- ) find-vocab-root fuel-eval-set-result ;
 
 ! Remote connection
index 39ba3bd2b3c286d45c8f4e0a19e4d56bcb286f46..649081ff03f1c80ea5626347ec949d4e25e59d38 100644 (file)
@@ -29,7 +29,7 @@ IN: fuel.xref
     [ word? ] filter [ word>xref ] map ;
 
 : filter-prefix ( seq prefix -- seq )
-    [ drop-prefix nip length 0 = ] curry filter prune ;
+    [ drop-prefix nip length 0 = ] curry filter members ;
 
 MEMO: (vocab-words) ( name -- seq )
     >vocab-link words [ name>> ] map ;
@@ -40,7 +40,7 @@ MEMO: (vocab-words) ( name -- seq )
     append H{ } [ assoc-union ] reduce keys ;
 
 : vocabs-words ( names -- seq )
-    prune [ (vocab-words) ] map concat ;
+    members [ (vocab-words) ] map concat ;
 
 PRIVATE>
 
diff --git a/extra/fullscreen/authors.txt b/extra/fullscreen/authors.txt
new file mode 100755 (executable)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/fullscreen/fullscreen.factor b/extra/fullscreen/fullscreen.factor
new file mode 100755 (executable)
index 0000000..56c1426
--- /dev/null
@@ -0,0 +1,142 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types arrays classes.struct fry kernel
+literals locals make math math.bitwise multiline sequences
+slots.syntax ui.backend.windows vocabs.loader windows.errors
+windows.gdi32 windows.kernel32 windows.types windows.user32
+ui.gadgets.worlds ;
+IN: fullscreen
+
+: hwnd>hmonitor ( HWND -- HMONITOR )
+    MONITOR_DEFAULTTOPRIMARY MonitorFromWindow ;
+
+: desktop-hmonitor ( -- HMONITOR )
+    GetDesktopWindow hwnd>hmonitor ;
+
+:: (monitor-info>devmodes) ( monitor-info n -- )
+    DEVMODE <struct>
+        DEVMODE heap-size >>dmSize
+        flags{ DM_BITSPERPEL DM_PELSWIDTH DM_PELSHEIGHT } >>dmFields
+    :> devmode
+
+    monitor-info szDevice>>
+    n
+    devmode
+    EnumDisplaySettings 0 = [
+        devmode ,
+        monitor-info n 1 + (monitor-info>devmodes)
+    ] unless ;
+
+: monitor-info>devmodes ( monito-info -- devmodes )
+    [ 0 (monitor-info>devmodes) ] { } make ;
+
+: hmonitor>monitor-info ( HMONITOR -- monitor-info )
+    MONITORINFOEX <struct>
+        MONITORINFOEX heap-size >>cbSize
+    [ GetMonitorInfo win32-error=0/f ] keep ;
+
+: hwnd>monitor-info ( HWND -- monitor-info )
+    hwnd>hmonitor hmonitor>monitor-info ;
+
+: hmonitor>devmodes ( HMONITOR -- devmodes )
+    hmonitor>monitor-info monitor-info>devmodes ;
+
+: desktop-devmodes ( -- DEVMODEs )
+    desktop-hmonitor hmonitor>devmodes ;
+
+: desktop-monitor-info ( -- monitor-info )
+    desktop-hmonitor hmonitor>monitor-info ;
+
+: desktop-RECT ( -- RECT )
+    GetDesktopWindow RECT <struct> [ GetWindowRect win32-error=0/f ] keep ;
+
+ERROR: display-change-error n ;
+
+: fullscreen-mode ( monitor-info devmode -- )
+    [ szDevice>> ] dip f CDS_FULLSCREEN f
+    ChangeDisplaySettingsEx dup DISP_CHANGE_SUCCESSFUL =
+    [ drop ] [ display-change-error ] if ;
+
+: non-fullscreen-mode ( monitor-info devmode -- )
+    [ szDevice>> ] dip f 0 f
+    ChangeDisplaySettingsEx dup DISP_CHANGE_SUCCESSFUL =
+    [ drop ] [ display-change-error ] if ;
+
+: get-style ( hwnd n -- style )
+    GetWindowLongPtr [ win32-error=0/f ] keep ;
+    
+: set-style ( hwnd n style -- )
+    SetWindowLongPtr win32-error=0/f ;
+
+: change-style ( hwnd n quot -- )
+    [ 2dup get-style ] dip call set-style ; inline
+
+: set-fullscreen-styles ( hwnd -- )
+    [ GWL_STYLE [ WS_OVERLAPPEDWINDOW unmask ] change-style ]
+    [ GWL_EXSTYLE [ flags{ WS_EX_APPWINDOW WS_EX_TOPMOST } bitor ] change-style ] bi ;
+
+: set-non-fullscreen-styles ( hwnd -- )
+    [ GWL_STYLE [ WS_OVERLAPPEDWINDOW bitor ] change-style ]
+    [ GWL_EXSTYLE [ flags{ WS_EX_APPWINDOW WS_EX_TOPMOST } unmask ] change-style ] bi ;
+
+ERROR: unsupported-resolution triple ;
+
+:: find-devmode ( triple hwnd -- devmode )
+    hwnd hwnd>hmonitor hmonitor>devmodes
+    [
+        slots{ dmPelsWidth dmPelsHeight dmBitsPerPel }
+        triple =
+    ] find nip [ triple unsupported-resolution ] unless* ;
+
+:: set-fullscreen-window-position ( hwnd triple -- )
+    hwnd f
+    desktop-monitor-info rcMonitor>> slots{ left top } first2
+    triple first2
+    flags{
+        SWP_NOACTIVATE SWP_NOCOPYBITS SWP_NOOWNERZORDER
+        SWP_NOREPOSITION SWP_NOZORDER
+    }
+    SetWindowPos win32-error=0/f ;
+
+:: enable-fullscreen ( triple hwnd -- rect )
+    hwnd hwnd>RECT :> rect
+    
+    desktop-monitor-info
+    triple GetDesktopWindow find-devmode
+    hwnd set-fullscreen-styles
+    fullscreen-mode
+
+    hwnd triple set-fullscreen-window-position
+    rect ;
+
+:: set-window-position ( hwnd rect -- )
+    hwnd f rect get-RECT-dimensions SWP_FRAMECHANGED
+    SetWindowPos win32-error=0/f ;
+
+:: disable-fullscreen ( rect triple hwnd -- )
+    desktop-monitor-info
+    triple
+    GetDesktopWindow find-devmode non-fullscreen-mode
+    hwnd set-non-fullscreen-styles
+    hwnd rect set-window-position ;
+
+: enable-factor-fullscreen ( triple -- rect )
+    GetForegroundWindow enable-fullscreen ;
+
+: disable-factor-fullscreen ( rect triple -- )
+    GetForegroundWindow disable-fullscreen ;
+
+:: (set-fullscreen) ( world triple fullscreen? -- )
+    world fullscreen?>> fullscreen? xor [
+        triple
+        world handle>> hWnd>>
+        fullscreen? [
+            enable-fullscreen world saved-position<<
+        ] [
+            [ world saved-position>> ] 2dip disable-fullscreen
+        ] if
+        fullscreen? world fullscreen?<<
+    ] when ;
+
+: set-fullscreen ( gadget triple fullscreen? -- )
+    [ find-world ] 2dip (set-fullscreen) ;
diff --git a/extra/fullscreen/platforms.txt b/extra/fullscreen/platforms.txt
new file mode 100644 (file)
index 0000000..8e1a559
--- /dev/null
@@ -0,0 +1 @@
+windows
diff --git a/extra/game/debug/authors.txt b/extra/game/debug/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/game/debug/debug.factor b/extra/game/debug/debug.factor
new file mode 100644 (file)
index 0000000..a4f4895
--- /dev/null
@@ -0,0 +1,212 @@
+! Copyright (C) 2010 Erik Charlebois
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types arrays circular colors colors.constants
+columns destructors fonts gpu.buffers gpu.render gpu.shaders gpu.state
+gpu.textures images kernel literals locals make math math.constants
+math.functions math.vectors sequences specialized-arrays typed ui.text fry ;
+FROM: alien.c-types => float ;
+SPECIALIZED-ARRAYS: float uint ;
+IN: game.debug
+
+<PRIVATE
+! Vertex shader for debug shapes
+GLSL-SHADER: debug-shapes-vertex-shader vertex-shader
+uniform   mat4 u_mvp_matrix;
+attribute vec3 a_position;
+attribute vec3 a_color;
+varying   vec3 v_color;
+void main()
+{
+    gl_Position = u_mvp_matrix * vec4(a_position, 1.0);
+    gl_PointSize = 5.0;
+    v_color = a_color;
+}
+;
+
+GLSL-SHADER: debug-shapes-fragment-shader fragment-shader
+varying vec3 v_color;
+void main()
+{
+    gl_FragColor = vec4(v_color, 1.0);
+}
+;
+
+VERTEX-FORMAT: debug-shapes-vertex-format
+    { "a_position" float-components 3 f }
+    { "a_color"    float-components 3 f } ;
+
+UNIFORM-TUPLE: debug-shapes-uniforms
+    { "u_mvp_matrix" mat4-uniform f } ;
+
+GLSL-PROGRAM: debug-shapes-program debug-shapes-vertex-shader
+debug-shapes-fragment-shader debug-shapes-vertex-format ;
+
+! Vertex shader for debug text
+GLSL-SHADER: debug-text-vertex-shader vertex-shader
+attribute vec2 a_position;
+attribute vec2 a_texcoord;
+varying   vec2 v_texcoord;
+void main()
+{
+    gl_Position = vec4(a_position, 0.0, 1.0);
+    v_texcoord  = a_texcoord;
+}
+;
+
+GLSL-SHADER: debug-text-fragment-shader fragment-shader
+uniform sampler2D u_text_map;
+uniform vec3 u_background_color;
+varying vec2 v_texcoord;
+void main()
+{
+    vec4 c = texture2D(u_text_map, v_texcoord);
+    if (c.xyz == u_background_color)
+        discard;
+    else
+        gl_FragColor = c;
+}
+;
+
+VERTEX-FORMAT: debug-text-vertex-format
+    { "a_position" float-components 2 f }
+    { "a_texcoord" float-components 2 f } ;
+
+UNIFORM-TUPLE: debug-text-uniforms
+    { "u_text_map"         texture-uniform f }
+    { "u_background_color" vec3-uniform    f } ;
+
+GLSL-PROGRAM: debug-text-program debug-text-vertex-shader
+debug-text-fragment-shader debug-text-vertex-format ;
+
+CONSTANT: debug-text-font
+    T{ font 
+       { name       "monospace"  }
+       { size       16           }
+       { bold?      f            }
+       { italic?    f            }
+       { foreground COLOR: white }
+       { background COLOR: black } }
+       
+CONSTANT: debug-text-texture-parameters       
+    T{ texture-parameters
+       { wrap              repeat-texcoord }
+       { min-filter        filter-linear   }
+       { min-mipmap-filter f               } }
+       
+: text>image ( string color -- image )      
+    debug-text-font clone swap >>foreground swap string>image drop ;
+
+:: image>texture ( image -- texture )
+    image [ component-order>> ] [ component-type>> ] bi
+    debug-text-texture-parameters <texture-2d> &dispose
+    [ 0 image allocate-texture-image ] keep ;
+
+:: screen-quad ( image pt dim -- float-array )
+    pt dim v/ 2.0 v*n 1.0 v-n
+    dup image dim>> dim v/ 2.0 v*n v+
+    [ first2 ] bi@ :> ( x0 y0 x1 y1 )
+    image upside-down?>>
+    [ { x0 y0 0 0 x1 y0 1 0 x1 y1 1 1 x0 y1 0 1 } ]
+    [ { x0 y0 0 1 x1 y0 1 1 x1 y1 1 0 x0 y1 0 0 } ]
+    if >float-array ;
+
+: debug-text-uniform-variables ( string color -- image uniforms )
+    text>image dup image>texture
+    float-array{ 0.0 0.0 0.0 }
+    debug-text-uniforms boa swap ;
+
+: debug-text-vertex-array ( image pt dim -- vertex-array )
+    screen-quad stream-upload draw-usage vertex-buffer byte-array>buffer &dispose
+    debug-text-program <program-instance> <vertex-array> &dispose ;
+: debug-text-index-buffer ( -- index-buffer )
+    uint-array{ 0 1 2 2 3 0 } stream-upload draw-usage index-buffer
+    byte-array>buffer &dispose 0 <buffer-ptr> 6 uint-indexes <index-elements> ;
+
+: debug-text-render ( uniforms vertex-array index-buffer -- )
+    [
+        {
+            { "primitive-mode" [ 3drop triangles-mode ] }
+            { "uniforms"       [ 2drop ] }
+            { "vertex-array"   [ drop nip ] }
+            { "indexes"        [ 2nip ] }
+        } 3<render-set> render
+    ] with-destructors ;
+
+: debug-shapes-vertex-array ( sequence -- vertex-array )
+    stream-upload draw-usage vertex-buffer byte-array>buffer &dispose
+    debug-shapes-program <program-instance> &dispose <vertex-array> &dispose ;
+
+: draw-debug-primitives ( mode primitives mvp-matrix -- )
+    f origin-upper-left 1.0 <point-state> set-gpu-state
+    {
+        { "primitive-mode"     [ 2drop ] }
+        { "uniforms"           [ 2nip debug-shapes-uniforms boa ] }
+        { "vertex-array"       [ drop nip debug-shapes-vertex-array ] }
+        { "indexes"            [ drop nip length 0 swap <index-range> ] }
+    } 3<render-set> render ;
+
+CONSTANT: box-vertices
+    { { {  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 } } }
+      
+CONSTANT: cylinder-vertices
+    $[ 12 iota [ 2pi 12 / * [ cos ] [ drop 0.0 ] [ sin ] tri 3array ] map ]
+    
+:: scale-cylinder-vertices ( radius half-height verts -- bot-verts top-verts )
+    verts
+    [ [ radius v*n { 0 half-height 0 } v- ] map ]
+    [ [ radius v*n { 0 half-height 0 } v+ ] map ] bi ;
+PRIVATE>
+
+: debug-point ( pt color -- )
+    [ first3 [ , ] tri@ ]
+    [ [ red>> , ] [ green>> , ] [ blue>> , ] tri ]
+    bi* ; inline
+
+: debug-line ( from to color -- )
+    dup swapd [ debug-point ] 2bi@ ; inline
+
+: debug-axes ( pt mat -- )
+    [ 0 <column> normalize over v+ COLOR: red debug-line ]
+    [ 1 <column> normalize over v+ COLOR: green debug-line ]
+    [ 2 <column> normalize over v+ COLOR: blue debug-line ]
+    2tri ; inline
+        
+:: debug-box ( pt half-widths color -- )
+    box-vertices [
+        first2 [ half-widths v* pt v+ ] bi@ color debug-line
+    ] each ; inline
+
+:: debug-circle ( points color -- )
+    points dup <circular> [ 1 swap change-circular-start ] keep
+    [ color debug-line ] 2each ; inline
+
+:: debug-cylinder ( pt half-height radius color -- )
+    radius half-height cylinder-vertices scale-cylinder-vertices
+    [ [ color debug-circle ] bi@ ]
+    [ color '[ _ debug-line ] 2each ] 2bi ; inline
+
+TYPED: draw-debug-lines ( lines: float-array mvp-matrix -- )
+    [ lines-mode -rot draw-debug-primitives ] with-destructors ; inline
+
+TYPED: draw-debug-points ( points: float-array mvp-matrix -- )
+    [ points-mode -rot draw-debug-primitives ] with-destructors ; inline
+        
+TYPED: draw-text ( string color: rgba pt dim -- )
+    [
+        [ debug-text-uniform-variables ] 2dip
+        debug-text-vertex-array
+        debug-text-index-buffer
+        debug-text-render
+    ] with-destructors ; inline
diff --git a/extra/game/debug/summary.txt b/extra/game/debug/summary.txt
new file mode 100644 (file)
index 0000000..1f772ef
--- /dev/null
@@ -0,0 +1 @@
+Simple shape rendering for visual debugging.
diff --git a/extra/game/debug/tags.txt b/extra/game/debug/tags.txt
new file mode 100644 (file)
index 0000000..84d4140
--- /dev/null
@@ -0,0 +1 @@
+games
diff --git a/extra/game/debug/tests/tests.factor b/extra/game/debug/tests/tests.factor
new file mode 100644 (file)
index 0000000..817379b
--- /dev/null
@@ -0,0 +1,68 @@
+! Copyright (C) 2010 Erik Charlebois
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors colors.constants game.loop game.worlds gpu
+gpu.framebuffers gpu.util.wasd game.debug kernel literals locals
+make math math.constants math.matrices math.parser sequences
+alien.c-types specialized-arrays ui.gadgets.worlds ui.pixel-formats ;
+FROM: alien.c-types => float ;
+SPECIALIZED-ARRAY: float
+IN: game.debug.tests
+
+:: clear-screen ( color -- )
+    system-framebuffer {
+        { default-attachment color }
+    } clear-framebuffer ;
+
+: deg>rad ( d -- r )
+    180 / pi * ;
+
+:: draw-debug-tests ( world -- )
+    world [ wasd-p-matrix ] [ wasd-mv-matrix ] bi m. :> mvp-matrix
+    { 0 0 0 } clear-screen
+    
+    [
+        { 0 0 0 } { 1 0 0 } COLOR: red   debug-line
+        { 0 0 0 } { 0 1 0 } COLOR: green debug-line
+        { 0 0 0 } { 0 0 1 } COLOR: blue  debug-line
+        { -1.2 0 0 } { 0 1 0 } 0 deg>rad rotation-matrix3 debug-axes
+        { 3 5 -2 } { 3 2 1 } COLOR: white debug-box
+        { 0 9 0 } 8 2 COLOR: blue debug-cylinder
+    ] float-array{ } make
+    mvp-matrix draw-debug-lines
+
+    [
+        { 0 4.0 0 } COLOR: red debug-point
+        { 0 4.1 0 } COLOR: green debug-point
+        { 0 4.2 0 } COLOR: blue debug-point
+    ] float-array{ } make
+    mvp-matrix draw-debug-points
+
+    "Frame: " world frame-number>> number>string append
+    COLOR: purple { 5 5 } world dim>> draw-text
+    world [ 1 + ] change-frame-number drop ;
+
+TUPLE: tests-world < wasd-world frame-number ;
+M: tests-world draw-world* draw-debug-tests ;
+M: tests-world wasd-movement-speed drop 1/16. ;
+M: tests-world wasd-near-plane drop 1/32. ;
+M: tests-world wasd-far-plane drop 1024.0 ;
+M: tests-world begin-game-world
+    init-gpu
+    0 >>frame-number
+    { 0.0 0.0 2.0 } 0 0 set-wasd-view drop ;
+
+GAME: run-tests {
+        { world-class tests-world }
+        { title "game.debug.tests" }
+        { pixel-format-attributes {
+            windowed
+            double-buffered
+            T{ depth-bits { value 24 } }
+        } }
+        { grab-input? t }
+        { use-game-input? t }
+        { pref-dim { 1024 768 } }
+        { tick-interval-nanos $[ 60 fps ] }
+    } ;
+
+MAIN: run-tests
diff --git a/extra/game/input/demos/joysticks/authors.txt b/extra/game/input/demos/joysticks/authors.txt
new file mode 100644 (file)
index 0000000..f13c9c1
--- /dev/null
@@ -0,0 +1 @@
+Joe Groff
diff --git a/extra/game/input/demos/joysticks/deploy.factor b/extra/game/input/demos/joysticks/deploy.factor
new file mode 100644 (file)
index 0000000..8ef5231
--- /dev/null
@@ -0,0 +1,13 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-name "joystick-demo" }
+    { deploy-io 2 }
+    { deploy-word-defs? f }
+    { deploy-c-types? t }
+    { deploy-word-props? f }
+    { deploy-reflection 1 }
+    { deploy-threads? t }
+    { deploy-math? t }
+    { "stop-after-last-window?" t }
+    { deploy-ui? t }
+}
diff --git a/extra/game/input/demos/joysticks/joysticks.factor b/extra/game/input/demos/joysticks/joysticks.factor
new file mode 100644 (file)
index 0000000..ab65369
--- /dev/null
@@ -0,0 +1,145 @@
+USING: ui ui.gadgets sequences kernel arrays math colors
+colors.constants ui.render ui.pens.polygon ui.pens.solid math.vectors
+accessors fry ui.gadgets.packs game.input ui.gadgets.labels
+ui.gadgets.borders alarms calendar locals strings ui.gadgets.buttons
+combinators math.parser assocs threads ;
+IN: game.input.demos.joysticks
+
+CONSTANT: SIZE { 151 151 }
+CONSTANT: INDICATOR-SIZE { 4 4 }
+: FREQUENCY ( -- f ) 30 recip seconds ;
+
+TUPLE: axis-gadget < gadget indicator z-indicator pov ;
+
+M: axis-gadget pref-dim* drop SIZE ;
+
+: (rect-polygon) ( lo hi -- polygon )
+    2dup
+    [ [ second ] [ first  ] bi* swap 2array ]
+    [ [ first  ] [ second ] bi*      2array ] 2bi swapd 4array ;
+
+: indicator-polygon ( -- polygon )
+    { 0 0 } INDICATOR-SIZE (rect-polygon) ;
+
+CONSTANT: pov-polygons
+    V{
+        { pov-neutral    { { 70 75 } { 75 70 } { 80 75 } { 75 80 } } }
+        { pov-up         { { 70 65 } { 75 60 } { 80 65 } } }
+        { pov-up-right   { { 83 60 } { 90 60 } { 90 67 } } }
+        { pov-right      { { 85 70 } { 90 75 } { 85 80 } } }
+        { pov-down-right { { 90 83 } { 90 90 } { 83 90 } } }
+        { pov-down       { { 70 85 } { 75 90 } { 80 85 } } }
+        { pov-down-left  { { 67 90 } { 60 90 } { 60 83 } } }
+        { pov-left       { { 65 70 } { 60 75 } { 65 80 } } }
+        { pov-up-left    { { 67 60 } { 60 60 } { 60 67 } } }
+    }
+
+: <indicator-gadget> ( color -- indicator )
+    indicator-polygon <polygon-gadget> ;
+
+: (>loc) ( axisloc -- windowloc )
+    0.5 v*n { 0.5 0.5 } v+ SIZE v* [ >integer ] map
+    INDICATOR-SIZE 2 v/n v- ;
+
+: (xy>loc) ( x y -- xyloc )
+    2array (>loc) ;
+: (z>loc) ( z -- zloc )
+    0.0 swap 2array (>loc) ;
+
+: (xyz>loc) ( x y z -- xyloc zloc )
+    [ [ 0.0 ] unless* ] tri@
+    [ (xy>loc) ] dip (z>loc) ;
+
+:: move-axis ( gadget x y z -- )
+    x y z (xyz>loc) :> ( xy z )
+    xy gadget   indicator>> loc<<
+    z  gadget z-indicator>> loc<< ;
+
+: move-pov ( gadget pov -- )
+    swap pov>> [ interior>> -rot = COLOR: gray COLOR: white ? >>color drop ]
+    with assoc-each ;
+
+:: add-pov-gadget ( gadget direction polygon -- gadget direction gadget )
+    gadget COLOR: white polygon <polygon-gadget> [ add-gadget ] keep
+    direction swap ;
+
+: add-pov-gadgets ( gadget -- gadget )
+    pov-polygons [ add-pov-gadget ] assoc-map >>pov ;
+
+: <axis-gadget> ( -- gadget )
+    axis-gadget new
+    add-pov-gadgets
+    COLOR: black <indicator-gadget> [ >>z-indicator ] [ add-gadget ] bi
+    COLOR: red   <indicator-gadget> [ >>indicator   ] [ add-gadget ] bi
+    dup [ 0.0 0.0 0.0 move-axis ] [ f move-pov ] bi ;
+
+TUPLE: joystick-demo-gadget < pack axis raxis controller buttons alarm ;
+
+: add-gadget-with-border ( parent child -- parent )
+    { 2 2 } <border> COLOR: gray <solid> >>boundary add-gadget ;
+
+: add-controller-label ( gadget controller -- gadget )
+    [ >>controller ] [ product-string <label> add-gadget ] bi ;
+
+: add-axis-gadget ( gadget shelf -- gadget shelf )
+    <axis-gadget> [ >>axis ] [ add-gadget-with-border ] bi-curry bi* ;
+
+: add-raxis-gadget ( gadget shelf -- gadget shelf )
+    <axis-gadget> [ >>raxis ] [ add-gadget-with-border ] bi-curry bi* ;
+
+:: (add-button-gadgets) ( gadget shelf -- )
+    gadget controller>> read-controller buttons>> length iota [
+        number>string [ drop ] <border-button>
+        shelf over add-gadget drop
+    ] map gadget buttons<< ;
+
+: add-button-gadgets ( gadget shelf -- gadget shelf )
+    [ (add-button-gadgets) ] 2keep ;
+
+: <joystick-demo-gadget> ( controller -- gadget )
+    joystick-demo-gadget new
+    { 0 1 } >>orientation
+    swap add-controller-label
+    <shelf> add-axis-gadget add-raxis-gadget add-gadget
+    <shelf> add-button-gadgets add-gadget ;
+
+: update-buttons ( buttons button-states -- )
+    [ >>selected? drop ] 2each ;
+
+: kill-update-axes ( gadget -- )
+    COLOR: gray <solid> >>interior
+    [ [ stop-alarm ] when* f ] change-alarm
+    relayout-1 ;
+
+: (update-axes) ( gadget controller-state -- )
+    {
+        [ [ axis>>  ] [ [ x>>  ] [ y>>  ] [ z>>  ] tri ] bi* move-axis ]
+        [ [ raxis>> ] [ [ rx>> ] [ ry>> ] [ rz>> ] tri ] bi* move-axis ]
+        [ [ axis>>  ] [ pov>> ] bi* move-pov ]
+        [ [ buttons>> ] [ buttons>> ] bi* update-buttons ]
+        [ drop relayout-1 ]
+    } 2cleave ;
+
+: update-axes ( gadget -- )
+    dup controller>> read-controller
+    [ (update-axes) ] [ kill-update-axes ] if* ;
+
+M: joystick-demo-gadget graft*
+    dup '[ _ update-axes ] FREQUENCY every >>alarm
+    drop ;
+
+M: joystick-demo-gadget ungraft*
+    alarm>> [ stop-alarm ] when* ;
+
+: joystick-window ( controller -- )
+    [ <joystick-demo-gadget> ] [ product-string ] bi
+    open-window ;
+
+: joystick-demo ( -- )
+    [
+        open-game-input
+        100 milliseconds sleep ! It might take a moment to find devices...
+        get-controllers [ joystick-window ] each
+    ] with-ui ;
+
+MAIN: joystick-demo
diff --git a/extra/game/input/demos/joysticks/summary.txt b/extra/game/input/demos/joysticks/summary.txt
new file mode 100644 (file)
index 0000000..e10653c
--- /dev/null
@@ -0,0 +1 @@
+Demonstrate gamepad and joystick input
diff --git a/extra/game/input/demos/joysticks/tags.txt b/extra/game/input/demos/joysticks/tags.txt
new file mode 100755 (executable)
index 0000000..84d4140
--- /dev/null
@@ -0,0 +1 @@
+games
diff --git a/extra/game/input/demos/key-caps/authors.txt b/extra/game/input/demos/key-caps/authors.txt
new file mode 100644 (file)
index 0000000..f13c9c1
--- /dev/null
@@ -0,0 +1 @@
+Joe Groff
diff --git a/extra/game/input/demos/key-caps/key-caps.factor b/extra/game/input/demos/key-caps/key-caps.factor
new file mode 100644 (file)
index 0000000..363c7c8
--- /dev/null
@@ -0,0 +1,177 @@
+USING: game.input game.input.scancodes
+kernel ui.gadgets ui.gadgets.buttons sequences accessors
+words arrays assocs math calendar fry alarms ui
+ui.gadgets.borders ui.gestures literals ;
+IN: game.input.demos.key-caps
+
+CONSTANT: key-locations H{
+    { key-escape        { {   0   0 } {  10  10 } } }
+
+    { key-f1            { {  20   0 } {  10  10 } } }
+    { key-f2            { {  30   0 } {  10  10 } } }
+    { key-f3            { {  40   0 } {  10  10 } } }
+    { key-f4            { {  50   0 } {  10  10 } } }
+
+    { key-f5            { {  65   0 } {  10  10 } } }
+    { key-f6            { {  75   0 } {  10  10 } } }
+    { key-f7            { {  85   0 } {  10  10 } } }
+    { key-f8            { {  95   0 } {  10  10 } } }
+
+    { key-f9            { { 110   0 } {  10  10 } } }
+    { key-f10           { { 120   0 } {  10  10 } } }
+    { key-f11           { { 130   0 } {  10  10 } } }
+    { key-f12           { { 140   0 } {  10  10 } } }
+
+
+    { key-`             { {   0  15 } {  10  10 } } }
+    { key-1             { {  10  15 } {  10  10 } } }
+    { key-2             { {  20  15 } {  10  10 } } }
+    { key-3             { {  30  15 } {  10  10 } } }
+    { key-4             { {  40  15 } {  10  10 } } }
+    { key-5             { {  50  15 } {  10  10 } } }
+    { key-6             { {  60  15 } {  10  10 } } }
+    { key-7             { {  70  15 } {  10  10 } } }
+    { key-8             { {  80  15 } {  10  10 } } }
+    { key-9             { {  90  15 } {  10  10 } } }
+    { key-0             { { 100  15 } {  10  10 } } }
+    { key--             { { 110  15 } {  10  10 } } }
+    { key-=             { { 120  15 } {  10  10 } } }
+    { key-backspace     { { 130  15 } {  20  10 } } }
+
+    { key-tab           { {   0  25 } {  15  10 } } }
+    { key-q             { {  15  25 } {  10  10 } } }
+    { key-w             { {  25  25 } {  10  10 } } }
+    { key-e             { {  35  25 } {  10  10 } } }
+    { key-r             { {  45  25 } {  10  10 } } }
+    { key-t             { {  55  25 } {  10  10 } } }
+    { key-y             { {  65  25 } {  10  10 } } }
+    { key-u             { {  75  25 } {  10  10 } } }
+    { key-i             { {  85  25 } {  10  10 } } }
+    { key-o             { {  95  25 } {  10  10 } } }
+    { key-p             { { 105  25 } {  10  10 } } }
+    { key-[             { { 115  25 } {  10  10 } } }
+    { key-]             { { 125  25 } {  10  10 } } }
+    { key-\             { { 135  25 } {  15  10 } } }
+
+    { key-caps-lock     { {   0  35 } {  20  10 } } }
+    { key-a             { {  20  35 } {  10  10 } } }
+    { key-s             { {  30  35 } {  10  10 } } }
+    { key-d             { {  40  35 } {  10  10 } } }
+    { key-f             { {  50  35 } {  10  10 } } }
+    { key-g             { {  60  35 } {  10  10 } } }
+    { key-h             { {  70  35 } {  10  10 } } }
+    { key-j             { {  80  35 } {  10  10 } } }
+    { key-k             { {  90  35 } {  10  10 } } }
+    { key-l             { { 100  35 } {  10  10 } } }
+    { key-;             { { 110  35 } {  10  10 } } }
+    { key-'             { { 120  35 } {  10  10 } } }
+    { key-return        { { 130  35 } {  20  10 } } }
+
+    { key-left-shift    { {   0  45 } {  25  10 } } }
+    { key-z             { {  25  45 } {  10  10 } } }
+    { key-x             { {  35  45 } {  10  10 } } }
+    { key-c             { {  45  45 } {  10  10 } } }
+    { key-v             { {  55  45 } {  10  10 } } }
+    { key-b             { {  65  45 } {  10  10 } } }
+    { key-n             { {  75  45 } {  10  10 } } }
+    { key-m             { {  85  45 } {  10  10 } } }
+    { key-,             { {  95  45 } {  10  10 } } }
+    { key-.             { { 105  45 } {  10  10 } } }
+    { key-/             { { 115  45 } {  10  10 } } }
+    { key-right-shift   { { 125  45 } {  25  10 } } }
+
+    { key-left-control  { {   0  55 } {  15  10 } } }
+    { key-left-gui      { {  15  55 } {  15  10 } } }
+    { key-left-alt      { {  30  55 } {  15  10 } } }
+    { key-space         { {  45  55 } {  45  10 } } }
+    { key-right-alt     { {  90  55 } {  15  10 } } }
+    { key-right-gui     { { 105  55 } {  15  10 } } }
+    { key-application   { { 120  55 } {  15  10 } } }
+    { key-right-control { { 135  55 } {  15  10 } } }
+
+
+    { key-print-screen  { { 155   0 } {  10  10 } } }
+    { key-scroll-lock   { { 165   0 } {  10  10 } } }
+    { key-pause         { { 175   0 } {  10  10 } } }
+    
+    { key-insert        { { 155  15 } {  10  10 } } }
+    { key-home          { { 165  15 } {  10  10 } } }
+    { key-page-up       { { 175  15 } {  10  10 } } }
+
+    { key-delete        { { 155  25 } {  10  10 } } }
+    { key-end           { { 165  25 } {  10  10 } } }
+    { key-page-down     { { 175  25 } {  10  10 } } }
+
+    { key-up-arrow      { { 165  45 } {  10  10 } } }
+    { key-left-arrow    { { 155  55 } {  10  10 } } }
+    { key-down-arrow    { { 165  55 } {  10  10 } } }
+    { key-right-arrow   { { 175  55 } {  10  10 } } }
+
+
+    { key-keypad-numlock { { 190 15 } {  10  10 } } }
+    { key-keypad-/       { { 200 15 } {  10  10 } } }
+    { key-keypad-*       { { 210 15 } {  10  10 } } }
+    { key-keypad--       { { 220 15 } {  10  10 } } }
+
+    { key-keypad-7       { { 190 25 } {  10  10 } } }
+    { key-keypad-8       { { 200 25 } {  10  10 } } }
+    { key-keypad-9       { { 210 25 } {  10  10 } } }
+    { key-keypad-+       { { 220 25 } {  10  20 } } }
+
+    { key-keypad-4       { { 190 35 } {  10  10 } } }
+    { key-keypad-5       { { 200 35 } {  10  10 } } }
+    { key-keypad-6       { { 210 35 } {  10  10 } } }
+
+    { key-keypad-1       { { 190 45 } {  10  10 } } }
+    { key-keypad-2       { { 200 45 } {  10  10 } } }
+    { key-keypad-3       { { 210 45 } {  10  10 } } }
+    { key-keypad-enter   { { 220 45 } {  10  20 } } }
+
+    { key-keypad-0       { { 190 55 } {  20  10 } } }
+    { key-keypad-.       { { 210 55 } {  10  10 } } }
+}
+
+CONSTANT: KEYBOARD-SIZE { 230 65 }
+CONSTANT: FREQUENCY $[ 1/30 seconds ]
+
+TUPLE: key-caps-gadget < gadget keys alarm ;
+
+: make-key-gadget ( scancode dim array -- )
+    [ 
+        swap [ 
+            " " [ drop ] <border-button>
+            swap [ first >>loc ] [ second >>dim ] bi
+        ] [ execute( -- value ) ] bi*
+    ] dip set-nth ;
+
+: add-keys-gadgets ( gadget -- gadget )
+    key-locations 256 f <array>
+    [ [ make-key-gadget ] curry assoc-each ]
+    [ [ [ add-gadget ] when* ] each ] 
+    [ >>keys ] tri ;
+
+: <key-caps-gadget> ( -- gadget )
+    key-caps-gadget new
+    add-keys-gadgets ;
+
+M: key-caps-gadget pref-dim* drop KEYBOARD-SIZE ;
+
+: update-key-caps-state ( gadget -- )
+    read-keyboard keys>> over keys>> 
+    [ [ selected?<< ] [ drop ] if* ] 2each 
+    relayout-1 ;
+
+M: key-caps-gadget graft*
+    open-game-input
+    dup '[ _ update-key-caps-state ] FREQUENCY every >>alarm
+    drop ;
+
+M: key-caps-gadget ungraft*
+    alarm>> [ stop-alarm ] when*
+    close-game-input ;
+
+M: key-caps-gadget handle-gesture
+    drop [ key-down? ] [ key-up? ] bi or not ;
+
+MAIN-WINDOW: key-caps { { title "Key Caps" } }
+    <key-caps-gadget> { 5 5 } <border> >>gadgets ;
diff --git a/extra/game/input/demos/key-caps/summary.txt b/extra/game/input/demos/key-caps/summary.txt
new file mode 100644 (file)
index 0000000..f7d7a2c
--- /dev/null
@@ -0,0 +1 @@
+Graphical keyboard diagram
diff --git a/extra/game/input/demos/key-caps/tags.txt b/extra/game/input/demos/key-caps/tags.txt
new file mode 100755 (executable)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
index b48f01cd82138197e7da2b05d31c7d65603e4f2b..1605c45284795ccab6db5241c145f46da237cf09 100644 (file)
@@ -3,24 +3,24 @@ USING: help.markup help.syntax kernel math ui.gadgets.worlds ;
 IN: game.loop
 
 HELP: fps
-{ $values { "fps" real } { "micros" integer } }
-{ $description "Converts a frames per second value into an interval length in microseconds." } ;
+{ $values { "fps" real } { "nanos" integer } }
+{ $description "Converts a frames per second value into an interval length in nanoseconds." } ;
 
 HELP: <game-loop>
 { $values
-    { "tick-interval-micros" integer } { "delegate" "a " { $link "game.loop-delegates" } }
+    { "tick-interval-nanos" integer } { "delegate" "a " { $link "game.loop-delegates" } }
     { "loop" game-loop }
 }
-{ $description "Constructs a new stopped " { $link game-loop } " object. When started, the game loop will call the " { $link tick* } " method on the " { $snippet "delegate" } " every " { $snippet "tick-interval-micros" } " microseconds, and " { $link draw* } " on the same delegate object as frequently as possible. The " { $link start-loop } " and " { $link stop-loop } " words start and stop the game loop."
+{ $description "Constructs a new stopped " { $link game-loop } " object. When started, the game loop will call the " { $link tick* } " method on the " { $snippet "delegate" } " every " { $snippet "tick-interval-nanos" } " nanoseconds, and " { $link draw* } " on the same delegate object as frequently as possible. The " { $link start-loop } " and " { $link stop-loop } " words start and stop the game loop."
 $nl
 "To initialize the game loop with separate tick and draw delegates, use " { $link <game-loop*> } "." } ;
 
 HELP: <game-loop*>
 { $values
-    { "tick-interval-micros" integer } { "tick-delegate" "a " { $link "game.loop-delegates" } } { "draw-delegate" "a " { $link "game.loop-delegates" } }
+    { "tick-interval-nanos" integer } { "tick-delegate" "a " { $link "game.loop-delegates" } } { "draw-delegate" "a " { $link "game.loop-delegates" } }
     { "loop" game-loop }
 }
-{ $description "Constructs a new stopped " { $link game-loop } " object. When started, the game loop will call the " { $link tick* } " method on the " { $snippet "tick-delegate" } " every " { $snippet "tick-interval-micros" } " microseconds, and " { $link draw* } " on the " { $snippet "draw-delegate" } " as frequently as possible. The " { $link start-loop } " and " { $link stop-loop } " words start and stop the game loop."
+{ $description "Constructs a new stopped " { $link game-loop } " object. When started, the game loop will call the " { $link tick* } " method on the " { $snippet "tick-delegate" } " every " { $snippet "tick-interval-nanos" } " nanoseconds, and " { $link draw* } " on the " { $snippet "draw-delegate" } " as frequently as possible. The " { $link start-loop } " and " { $link stop-loop } " words start and stop the game loop."
 $nl
 "The " { $link <game-loop> } " word provides a shorthand for initializing a game loop that uses the same object for the " { $snippet "tick-delegate" } " and " { $snippet "draw-delegate" } "." } ;
 
@@ -46,7 +46,7 @@ HELP: draw*
 { $values
     { "tick-slice" float } { "delegate" "a " { $link "game.loop-delegates" } }
 }
-{ $description "This generic word is called by a " { $link game-loop } " on its " { $snippet "draw-delegate" } " object in a tight loop while the game loop is running. The " { $snippet "tick-slice" } " value represents what fraction of the game loop's " { $snippet "tick-interval-micros" } " time period has passed since " { $link tick* } " was most recently called on the " { $snippet "tick-delegate" } "." } ;
+{ $description "This generic word is called by a " { $link game-loop } " on its " { $snippet "draw-delegate" } " object in a tight loop while the game loop is running. The " { $snippet "tick-slice" } " value represents what fraction of the game loop's " { $snippet "tick-interval-nanos" } " time period has passed since " { $link tick* } " was most recently called on the " { $snippet "tick-delegate" } "." } ;
 
 HELP: game-loop
 { $class-description "Objects of the " { $snippet "game-loop" } " class manage game loops. See " { $link "game.loop" } " for an overview of the game loop library. To construct a game loop, use " { $link <game-loop> } ". To start and stop a game loop, use the " { $link start-loop } " and " { $link stop-loop } " words."
@@ -83,7 +83,7 @@ HELP: tick*
 { $values
     { "delegate" "a " { $link "game.loop-delegates" } }
 }
-{ $description "This generic word is called by a " { $link game-loop } " on its " { $snippet "tick-delegate" } " object at regular intervals while the game loop is running. The game loop's " { $snippet "tick-interval-micros" } " attribute determines the number of microseconds between invocations of " { $snippet "tick*" } "." } ;
+{ $description "This generic word is called by a " { $link game-loop } " on its " { $snippet "tick-delegate" } " object at regular intervals while the game loop is running. The game loop's " { $snippet "tick-interval-nanos" } " attribute determines the number of nanoseconds between invocations of " { $snippet "tick*" } "." } ;
 
 { draw* tick* } related-words
 
@@ -93,7 +93,7 @@ ARTICLE: "game.loop-delegates" "Game loop delegate"
     tick*
     draw*
 }
-{ $snippet "tick*" } " will be called at a regular interval determined by the game loop's " { $snippet "tick-interval-micros" } " attribute on the tick delegate. " { $snippet "draw*" } " will be invoked on the draw delegate in a tight loop, updating as frequently as possible."
+{ $snippet "tick*" } " will be called at a regular interval determined by the game loop's " { $snippet "tick-interval-nanos" } " attribute on the tick delegate. " { $snippet "draw*" } " will be invoked on the draw delegate in a tight loop, updating as frequently as possible."
 $nl
 "It is possible to change the " { $snippet "tick-delegate" } " and " { $snippet "draw-delegate" } " slots of a game loop while it is running, for example, to use different delegates to control a game while it's in the menu, paused, or running the main game." ;
 
index 9e46535b4eebf12d3c3d0fd785137fb7c4da3259..c4c190355bf00d27fe5231c258867054c32dd9f4 100644 (file)
@@ -1,32 +1,31 @@
 ! (c)2009 Joe Groff bsd license
-USING: accessors calendar continuations destructors kernel math
-math.order namespaces system threads ui ui.gadgets.worlds
-sequences ;
+USING: accessors alarms calendar continuations destructors fry
+kernel math math.order namespaces system ui ui.gadgets.worlds ;
 IN: game.loop
 
 TUPLE: game-loop
-    { tick-interval-micros integer read-only }
+    { tick-interval-nanos integer read-only }
     tick-delegate
     draw-delegate
     { last-tick integer }
-    thread 
     { running? boolean }
     { tick-number integer }
     { frame-number integer }
     { benchmark-time integer }
     { benchmark-tick-number integer }
-    { benchmark-frame-number integer } ;
+    { benchmark-frame-number integer }
+    alarm ;
 
 GENERIC: tick* ( delegate -- )
 GENERIC: draw* ( tick-slice delegate -- )
 
 SYMBOL: game-loop
 
-: since-last-tick ( loop -- microseconds )
-    last-tick>> system-micros swap - ;
+: since-last-tick ( loop -- nanos )
+    last-tick>> nano-count swap - ;
 
 : tick-slice ( loop -- slice )
-    [ since-last-tick ] [ tick-interval-micros>> ] bi /f 1.0 min ;
+    [ since-last-tick ] [ tick-interval-nanos>> ] bi /f 1.0 min ;
 
 CONSTANT: MAX-FRAMES-TO-SKIP 5
 
@@ -40,8 +39,8 @@ TUPLE: game-loop-error game-loop error ;
 : game-loop-error ( game-loop error -- )
     [ drop stop-loop ] [ \ game-loop-error boa ?ui-error ] 2bi ;
 
-: fps ( fps -- micros )
-    1,000,000 swap /i ; inline
+: fps ( fps -- nanos )
+    1,000,000,000 swap /i ; inline
 
 <PRIVATE
 
@@ -54,64 +53,65 @@ TUPLE: game-loop-error game-loop error ;
 
 : increment-tick ( loop -- )
     [ 1 + ] change-tick-number
-    dup tick-interval-micros>> [ + ] curry change-last-tick
+    dup tick-interval-nanos>> [ + ] curry change-last-tick
     drop ;
 
 : ?tick ( loop count -- )
-    [ system-micros >>last-tick drop ] [
-        over [ since-last-tick ] [ tick-interval-micros>> ] bi >=
+    [ nano-count >>last-tick drop ] [
+        over [ since-last-tick ] [ tick-interval-nanos>> ] bi >=
         [ [ drop increment-tick ] [ drop tick ] [ 1 - ?tick ] 2tri ]
         [ 2drop ] if
     ] if-zero ;
 
-: (run-loop) ( loop -- )
-    dup running?>>
-    [ [ MAX-FRAMES-TO-SKIP ?tick ] [ redraw ] [ 1 milliseconds sleep (run-loop) ] tri ]
-    [ drop ] if ;
-
-: run-loop ( loop -- )
-    dup game-loop
-    [ [ (run-loop) ] [ game-loop-error ] recover ]
-    with-variable ;
-
-: benchmark-micros ( loop -- micros )
-    system-micros swap benchmark-time>> - ;
+: benchmark-nanos ( loop -- nanos )
+    nano-count swap benchmark-time>> - ;
 
 PRIVATE>
 
-: reset-loop-benchmark ( loop -- )
-    system-micros >>benchmark-time
+: reset-loop-benchmark ( loop -- loop )
+    nano-count >>benchmark-time
     dup tick-number>> >>benchmark-tick-number
-    dup frame-number>> >>benchmark-frame-number
-    drop ;
+    dup frame-number>> >>benchmark-frame-number ;
 
 : benchmark-ticks-per-second ( loop -- n )
-    [ tick-number>> ] [ benchmark-tick-number>> - ] [ benchmark-micros ] tri /f ;
+    [ tick-number>> ] [ benchmark-tick-number>> - ] [ benchmark-nanos ] tri /f ;
 : benchmark-frames-per-second ( loop -- n )
-    [ frame-number>> ] [ benchmark-frame-number>> - ] [ benchmark-micros ] tri /f ;
+    [ frame-number>> ] [ benchmark-frame-number>> - ] [ benchmark-nanos ] tri /f ;
+
+: (game-tick) ( loop -- )
+    dup running?>>
+    [ [ MAX-FRAMES-TO-SKIP ?tick ] [ redraw ] bi ]
+    [ drop ] if ;
+    
+: game-tick ( loop -- )
+    dup game-loop [
+        [ (game-tick) ] [ game-loop-error ] recover
+    ] with-variable ;
 
 : start-loop ( loop -- )
-    system-micros >>last-tick
+    nano-count >>last-tick
     t >>running?
-    [ reset-loop-benchmark ]
-    [ [ run-loop ] curry "game loop" spawn ]
-    [ (>>thread) ] tri ;
+    reset-loop-benchmark
+    [
+        [ '[ _ game-tick ] f ]
+        [ tick-interval-nanos>> nanoseconds ] bi
+        <alarm>
+    ] keep [ alarm<< ] [ drop start-alarm ] 2bi ;
 
 : stop-loop ( loop -- )
     f >>running?
-    f >>thread
-    drop ;
+    alarm>> stop-alarm ;
 
-: <game-loop*> ( tick-interval-micros tick-delegate draw-delegate -- loop )
-    system-micros f f 0 0 system-micros 0 0
+: <game-loop*> ( tick-interval-nanos tick-delegate draw-delegate -- loop )
+    nano-count f 0 0 nano-count 0 0 f
     game-loop boa ;
 
-: <game-loop> ( tick-interval-micros delegate -- loop )
+: <game-loop> ( tick-interval-nanos delegate -- loop )
     dup <game-loop*> ; inline
 
 M: game-loop dispose
     stop-loop ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [ "game.loop.prettyprint" require ] when
+{ "game.loop" "prettyprint" } "game.loop.prettyprint" require-when
diff --git a/extra/game/models/half-edge/authors.txt b/extra/game/models/half-edge/authors.txt
new file mode 100644 (file)
index 0000000..f13c9c1
--- /dev/null
@@ -0,0 +1 @@
+Joe Groff
diff --git a/extra/game/models/half-edge/half-edge-tests.factor b/extra/game/models/half-edge/half-edge-tests.factor
new file mode 100644 (file)
index 0000000..cbfe514
--- /dev/null
@@ -0,0 +1,69 @@
+USING: accessors game.models.half-edge kernel sequences
+tools.test ;
+IN: game.models.half-edge.tests
+
+CONSTANT: cube-edges
+    {
+        T{ edge { face 0 } { vertex  0 } { opposite-edge  6 } { next-edge  1 } }
+        T{ edge { face 0 } { vertex  1 } { opposite-edge 19 } { next-edge  2 } }
+        T{ edge { face 0 } { vertex  3 } { opposite-edge 12 } { next-edge  3 } }
+        T{ edge { face 0 } { vertex  2 } { opposite-edge 21 } { next-edge  0 } }
+
+        T{ edge { face 1 } { vertex  4 } { opposite-edge 10 } { next-edge  5 } }
+        T{ edge { face 1 } { vertex  5 } { opposite-edge 16 } { next-edge  6 } }
+        T{ edge { face 1 } { vertex  1 } { opposite-edge  0 } { next-edge  7 } }
+        T{ edge { face 1 } { vertex  0 } { opposite-edge 20 } { next-edge  4 } }
+
+        T{ edge { face 2 } { vertex  6 } { opposite-edge 14 } { next-edge  9 } }
+        T{ edge { face 2 } { vertex  7 } { opposite-edge 17 } { next-edge 10 } }
+        T{ edge { face 2 } { vertex  5 } { opposite-edge  4 } { next-edge 11 } }
+        T{ edge { face 2 } { vertex  4 } { opposite-edge 23 } { next-edge  8 } }
+
+        T{ edge { face 3 } { vertex  2 } { opposite-edge  2 } { next-edge 13 } }
+        T{ edge { face 3 } { vertex  3 } { opposite-edge 22 } { next-edge 14 } }
+        T{ edge { face 3 } { vertex  7 } { opposite-edge  8 } { next-edge 15 } }
+        T{ edge { face 3 } { vertex  6 } { opposite-edge 18 } { next-edge 12 } }
+
+        T{ edge { face 4 } { vertex  1 } { opposite-edge  5 } { next-edge 17 } }
+        T{ edge { face 4 } { vertex  5 } { opposite-edge  9 } { next-edge 18 } }
+        T{ edge { face 4 } { vertex  7 } { opposite-edge 13 } { next-edge 19 } }
+        T{ edge { face 4 } { vertex  3 } { opposite-edge  1 } { next-edge 16 } }
+
+        T{ edge { face 5 } { vertex  4 } { opposite-edge  7 } { next-edge 21 } }
+        T{ edge { face 5 } { vertex  0 } { opposite-edge  3 } { next-edge 22 } }
+        T{ edge { face 5 } { vertex  2 } { opposite-edge 15 } { next-edge 23 } }
+        T{ edge { face 5 } { vertex  6 } { opposite-edge 11 } { next-edge 20 } }
+    }
+
+: connect-cube-edges ( -- )
+    cube-edges [
+        [ cube-edges nth ] change-opposite-edge
+        [ cube-edges nth ] change-next-edge
+        drop
+    ] each ;
+
+connect-cube-edges
+
+[ 0 1 ]
+[ cube-edges first edge-vertices ] unit-test
+
+[ { 0 0 0 } ]
+[ cube-edges first vertex-edges [ vertex>> ] map ] unit-test
+
+[ 3 ]
+[ cube-edges first vertex-valence ] unit-test
+
+[ { 0 1 3 2 } ]
+[ cube-edges first face-edges [ vertex>> ] map ] unit-test
+
+[ 4 ]
+[ cube-edges first face-sides ] unit-test
+
+[ { 1 4 2 } ]
+[ cube-edges first vertex-neighbors ] unit-test
+
+[ { 3 5 6 } ]
+[ cube-edges first vertex-diagonals ] unit-test
+
+[ { 1 4 3 5 } ]
+[ cube-edges first face-neighbors ] unit-test
diff --git a/extra/game/models/half-edge/half-edge.factor b/extra/game/models/half-edge/half-edge.factor
new file mode 100644 (file)
index 0000000..eeb3e61
--- /dev/null
@@ -0,0 +1,54 @@
+! (c)2010 Joe Groff bsd license
+USING: accessors arrays fry kernel locals math sequences ;
+IN: game.models.half-edge
+
+TUPLE: edge < identity-tuple face vertex opposite-edge next-edge ;
+
+: edge-vertices ( edge -- start end )
+    [ vertex>> ] [ opposite-edge>> vertex>> ] bi ;
+
+! building blocks for edge loop iteration
+
+: (collect) ( in quot iterator -- out )
+    [ collector ] dip dip >array ; inline
+
+: (reduce) ( in initial quot iterator -- accum )
+    [ swap ] 2dip call ; inline
+
+: (count) ( in iterator -- count )
+    [ 0 [ drop 1 + ] ] dip (reduce) ; inline
+
+: edge-loop ( ..a edge quot: ( ..a edge -- ..b ) next-edge-quot: ( ..b edge -- ..a edge' ) -- ..a )
+    pick '[ _ _ bi dup _ eq? not ] loop drop ; inline
+
+! iterate over related edges
+
+: each-vertex-edge ( ... edge quot: ( ... edge -- ... ) -- ... )
+    [ opposite-edge>> next-edge>> ] edge-loop ; inline
+
+: each-face-edge ( ... edge quot: ( ... edge -- ... ) -- ... )
+    [ next-edge>> ] edge-loop ; inline
+
+! 
+
+: vertex-edges ( edge -- edges )
+    [ ] [ each-vertex-edge ] (collect) ;
+
+: vertex-neighbors ( edge -- edges )
+    [ opposite-edge>> vertex>> ] [ each-vertex-edge ] (collect) ;
+
+: vertex-diagonals ( edge -- edges )
+    [ next-edge>> opposite-edge>> vertex>> ] [ each-vertex-edge ] (collect) ;
+
+: vertex-valence ( edge -- count )
+    [ each-vertex-edge ] (count) ;
+
+: face-edges ( edge -- edges )
+    [ ] [ each-face-edge ] (collect) ;
+
+: face-neighbors ( edge -- edges )
+    [ opposite-edge>> face>> ] [ each-face-edge ] (collect) ;
+
+: face-sides ( edge -- count )
+    [ each-face-edge ] (count) ;
+
diff --git a/extra/game/models/half-edge/summary.txt b/extra/game/models/half-edge/summary.txt
new file mode 100644 (file)
index 0000000..6f0aac5
--- /dev/null
@@ -0,0 +1 @@
+Iterators for half-edge geometry structures
index 9ac59444db0a01a8ef435855349a11b24327a5d1..9b91b8fcf74af8eeaf51c27ba63f2a769409d103 100644 (file)
@@ -54,22 +54,22 @@ TUPLE: material
                 [ material new swap >>name current-material set ]
                 [ cm swap md set-at ] bi
             ] }
-            { "Ka"       [ 3 head strings>numbers cm (>>ambient-reflectivity)  ] }
-            { "Kd"       [ 3 head strings>numbers cm (>>diffuse-reflectivity)  ] }
-            { "Ks"       [ 3 head strings>numbers cm (>>specular-reflectivity) ] }
-            { "Tf"       [ 3 head strings>numbers cm (>>transmission-filter)   ] }
-            { "d"        [ first string>number cm    (>>dissolve)              ] }
-            { "Ns"       [ first string>number cm    (>>specular-exponent)     ] }
-            { "Ni"       [ first string>number cm    (>>refraction-index)      ] }
-            { "map_Ka"   [ first cm                  (>>ambient-map)           ] }
-            { "map_Kd"   [ first cm                  (>>diffuse-map)           ] }
-            { "map_Ks"   [ first cm                  (>>specular-map)          ] }
-            { "map_Ns"   [ first cm                  (>>specular-exponent-map) ] }
-            { "map_d"    [ first cm                  (>>dissolve-map)          ] }
-            { "map_bump" [ first cm                  (>>bump-map)              ] }
-            { "bump"     [ first cm                  (>>bump-map)              ] }
-            { "disp"     [ first cm                  (>>displacement-map)      ] }
-            { "refl"     [ first cm                  (>>reflection-map)        ] }
+            { "Ka"       [ 3 head strings>numbers cm ambient-reflectivity<<  ] }
+            { "Kd"       [ 3 head strings>numbers cm diffuse-reflectivity<<  ] }
+            { "Ks"       [ 3 head strings>numbers cm specular-reflectivity<< ] }
+            { "Tf"       [ 3 head strings>numbers cm transmission-filter<<   ] }
+            { "d"        [ first string>number cm    dissolve<<              ] }
+            { "Ns"       [ first string>number cm    specular-exponent<<     ] }
+            { "Ni"       [ first string>number cm    refraction-index<<      ] }
+            { "map_Ka"   [ first cm                  ambient-map<<           ] }
+            { "map_Kd"   [ first cm                  diffuse-map<<           ] }
+            { "map_Ks"   [ first cm                  specular-map<<          ] }
+            { "map_Ns"   [ first cm                  specular-exponent-map<< ] }
+            { "map_d"    [ first cm                  dissolve-map<<          ] }
+            { "map_bump" [ first cm                  bump-map<<              ] }
+            { "bump"     [ first cm                  bump-map<<              ] }
+            { "disp"     [ first cm                  displacement-map<<      ] }
+            { "refl"     [ first cm                  reflection-map<<        ] }
             [ 2drop ]
         } case
     ] unless-empty ;
index 438ab82356b51c1306f44846cee88df6c9642e67..cf43e69451df2474f2f39121a6d85b0d241d2a34 100644 (file)
@@ -37,8 +37,8 @@ M:: indexed-seq set-nth ( elt n seq -- )
 M: indexed-seq new-resizable
     [ dseq>> ] [ iseq>> ] [ rassoc>> ] tri <indexed-seq>
     dup -rot
-    [ [ dseq>> new-resizable ] keep (>>dseq) ]
-    [ [ iseq>> new-resizable ] keep (>>iseq) ]
-    [ [ rassoc>> clone nip ] keep (>>rassoc) ]
+    [ [ dseq>> new-resizable ] keep dseq<< ]
+    [ [ iseq>> new-resizable ] keep iseq<< ]
+    [ [ rassoc>> clone nip ] keep rassoc<< ]
     2tri ;
 
index c10ae4056130bd70c3133b29d6ce9a518828bc43..c169ec8b5dd05e42fc8a9886a45e6889aa84c659 100644 (file)
@@ -6,7 +6,7 @@ IN: game.worlds
 HELP: game-attributes
 { $class-description "Extends the " { $link world-attributes } " tuple class with extra attributes for " { $link game-world } "s:" }
 { $list
-{ { $snippet "tick-interval-micros" } " specifies the number of microseconds between consecutive calls to the world's " { $link tick-game-world } " method by the game loop. An integer greater than zero must be provided." }
+{ { $snippet "tick-interval-nanos" } " specifies the number of nanoseconds between consecutive calls to the world's " { $link tick-game-world } " method by the game loop. An integer greater than zero must be provided." }
 { { $snippet "use-game-input?" } " specifies whether the game world should initialize the " { $vocab-link "game.input" } " library for use by the game. False by default." }
 { { $snippet "use-audio-engine?" } " specifies whether the game world should manage an " { $link audio-engine } " instance. False by default." }
 { { $snippet "audio-engine-device" } " specifies the string name of the OpenAL device the audio engine, if any, should try to open. The default value of " { $link POSTPONE: f } " attempts to open the default OpenAL device." }
index dd9b2431c921309793ba05d1a4f3999df74bf7d9..f8b3ae8587bbb00145f8e637090979ab81da5c86 100644 (file)
@@ -7,7 +7,7 @@ IN: game.worlds
 TUPLE: game-world < world
     game-loop
     audio-engine
-    { tick-interval-micros fixnum }
+    { tick-interval-nanos integer }
     { use-game-input? boolean }
     { use-audio-engine? boolean }
     { audio-engine-device initial: f }
@@ -44,9 +44,8 @@ PRIVATE>
 M: game-world begin-world
     dup use-game-input?>> [ open-game-input ] when
     dup use-audio-engine?>> [ dup open-game-audio-engine >>audio-engine ] when
-    dup begin-game-world
-    dup [ tick-interval-micros>> ] [ ] bi <game-loop> [ >>game-loop ] keep start-loop
-    drop ;
+    dup [ tick-interval-nanos>> ] [ ] bi <game-loop>
+    [ >>game-loop begin-game-world ] keep start-loop ;
 
 M: game-world end-world
     [ [ stop-loop ] when* f ] change-game-loop
@@ -55,7 +54,7 @@ M: game-world end-world
     [ use-game-input?>> [ close-game-input ] when ] tri ;
 
 TUPLE: game-attributes < world-attributes
-    { tick-interval-micros fixnum }
+    { tick-interval-nanos integer }
     { use-game-input? boolean initial: f }
     { use-audio-engine? boolean initial: f }
     { audio-engine-device initial: f }
@@ -63,7 +62,7 @@ TUPLE: game-attributes < world-attributes
 
 M: game-world apply-world-attributes
     {
-        [ tick-interval-micros>> >>tick-interval-micros ]
+        [ tick-interval-nanos>> >>tick-interval-nanos ]
         [ use-game-input?>> >>use-game-input? ]
         [ use-audio-engine?>> >>use-audio-engine? ]
         [ audio-engine-device>> >>audio-engine-device ]
index f23848ce301a4738a8ebe4961ca69983adf0d366..9dedb6410b051b6b0e7f246c7f08bf53bb24274a 100644 (file)
@@ -40,7 +40,7 @@ MEMO: ip-db ( -- seq )
 : filter-overlaps ( alist -- alist' )
     2 clump
     [ first2 [ first second ] [ first first ] bi* < ] filter
-    [ first ] map ;
+    keys ;
 
 MEMO: ip-intervals ( -- interval-map )
     ip-db [ [ [ from>> ] [ to>> ] bi 2array ] keep ] { } map>assoc
index 9ca1093000dd6309983b999d30a6e0c06f728374..4440fc1d88020a747f07787563a9d6320203d9ac 100644 (file)
@@ -1,6 +1,6 @@
 ! (c)2009 Joe Groff bsd license
-USING: alien byte-arrays destructors help.markup help.syntax kernel math
-quotations ;
+USING: alien alien.data byte-arrays destructors help.markup help.syntax
+kernel math quotations ;
 IN: gpu.buffers
 
 HELP: <buffer-ptr>
@@ -149,6 +149,10 @@ HELP: dynamic-upload
 HELP: gpu-data-ptr
 { $class-description "This class is a union of the " { $link c-ptr } " and " { $link buffer-ptr } " classes. It represents a value that can be supplied either from CPU or GPU memory." } ;
 
+HELP: grow-buffer
+{ $values { "buffer" buffer } { "target-size" integer } }
+{ $description "If the " { $link buffer-size } " of the given " { $link buffer } " is less than " { $snippet "target-size" } ", reallocates the buffer to a size large enough to accommodate " { $snippet "target-size" } " bytes. If the buffer is reallocated, the original contents are lost." } ;
+
 HELP: index-buffer
 { $class-description "This " { $link buffer-kind } " declares that a " { $link buffer } "'s primary use will be to index vertex arrays." } ;
 
@@ -203,10 +207,17 @@ HELP: vertex-buffer
 
 HELP: with-mapped-buffer
 { $values
-    { "buffer" buffer } { "access" buffer-access-mode } { "quot" { $quotation "( alien -- )" } }
+    { "buffer" buffer } { "access" buffer-access-mode } { "quot" { $quotation "( ..a alien -- ..b )" } }
 }
 { $description "Maps " { $snippet "buffer" } " into CPU address space with " { $snippet "access" } " for the dynamic extent of " { $snippet "quot" } ". " { $snippet "quot" } " is called with a pointer to the mapped memory on top of the stack." } ;
 
+HELP: with-mapped-buffer-array
+{ $values
+    { "buffer" buffer } { "access" buffer-access-mode } { "c-type" "a C type" } { "quot" { $quotation "( ..a array -- ..b )" } }
+}
+{ $description "Maps " { $snippet "buffer" } " into CPU address space with " { $snippet "access" } " for the dynamic extent of " { $snippet "quot" } ". " { $snippet "quot" } " is called with the pointer to the mapped memory wrapped in a specialized array of " { $snippet "c-type" } "." }
+{ $notes "The appropriate specialized array vocabulary must be loaded; otherwise, an error will be thrown. The vocabulary can be loaded with the " { $link require-c-array } " word. See the " { $vocab-link "specialized-arrays" } " vocabulary for details on the underlying sequence type constructed." } ;
+
 { allocate-buffer allocate-byte-array buffer-size update-buffer read-buffer copy-buffer with-mapped-buffer } related-words
 
 HELP: write-access
@@ -236,11 +247,12 @@ ARTICLE: "gpu.buffers" "Buffer objects"
 { $subsections
     allocate-buffer
     allocate-byte-array
+    grow-buffer
     update-buffer
     read-buffer
     copy-buffer
     with-mapped-buffer
-}
-;
+    with-mapped-buffer-array
+;
 
 ABOUT: "gpu.buffers"
index bc6f089db95885871aec1796b5e83a71caafd2a4..6172c8ad8ce616dd789e1fddf8babdd0c9e719c4 100644 (file)
@@ -1,5 +1,5 @@
 ! (c)2009 Joe Groff bsd license
-USING: accessors alien alien.c-types arrays byte-arrays
+USING: accessors alien alien.c-types alien.data arrays byte-arrays
 combinators destructors gpu kernel locals math opengl opengl.gl
 typed ui.gadgets.worlds variants ;
 IN: gpu.buffers
@@ -132,7 +132,14 @@ TYPED:: copy-buffer ( to-buffer-ptr: buffer-ptr from-buffer-ptr: buffer-ptr size
     from-buffer-ptr offset>> to-buffer-ptr offset>>
     size glCopyBufferSubData ;
 
-:: with-mapped-buffer ( buffer access quot: ( alien -- ) -- )
+: (grow-buffer-size) ( target-size old-size -- new-size )
+    [ 2dup > ] [ 2 * ] while nip ; inline
+
+TYPED: grow-buffer ( buffer: buffer target-size: integer -- )
+    over buffer-size 2dup >
+    [ (grow-buffer-size) f allocate-buffer ] [ 3drop ] if ; inline
+
+:: with-mapped-buffer ( ..a buffer access quot: ( ..a alien -- ..b ) -- ..b )
     buffer bind-buffer :> target
     target access gl-access glMapBuffer
 
@@ -140,15 +147,19 @@ TYPED:: copy-buffer ( to-buffer-ptr: buffer-ptr from-buffer-ptr: buffer-ptr size
 
     target glUnmapBuffer drop ; inline
 
-:: with-bound-buffer ( buffer target quot: ( -- ) -- )
+:: with-mapped-buffer-array ( ..a buffer access c-type quot: ( ..a array -- ..b ) -- ..b )
+    buffer buffer-size c-type heap-size /i :> len
+    buffer access [ len c-type <c-direct-array> quot call ] with-mapped-buffer ; inline
+
+:: with-bound-buffer ( ..a buffer target quot: ( ..a -- ..b ) -- ..b )
     target gl-target buffer glBindBuffer
     quot call ; inline
 
-: with-buffer-ptr ( buffer-ptr target quot: ( c-ptr -- ) -- )
+: with-buffer-ptr ( ..a buffer-ptr target quot: ( ..a c-ptr -- ..b ) -- ..b )
     [ [ offset>> <alien> ] [ buffer>> handle>> ] bi ] 2dip
     with-bound-buffer ; inline
 
-: with-gpu-data-ptr ( gpu-data-ptr target quot: ( c-ptr -- ) -- )
+: with-gpu-data-ptr ( ..a gpu-data-ptr target quot: ( ..a c-ptr -- ..b ) -- ..b )
     pick buffer-ptr?
     [ with-buffer-ptr ]
     [ [ gl-target 0 glBindBuffer ] dip call ] if ; inline
index bee94d302a1a5bb8c00322feeaaf0b4e0417bdb9..28deff905c39ed1924d7613ed4f2b8721b24f00d 100644 (file)
@@ -34,12 +34,12 @@ GLSL-SHADER-FILE: window-vertex-shader vertex-shader "window.v.glsl"
 GLSL-SHADER-FILE: sobel-fragment-shader fragment-shader "sobel.f.glsl"
 GLSL-PROGRAM: sobel-program
     window-vertex-shader sobel-fragment-shader
-    window-vertex ;
+    window-vertex-format ;
 
 GLSL-SHADER-FILE: loading-fragment-shader fragment-shader "loading.f.glsl"
 GLSL-PROGRAM: loading-program
     window-vertex-shader loading-fragment-shader
-    window-vertex ;
+    window-vertex-format ;
 
 TUPLE: bunny-state
     vertexes
@@ -311,5 +311,5 @@ GAME: bunny-game {
         { grab-input? t }
         { use-game-input? t }
         { pref-dim { 1024 768 } }
-        { tick-interval-micros $[ 60 fps ] }
+        { tick-interval-nanos $[ 60 fps ] }
     } ;
index b01a64ccbc48a1509d24d088993356dfb3198228..2fec4f861f3f5410a5d6ea8cca65c826c7045aaa 100644 (file)
@@ -3,6 +3,7 @@ H{
     { deploy-name "Raytrace" }
     { deploy-ui? t }
     { deploy-c-types? f }
+    { deploy-console? f }
     { deploy-unicode? f }
     { "stop-after-last-window?" t }
     { deploy-io 2 }
index 2ad6c82d7cd3906991b7bdccf8055e8ec26a1321..9828c97aa77d200cfbf8dbf3d20c21eabb55043a 100644 (file)
@@ -10,7 +10,7 @@ GLSL-SHADER-FILE: raytrace-vertex-shader vertex-shader "raytrace.v.glsl"
 GLSL-SHADER-FILE: raytrace-fragment-shader fragment-shader "raytrace.f.glsl"
 GLSL-PROGRAM: raytrace-program
     raytrace-vertex-shader raytrace-fragment-shader
-    window-vertex ;
+    window-vertex-format ;
 
 UNIFORM-TUPLE: sphere-uniforms
     { "center" vec3-uniform  f }
@@ -126,5 +126,5 @@ GAME: raytrace-game {
         { use-game-input? t }
         { use-audio-engine? t }
         { pref-dim { 1024 768 } }
-        { tick-interval-micros $[ 60 fps ] }
+        { tick-interval-nanos $[ 60 fps ] }
     } ;
diff --git a/extra/gpu/effects/blur/authors.txt b/extra/gpu/effects/blur/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/gpu/effects/blur/blur.factor b/extra/gpu/effects/blur/blur.factor
new file mode 100644 (file)
index 0000000..ed72b28
--- /dev/null
@@ -0,0 +1,82 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays destructors fry gpu.framebuffers gpu.render gpu.shaders
+gpu.state gpu.textures gpu.util images kernel locals math
+math.rectangles sequences ;
+IN: gpu.effects.blur
+
+GLSL-SHADER: blur-fragment-shader fragment-shader
+uniform sampler2D texture;
+uniform bool horizontal;
+uniform float blurSize;
+varying vec2 texcoord;
+void main()
+{
+    vec4 col = 0.16 * texture2D(texture, texcoord);
+    if (horizontal)
+    {
+        vec2 blurX1 = vec2(blurSize, 0.0);
+        vec2 blurX2 = vec2(blurSize * 2.0, 0.0);
+        vec2 blurX3 = vec2(blurSize * 3.0, 0.0);
+        vec2 blurX4 = vec2(blurSize * 4.0, 0.0);
+        col += 0.15 * (  texture2D(texture, texcoord - blurX1)
+                       + texture2D(texture, texcoord + blurX1));
+        col += 0.12 * (  texture2D(texture, texcoord - blurX2)
+                       + texture2D(texture, texcoord + blurX2));
+        col += 0.09 * (  texture2D(texture, texcoord - blurX3)
+                       + texture2D(texture, texcoord + blurX3));
+        col += 0.05 * (  texture2D(texture, texcoord - blurX4)
+                       + texture2D(texture, texcoord + blurX4));
+    }
+    else
+    {
+        vec2 blurY1 = vec2(0.0, blurSize);
+        vec2 blurY2 = vec2(0.0, blurSize * 2.0);
+        vec2 blurY3 = vec2(0.0, blurSize * 3.0);
+        vec2 blurY4 = vec2(0.0, blurSize * 4.0);
+        col += 0.15 * (  texture2D(texture, texcoord - blurY1)
+                       + texture2D(texture, texcoord + blurY1));
+        col += 0.12 * (  texture2D(texture, texcoord - blurY2)
+                       + texture2D(texture, texcoord + blurY2));
+        col += 0.09 * (  texture2D(texture, texcoord - blurY3)
+                       + texture2D(texture, texcoord + blurY3));
+        col += 0.05 * (  texture2D(texture, texcoord - blurY4)
+                       + texture2D(texture, texcoord + blurY4));
+    }
+    gl_FragColor = col;
+}
+;
+   
+UNIFORM-TUPLE: blur-uniforms
+    { "texture"    texture-uniform f }
+    { "horizontal" bool-uniform    f }
+    { "blurSize"   float-uniform   f } ;
+
+GLSL-PROGRAM: blur-program window-vertex-shader blur-fragment-shader window-vertex-format ;
+                        
+:: (blur) ( texture horizontal? framebuffer dim -- )
+    { 0 0 } dim <rect> <viewport-state> set-gpu-state
+    texture horizontal? 1.0 dim horizontal? [ first ] [ second ] if / blur-uniforms boa framebuffer {
+        { "primitive-mode" [ 2drop triangle-strip-mode ] }
+        { "uniforms"       [ drop ] }
+        { "vertex-array"   [ 2drop blur-program <program-instance> <window-vertex-array> &dispose ] }
+        { "indexes"        [ 2drop T{ index-range f 0 4 } ] }
+        { "framebuffer"    [ nip ] }
+    } 2<render-set> render ;
+                         
+:: blur ( texture horizontal? -- texture )
+    texture 0 texture-dim :> dim
+    dim RGB float-components <2d-render-texture> :> ( target-framebuffer target-texture )
+    texture horizontal? target-framebuffer dim (blur)
+    target-framebuffer dispose
+    target-texture ;
+                         
+: horizontal-blur ( texture -- texture ) t blur ; inline
+                         
+: vertical-blur ( texture -- texture ) f blur ; inline
+
+: discompose ( quot1 quot2 -- compose )
+    '[ @ &dispose @ ] with-destructors ; inline
+
+: gaussian-blur ( texture -- texture )
+    [ horizontal-blur ] [ vertical-blur ] discompose ;
diff --git a/extra/gpu/effects/blur/summary.txt b/extra/gpu/effects/blur/summary.txt
new file mode 100644 (file)
index 0000000..a9c5314
--- /dev/null
@@ -0,0 +1 @@
+Blur effects for textures.
diff --git a/extra/gpu/effects/step/authors.txt b/extra/gpu/effects/step/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/gpu/effects/step/step.factor b/extra/gpu/effects/step/step.factor
new file mode 100644 (file)
index 0000000..bd3b013
--- /dev/null
@@ -0,0 +1,40 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: destructors gpu.render gpu.shaders gpu.state gpu.textures
+gpu.util images kernel locals math.rectangles ;
+IN: gpu.effects.step
+
+GLSL-SHADER: step-fragment-shader fragment-shader
+const vec4 luminance = vec4(0.3, 0.59, 0.11, 0.0);
+uniform sampler2D texture;
+uniform sampler2D ramp;
+varying vec2 texcoord;
+void main()
+{
+    vec4 col = texture2D(texture, texcoord);
+    float l = dot(col, luminance);
+    gl_FragColor = texture2D(ramp, vec2(l, 0.0));
+}
+;
+
+UNIFORM-TUPLE: step-uniforms
+    { "texture" texture-uniform f }
+    { "ramp"    texture-uniform f } ;
+
+GLSL-PROGRAM: step-program window-vertex-shader step-fragment-shader window-vertex-format ;
+
+: (step-texture) ( texture ramp texture dim -- )
+    { 0 0 } swap <rect> <viewport-state> set-gpu-state
+    [ step-uniforms boa ] dip {
+        { "primitive-mode" [ 2drop triangle-strip-mode ] }
+        { "uniforms"       [ drop ] }
+        { "vertex-array"   [ 2drop <window-vertex-buffer> step-program <program-instance> <vertex-array> ] }
+        { "indexes"        [ 2drop T{ index-range f 0 4 } ] }
+        { "framebuffer"    [ nip ] }
+    } 2<render-set> render ;
+
+:: step-texture ( texture ramp dim -- texture )
+    dim RGB float-components <2d-render-texture> :> ( target-framebuffer target-texture )
+    texture ramp target-framebuffer dim (step-texture)
+    target-framebuffer dispose
+    target-texture ;
diff --git a/extra/gpu/effects/step/summary.txt b/extra/gpu/effects/step/summary.txt
new file mode 100644 (file)
index 0000000..61028dd
--- /dev/null
@@ -0,0 +1 @@
+Render a quad with a step texture.
index 95187b6ce72a75678bb4f312b812ffbc4d974855..4891a2601acdac4041bc95b0803a4f5755ad7eb6 100644 (file)
@@ -293,6 +293,7 @@ HELP: vertex-indexes
 { "An " { $link index-elements } " value submits vertex array elements in an order specified by an array of indexes." }
 { "A " { $link multi-index-range } " value submits multiple sequential slices of a vertex array." }
 { "A " { $link multi-index-elements } " value submits multiple separate lists of indexed vertex array elements." }
+{ "Specialized arrays of " { $link c:uchar } ", " { $link c:ushort } ", or " { $link c:uint } " elements may also be used directly as arrays of indexes." }
 } } ;
 
 ARTICLE: "gpu.render" "Rendering"
index 2b7d75a3aea6a2aae344b2d52f21e5973995bf1f..10bddc3752efb7b92c520fe37bcc377965eef2df 100755 (executable)
@@ -4,17 +4,14 @@ assocs classes classes.mixin classes.parser classes.singleton classes.struct
 classes.tuple classes.tuple.private combinators combinators.tuple destructors fry
 generic generic.parser gpu gpu.buffers gpu.framebuffers
 gpu.framebuffers.private gpu.shaders gpu.shaders.private gpu.state
-gpu.textures gpu.textures.private half-floats images kernel
+gpu.textures gpu.textures.private math.floats.half images kernel
 lexer locals math math.order math.parser namespaces opengl
 opengl.gl parser quotations sequences slots sorting
 specialized-arrays strings ui.gadgets.worlds variants
 vocabs.parser words math.vectors.simd ;
 FROM: math => float ;
 QUALIFIED-WITH: alien.c-types c
-SPECIALIZED-ARRAY: c:float
-SPECIALIZED-ARRAY: int
-SPECIALIZED-ARRAY: uint
-SPECIALIZED-ARRAY: void*
+SPECIALIZED-ARRAYS: c:float c:int c:uchar c:ushort c:uint c:void* ;
 IN: gpu.render
 
 UNION: ?integer integer POSTPONE: f ;
@@ -98,15 +95,22 @@ UNION: vertex-indexes
     index-range
     multi-index-range
     index-elements
-    multi-index-elements ;
+    multi-index-elements
+    uchar-array
+    ushort-array
+    uint-array ;
 
 VARIANT: primitive-mode
     points-mode
     lines-mode
     line-strip-mode
+    lines-with-adjacency-mode
+    line-strip-with-adjacency-mode
     line-loop-mode
     triangles-mode
     triangle-strip-mode
+    triangles-with-adjacency-mode
+    triangle-strip-with-adjacency-mode
     triangle-fan-mode ;
 
 TUPLE: uniform-tuple ;
@@ -131,12 +135,21 @@ ERROR: invalid-uniform-type uniform ;
         { triangles-mode      [ GL_TRIANGLES      ] }
         { triangle-strip-mode [ GL_TRIANGLE_STRIP ] }
         { triangle-fan-mode   [ GL_TRIANGLE_FAN   ] }
+        { lines-with-adjacency-mode          [ GL_LINES_ADJACENCY          ] }
+        { line-strip-with-adjacency-mode     [ GL_LINE_STRIP_ADJACENCY     ] }
+        { triangles-with-adjacency-mode      [ GL_TRIANGLES_ADJACENCY      ] }
+        { triangle-strip-with-adjacency-mode [ GL_TRIANGLE_STRIP_ADJACENCY ] }
     } case ; inline
 
 GENERIC: render-vertex-indexes ( primitive-mode vertex-indexes -- )
 
 GENERIC# render-vertex-indexes-instanced 1 ( primitive-mode vertex-indexes instances -- )
 
+GENERIC: gl-array-element-type ( array -- type )
+M: uchar-array  gl-array-element-type drop GL_UNSIGNED_BYTE  ; inline
+M: ushort-array gl-array-element-type drop GL_UNSIGNED_SHORT ; inline
+M: uint-array   gl-array-element-type drop GL_UNSIGNED_INT   ; inline
+
 M: index-range render-vertex-indexes
     [ gl-primitive-mode ] [ [ start>> ] [ count>> ] bi ] bi* glDrawArrays ;
 
@@ -159,6 +172,18 @@ M: index-elements render-vertex-indexes-instanced
     [ ] tri*
     swap index-buffer [ swap glDrawElementsInstanced ] with-gpu-data-ptr ;
 
+M: specialized-array render-vertex-indexes
+    GL_ELEMENT_ARRAY_BUFFER 0 glBindBuffer
+    [ gl-primitive-mode ]
+    [ [ length ] [ gl-array-element-type ] [ >c-ptr ] tri ] bi*
+    glDrawElements ;
+
+M: specialized-array render-vertex-indexes-instanced
+    GL_ELEMENT_ARRAY_BUFFER 0 glBindBuffer
+    [ gl-primitive-mode ]
+    [ [ length ] [ gl-array-element-type ] [ >c-ptr ] tri ]
+    [ ] tri* glDrawElementsInstanced ;
+
 M: multi-index-elements render-vertex-indexes
     [ gl-primitive-mode ]
     [ { [ counts>> ] [ index-type>> gl-index-type ] [ ptrs>> dup length ] [ buffer>> ] } cleave ]
@@ -527,7 +552,7 @@ SYNTAX: UNIFORM-TUPLE:
     [ [ length ] [ >int-array ] bi glDrawBuffers ] if ;
 
 : bind-named-output-attachments ( program-instance framebuffer attachments -- )
-    rot '[ first _ swap output-index ] sort-with [ second ] map
+    rot '[ first _ swap output-index ] sort-with values
     bind-unnamed-output-attachments ;
 
 : bind-output-attachments ( program-instance framebuffer attachments -- )
index 025acba896f12fa06b8df35da26a9dd373c949b8..d1c137128aa254e212e18b797abce5e6f8e51e7f 100755 (executable)
@@ -8,14 +8,25 @@ kernel lexer literals locals math math.parser memoize multiline namespaces
 opengl opengl.gl opengl.shaders parser quotations sequences
 specialized-arrays splitting strings tr ui.gadgets.worlds
 variants vectors vocabs vocabs.loader vocabs.parser words
-words.constant half-floats typed ;
+words.constant math.floats.half typed ;
 QUALIFIED-WITH: alien.c-types c
 SPECIALIZED-ARRAY: int
 SPECIALIZED-ARRAY: void*
 IN: gpu.shaders
 
 VARIANT: shader-kind
-    vertex-shader fragment-shader ;
+    vertex-shader fragment-shader geometry-shader ;
+
+VARIANT: geometry-shader-input
+    points-input
+    lines-input
+    lines-with-adjacency-input
+    triangles-input
+    triangles-with-adjacency-input ;
+VARIANT: geometry-shader-output
+    points-output
+    line-strips-output
+    triangle-strips-output ;
 
 UNION: ?string string POSTPONE: f ;
 
@@ -47,6 +58,7 @@ TUPLE: program
     { shaders array read-only }
     { vertex-formats array read-only }
     { feedback-format ?vertex-format read-only }
+    { geometry-shader-parameters array read-only }
     { instances hashtable read-only } ;
 
 TUPLE: shader-instance < gpu-object
@@ -197,6 +209,31 @@ TR: hyphens>underscores "-" "_" ;
     vertex-attributes [ [verify-feedback-attribute] ] map-index :> verify-cleave
     { drop verify-cleave cleave } >quotation ;
 
+: gl-geometry-shader-input ( input -- input )
+    {
+        { points-input [ GL_POINTS ] }
+        { lines-input  [ GL_LINES ] }
+        { lines-with-adjacency-input [ GL_LINES_ADJACENCY ] }
+        { triangles-input [ GL_TRIANGLES ] }
+        { triangles-with-adjacency-input [ GL_TRIANGLES_ADJACENCY ] }
+    } case ; inline
+
+: gl-geometry-shader-output ( output -- output )
+    {
+        { points-output [ GL_POINTS ] }
+        { line-strips-output  [ GL_LINE_STRIP ] }
+        { triangle-strips-output [ GL_TRIANGLE_STRIP ] }
+    } case ; inline
+
+TUPLE: geometry-shader-vertices-out
+    { count integer read-only } ;
+
+UNION: geometry-shader-parameter
+    geometry-shader-input
+    geometry-shader-output
+    geometry-shader-vertices-out ;
+
+
 GENERIC: bind-vertex-format ( program-instance buffer-ptr format -- )
 
 GENERIC: link-feedback-format ( program-handle format -- )
@@ -208,6 +245,18 @@ M: f link-feedback-format
     [ vertex-format-attributes [ name>> ] map sift ] map concat
     swap '[ [ _ ] 2dip swap glBindAttribLocation ] each-index ; 
 
+GENERIC: link-geometry-shader-parameter ( program-handle parameter -- )
+
+M: geometry-shader-input link-geometry-shader-parameter
+    [ GL_GEOMETRY_INPUT_TYPE ] dip gl-geometry-shader-input glProgramParameteriARB ;
+M: geometry-shader-output link-geometry-shader-parameter
+    [ GL_GEOMETRY_OUTPUT_TYPE ] dip gl-geometry-shader-output glProgramParameteriARB ;
+M: geometry-shader-vertices-out link-geometry-shader-parameter
+    [ GL_GEOMETRY_VERTICES_OUT ] dip count>> glProgramParameteriARB ;
+
+: link-geometry-shader-parameters ( program-handle parameters -- )
+    [ link-geometry-shader-parameter ] with each ;
+
 GENERIC: (verify-feedback-format) ( program-instance format -- )
 
 M: f (verify-feedback-format)
@@ -252,13 +301,11 @@ M: f (verify-feedback-format)
     dup 1 = [ drop ] [ 2array ] if ;
 
 SYMBOL: padding-no
-padding-no [ 0 ] initialize
 
 : padding-name ( -- name )
     "padding-"
-    padding-no get number>string append
-    "(" ")" surround
-    padding-no inc ;
+    padding-no counter number>string append
+    "(" ")" surround ;
 
 : vertex-attribute>struct-slot ( vertex-attribute -- struct-slot-spec )
     [ name>> [ padding-name ] unless* ]
@@ -293,7 +340,8 @@ padding-no [ 0 ] initialize
     {
         { vertex-shader [ GL_VERTEX_SHADER ] }
         { fragment-shader [ GL_FRAGMENT_SHADER ] }
-    } case ;
+        { geometry-shader [ GL_GEOMETRY_SHADER ] }
+    } case ; inline
 
 PRIVATE>
 
@@ -433,8 +481,12 @@ DEFER: <shader-instance>
 : (link-program) ( program shader-instances -- program-instance )
     '[ _ [ handle>> ] map ]
     [
-        [ vertex-formats>> ] [ feedback-format>> ] bi
-        '[ [ _ link-vertex-formats ] [ _ link-feedback-format ] bi ]
+        [ vertex-formats>> ] [ feedback-format>> ] [ geometry-shader-parameters>> ] tri
+        '[
+            [ _ link-vertex-formats ]
+            [ _ link-feedback-format ]
+            [ _ link-geometry-shader-parameters ] tri
+        ]
     ] bi (gl-program)
     dup gl-program-ok?  [
         [ swap world get \ program-instance boa |dispose dup verify-feedback-format ]
@@ -485,15 +537,20 @@ TUPLE: feedback-format
 : ?shader ( object -- shader/f )
     dup word? [ def>> first dup shader? [ drop f ] unless ] [ drop f ] if ;
 
-: shaders-and-formats ( words -- shaders vertex-formats feedback-format )
-    [ [ ?shader ] map sift ]
-    [ [ vertex-format-attributes ] filter ]
-    [ [ feedback-format? ] filter validate-feedback-format ] tri ;
+: shaders-and-formats ( words -- shaders vertex-formats feedback-format geom-parameters )
+    {
+        [ [ ?shader ] map sift ]
+        [ [ vertex-format-attributes ] filter ]
+        [ [ feedback-format? ] filter validate-feedback-format ]
+        [ [ geometry-shader-parameter? ] filter ]
+    } cleave ;
 
 PRIVATE>
 
 SYNTAX: feedback-format:
     scan-object feedback-format boa suffix! ;
+SYNTAX: geometry-shader-vertices-out:
+    scan-object geometry-shader-vertices-out boa suffix! ;
 
 TYPED:: refresh-program ( program: program -- )
     program shaders>> [ refresh-shader-source ] each
@@ -575,4 +632,4 @@ M: program-instance dispose
     [ world>> ] [ program>> instances>> ] [ ] tri ?delete-at
     reset-memos ;
 
-"prettyprint" vocab [ "gpu.shaders.prettyprint" require ] when
+{ "gpu.shaders" "prettyprint" } "gpu.shaders.prettyprint" require-when
index 132e4303e7bb88ff1b111743fb938592dc668fc2..a240aae9452163ff3d4d40cfa2742402c7a669f5 100644 (file)
@@ -176,11 +176,6 @@ M: cube-map-face     texture-data-gl-target
     texture [ texture-gl-target ] [ handle>> ] bi glBindTexture
     texture ; inline
 
-: get-texture-float ( target level enum -- value )
-    0 <float> [ glGetTexLevelParameterfv ] keep *float ; inline
-: get-texture-int ( target level enum -- value )
-    0 <int> [ glGetTexLevelParameteriv ] keep *int ; inline
-
 : ?product ( x -- y )
     dup number? [ product ] unless ; inline
 
index d33fcf8c09799f8a99d3b50a4c2b4b40a8db35e1..2678f0452c950cd6213047bdc13eab9b159cf015 100644 (file)
@@ -1,6 +1,7 @@
 ! (c)2009 Joe Groff bsd license
-USING: gpu.buffers gpu.render gpu.shaders gpu.textures images kernel
-specialized-arrays ;
+USING: arrays destructors gpu.buffers gpu.framebuffers gpu.render
+gpu.shaders gpu.state gpu.textures images kernel locals math
+math.rectangles opengl.gl sequences specialized-arrays ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: float
 IN: gpu.util
@@ -44,10 +45,59 @@ CONSTANT: environment-cube-map-mv-matrices
             {  0.0  0.0  0.0  1.0 }
         } }
     }
+    
+GLSL-SHADER: window-vertex-shader vertex-shader
+attribute vec2 vertex;
+varying vec2 texcoord;
+void main()
+{
+    texcoord = vertex * vec2(0.5) + vec2(0.5);
+    gl_Position = vec4(vertex, 0.0, 1.0);
+}
+;
 
-VERTEX-FORMAT: window-vertex
+GLSL-SHADER: window-fragment-shader fragment-shader
+uniform sampler2D texture;
+varying vec2 texcoord;
+void main()
+{
+    gl_FragColor = texture2D(texture, texcoord);
+}
+;
+
+VERTEX-FORMAT: window-vertex-format
     { "vertex" float-components 2 f } ;
 
+UNIFORM-TUPLE: window-uniforms
+    { "texture" texture-uniform f } ;
+
+GLSL-PROGRAM: window-program window-vertex-shader window-fragment-shader window-vertex-format ;
+
+GLSL-SHADER: window-point-vertex-shader vertex-shader
+uniform float point_size;
+attribute vec2 vertex;
+void main()
+{
+    gl_Position  = vec4(vertex, 0.0, 1.0);
+    gl_PointSize = point_size;
+}
+;
+
+GLSL-SHADER: window-point-fragment-shader fragment-shader
+#version 120
+uniform sampler2D texture;
+void main()
+{
+    gl_FragColor = texture2D(texture, gl_PointCoord);
+}
+;
+
+UNIFORM-TUPLE: window-point-uniforms
+    { "texture"    texture-uniform f }
+    { "point_size" float-uniform   f } ;
+
+GLSL-PROGRAM: window-point-program window-point-vertex-shader window-point-fragment-shader window-vertex-format ;
+
 CONSTANT: window-vertexes
     float-array{
         -1.0 -1.0
@@ -62,4 +112,47 @@ CONSTANT: window-vertexes
     byte-array>buffer ; inline
 
 : <window-vertex-array> ( program-instance -- vertex-array )
-    [ <window-vertex-buffer> ] dip window-vertex <vertex-array*> ; inline
+    [ <window-vertex-buffer> ] dip window-vertex-format <vertex-array*> ; inline
+
+:: <2d-render-texture> ( dim order type -- renderbuffer texture )
+    order type
+    T{ texture-parameters
+       { wrap clamp-texcoord-to-edge }
+       { min-filter filter-linear }
+       { min-mipmap-filter f } }
+    <texture-2d> [
+        0 <texture-2d-attachment> 1array f f dim <framebuffer>
+        dup { { default-attachment { 0 0 0 } } } clear-framebuffer
+    ] keep ;
+
+: draw-texture ( texture dim -- )
+    { 0 0 } swap <rect> <viewport-state> set-gpu-state
+    {
+        { "primitive-mode" [ drop triangle-strip-mode ] }
+        { "uniforms"       [ window-uniforms boa ] }
+        { "vertex-array"   [ drop window-program <program-instance> <window-vertex-array> &dispose ] }
+        { "indexes"        [ drop T{ index-range f 0 4 } ] }
+    } <render-set> render ;
+
+:: <streamed-vertex-array> ( verts program-instance -- vertex-array )
+    verts stream-upload draw-usage vertex-buffer byte-array>buffer &dispose
+    program-instance <vertex-array> &dispose ;
+
+: (blended-point-sprite-batch) ( verts framebuffer texture point-size dim -- )
+    f eq-add func-one func-one <blend-mode> dup <blend-state> set-gpu-state
+    f origin-upper-left 1.0 <point-state> set-gpu-state
+    GL_POINT_SPRITE glEnable
+    { 0 0 } swap <rect> <viewport-state> set-gpu-state
+    window-point-uniforms boa {
+        { "primitive-mode" [ 3drop points-mode ] }
+        { "uniforms"       [ 2nip ] }
+        { "vertex-array"   [ 2drop window-point-program <program-instance> <streamed-vertex-array> ] }
+        { "indexes"        [ 2drop length 2 / 0 swap <index-range> ] }
+        { "framebuffer"    [ drop nip ] }
+    } 3<render-set> render ;
+    
+:: blended-point-sprite-batch ( verts texture point-size dim -- texture )
+    dim RGB float-components <2d-render-texture> :> ( target-framebuffer target-texture )
+    verts target-framebuffer texture point-size dim (blended-point-sprite-batch)
+    target-framebuffer dispose
+    target-texture ;
index ef71a669ed204b3f7cb6bcd79fba3626aa7e745f..0b6275dba0800f2735ece98452e99d0f4f89c006 100644 (file)
@@ -18,4 +18,4 @@ SPECIALIZED-ARRAY: float
         1.0 0.0 0.5 1.0
         1.0 0.0 1.0 1.0
     }
-] [ { 2 2 } vertex-array byte-array>float-array ] unit-test
+] [ { 2 2 } vertex-array float-array-cast ] unit-test
index 2d0b9514ffee2dab36a0c2569a32df11cb9e6dbd..760fd1e47be71078b531f1a051a03d4ba0bbc396 100644 (file)
@@ -145,7 +145,7 @@ TUPLE: link attributes clickable ;
     [ >url ] map ;
 
 : find-all-links ( vector -- vector' )
-    [ find-hrefs ] [ find-frame-links ] bi append prune ;
+    [ find-hrefs ] [ find-frame-links ] bi union ;
 
 : find-forms ( vector -- vector' )
     "form" over find-opening-tags-by-name
diff --git a/extra/images/testing/pbm/test.ascii.fig b/extra/images/testing/pbm/test.ascii.fig
new file mode 100644 (file)
index 0000000..aee805e
Binary files /dev/null and b/extra/images/testing/pbm/test.ascii.fig differ
diff --git a/extra/images/testing/pbm/test.ascii.pbm b/extra/images/testing/pbm/test.ascii.pbm
new file mode 100644 (file)
index 0000000..2cf2555
--- /dev/null
@@ -0,0 +1,369 @@
+P1
+# CREATOR: GIMP PNM Filter Version 1.1
+160 160
+1111111100000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000111111111111111100000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000011111111111111111000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000111111111111111111
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0111111111111111111000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000111111111111111110000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000001111111111111111100000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000011111111
+1111111110000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000111111101111110000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000001011111001010000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000101000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000001111
+1111111111111111111111010000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000011111111111111111111111111111111000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000001111111111111111111111111111111111100
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000111111111111111111
+1111111111111111111000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0111111111111111111111111111111111111111000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000001111111111111111111111111111111111111110000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000011111111111111111111111111111
+1111111111000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000001111111111
+1111111111111111111111111111110000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000111111111111111111111111111111111111111100000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000011111111111111111111111111111111111111111
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000111111111111111111111
+1111111111111111111100000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000001
+1111111111111111111111111111111111111111000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000111111111111000000000000000001111111111110000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000001111111111110000000000000000011
+1111111111000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000011111111111
+1000000000000000001111111111110000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000001111111111110000000000000000011111111111100000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000011111111111100000000000000000111111111111
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000111111111111000000000
+0000000011111111111100000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000001
+1111111111100000000000000000111111111111000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000111111111111000000000000000001111111111110000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000001111111111110000000000000000011
+1111111111000000000000000000000000000000000000000000000000000000000000
+0000000000011110100000000000000000000000000000000000000000011111111111
+1000000000000000001111111111110000000000000000000000000000000000000000
+0000000000000000000000000000111111111110000000000000000000000000000000
+0000000001111111111110000000000000000011111111111100000000000000000000
+0000000000000000000000000000000000000000000000111111111111110000000000
+0000000000000000000000000000011111111111100000000000000000111111111111
+0000000000000000000000000000000000000000000000000000000000000001111111
+1111111111100000000000000000000000000000000000000111111111111000000000
+0000000111111111111100000000000000000000000000000000000000000000000000
+0000000000111111111111111111111100000000000000000000000000000000000001
+1111111111100000000000000001111111111110000000000000000000000000000000
+0000000000000000000000000000011111111111111111111111000000000000000000
+0000000000000000001111111111111000000000000000011111111111100000000000
+0000000000000000000000000000000000000000000000011111111111111111111111
+1110000000000000000000000000000000000001111111111100000000000000000111
+1111111110000000000000000000000000000000000000000000000000000000001111
+1111111111111111111111100000000000000000000000000000000000111111111111
+0000000000000000011111111111100000000000000000000000000000000000000000
+0000000000000011111111111111111111111111111000000000000000000000000000
+0000000011111111111100000000000000000111111111110000000000000000000000
+0000000000000000000000000000000011111111111111111111111111111110000000
+0000000000000000000000000000111111111111000000000000000011111111111100
+0000000000000000000000000000000000000000000000000001111111111111111111
+1111111111111000000000000000000000000000000000001111111111110000000000
+0000001111111111110000000000000000000000000000000000000000000000000000
+1111111111111111111111111111111110000000000000000000000000000000000011
+1111111111000000000000000011111111111100000000000000000000000000000000
+0000000000000000000111111111111111111111111111111111110000000000000000
+0000000000000000001111111111110000000000000000111111111111000000000000
+0000000000000000000000000000000000000001111111111111111111111011111111
+1111000000000000000000000000000000000111111111111100000000000000001111
+1111111100000000000000000000000000000000000000000000000000011111111111
+1111110000001111111111110000000000000000000000000000000011111111111110
+0000000000000000111111111111000000000000000000000000000000000000000000
+0000000011111111111111111000000011111111111110000000000000000000000000
+0000011111111111111000000000000000001111111111110000000000000000000000
+0000000000000000000000000000111111111111111000000000011111111111000000
+0000000000000000000000000111111111111110000000000000000011111111111100
+0000000000000000000000000000000000000000000000001111111111111100000000
+0001111111111110000000000000000000000000000011111111111111000000000000
+0000001111111111110000000000000000000000000000000000000000000000000011
+1111111111000000000000011111111111100000000000000000000000000011111111
+1111111100000000000000000011111111111100000000000000000000000000000000
+0000000000000000001111111111100000000000000111111111111000000000000000
+0000000000001111111111111110000000000000000000111111111111000000000000
+0000000000000000000000000000000000000111111111111000000000000001111111
+1111100000000000000000000000000111111111111111000000000000000000001111
+1111111100000000000000000000000000000000000000000000000001111111111110
+0000000000000111111111111000000000000000000000000011111111111111110000
+0000000000000000111111111111000000000000000000000000000000000000000000
+0000000111111111111000000000000001111111111110000000000000000000000001
+1111111111111110000000000000000000001111111111110000000000000000000000
+0000000000000000000000000001111111111110000000000000011111111111110000
+0000000000000000000111111111111111000000000000000000000011111111111100
+0000000000000000000000000000000000000000000000011111111111100000000000
+0000111111111111000000000000000000000111111111111111100000000000000000
+0000001111111111110000000000000000000000000000000000000000000000000111
+1111111110000000000000001111111111110000000000000000000011111111111111
+1100000000000000000000000011111111111100000000000000000000000000000000
+0000000000000000011111111111100000000000000011111111111110000000000000
+0000011111111111111110000000000000000000000000111111111111000000000000
+0000000000000000000000000000000000000111111111111000000000000000011111
+1111111000000000000000000111111111111111100000000000000000000000001111
+1111111100000000000000000000000000000000000000000000000001111111111110
+0000000000000001111111111110000000000000000111111111111111100000000000
+0000000000000000111111111110000000000000000000000000000000000000000000
+0000000111111111111000000000000000011111111111100000000000000001111111
+1111111110000000000000000000000000011111111111110000000000000000000000
+0000000000000000000000000001111111111110000000000000000111111111111000
+0000000000001111111111111111000000000000000000000000000111111111111000
+0000000000000000000000000000000000000000000000011111111111100000000000
+0000011111111111110000000000000111111111111111100000000000000000000000
+0000011111111111100000000000000000000000000000000000000000000000000111
+1111111110000000000000000011111111111100000000000011111111111111110000
+0000000000000000000000000111111111111000000000000000000000000000000000
+0000000000000000011111111111100000000000000000111111111111000000000001
+1111111111111100000000000000000000000000000001111111111110000000000000
+0000000000000000000000000000000000000111111111111000000000000000001111
+1111111110000000001111111111111111000000000000000000000000000000011111
+1111111000000000000000000000000000000000000000000000000001111111111110
+0000000000000000011111111111100000000111111111111111100000000000000000
+0000000000000001111111111110000000000000000000000000000000000000000000
+0000000111111111111000000000000000000111111111111000000111111111111111
+1100000000000000000000000000000000011111111111100000000000000000000000
+0000000000000000000000000001111111111110000000000000000001111111111110
+0000011111111111111110000000000000000000000000000000000111111111111000
+0000000000000000000000000000000000000000000000011111111111100000000000
+0000000111111111111000011111111111111111000000000000000000000000000000
+0000011111111111100000000000000000000000000000000000000000000000000111
+1111111110000000000000000000111111111111001111111111111111110000000000
+0000000000000000000000000111111111111000000000000000000000000000000000
+0000000000000000011111111111100000000000000000001111111111110111111111
+1111111100000000000000000000000000000000000001111111111110000000000000
+0000000000000000000000000000000000000111111111111000000000000000000011
+1111111111111111111111111111000000000000000000000000000000000000011111
+1111111000000000000000000000000000000000000000000000000001111111111110
+0000000000000000001111111111111111111111111111000000000000000000000000
+0000000000000001111111111110000000000000000000000000000000000000000000
+0000000111111111111000000000000000000001111111111111111111111111100000
+0000000000000000000000000000000000011111111111100000000000000000000000
+0000000000000000000000000001111111111110000000000000000000011111111111
+1111111111111100000000000000000000000000000000000000001111111111110000
+0000000000000000000000000000000000000000000000011111111111100000000000
+0000000001111111111111111111111110000000000000000000000000000000000000
+0000111111111111000000000000000000000000000000000000000000000000000111
+1111111110000000000000000000011111111111111111111111000000000000000000
+0000000000000000000000001111111111110000000000000000000000000000000000
+0000000000000000011111111111100000000000000000000111111111111111111111
+0000000000000000000000000000000000000000000011111111111100000000000000
+0000000000000000000000000000000000000111111111111000000000000000000001
+1111111111111111111000000000000000000000000000000000000000000000111111
+1111110000000000000000000000000000000000000000000000000001111111111110
+0000000000000000000111111111111111111100000000000000000000000000000000
+0000000000000011111111111100000000000000000000000000000000000000000000
+0000000111111111111000000000000000000000111111111111111110000000000000
+0000000000000000000000000000000000111111111111000000000000000000000000
+0000000000000000000000000001111111111110000000000000000000001111111111
+1111111000000000000000000000000000000000000000000000001111111111110000
+0000000000000000000000000000000000000000000000011111111111100000000000
+0000000000111111111111111000000000000000000000000000000000000000000000
+0000111111111111000000000000000000000000000000000000000000000000000111
+1111111110000000000000000000001111111111111000000000000000000000000000
+0000000000000000000000001111111111110000000000000000000000000000000000
+0000000000000000011111111111100000000000000000000001111111111110000000
+0000000000000000000000000000000000000000000011111111111100000000000000
+0000000000000000000000000000000000000111111111111000000000000000000000
+0011111111110000000000000000000000000000000000000000000000000000111111
+1111110000000000000000000000000000000000000000000000000001111111111110
+0000000000000000000000011111110000001011111111111110100000000000000000
+0000000000000011111111111100000000000000000000000000000000000000000000
+0000000111111111111000000000000000000000000000101010111111111111111111
+1111111111000000000000000000000000111111111111000000000000000000000000
+0000000000000000000000000001111111111110000000000000000000000000001111
+1111111111111111111111111111111100000000000000000000001111111111110000
+0000000000000000000000000000000000000000000000011111111111100000000000
+0000000101111111111111111111111111111111111111111111100000000000000000
+0000111111111111000000000000000000000000000000000000000000000000000111
+1111111110000000000000101111111111111111111111111111111111111111111111
+1110000000000000000000001111111111110000000000000000000000000000000000
+0000000000000000011111111111100000101111111111111111111111111111111111
+1111111111111111111111110000000000000000000011111111111100000000000000
+0000000000000000000000000000000000000111111111111000111111111111111111
+1111111111111111111111111111111111111111111100000000000000000000111111
+1111110000000000000000000000000000000000000000000000000001111111111110
+0011111111111111111111111111111111111111111111111111111111111111000000
+0000000000000011111111111100000000000000000000000000000000000000000000
+0000000111111111111111111111111111111111111111111111111111111111111111
+1111111111111100000000000000000000111111111111000000000000000000000000
+0000000000000000000000000001111111111111111111111111111111111111111111
+1111111111111111111111111111111110000000000000000000011111111111110000
+0000000000000000000000000000000000000000000000011111111111111111111111
+1111111111111111111111111111111111111111111111111111100000000000000000
+0001111111111110000000000000000000000000000000000000000000000000000111
+1111111111111111111111111111111111111111111111111111111111111111111111
+1100000000000000000000011111111111100000000000000000000000000000000000
+0000000000000000011111111111111111111111111111111111111111111111111111
+1111111111111111111100000000000000000000000111111111111000000000000000
+0000000000000000000000000000000000000111111111111111111111111111111111
+1111111111111111111111111111111111111000000000000000000000000011111111
+1111100000000000000000000000000000000000000000000000000001111111111111
+1111111111111111111111111111111111111111111111111111110000000000000000
+0000000000011111111111110000000000000000000000000000000000000000000000
+0000000111111111111111111111111111110100000000111111111111111111111111
+1100000000000000000000000000000111111111111100000000000000000000000000
+0000000000000000000000000001111111111111111111111111010000000000011111
+1111111111111111111000000000000000000000000000000111111111111111000000
+0000000000000000000000000000000000000000000000111111111111111111111000
+0000000000000111111111111111111111111000000000000000000000000000000001
+1111111111111000000000000000000000000000000000000000000000000000001111
+1111111111111110000000000000000111111111111111111111111000000000000000
+0000000000000000011111111111111110000000000000000000000000000000000000
+0000000000000000111111111111111100000000000000000111111111111111111111
+1111000000000000000000000000000000011111111111111111000000000000000000
+0000000000000000000000000000000000001111111111111110000000000000000011
+1111111111111111111110000000000000000000000000000000001111111111111111
+1000000000000000000000000000000000000000000000000000000001111111111110
+0000000000000000001111111111111111111101000000000000000000000000000000
+0001111111111111111110000000000000000000000000000000000000000000000000
+0000000111111111110000000000000000000111111111111111111110000000000000
+0000000000000000000001111111111111111111000000000000000000000000000000
+0000000000000000000000000000111111111000000000000000000011111111111111
+1111110000000000000000000000000000000000011111111111111111100000000000
+0000000000000000000000000000000000000000000000000111111100000000000000
+0000001111111111111111100000000000000000000000000000000000011111111111
+1111111100000000000000000000000000000000000000000000000000000000000000
+0010100000000000000000000011111111111111110000000000000000000000000000
+0000000011111111111111111110000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000111111111111111000000000
+0000000000000000000000000011111111111111111110000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000001111
+1111111110000000000000000000000000000000000000111111111111111111100000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000111111111111000000000000000000000000000000000000011111
+1111111111110000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000001111111111110000000000000000000000
+0000000000000011111111111111111000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000011111111111100
+0000000000000000000000000000000001111111111111111100000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000001111111111110000000000000000000000000000000000111111111111111111
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000001111111111100000000000000000000000000000000
+1111111111111111110000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000011111111111100000000000
+0000000000000000000111111111111111111000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000111
+1111111110000000000000000000000000000111111111111111111100000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000011111111111110000000000000000000000000011111111111111
+1111000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000011111111111100000000000000000000
+0000111111111111111111110000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000111111111111
+1000000000000000000000011111111111111111110000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000011111111111110000000000000000000011111111111111111111000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000011111111111110000000000000000000111111111
+1111111111100000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000111111111111100000000
+0000000001111111111111111111100000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+1111111111110000000000000000111111111111111111110000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000011111111111110000000000000011111111111111111110000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000011111111111100000000000001111
+1111111111111110000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000111111111
+1111000000000001111111111111111110000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000011111111111110000000000111111111111111111000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000011111111111110000000011111111111111111
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000111111111111110000
+0011111111111111111100000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0001111111111111000011111111111111111100000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000001111111111111100111111111111111110000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000011111111111111111111111111
+1111100000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000011111
+1111111111111111111111110000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000001111111111111111111111111111100000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000001111111111111111111111111110000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000011111111111111
+1111111111110000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+0000000111111111111111111111110000000000000000000000000000000000000000
+0000000000000000000000000101000000101000000000000000000000000000000000
+0000000000000000000000000000111111111111111111111000000000000000000000
+0000000000000000000000000000000000000000000011111100111111000000000000
+0000000000000000000000000000000000000000000000000111111111111111111110
+0000000000000000000000000000000000000000000000000000000000000001111111
+1111111110000000000000000000000000000000000000000000000000000000000000
+1111111111111111100000000000000000000000000000000000000000000000000000
+0000000000001111111111111111110000000000000000000000000000000000000000
+0000000000000000000001111111111111111000000000000000000000000000000000
+0000000000000000000000000000000011111111111111111100000000000000000000
+0000000000000000000000000000000000000000011111111111111000000000000000
+0000000000000000000000000000000000000000000000000001111111111111111111
+1000000000000000000000000000000000000000000000000000000000000001111111
+1111000000000000000000000000000000000000000000000000000000000000000000
+0111111111111111111100000000000000000000000000000000000000000000000000
+0000000000000001111101000000000000000000000000000000000000000000000000
+0000000000000000000000111111111111111111000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000011111111
\ No newline at end of file
diff --git a/extra/images/testing/pbm/test.binary.fig b/extra/images/testing/pbm/test.binary.fig
new file mode 100644 (file)
index 0000000..aee805e
Binary files /dev/null and b/extra/images/testing/pbm/test.binary.fig differ
diff --git a/extra/images/testing/pbm/test.binary.pbm b/extra/images/testing/pbm/test.binary.pbm
new file mode 100644 (file)
index 0000000..3a49dd7
Binary files /dev/null and b/extra/images/testing/pbm/test.binary.pbm differ
diff --git a/extra/images/testing/pgm/radial.ascii.fig b/extra/images/testing/pgm/radial.ascii.fig
new file mode 100644 (file)
index 0000000..6e52311
Binary files /dev/null and b/extra/images/testing/pgm/radial.ascii.fig differ
diff --git a/extra/images/testing/pgm/radial.ascii.pgm b/extra/images/testing/pgm/radial.ascii.pgm
new file mode 100644 (file)
index 0000000..1a7a6a8
--- /dev/null
@@ -0,0 +1,16388 @@
+P2
+# CREATOR: GIMP PNM Filter Version 1.1
+128 128
+255
+0
+2
+4
+6
+8
+10
+12
+13
+16
+17
+19
+21
+22
+24
+26
+28
+30
+32
+33
+35
+36
+38
+40
+41
+42
+44
+45
+46
+48
+49
+51
+52
+54
+55
+56
+57
+58
+59
+60
+61
+63
+63
+65
+65
+66
+67
+67
+68
+69
+70
+71
+71
+72
+72
+72
+73
+74
+74
+74
+74
+74
+74
+75
+74
+75
+75
+74
+75
+74
+74
+74
+74
+73
+73
+73
+72
+72
+71
+70
+69
+69
+69
+67
+66
+66
+65
+64
+63
+62
+61
+60
+59
+58
+57
+56
+55
+54
+52
+51
+49
+48
+46
+45
+43
+42
+41
+39
+38
+36
+34
+33
+31
+29
+27
+26
+25
+23
+21
+19
+18
+16
+14
+12
+10
+8
+6
+4
+2
+2
+4
+6
+8
+10
+12
+13
+16
+18
+20
+21
+23
+24
+27
+29
+31
+32
+34
+35
+37
+38
+40
+41
+43
+45
+46
+48
+49
+50
+52
+54
+55
+56
+57
+59
+60
+61
+61
+63
+64
+66
+66
+67
+68
+69
+69
+70
+71
+72
+73
+73
+74
+74
+75
+76
+76
+76
+77
+76
+77
+77
+78
+77
+77
+77
+77
+77
+77
+78
+77
+77
+77
+76
+76
+75
+75
+74
+74
+74
+73
+72
+71
+71
+70
+68
+68
+67
+67
+65
+64
+63
+62
+60
+59
+59
+57
+56
+54
+54
+52
+51
+49
+47
+46
+45
+43
+41
+41
+38
+37
+35
+34
+32
+30
+29
+27
+25
+23
+21
+19
+18
+15
+14
+12
+10
+8
+6
+4
+4
+6
+8
+10
+12
+14
+16
+18
+20
+21
+23
+25
+27
+28
+30
+32
+34
+36
+37
+39
+40
+43
+44
+46
+47
+49
+50
+51
+53
+54
+56
+58
+58
+60
+60
+62
+63
+65
+66
+67
+68
+68
+70
+71
+72
+73
+73
+74
+74
+75
+76
+76
+78
+77
+78
+78
+79
+80
+79
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+79
+79
+78
+78
+78
+78
+77
+77
+76
+75
+75
+74
+73
+72
+71
+70
+70
+69
+67
+67
+65
+64
+63
+62
+61
+60
+59
+57
+56
+54
+53
+52
+51
+49
+47
+46
+44
+42
+41
+39
+38
+35
+34
+32
+31
+29
+27
+25
+23
+22
+19
+18
+16
+14
+12
+10
+8
+6
+6
+8
+10
+12
+14
+16
+18
+19
+22
+23
+26
+27
+29
+31
+33
+35
+37
+38
+39
+41
+43
+45
+47
+48
+49
+51
+53
+54
+56
+57
+58
+60
+61
+63
+64
+65
+66
+67
+69
+69
+70
+71
+72
+73
+74
+75
+76
+77
+77
+78
+79
+79
+80
+80
+81
+81
+81
+82
+82
+83
+82
+83
+83
+83
+83
+83
+83
+83
+83
+83
+82
+82
+82
+82
+80
+80
+80
+79
+79
+78
+77
+76
+75
+75
+74
+73
+73
+72
+71
+69
+68
+67
+66
+65
+64
+62
+61
+59
+59
+57
+55
+54
+52
+51
+50
+48
+47
+45
+43
+42
+40
+38
+36
+35
+33
+31
+29
+27
+25
+24
+22
+20
+18
+16
+14
+12
+10
+7
+8
+9
+12
+14
+16
+18
+19
+22
+24
+25
+27
+30
+31
+34
+35
+37
+38
+41
+42
+44
+45
+47
+49
+50
+52
+53
+55
+56
+58
+59
+61
+62
+63
+65
+66
+67
+69
+70
+71
+72
+73
+73
+75
+76
+77
+77
+78
+80
+80
+81
+81
+82
+82
+84
+83
+84
+84
+84
+85
+86
+85
+86
+86
+86
+86
+85
+86
+86
+86
+86
+85
+85
+84
+84
+84
+83
+83
+82
+81
+80
+80
+80
+78
+78
+77
+76
+75
+74
+73
+72
+71
+69
+68
+68
+66
+65
+64
+62
+61
+59
+58
+57
+55
+53
+52
+50
+49
+47
+46
+44
+42
+40
+39
+36
+35
+33
+31
+29
+28
+26
+23
+22
+20
+18
+16
+14
+12
+10
+10
+12
+14
+16
+18
+20
+22
+23
+26
+28
+30
+31
+33
+36
+37
+38
+41
+42
+45
+45
+48
+50
+51
+53
+55
+56
+58
+59
+60
+62
+63
+64
+66
+68
+69
+69
+71
+73
+74
+74
+76
+77
+77
+78
+79
+80
+82
+82
+82
+84
+85
+85
+85
+86
+86
+87
+87
+88
+88
+89
+88
+88
+89
+88
+89
+89
+88
+89
+88
+88
+88
+88
+87
+87
+86
+86
+86
+85
+85
+84
+82
+82
+82
+81
+80
+79
+78
+77
+75
+74
+73
+72
+71
+70
+68
+67
+66
+64
+64
+62
+60
+59
+57
+56
+54
+53
+51
+49
+48
+46
+44
+42
+40
+39
+37
+35
+34
+31
+30
+28
+26
+24
+21
+20
+18
+16
+14
+12
+12
+14
+16
+18
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+39
+41
+43
+45
+47
+48
+50
+52
+53
+55
+57
+58
+59
+61
+63
+64
+65
+67
+69
+70
+71
+73
+74
+74
+76
+77
+78
+79
+80
+81
+83
+83
+84
+85
+85
+86
+87
+87
+89
+89
+90
+89
+90
+90
+91
+91
+91
+92
+92
+92
+92
+92
+91
+92
+92
+91
+91
+91
+90
+89
+89
+89
+88
+87
+87
+86
+86
+85
+84
+83
+82
+81
+80
+79
+78
+77
+76
+75
+74
+72
+71
+69
+68
+67
+66
+64
+63
+61
+59
+58
+56
+55
+53
+52
+50
+49
+46
+45
+43
+41
+39
+37
+36
+33
+32
+30
+28
+26
+24
+22
+20
+18
+15
+14
+14
+15
+18
+20
+22
+24
+26
+28
+30
+31
+33
+36
+37
+40
+42
+43
+45
+47
+48
+50
+52
+54
+56
+57
+59
+61
+62
+64
+65
+67
+68
+70
+71
+72
+74
+75
+76
+77
+78
+80
+81
+82
+83
+84
+85
+86
+87
+87
+88
+89
+89
+90
+90
+91
+92
+92
+93
+93
+94
+94
+94
+95
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+93
+92
+92
+92
+90
+91
+90
+89
+88
+87
+86
+86
+85
+84
+83
+82
+81
+80
+78
+77
+76
+75
+73
+72
+70
+69
+68
+67
+65
+63
+62
+61
+59
+57
+56
+54
+52
+50
+49
+47
+45
+43
+41
+40
+38
+35
+34
+32
+30
+28
+26
+24
+22
+20
+17
+16
+15
+17
+20
+22
+24
+26
+28
+30
+32
+34
+35
+38
+40
+41
+44
+45
+48
+49
+51
+53
+54
+56
+58
+60
+62
+63
+65
+66
+68
+69
+70
+72
+73
+74
+76
+77
+79
+80
+81
+82
+84
+84
+85
+87
+87
+89
+89
+90
+91
+91
+92
+93
+94
+94
+94
+95
+96
+96
+96
+97
+97
+97
+97
+97
+98
+98
+98
+97
+97
+96
+96
+96
+95
+95
+95
+95
+94
+93
+92
+92
+91
+90
+89
+88
+88
+87
+86
+84
+83
+82
+81
+80
+79
+77
+76
+74
+73
+72
+71
+69
+68
+66
+64
+63
+61
+59
+58
+57
+54
+53
+51
+49
+48
+45
+43
+42
+39
+37
+35
+34
+31
+30
+28
+26
+24
+21
+20
+18
+17
+20
+22
+23
+26
+28
+30
+31
+34
+36
+38
+40
+42
+44
+46
+48
+49
+51
+53
+55
+57
+59
+60
+62
+63
+65
+66
+68
+70
+72
+73
+74
+76
+78
+78
+79
+81
+83
+83
+84
+86
+87
+89
+89
+90
+91
+92
+92
+94
+95
+95
+96
+96
+97
+98
+98
+99
+98
+99
+100
+100
+99
+100
+100
+100
+100
+100
+100
+100
+99
+99
+98
+99
+98
+98
+97
+96
+96
+95
+95
+93
+93
+92
+91
+90
+89
+89
+87
+86
+85
+84
+83
+81
+79
+78
+77
+75
+74
+73
+71
+70
+69
+67
+65
+64
+62
+60
+59
+57
+55
+53
+51
+49
+47
+46
+44
+41
+40
+38
+36
+34
+32
+30
+27
+26
+24
+21
+19
+19
+21
+24
+26
+28
+30
+32
+34
+35
+38
+40
+41
+44
+45
+48
+50
+52
+54
+56
+56
+59
+61
+62
+64
+66
+67
+69
+71
+73
+74
+76
+77
+78
+79
+81
+83
+84
+85
+86
+87
+89
+90
+91
+92
+93
+93
+95
+96
+97
+97
+97
+98
+99
+100
+100
+100
+101
+101
+102
+103
+102
+102
+103
+103
+102
+103
+102
+102
+103
+102
+102
+102
+101
+100
+100
+99
+99
+98
+98
+98
+97
+96
+95
+94
+92
+91
+91
+89
+89
+88
+87
+85
+84
+83
+81
+79
+78
+77
+75
+74
+73
+71
+69
+68
+66
+64
+62
+61
+59
+57
+55
+54
+51
+49
+48
+46
+43
+42
+40
+38
+36
+33
+32
+29
+27
+26
+23
+21
+21
+23
+25
+27
+30
+32
+33
+35
+38
+40
+42
+44
+45
+48
+50
+52
+53
+55
+57
+59
+61
+63
+64
+67
+68
+69
+71
+73
+75
+76
+77
+79
+81
+82
+83
+85
+87
+88
+89
+90
+91
+92
+93
+95
+95
+96
+97
+98
+99
+99
+101
+101
+102
+102
+103
+104
+104
+105
+105
+105
+105
+105
+106
+106
+106
+106
+106
+106
+105
+105
+105
+104
+104
+103
+103
+103
+102
+101
+101
+100
+99
+98
+97
+96
+96
+95
+93
+93
+91
+90
+88
+87
+86
+85
+83
+82
+81
+79
+77
+76
+74
+73
+71
+69
+68
+66
+65
+63
+61
+59
+57
+56
+54
+51
+50
+48
+46
+43
+42
+40
+38
+35
+34
+32
+30
+27
+25
+23
+22
+25
+27
+29
+32
+34
+35
+38
+40
+42
+44
+45
+48
+50
+52
+53
+56
+57
+60
+61
+64
+65
+67
+69
+70
+72
+74
+76
+77
+79
+80
+81
+83
+84
+86
+87
+88
+90
+91
+92
+94
+95
+96
+97
+98
+99
+100
+101
+102
+102
+103
+104
+105
+105
+106
+106
+107
+108
+108
+108
+108
+108
+108
+108
+109
+109
+108
+108
+108
+108
+107
+107
+106
+106
+106
+105
+104
+104
+103
+103
+102
+101
+100
+99
+98
+97
+96
+95
+94
+92
+91
+90
+89
+87
+86
+84
+83
+82
+80
+79
+76
+75
+74
+71
+70
+69
+67
+65
+63
+61
+59
+57
+56
+54
+51
+49
+48
+46
+44
+42
+40
+38
+35
+34
+31
+29
+27
+25
+24
+26
+29
+31
+33
+35
+37
+39
+42
+44
+46
+48
+49
+51
+54
+56
+57
+60
+61
+63
+65
+67
+69
+71
+73
+74
+76
+77
+79
+81
+82
+84
+85
+87
+89
+90
+91
+92
+94
+95
+96
+97
+99
+99
+100
+102
+103
+104
+104
+106
+106
+107
+108
+108
+109
+109
+110
+110
+110
+111
+111
+111
+111
+111
+111
+112
+111
+111
+111
+111
+111
+110
+110
+109
+109
+108
+108
+107
+106
+105
+105
+103
+102
+101
+100
+99
+99
+97
+96
+95
+94
+92
+91
+90
+88
+87
+86
+84
+82
+80
+79
+77
+75
+74
+72
+71
+69
+67
+65
+63
+61
+60
+58
+56
+54
+52
+50
+48
+46
+44
+42
+39
+37
+35
+34
+31
+28
+27
+26
+28
+31
+33
+35
+37
+39
+41
+44
+45
+47
+50
+52
+54
+56
+58
+59
+62
+64
+66
+67
+69
+71
+73
+75
+76
+78
+80
+82
+83
+85
+86
+88
+90
+91
+92
+94
+95
+97
+97
+98
+100
+101
+103
+103
+104
+105
+106
+107
+108
+109
+109
+110
+111
+111
+112
+112
+113
+113
+114
+114
+114
+114
+114
+115
+114
+114
+114
+113
+113
+113
+113
+112
+111
+111
+110
+110
+109
+108
+108
+107
+106
+106
+104
+103
+102
+102
+99
+99
+97
+97
+95
+94
+92
+91
+89
+87
+87
+84
+83
+81
+80
+78
+77
+75
+73
+71
+69
+67
+66
+63
+62
+60
+58
+56
+54
+51
+50
+48
+46
+44
+42
+39
+37
+35
+33
+31
+28
+28
+31
+32
+35
+36
+39
+41
+43
+46
+47
+49
+52
+54
+56
+57
+60
+62
+63
+65
+68
+69
+71
+73
+75
+77
+79
+80
+82
+84
+85
+87
+88
+90
+91
+93
+95
+96
+97
+99
+100
+101
+102
+104
+105
+106
+107
+108
+109
+109
+111
+111
+113
+113
+113
+114
+114
+115
+116
+116
+116
+117
+117
+117
+117
+117
+117
+117
+117
+117
+117
+116
+115
+115
+115
+115
+113
+113
+112
+111
+111
+110
+109
+108
+107
+106
+104
+103
+102
+102
+100
+98
+97
+96
+95
+93
+92
+90
+89
+87
+85
+84
+82
+80
+79
+77
+75
+73
+72
+69
+67
+66
+64
+61
+60
+57
+56
+53
+52
+49
+48
+46
+43
+41
+38
+37
+35
+33
+30
+30
+31
+34
+36
+39
+40
+42
+45
+47
+49
+52
+54
+56
+57
+60
+62
+64
+65
+68
+69
+71
+74
+76
+77
+79
+81
+83
+84
+86
+87
+89
+90
+93
+94
+96
+97
+99
+100
+101
+103
+104
+106
+106
+108
+109
+110
+111
+112
+112
+114
+114
+115
+115
+117
+117
+117
+117
+119
+118
+119
+119
+119
+120
+119
+120
+119
+120
+120
+119
+119
+119
+119
+118
+118
+117
+116
+116
+115
+114
+114
+113
+111
+111
+110
+109
+108
+106
+105
+104
+103
+101
+100
+99
+97
+96
+94
+92
+91
+89
+87
+86
+84
+83
+80
+79
+77
+76
+73
+71
+70
+67
+65
+64
+62
+59
+57
+55
+54
+51
+49
+47
+45
+43
+41
+38
+37
+34
+31
+32
+34
+35
+38
+40
+43
+45
+46
+49
+52
+53
+55
+57
+59
+62
+64
+66
+68
+70
+72
+73
+75
+77
+79
+81
+83
+85
+86
+88
+90
+91
+93
+95
+97
+98
+99
+101
+102
+103
+105
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+117
+119
+119
+120
+121
+120
+121
+121
+122
+122
+122
+122
+123
+123
+122
+123
+122
+122
+122
+121
+121
+120
+121
+120
+119
+118
+117
+117
+116
+115
+114
+113
+112
+111
+110
+108
+107
+106
+105
+104
+102
+100
+99
+98
+96
+95
+93
+91
+90
+88
+86
+84
+83
+81
+79
+77
+75
+74
+71
+70
+68
+66
+63
+62
+59
+57
+55
+53
+51
+49
+47
+45
+42
+40
+38
+36
+33
+33
+35
+37
+40
+42
+44
+47
+49
+51
+53
+56
+57
+59
+61
+63
+66
+68
+70
+72
+74
+76
+78
+80
+82
+83
+86
+87
+88
+90
+93
+94
+95
+97
+99
+101
+102
+103
+105
+106
+107
+108
+110
+111
+113
+113
+115
+116
+116
+118
+118
+120
+120
+121
+121
+122
+123
+124
+124
+125
+124
+125
+126
+126
+125
+125
+125
+125
+126
+125
+125
+124
+124
+124
+123
+122
+122
+121
+121
+119
+118
+117
+116
+116
+115
+113
+112
+111
+110
+109
+107
+106
+105
+103
+102
+100
+98
+97
+96
+93
+92
+90
+89
+87
+85
+83
+81
+79
+78
+76
+74
+71
+70
+68
+65
+64
+62
+59
+58
+56
+53
+51
+48
+46
+44
+42
+39
+38
+35
+35
+36
+39
+42
+43
+46
+48
+50
+53
+54
+57
+59
+61
+64
+65
+68
+69
+72
+74
+75
+78
+80
+81
+83
+86
+87
+89
+91
+93
+94
+96
+98
+99
+101
+102
+104
+105
+107
+109
+110
+111
+113
+114
+116
+116
+117
+119
+120
+121
+121
+122
+123
+124
+124
+126
+126
+126
+127
+127
+128
+128
+128
+128
+128
+128
+128
+128
+128
+128
+127
+127
+127
+127
+126
+125
+125
+124
+123
+123
+121
+121
+120
+118
+118
+116
+115
+114
+112
+111
+110
+108
+107
+105
+104
+102
+101
+99
+98
+96
+94
+93
+91
+89
+87
+85
+84
+82
+80
+78
+75
+74
+71
+70
+68
+65
+63
+61
+59
+57
+55
+52
+50
+49
+46
+44
+41
+39
+37
+37
+39
+40
+43
+46
+48
+49
+52
+54
+57
+59
+61
+63
+66
+68
+70
+72
+73
+76
+77
+80
+82
+84
+86
+88
+90
+92
+94
+95
+97
+98
+100
+101
+103
+105
+107
+108
+110
+111
+112
+113
+115
+116
+118
+118
+120
+121
+122
+123
+124
+124
+126
+127
+127
+128
+128
+129
+129
+129
+130
+131
+131
+131
+131
+131
+131
+131
+131
+130
+130
+130
+129
+129
+129
+128
+127
+126
+126
+125
+124
+123
+122
+121
+120
+119
+118
+116
+115
+114
+113
+111
+110
+108
+107
+104
+103
+102
+100
+98
+96
+95
+93
+91
+90
+87
+85
+84
+82
+79
+78
+75
+74
+72
+69
+67
+65
+63
+60
+59
+56
+55
+52
+49
+47
+46
+43
+41
+38
+37
+40
+42
+44
+47
+49
+52
+54
+56
+58
+61
+62
+65
+67
+69
+72
+73
+75
+77
+80
+82
+83
+86
+88
+89
+92
+93
+95
+97
+99
+101
+102
+104
+106
+108
+108
+110
+112
+114
+115
+116
+118
+119
+120
+121
+122
+124
+125
+126
+127
+128
+128
+130
+130
+130
+131
+132
+132
+133
+133
+133
+133
+134
+134
+134
+134
+133
+134
+133
+133
+132
+133
+132
+131
+131
+130
+129
+128
+127
+126
+126
+125
+124
+123
+121
+120
+119
+118
+117
+115
+114
+112
+111
+109
+107
+105
+104
+103
+101
+99
+97
+95
+94
+91
+90
+87
+86
+83
+82
+80
+78
+76
+73
+71
+69
+67
+65
+62
+61
+59
+56
+53
+52
+49
+47
+45
+43
+40
+39
+41
+44
+46
+48
+51
+54
+56
+58
+60
+63
+64
+66
+69
+71
+73
+76
+78
+80
+81
+84
+86
+88
+89
+92
+93
+95
+97
+100
+100
+103
+104
+106
+108
+110
+112
+113
+114
+116
+118
+119
+120
+122
+123
+124
+126
+126
+128
+128
+129
+130
+131
+132
+133
+134
+134
+134
+135
+136
+136
+136
+137
+137
+137
+137
+137
+137
+136
+136
+136
+136
+135
+134
+134
+133
+133
+131
+132
+130
+130
+128
+127
+126
+125
+124
+123
+121
+121
+118
+117
+116
+114
+112
+111
+110
+108
+107
+105
+102
+101
+100
+98
+95
+94
+91
+90
+88
+86
+83
+82
+79
+78
+76
+73
+71
+69
+67
+65
+62
+60
+58
+55
+54
+51
+49
+47
+44
+42
+41
+44
+46
+47
+50
+53
+55
+57
+60
+61
+64
+66
+68
+71
+72
+75
+77
+79
+82
+84
+85
+88
+90
+91
+93
+95
+98
+99
+101
+103
+105
+107
+108
+110
+112
+113
+115
+117
+118
+120
+121
+122
+124
+126
+126
+128
+129
+130
+131
+132
+133
+134
+135
+135
+136
+137
+138
+138
+139
+138
+139
+139
+140
+139
+139
+140
+139
+139
+139
+139
+138
+137
+138
+136
+136
+135
+135
+134
+133
+132
+131
+130
+129
+128
+127
+126
+124
+122
+121
+119
+119
+117
+115
+113
+112
+111
+109
+107
+105
+103
+101
+99
+98
+96
+94
+92
+90
+87
+86
+84
+82
+79
+78
+75
+73
+71
+68
+66
+64
+61
+60
+58
+55
+53
+50
+48
+46
+43
+42
+44
+47
+50
+52
+54
+56
+58
+61
+64
+66
+68
+70
+72
+74
+77
+79
+81
+83
+85
+87
+90
+92
+93
+95
+98
+99
+101
+103
+105
+107
+109
+111
+112
+115
+116
+117
+119
+120
+123
+123
+125
+126
+128
+129
+130
+132
+132
+134
+135
+136
+137
+137
+138
+139
+140
+140
+141
+141
+141
+141
+142
+143
+142
+143
+142
+142
+142
+142
+142
+141
+141
+141
+140
+139
+138
+137
+137
+135
+134
+134
+132
+132
+130
+129
+128
+126
+125
+124
+122
+121
+119
+118
+115
+115
+112
+110
+109
+107
+106
+104
+101
+100
+98
+96
+93
+92
+90
+88
+85
+83
+81
+79
+77
+74
+72
+70
+67
+66
+63
+61
+59
+56
+54
+52
+49
+47
+45
+44
+46
+49
+51
+54
+56
+58
+61
+62
+65
+67
+70
+72
+74
+76
+78
+81
+83
+85
+87
+89
+92
+93
+96
+98
+100
+102
+104
+106
+107
+110
+111
+113
+115
+117
+118
+120
+121
+123
+125
+126
+127
+129
+130
+132
+132
+134
+136
+136
+137
+139
+139
+140
+141
+142
+142
+143
+143
+144
+144
+145
+145
+145
+145
+145
+145
+145
+144
+145
+145
+144
+143
+143
+142
+142
+141
+140
+139
+138
+138
+136
+135
+134
+133
+132
+130
+129
+128
+126
+124
+123
+121
+120
+118
+116
+114
+113
+111
+109
+107
+106
+104
+102
+100
+98
+95
+94
+91
+90
+87
+86
+83
+81
+79
+76
+74
+72
+70
+68
+65
+63
+61
+58
+55
+54
+51
+48
+46
+45
+48
+50
+52
+55
+58
+60
+62
+64
+67
+69
+71
+74
+76
+78
+80
+83
+84
+86
+90
+91
+93
+95
+97
+99
+101
+103
+105
+108
+109
+111
+113
+115
+117
+118
+120
+122
+124
+126
+127
+128
+130
+132
+132
+134
+136
+136
+138
+139
+140
+141
+141
+143
+144
+144
+145
+146
+146
+147
+147
+148
+148
+148
+148
+148
+148
+147
+148
+147
+147
+146
+147
+145
+145
+144
+143
+143
+142
+141
+140
+138
+138
+137
+135
+135
+133
+131
+130
+128
+127
+125
+124
+122
+120
+119
+117
+115
+114
+111
+109
+108
+106
+103
+102
+99
+97
+95
+93
+92
+89
+87
+85
+83
+81
+78
+76
+74
+71
+69
+66
+65
+62
+60
+57
+55
+52
+50
+48
+47
+50
+52
+54
+57
+58
+61
+64
+66
+68
+71
+72
+75
+77
+80
+82
+85
+86
+89
+91
+93
+95
+98
+100
+102
+104
+105
+108
+110
+111
+114
+115
+117
+119
+121
+122
+125
+126
+127
+129
+131
+133
+134
+136
+137
+138
+140
+140
+142
+143
+144
+144
+145
+146
+147
+148
+148
+149
+150
+150
+150
+151
+150
+151
+151
+151
+150
+150
+151
+149
+149
+149
+148
+148
+147
+146
+145
+145
+144
+142
+141
+140
+139
+138
+137
+135
+133
+132
+131
+129
+127
+126
+125
+123
+121
+119
+117
+116
+113
+111
+109
+107
+105
+104
+101
+99
+98
+95
+94
+91
+89
+87
+84
+82
+79
+78
+75
+73
+71
+68
+65
+64
+61
+59
+56
+54
+52
+49
+48
+50
+53
+56
+58
+60
+62
+65
+67
+69
+72
+75
+77
+79
+81
+83
+86
+88
+90
+93
+95
+97
+99
+102
+104
+105
+108
+110
+111
+113
+116
+117
+119
+121
+123
+124
+127
+128
+129
+131
+133
+134
+136
+137
+139
+140
+142
+143
+144
+146
+146
+147
+148
+149
+150
+151
+151
+152
+152
+153
+153
+153
+154
+154
+153
+154
+153
+153
+153
+152
+152
+152
+151
+151
+150
+149
+149
+148
+146
+145
+144
+143
+142
+140
+139
+138
+137
+135
+134
+132
+130
+128
+126
+125
+123
+122
+119
+117
+115
+113
+111
+110
+108
+106
+104
+101
+99
+97
+95
+93
+90
+88
+86
+83
+81
+79
+76
+75
+72
+70
+67
+65
+62
+60
+58
+56
+53
+50
+49
+52
+55
+57
+59
+61
+64
+66
+69
+71
+74
+76
+78
+81
+83
+85
+88
+90
+93
+95
+96
+98
+101
+103
+105
+107
+109
+111
+114
+115
+118
+119
+121
+123
+125
+127
+129
+130
+132
+134
+136
+137
+139
+140
+141
+143
+144
+145
+147
+148
+149
+150
+151
+151
+152
+153
+154
+154
+155
+156
+156
+156
+157
+156
+157
+156
+156
+156
+155
+155
+155
+155
+154
+153
+153
+152
+151
+150
+149
+147
+147
+145
+144
+143
+141
+140
+138
+137
+136
+134
+132
+130
+128
+127
+125
+124
+122
+120
+118
+116
+113
+112
+110
+107
+105
+103
+101
+99
+97
+94
+92
+90
+88
+86
+83
+81
+78
+76
+73
+72
+69
+67
+65
+62
+59
+57
+55
+51
+51
+53
+55
+58
+60
+63
+66
+68
+71
+73
+75
+77
+80
+82
+85
+87
+89
+91
+93
+96
+98
+101
+103
+105
+108
+110
+111
+114
+115
+118
+120
+122
+123
+125
+127
+129
+131
+132
+134
+136
+137
+139
+141
+142
+144
+145
+147
+148
+149
+150
+151
+153
+154
+154
+155
+156
+157
+157
+158
+158
+158
+159
+159
+159
+159
+160
+159
+159
+158
+158
+158
+157
+157
+155
+155
+155
+153
+152
+151
+150
+149
+147
+147
+146
+144
+142
+141
+140
+138
+136
+134
+133
+131
+129
+127
+126
+123
+121
+119
+118
+115
+113
+112
+109
+107
+105
+103
+101
+98
+96
+94
+91
+89
+87
+84
+82
+80
+78
+76
+73
+71
+68
+66
+63
+61
+58
+55
+54
+52
+55
+57
+60
+63
+65
+67
+69
+72
+74
+77
+79
+81
+84
+86
+89
+91
+93
+95
+98
+100
+102
+104
+106
+109
+111
+113
+115
+118
+120
+122
+123
+126
+128
+130
+131
+133
+135
+136
+138
+140
+142
+143
+144
+146
+148
+149
+150
+151
+152
+154
+155
+156
+157
+158
+159
+159
+160
+161
+161
+162
+162
+162
+162
+162
+162
+162
+162
+161
+161
+161
+160
+159
+159
+158
+157
+157
+155
+154
+153
+151
+151
+150
+148
+146
+145
+143
+142
+140
+138
+137
+135
+133
+131
+129
+127
+126
+123
+121
+119
+118
+115
+114
+111
+108
+107
+104
+102
+100
+98
+95
+94
+91
+89
+86
+84
+82
+79
+77
+74
+72
+70
+67
+64
+62
+60
+57
+54
+54
+56
+58
+61
+64
+66
+69
+71
+74
+76
+78
+80
+83
+86
+88
+90
+93
+95
+97
+100
+102
+104
+106
+109
+111
+113
+115
+117
+119
+121
+123
+125
+127
+130
+132
+133
+135
+137
+138
+140
+142
+144
+146
+147
+149
+150
+152
+153
+154
+155
+156
+158
+159
+159
+161
+161
+162
+162
+163
+164
+164
+164
+164
+165
+165
+165
+165
+165
+164
+164
+163
+163
+162
+161
+160
+160
+159
+158
+156
+155
+155
+153
+151
+150
+148
+147
+146
+144
+142
+141
+139
+137
+135
+133
+132
+129
+127
+126
+123
+121
+119
+117
+115
+112
+110
+108
+107
+104
+102
+100
+97
+95
+92
+90
+88
+85
+83
+81
+79
+75
+73
+71
+69
+66
+63
+61
+58
+56
+55
+57
+60
+62
+65
+67
+69
+72
+74
+77
+80
+82
+84
+87
+89
+92
+94
+96
+99
+101
+103
+106
+108
+110
+112
+115
+117
+119
+121
+123
+125
+127
+130
+132
+133
+136
+137
+139
+141
+143
+145
+146
+148
+149
+151
+153
+154
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+166
+166
+167
+168
+167
+168
+168
+168
+168
+167
+167
+167
+166
+165
+165
+164
+163
+163
+162
+161
+159
+158
+156
+155
+154
+152
+151
+149
+148
+146
+144
+143
+141
+139
+138
+135
+133
+131
+130
+127
+126
+123
+121
+119
+117
+115
+113
+111
+108
+106
+104
+101
+99
+97
+95
+91
+89
+87
+84
+82
+79
+77
+74
+72
+70
+67
+65
+62
+59
+57
+56
+58
+60
+63
+66
+68
+71
+73
+76
+79
+81
+84
+86
+89
+91
+94
+96
+98
+100
+103
+105
+107
+110
+112
+114
+116
+118
+121
+123
+125
+127
+130
+131
+133
+136
+137
+139
+141
+143
+145
+146
+149
+150
+152
+153
+155
+156
+158
+159
+161
+162
+163
+164
+165
+165
+167
+168
+168
+169
+170
+169
+170
+171
+171
+171
+170
+171
+170
+169
+170
+169
+168
+167
+166
+166
+165
+164
+163
+162
+160
+159
+158
+156
+155
+153
+151
+151
+148
+146
+145
+143
+142
+140
+137
+136
+133
+131
+130
+127
+125
+123
+121
+119
+116
+114
+111
+110
+107
+105
+102
+100
+98
+96
+93
+91
+89
+86
+84
+81
+79
+76
+74
+71
+68
+66
+64
+61
+58
+57
+60
+62
+65
+67
+70
+72
+75
+78
+80
+82
+84
+87
+90
+92
+95
+97
+99
+102
+105
+106
+109
+111
+114
+116
+118
+121
+122
+125
+127
+130
+132
+134
+136
+137
+139
+142
+144
+145
+147
+149
+151
+153
+154
+155
+157
+159
+160
+161
+163
+165
+165
+167
+168
+169
+170
+171
+171
+172
+172
+173
+173
+173
+173
+173
+173
+173
+173
+172
+172
+171
+171
+170
+169
+169
+168
+167
+166
+165
+163
+162
+161
+158
+157
+156
+154
+153
+151
+148
+147
+145
+143
+141
+139
+137
+136
+133
+131
+129
+127
+124
+123
+120
+118
+116
+113
+111
+109
+107
+104
+102
+99
+97
+95
+92
+89
+87
+85
+82
+80
+77
+75
+72
+70
+67
+65
+62
+60
+58
+61
+63
+66
+69
+71
+74
+76
+79
+81
+84
+86
+89
+91
+93
+96
+98
+101
+103
+105
+108
+110
+113
+116
+118
+120
+122
+125
+126
+129
+131
+133
+135
+137
+139
+142
+144
+145
+148
+149
+151
+153
+154
+156
+158
+160
+161
+163
+164
+165
+166
+168
+169
+171
+171
+172
+173
+174
+174
+175
+175
+176
+176
+176
+176
+176
+176
+175
+175
+175
+174
+174
+173
+172
+171
+170
+169
+168
+167
+165
+165
+163
+161
+160
+158
+156
+155
+153
+151
+149
+147
+145
+144
+141
+140
+137
+135
+133
+131
+129
+127
+124
+122
+120
+117
+115
+113
+110
+108
+106
+103
+100
+98
+96
+94
+91
+89
+86
+83
+81
+78
+76
+74
+71
+68
+66
+64
+60
+59
+62
+65
+67
+70
+73
+75
+78
+80
+83
+85
+88
+90
+92
+95
+97
+100
+103
+105
+107
+109
+112
+114
+117
+119
+121
+123
+126
+128
+131
+133
+135
+137
+139
+141
+143
+146
+148
+149
+152
+153
+155
+156
+158
+160
+162
+164
+165
+167
+168
+169
+170
+172
+173
+174
+175
+175
+177
+177
+177
+178
+178
+179
+179
+179
+179
+179
+179
+178
+178
+177
+177
+176
+175
+173
+173
+171
+171
+170
+168
+167
+165
+163
+162
+161
+159
+157
+155
+153
+151
+150
+148
+146
+143
+141
+139
+137
+134
+133
+130
+128
+126
+124
+122
+119
+117
+114
+112
+109
+107
+105
+102
+100
+97
+95
+92
+90
+88
+84
+83
+80
+77
+75
+72
+70
+67
+65
+62
+61
+63
+66
+68
+71
+73
+76
+79
+81
+84
+86
+89
+91
+94
+96
+99
+102
+104
+106
+109
+111
+113
+116
+119
+120
+123
+125
+127
+130
+132
+134
+137
+139
+141
+143
+145
+147
+150
+151
+154
+155
+157
+159
+161
+162
+165
+165
+167
+169
+171
+172
+173
+174
+176
+177
+178
+178
+179
+180
+181
+181
+181
+182
+182
+182
+182
+182
+181
+181
+180
+180
+179
+178
+178
+176
+176
+175
+173
+172
+170
+169
+167
+166
+164
+162
+160
+159
+157
+155
+154
+152
+149
+147
+146
+143
+141
+139
+136
+134
+132
+130
+128
+125
+123
+120
+118
+116
+114
+111
+109
+106
+104
+101
+98
+96
+94
+91
+89
+87
+83
+81
+79
+76
+73
+71
+69
+65
+63
+61
+64
+66
+69
+72
+74
+77
+80
+82
+85
+88
+90
+93
+95
+98
+100
+102
+105
+107
+110
+112
+115
+117
+120
+122
+124
+127
+129
+131
+134
+136
+139
+141
+143
+145
+147
+150
+151
+154
+155
+158
+159
+161
+163
+164
+167
+168
+170
+171
+173
+174
+176
+177
+178
+179
+180
+181
+182
+183
+183
+183
+184
+185
+185
+185
+185
+185
+184
+184
+183
+183
+182
+182
+180
+179
+178
+177
+175
+174
+173
+172
+169
+168
+167
+165
+163
+161
+159
+158
+155
+153
+151
+149
+147
+145
+143
+141
+138
+136
+134
+131
+130
+127
+124
+122
+120
+117
+115
+113
+110
+108
+105
+103
+100
+97
+95
+92
+90
+87
+85
+82
+79
+77
+74
+72
+69
+66
+64
+63
+65
+68
+70
+73
+75
+78
+81
+83
+86
+88
+91
+94
+97
+99
+101
+104
+106
+109
+111
+114
+116
+118
+121
+124
+126
+128
+131
+133
+136
+138
+140
+142
+145
+147
+149
+151
+154
+156
+157
+159
+161
+164
+166
+167
+169
+170
+172
+173
+175
+177
+178
+180
+180
+182
+183
+184
+185
+185
+186
+187
+187
+187
+187
+188
+187
+187
+186
+186
+186
+186
+184
+184
+183
+182
+181
+179
+178
+177
+176
+174
+172
+171
+169
+167
+165
+163
+162
+159
+157
+155
+154
+151
+149
+146
+144
+142
+140
+138
+135
+133
+131
+128
+126
+123
+121
+119
+116
+114
+112
+109
+107
+104
+101
+99
+96
+94
+91
+88
+86
+84
+81
+78
+76
+73
+70
+67
+65
+64
+66
+69
+72
+74
+76
+79
+82
+84
+87
+90
+92
+95
+97
+100
+103
+105
+108
+110
+113
+115
+118
+120
+122
+125
+128
+130
+132
+135
+137
+139
+142
+144
+146
+149
+151
+153
+155
+158
+160
+161
+163
+166
+167
+169
+171
+172
+174
+176
+178
+179
+180
+181
+183
+184
+186
+186
+187
+188
+188
+189
+190
+190
+191
+190
+190
+190
+190
+189
+188
+188
+187
+187
+185
+184
+184
+182
+180
+179
+177
+176
+175
+172
+171
+169
+168
+166
+163
+161
+160
+157
+155
+153
+151
+148
+146
+144
+141
+140
+137
+134
+133
+130
+128
+125
+122
+120
+118
+115
+112
+110
+108
+105
+103
+100
+97
+95
+92
+90
+88
+84
+82
+79
+77
+74
+71
+68
+66
+64
+67
+70
+73
+75
+77
+80
+83
+86
+88
+91
+93
+96
+99
+101
+104
+106
+109
+112
+114
+116
+119
+122
+124
+126
+129
+131
+134
+137
+138
+141
+144
+145
+148
+150
+152
+155
+157
+159
+161
+163
+166
+168
+170
+171
+173
+175
+177
+179
+180
+181
+183
+184
+186
+187
+188
+189
+189
+191
+191
+192
+193
+193
+193
+193
+193
+193
+193
+192
+192
+191
+190
+189
+188
+187
+186
+185
+183
+181
+180
+179
+177
+175
+173
+171
+169
+168
+165
+163
+161
+159
+157
+155
+152
+150
+148
+146
+143
+141
+138
+136
+134
+131
+129
+126
+124
+121
+119
+117
+114
+111
+108
+107
+104
+102
+98
+96
+94
+90
+88
+85
+83
+80
+77
+75
+72
+70
+67
+65
+68
+71
+73
+76
+79
+81
+84
+86
+89
+91
+94
+97
+100
+102
+105
+108
+110
+112
+115
+118
+120
+123
+125
+128
+130
+133
+135
+138
+140
+142
+145
+147
+150
+152
+154
+157
+158
+161
+163
+165
+167
+169
+171
+174
+175
+178
+179
+181
+182
+184
+185
+187
+188
+189
+190
+192
+193
+193
+194
+194
+195
+195
+195
+196
+196
+196
+196
+195
+194
+193
+193
+191
+190
+189
+188
+187
+185
+184
+182
+180
+179
+177
+175
+173
+171
+169
+167
+165
+163
+160
+159
+156
+154
+152
+149
+147
+144
+143
+140
+138
+135
+132
+130
+127
+125
+123
+120
+117
+115
+113
+110
+108
+104
+102
+100
+97
+94
+92
+89
+86
+83
+81
+78
+75
+73
+71
+68
+66
+69
+71
+74
+76
+79
+82
+84
+88
+90
+93
+96
+98
+100
+104
+106
+108
+111
+114
+116
+119
+121
+124
+126
+129
+132
+134
+136
+139
+141
+144
+146
+149
+151
+153
+156
+158
+160
+163
+165
+167
+169
+171
+173
+175
+177
+179
+181
+183
+185
+186
+188
+189
+191
+192
+193
+194
+195
+196
+197
+197
+198
+198
+199
+199
+199
+198
+198
+198
+197
+196
+196
+195
+193
+192
+190
+190
+188
+186
+185
+183
+181
+180
+177
+175
+173
+171
+170
+167
+165
+163
+160
+158
+155
+154
+151
+149
+146
+144
+141
+139
+136
+134
+131
+129
+127
+124
+122
+119
+116
+114
+111
+109
+105
+103
+101
+98
+96
+93
+90
+88
+85
+82
+80
+77
+74
+72
+68
+67
+70
+73
+75
+77
+81
+83
+86
+88
+91
+93
+97
+99
+101
+104
+107
+110
+112
+115
+117
+120
+123
+126
+128
+131
+133
+135
+138
+140
+143
+145
+148
+150
+152
+155
+158
+160
+162
+164
+166
+169
+171
+173
+175
+178
+180
+182
+183
+185
+187
+188
+190
+192
+193
+194
+196
+197
+198
+199
+199
+201
+200
+201
+201
+201
+201
+202
+201
+200
+199
+199
+198
+197
+196
+194
+193
+192
+190
+189
+187
+185
+183
+181
+180
+178
+175
+173
+171
+169
+166
+165
+162
+160
+157
+155
+153
+150
+148
+145
+143
+140
+138
+136
+132
+131
+127
+125
+123
+120
+118
+115
+113
+110
+107
+104
+101
+99
+97
+94
+91
+88
+86
+83
+81
+78
+75
+72
+70
+67
+71
+74
+76
+78
+82
+84
+87
+89
+92
+95
+97
+100
+103
+105
+108
+110
+113
+116
+119
+121
+123
+126
+129
+131
+134
+137
+140
+141
+145
+147
+149
+152
+154
+156
+159
+161
+163
+166
+168
+171
+172
+175
+177
+179
+181
+183
+185
+187
+189
+191
+192
+194
+195
+197
+198
+199
+200
+202
+202
+203
+203
+204
+205
+205
+204
+204
+204
+203
+202
+201
+201
+199
+199
+197
+195
+194
+192
+191
+189
+187
+185
+183
+181
+179
+177
+175
+172
+171
+168
+166
+164
+162
+159
+156
+154
+152
+149
+146
+144
+141
+139
+137
+133
+131
+129
+126
+124
+121
+118
+116
+113
+110
+108
+105
+103
+100
+97
+94
+92
+89
+86
+84
+81
+79
+76
+73
+71
+69
+71
+73
+77
+79
+82
+85
+88
+90
+93
+95
+98
+101
+104
+106
+109
+111
+114
+117
+120
+122
+125
+128
+130
+133
+135
+137
+141
+143
+145
+148
+151
+153
+155
+157
+161
+163
+165
+168
+170
+172
+175
+177
+179
+181
+183
+185
+187
+189
+191
+193
+194
+196
+197
+199
+200
+202
+203
+204
+205
+206
+207
+207
+207
+207
+207
+207
+207
+206
+205
+205
+204
+202
+200
+200
+198
+197
+194
+193
+191
+189
+188
+185
+183
+181
+179
+176
+175
+173
+170
+167
+165
+163
+160
+158
+155
+153
+150
+148
+146
+142
+140
+137
+135
+133
+129
+127
+125
+122
+119
+117
+114
+112
+109
+106
+103
+101
+98
+95
+93
+90
+87
+85
+82
+79
+76
+74
+71
+69
+72
+74
+77
+80
+83
+85
+88
+90
+94
+96
+99
+102
+104
+107
+110
+113
+115
+118
+120
+123
+126
+129
+131
+134
+136
+139
+141
+144
+147
+149
+152
+154
+157
+159
+161
+165
+166
+169
+171
+174
+176
+178
+180
+183
+185
+187
+189
+191
+193
+195
+197
+199
+201
+202
+203
+205
+206
+207
+208
+208
+210
+210
+210
+210
+210
+209
+209
+209
+208
+207
+206
+204
+204
+202
+201
+199
+197
+195
+193
+191
+189
+187
+185
+183
+181
+178
+176
+174
+171
+169
+167
+165
+162
+159
+157
+154
+151
+149
+147
+144
+141
+139
+137
+134
+131
+129
+126
+123
+120
+118
+115
+112
+109
+107
+105
+102
+99
+96
+94
+91
+88
+86
+83
+80
+78
+74
+72
+70
+73
+76
+78
+81
+84
+86
+88
+92
+95
+98
+100
+103
+106
+108
+111
+114
+116
+118
+121
+124
+126
+129
+132
+134
+137
+140
+142
+145
+148
+150
+153
+155
+158
+160
+163
+165
+168
+171
+173
+175
+178
+180
+182
+185
+187
+189
+191
+194
+195
+197
+199
+201
+203
+204
+206
+207
+209
+209
+211
+212
+212
+212
+213
+212
+213
+213
+212
+212
+211
+210
+209
+207
+206
+204
+202
+201
+199
+198
+195
+193
+191
+189
+187
+184
+182
+180
+177
+175
+173
+170
+168
+166
+163
+160
+158
+155
+152
+151
+148
+145
+142
+140
+138
+134
+132
+129
+127
+124
+121
+119
+116
+113
+110
+108
+105
+102
+100
+97
+94
+91
+89
+86
+83
+81
+78
+75
+72
+71
+73
+76
+78
+81
+85
+87
+90
+92
+95
+98
+100
+103
+106
+109
+112
+114
+116
+119
+123
+125
+127
+130
+133
+135
+139
+141
+143
+146
+149
+152
+154
+157
+160
+162
+164
+167
+170
+172
+175
+177
+179
+181
+184
+186
+189
+191
+193
+195
+197
+199
+202
+203
+205
+207
+208
+210
+211
+212
+213
+214
+215
+215
+216
+216
+215
+215
+215
+214
+213
+212
+211
+209
+208
+207
+205
+203
+201
+199
+198
+195
+193
+191
+189
+186
+184
+181
+179
+177
+175
+171
+170
+167
+164
+162
+159
+157
+154
+152
+149
+146
+144
+141
+138
+136
+133
+131
+128
+125
+122
+119
+117
+114
+111
+109
+106
+103
+101
+98
+95
+93
+90
+87
+84
+81
+79
+76
+73
+71
+74
+77
+79
+82
+85
+88
+91
+93
+95
+98
+101
+104
+106
+109
+112
+114
+118
+120
+123
+126
+128
+131
+134
+136
+139
+142
+145
+147
+149
+153
+155
+158
+160
+163
+165
+169
+171
+173
+176
+178
+181
+183
+186
+188
+190
+192
+195
+197
+199
+201
+203
+206
+207
+209
+210
+212
+213
+215
+216
+216
+218
+218
+218
+219
+218
+218
+217
+217
+216
+215
+214
+212
+211
+208
+207
+205
+204
+201
+199
+197
+195
+192
+190
+188
+185
+183
+181
+178
+175
+173
+171
+168
+165
+163
+161
+158
+156
+152
+149
+147
+144
+141
+139
+136
+133
+131
+128
+126
+123
+120
+118
+115
+112
+109
+107
+104
+101
+99
+96
+93
+90
+87
+85
+82
+79
+77
+74
+71
+74
+77
+80
+82
+85
+88
+91
+94
+96
+99
+102
+104
+107
+110
+113
+116
+118
+122
+124
+126
+129
+132
+135
+137
+141
+143
+145
+148
+150
+153
+156
+158
+161
+164
+167
+170
+172
+174
+177
+179
+182
+185
+187
+190
+191
+194
+197
+199
+201
+203
+205
+207
+209
+211
+213
+214
+216
+217
+218
+220
+221
+220
+221
+221
+221
+221
+220
+219
+218
+217
+216
+215
+212
+211
+209
+207
+205
+203
+201
+198
+197
+194
+192
+190
+187
+185
+182
+179
+177
+174
+172
+169
+167
+164
+161
+159
+156
+154
+150
+148
+145
+143
+140
+138
+134
+132
+129
+126
+124
+121
+118
+115
+112
+110
+108
+105
+102
+100
+96
+94
+91
+88
+86
+82
+80
+77
+74
+72
+75
+77
+80
+83
+86
+89
+92
+95
+97
+100
+102
+105
+108
+111
+113
+117
+119
+122
+124
+128
+130
+133
+135
+139
+140
+144
+146
+149
+152
+154
+157
+160
+162
+165
+168
+171
+173
+175
+178
+181
+183
+186
+188
+190
+193
+195
+198
+201
+203
+205
+207
+209
+211
+213
+214
+217
+219
+220
+221
+222
+223
+223
+223
+224
+224
+223
+223
+222
+221
+219
+218
+217
+215
+213
+211
+209
+207
+205
+203
+200
+198
+196
+193
+191
+188
+185
+184
+180
+178
+175
+173
+170
+167
+165
+163
+160
+157
+154
+151
+149
+146
+143
+141
+138
+136
+133
+130
+127
+125
+122
+119
+116
+113
+110
+108
+106
+102
+100
+97
+94
+92
+89
+86
+83
+81
+77
+75
+73
+75
+78
+81
+84
+87
+89
+92
+95
+97
+101
+103
+106
+108
+111
+114
+117
+119
+122
+125
+128
+131
+134
+136
+139
+142
+145
+147
+150
+152
+155
+158
+161
+163
+166
+168
+171
+174
+177
+179
+182
+185
+187
+190
+192
+195
+197
+200
+201
+205
+206
+209
+211
+213
+215
+217
+219
+221
+222
+224
+224
+226
+227
+226
+227
+227
+226
+225
+225
+224
+222
+221
+219
+217
+215
+214
+211
+208
+207
+204
+202
+200
+197
+194
+192
+190
+187
+184
+182
+179
+177
+174
+172
+168
+166
+164
+161
+158
+156
+153
+150
+147
+144
+142
+139
+136
+133
+131
+128
+125
+122
+120
+117
+114
+112
+109
+106
+103
+100
+97
+95
+92
+89
+87
+83
+80
+78
+75
+73
+76
+78
+81
+84
+87
+89
+92
+95
+98
+101
+104
+106
+109
+112
+115
+117
+120
+123
+126
+128
+132
+134
+137
+140
+142
+145
+148
+150
+154
+156
+158
+161
+164
+167
+170
+172
+175
+177
+180
+183
+185
+188
+191
+193
+196
+198
+201
+203
+205
+208
+210
+213
+215
+218
+219
+221
+223
+225
+226
+227
+229
+229
+230
+229
+229
+229
+228
+227
+226
+224
+223
+221
+219
+217
+215
+213
+210
+208
+206
+203
+201
+199
+196
+193
+191
+188
+185
+183
+180
+178
+175
+172
+169
+167
+164
+161
+159
+156
+154
+150
+148
+145
+143
+140
+136
+134
+131
+129
+125
+123
+120
+118
+114
+112
+110
+107
+103
+101
+98
+95
+93
+90
+87
+84
+82
+78
+76
+74
+76
+79
+81
+85
+88
+90
+93
+95
+98
+101
+104
+107
+109
+112
+115
+117
+121
+123
+126
+129
+132
+135
+137
+140
+142
+146
+148
+151
+154
+156
+159
+162
+164
+167
+170
+173
+176
+179
+181
+184
+186
+189
+192
+194
+197
+200
+202
+205
+207
+210
+212
+215
+217
+219
+221
+223
+225
+227
+228
+229
+231
+231
+232
+233
+232
+232
+231
+229
+228
+227
+225
+223
+221
+219
+216
+214
+212
+209
+207
+204
+202
+200
+197
+194
+192
+189
+187
+184
+181
+178
+176
+173
+170
+168
+164
+163
+160
+157
+154
+151
+148
+146
+143
+140
+137
+134
+131
+129
+126
+124
+120
+117
+115
+113
+110
+106
+104
+102
+98
+95
+93
+90
+87
+84
+81
+78
+76
+74
+76
+80
+83
+85
+88
+90
+94
+96
+99
+101
+104
+107
+110
+113
+116
+118
+122
+124
+127
+129
+132
+135
+138
+140
+144
+146
+149
+151
+155
+157
+160
+163
+166
+168
+171
+174
+176
+179
+181
+185
+187
+190
+192
+195
+198
+200
+203
+206
+208
+210
+214
+216
+218
+221
+223
+225
+227
+229
+231
+232
+233
+235
+235
+235
+235
+234
+234
+232
+231
+229
+228
+225
+223
+221
+219
+216
+214
+211
+209
+206
+203
+201
+198
+196
+193
+190
+187
+184
+182
+179
+177
+174
+171
+168
+166
+163
+160
+157
+154
+151
+149
+146
+143
+141
+138
+135
+132
+129
+127
+124
+121
+118
+115
+113
+110
+107
+104
+102
+98
+96
+93
+91
+88
+85
+82
+79
+76
+73
+76
+80
+82
+85
+88
+91
+94
+96
+100
+102
+105
+107
+110
+113
+115
+119
+122
+125
+127
+130
+133
+136
+138
+141
+144
+147
+149
+152
+155
+158
+161
+164
+166
+169
+172
+174
+177
+179
+182
+185
+188
+191
+193
+197
+199
+202
+204
+207
+210
+212
+215
+217
+220
+222
+225
+227
+229
+232
+233
+235
+236
+237
+238
+238
+238
+238
+236
+235
+233
+231
+229
+226
+224
+222
+219
+218
+215
+212
+210
+207
+205
+202
+199
+196
+193
+191
+188
+186
+183
+179
+177
+175
+171
+169
+166
+163
+161
+158
+155
+152
+150
+146
+144
+141
+138
+135
+132
+130
+127
+125
+121
+119
+116
+113
+111
+107
+105
+102
+99
+96
+94
+91
+88
+86
+82
+80
+76
+75
+76
+80
+82
+86
+88
+91
+93
+97
+99
+102
+105
+108
+111
+113
+116
+119
+121
+124
+127
+130
+133
+136
+139
+141
+144
+147
+150
+153
+155
+159
+161
+163
+166
+169
+172
+174
+178
+180
+183
+186
+188
+192
+194
+196
+200
+202
+205
+208
+210
+213
+215
+218
+221
+224
+226
+229
+231
+233
+235
+237
+239
+240
+240
+241
+241
+240
+239
+237
+235
+233
+231
+228
+226
+223
+221
+218
+216
+213
+210
+208
+205
+202
+200
+197
+194
+191
+189
+186
+183
+181
+177
+175
+172
+169
+167
+163
+161
+158
+155
+152
+149
+147
+144
+141
+139
+136
+133
+130
+127
+125
+122
+119
+116
+113
+110
+108
+105
+102
+100
+97
+94
+91
+88
+85
+83
+80
+77
+75
+77
+80
+83
+85
+88
+91
+94
+97
+99
+102
+105
+108
+111
+114
+116
+120
+122
+125
+128
+130
+133
+136
+139
+142
+145
+148
+150
+153
+156
+158
+161
+164
+167
+169
+173
+176
+178
+180
+184
+186
+189
+192
+195
+197
+200
+203
+206
+209
+212
+214
+217
+220
+222
+225
+227
+230
+232
+234
+237
+240
+241
+243
+243
+244
+243
+242
+241
+239
+237
+235
+232
+230
+227
+224
+222
+219
+216
+214
+211
+208
+206
+203
+200
+197
+194
+192
+190
+186
+183
+181
+178
+175
+173
+170
+166
+164
+161
+158
+156
+153
+150
+147
+145
+141
+139
+136
+134
+131
+128
+125
+122
+119
+117
+114
+111
+108
+105
+102
+99
+97
+94
+91
+88
+85
+83
+80
+77
+74
+77
+80
+83
+86
+88
+92
+94
+97
+100
+102
+105
+108
+111
+113
+117
+119
+123
+125
+128
+131
+133
+137
+139
+141
+145
+148
+151
+153
+156
+159
+161
+164
+168
+170
+173
+176
+178
+181
+184
+187
+189
+193
+196
+198
+200
+204
+206
+209
+212
+214
+218
+220
+223
+226
+229
+231
+234
+236
+239
+241
+243
+245
+246
+247
+246
+245
+243
+241
+239
+236
+234
+231
+228
+226
+223
+220
+217
+214
+212
+209
+206
+204
+201
+198
+196
+193
+190
+187
+184
+181
+179
+176
+173
+170
+168
+164
+162
+159
+156
+153
+151
+148
+145
+142
+139
+137
+133
+130
+128
+125
+122
+119
+117
+114
+111
+108
+105
+103
+100
+97
+94
+92
+88
+86
+83
+80
+77
+75
+77
+80
+83
+86
+88
+92
+94
+97
+100
+103
+106
+109
+111
+114
+117
+119
+122
+125
+128
+131
+134
+136
+140
+142
+145
+148
+151
+153
+156
+159
+162
+165
+167
+170
+173
+176
+178
+182
+185
+187
+190
+193
+196
+199
+202
+204
+207
+209
+213
+215
+218
+220
+223
+227
+229
+232
+235
+238
+240
+242
+245
+247
+249
+250
+249
+247
+245
+242
+240
+237
+234
+232
+229
+226
+224
+221
+218
+216
+213
+210
+206
+204
+201
+198
+196
+193
+190
+187
+185
+182
+178
+175
+173
+170
+168
+164
+162
+159
+156
+153
+150
+148
+145
+142
+139
+136
+133
+131
+128
+126
+122
+120
+117
+114
+111
+109
+106
+103
+100
+97
+94
+91
+89
+85
+83
+80
+77
+75
+77
+80
+83
+86
+89
+91
+94
+97
+100
+102
+106
+109
+112
+115
+117
+120
+123
+125
+128
+131
+134
+137
+139
+142
+145
+147
+151
+154
+156
+159
+162
+164
+167
+171
+174
+176
+179
+181
+185
+187
+190
+193
+196
+198
+202
+204
+207
+210
+213
+216
+218
+221
+224
+227
+230
+232
+235
+238
+241
+243
+246
+248
+251
+252
+251
+249
+246
+244
+241
+238
+235
+232
+229
+226
+224
+221
+219
+216
+213
+209
+207
+204
+202
+199
+195
+193
+190
+187
+185
+182
+179
+176
+173
+171
+168
+165
+162
+159
+156
+154
+151
+148
+146
+142
+139
+137
+134
+131
+129
+125
+123
+120
+117
+114
+112
+109
+105
+102
+100
+98
+95
+92
+89
+86
+84
+80
+77
+75
+77
+81
+83
+86
+88
+92
+94
+98
+100
+103
+105
+108
+111
+114
+117
+120
+123
+126
+128
+131
+134
+136
+139
+143
+145
+148
+151
+154
+157
+159
+163
+164
+168
+170
+174
+176
+179
+181
+185
+187
+190
+193
+196
+199
+201
+204
+207
+210
+213
+215
+219
+221
+224
+226
+230
+233
+235
+238
+241
+244
+247
+250
+252
+255
+252
+250
+246
+244
+241
+238
+236
+233
+230
+227
+224
+222
+218
+216
+213
+210
+207
+204
+202
+199
+196
+193
+190
+188
+185
+182
+179
+176
+173
+171
+167
+164
+162
+159
+156
+154
+150
+148
+145
+142
+139
+136
+133
+131
+128
+125
+122
+120
+117
+115
+111
+108
+106
+103
+100
+97
+94
+92
+89
+86
+83
+81
+78
+74
+78
+80
+83
+86
+88
+92
+95
+97
+100
+103
+106
+109
+111
+114
+117
+119
+123
+125
+128
+131
+134
+136
+140
+142
+145
+148
+151
+153
+157
+159
+162
+165
+168
+170
+173
+177
+179
+182
+185
+187
+190
+192
+196
+199
+201
+204
+207
+210
+213
+216
+218
+221
+224
+227
+230
+232
+235
+238
+241
+243
+246
+249
+251
+253
+251
+249
+246
+243
+241
+238
+235
+233
+230
+227
+224
+221
+218
+216
+213
+210
+207
+204
+201
+198
+196
+192
+191
+187
+184
+182
+179
+176
+173
+170
+168
+165
+162
+159
+156
+153
+151
+148
+145
+142
+140
+137
+133
+131
+129
+125
+122
+120
+117
+114
+111
+108
+106
+103
+100
+98
+95
+92
+89
+86
+83
+80
+78
+74
+78
+80
+83
+86
+89
+91
+94
+97
+100
+103
+105
+109
+111
+114
+116
+120
+123
+126
+128
+131
+134
+136
+139
+142
+145
+148
+150
+153
+156
+159
+162
+165
+167
+170
+173
+176
+179
+182
+184
+188
+190
+193
+196
+198
+201
+204
+207
+209
+212
+215
+218
+221
+223
+226
+229
+232
+235
+237
+239
+242
+244
+247
+249
+249
+249
+247
+245
+243
+239
+238
+235
+232
+229
+227
+224
+220
+218
+215
+213
+210
+206
+204
+201
+199
+196
+193
+189
+188
+184
+181
+179
+176
+173
+170
+168
+165
+162
+159
+156
+153
+150
+147
+145
+143
+139
+137
+133
+131
+128
+126
+122
+120
+117
+114
+112
+109
+105
+103
+100
+97
+94
+92
+89
+86
+83
+81
+77
+74
+77
+81
+83
+86
+89
+92
+95
+97
+100
+103
+105
+108
+111
+114
+116
+120
+122
+125
+128
+131
+134
+136
+140
+142
+145
+147
+151
+154
+156
+159
+162
+165
+167
+170
+172
+175
+178
+181
+184
+187
+190
+193
+195
+198
+201
+203
+206
+209
+212
+215
+217
+220
+223
+226
+229
+231
+234
+236
+239
+241
+243
+245
+246
+246
+246
+245
+243
+241
+238
+236
+234
+231
+228
+226
+222
+220
+217
+215
+212
+209
+207
+203
+201
+198
+195
+193
+190
+187
+184
+181
+178
+176
+173
+170
+167
+164
+161
+159
+156
+154
+150
+148
+145
+142
+139
+136
+134
+131
+128
+125
+122
+120
+117
+114
+111
+108
+105
+103
+100
+97
+95
+91
+89
+86
+83
+80
+77
+75
+77
+80
+83
+86
+88
+92
+94
+97
+99
+103
+106
+109
+111
+113
+117
+120
+122
+125
+128
+131
+133
+137
+139
+142
+145
+147
+151
+153
+155
+158
+161
+164
+167
+170
+173
+175
+178
+180
+183
+187
+189
+192
+194
+197
+200
+203
+205
+209
+212
+214
+217
+219
+222
+225
+227
+229
+232
+234
+237
+239
+241
+242
+243
+244
+243
+242
+241
+240
+237
+235
+233
+229
+227
+225
+222
+219
+217
+213
+211
+208
+206
+203
+200
+198
+195
+192
+189
+186
+184
+181
+178
+175
+172
+170
+167
+164
+161
+158
+156
+153
+150
+147
+144
+142
+139
+136
+133
+131
+128
+125
+122
+119
+117
+114
+111
+108
+106
+103
+100
+97
+94
+91
+89
+86
+83
+80
+77
+75
+77
+79
+83
+85
+88
+91
+94
+97
+100
+102
+105
+108
+111
+114
+116
+119
+122
+124
+127
+130
+133
+136
+139
+141
+145
+147
+150
+152
+155
+159
+161
+164
+166
+170
+172
+175
+177
+181
+184
+186
+189
+191
+195
+197
+199
+202
+205
+208
+211
+213
+216
+219
+221
+224
+226
+228
+231
+233
+235
+237
+239
+239
+241
+241
+241
+239
+238
+237
+235
+233
+231
+228
+226
+223
+221
+219
+216
+213
+210
+207
+205
+202
+200
+197
+195
+192
+189
+186
+183
+181
+177
+175
+172
+169
+166
+164
+161
+159
+155
+152
+149
+147
+144
+141
+139
+136
+133
+130
+128
+125
+122
+119
+116
+114
+110
+108
+105
+102
+100
+97
+94
+91
+89
+86
+83
+80
+77
+74
+77
+79
+82
+85
+88
+90
+93
+96
+99
+102
+105
+107
+110
+113
+116
+119
+121
+125
+127
+130
+133
+135
+138
+141
+143
+147
+149
+152
+155
+158
+161
+163
+166
+169
+172
+174
+177
+180
+182
+185
+188
+191
+194
+196
+199
+201
+204
+207
+209
+212
+215
+217
+220
+222
+224
+227
+229
+231
+233
+235
+236
+237
+238
+238
+237
+238
+236
+235
+233
+231
+229
+227
+224
+223
+219
+218
+214
+212
+209
+207
+204
+201
+199
+197
+193
+190
+188
+185
+183
+180
+177
+174
+171
+169
+166
+163
+160
+157
+155
+152
+149
+147
+144
+141
+139
+135
+132
+130
+127
+124
+122
+118
+116
+113
+111
+108
+105
+102
+99
+96
+94
+91
+88
+86
+82
+80
+77
+74
+77
+79
+82
+85
+87
+90
+93
+96
+99
+102
+104
+107
+110
+113
+115
+118
+121
+123
+127
+130
+132
+135
+138
+141
+144
+147
+149
+152
+155
+157
+160
+162
+166
+168
+171
+174
+176
+179
+182
+185
+187
+190
+193
+196
+198
+200
+203
+206
+208
+211
+213
+216
+219
+220
+223
+225
+227
+229
+231
+233
+234
+235
+235
+235
+235
+234
+233
+232
+231
+229
+227
+225
+223
+220
+218
+215
+213
+211
+208
+206
+203
+201
+198
+195
+192
+190
+187
+184
+182
+180
+176
+174
+171
+168
+165
+162
+160
+157
+155
+152
+149
+146
+143
+141
+138
+135
+132
+130
+126
+124
+121
+118
+116
+113
+110
+107
+104
+102
+99
+96
+93
+91
+88
+85
+82
+79
+76
+73
+77
+79
+81
+85
+88
+90
+93
+96
+98
+101
+104
+106
+109
+112
+115
+118
+120
+124
+126
+129
+132
+134
+137
+140
+143
+146
+149
+151
+154
+157
+159
+162
+165
+167
+170
+173
+176
+178
+181
+184
+187
+189
+191
+194
+197
+200
+202
+204
+207
+210
+212
+214
+217
+218
+221
+223
+225
+227
+228
+229
+231
+232
+233
+233
+233
+232
+230
+230
+229
+227
+225
+223
+221
+219
+217
+215
+212
+209
+208
+205
+202
+200
+197
+195
+191
+189
+186
+184
+181
+179
+175
+173
+170
+167
+165
+162
+159
+157
+153
+151
+148
+146
+143
+140
+137
+135
+132
+129
+127
+124
+120
+118
+115
+112
+109
+106
+104
+101
+99
+95
+93
+90
+87
+84
+82
+79
+76
+73
+76
+79
+81
+84
+86
+89
+93
+95
+98
+101
+104
+106
+109
+112
+114
+117
+121
+123
+126
+129
+131
+134
+136
+139
+142
+145
+147
+151
+153
+156
+158
+162
+164
+167
+170
+172
+175
+177
+180
+183
+185
+188
+191
+193
+196
+199
+201
+203
+205
+208
+210
+213
+215
+217
+219
+221
+222
+224
+226
+227
+228
+229
+230
+230
+229
+229
+228
+227
+226
+225
+223
+221
+219
+217
+215
+213
+210
+208
+206
+204
+201
+198
+196
+193
+191
+188
+186
+182
+180
+178
+174
+172
+169
+166
+164
+162
+159
+156
+153
+150
+148
+145
+142
+139
+137
+134
+131
+128
+126
+123
+121
+118
+115
+112
+109
+106
+103
+101
+98
+95
+92
+90
+87
+84
+81
+78
+75
+72
+76
+78
+81
+83
+87
+89
+92
+95
+97
+101
+103
+106
+109
+112
+115
+117
+119
+123
+126
+128
+130
+133
+136
+139
+142
+144
+147
+149
+153
+155
+158
+160
+163
+166
+169
+171
+173
+177
+179
+181
+184
+187
+189
+192
+194
+197
+199
+202
+204
+207
+209
+211
+214
+215
+217
+219
+221
+223
+223
+224
+226
+227
+227
+226
+226
+227
+226
+225
+223
+223
+221
+218
+217
+215
+214
+211
+209
+207
+204
+202
+200
+197
+195
+192
+190
+187
+184
+182
+179
+176
+173
+171
+168
+166
+163
+161
+158
+156
+153
+150
+147
+144
+142
+139
+136
+133
+131
+128
+125
+122
+119
+117
+114
+111
+109
+105
+103
+100
+97
+95
+92
+89
+86
+83
+80
+78
+75
+72
+75
+77
+80
+83
+86
+89
+91
+94
+97
+99
+102
+105
+108
+111
+114
+116
+119
+121
+124
+127
+130
+132
+136
+138
+141
+143
+146
+149
+151
+154
+157
+159
+163
+165
+168
+170
+173
+176
+178
+181
+184
+186
+188
+191
+193
+196
+198
+200
+203
+205
+207
+209
+211
+213
+215
+216
+218
+220
+221
+222
+223
+223
+224
+224
+224
+223
+223
+222
+220
+220
+219
+217
+215
+213
+211
+209
+207
+205
+202
+200
+198
+196
+193
+191
+188
+186
+183
+181
+178
+175
+173
+170
+168
+165
+162
+160
+157
+155
+152
+149
+146
+143
+140
+138
+135
+133
+130
+127
+124
+121
+119
+116
+113
+111
+108
+105
+102
+99
+97
+95
+92
+89
+86
+83
+80
+77
+75
+72
+74
+77
+80
+82
+85
+88
+91
+94
+97
+99
+102
+105
+107
+111
+112
+116
+119
+122
+124
+126
+130
+132
+134
+137
+140
+143
+146
+148
+151
+153
+156
+159
+161
+164
+167
+169
+172
+174
+176
+179
+182
+185
+186
+190
+192
+194
+196
+199
+200
+203
+206
+208
+209
+211
+213
+214
+216
+217
+219
+220
+220
+221
+221
+221
+221
+221
+220
+220
+218
+217
+215
+215
+212
+211
+209
+207
+205
+203
+201
+199
+197
+194
+192
+190
+186
+185
+182
+179
+177
+175
+172
+169
+167
+164
+161
+159
+156
+153
+151
+148
+145
+143
+140
+137
+135
+132
+129
+127
+124
+121
+118
+115
+113
+110
+107
+104
+102
+99
+96
+93
+91
+88
+86
+83
+79
+77
+74
+71
+74
+77
+79
+82
+85
+88
+91
+93
+95
+99
+102
+104
+106
+109
+112
+115
+117
+120
+123
+125
+129
+132
+134
+137
+139
+142
+145
+147
+150
+152
+155
+158
+161
+163
+165
+168
+171
+173
+175
+178
+180
+183
+186
+188
+190
+193
+194
+197
+199
+201
+203
+206
+207
+209
+210
+212
+213
+214
+215
+216
+217
+218
+218
+218
+218
+218
+217
+217
+216
+215
+214
+212
+211
+209
+207
+205
+203
+202
+199
+197
+195
+193
+190
+188
+185
+183
+180
+178
+176
+173
+170
+168
+166
+163
+160
+157
+155
+153
+150
+147
+145
+142
+139
+136
+134
+131
+128
+126
+123
+120
+117
+115
+112
+109
+107
+104
+101
+99
+96
+93
+90
+88
+85
+82
+80
+76
+74
+71
+73
+76
+79
+82
+84
+87
+90
+92
+95
+98
+100
+104
+106
+109
+112
+114
+116
+120
+122
+125
+128
+130
+133
+136
+138
+141
+143
+147
+149
+151
+154
+156
+159
+162
+165
+167
+169
+172
+174
+177
+179
+181
+184
+186
+188
+191
+193
+195
+197
+199
+201
+203
+205
+207
+208
+209
+211
+212
+214
+214
+214
+215
+216
+216
+215
+215
+215
+214
+213
+212
+211
+210
+208
+207
+205
+203
+201
+199
+198
+195
+193
+190
+188
+186
+184
+182
+180
+177
+174
+171
+169
+167
+164
+162
+159
+157
+154
+151
+149
+146
+144
+141
+139
+135
+133
+131
+128
+125
+122
+120
+117
+114
+112
+108
+106
+103
+101
+98
+96
+92
+90
+87
+84
+81
+79
+76
+73
+70
+72
+75
+78
+81
+83
+86
+89
+91
+94
+97
+100
+102
+105
+108
+110
+113
+116
+119
+121
+124
+127
+129
+132
+134
+137
+140
+142
+145
+148
+150
+153
+155
+158
+160
+163
+165
+168
+171
+173
+176
+178
+180
+182
+185
+187
+189
+191
+193
+195
+197
+199
+201
+203
+205
+206
+207
+208
+210
+210
+211
+212
+212
+213
+212
+213
+212
+212
+212
+211
+209
+208
+207
+206
+204
+203
+200
+199
+197
+195
+193
+191
+189
+187
+185
+182
+180
+178
+176
+173
+170
+168
+165
+163
+160
+158
+155
+153
+151
+148
+145
+142
+139
+138
+135
+132
+130
+126
+124
+121
+118
+116
+114
+111
+108
+106
+103
+100
+97
+94
+92
+89
+86
+83
+81
+78
+75
+72
+69
+72
+75
+77
+80
+83
+86
+88
+91
+93
+96
+99
+101
+104
+107
+110
+112
+115
+117
+120
+123
+126
+128
+131
+133
+136
+139
+142
+144
+147
+149
+152
+154
+157
+159
+161
+164
+166
+169
+171
+174
+176
+179
+180
+183
+185
+187
+189
+191
+193
+195
+197
+199
+200
+202
+203
+205
+206
+207
+208
+209
+209
+210
+210
+210
+210
+210
+209
+209
+208
+207
+206
+204
+203
+202
+200
+199
+197
+195
+193
+191
+189
+188
+185
+183
+180
+178
+176
+173
+172
+169
+167
+164
+161
+160
+156
+154
+152
+149
+147
+144
+142
+139
+136
+133
+131
+128
+125
+123
+120
+118
+115
+112
+110
+107
+104
+102
+99
+97
+94
+91
+89
+85
+83
+80
+78
+74
+72
+68
+71
+74
+76
+79
+82
+85
+88
+90
+93
+95
+98
+101
+104
+107
+109
+112
+114
+117
+119
+122
+125
+127
+130
+133
+136
+138
+140
+142
+146
+147
+151
+152
+156
+158
+160
+163
+165
+168
+170
+172
+174
+177
+179
+181
+183
+185
+187
+189
+191
+193
+195
+196
+198
+200
+200
+202
+204
+204
+205
+205
+206
+206
+207
+207
+207
+207
+206
+206
+205
+204
+203
+202
+201
+199
+198
+197
+195
+193
+191
+190
+187
+185
+183
+181
+179
+177
+175
+173
+169
+168
+166
+163
+160
+158
+156
+153
+150
+148
+146
+143
+140
+138
+135
+133
+130
+128
+125
+122
+119
+117
+114
+112
+109
+106
+104
+101
+99
+95
+93
+91
+87
+85
+82
+79
+77
+73
+71
+68
+70
+73
+76
+79
+81
+84
+87
+89
+92
+95
+97
+100
+103
+105
+108
+111
+113
+116
+118
+121
+124
+126
+129
+131
+134
+137
+139
+141
+144
+147
+149
+151
+154
+157
+159
+161
+163
+166
+168
+170
+172
+175
+177
+180
+181
+183
+185
+187
+189
+191
+192
+194
+196
+197
+198
+200
+201
+202
+203
+203
+203
+204
+204
+204
+205
+204
+204
+203
+202
+202
+201
+200
+198
+197
+195
+194
+193
+191
+189
+187
+185
+184
+181
+179
+177
+175
+173
+170
+168
+166
+164
+162
+158
+157
+154
+152
+149
+146
+144
+142
+139
+136
+134
+132
+129
+126
+123
+121
+118
+116
+113
+110
+108
+105
+102
+100
+97
+95
+92
+89
+87
+84
+81
+78
+76
+73
+70
+67
+70
+72
+75
+77
+81
+83
+86
+89
+91
+94
+97
+99
+102
+104
+107
+110
+113
+115
+118
+120
+123
+125
+128
+131
+132
+135
+138
+141
+142
+145
+147
+150
+152
+155
+158
+160
+162
+164
+167
+168
+171
+173
+175
+177
+179
+181
+184
+185
+187
+188
+190
+192
+193
+195
+196
+196
+198
+199
+200
+200
+201
+201
+201
+202
+202
+201
+201
+201
+200
+199
+198
+197
+196
+194
+193
+192
+190
+189
+187
+185
+183
+182
+180
+177
+176
+173
+171
+169
+167
+165
+162
+160
+157
+155
+153
+150
+148
+146
+143
+141
+138
+136
+133
+131
+128
+126
+123
+120
+117
+115
+112
+110
+107
+105
+102
+99
+97
+94
+91
+89
+86
+83
+80
+77
+75
+72
+69
+66
+69
+72
+74
+77
+79
+82
+85
+87
+90
+93
+96
+98
+100
+104
+106
+108
+111
+113
+116
+119
+121
+124
+126
+129
+132
+134
+136
+139
+141
+144
+146
+149
+151
+154
+155
+158
+160
+163
+165
+167
+169
+172
+174
+175
+177
+179
+181
+183
+185
+186
+188
+189
+190
+192
+194
+194
+196
+196
+197
+197
+198
+198
+198
+199
+199
+198
+198
+198
+197
+196
+196
+194
+194
+192
+190
+189
+187
+186
+185
+183
+181
+180
+177
+175
+173
+172
+169
+167
+164
+162
+160
+158
+155
+154
+151
+149
+146
+143
+141
+139
+136
+134
+132
+129
+127
+124
+122
+119
+117
+114
+111
+109
+106
+103
+100
+98
+95
+92
+90
+88
+85
+82
+79
+77
+74
+71
+68
+65
+68
+71
+73
+76
+78
+82
+84
+86
+90
+92
+94
+97
+99
+102
+105
+107
+110
+113
+115
+117
+120
+122
+126
+128
+130
+132
+136
+137
+140
+143
+145
+147
+149
+152
+154
+156
+159
+161
+163
+166
+168
+169
+172
+174
+175
+177
+179
+180
+182
+184
+186
+187
+188
+190
+190
+191
+193
+193
+194
+195
+196
+195
+196
+196
+195
+196
+195
+194
+194
+194
+193
+192
+191
+189
+188
+186
+186
+184
+182
+181
+179
+177
+175
+173
+171
+170
+167
+165
+163
+161
+159
+157
+154
+152
+150
+147
+144
+143
+140
+137
+135
+133
+130
+128
+125
+123
+120
+117
+115
+112
+110
+108
+105
+103
+99
+97
+94
+91
+89
+87
+84
+81
+78
+76
+73
+71
+68
+64
+67
+70
+72
+75
+77
+81
+83
+85
+88
+91
+93
+96
+99
+101
+104
+107
+109
+112
+114
+117
+119
+121
+124
+126
+129
+132
+133
+136
+138
+141
+143
+145
+148
+150
+152
+155
+157
+159
+161
+163
+165
+167
+169
+171
+173
+175
+177
+179
+180
+182
+183
+185
+186
+187
+188
+189
+190
+191
+191
+192
+193
+193
+193
+193
+193
+192
+192
+192
+192
+191
+190
+189
+188
+187
+186
+184
+183
+181
+180
+178
+176
+175
+173
+172
+170
+167
+166
+163
+161
+159
+157
+154
+153
+151
+148
+146
+143
+141
+139
+136
+133
+132
+128
+127
+124
+121
+119
+116
+114
+112
+109
+106
+103
+101
+98
+96
+94
+91
+88
+86
+83
+80
+77
+75
+72
+70
+67
+63
+66
+69
+71
+74
+76
+79
+82
+85
+87
+90
+92
+95
+98
+100
+102
+105
+107
+110
+113
+115
+118
+120
+122
+125
+128
+130
+132
+135
+137
+140
+141
+144
+146
+149
+151
+153
+155
+157
+159
+161
+163
+166
+168
+170
+171
+172
+174
+176
+178
+179
+180
+182
+183
+185
+185
+186
+187
+188
+189
+190
+190
+189
+190
+190
+190
+190
+189
+189
+189
+188
+187
+186
+186
+184
+183
+182
+181
+179
+178
+176
+175
+172
+170
+169
+167
+165
+163
+161
+159
+157
+155
+153
+151
+149
+146
+144
+142
+139
+137
+135
+132
+130
+128
+125
+122
+121
+118
+115
+112
+110
+107
+105
+102
+100
+98
+94
+93
+89
+87
+84
+82
+80
+77
+74
+72
+69
+66
+62
+65
+67
+71
+73
+76
+78
+80
+83
+86
+88
+91
+93
+96
+99
+101
+104
+106
+109
+111
+114
+117
+118
+121
+124
+126
+129
+130
+133
+135
+137
+140
+142
+144
+147
+149
+151
+153
+155
+157
+159
+161
+164
+166
+167
+169
+170
+172
+174
+175
+176
+178
+180
+181
+182
+183
+184
+185
+185
+186
+186
+186
+187
+187
+187
+188
+187
+187
+186
+186
+185
+185
+184
+183
+181
+180
+180
+178
+176
+176
+174
+172
+170
+169
+167
+165
+163
+161
+160
+158
+156
+154
+152
+149
+147
+145
+142
+140
+138
+136
+133
+131
+128
+126
+124
+121
+119
+116
+114
+111
+109
+106
+104
+102
+98
+96
+94
+91
+89
+86
+84
+81
+78
+75
+73
+70
+68
+65
+61
+64
+67
+69
+72
+75
+77
+80
+83
+85
+88
+90
+92
+95
+97
+100
+103
+105
+108
+110
+112
+115
+118
+120
+122
+125
+127
+129
+132
+134
+136
+139
+140
+142
+145
+147
+149
+151
+153
+156
+157
+159
+161
+163
+164
+166
+168
+170
+172
+173
+174
+175
+176
+178
+179
+180
+181
+182
+182
+184
+183
+184
+184
+185
+185
+184
+184
+184
+184
+184
+182
+182
+182
+180
+179
+178
+177
+176
+174
+173
+171
+170
+168
+167
+165
+163
+161
+159
+157
+156
+153
+152
+149
+147
+145
+142
+140
+138
+136
+134
+132
+129
+127
+124
+122
+120
+117
+115
+113
+110
+108
+105
+103
+100
+98
+95
+92
+90
+88
+85
+82
+80
+77
+75
+72
+69
+66
+64
+61
+63
+66
+69
+71
+74
+76
+79
+81
+83
+86
+89
+91
+93
+96
+99
+101
+104
+106
+108
+111
+114
+116
+119
+121
+123
+125
+128
+130
+132
+135
+137
+139
+141
+144
+145
+147
+149
+151
+153
+156
+157
+159
+161
+163
+164
+166
+168
+169
+171
+171
+173
+175
+175
+177
+178
+179
+179
+179
+181
+181
+181
+181
+182
+182
+182
+181
+181
+181
+180
+180
+179
+179
+177
+177
+175
+174
+173
+171
+170
+169
+167
+165
+165
+163
+161
+159
+157
+155
+154
+151
+150
+147
+145
+143
+141
+139
+137
+134
+132
+130
+127
+125
+123
+121
+118
+116
+114
+111
+108
+106
+104
+101
+99
+96
+93
+91
+89
+87
+84
+81
+79
+76
+73
+71
+69
+65
+63
+59
+62
+65
+67
+70
+73
+74
+77
+80
+82
+85
+87
+90
+93
+95
+98
+99
+103
+105
+107
+110
+112
+114
+117
+119
+121
+123
+125
+128
+130
+132
+135
+137
+139
+141
+143
+146
+148
+149
+151
+154
+155
+157
+158
+160
+162
+163
+165
+166
+168
+169
+171
+172
+173
+174
+175
+175
+176
+177
+178
+178
+179
+179
+179
+179
+179
+179
+178
+178
+178
+177
+177
+176
+175
+174
+173
+171
+170
+169
+168
+166
+165
+164
+162
+161
+159
+157
+155
+153
+152
+149
+147
+145
+143
+141
+139
+137
+135
+133
+131
+128
+126
+124
+122
+119
+117
+114
+112
+110
+107
+105
+102
+100
+98
+95
+93
+90
+87
+84
+82
+80
+78
+75
+72
+70
+67
+65
+62
+59
+61
+63
+66
+68
+71
+73
+76
+79
+81
+83
+86
+88
+91
+93
+96
+99
+101
+103
+106
+108
+110
+113
+116
+117
+120
+122
+124
+127
+129
+131
+133
+135
+137
+139
+141
+143
+146
+147
+149
+151
+153
+155
+156
+158
+160
+161
+163
+164
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+175
+176
+175
+176
+176
+176
+176
+176
+176
+176
+175
+174
+174
+173
+172
+172
+170
+169
+168
+167
+166
+164
+163
+161
+159
+158
+156
+155
+153
+151
+149
+147
+146
+143
+142
+139
+137
+136
+133
+131
+129
+126
+124
+122
+120
+117
+115
+113
+111
+108
+105
+104
+100
+99
+96
+94
+91
+89
+87
+84
+81
+79
+76
+74
+71
+68
+66
+64
+61
+57
+60
+62
+65
+67
+70
+73
+75
+78
+80
+82
+85
+87
+89
+92
+94
+97
+99
+102
+104
+107
+109
+111
+113
+116
+118
+121
+123
+124
+127
+129
+131
+133
+135
+138
+140
+141
+144
+146
+147
+149
+151
+153
+154
+156
+157
+159
+161
+162
+163
+164
+165
+166
+168
+169
+170
+170
+171
+171
+172
+172
+172
+173
+173
+173
+173
+173
+173
+172
+172
+171
+171
+170
+169
+169
+167
+166
+165
+165
+163
+162
+161
+159
+157
+156
+154
+152
+151
+149
+147
+145
+143
+141
+139
+137
+136
+133
+131
+129
+127
+124
+122
+121
+118
+116
+114
+111
+108
+106
+104
+101
+100
+97
+94
+92
+90
+88
+84
+82
+80
+77
+74
+72
+70
+67
+64
+62
+60
+56
+59
+61
+63
+66
+69
+71
+74
+76
+79
+81
+83
+86
+89
+91
+93
+96
+98
+100
+102
+105
+107
+110
+112
+114
+116
+119
+121
+123
+125
+128
+130
+131
+133
+136
+138
+139
+141
+143
+145
+147
+148
+150
+151
+154
+154
+156
+158
+159
+160
+162
+163
+164
+165
+166
+167
+168
+168
+169
+170
+170
+170
+170
+170
+171
+171
+170
+170
+170
+169
+169
+168
+167
+167
+166
+165
+164
+163
+161
+160
+159
+158
+156
+155
+154
+152
+151
+149
+147
+145
+143
+142
+140
+138
+135
+133
+131
+129
+127
+125
+123
+121
+118
+116
+114
+112
+110
+107
+105
+102
+100
+98
+96
+93
+90
+88
+86
+83
+81
+79
+76
+74
+71
+68
+66
+63
+61
+59
+54
+57
+60
+62
+65
+67
+69
+73
+75
+77
+80
+82
+84
+86
+90
+92
+94
+97
+98
+101
+103
+105
+108
+110
+112
+114
+117
+119
+121
+124
+125
+127
+129
+131
+134
+136
+137
+139
+142
+142
+144
+146
+148
+150
+151
+153
+154
+156
+157
+158
+159
+161
+162
+162
+163
+164
+165
+165
+166
+167
+167
+167
+168
+168
+168
+168
+168
+167
+167
+166
+166
+166
+165
+164
+163
+162
+161
+160
+159
+158
+157
+155
+154
+152
+152
+150
+148
+146
+144
+143
+141
+139
+137
+135
+134
+132
+130
+127
+125
+123
+121
+119
+116
+115
+113
+110
+108
+106
+103
+101
+99
+97
+94
+92
+89
+87
+84
+82
+80
+77
+74
+72
+69
+67
+65
+62
+59
+57
+53
+56
+59
+61
+64
+66
+68
+70
+73
+75
+78
+80
+83
+85
+88
+90
+92
+95
+97
+99
+102
+104
+107
+108
+110
+113
+115
+117
+119
+122
+124
+125
+127
+130
+132
+133
+135
+137
+139
+140
+142
+144
+146
+147
+149
+151
+152
+153
+154
+156
+157
+158
+159
+159
+160
+162
+162
+163
+163
+163
+164
+164
+165
+164
+165
+165
+165
+165
+164
+164
+163
+163
+162
+162
+160
+160
+159
+158
+157
+156
+155
+153
+152
+150
+149
+147
+145
+144
+142
+141
+139
+137
+135
+133
+131
+130
+128
+125
+123
+122
+119
+118
+115
+113
+111
+108
+106
+104
+101
+99
+97
+95
+92
+90
+88
+85
+83
+81
+78
+76
+73
+71
+68
+66
+63
+61
+59
+56
+52
+55
+57
+60
+62
+64
+67
+69
+72
+74
+76
+79
+81
+84
+86
+89
+91
+94
+96
+97
+100
+103
+105
+107
+109
+111
+113
+115
+117
+119
+121
+124
+126
+127
+129
+131
+133
+134
+136
+139
+140
+142
+143
+144
+147
+148
+149
+151
+151
+153
+154
+155
+156
+157
+158
+159
+159
+160
+161
+161
+161
+162
+162
+162
+162
+162
+161
+161
+161
+161
+161
+160
+159
+159
+158
+157
+156
+155
+154
+153
+152
+150
+150
+148
+147
+145
+144
+141
+140
+138
+136
+135
+134
+132
+129
+127
+125
+124
+121
+120
+117
+115
+113
+111
+109
+107
+104
+102
+100
+98
+96
+93
+91
+88
+87
+84
+82
+79
+76
+74
+71
+70
+67
+64
+62
+60
+57
+55
+51
+54
+56
+58
+61
+63
+66
+68
+70
+73
+75
+78
+80
+82
+84
+87
+89
+91
+94
+96
+99
+100
+102
+104
+107
+110
+111
+113
+116
+117
+120
+122
+123
+125
+128
+129
+131
+133
+134
+136
+137
+139
+140
+143
+144
+145
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+157
+158
+158
+159
+158
+159
+159
+159
+159
+159
+159
+158
+158
+158
+157
+156
+156
+155
+155
+153
+153
+152
+150
+149
+148
+147
+145
+144
+142
+140
+140
+138
+136
+135
+133
+131
+129
+127
+125
+123
+121
+119
+118
+115
+113
+111
+109
+107
+104
+102
+101
+98
+96
+94
+92
+89
+87
+84
+83
+80
+77
+76
+73
+70
+68
+66
+64
+61
+58
+56
+53
+49
+52
+55
+57
+60
+62
+64
+67
+69
+71
+73
+76
+79
+81
+83
+86
+88
+90
+92
+95
+96
+98
+101
+104
+105
+108
+110
+112
+113
+115
+118
+119
+121
+123
+125
+127
+128
+131
+132
+133
+135
+137
+138
+140
+142
+143
+144
+145
+147
+148
+149
+150
+151
+151
+152
+154
+153
+154
+155
+156
+155
+156
+157
+157
+156
+156
+156
+156
+156
+155
+155
+154
+154
+153
+152
+152
+150
+150
+149
+147
+146
+146
+144
+143
+142
+141
+139
+137
+135
+134
+132
+130
+129
+127
+125
+123
+121
+120
+117
+116
+113
+112
+109
+108
+105
+103
+101
+98
+97
+94
+92
+90
+88
+86
+83
+81
+78
+76
+73
+71
+69
+67
+64
+62
+59
+57
+54
+51
+48
+50
+53
+55
+58
+61
+63
+65
+68
+70
+72
+75
+77
+79
+81
+84
+85
+88
+91
+93
+95
+97
+100
+101
+103
+106
+107
+110
+112
+114
+116
+117
+120
+121
+123
+124
+127
+128
+130
+131
+133
+135
+136
+137
+139
+141
+142
+143
+144
+145
+146
+147
+148
+149
+149
+150
+151
+152
+152
+153
+153
+153
+154
+153
+153
+153
+153
+153
+153
+153
+152
+152
+151
+150
+150
+149
+149
+148
+146
+145
+144
+143
+141
+140
+139
+138
+136
+135
+133
+131
+130
+129
+127
+125
+123
+121
+119
+118
+115
+114
+112
+109
+108
+105
+104
+101
+99
+97
+95
+93
+91
+88
+86
+84
+81
+79
+77
+74
+73
+70
+68
+66
+63
+60
+58
+56
+53
+51
+47
+50
+51
+54
+56
+58
+61
+63
+65
+69
+71
+73
+75
+78
+80
+82
+84
+86
+89
+91
+93
+95
+97
+100
+102
+103
+105
+108
+109
+112
+114
+115
+117
+119
+120
+122
+124
+126
+128
+129
+130
+132
+134
+135
+136
+138
+139
+140
+141
+143
+143
+144
+145
+146
+147
+148
+148
+148
+150
+150
+150
+150
+151
+151
+151
+151
+150
+150
+151
+149
+150
+149
+148
+148
+147
+147
+146
+145
+144
+143
+141
+140
+139
+138
+137
+135
+133
+132
+130
+130
+127
+126
+124
+122
+121
+119
+117
+115
+114
+112
+109
+108
+105
+104
+101
+99
+97
+95
+93
+90
+89
+87
+84
+82
+79
+78
+75
+73
+71
+68
+66
+64
+61
+59
+56
+54
+52
+49
+45
+48
+50
+53
+55
+57
+60
+62
+64
+67
+69
+71
+73
+76
+79
+80
+82
+85
+87
+89
+91
+94
+95
+97
+100
+102
+104
+106
+107
+109
+111
+113
+115
+117
+119
+120
+122
+124
+125
+127
+129
+130
+131
+133
+134
+136
+137
+138
+139
+140
+141
+142
+142
+144
+144
+145
+146
+146
+147
+147
+147
+148
+148
+148
+148
+148
+148
+148
+147
+147
+147
+146
+145
+145
+144
+144
+143
+142
+141
+140
+139
+138
+137
+135
+134
+133
+132
+130
+128
+127
+125
+124
+122
+120
+119
+117
+115
+114
+111
+109
+108
+105
+104
+101
+100
+98
+95
+94
+92
+89
+87
+85
+82
+80
+78
+76
+73
+71
+69
+67
+64
+62
+60
+57
+55
+52
+50
+47
+44
+46
+49
+51
+54
+56
+58
+61
+63
+65
+67
+70
+72
+74
+76
+78
+81
+83
+85
+87
+89
+92
+93
+96
+98
+99
+101
+103
+106
+107
+110
+111
+113
+115
+116
+118
+120
+121
+123
+125
+126
+128
+129
+130
+131
+133
+134
+135
+136
+137
+138
+139
+140
+141
+141
+142
+143
+143
+143
+144
+145
+145
+145
+146
+145
+145
+145
+145
+145
+144
+144
+144
+143
+142
+141
+141
+140
+140
+138
+138
+137
+135
+134
+133
+131
+130
+129
+128
+126
+124
+123
+121
+119
+118
+117
+115
+113
+111
+109
+107
+105
+104
+102
+99
+97
+96
+93
+91
+90
+87
+85
+83
+81
+78
+77
+74
+72
+70
+67
+65
+63
+61
+58
+56
+54
+51
+48
+47
+43
+45
+47
+49
+52
+54
+56
+59
+61
+64
+66
+68
+70
+73
+74
+77
+79
+82
+84
+85
+88
+90
+92
+94
+96
+97
+100
+102
+103
+105
+107
+109
+111
+113
+114
+116
+117
+119
+121
+123
+124
+125
+126
+127
+129
+130
+131
+133
+134
+134
+135
+137
+138
+138
+138
+140
+140
+141
+141
+142
+142
+142
+142
+142
+142
+142
+143
+142
+142
+142
+141
+141
+141
+139
+139
+138
+137
+137
+135
+135
+134
+133
+132
+130
+129
+127
+127
+125
+124
+122
+120
+119
+118
+116
+114
+113
+111
+109
+107
+105
+104
+102
+100
+98
+96
+93
+91
+90
+87
+85
+84
+81
+79
+77
+74
+72
+70
+68
+66
+63
+61
+59
+56
+54
+52
+49
+47
+45
+41
+44
+45
+48
+50
+52
+55
+57
+59
+61
+64
+66
+68
+71
+72
+75
+78
+79
+82
+84
+86
+88
+90
+91
+93
+96
+98
+99
+102
+103
+105
+106
+108
+111
+112
+113
+115
+117
+119
+120
+121
+123
+124
+126
+127
+127
+129
+130
+131
+132
+133
+134
+135
+135
+136
+136
+137
+137
+139
+138
+139
+139
+139
+139
+139
+139
+139
+140
+139
+139
+139
+138
+137
+137
+136
+135
+135
+134
+133
+132
+131
+130
+129
+128
+127
+125
+124
+123
+121
+120
+118
+116
+115
+113
+111
+110
+108
+107
+105
+103
+102
+99
+97
+95
+93
+91
+90
+87
+86
+83
+81
+80
+77
+75
+73
+70
+68
+66
+64
+62
+60
+58
+55
+52
+51
+48
+46
+43
+39
+42
+44
+46
+49
+50
+53
+56
+58
+60
+62
+65
+67
+69
+71
+74
+76
+78
+79
+81
+84
+86
+87
+90
+91
+94
+96
+97
+99
+101
+103
+105
+106
+108
+109
+111
+112
+115
+116
+117
+118
+120
+122
+122
+124
+125
+127
+128
+129
+129
+130
+132
+132
+133
+133
+134
+135
+135
+136
+136
+136
+136
+136
+137
+137
+137
+136
+137
+136
+136
+136
+135
+135
+134
+133
+132
+132
+131
+131
+129
+128
+127
+127
+125
+124
+123
+121
+120
+119
+117
+116
+114
+112
+112
+110
+107
+107
+105
+103
+101
+99
+98
+96
+93
+91
+90
+87
+86
+84
+82
+79
+77
+75
+73
+71
+69
+67
+64
+62
+60
+58
+55
+54
+51
+49
+46
+44
+41
+38
+40
+43
+45
+47
+49
+51
+54
+56
+58
+61
+62
+65
+67
+69
+72
+73
+76
+77
+80
+81
+83
+85
+88
+90
+92
+94
+96
+97
+99
+101
+102
+104
+106
+107
+109
+110
+112
+114
+115
+116
+118
+119
+120
+121
+122
+124
+125
+126
+127
+127
+128
+129
+130
+131
+131
+132
+132
+132
+133
+133
+134
+134
+134
+134
+134
+134
+133
+134
+133
+132
+133
+131
+132
+131
+130
+129
+128
+128
+126
+126
+125
+124
+122
+121
+120
+119
+118
+116
+115
+114
+112
+111
+109
+107
+106
+104
+102
+101
+98
+97
+95
+93
+91
+90
+87
+86
+84
+82
+80
+78
+75
+73
+72
+69
+67
+65
+63
+60
+59
+56
+53
+51
+49
+47
+45
+43
+40
+36
+39
+41
+44
+45
+48
+50
+52
+55
+57
+59
+61
+63
+65
+67
+69
+71
+74
+76
+78
+80
+81
+84
+86
+87
+89
+91
+93
+95
+97
+99
+100
+101
+103
+105
+106
+109
+109
+111
+113
+114
+115
+117
+117
+119
+120
+121
+122
+123
+124
+125
+126
+126
+127
+128
+128
+129
+130
+130
+130
+130
+131
+131
+131
+131
+131
+131
+131
+131
+130
+130
+129
+129
+128
+128
+127
+126
+126
+125
+124
+124
+122
+121
+120
+119
+117
+116
+116
+113
+113
+111
+109
+108
+107
+105
+103
+102
+100
+99
+97
+94
+93
+91
+89
+88
+85
+83
+81
+80
+78
+76
+73
+72
+70
+67
+65
+63
+61
+59
+56
+54
+52
+50
+48
+46
+43
+41
+38
+34
+37
+39
+41
+44
+46
+48
+50
+53
+55
+57
+59
+61
+63
+66
+68
+70
+71
+73
+76
+77
+79
+82
+84
+85
+87
+89
+91
+93
+94
+96
+98
+100
+101
+103
+104
+106
+107
+108
+110
+112
+112
+114
+115
+116
+118
+119
+119
+121
+121
+122
+123
+124
+125
+125
+126
+127
+127
+127
+127
+128
+128
+128
+128
+129
+128
+128
+128
+128
+128
+127
+127
+126
+126
+125
+124
+124
+123
+122
+122
+120
+120
+118
+118
+116
+115
+114
+113
+111
+110
+108
+107
+106
+104
+103
+101
+100
+97
+96
+94
+92
+91
+89
+87
+86
+84
+82
+80
+78
+76
+73
+72
+70
+68
+66
+63
+61
+59
+56
+55
+53
+51
+48
+46
+44
+41
+40
+37
+33
+35
+37
+39
+42
+44
+46
+49
+51
+53
+55
+57
+59
+62
+63
+66
+67
+69
+71
+74
+76
+78
+80
+81
+84
+86
+87
+89
+90
+92
+94
+95
+97
+98
+100
+102
+104
+104
+106
+108
+109
+110
+111
+112
+114
+114
+116
+116
+118
+118
+120
+121
+121
+122
+123
+123
+123
+124
+124
+125
+125
+125
+126
+126
+125
+126
+125
+125
+125
+125
+125
+124
+123
+123
+123
+122
+121
+120
+120
+119
+118
+117
+116
+115
+113
+112
+111
+110
+109
+108
+107
+105
+103
+102
+100
+99
+97
+95
+94
+93
+90
+88
+87
+85
+83
+82
+80
+77
+76
+73
+72
+70
+68
+66
+63
+61
+59
+58
+56
+53
+51
+49
+47
+44
+42
+40
+37
+36
+31
+33
+36
+38
+41
+42
+45
+47
+49
+51
+53
+55
+57
+60
+61
+64
+65
+68
+70
+71
+74
+76
+77
+80
+81
+83
+85
+87
+89
+90
+92
+93
+95
+96
+98
+99
+101
+103
+104
+105
+107
+108
+108
+110
+111
+112
+113
+114
+115
+116
+117
+118
+118
+119
+120
+120
+121
+121
+122
+122
+122
+123
+122
+123
+122
+122
+123
+122
+123
+122
+122
+121
+120
+120
+120
+119
+119
+118
+117
+116
+115
+114
+113
+112
+111
+110
+109
+108
+106
+105
+104
+102
+101
+99
+98
+97
+95
+93
+92
+90
+88
+86
+84
+83
+81
+79
+77
+76
+73
+72
+70
+68
+66
+64
+62
+60
+58
+56
+53
+52
+49
+47
+44
+42
+40
+38
+36
+34
+29
+32
+34
+36
+38
+41
+43
+45
+47
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+71
+74
+75
+77
+79
+81
+83
+85
+86
+88
+89
+91
+92
+94
+95
+97
+99
+100
+101
+102
+104
+105
+106
+107
+108
+110
+111
+111
+113
+113
+114
+115
+116
+117
+117
+118
+118
+118
+119
+119
+119
+120
+120
+120
+120
+120
+120
+119
+120
+119
+119
+118
+118
+117
+117
+116
+116
+115
+114
+113
+113
+111
+110
+109
+108
+108
+107
+105
+104
+102
+101
+99
+98
+97
+95
+94
+92
+91
+89
+87
+86
+84
+83
+80
+79
+77
+76
+74
+72
+69
+68
+66
+64
+61
+60
+57
+55
+53
+51
+49
+47
+45
+43
+41
+39
+37
+34
+32
+28
+31
+33
+35
+37
+39
+41
+43
+46
+47
+50
+51
+53
+56
+58
+60
+61
+64
+65
+67
+70
+72
+73
+75
+77
+79
+80
+82
+83
+85
+87
+89
+90
+92
+93
+95
+96
+97
+99
+100
+102
+102
+103
+105
+106
+106
+108
+109
+110
+111
+111
+112
+113
+113
+114
+115
+115
+116
+116
+117
+116
+117
+117
+117
+116
+117
+117
+117
+117
+116
+115
+116
+115
+114
+114
+113
+113
+112
+111
+111
+110
+109
+108
+107
+106
+104
+104
+102
+101
+100
+98
+98
+96
+94
+93
+92
+90
+89
+87
+86
+84
+82
+81
+78
+77
+75
+73
+72
+69
+68
+66
+63
+61
+60
+57
+56
+54
+51
+50
+48
+46
+43
+41
+39
+37
+35
+32
+30
+27
+29
+31
+33
+35
+37
+39
+41
+43
+45
+48
+50
+52
+54
+56
+58
+59
+62
+64
+65
+68
+69
+71
+73
+74
+77
+78
+80
+81
+83
+84
+86
+88
+90
+90
+92
+94
+95
+96
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+110
+111
+112
+112
+112
+113
+113
+113
+113
+114
+114
+114
+114
+114
+114
+114
+113
+113
+114
+113
+112
+112
+111
+110
+110
+110
+109
+108
+107
+106
+105
+104
+104
+102
+101
+100
+99
+98
+96
+95
+93
+92
+91
+89
+87
+86
+85
+83
+81
+80
+78
+76
+74
+72
+71
+69
+68
+66
+63
+62
+60
+57
+56
+53
+52
+50
+47
+46
+44
+41
+39
+37
+35
+33
+31
+28
+25
+27
+29
+31
+33
+36
+37
+40
+41
+43
+46
+48
+50
+52
+54
+56
+58
+60
+61
+63
+65
+68
+69
+71
+72
+74
+75
+78
+79
+81
+82
+84
+85
+87
+88
+90
+91
+92
+93
+95
+96
+98
+98
+100
+101
+101
+102
+104
+105
+106
+106
+107
+108
+108
+109
+110
+110
+110
+110
+111
+111
+111
+111
+111
+112
+111
+111
+111
+111
+111
+110
+110
+109
+109
+109
+108
+107
+106
+106
+105
+105
+103
+103
+101
+101
+100
+98
+97
+96
+95
+94
+92
+91
+90
+89
+87
+85
+84
+82
+81
+79
+77
+76
+74
+72
+71
+69
+67
+66
+63
+61
+60
+58
+55
+53
+52
+49
+47
+45
+43
+42
+39
+38
+35
+34
+31
+29
+27
+22
+25
+27
+29
+31
+34
+35
+37
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+59
+61
+63
+64
+66
+68
+71
+72
+74
+75
+77
+79
+80
+81
+83
+84
+85
+87
+89
+90
+91
+92
+93
+95
+96
+97
+98
+99
+100
+101
+102
+102
+103
+104
+105
+105
+105
+106
+107
+108
+107
+108
+108
+108
+109
+108
+108
+108
+108
+109
+108
+108
+108
+107
+107
+107
+105
+105
+105
+104
+103
+102
+102
+101
+100
+99
+98
+97
+96
+95
+93
+92
+91
+90
+88
+87
+86
+84
+83
+82
+80
+78
+77
+75
+74
+72
+70
+69
+66
+65
+63
+61
+60
+57
+56
+54
+51
+49
+48
+46
+43
+41
+40
+38
+35
+33
+31
+29
+27
+25
+21
+23
+25
+27
+29
+32
+33
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+55
+57
+59
+61
+63
+64
+66
+68
+70
+71
+73
+74
+76
+77
+80
+81
+82
+84
+85
+86
+87
+89
+90
+92
+92
+93
+94
+95
+96
+97
+98
+99
+99
+100
+102
+102
+103
+103
+104
+104
+104
+105
+105
+105
+105
+105
+106
+106
+105
+105
+105
+106
+105
+105
+105
+104
+104
+103
+102
+102
+101
+101
+100
+99
+98
+97
+97
+95
+94
+94
+93
+91
+89
+88
+88
+86
+84
+83
+82
+80
+79
+77
+76
+75
+72
+71
+69
+68
+66
+65
+62
+61
+59
+58
+56
+54
+51
+50
+48
+46
+44
+42
+40
+38
+36
+34
+31
+30
+27
+25
+23
+19
+22
+24
+26
+27
+30
+32
+34
+36
+38
+39
+42
+43
+46
+47
+50
+51
+53
+55
+57
+58
+60
+63
+64
+66
+67
+69
+70
+73
+74
+75
+76
+78
+80
+81
+83
+83
+85
+86
+87
+89
+90
+91
+92
+93
+94
+95
+95
+96
+97
+98
+98
+99
+100
+100
+101
+102
+101
+102
+103
+103
+103
+102
+103
+103
+102
+102
+103
+102
+103
+102
+102
+101
+101
+100
+100
+100
+99
+98
+98
+97
+96
+94
+93
+93
+92
+91
+90
+89
+87
+87
+85
+83
+83
+81
+80
+78
+77
+75
+74
+72
+71
+69
+68
+65
+64
+63
+61
+59
+57
+55
+54
+51
+50
+47
+46
+44
+42
+40
+38
+36
+34
+32
+30
+28
+25
+24
+22
+17
+19
+21
+23
+25
+28
+30
+31
+34
+36
+37
+40
+42
+43
+46
+47
+50
+51
+53
+54
+57
+58
+60
+62
+64
+65
+67
+68
+70
+72
+73
+74
+76
+77
+79
+80
+81
+83
+83
+85
+86
+87
+88
+89
+91
+91
+92
+92
+93
+95
+95
+96
+96
+97
+98
+98
+99
+99
+99
+99
+100
+100
+100
+100
+100
+100
+100
+100
+100
+99
+99
+98
+99
+98
+97
+97
+97
+96
+95
+94
+94
+92
+92
+91
+90
+89
+89
+87
+86
+84
+84
+82
+81
+80
+79
+77
+75
+74
+73
+71
+70
+68
+67
+65
+63
+62
+60
+59
+56
+55
+53
+51
+49
+47
+46
+44
+42
+40
+38
+36
+34
+32
+29
+28
+25
+24
+21
+19
+16
+18
+19
+22
+24
+26
+28
+30
+31
+34
+36
+38
+40
+42
+44
+45
+47
+49
+50
+52
+54
+56
+57
+59
+61
+62
+65
+66
+67
+69
+71
+72
+73
+75
+76
+78
+79
+80
+81
+83
+83
+85
+86
+86
+87
+88
+89
+90
+91
+91
+92
+93
+94
+95
+95
+95
+95
+96
+96
+97
+97
+97
+97
+97
+97
+97
+98
+97
+97
+97
+96
+96
+96
+95
+95
+94
+94
+93
+92
+92
+91
+90
+89
+88
+87
+86
+86
+84
+83
+82
+81
+80
+78
+77
+76
+75
+73
+72
+71
+69
+68
+66
+64
+63
+61
+59
+58
+56
+54
+53
+50
+49
+47
+45
+44
+42
+40
+38
+35
+33
+32
+29
+28
+26
+24
+22
+19
+17
+13
+16
+18
+19
+22
+24
+26
+28
+30
+31
+34
+36
+38
+40
+42
+43
+45
+47
+48
+50
+52
+54
+55
+57
+59
+60
+62
+63
+65
+67
+68
+69
+71
+72
+74
+75
+76
+77
+79
+80
+81
+82
+82
+84
+85
+86
+87
+88
+88
+89
+89
+91
+91
+92
+92
+93
+93
+94
+93
+94
+94
+94
+94
+94
+95
+95
+95
+95
+94
+94
+94
+93
+93
+93
+92
+92
+91
+90
+89
+89
+88
+88
+87
+85
+84
+84
+82
+82
+80
+79
+79
+78
+76
+75
+73
+72
+70
+69
+68
+66
+65
+63
+62
+61
+59
+58
+56
+54
+52
+50
+48
+47
+45
+44
+41
+39
+37
+35
+34
+31
+30
+28
+26
+24
+22
+20
+18
+16
+12
+14
+16
+18
+20
+22
+24
+26
+28
+30
+32
+33
+36
+38
+39
+41
+43
+45
+46
+48
+50
+52
+54
+55
+57
+58
+59
+61
+63
+64
+65
+67
+68
+69
+71
+72
+74
+75
+76
+77
+78
+79
+80
+82
+82
+83
+84
+84
+86
+87
+87
+88
+88
+89
+89
+90
+90
+90
+90
+91
+91
+91
+92
+92
+92
+92
+91
+91
+92
+91
+91
+91
+90
+89
+89
+88
+88
+87
+87
+86
+85
+85
+84
+84
+82
+81
+80
+79
+78
+77
+76
+75
+74
+72
+71
+70
+68
+67
+66
+64
+63
+61
+60
+58
+56
+55
+53
+52
+50
+48
+46
+45
+43
+41
+39
+38
+36
+34
+32
+30
+28
+26
+24
+22
+20
+18
+15
+14
+9
+12
+14
+16
+18
+20
+22
+24
+25
+28
+30
+32
+34
+35
+37
+39
+41
+42
+44
+46
+48
+49
+50
+53
+54
+56
+58
+59
+60
+62
+63
+65
+66
+67
+69
+70
+71
+72
+73
+74
+75
+76
+78
+78
+80
+81
+81
+82
+83
+83
+85
+85
+86
+86
+86
+86
+88
+88
+87
+88
+89
+89
+88
+89
+89
+89
+88
+89
+88
+88
+88
+88
+88
+87
+87
+86
+85
+85
+84
+84
+83
+82
+81
+81
+80
+79
+78
+77
+76
+75
+73
+72
+71
+70
+68
+67
+66
+64
+63
+62
+60
+59
+57
+56
+54
+53
+51
+49
+48
+46
+45
+43
+41
+39
+37
+35
+34
+31
+30
+28
+26
+24
+22
+20
+18
+16
+14
+12
+8
+10
+12
+14
+16
+18
+20
+22
+24
+25
+27
+29
+32
+33
+35
+37
+38
+40
+41
+44
+45
+48
+49
+50
+52
+53
+55
+56
+57
+60
+61
+62
+63
+65
+66
+67
+68
+69
+71
+72
+73
+74
+75
+76
+76
+78
+79
+79
+80
+80
+81
+82
+83
+83
+83
+84
+85
+85
+85
+86
+86
+86
+86
+86
+86
+86
+86
+86
+85
+85
+85
+85
+84
+84
+83
+83
+82
+82
+81
+81
+80
+79
+79
+78
+77
+75
+75
+74
+73
+72
+71
+69
+69
+67
+66
+65
+63
+62
+61
+59
+58
+57
+55
+54
+52
+50
+48
+47
+45
+44
+42
+40
+38
+36
+35
+33
+31
+30
+27
+26
+23
+22
+20
+18
+16
+14
+12
+10
+5
+8
+10
+12
+14
+16
+18
+20
+22
+24
+25
+27
+29
+31
+33
+34
+36
+38
+40
+42
+43
+45
+47
+48
+49
+52
+52
+54
+55
+56
+58
+60
+60
+62
+63
+65
+66
+67
+68
+69
+71
+72
+72
+73
+74
+75
+76
+77
+77
+78
+78
+79
+80
+80
+81
+82
+82
+82
+82
+82
+83
+83
+83
+83
+84
+83
+83
+82
+83
+82
+82
+82
+81
+81
+80
+81
+80
+80
+79
+78
+77
+77
+76
+75
+74
+74
+72
+72
+71
+69
+68
+67
+66
+64
+63
+62
+60
+60
+58
+57
+55
+54
+53
+51
+50
+48
+47
+45
+43
+41
+39
+38
+36
+34
+33
+31
+29
+27
+25
+23
+22
+20
+18
+16
+14
+12
+10
+8
+4
+6
+8
+10
+12
+14
+16
+17
+19
+21
+24
+25
+27
+29
+30
+33
+34
+36
+38
+39
+41
+43
+44
+46
+47
+49
+50
+52
+53
+55
+56
+57
+58
+60
+61
+62
+63
+65
+65
+67
+67
+68
+70
+71
+71
+72
+73
+74
+75
+75
+76
+76
+77
+77
+78
+79
+79
+79
+79
+80
+80
+80
+81
+81
+81
+80
+81
+80
+80
+80
+79
+79
+79
+79
+78
+78
+77
+77
+76
+75
+75
+74
+73
+72
+71
+71
+70
+69
+68
+67
+66
+65
+64
+62
+61
+60
+59
+57
+56
+54
+53
+52
+50
+48
+47
+46
+44
+43
+41
+39
+37
+36
+34
+33
+30
+29
+27
+26
+23
+21
+20
+18
+16
+13
+11
+10
+8
+6
+2
+4
+6
+8
+10
+11
+14
+16
+18
+19
+21
+23
+25
+27
+29
+30
+32
+33
+35
+37
+39
+40
+42
+43
+45
+46
+48
+49
+51
+52
+53
+55
+56
+57
+58
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+69
+70
+71
+71
+72
+73
+74
+74
+74
+76
+75
+77
+77
+77
+77
+77
+78
+77
+77
+78
+77
+77
+77
+77
+77
+77
+77
+77
+76
+75
+75
+74
+74
+73
+73
+72
+71
+71
+70
+69
+68
+67
+66
+65
+64
+63
+62
+60
+60
+59
+57
+56
+54
+54
+52
+50
+49
+48
+46
+44
+43
+42
+40
+38
+37
+35
+33
+32
+30
+28
+27
+25
+23
+22
+20
+18
+16
+14
+11
+10
+8
+6
+4
diff --git a/extra/images/testing/pgm/radial.binary.fig b/extra/images/testing/pgm/radial.binary.fig
new file mode 100644 (file)
index 0000000..6e52311
Binary files /dev/null and b/extra/images/testing/pgm/radial.binary.fig differ
diff --git a/extra/images/testing/pgm/radial.binary.pgm b/extra/images/testing/pgm/radial.binary.pgm
new file mode 100644 (file)
index 0000000..598ee59
Binary files /dev/null and b/extra/images/testing/pgm/radial.binary.pgm differ
diff --git a/extra/images/testing/ppm/ascii.fig b/extra/images/testing/ppm/ascii.fig
new file mode 100644 (file)
index 0000000..68a1fa1
Binary files /dev/null and b/extra/images/testing/ppm/ascii.fig differ
diff --git a/extra/images/testing/ppm/ascii.ppm b/extra/images/testing/ppm/ascii.ppm
new file mode 100644 (file)
index 0000000..326b70e
--- /dev/null
@@ -0,0 +1,57604 @@
+P3
+# CREATOR: GIMP PNM Filter Version 1.1
+160 120
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+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
+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
+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
+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
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+243
+50
+50
+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
+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
+255
+255
+255
+255
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+50
+86
+243
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+0
+255
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+242
+190
+255
+218
+71
+255
+207
+17
+255
+205
+4
+255
+210
+31
+255
+223
+95
+255
+243
+196
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+239
+174
+255
+204
+2
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+213
+43
+255
+204
+0
+255
+219
+77
+255
+247
+214
+255
+254
+251
+255
+251
+234
+255
+238
+169
+255
+217
+63
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+205
+5
+255
+204
+0
+255
+252
+238
+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
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+210
+32
+255
+204
+0
+255
+230
+132
+255
+251
+237
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+236
+158
+255
+204
+0
+255
+204
+0
+255
+204
+1
+255
+211
+36
+255
+221
+87
+255
+237
+164
+255
+254
+250
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+242
+190
+255
+219
+77
+255
+206
+11
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+214
+48
+255
+251
+233
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+254
+252
+255
+247
+213
+255
+234
+152
+255
+211
+35
+255
+204
+0
+255
+222
+92
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+248
+220
+255
+204
+0
+255
+208
+19
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+251
+235
+255
+204
+0
+255
+205
+5
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+1
+255
+204
+0
+255
+255
+254
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+1
+255
+204
+0
+255
+255
+254
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+1
+255
+204
+0
+255
+255
+254
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+215
+54
+255
+234
+150
+255
+247
+215
+255
+254
+248
+255
+254
+249
+255
+245
+204
+255
+218
+68
+255
+204
+0
+255
+212
+42
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+208
+19
+255
+204
+0
+255
+242
+190
+255
+255
+254
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+208
+19
+255
+204
+0
+255
+242
+190
+255
+255
+254
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+208
+19
+255
+204
+0
+255
+242
+190
+255
+255
+254
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+247
+217
+255
+204
+2
+255
+206
+10
+255
+251
+236
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+252
+239
+255
+206
+11
+255
+204
+2
+255
+247
+216
+255
+255
+255
+255
+241
+186
+255
+219
+75
+255
+207
+15
+255
+206
+9
+255
+215
+57
+255
+242
+188
+255
+255
+255
+255
+255
+255
+255
+247
+217
+255
+204
+2
+255
+206
+10
+255
+251
+236
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+252
+239
+255
+206
+11
+255
+204
+2
+255
+247
+216
+255
+255
+255
+255
+241
+186
+255
+219
+75
+255
+207
+15
+255
+206
+9
+255
+215
+57
+255
+242
+188
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+2
+255
+238
+172
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+221
+84
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+221
+84
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+221
+84
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+221
+85
+255
+204
+0
+255
+230
+132
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+232
+138
+255
+204
+0
+255
+220
+80
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+205
+5
+255
+245
+204
+255
+255
+255
+255
+255
+255
+255
+221
+85
+255
+204
+0
+255
+230
+132
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+232
+138
+255
+204
+0
+255
+220
+80
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+205
+5
+255
+245
+204
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+245
+203
+255
+226
+111
+255
+213
+46
+255
+206
+9
+255
+205
+5
+255
+209
+27
+255
+221
+83
+255
+243
+195
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+250
+229
+255
+221
+83
+255
+208
+18
+255
+204
+1
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+250
+229
+255
+221
+83
+255
+208
+18
+255
+204
+1
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+250
+229
+255
+221
+83
+255
+208
+18
+255
+204
+1
+255
+204
+0
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+245
+205
+255
+204
+0
+255
+209
+25
+255
+254
+249
+255
+255
+255
+255
+255
+255
+255
+254
+251
+255
+210
+29
+255
+204
+0
+255
+244
+198
+255
+255
+255
+255
+255
+255
+255
+221
+84
+255
+245
+205
+255
+254
+249
+255
+249
+227
+255
+222
+88
+255
+204
+0
+255
+222
+88
+255
+255
+255
+255
+255
+255
+255
+245
+205
+255
+204
+0
+255
+209
+25
+255
+254
+249
+255
+255
+255
+255
+255
+255
+255
+254
+251
+255
+210
+29
+255
+204
+0
+255
+244
+198
+255
+255
+255
+255
+255
+255
+255
+221
+84
+255
+245
+205
+255
+254
+249
+255
+249
+227
+255
+222
+88
+255
+204
+0
+255
+222
+88
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+218
+71
+255
+204
+0
+255
+236
+159
+255
+255
+255
+255
+255
+255
+255
+238
+168
+255
+204
+0
+255
+216
+60
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+252
+239
+255
+204
+0
+255
+210
+29
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+218
+71
+255
+204
+0
+255
+236
+159
+255
+255
+255
+255
+255
+255
+255
+238
+168
+255
+204
+0
+255
+216
+60
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+252
+239
+255
+204
+0
+255
+210
+29
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+206
+10
+255
+206
+11
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+206
+10
+255
+206
+11
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+242
+192
+255
+204
+0
+255
+213
+46
+255
+255
+255
+255
+255
+255
+255
+215
+56
+255
+204
+0
+255
+240
+178
+255
+255
+255
+255
+255
+255
+255
+254
+252
+255
+232
+139
+255
+214
+48
+255
+206
+10
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+205
+6
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+242
+192
+255
+204
+0
+255
+213
+46
+255
+255
+255
+255
+255
+255
+255
+215
+56
+255
+204
+0
+255
+240
+178
+255
+255
+255
+255
+255
+255
+255
+254
+252
+255
+232
+139
+255
+214
+48
+255
+206
+10
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+205
+6
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+209
+26
+255
+209
+27
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+209
+26
+255
+209
+27
+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
+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
+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
+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
+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
+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
+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
+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
+216
+58
+255
+204
+0
+255
+241
+187
+255
+244
+199
+255
+204
+0
+255
+212
+42
+255
+255
+254
+255
+255
+255
+255
+255
+255
+255
+227
+113
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+216
+58
+255
+204
+0
+255
+241
+187
+255
+244
+199
+255
+204
+0
+255
+212
+42
+255
+255
+254
+255
+255
+255
+255
+255
+255
+255
+227
+113
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+213
+43
+255
+213
+43
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+213
+43
+255
+213
+43
+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
+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
+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
+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
+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
+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
+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
+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
+240
+179
+255
+204
+0
+255
+218
+72
+255
+221
+86
+255
+204
+0
+255
+236
+158
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+208
+18
+255
+204
+0
+255
+238
+168
+255
+252
+240
+255
+255
+254
+255
+252
+241
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+240
+179
+255
+204
+0
+255
+218
+72
+255
+221
+86
+255
+204
+0
+255
+236
+158
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+208
+18
+255
+204
+0
+255
+238
+168
+255
+252
+240
+255
+255
+254
+255
+252
+241
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+254
+255
+213
+45
+255
+204
+1
+255
+205
+3
+255
+209
+27
+255
+254
+249
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+206
+9
+255
+204
+0
+255
+239
+176
+255
+254
+248
+255
+248
+221
+255
+221
+87
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+254
+255
+213
+45
+255
+204
+1
+255
+205
+3
+255
+209
+27
+255
+254
+249
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+206
+9
+255
+204
+0
+255
+239
+176
+255
+254
+248
+255
+248
+221
+255
+221
+87
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+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
+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
+237
+165
+255
+204
+0
+255
+204
+0
+255
+232
+138
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+220
+81
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+219
+76
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+237
+165
+255
+204
+0
+255
+204
+0
+255
+232
+138
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+220
+81
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+219
+76
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+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
+248
+218
+255
+204
+0
+255
+207
+15
+255
+252
+241
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+251
+235
+255
+220
+82
+255
+206
+10
+255
+207
+16
+255
+223
+96
+255
+252
+240
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+248
+218
+255
+204
+0
+255
+207
+15
+255
+252
+241
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+251
+235
+255
+220
+82
+255
+206
+10
+255
+207
+16
+255
+223
+96
+255
+252
+240
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+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
+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
+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
+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
+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
+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
+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
+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
+236
+158
+255
+204
+0
+255
+227
+116
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+236
+158
+255
+204
+0
+255
+227
+116
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+252
+238
+255
+218
+71
+255
+204
+0
+255
+247
+213
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+252
+238
+255
+218
+71
+255
+204
+0
+255
+247
+213
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+219
+74
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+204
+0
+255
+204
+0
+255
+219
+74
+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
+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
+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
+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
+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
+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
+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
+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
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+205
+4
+255
+217
+65
+255
+250
+229
+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
+255
+255
+255
+255
+255
+255
+255
+255
+255
+204
+0
+255
+205
+4
+255
+217
+65
+255
+250
+229
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
+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
diff --git a/extra/images/testing/ppm/binary.fig b/extra/images/testing/ppm/binary.fig
new file mode 100644 (file)
index 0000000..68a1fa1
Binary files /dev/null and b/extra/images/testing/ppm/binary.fig differ
diff --git a/extra/images/testing/ppm/binary.ppm b/extra/images/testing/ppm/binary.ppm
new file mode 100644 (file)
index 0000000..b774663
Binary files /dev/null and b/extra/images/testing/ppm/binary.ppm differ
diff --git a/extra/images/viewer/tags.txt b/extra/images/viewer/tags.txt
new file mode 100644 (file)
index 0000000..700f0dc
--- /dev/null
@@ -0,0 +1 @@
+not tested
diff --git a/extra/images/viewer/viewer-docs.factor b/extra/images/viewer/viewer-docs.factor
new file mode 100644 (file)
index 0000000..1d24bef
--- /dev/null
@@ -0,0 +1,103 @@
+! Copyright (C) 2010 Jon Harper.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel strings io.pathnames images 
+models opengl.textures classes ui.gadgets ;
+IN: images.viewer
+
+HELP: <image-gadget>
+{ $values
+    { "object" { $or pathname string image } }
+    { "gadget" image-gadget }
+}
+{ $description "Creates " { $instance image-gadget } " with the given image. See " { $link set-image } "." } ;
+HELP: <image-control>
+{ $values
+    { "model" model }
+    { "gadget" image-control }
+}
+{ $description "Creates " { $instance image-control } " with the given image. See " { $link set-image } "." } ;
+
+HELP: new-image-gadget
+{ $values
+    { "class" class }
+    { "gadget" image-gadget }
+}
+{ $description "Use this if the image is not available when you want to construct the gadget. Don't forget to call "
+{ $link set-image } " before grafting this gadget. You can also use this constructor if you want to extend image-gadget or image-control."
+} ;
+
+HELP: new-image-gadget*
+{ $values
+    { "object" { $or pathname string image } } { "class" class }
+    { "gadget" image-gadget }
+}
+{ $description "Use this constructor when you want to extend image-gadget or image-control." } ;
+
+HELP: set-image
+{ $values
+    { "gadget" image-gadget } { "object" { $or pathname string image } }
+}
+{ $description "Sets the image of this gadget. This word loads the image from disk if the input is a string or a pathname."
+"If the input is a model, gadget has to be " { $instance image-control } "." } ;
+
+HELP: image-control
+{ $var-description "This gadget is like " { $instance image-gadget } ", but it's image must be in " { $instance model } ". It's used to display changing images." } ;
+
+HELP: image-gadget
+{ $var-description "This gadget can render " { $instance image } "." } ;
+
+HELP: image-window
+{ $values
+    { "object" { $or pathname string image } }
+}
+{ $description "Opens a new window displaying the image." } ;
+
+HELP: image.
+{ $values
+    { "object" { $or pathname string image } }
+}
+{ $description "Displays the image in the listener." } ;
+HELP: start-control
+{ $values
+    { "gadget" gadget }
+}
+{ $description "Adds a connection between the gadget and it's model." } ;
+
+HELP: stop-control
+{ $values
+    { "gadget" gadget }
+}
+{ $description "Removes the connection between the gadget and it's model" } ;
+ARTICLE: "images.viewer" "Displaying Images"
+"The " { $vocab-link "images.viewer" } " vocabulary uses the " { $vocab-link "opengl.textures" } 
+" vocabulary to display any instance of " { $link image } "."$nl 
+"An " { $link image-gadget } " can be used for static images and " { $instance image-control } 
+" for changing images (for example a video feed). For changing images, the image should be containted in " { $instance model } 
+". Change the model value with " { $link set-model } " or mutate the image and call "
+{ $link notify-connections } " when you want to update the image. To stop refreshing the image, call " { $link stop-control } "."
+" To start refreshing again, call " { $link start-control } "."
+
+$nl
+"If the " { $link image } " or " { $link model } " containing the image "
+"is available when the object is created, use the following words to create the gadget:"
+{ $subsections <image-gadget> <image-control> }
+"The " { $link image } " or " { $link model }
+" can also be given after the construction of the object. In this case, use "
+{ $link new-image-gadget } " and " { $link set-image } "." 
+" The gadget will automatically detect if the image changes size or format and reallocate a new texture if needed."
+" This means images can be set even after the gadget has been grafted. Grafted gadgets without an image will display a blank screen."
+
+{ $notes "The image can be set after the gadget has been grafted. However, for " { $instance image-gadget } ", this can "
+" be done only once. If your image is changing, you should be using " { $instance image-control } " and " { $instance model } "." 
+$nl
+" Performance will be greatly reduced if you are using images that have more than 512 pixels on one of their"
+" axis." }
+
+
+$nl
+"Utility words for displaying images :"
+{ $subsections
+image. image-window }
+
+;
+ABOUT: "images.viewer"
diff --git a/extra/images/viewer/viewer-tests.factor b/extra/images/viewer/viewer-tests.factor
new file mode 100644 (file)
index 0000000..b59c673
--- /dev/null
@@ -0,0 +1,36 @@
+! Copyright (C) 2010 Jon Harper.
+! See http://factorcode.org/license.txt for BSD license.
+USING: tools.test images.viewer images.viewer.private kernel accessors sequences images
+namespaces ui ui.gadgets.debug math opengl.textures opengl.textures.private 
+models ;
+IN: images.viewer.tests
+
+: (gen-image) ( dim -- bitmap )
+    product 3 * [ 200 ] BV{ } replicate-as ;
+: gen-image ( dim -- image )
+    dup (gen-image) <image> swap >>bitmap swap >>dim 
+    RGB >>component-order ubyte-components >>component-type ;
+
+[ ] [ { 50 50 } gen-image "s" set ] unit-test
+[ ] [ "s" get <image-gadget> "ig" set ] unit-test
+"ig" get [
+   [ t ] [ "ig" get image-gadget-texture single-texture? ] unit-test
+] with-grafted-gadget 
+
+[ ] [ "s" get <model> "m" set ] unit-test
+[ ] [ { 150 150 } gen-image "s1" set ] unit-test
+[ ] [ "m" get <image-control> "ic" set ] unit-test
+"ic" get [
+   [ t ] [ "ic" get image-gadget-texture single-texture? ] unit-test
+   [ { 50 50 } ] [ "ic" get texture>> texture-size ] unit-test
+] with-grafted-gadget
+
+! TODO
+! test that when changing the model, the gadget updates the texture.
+! - same size images (both smaller than 512x512) (updates)
+! test that when changing the model, the gadget creates a new texture.
+! test different cases : 
+! - same size images (both bigger than 512x512) (creates)
+! - different size images (both smaller than 512x512) (creates)
+! - different size images (both bigger than 512x512) (creates)
+! - different size images (1 smaller than, 1 bigger than 512x512)
index c62293bbe7f9e22830ffdbede73e41992f916812..33042f5dd0cca09b815bcf3c9f1b2c5d974770a0 100644 (file)
@@ -1,17 +1,21 @@
 ! Copyright (C) 2007, 2009 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors images images.loader io.pathnames kernel
-models namespaces opengl opengl.gl opengl.textures sequences
+models namespaces opengl opengl.gl opengl.textures opengl.textures.private
+sequences math arrays
 strings ui ui.gadgets ui.gadgets.panes ui.images ui.render
-constructors ;
+constructors locals combinators.short-circuit 
+literals destructors ui.gadgets.worlds continuations ;
 IN: images.viewer
 
 TUPLE: image-gadget < gadget image texture ;
+<PRIVATE
+M: image-gadget pref-dim* image>> [ dim>> ] [ { 640 480 } ] if* ;
 
-M: image-gadget pref-dim* image>> dim>> ;
-
+: (image-gadget-texture) ( gadget -- texture )
+    dup image>> { 0 0 } <texture> >>texture texture>> ;
 : image-gadget-texture ( gadget -- texture )
-    dup texture>> [ ] [ dup image>> { 0 0 } <texture> >>texture texture>> ] ?if ;
+    dup texture>> [ ] [ (image-gadget-texture) ] ?if ;
 
 M: image-gadget draw-gadget* ( gadget -- )
     dup image>> [
@@ -20,27 +24,88 @@ M: image-gadget draw-gadget* ( gadget -- )
         drop
     ] if ;
 
-TUPLE: image-control < image-gadget ;
-
-CONSTRUCTOR: image-control ( model -- image-control ) ;
-
-M: image-control pref-dim* image>> [ dim>> ] [ { 640 480 } ] if* ;
-
-M: image-control model-changed
-    swap value>> >>image relayout ;
+: delete-current-texture ( image-gadget -- )
+    [ texture>> [ dispose ] when* ]
+    [ f >>texture drop ] bi ;
 
-! Todo: delete texture on ungraft
+! In unit tests, find-gl-context throws no-world-found when using with-grafted-gadget.
+M: image-gadget ungraft* [ dup find-gl-context delete-current-texture ] [ 2drop ] recover ;
+PRIVATE>
+TUPLE: image-control < image-gadget image-updated? ;
+<PRIVATE
 
-GENERIC: <image-gadget> ( object -- gadget )
+: (bind-2d-texture) ( texture-id -- )
+    [ GL_TEXTURE_2D ] dip glBindTexture ;
+: bind-2d-texture ( single-texture -- )
+    texture>> (bind-2d-texture) ;
+: (update-texture) ( image single-texture -- ) 
+    bind-2d-texture tex-sub-image ;
+! works only for single-texture
+: update-texture ( image-gadget -- )
+    [ image>> ] [ texture>> ] bi
+    (update-texture) ;
+GENERIC: texture-size ( texture -- dim )
+M: single-texture texture-size dim>> ;
 
-M: image <image-gadget>
-    \ image-gadget new
-        swap >>image ;
+:: grid-width ( grid element-quot -- width )
+    grid [ 0 ] [
+        first element-quot [ + ] map-reduce
+    ] if-empty ; inline
+: grid-dim ( grid -- dim )
+    [ [ dim>> first ] grid-width ] [ flip [ dim>> second ] grid-width ] bi 2array ;
+M: multi-texture texture-size 
+    grid>> grid-dim ;
+: same-size? ( image-gadget -- ? )
+    [ texture>> texture-size ] [ image>> dim>> ] bi = ;
+: (texture-format) ( texture-id -- format )
+    (bind-2d-texture) GL_TEXTURE_2D 0
+    GL_TEXTURE_INTERNAL_FORMAT get-texture-int ;
+! works only for single-texture
+: texture-format ( image-gadget -- format/f )
+    texture>> [
+        texture>> [
+            (texture-format)
+        ] [ f ] if*
+    ] [ f ] if* ;
+: same-internal-format? ( image-gadget -- ? ) 
+   [ texture-format ] [ image>> image-format 2drop ] bi = ;
 
-M: string <image-gadget> load-image <image-gadget> ;
-
-M: pathname <image-gadget> string>> load-image <image-gadget> ;
+! TODO: also keep multitextures if possible ?
+: keep-same-texture? ( image-gadget -- ? )
+    { [ texture>> single-texture? ]
+      [ same-size? ]
+      [ same-internal-format? ] } 1&& ;
+: ?update-texture ( image-gadget -- )
+    dup image-updated?>> [
+        f >>image-updated?
+        dup keep-same-texture? [ update-texture ] [ delete-current-texture ] if
+    ] [ drop ] if ;
 
+M: image-control model-changed
+    swap value>> >>image t >>image-updated? relayout ;
+M: image-control draw-gadget* [ ?update-texture ] [ call-next-method ] bi ;
+PRIVATE>
+GENERIC: set-image ( gadget object -- gadget )
+M: image set-image >>image ;
+M: string set-image load-image >>image ;
+M: pathname set-image string>> load-image >>image ;
+M: model set-image [ value>> >>image drop ] [ >>model ] 2bi ;
+: new-image-gadget ( class -- gadget ) new ;
+: new-image-gadget* ( object class -- gadget ) 
+    new-image-gadget swap set-image ;
+: <image-gadget> ( object -- gadget )
+    \ image-gadget new-image-gadget* ;
+: <image-control> ( model -- gadget )
+    \ image-control new-image-gadget* ;
 : image-window ( object -- ) <image-gadget> "Image" open-window ;
 
+! move these words to ui.gadgets because they affect all controls ?
+: stop-control ( gadget -- ) dup model>> [ remove-connection ] [ drop ] if* ;
+: start-control ( gadget -- ) dup model>> [ add-connection ] [ drop ] if* ;
+
 : image. ( object -- ) <image-gadget> gadget. ;
+
+<PRIVATE
+M: image-control graft* start-control ;
+M: image-control ungraft* [ stop-control ] [ call-next-method ] bi ;
+PRIVATE>
index dbb013aca04ff7a8d3ed859d3738384286093cb0..14d4f515ae94f18d37cecf526f8f6e23e2ab825e 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax kernel math.bitwise sequences system io.serial ;
+USING: alien.syntax kernel math.bitwise sequences system io.serial
+literals ;
 IN: io.serial.unix
 
 M: bsd lookup-baud ( m -- n )
@@ -60,7 +61,7 @@ CONSTANT: HUPCL       HEX: 00004000
 CONSTANT: CLOCAL      HEX: 00008000
 CONSTANT: CCTS_OFLOW  HEX: 00010000
 CONSTANT: CRTS_IFLOW  HEX: 00020000
-: CRTSCTS ( -- n )  { CCTS_OFLOW CRTS_IFLOW } flags ; inline
+CONSTANT: CRTSCTS flags{ CCTS_OFLOW CRTS_IFLOW }
 CONSTANT: CDTR_IFLOW  HEX: 00040000
 CONSTANT: CDSR_OFLOW  HEX: 00080000
 CONSTANT: CCAR_OFLOW  HEX: 00100000
index f4c0c6b45a4cbc91ce9862867c11dc20291c4b2b..422844ab82f1e91222cc785c88b91c0874bd1591 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel math.bitwise io.serial io.serial.unix ;
+USING: accessors kernel math.bitwise io.serial io.serial.unix
+literals ;
 IN: io.serial.unix
 
 : serial-obj ( -- obj )
@@ -10,10 +11,10 @@ IN: io.serial.unix
     ! "/dev/ttyd0" >>path ! freebsd
     ! "/dev/ttyU0" >>path ! openbsd
     19200 >>baud
-    { IGNPAR ICRNL } flags >>iflag
-    { } flags >>oflag
-    { CS8 CLOCAL CREAD } flags >>cflag
-    { ICANON } flags >>lflag ;
+    flags{ IGNPAR ICRNL } >>iflag
+    flags{ } >>oflag
+    flags{ CS8 CLOCAL CREAD } >>cflag
+    flags{ ICANON } >>lflag ;
 
 : serial-test ( -- serial )
     serial-obj
index 6c0de55ec84628b3983e3206f54bce23fdc504d3..f2dec1972e66c48e3b8369a3a53b56b95dffd6d8 100644 (file)
@@ -3,7 +3,8 @@
 USING: accessors alien.c-types alien.syntax alien.data 
 classes.struct combinators io.ports io.streams.duplex
 system kernel math math.bitwise vocabs.loader io.serial
-io.serial.unix.termios io.backend.unix unix unix.ffi ;
+io.serial.unix.termios io.backend.unix unix unix.ffi
+literals ;
 IN: io.serial.unix
 
 << {
@@ -33,7 +34,7 @@ FUNCTION: int cfsetspeed ( termios* t, speed_t s ) ;
 
 M: unix open-serial ( serial -- serial' )
     dup
-    path>> { O_RDWR O_NOCTTY O_NDELAY } flags file-mode open-file
+    path>> flags{ O_RDWR O_NOCTTY O_NDELAY } file-mode open-file
     fd>duplex-stream >>stream ;
 
 : serial-fd ( serial -- fd )
@@ -46,14 +47,14 @@ M: unix open-serial ( serial -- serial' )
 : configure-termios ( serial -- )
     dup termios>>
     {
-        [ [ iflag>> ] dip over [ (>>iflag) ] [ 2drop ] if ]
-        [ [ oflag>> ] dip over [ (>>oflag) ] [ 2drop ] if ]
+        [ [ iflag>> ] dip over [ iflag<< ] [ 2drop ] if ]
+        [ [ oflag>> ] dip over [ oflag<< ] [ 2drop ] if ]
         [
             [
                 [ cflag>> 0 or ] [ baud>> lookup-baud ] bi bitor
-            ] dip (>>cflag)
+            ] dip cflag<<
         ]
-        [ [ lflag>> ] dip over [ (>>lflag) ] [ 2drop ] if ]
+        [ [ lflag>> ] dip over [ lflag<< ] [ 2drop ] if ]
     } 2cleave ;
 
 : tciflush ( serial -- )
index 318a1ab1e3225f96a3e475296217b3908417f858..8cc083d9dd2a007756acbc50a363732a735c3791 100644 (file)
@@ -14,7 +14,7 @@ SYMBOL: current-irc-client
 : chats> ( -- seq ) irc> chats>> values ;
 : me? ( string -- ? ) irc> nick>> = ;
 
-: with-irc ( irc-client quot: ( -- ) -- )
+: with-irc ( ..a irc-client quot: ( ..a -- ..b ) -- ..b )
     \ current-irc-client swap with-variable ; inline
 
 UNION: to-target privmsg notice ;
index f2030e87b018bab93d3c9059668ee4638e8eaa84..68ca6451a571751951ef953327bd577dc1efce5b 100644 (file)
@@ -165,7 +165,7 @@ M: irc-chat (attach-chat)
     2bi ;
 
 M: irc-server-chat (attach-chat)
-    irc> [ (>>client) ] [ chats>> +server-chat+ set-at ] 2bi ;
+    irc> [ client<< ] [ chats>> +server-chat+ set-at ] 2bi ;
 
 GENERIC: remove-chat ( irc-chat -- )
 M: irc-nick-chat remove-chat name>> unregister-chat ;
index 8d367dbb95cd562bbc0bcfa8599535537f74e0b0..d2b2e1599968e36bd0a539a87dac973c13879962 100644 (file)
@@ -37,8 +37,8 @@ M: irc-channel-chat has-participant? participants>> key? ;
 
 : apply-mode ( ? participant mode -- )
     {
-        { CHAR: o [ (>>operator) ] }
-        { CHAR: v [ (>>voice) ] }
+        { CHAR: o [ operator<< ] }
+        { CHAR: v [ voice<< ] }
         [ 3drop ]
     } case ;
 
index 0963765482275ba61681a2b3411f9df6a4000579..950b34a8d79d80782b3cc7d3a1946f6f5901f14d 100644 (file)
@@ -1,13 +1,13 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: fry irc.client irc.client.chats kernel namespaces
 sequences threads io.launcher io splitting
 make mason.common mason.updates calendar math alarms
-io.encodings.8-bit.latin1 ;
+io.encodings.8-bit.latin1 debugger ;
 IN: irc.gitbot
 
 : bot-profile ( -- obj )
-    "irc.freenode.org" 6667 "jackass" f <irc-profile> ;
+    "irc.freenode.org" 6667 "stackoid" f <irc-profile> ;
 
 : bot-channel ( -- seq ) "#concatenative" ;
 
@@ -46,8 +46,10 @@ M: object handle-message drop ;
     '[ _ speak ] interleave ;
 
 : check-for-updates ( chat -- )
-    [ git-id git-pull-cmd short-running-process git-id ] dip
-    report-updates ;
+    '[
+        git-id git-pull-cmd short-running-process git-id
+        _ report-updates
+    ] try ;
 
 : bot ( -- )
     start-bot
index b785970520738bbe69041e6604271aa49611a00b..f0f9ca02cefb931474707be81f8c6e2548afb2f5 100644 (file)
@@ -74,7 +74,7 @@ M: irc-message set-irc-trailing
 
 GENERIC: set-irc-command ( irc-message -- )
 M: irc-message set-irc-command
-    [ irc-command-string ] [ (>>command) ] bi ;
+    [ irc-command-string ] [ command<< ] bi ;
 
 : irc-message>string ( irc-message -- string )
     {
index 06a41b0aaab409bfa8fe106656e343dd8b94fea2..34606eb83afed3ed7ea3bb30453506f6aba41df7 100644 (file)
@@ -31,5 +31,5 @@ PRIVATE>
     [ >>parameters ]
     [ >>trailing ]
     tri*
-    [ (>>prefix) ] [ fill-irc-message-slots ] [ swap >>line ] tri
+    [ prefix<< ] [ fill-irc-message-slots ] [ swap >>line ] tri
     dup sender >>sender ;
diff --git a/extra/javascriptcore/authors.txt b/extra/javascriptcore/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/javascriptcore/core-foundation/authors.txt b/extra/javascriptcore/core-foundation/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/javascriptcore/core-foundation/core-foundation.factor b/extra/javascriptcore/core-foundation/core-foundation.factor
new file mode 100644 (file)
index 0000000..9dfc93b
--- /dev/null
@@ -0,0 +1,11 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax core-foundation core-foundation.strings
+javascriptcore.ffi ;
+IN: javascriptcore.core-foundation
+
+FUNCTION: JSStringRef JSStringCreateWithCFString ( CFStringRef string ) ;
+
+FUNCTION: CFStringRef JSStringCopyCFString ( CFAllocatorRef alloc, JSStringRef string ) ;
+
+
diff --git a/extra/javascriptcore/core-foundation/platforms.txt b/extra/javascriptcore/core-foundation/platforms.txt
new file mode 100644 (file)
index 0000000..6e806f4
--- /dev/null
@@ -0,0 +1 @@
+macosx
diff --git a/extra/javascriptcore/ffi/authors.txt b/extra/javascriptcore/ffi/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/javascriptcore/ffi/ffi.factor b/extra/javascriptcore/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..02847e2
--- /dev/null
@@ -0,0 +1,269 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.libraries alien.syntax
+classes.struct combinators io.encodings.utf16n
+io.encodings.utf8 kernel system ;
+IN: javascriptcore.ffi
+
+<<
+"javascriptcore" {
+    { [ os macosx? ] [
+        "/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/JavaScriptCore" cdecl add-library
+    ] }
+    ! { [ os winnt? ]  [ "javascriptcore.dll" ] }
+    ! { [ os unix? ]  [ "libsqlite3.so" ] }
+    [ drop ]
+} cond
+>>
+
+LIBRARY: javascriptcore
+
+TYPEDEF: void* JSContextGroupRef
+TYPEDEF: void* JSContextRef
+TYPEDEF: void* JSGlobalContextRef
+TYPEDEF: void* JSStringRef
+TYPEDEF: void* JSClassRef
+TYPEDEF: void* JSPropertyNameArrayRef
+TYPEDEF: void* JSPropertyNameAccumulatorRef
+TYPEDEF: void* JSValueRef
+TYPEDEF: void* JSObjectRef
+TYPEDEF: void* JSObjectInitializeCallback
+TYPEDEF: void* JSObjectFinalizeCallback
+TYPEDEF: void* JSObjectHasPropertyCallback
+TYPEDEF: void* JSObjectGetPropertyCallback
+TYPEDEF: void* JSObjectSetPropertyCallback
+TYPEDEF: void* JSObjectDeletePropertyCallback
+TYPEDEF: void* JSObjectGetPropertyNamesCallback
+TYPEDEF: void* JSObjectCallAsFunctionCallback
+TYPEDEF: void* JSObjectCallAsConstructorCallback
+TYPEDEF: void* JSObjectHasInstanceCallback
+TYPEDEF: void* JSObjectConvertToTypeCallback
+TYPEDEF: uint unsigned
+TYPEDEF: ushort JSChar
+
+ENUM: JSPropertyAttributes
+    { kJSPropertyAttributeNone       0 }
+    { kJSPropertyAttributeReadOnly   2 }
+    { kJSPropertyAttributeDontEnum   4 }
+    { kJSPropertyAttributeDontDelete 8 } ;
+
+ENUM: JSClassAttributes
+    { kJSClassAttributeNone 0 }
+    { kJSClassAttributeNoAutomaticPrototype 2 } ;
+
+ENUM: JSType
+    kJSTypeUndefined,
+    kJSTypeNull,
+    kJSTypeBoolean,
+    kJSTypeNumber,
+    kJSTypeString,
+    kJSTypeObject ;
+
+STRUCT: JSStaticValue
+    { name c-string }
+    { getProperty JSObjectGetPropertyCallback }
+    { setProperty JSObjectSetPropertyCallback }
+    { attributes JSPropertyAttributes } ;
+
+STRUCT: JSStaticFunction
+    { name c-string }
+    { callAsFunction JSObjectCallAsFunctionCallback } ;
+
+STRUCT: JSClassDefinition
+    { version int }
+    { attributes JSClassAttributes }
+    { className c-string }
+    { parentClass JSClassRef }
+    { staticValues JSStaticValue* }
+    { staticFunctions JSStaticFunction* }
+    { initialize JSObjectInitializeCallback }
+    { finalize JSObjectFinalizeCallback }
+    { hasProperty JSObjectHasPropertyCallback }
+    { getProperty JSObjectGetPropertyCallback }
+    { setProperty JSObjectSetPropertyCallback }
+    { deleteProperty JSObjectDeletePropertyCallback }
+    { getPropertyNames JSObjectGetPropertyNamesCallback }
+    { callAsFunction JSObjectCallAsFunctionCallback }
+    { callAsConstructor JSObjectCallAsConstructorCallback }
+    { hasInstance JSObjectHasInstanceCallback }
+    { convertToType JSObjectConvertToTypeCallback } ;
+
+ALIAS: kJSClassDefinitionEmpty JSClassDefinition
+
+FUNCTION: JSValueRef JSEvaluateScript (
+    JSContextRef ctx,
+    JSStringRef script,
+    JSObjectRef thisObject,
+    JSStringRef sourceURL,
+    int startingLineNumber,
+    JSValueRef* exception ) ;
+
+FUNCTION: bool JSCheckScriptSyntax (
+    JSContextRef ctx,
+    JSStringRef script,
+    JSStringRef sourceURL,
+    int startingLineNumber,
+    JSValueRef* exception ) ;
+
+FUNCTION: void JSGarbageCollect
+    ( JSContextRef ctx ) ;
+
+FUNCTION: JSContextGroupRef JSContextGroupCreate
+    ( ) ;
+
+FUNCTION: JSContextGroupRef JSContextGroupRetain
+    ( JSContextGroupRef group ) ;
+
+FUNCTION: void JSContextGroupRelease
+    ( JSContextGroupRef group ) ;
+
+FUNCTION: JSGlobalContextRef JSGlobalContextCreate
+    ( JSClassRef globalObjectClass ) ; 
+
+FUNCTION: JSGlobalContextRef JSGlobalContextCreateInGroup (
+    JSContextGroupRef group,
+    JSClassRef globalObjectClass ) ;
+
+FUNCTION: JSGlobalContextRef JSGlobalContextRetain
+    ( JSGlobalContextRef ctx ) ;
+
+FUNCTION: void JSGlobalContextRelease
+    ( JSGlobalContextRef ctx ) ;
+
+FUNCTION: JSObjectRef JSContextGetGlobalObject
+    ( JSContextRef ctx ) ;
+
+FUNCTION: JSContextGroupRef JSContextGetGroup
+    ( JSContextRef ctx ) ;
+
+FUNCTION: JSClassRef JSClassCreate
+    ( JSClassDefinition* definition ) ;
+
+FUNCTION: JSClassRef JSClassRetain
+    ( JSClassRef jsClass ) ;
+
+FUNCTION: void JSClassRelease
+    ( JSClassRef jsClass ) ;
+
+FUNCTION: JSObjectRef JSObjectMake
+    ( JSContextRef ctx,
+      JSClassRef jsClass, void* data ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeFunctionWithCallback ( JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeConstructor ( JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeArray ( JSContextRef ctx, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeDate ( JSContextRef ctx, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeError ( JSContextRef ctx, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeRegExp ( JSContextRef ctx, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeFunction ( JSContextRef ctx, JSStringRef name, unsigned parameterCount, JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception ) ;
+
+FUNCTION: JSValueRef JSObjectGetPrototype ( JSContextRef ctx, JSObjectRef object ) ;
+
+FUNCTION: void JSObjectSetPrototype ( JSContextRef ctx, JSObjectRef object, JSValueRef value ) ;
+
+FUNCTION: bool JSObjectHasProperty ( JSContextRef ctx, JSObjectRef object, JSStringRef propertyName ) ;
+
+FUNCTION: JSValueRef JSObjectGetProperty ( JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception ) ;
+
+FUNCTION: void JSObjectSetProperty ( JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception ) ;
+
+FUNCTION: bool JSObjectDeleteProperty ( JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception ) ;
+
+FUNCTION: JSValueRef JSObjectGetPropertyAtIndex ( JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception ) ;
+
+FUNCTION: void JSObjectSetPropertyAtIndex ( JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception ) ;
+
+FUNCTION: void* JSObjectGetPrivate ( JSObjectRef object ) ;
+
+FUNCTION: bool JSObjectSetPrivate ( JSObjectRef object, void* data ) ;
+
+FUNCTION: bool JSObjectIsFunction ( JSContextRef ctx, JSObjectRef object ) ;
+
+FUNCTION: JSValueRef JSObjectCallAsFunction ( JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: bool JSObjectIsConstructor ( JSContextRef ctx, JSObjectRef object ) ;
+
+FUNCTION: JSObjectRef JSObjectCallAsConstructor ( JSContextRef ctx, JSObjectRef object, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: JSPropertyNameArrayRef JSObjectCopyPropertyNames ( JSContextRef ctx, JSObjectRef object ) ;
+
+FUNCTION: JSPropertyNameArrayRef JSPropertyNameArrayRetain ( JSPropertyNameArrayRef array ) ;
+
+FUNCTION: void JSPropertyNameArrayRelease ( JSPropertyNameArrayRef array ) ;
+
+FUNCTION: size_t JSPropertyNameArrayGetCount ( JSPropertyNameArrayRef array ) ;
+
+FUNCTION: JSStringRef JSPropertyNameArrayGetNameAtIndex ( JSPropertyNameArrayRef array, size_t index ) ;
+
+FUNCTION: void JSPropertyNameAccumulatorAddName ( JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName ) ;
+
+FUNCTION: JSStringRef JSStringCreateWithCharacters ( JSChar* chars, size_t numChars ) ;
+
+FUNCTION: JSStringRef JSStringCreateWithUTF8CString ( c-string string ) ;
+
+FUNCTION: JSStringRef JSStringRetain ( JSStringRef string ) ;
+
+FUNCTION: void JSStringRelease ( JSStringRef string ) ;
+
+FUNCTION: size_t JSStringGetLength ( JSStringRef string ) ;
+
+FUNCTION: JSChar* JSStringGetCharactersPtr ( JSStringRef string ) ;
+
+FUNCTION: size_t JSStringGetMaximumUTF8CStringSize ( JSStringRef string ) ;
+
+FUNCTION: size_t JSStringGetUTF8CString ( JSStringRef string, char* buffer, size_t bufferSize ) ;
+
+FUNCTION: bool JSStringIsEqual ( JSStringRef a, JSStringRef b ) ;
+
+FUNCTION: bool JSStringIsEqualToUTF8CString ( JSStringRef a, char* b ) ;
+
+FUNCTION: JSType JSValueGetType ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsUndefined ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsNull ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsBoolean ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsNumber ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsString ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsObject ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsObjectOfClass ( JSContextRef ctx, JSValueRef value, JSClassRef jsClass ) ;
+
+FUNCTION: bool JSValueIsEqual ( JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception ) ;
+
+FUNCTION: bool JSValueIsStrictEqual ( JSContextRef ctx, JSValueRef a, JSValueRef b ) ;
+
+FUNCTION: bool JSValueIsInstanceOfConstructor ( JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception ) ;
+
+FUNCTION: JSValueRef JSValueMakeUndefined ( JSContextRef ctx ) ;
+
+FUNCTION: JSValueRef JSValueMakeNull ( JSContextRef ctx ) ;
+
+FUNCTION: JSValueRef JSValueMakeBoolean ( JSContextRef ctx, bool boolean ) ;
+
+FUNCTION: JSValueRef JSValueMakeNumber ( JSContextRef ctx, double number ) ;
+
+FUNCTION: JSValueRef JSValueMakeString ( JSContextRef ctx, JSStringRef string ) ;
+
+FUNCTION: bool JSValueToBoolean ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: double JSValueToNumber ( JSContextRef ctx, JSValueRef value, JSValueRef* exception ) ;
+
+FUNCTION: JSStringRef JSValueToStringCopy ( JSContextRef ctx, JSValueRef value, JSValueRef* exception ) ;
+
+FUNCTION: JSObjectRef JSValueToObject ( JSContextRef ctx, JSValueRef value, JSValueRef* exception ) ;
+
+FUNCTION: void JSValueProtect ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: void JSValueUnprotect ( JSContextRef ctx, JSValueRef value ) ;
+
diff --git a/extra/javascriptcore/ffi/hack/authors.txt b/extra/javascriptcore/ffi/hack/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/javascriptcore/ffi/hack/hack.factor b/extra/javascriptcore/ffi/hack/hack.factor
new file mode 100644 (file)
index 0000000..1866a24
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.accessors alien.syntax kernel kernel.private
+math system ;
+IN: javascriptcore.ffi.hack
+
+HOOK: set-callstack-bounds os ( -- )
+
+HOOK: macosx-callstack-start-offset cpu ( -- address )
+HOOK: macosx-callstack-size-offset cpu ( -- address )
+
+M: ppc macosx-callstack-start-offset HEX: 188 ;
+M: ppc macosx-callstack-size-offset HEX: 18c ;
+
+M: x86.32 macosx-callstack-start-offset HEX: c48 ;
+M: x86.32 macosx-callstack-size-offset HEX: c4c ;
+
+M: x86.64 macosx-callstack-start-offset HEX: 1860 ;
+M: x86.64 macosx-callstack-size-offset HEX: 1868 ;
+
+M: object set-callstack-bounds ;
+
+FUNCTION: void* pthread_self ( ) ;
+
+M: macosx set-callstack-bounds
+    callstack-bounds over [ alien-address ] bi@ -
+    pthread_self
+    [ macosx-callstack-size-offset set-alien-unsigned-cell ]
+    [ macosx-callstack-start-offset set-alien-cell ] bi ;
diff --git a/extra/javascriptcore/javascriptcore-tests.factor b/extra/javascriptcore/javascriptcore-tests.factor
new file mode 100644 (file)
index 0000000..53ae12d
--- /dev/null
@@ -0,0 +1,10 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors javascriptcore kernel tools.test ;
+IN: javascriptcore.tests
+
+[ "2" ] [ "1+1" eval-js-standalone ] unit-test
+
+[ "1+shoes" eval-js-standalone ]
+[ error>> "ReferenceError: Can't find variable: shoes" = ] must-fail-with
+
diff --git a/extra/javascriptcore/javascriptcore.factor b/extra/javascriptcore/javascriptcore.factor
new file mode 100644 (file)
index 0000000..738f174
--- /dev/null
@@ -0,0 +1,48 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.data byte-arrays continuations fry
+io.encodings.string io.encodings.utf8 io.files
+javascriptcore.ffi javascriptcore.ffi.hack kernel namespaces
+sequences ;
+IN: javascriptcore
+
+ERROR: javascriptcore-error error ;
+
+SYMBOL: js-context
+
+: with-global-context ( quot -- )
+    [
+        [ f JSGlobalContextCreate dup js-context set ] dip
+        [ nip '[ @ ] ]
+        [ drop '[ _ JSGlobalContextRelease ] ] 2bi
+        [ ] cleanup
+    ] with-scope ; inline
+
+: with-javascriptcore ( quot -- )
+    set-callstack-bounds
+    with-global-context ; inline
+
+: JSString>string ( JSString -- string )
+    dup JSStringGetMaximumUTF8CStringSize [ <byte-array> ] keep
+    [ JSStringGetUTF8CString drop ] [ drop ] 2bi
+    utf8 decode [ 0 = ] trim-tail ;
+
+: JSValueRef>string ( ctx JSValueRef/f -- string/f )
+    [
+        f JSValueToStringCopy
+        [ JSString>string ] [ JSStringRelease ] bi
+    ] [
+        drop f
+    ] if* ;
+
+: eval-js ( string -- result-string )
+    [ js-context get dup ] dip
+    JSStringCreateWithUTF8CString f f 0 JSValueRef <c-object>
+    [ JSEvaluateScript ] keep *void*
+    dup [ nip JSValueRef>string javascriptcore-error ] [ drop JSValueRef>string ] if ;
+
+: eval-js-standalone ( string -- result-string )
+    '[ _ eval-js ] with-javascriptcore ;
+
+: eval-js-path-standalone ( path -- result-string ) utf8 file-contents eval-js-standalone ;
+
diff --git a/extra/javascriptcore/platforms.txt b/extra/javascriptcore/platforms.txt
new file mode 100644 (file)
index 0000000..6e806f4
--- /dev/null
@@ -0,0 +1 @@
+macosx
diff --git a/extra/joystick-demo/authors.txt b/extra/joystick-demo/authors.txt
deleted file mode 100644 (file)
index f13c9c1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Joe Groff
diff --git a/extra/joystick-demo/deploy.factor b/extra/joystick-demo/deploy.factor
deleted file mode 100644 (file)
index 8ef5231..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-USING: tools.deploy.config ;
-H{
-    { deploy-name "joystick-demo" }
-    { deploy-io 2 }
-    { deploy-word-defs? f }
-    { deploy-c-types? t }
-    { deploy-word-props? f }
-    { deploy-reflection 1 }
-    { deploy-threads? t }
-    { deploy-math? t }
-    { "stop-after-last-window?" t }
-    { deploy-ui? t }
-}
diff --git a/extra/joystick-demo/joystick-demo.factor b/extra/joystick-demo/joystick-demo.factor
deleted file mode 100644 (file)
index 05440c8..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-USING: ui ui.gadgets sequences kernel arrays math colors
-colors.constants ui.render ui.pens.polygon ui.pens.solid math.vectors
-accessors fry ui.gadgets.packs game.input ui.gadgets.labels
-ui.gadgets.borders alarms calendar locals strings ui.gadgets.buttons
-combinators math.parser assocs threads ;
-IN: joystick-demo
-
-CONSTANT: SIZE { 151 151 }
-CONSTANT: INDICATOR-SIZE { 4 4 }
-: FREQUENCY ( -- f ) 30 recip seconds ;
-
-TUPLE: axis-gadget < gadget indicator z-indicator pov ;
-
-M: axis-gadget pref-dim* drop SIZE ;
-
-: (rect-polygon) ( lo hi -- polygon )
-    2dup
-    [ [ second ] [ first  ] bi* swap 2array ]
-    [ [ first  ] [ second ] bi*      2array ] 2bi swapd 4array ;
-
-: indicator-polygon ( -- polygon )
-    { 0 0 } INDICATOR-SIZE (rect-polygon) ;
-
-CONSTANT: pov-polygons
-    V{
-        { pov-neutral    { { 70 75 } { 75 70 } { 80 75 } { 75 80 } } }
-        { pov-up         { { 70 65 } { 75 60 } { 80 65 } } }
-        { pov-up-right   { { 83 60 } { 90 60 } { 90 67 } } }
-        { pov-right      { { 85 70 } { 90 75 } { 85 80 } } }
-        { pov-down-right { { 90 83 } { 90 90 } { 83 90 } } }
-        { pov-down       { { 70 85 } { 75 90 } { 80 85 } } }
-        { pov-down-left  { { 67 90 } { 60 90 } { 60 83 } } }
-        { pov-left       { { 65 70 } { 60 75 } { 65 80 } } }
-        { pov-up-left    { { 67 60 } { 60 60 } { 60 67 } } }
-    }
-
-: <indicator-gadget> ( color -- indicator )
-    indicator-polygon <polygon-gadget> ;
-
-: (>loc) ( axisloc -- windowloc )
-    0.5 v*n { 0.5 0.5 } v+ SIZE v* [ >integer ] map
-    INDICATOR-SIZE 2 v/n v- ;
-
-: (xy>loc) ( x y -- xyloc )
-    2array (>loc) ;
-: (z>loc) ( z -- zloc )
-    0.0 swap 2array (>loc) ;
-
-: (xyz>loc) ( x y z -- xyloc zloc )
-    [ [ 0.0 ] unless* ] tri@
-    [ (xy>loc) ] dip (z>loc) ;
-
-:: move-axis ( gadget x y z -- )
-    x y z (xyz>loc) :> ( xy z )
-    xy gadget   indicator>> (>>loc)
-    z  gadget z-indicator>> (>>loc) ;
-
-: move-pov ( gadget pov -- )
-    swap pov>> [ interior>> -rot = COLOR: gray COLOR: white ? >>color drop ]
-    with assoc-each ;
-
-:: add-pov-gadget ( gadget direction polygon -- gadget direction gadget )
-    gadget COLOR: white polygon <polygon-gadget> [ add-gadget ] keep
-    direction swap ;
-
-: add-pov-gadgets ( gadget -- gadget )
-    pov-polygons [ add-pov-gadget ] assoc-map >>pov ;
-
-: <axis-gadget> ( -- gadget )
-    axis-gadget new
-    add-pov-gadgets
-    COLOR: black <indicator-gadget> [ >>z-indicator ] [ add-gadget ] bi
-    COLOR: red   <indicator-gadget> [ >>indicator   ] [ add-gadget ] bi
-    dup [ 0.0 0.0 0.0 move-axis ] [ f move-pov ] bi ;
-
-TUPLE: joystick-demo-gadget < pack axis raxis controller buttons alarm ;
-
-: add-gadget-with-border ( parent child -- parent )
-    { 2 2 } <border> COLOR: gray <solid> >>boundary add-gadget ;
-
-: add-controller-label ( gadget controller -- gadget )
-    [ >>controller ] [ product-string <label> add-gadget ] bi ;
-
-: add-axis-gadget ( gadget shelf -- gadget shelf )
-    <axis-gadget> [ >>axis ] [ add-gadget-with-border ] bi-curry bi* ;
-
-: add-raxis-gadget ( gadget shelf -- gadget shelf )
-    <axis-gadget> [ >>raxis ] [ add-gadget-with-border ] bi-curry bi* ;
-
-:: (add-button-gadgets) ( gadget shelf -- )
-    gadget controller>> read-controller buttons>> length [
-        number>string [ drop ] <border-button>
-        shelf over add-gadget drop
-    ] map gadget (>>buttons) ;
-
-: add-button-gadgets ( gadget shelf -- gadget shelf )
-    [ (add-button-gadgets) ] 2keep ;
-
-: <joystick-demo-gadget> ( controller -- gadget )
-    joystick-demo-gadget new
-    { 0 1 } >>orientation
-    swap add-controller-label
-    <shelf> add-axis-gadget add-raxis-gadget add-gadget
-    <shelf> add-button-gadgets add-gadget ;
-
-: update-buttons ( buttons button-states -- )
-    [ >>selected? drop ] 2each ;
-
-: kill-update-axes ( gadget -- )
-    COLOR: gray <solid> >>interior
-    [ [ cancel-alarm ] when* f ] change-alarm
-    relayout-1 ;
-
-: (update-axes) ( gadget controller-state -- )
-    {
-        [ [ axis>>  ] [ [ x>>  ] [ y>>  ] [ z>>  ] tri ] bi* move-axis ]
-        [ [ raxis>> ] [ [ rx>> ] [ ry>> ] [ rz>> ] tri ] bi* move-axis ]
-        [ [ axis>>  ] [ pov>> ] bi* move-pov ]
-        [ [ buttons>> ] [ buttons>> ] bi* update-buttons ]
-        [ drop relayout-1 ]
-    } 2cleave ;
-
-: update-axes ( gadget -- )
-    dup controller>> read-controller
-    [ (update-axes) ] [ kill-update-axes ] if* ;
-
-M: joystick-demo-gadget graft*
-    dup '[ _ update-axes ] FREQUENCY every >>alarm
-    drop ;
-
-M: joystick-demo-gadget ungraft*
-    alarm>> [ cancel-alarm ] when* ;
-
-: joystick-window ( controller -- )
-    [ <joystick-demo-gadget> ] [ product-string ] bi
-    open-window ;
-
-: joystick-demo ( -- )
-    [
-        open-game-input
-        100 milliseconds sleep ! It might take a moment to find devices...
-        get-controllers [ joystick-window ] each
-    ] with-ui ;
-
-MAIN: joystick-demo
diff --git a/extra/joystick-demo/summary.txt b/extra/joystick-demo/summary.txt
deleted file mode 100644 (file)
index e10653c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Demonstrate gamepad and joystick input
diff --git a/extra/joystick-demo/tags.txt b/extra/joystick-demo/tags.txt
deleted file mode 100755 (executable)
index 84d4140..0000000
+++ /dev/null
@@ -1 +0,0 @@
-games
diff --git a/extra/key-caps/authors.txt b/extra/key-caps/authors.txt
deleted file mode 100644 (file)
index f13c9c1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Joe Groff
diff --git a/extra/key-caps/key-caps.factor b/extra/key-caps/key-caps.factor
deleted file mode 100644 (file)
index 585ca2d..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-USING: game.input game.input.scancodes
-kernel ui.gadgets ui.gadgets.buttons sequences accessors
-words arrays assocs math calendar fry alarms ui
-ui.gadgets.borders ui.gestures ;
-IN: key-caps
-
-CONSTANT: key-locations H{
-    { key-escape        { {   0   0 } {  10  10 } } }
-
-    { key-f1            { {  20   0 } {  10  10 } } }
-    { key-f2            { {  30   0 } {  10  10 } } }
-    { key-f3            { {  40   0 } {  10  10 } } }
-    { key-f4            { {  50   0 } {  10  10 } } }
-
-    { key-f5            { {  65   0 } {  10  10 } } }
-    { key-f6            { {  75   0 } {  10  10 } } }
-    { key-f7            { {  85   0 } {  10  10 } } }
-    { key-f8            { {  95   0 } {  10  10 } } }
-
-    { key-f9            { { 110   0 } {  10  10 } } }
-    { key-f10           { { 120   0 } {  10  10 } } }
-    { key-f11           { { 130   0 } {  10  10 } } }
-    { key-f12           { { 140   0 } {  10  10 } } }
-
-
-    { key-`             { {   0  15 } {  10  10 } } }
-    { key-1             { {  10  15 } {  10  10 } } }
-    { key-2             { {  20  15 } {  10  10 } } }
-    { key-3             { {  30  15 } {  10  10 } } }
-    { key-4             { {  40  15 } {  10  10 } } }
-    { key-5             { {  50  15 } {  10  10 } } }
-    { key-6             { {  60  15 } {  10  10 } } }
-    { key-7             { {  70  15 } {  10  10 } } }
-    { key-8             { {  80  15 } {  10  10 } } }
-    { key-9             { {  90  15 } {  10  10 } } }
-    { key-0             { { 100  15 } {  10  10 } } }
-    { key--             { { 110  15 } {  10  10 } } }
-    { key-=             { { 120  15 } {  10  10 } } }
-    { key-backspace     { { 130  15 } {  20  10 } } }
-
-    { key-tab           { {   0  25 } {  15  10 } } }
-    { key-q             { {  15  25 } {  10  10 } } }
-    { key-w             { {  25  25 } {  10  10 } } }
-    { key-e             { {  35  25 } {  10  10 } } }
-    { key-r             { {  45  25 } {  10  10 } } }
-    { key-t             { {  55  25 } {  10  10 } } }
-    { key-y             { {  65  25 } {  10  10 } } }
-    { key-u             { {  75  25 } {  10  10 } } }
-    { key-i             { {  85  25 } {  10  10 } } }
-    { key-o             { {  95  25 } {  10  10 } } }
-    { key-p             { { 105  25 } {  10  10 } } }
-    { key-[             { { 115  25 } {  10  10 } } }
-    { key-]             { { 125  25 } {  10  10 } } }
-    { key-\             { { 135  25 } {  15  10 } } }
-
-    { key-caps-lock     { {   0  35 } {  20  10 } } }
-    { key-a             { {  20  35 } {  10  10 } } }
-    { key-s             { {  30  35 } {  10  10 } } }
-    { key-d             { {  40  35 } {  10  10 } } }
-    { key-f             { {  50  35 } {  10  10 } } }
-    { key-g             { {  60  35 } {  10  10 } } }
-    { key-h             { {  70  35 } {  10  10 } } }
-    { key-j             { {  80  35 } {  10  10 } } }
-    { key-k             { {  90  35 } {  10  10 } } }
-    { key-l             { { 100  35 } {  10  10 } } }
-    { key-;             { { 110  35 } {  10  10 } } }
-    { key-'             { { 120  35 } {  10  10 } } }
-    { key-return        { { 130  35 } {  20  10 } } }
-
-    { key-left-shift    { {   0  45 } {  25  10 } } }
-    { key-z             { {  25  45 } {  10  10 } } }
-    { key-x             { {  35  45 } {  10  10 } } }
-    { key-c             { {  45  45 } {  10  10 } } }
-    { key-v             { {  55  45 } {  10  10 } } }
-    { key-b             { {  65  45 } {  10  10 } } }
-    { key-n             { {  75  45 } {  10  10 } } }
-    { key-m             { {  85  45 } {  10  10 } } }
-    { key-,             { {  95  45 } {  10  10 } } }
-    { key-.             { { 105  45 } {  10  10 } } }
-    { key-/             { { 115  45 } {  10  10 } } }
-    { key-right-shift   { { 125  45 } {  25  10 } } }
-
-    { key-left-control  { {   0  55 } {  15  10 } } }
-    { key-left-gui      { {  15  55 } {  15  10 } } }
-    { key-left-alt      { {  30  55 } {  15  10 } } }
-    { key-space         { {  45  55 } {  45  10 } } }
-    { key-right-alt     { {  90  55 } {  15  10 } } }
-    { key-right-gui     { { 105  55 } {  15  10 } } }
-    { key-application   { { 120  55 } {  15  10 } } }
-    { key-right-control { { 135  55 } {  15  10 } } }
-
-
-    { key-print-screen  { { 155   0 } {  10  10 } } }
-    { key-scroll-lock   { { 165   0 } {  10  10 } } }
-    { key-pause         { { 175   0 } {  10  10 } } }
-    
-    { key-insert        { { 155  15 } {  10  10 } } }
-    { key-home          { { 165  15 } {  10  10 } } }
-    { key-page-up       { { 175  15 } {  10  10 } } }
-
-    { key-delete        { { 155  25 } {  10  10 } } }
-    { key-end           { { 165  25 } {  10  10 } } }
-    { key-page-down     { { 175  25 } {  10  10 } } }
-
-    { key-up-arrow      { { 165  45 } {  10  10 } } }
-    { key-left-arrow    { { 155  55 } {  10  10 } } }
-    { key-down-arrow    { { 165  55 } {  10  10 } } }
-    { key-right-arrow   { { 175  55 } {  10  10 } } }
-
-
-    { key-keypad-numlock { { 190 15 } {  10  10 } } }
-    { key-keypad-/       { { 200 15 } {  10  10 } } }
-    { key-keypad-*       { { 210 15 } {  10  10 } } }
-    { key-keypad--       { { 220 15 } {  10  10 } } }
-
-    { key-keypad-7       { { 190 25 } {  10  10 } } }
-    { key-keypad-8       { { 200 25 } {  10  10 } } }
-    { key-keypad-9       { { 210 25 } {  10  10 } } }
-    { key-keypad-+       { { 220 25 } {  10  20 } } }
-
-    { key-keypad-4       { { 190 35 } {  10  10 } } }
-    { key-keypad-5       { { 200 35 } {  10  10 } } }
-    { key-keypad-6       { { 210 35 } {  10  10 } } }
-
-    { key-keypad-1       { { 190 45 } {  10  10 } } }
-    { key-keypad-2       { { 200 45 } {  10  10 } } }
-    { key-keypad-3       { { 210 45 } {  10  10 } } }
-    { key-keypad-enter   { { 220 45 } {  10  20 } } }
-
-    { key-keypad-0       { { 190 55 } {  20  10 } } }
-    { key-keypad-.       { { 210 55 } {  10  10 } } }
-}
-
-CONSTANT: KEYBOARD-SIZE { 230 65 }
-: FREQUENCY ( -- f ) 30 recip seconds ;
-
-TUPLE: key-caps-gadget < gadget keys alarm ;
-
-: make-key-gadget ( scancode dim array -- )
-    [ 
-        swap [ 
-            " " [ drop ] <border-button>
-            swap [ first >>loc ] [ second >>dim ] bi
-        ] [ execute( -- value ) ] bi*
-    ] dip set-nth ;
-
-: add-keys-gadgets ( gadget -- gadget )
-    key-locations 256 f <array>
-    [ [ make-key-gadget ] curry assoc-each ]
-    [ [ [ add-gadget ] when* ] each ] 
-    [ >>keys ] tri ;
-
-: <key-caps-gadget> ( -- gadget )
-    key-caps-gadget new
-    add-keys-gadgets ;
-
-M: key-caps-gadget pref-dim* drop KEYBOARD-SIZE ;
-
-: update-key-caps-state ( gadget -- )
-    read-keyboard keys>> over keys>> 
-    [ [ (>>selected?) ] [ drop ] if* ] 2each 
-    relayout-1 ;
-
-M: key-caps-gadget graft*
-    open-game-input
-    dup '[ _ update-key-caps-state ] FREQUENCY every >>alarm
-    drop ;
-
-M: key-caps-gadget ungraft*
-    alarm>> [ cancel-alarm ] when*
-    close-game-input ;
-
-M: key-caps-gadget handle-gesture
-    drop [ key-down? ] [ key-up? ] bi or not ;
-
-MAIN-WINDOW: key-caps { { title "Key Caps" } }
-    <key-caps-gadget> { 5 5 } <border> >>gadgets ;
diff --git a/extra/key-caps/summary.txt b/extra/key-caps/summary.txt
deleted file mode 100644 (file)
index f7d7a2c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Graphical keyboard diagram
diff --git a/extra/key-caps/tags.txt b/extra/key-caps/tags.txt
deleted file mode 100755 (executable)
index cb5fc20..0000000
+++ /dev/null
@@ -1 +0,0 @@
-demos
diff --git a/extra/key-logger/authors.txt b/extra/key-logger/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/key-logger/deploy.factor b/extra/key-logger/deploy.factor
new file mode 100644 (file)
index 0000000..f265164
--- /dev/null
@@ -0,0 +1,15 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-name "key-logger" }
+    { deploy-ui? f }
+    { deploy-c-types? f }
+    { deploy-console? f }
+    { deploy-unicode? f }
+    { "stop-after-last-window?" t }
+    { deploy-io 3 }
+    { deploy-reflection 1 }
+    { deploy-word-props? f }
+    { deploy-math? t }
+    { deploy-threads? t }
+    { deploy-word-defs? f }
+}
diff --git a/extra/key-logger/key-logger.factor b/extra/key-logger/key-logger.factor
new file mode 100644 (file)
index 0000000..471c86c
--- /dev/null
@@ -0,0 +1,35 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alarms bit-arrays calendar game.input io
+io.binary io.encodings.binary io.files kernel literals math
+namespaces system threads ;
+IN: key-logger
+
+CONSTANT: frequency $[ 1/30 seconds ]
+
+CONSTANT: path "resource:key-log.txt"
+
+: update-key-caps-state ( -- )
+    read-keyboard keys>>
+    path binary [
+        [ gmt unix-1970 time- duration>nanoseconds >integer ]
+        [ bit-array>integer ] bi*
+        [ 8 >be write ] bi@ flush
+    ] with-file-appender ;
+
+SYMBOL: key-logger
+
+: start-key-logger ( -- )
+    key-logger get-global [
+        [
+            open-game-input
+            [ update-key-caps-state ] frequency every key-logger set-global
+        ] in-thread
+    ] unless ;
+
+: stop-key-logger ( -- )
+    key-logger get-global [ stop-alarm ] when*
+    f key-logger set-global
+    close-game-input ;
+
+MAIN: start-key-logger
index c35ba6ac8c0193922ba85c8b53879987713a6b64..ff1547ed27a9eb226017ebbdd270421a2ba1ffe7 100644 (file)
@@ -4,6 +4,7 @@ USING: accessors arrays hashtables assocs io kernel locals math
 math.vectors math.matrices math.matrices.elimination namespaces
 parser prettyprint sequences words combinators math.parser
 splitting sorting shuffle sets math.order ;
+FROM: namespaces => set ;
 IN: koszul
 
 ! Utilities
@@ -78,11 +79,8 @@ SYMBOL: terms
         [ nth ] 2keep swap 1 + tail-slice (inversions) +
     ] curry each ;
 
-: duplicates? ( seq -- ? )
-    dup prune [ length ] bi@ > ;
-
 : (wedge) ( n basis1 basis2 -- n basis )
-    append dup duplicates? [
+    append dup all-unique? not [
         2drop 0 { }
     ] [
         dup permutation inversions -1^ rot *
@@ -200,8 +198,8 @@ DEFER: (d)
 
 : bigraded-betti ( u-generators z-generators -- seq )
     [ basis graded ] bi@ tensor bigraded-ker/im-d
-    [ [ [ first ] map ] map ] keep
-    [ [ second ] map 2 head* { 0 0 } prepend ] map
+    [ [ keys ] map ] keep
+    [ values 2 head* { 0 0 } prepend ] map
     rest dup first length 0 <array> suffix
     [ v- ] 2map ;
 
index d521015d6f6c60ad411f2fb83c88ad42b48ba9c9..a5abc7279053f6a0172f78b8a2d6726bb947c6f4 100644 (file)
@@ -11,7 +11,7 @@ IN: libusb
         { [ os windows? ] [ "libusb-1.0.dll" ] }
         { [ os macosx? ] [ "libusb-1.0.dylib"  ] }
         { [ os unix?  ] [ "libusb-1.0.so" ] }
-    } cond "cdecl" add-library >>
+    } cond cdecl add-library >>
 LIBRARY: libusb
 
 : libusb_cpu_to_le16 ( x -- y )
@@ -19,28 +19,28 @@ LIBRARY: libusb
 
 ALIAS: libusb_le16_to_cpu libusb_cpu_to_le16
 
-CONSTANT: LIBUSB_CLASS_PER_INTERFACE 0
-CONSTANT: LIBUSB_CLASS_AUDIO         1
-CONSTANT: LIBUSB_CLASS_COMM          2
-CONSTANT: LIBUSB_CLASS_HID           3
-CONSTANT: LIBUSB_CLASS_PRINTER       7
-CONSTANT: LIBUSB_CLASS_PTP           6
-CONSTANT: LIBUSB_CLASS_MASS_STORAGE  8
-CONSTANT: LIBUSB_CLASS_HUB           9
-CONSTANT: LIBUSB_CLASS_DATA          10
-CONSTANT: LIBUSB_CLASS_VENDOR_SPEC HEX: ff
-TYPEDEF: int libusb_class_code
-
-CONSTANT: LIBUSB_DT_DEVICE    HEX: 01
-CONSTANT: LIBUSB_DT_CONFIG    HEX: 02
-CONSTANT: LIBUSB_DT_STRING    HEX: 03
-CONSTANT: LIBUSB_DT_INTERFACE HEX: 04
-CONSTANT: LIBUSB_DT_ENDPOINT  HEX: 05
-CONSTANT: LIBUSB_DT_HID       HEX: 21
-CONSTANT: LIBUSB_DT_REPORT    HEX: 22
-CONSTANT: LIBUSB_DT_PHYSICAL  HEX: 23
-CONSTANT: LIBUSB_DT_HUB       HEX: 29
-TYPEDEF: int libusb_descriptor_type
+ENUM: libusb_class_code
+    { LIBUSB_CLASS_PER_INTERFACE 0 }
+    { LIBUSB_CLASS_AUDIO         1 }
+    { LIBUSB_CLASS_COMM          2 }
+    { LIBUSB_CLASS_HID           3 }
+    { LIBUSB_CLASS_PRINTER       7 }
+    { LIBUSB_CLASS_PTP           6 }
+    { LIBUSB_CLASS_MASS_STORAGE  8 }
+    { LIBUSB_CLASS_HUB           9 }
+    { LIBUSB_CLASS_DATA          10 }
+    { LIBUSB_CLASS_VENDOR_SPEC HEX: ff } ;
+
+ENUM: libusb_descriptor_type
+    { LIBUSB_DT_DEVICE    HEX: 01 }
+    { LIBUSB_DT_CONFIG    HEX: 02 }
+    { LIBUSB_DT_STRING    HEX: 03 }
+    { LIBUSB_DT_INTERFACE HEX: 04 }
+    { LIBUSB_DT_ENDPOINT  HEX: 05 }
+    { LIBUSB_DT_HID       HEX: 21 }
+    { LIBUSB_DT_REPORT    HEX: 22 }
+    { LIBUSB_DT_PHYSICAL  HEX: 23 }
+    { LIBUSB_DT_HUB       HEX: 29 } ;
 
 CONSTANT: LIBUSB_DT_DEVICE_SIZE           18
 CONSTANT: LIBUSB_DT_CONFIG_SIZE           9
@@ -52,56 +52,57 @@ CONSTANT: LIBUSB_DT_HUB_NONVAR_SIZE       7
 CONSTANT: LIBUSB_ENDPOINT_ADDRESS_MASK    HEX: 0f
 CONSTANT: LIBUSB_ENDPOINT_DIR_MASK        HEX: 80
 
-CONSTANT: LIBUSB_ENDPOINT_IN  HEX: 80
-CONSTANT: LIBUSB_ENDPOINT_OUT HEX: 00
-TYPEDEF: int libusb_endpoint_direction
+ENUM: libusb_endpoint_direction
+    { LIBUSB_ENDPOINT_IN  HEX: 80 }
+    { LIBUSB_ENDPOINT_OUT HEX: 00 } ;
 
 CONSTANT: LIBUSB_TRANSFER_TYPE_MASK HEX: 03
 
-CONSTANT: LIBUSB_TRANSFER_TYPE_CONTROL     0
-CONSTANT: LIBUSB_TRANSFER_TYPE_ISOCHRONOUS 1
-CONSTANT: LIBUSB_TRANSFER_TYPE_BULK        2
-CONSTANT: LIBUSB_TRANSFER_TYPE_INTERRUPT   3
-TYPEDEF: int libusb_transfer_type
-
-CONSTANT: LIBUSB_REQUEST_GET_STATUS        HEX: 00
-CONSTANT: LIBUSB_REQUEST_CLEAR_FEATURE     HEX: 01
-CONSTANT: LIBUSB_REQUEST_SET_FEATURE       HEX: 03
-CONSTANT: LIBUSB_REQUEST_SET_ADDRESS       HEX: 05
-CONSTANT: LIBUSB_REQUEST_GET_DESCRIPTOR    HEX: 06
-CONSTANT: LIBUSB_REQUEST_SET_DESCRIPTOR    HEX: 07
-CONSTANT: LIBUSB_REQUEST_GET_CONFIGURATION HEX: 08
-CONSTANT: LIBUSB_REQUEST_SET_CONFIGURATION HEX: 09
-CONSTANT: LIBUSB_REQUEST_GET_INTERFACE     HEX: 0A
-CONSTANT: LIBUSB_REQUEST_SET_INTERFACE     HEX: 0B
-CONSTANT: LIBUSB_REQUEST_SYNCH_FRAME       HEX: 0C
-TYPEDEF: int libusb_standard_request
-
-CONSTANT: LIBUSB_REQUEST_TYPE_STANDARD HEX: 00
-CONSTANT: LIBUSB_REQUEST_TYPE_CLASS    HEX: 20
-CONSTANT: LIBUSB_REQUEST_TYPE_VENDOR   HEX: 40
-CONSTANT: LIBUSB_REQUEST_TYPE_RESERVED HEX: 60
-
-CONSTANT: LIBUSB_RECIPIENT_DEVICE    HEX: 00
-CONSTANT: LIBUSB_RECIPIENT_INTERFACE HEX: 01
-CONSTANT: LIBUSB_RECIPIENT_ENDPOINT  HEX: 02
-CONSTANT: LIBUSB_RECIPIENT_OTHER     HEX: 03
-TYPEDEF: int libusb_request_recipient
+ENUM: libusb_transfer_type
+    { LIBUSB_TRANSFER_TYPE_CONTROL     0 }
+    { LIBUSB_TRANSFER_TYPE_ISOCHRONOUS 1 }
+    { LIBUSB_TRANSFER_TYPE_BULK        2 }
+    { LIBUSB_TRANSFER_TYPE_INTERRUPT   3 } ;
+
+ENUM: libusb_standard_request
+    { LIBUSB_REQUEST_GET_STATUS        HEX: 00 }
+    { LIBUSB_REQUEST_CLEAR_FEATURE     HEX: 01 }
+    { LIBUSB_REQUEST_SET_FEATURE       HEX: 03 }
+    { LIBUSB_REQUEST_SET_ADDRESS       HEX: 05 }
+    { LIBUSB_REQUEST_GET_DESCRIPTOR    HEX: 06 }
+    { LIBUSB_REQUEST_SET_DESCRIPTOR    HEX: 07 }
+    { LIBUSB_REQUEST_GET_CONFIGURATION HEX: 08 }
+    { LIBUSB_REQUEST_SET_CONFIGURATION HEX: 09 }
+    { LIBUSB_REQUEST_GET_INTERFACE     HEX: 0A }
+    { LIBUSB_REQUEST_SET_INTERFACE     HEX: 0B }
+    { LIBUSB_REQUEST_SYNCH_FRAME       HEX: 0C } ;
+
+ENUM: libusb_request_type
+    { LIBUSB_REQUEST_TYPE_STANDARD HEX: 00 }
+    { LIBUSB_REQUEST_TYPE_CLASS    HEX: 20 }
+    { LIBUSB_REQUEST_TYPE_VENDOR   HEX: 40 }
+    { LIBUSB_REQUEST_TYPE_RESERVED HEX: 60 } ;
+
+ENUM: libusb_request_recipient
+    { LIBUSB_RECIPIENT_DEVICE    HEX: 00 }
+    { LIBUSB_RECIPIENT_INTERFACE HEX: 01 }
+    { LIBUSB_RECIPIENT_ENDPOINT  HEX: 02 }
+    { LIBUSB_RECIPIENT_OTHER     HEX: 03 } ;
 
 CONSTANT: LIBUSB_ISO_SYNC_TYPE_MASK HEX: 0C
 
-CONSTANT: LIBUSB_ISO_SYNC_TYPE_NONE     0
-CONSTANT: LIBUSB_ISO_SYNC_TYPE_ASYNC    1
-CONSTANT: LIBUSB_ISO_SYNC_TYPE_ADAPTIVE 2
-CONSTANT: LIBUSB_ISO_SYNC_TYPE_SYNC     3
-TYPEDEF: int libusb_iso_sync_type
+ENUM: libusb_iso_sync_type
+    { LIBUSB_ISO_SYNC_TYPE_NONE     0 }
+    { LIBUSB_ISO_SYNC_TYPE_ASYNC    1 }
+    { LIBUSB_ISO_SYNC_TYPE_ADAPTIVE 2 }
+    { LIBUSB_ISO_SYNC_TYPE_SYNC     3 } ;
 
 CONSTANT: LIBUSB_ISO_USAGE_TYPE_MASK HEX: 30
 
-CONSTANT: LIBUSB_ISO_USAGE_TYPE_DATA     0
-CONSTANT: LIBUSB_ISO_USAGE_TYPE_FEEDBACK 1
-CONSTANT: LIBUSB_ISO_USAGE_TYPE_IMPLICIT 2
-TYPEDEF: int libusb_iso_usage_type
+ENUM: libusb_iso_usage_type
+    { LIBUSB_ISO_USAGE_TYPE_DATA     0 }
+    { LIBUSB_ISO_USAGE_TYPE_FEEDBACK 1 }
+    { LIBUSB_ISO_USAGE_TYPE_IMPLICIT 2 } ;
 
 STRUCT: libusb_device_descriptor
     { bLength             uint8_t  }
@@ -175,23 +176,23 @@ C-TYPE: libusb_context
 C-TYPE: libusb_device
 C-TYPE: libusb_device_handle
 
-CONSTANT: LIBUSB_SUCCESS             0
-CONSTANT: LIBUSB_ERROR_IO            -1
-CONSTANT: LIBUSB_ERROR_INVALID_PARAM -2
-CONSTANT: LIBUSB_ERROR_ACCESS        -3
-CONSTANT: LIBUSB_ERROR_NO_DEVICE     -4
-CONSTANT: LIBUSB_ERROR_NOT_FOUND     -5
-CONSTANT: LIBUSB_ERROR_BUSY          -6
-CONSTANT: LIBUSB_ERROR_TIMEOUT       -7
-CONSTANT: LIBUSB_ERROR_OVERFLOW      -8
-CONSTANT: LIBUSB_ERROR_PIPE          -9
-CONSTANT: LIBUSB_ERROR_INTERRUPTED   -10
-CONSTANT: LIBUSB_ERROR_NO_MEM        -11
-CONSTANT: LIBUSB_ERROR_NOT_SUPPORTED -12
-CONSTANT: LIBUSB_ERROR_OTHER         -99
-TYPEDEF: int libusb_error
-
-C-ENUM:
+ENUM: libusb_error
+    { LIBUSB_SUCCESS             0 }
+    { LIBUSB_ERROR_IO            -1 }
+    { LIBUSB_ERROR_INVALID_PARAM -2 }
+    { LIBUSB_ERROR_ACCESS        -3 }
+    { LIBUSB_ERROR_NO_DEVICE     -4 }
+    { LIBUSB_ERROR_NOT_FOUND     -5 }
+    { LIBUSB_ERROR_BUSY          -6 }
+    { LIBUSB_ERROR_TIMEOUT       -7 }
+    { LIBUSB_ERROR_OVERFLOW      -8 }
+    { LIBUSB_ERROR_PIPE          -9 }
+    { LIBUSB_ERROR_INTERRUPTED   -10 }
+    { LIBUSB_ERROR_NO_MEM        -11 }
+    { LIBUSB_ERROR_NOT_SUPPORTED -12 }
+    { LIBUSB_ERROR_OTHER         -99 } ;
+
+ENUM: libusb_transfer_status
     LIBUSB_TRANSFER_COMPLETED
     LIBUSB_TRANSFER_ERROR
     LIBUSB_TRANSFER_TIMED_OUT
@@ -199,12 +200,11 @@ C-ENUM:
     LIBUSB_TRANSFER_STALL
     LIBUSB_TRANSFER_NO_DEVICE
     LIBUSB_TRANSFER_OVERFLOW ;
-TYPEDEF: int libusb_transfer_status
 
-CONSTANT: LIBUSB_TRANSFER_SHORT_NOT_OK  1
-CONSTANT: LIBUSB_TRANSFER_FREE_BUFFER   2
-CONSTANT: LIBUSB_TRANSFER_FREE_TRANSFER 4
-TYPEDEF: int libusb_transfer_flags
+ENUM: libusb_transfer_flags
+    { LIBUSB_TRANSFER_SHORT_NOT_OK  1 }
+    { LIBUSB_TRANSFER_FREE_BUFFER   2 }
+    { LIBUSB_TRANSFER_FREE_TRANSFER 4 } ;
 
 STRUCT: libusb_iso_packet_descriptor
     { length        uint                   }
index 0d1b22e2887828af31b44d469ded158273f537f7..4b20655ed42758689fa4e772a5fefe69b2391f49 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Matthew Willis.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.libraries alien.syntax system sequences combinators kernel ;
+USING: alien alien.libraries alien.syntax system sequences combinators kernel alien.c-types ;
 
 IN: llvm.core
 
@@ -12,7 +12,7 @@ IN: llvm.core
         { [ os macosx? ] [ "/usr/local/lib/lib" ".dylib" surround ] }
         { [ os windows? ] [ ".dll" append ] }
         { [ os unix? ] [ "lib" ".so" surround ] }
-    } cond "cdecl" add-library ;
+    } cond cdecl add-library ;
 
 "LLVMSystem" add-llvm-library
 "LLVMSupport" add-llvm-library
@@ -28,20 +28,20 @@ LIBRARY: LLVMCore
 TYPEDEF: uint unsigned
 TYPEDEF: unsigned enum
 
-CONSTANT: LLVMZExtAttribute         BIN: 1
-CONSTANT: LLVMSExtAttribute         BIN: 10
-CONSTANT: LLVMNoReturnAttribute     BIN: 100
-CONSTANT: LLVMInRegAttribute        BIN: 1000
-CONSTANT: LLVMStructRetAttribute    BIN: 10000
-CONSTANT: LLVMNoUnwindAttribute     BIN: 100000
-CONSTANT: LLVMNoAliasAttribute      BIN: 1000000
-CONSTANT: LLVMByValAttribute        BIN: 10000000
-CONSTANT: LLVMNestAttribute         BIN: 100000000
-CONSTANT: LLVMReadNoneAttribute     BIN: 1000000000
-CONSTANT: LLVMReadOnlyAttribute     BIN: 10000000000
-TYPEDEF: enum LLVMAttribute;
-
-C-ENUM:
+ENUM: LLVMAttribute
+    { LLVMZExtAttribute         BIN: 1 }
+    { LLVMSExtAttribute         BIN: 10 }
+    { LLVMNoReturnAttribute     BIN: 100 }
+    { LLVMInRegAttribute        BIN: 1000 }
+    { LLVMStructRetAttribute    BIN: 10000 }
+    { LLVMNoUnwindAttribute     BIN: 100000 }
+    { LLVMNoAliasAttribute      BIN: 1000000 }
+    { LLVMByValAttribute        BIN: 10000000 }
+    { LLVMNestAttribute         BIN: 100000000 }
+    { LLVMReadNoneAttribute     BIN: 1000000000 }
+    { LLVMReadOnlyAttribute     BIN: 10000000000 } ;
+
+ENUM: LLVMTypeKind
   LLVMVoidTypeKind
   LLVMFloatTypeKind
   LLVMDoubleTypeKind
@@ -57,9 +57,8 @@ C-ENUM:
   LLVMPointerTypeKind
   LLVMOpaqueTypeKind
   LLVMVectorTypeKind ;
-TYPEDEF: enum LLVMTypeKind
 
-C-ENUM:
+ENUM: LLVMLinkage
   LLVMExternalLinkage
   LLVMLinkOnceLinkage
   LLVMWeakLinkage
@@ -69,34 +68,32 @@ C-ENUM:
   LLVMDLLExportLinkage
   LLVMExternalWeakLinkage
   LLVMGhostLinkage ;
-TYPEDEF: enum LLVMLinkage
 
-C-ENUM:
+ENUM: LLVMVisibility
   LLVMDefaultVisibility
   LLVMHiddenVisibility
   LLVMProtectedVisibility ;
-TYPEDEF: enum LLVMVisibility
-
-CONSTANT: LLVMCCallConv             0
-CONSTANT: LLVMFastCallConv          8
-CONSTANT: LLVMColdCallConv          9
-CONSTANT: LLVMX86StdcallCallConv    64
-CONSTANT: LLVMX86FastcallCallConv   65
-TYPEDEF: enum LLVMCallConv
-
-CONSTANT: LLVMIntEQ                 32
-CONSTANT: LLVMIntNE                 33
-CONSTANT: LLVMIntUGT                34
-CONSTANT: LLVMIntUGE                35
-CONSTANT: LLVMIntULT                36
-CONSTANT: LLVMIntULE                37
-CONSTANT: LLVMIntSGT                38
-CONSTANT: LLVMIntSGE                39
-CONSTANT: LLVMIntSLT                40
-CONSTANT: LLVMIntSLE                41
-TYPEDEF: enum LLVMIntPredicate
-
-C-ENUM:
+
+ENUM: LLVMCallConv
+  { LLVMCCallConv             0 }
+  { LLVMFastCallConv          8 }
+  { LLVMColdCallConv          9 }
+  { LLVMX86StdcallCallConv    64 }
+  { LLVMX86FastcallCallConv   65 } ;
+
+ENUM: LLVMIntPredicate
+  { LLVMIntEQ                 32 }
+  { LLVMIntNE                 33 }
+  { LLVMIntUGT                34 }
+  { LLVMIntUGE                35 }
+  { LLVMIntULT                36 }
+  { LLVMIntULE                37 }
+  { LLVMIntSGT                38 }
+  { LLVMIntSGE                39 }
+  { LLVMIntSLT                40 }
+  { LLVMIntSLE                41 } ;
+
+ENUM: LLVMRealPredicate
   LLVMRealPredicateFalse
   LLVMRealOEQ
   LLVMRealOGT
@@ -113,7 +110,6 @@ C-ENUM:
   LLVMRealULE
   LLVMRealUNE
   LLVMRealPredicateTrue ;
-TYPEDEF: enum LLVMRealPredicate
 
 ! Opaque Types
 
@@ -137,11 +133,11 @@ TYPEDEF: void* LLVMMemoryBufferRef
 
 ! Functions
 
-FUNCTION: void LLVMDisposeMessage ( char* Message ) ;
+FUNCTION: void LLVMDisposeMessage ( c-string Message ) ;
 
-FUNCTION: LLVMModuleRef LLVMModuleCreateWithName ( char* ModuleID ) ;
+FUNCTION: LLVMModuleRef LLVMModuleCreateWithName ( c-string ModuleID ) ;
 
-FUNCTION: int LLVMAddTypeName ( LLVMModuleRef M, char* Name, LLVMTypeRef Ty ) ;
+FUNCTION: int LLVMAddTypeName ( LLVMModuleRef M, c-string Name, LLVMTypeRef Ty ) ;
 
 FUNCTION: void LLVMDisposeModule ( LLVMModuleRef M ) ;
 
@@ -230,7 +226,7 @@ FUNCTION: unsigned LLVMCountParams ( LLVMValueRef Fn ) ;
 FUNCTION: void LLVMGetParams ( LLVMValueRef Fn, LLVMValueRef* Params ) ;
 
 FUNCTION: LLVMValueRef
-LLVMAddFunction ( LLVMModuleRef M, char* Name, LLVMTypeRef FunctionTy ) ;
+LLVMAddFunction ( LLVMModuleRef M, c-string Name, LLVMTypeRef FunctionTy ) ;
 
 FUNCTION: LLVMValueRef LLVMGetFirstFunction ( LLVMModuleRef M ) ;
 
@@ -241,15 +237,15 @@ FUNCTION: unsigned LLVMGetFunctionCallConv ( LLVMValueRef Fn ) ;
 FUNCTION: void LLVMSetFunctionCallConv ( LLVMValueRef Fn, unsigned CC ) ;
 
 FUNCTION: LLVMBasicBlockRef
-LLVMAppendBasicBlock ( LLVMValueRef Fn, char* Name ) ;
+LLVMAppendBasicBlock ( LLVMValueRef Fn, c-string Name ) ;
 
 FUNCTION: LLVMValueRef LLVMGetBasicBlockParent ( LLVMBasicBlockRef BB ) ;
 
 ! Values
 
 FUNCTION: LLVMTypeRef LLVMTypeOf ( LLVMValueRef Val ) ;
-FUNCTION: char* LLVMGetValueName ( LLVMValueRef Val ) ;
-FUNCTION: void LLVMSetValueName ( LLVMValueRef Val, char* Name ) ;
+FUNCTION: c-string LLVMGetValueName ( LLVMValueRef Val ) ;
+FUNCTION: void LLVMSetValueName ( LLVMValueRef Val, c-string Name ) ;
 FUNCTION: void LLVMDumpValue ( LLVMValueRef Val ) ;
 
 ! Instruction Builders
@@ -284,7 +280,7 @@ FUNCTION: LLVMValueRef LLVMBuildSwitch
 ( LLVMBuilderRef Builder, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases ) ;
 FUNCTION: LLVMValueRef LLVMBuildInvoke
 ( LLVMBuilderRef Builder, LLVMValueRef Fn, LLVMValueRef* Args, unsigned NumArgs,
-  LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, char* Name ) ;
+  LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildUnwind
 ( LLVMBuilderRef Builder ) ;
 FUNCTION: LLVMValueRef LLVMBuildUnreachable
@@ -298,126 +294,126 @@ FUNCTION: void LLVMAddCase
 ! IB Arithmetic
 
 FUNCTION: LLVMValueRef LLVMBuildAdd
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildSub
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildMul
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildUDiv
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildSDiv
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildFDiv
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildURem
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildSRem
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildFRem
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildShl
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildLShr
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildAShr
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildAnd
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildOr
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildXor
-( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildNeg
-( LLVMBuilderRef Builder, LLVMValueRef V, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef V, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildNot
-( LLVMBuilderRef Builder, LLVMValueRef V, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef V, c-string Name ) ;
 
 ! IB Memory
 
 FUNCTION: LLVMValueRef LLVMBuildMalloc
-( LLVMBuilderRef Builder, LLVMTypeRef Ty, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMTypeRef Ty, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildArrayMalloc
-( LLVMBuilderRef Builder, LLVMTypeRef Ty, LLVMValueRef Val, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMTypeRef Ty, LLVMValueRef Val, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildAlloca
-( LLVMBuilderRef Builder, LLVMTypeRef Ty, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMTypeRef Ty, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildArrayAlloca
-( LLVMBuilderRef Builder, LLVMTypeRef Ty, LLVMValueRef Val, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMTypeRef Ty, LLVMValueRef Val, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildFree
 ( LLVMBuilderRef Builder, LLVMValueRef PointerVal ) ;
 FUNCTION: LLVMValueRef LLVMBuildLoad
-( LLVMBuilderRef Builder, LLVMValueRef PointerVal, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef PointerVal, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildStore
 ( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMValueRef Ptr ) ;
 FUNCTION: LLVMValueRef LLVMBuildGEP
 ( LLVMBuilderRef B, LLVMValueRef Pointer, LLVMValueRef* Indices,
-  unsigned NumIndices, char* Name ) ;
+  unsigned NumIndices, c-string Name ) ;
 
 ! IB Casts
 
 FUNCTION: LLVMValueRef LLVMBuildTrunc
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildZExt
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildSExt
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildFPToUI
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildFPToSI
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildUIToFP
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildSIToFP
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildFPTrunc
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildFPExt
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildPtrToInt
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildIntToPtr
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildBitCast
-( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
 
 ! IB Comparisons
 
 FUNCTION: LLVMValueRef LLVMBuildICmp
-( LLVMBuilderRef Builder, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildFCmp
-( LLVMBuilderRef Builder, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
 
 ! IB Misc Instructions
 
 FUNCTION: LLVMValueRef LLVMBuildPhi
-( LLVMBuilderRef Builder, LLVMTypeRef Ty, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMTypeRef Ty, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildCall
-( LLVMBuilderRef Builder, LLVMValueRef Fn, LLVMValueRef* Args, unsigned NumArgs, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef Fn, LLVMValueRef* Args, unsigned NumArgs, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildSelect
-( LLVMBuilderRef Builder, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildVAArg
-( LLVMBuilderRef Builder, LLVMValueRef List, LLVMTypeRef Ty, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef List, LLVMTypeRef Ty, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildExtractElement
-( LLVMBuilderRef Builder, LLVMValueRef VecVal, LLVMValueRef Index, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef VecVal, LLVMValueRef Index, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildInsertElement
-( LLVMBuilderRef Builder, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildShuffleVector
-( LLVMBuilderRef Builder, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildExtractValue
-( LLVMBuilderRef Builder, LLVMValueRef AggVal, unsigned Index, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef AggVal, unsigned Index, c-string Name ) ;
 FUNCTION: LLVMValueRef LLVMBuildInsertValue
-( LLVMBuilderRef Builder, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, char* Name ) ;
+( LLVMBuilderRef Builder, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, c-string Name ) ;
 
 ! Memory Buffers/Bit Reader
 
 FUNCTION: int LLVMCreateMemoryBufferWithContentsOfFile
-( char* Path, LLVMMemoryBufferRef* OutMemBuf, char** OutMessage ) ;
+( c-string Path, LLVMMemoryBufferRef* OutMemBuf, c-string* OutMessage ) ;
 
 FUNCTION: void LLVMDisposeMemoryBuffer ( LLVMMemoryBufferRef MemBuf ) ;
 
 LIBRARY: LLVMBitReader
 
 FUNCTION: int LLVMParseBitcode
-( LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutModule, char** OutMessage ) ;
+( LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutModule, c-string* OutMessage ) ;
  
 FUNCTION: int LLVMGetBitcodeModuleProvider
-( LLVMMemoryBufferRef MemBuf, LLVMModuleProviderRef* OutMP, char** OutMessage ) ;
+( LLVMMemoryBufferRef MemBuf, LLVMModuleProviderRef* OutMP, c-string* OutMessage ) ;
index 5d77766703db1089fff42575eddc9e6ad0296848..700f0dc9a51791cf38d9f83773492519cc0f09b2 100644 (file)
@@ -1 +1 @@
-untested
+not tested
index d259c740e6f6809819855eded2aed7c59050378e..bb39f86f73319d661ff5b0e27f50382dc74b999c 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Matthew Willis.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.libraries alien.syntax llvm.core ;
+USING: alien.c-types alien.libraries alien.syntax llvm.core ;
 IN: llvm.engine
 
 <<
@@ -34,10 +34,10 @@ FUNCTION: ulonglong LLVMGenericValueToInt
 ( LLVMGenericValueRef GenVal, int IsSigned ) ;
 
 FUNCTION: int LLVMCreateExecutionEngine
-( LLVMExecutionEngineRef *OutEE, LLVMModuleProviderRef MP, char** OutError ) ;
+( LLVMExecutionEngineRef *OutEE, LLVMModuleProviderRef MP, c-string* OutError ) ;
 
 FUNCTION: int LLVMCreateJITCompiler
-( LLVMExecutionEngineRef* OutJIT, LLVMModuleProviderRef MP, unsigned OptLevel, char** OutError ) ;
+( LLVMExecutionEngineRef* OutJIT, LLVMModuleProviderRef MP, unsigned OptLevel, c-string* OutError ) ;
 
 FUNCTION: void LLVMDisposeExecutionEngine ( LLVMExecutionEngineRef EE ) ;
 
@@ -46,10 +46,10 @@ FUNCTION: void LLVMFreeMachineCodeForFunction ( LLVMExecutionEngineRef EE, LLVMV
 FUNCTION: void LLVMAddModuleProvider ( LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP ) ;
 
 FUNCTION: int LLVMRemoveModuleProvider
-( LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP, LLVMModuleRef* OutMod, char** OutError ) ;
+( LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP, LLVMModuleRef* OutMod, c-string* OutError ) ;
 
 FUNCTION: int LLVMFindFunction
-( LLVMExecutionEngineRef EE, char* Name, LLVMValueRef* OutFn ) ;
+( LLVMExecutionEngineRef EE, c-string Name, LLVMValueRef* OutFn ) ;
 
 FUNCTION: void* LLVMGetPointerToGlobal ( LLVMExecutionEngineRef EE, LLVMValueRef Global ) ;
 
index 5d77766703db1089fff42575eddc9e6ad0296848..700f0dc9a51791cf38d9f83773492519cc0f09b2 100644 (file)
@@ -1 +1 @@
-untested
+not tested
index 87f39944d934b1fbc050d3ed600cfe1f77961478..9d6bfc8a5a525e71d67817a28df9e68be4156c54 100644 (file)
@@ -32,7 +32,7 @@ TUPLE: function name alien return params ;
     LLVMGetFirstFunction [ (functions) ] { } make [ <function> ] map ;
 
 : function-effect ( function -- effect )
-    [ params>> [ first ] map ] [ return>> void? 0 1 ? ] bi <effect> ;
+    [ params>> keys ] [ return>> void? 0 1 ? ] bi <effect> ;
 
 : install-function ( function -- )
     dup name>> "alien.llvm" create-vocab drop
@@ -41,11 +41,11 @@ TUPLE: function name alien return params ;
         dup name>> function-pointer ,
         dup return>> c-type ,
         dup params>> [ second c-type ] map ,
-        "cdecl" , \ alien-indirect ,
+        cdecl , \ alien-indirect ,
     ] [ ] make swap function-effect [ define-declared ] with-compilation-unit ;
 
 : install-module ( name -- )
-    thejit get mps>> at [
+    current-jit mps>> at [
         module>> functions [ install-function ] each
     ] [ "no such module" throw ] if* ;
 
@@ -53,4 +53,4 @@ TUPLE: function name alien return params ;
     [ normalize-path ] [ file-name ] bi
     [ load-into-jit ] keep install-module ;
     
-<< "alien.llvm" create-vocab drop >>
\ No newline at end of file
+<< "alien.llvm" create-vocab drop >>
index 5d77766703db1089fff42575eddc9e6ad0296848..700f0dc9a51791cf38d9f83773492519cc0f09b2 100644 (file)
@@ -1 +1 @@
-untested
+not tested
index f58851fe6f9c9be44f330996e4b47f515e84d3b1..fc755fd00fa6c93e48909ffc3054b73aae036096 100644 (file)
@@ -5,8 +5,6 @@ kernel llvm.core llvm.engine llvm.wrappers namespaces ;
 
 IN: llvm.jit
 
-SYMBOL: thejit
-
 TUPLE: jit ee mps ;
 
 : empty-engine ( -- engine )
@@ -15,8 +13,11 @@ TUPLE: jit ee mps ;
 : <jit> ( -- jit )
     jit new empty-engine >>ee H{ } clone >>mps ;
 
+: current-jit ( -- jit )
+    \ current-jit global [ drop <jit> ] cache ;
+
 : (remove-functions) ( function -- )
-    thejit get ee>> value>> over LLVMFreeMachineCodeForFunction
+    current-jit ee>> value>> over LLVMFreeMachineCodeForFunction
     LLVMGetNextFunction dup ALIEN: 0 = [ drop ] [ (remove-functions) ] if ;
 
 : remove-functions ( module -- )
@@ -24,26 +25,24 @@ TUPLE: jit ee mps ;
     LLVMGetFirstFunction dup ALIEN: 0 = [ drop ] [ (remove-functions) ] if ;
 
 : remove-provider ( provider -- )
-    thejit get ee>> value>> swap value>> f <void*> f <void*>
+    current-jit ee>> value>> swap value>> f <void*> f <void*>
     [ LLVMRemoveModuleProvider drop ] 2keep *void* [ llvm-throw ] when*
     *void* module new swap >>value
     [ value>> remove-functions ] with-disposal ;
 
 : remove-module ( name -- )
-    dup thejit get mps>> at [
+    dup current-jit mps>> at [
         remove-provider
-        thejit get mps>> delete-at
+        current-jit mps>> delete-at
     ] [ drop ] if* ;
 
 : add-module ( module name -- )
     [ <provider> ] dip [ remove-module ] keep
-    thejit get ee>> value>> pick
+    current-jit ee>> value>> pick
     [ [ value>> LLVMAddModuleProvider ] [ t >>disposed drop ] bi ] with-disposal
-    thejit get mps>> set-at ;
+    current-jit mps>> set-at ;
 
 : function-pointer ( name -- alien )
-    thejit get ee>> value>> dup
+    current-jit ee>> value>> dup
     rot f <void*> [ LLVMFindFunction drop ] keep
-    *void* LLVMGetPointerToGlobal ;
-
-thejit [ <jit> ] initialize
\ No newline at end of file
+    *void* LLVMGetPointerToGlobal ;
\ No newline at end of file
index 5d77766703db1089fff42575eddc9e6ad0296848..700f0dc9a51791cf38d9f83773492519cc0f09b2 100644 (file)
@@ -1 +1 @@
-untested
+not tested
index 5d77766703db1089fff42575eddc9e6ad0296848..700f0dc9a51791cf38d9f83773492519cc0f09b2 100644 (file)
@@ -1 +1 @@
-untested
+not tested
index a9d28becd86098064474f68b9180f05ecfb31c31..ba3ee02ae40c27447f1b60c21ebb84564cb6882d 100644 (file)
@@ -1,2 +1,2 @@
 bindings
-untested
+not tested
index 5d77766703db1089fff42575eddc9e6ad0296848..700f0dc9a51791cf38d9f83773492519cc0f09b2 100644 (file)
@@ -1 +1 @@
-untested
+not tested
index ddb54ecb2799e8b13d110494c268b4627902e585..c312e7a173669972b7c32e63bc7369fa8e257fec 100644 (file)
@@ -99,7 +99,7 @@ TUPLE: pointer < enclosing type ;
 M: pointer (>tref)* type>> (>tref) 0 LLVMPointerType ;
 M: pointer clean* type>> clean ;
 M: pointer (tref>)* swap LLVMGetElementType (tref>) >>type ;
-M: pointer c-type type>> 8 <integer> = "char*" "void*" ? ;
+M: pointer c-type type>> 8 <integer> = "c-string" "void*" ? ;
 
 TUPLE: vector < enclosing size type ;
 : <vector> ( s t -- o )
@@ -229,7 +229,7 @@ NoFunctionParams = "(" WhiteSpace ")" => [[ drop { } ]]
 VarArgs = WhiteSpace "..." WhiteSpace => [[ drop ... ]]
 ParamListContinued = "," (Type | VarArgs):t => [[ t ]]
 ParamList = "(" Type:t (ParamListContinued*):ts ")" => [[ ts t prefix ]]
-Function = T:t WhiteSpace ( ParamList | NoFunctionParams ):ts => [[ ... ts member? dup [ ... ts delete ] when t ts >array rot <function> ]]
+Function = T:t WhiteSpace ( ParamList | NoFunctionParams ):ts => [[ ... ts member? dup [ ... ts remove! drop ] when t ts >array rot <function> ]]
 PackedStructure = "<" WhiteSpace "{" Type:ty (StructureTypesList)*:ts "}" WhiteSpace ">" => [[ ts ty prefix >array t <struct> ]]
 UpReference = "\\" Number:n => [[ n <up-ref> ]]
 Name = '%' ([a-zA-Z][a-zA-Z0-9]*):id => [[ id flatten >string ]]
index 5d77766703db1089fff42575eddc9e6ad0296848..700f0dc9a51791cf38d9f83773492519cc0f09b2 100644 (file)
@@ -1 +1 @@
-untested
+not tested
index a1d757e7e9b4ada87b698d731da4624d2e6e4854..05aafce973ead3f82c61e3c38b532f4773817bce 100644 (file)
@@ -6,7 +6,7 @@ llvm.core llvm.engine ;
 
 IN: llvm.wrappers
 
-: llvm-throw ( char* -- )
+: llvm-throw ( c-string -- )
     [ utf8 alien>string ] [ LLVMDisposeMessage ] bi throw ;
 
 : <dispose> ( alien class -- disposable ) new swap >>value ;
diff --git a/extra/lua/authors.txt b/extra/lua/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/lua/lua.factor b/extra/lua/lua.factor
new file mode 100644 (file)
index 0000000..fa997b1
--- /dev/null
@@ -0,0 +1,313 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien alien.accessors alien.c-types alien.libraries
+alien.syntax classes.struct combinators io.encodings.ascii kernel
+locals math system ;
+IN: lua
+
+<< "liblua5.1" {
+        { [ os windows? ] [ "lua5.1.dll" ] }
+        { [ os macosx? ] [ "liblua5.1.dylib"  ] }
+        { [ os unix? ] [ "liblua5.1.so" ] }
+    } cond cdecl add-library >>
+LIBRARY: liblua5.1
+    
+! luaconf.h
+TYPEDEF: double LUA_NUMBER
+TYPEDEF: ptrdiff_t LUA_INTEGER
+
+CONSTANT: LUA_IDSIZE 60
+
+! This is normally the BUFSIZ value of the given platform.
+: LUAL_BUFFERSIZE ( -- x )
+    {
+        { [ os windows? ] [ 512 ] }
+        { [ os macosx? ] [ 1024 ] }
+        { [ os unix? ] [ 8192 ] }
+    } cond ;
+
+! lua.h
+CONSTANT: LUA_SIGNATURE B{ 27 76 117 97 }
+CONSTANT: LUA_MULTRET -1
+
+CONSTANT: LUA_REGISTRYINDEX -10000
+CONSTANT: LUA_ENVIRONINDEX  -10001
+CONSTANT: LUA_GLOBALSINDEX  -10002
+
+: lua_upvalueindex ( i -- i ) [ LUA_GLOBALSINDEX ] dip - ; inline
+
+CONSTANT: LUA_YIELD     1
+CONSTANT: LUA_ERRRUN    2
+CONSTANT: LUA_ERRSYNTAX 3
+CONSTANT: LUA_ERRMEM    4
+CONSTANT: LUA_ERRERR    5
+
+C-TYPE: lua_State
+
+CALLBACK: int lua_CFunction ( lua_State* L ) ;
+CALLBACK: char* lua_Reader ( lua_State* L, void* ud, size_t* sz ) ;
+CALLBACK: int lua_Writer ( lua_State* L, void* p, size_t sz, void* ud ) ;
+CALLBACK: void* lua_Alloc ( void* ud, void* ptr, size_t osize, size_t nsize ) ;
+
+CONSTANT: LUA_TNONE           -1
+CONSTANT: LUA_TNIL            0
+CONSTANT: LUA_TBOOLEAN        1
+CONSTANT: LUA_TLIGHTUSERDATA  2
+CONSTANT: LUA_TNUMBER         3
+CONSTANT: LUA_TSTRING         4
+CONSTANT: LUA_TTABLE          5
+CONSTANT: LUA_TFUNCTION       6
+CONSTANT: LUA_TUSERDATA       7
+CONSTANT: LUA_TTHREAD         8
+
+CONSTANT: LUA_MINSTACK 20
+
+TYPEDEF: LUA_NUMBER lua_Number
+TYPEDEF: LUA_INTEGER lua_Integer
+
+FUNCTION: lua_State* lua_newstate ( lua_Alloc f, void* ud ) ;
+FUNCTION: void lua_close ( lua_State* L ) ;
+FUNCTION: lua_State* lua_newthread ( lua_State* L ) ;
+
+FUNCTION: lua_CFunction lua_atpanic ( lua_State* L, lua_CFunction panicf ) ;
+
+FUNCTION: int lua_gettop ( lua_State* L ) ;
+FUNCTION: void lua_settop ( lua_State* L, int idx ) ;
+FUNCTION: void lua_pushvalue ( lua_State* L, int idx ) ;
+FUNCTION: void lua_remove ( lua_State* L, int idx ) ;
+FUNCTION: void lua_insert ( lua_State* L, int idx ) ;
+FUNCTION: void lua_replace ( lua_State* L, int idx ) ;
+FUNCTION: int lua_checkstack ( lua_State* L, int sz ) ;
+
+FUNCTION: void lua_xmove ( lua_State* from, lua_State* to, int n ) ;
+
+FUNCTION: int lua_isnumber ( lua_State* L, int idx ) ;
+FUNCTION: int lua_isstring ( lua_State* L, int idx ) ;
+FUNCTION: int lua_iscfunction ( lua_State* L, int idx ) ;
+FUNCTION: int lua_isuserdata ( lua_State* L, int idx ) ;
+FUNCTION: int lua_type ( lua_State* L, int idx ) ;
+FUNCTION: c-string[ascii] lua_typename ( lua_State* L, int tp ) ;
+
+FUNCTION: int lua_equal ( lua_State* L, int idx1, int idx2 ) ;
+FUNCTION: int lua_rawequal ( lua_State* L, int idx1, int idx2 ) ;
+FUNCTION: int lua_lessthan ( lua_State* L, int idx1, int idx2 ) ;
+
+FUNCTION: lua_Number lua_tonumber ( lua_State* L, int idx ) ;
+FUNCTION: lua_Integer lua_tointeger ( lua_State* L, int idx ) ;
+FUNCTION: int lua_toboolean ( lua_State* L, int idx ) ;
+FUNCTION: c-string[ascii] lua_tolstring ( lua_State* L, int idx, size_t* len ) ;
+FUNCTION: size_t lua_objlen ( lua_State* L, int idx ) ;
+FUNCTION: lua_CFunction lua_tocfunction ( lua_State* L, int idx ) ;
+FUNCTION: void* lua_touserdata ( lua_State* L, int idx ) ;
+FUNCTION: lua_State* lua_tothread ( lua_State* L, int idx ) ;
+FUNCTION: void* lua_topointer ( lua_State* L, int idx ) ;
+
+FUNCTION: void lua_pushnil ( lua_State* L ) ;
+FUNCTION: void lua_pushnumber ( lua_State* L, lua_Number n ) ;
+FUNCTION: void lua_pushinteger ( lua_State* L, lua_Integer n ) ;
+FUNCTION: void lua_pushlstring ( lua_State* L, char* s, size_t l ) ;
+FUNCTION: void lua_pushstring ( lua_State* L, c-string[ascii] ) ;
+! FUNCTION: c-string[ascii] lua_pushvfstring ( lua_State* L, c-string[ascii] fmt, va_list argp ) ;
+! FUNCTION: c-string[ascii] lua_pushfstring ( lua_State* L, c-string[ascii] fmt, ... ) ;
+FUNCTION: void lua_pushcclosure ( lua_State* L, lua_CFunction fn, int n ) ;
+FUNCTION: void lua_pushboolean ( lua_State* L, int b ) ;
+FUNCTION: void lua_pushlightuserdata ( lua_State* L, void* p ) ;
+FUNCTION: int lua_pushthread ( lua_State* L ) ;
+
+FUNCTION: void lua_gettable ( lua_State* L, int idx ) ;
+FUNCTION: void lua_getfield ( lua_State* L, int idx, c-string[ascii] k ) ;
+FUNCTION: void lua_rawget ( lua_State* L, int idx ) ;
+FUNCTION: void lua_rawgeti ( lua_State* L, int idx, int n ) ;
+FUNCTION: void lua_createtable ( lua_State* L, int narr, int nrec ) ;
+FUNCTION: void* lua_newuserdata ( lua_State* L, size_t sz ) ;
+FUNCTION: int lua_getmetatable ( lua_State* L, int objindex ) ;
+FUNCTION: void lua_getfenv ( lua_State* L, int idx ) ;
+
+FUNCTION: void lua_settable ( lua_State* L, int idx ) ;
+FUNCTION: void lua_setfield ( lua_State* L, int idx, c-string[ascii] k ) ;
+FUNCTION: void lua_rawset ( lua_State* L, int idx ) ;
+FUNCTION: void lua_rawseti ( lua_State* L, int idx, int n ) ;
+FUNCTION: int lua_setmetatable ( lua_State* L, int objindex ) ;
+FUNCTION: int lua_setfenv ( lua_State* L, int idx ) ;
+
+FUNCTION: void lua_call ( lua_State* L, int nargs, int nresults ) ;
+FUNCTION: int lua_pcall ( lua_State* L, int nargs, int nresults, int errfunc ) ;
+FUNCTION: int lua_cpcall ( lua_State* L, lua_CFunction func, void* ud ) ;
+FUNCTION: int lua_load ( lua_State* L, lua_Reader reader, void* dt, c-string[ascii] chunkname ) ;
+
+FUNCTION: int lua_dump ( lua_State* L, lua_Writer writer, void* data ) ;
+
+FUNCTION: int lua_yield ( lua_State* L, int nresults ) ;
+FUNCTION: int lua_resume ( lua_State* L, int narg ) ;
+FUNCTION: int lua_status ( lua_State* L ) ;
+
+CONSTANT: LUA_GCSTOP          0
+CONSTANT: LUA_GCRESTART       1
+CONSTANT: LUA_GCCOLLECT       2
+CONSTANT: LUA_GCCOUNT         3
+CONSTANT: LUA_GCCOUNTB        4
+CONSTANT: LUA_GCSTEP          5
+CONSTANT: LUA_GCSETPAUSE      6
+CONSTANT: LUA_GCSETSTEPMUL    7
+
+FUNCTION: int lua_gc ( lua_State* L, int what, int data ) ;
+
+FUNCTION: int lua_error ( lua_State* L ) ;
+FUNCTION: int lua_next ( lua_State* L, int idx ) ;
+FUNCTION: void lua_concat ( lua_State* L, int n ) ;
+FUNCTION: lua_Alloc lua_getallocf ( lua_State* L, void* *ud ) ;
+FUNCTION: void lua_setallocf ( lua_State* L, lua_Alloc f, void* ud ) ;
+
+TYPEDEF: lua_Reader lua_Chunkreader
+TYPEDEF: lua_Writer lua_Chunkwriter
+
+FUNCTION: void lua_setlevel ( lua_State* from, lua_State* to ) ;
+
+CONSTANT: LUA_HOOKCALL    0
+CONSTANT: LUA_HOOKRET     1
+CONSTANT: LUA_HOOKLINE    2
+CONSTANT: LUA_HOOKCOUNT   3
+CONSTANT: LUA_HOOKTAILRET 4
+
+: LUA_MASKCALL ( n -- n ) LUA_HOOKCALL shift ; inline
+: LUA_MASKRET ( n -- n ) LUA_HOOKRET shift ; inline
+: LUA_MASKLINE ( n -- n ) LUA_HOOKLINE shift ; inline
+: LUA_MASKCOUNT ( n -- n ) LUA_HOOKCOUNT shift ; inline
+
+C-TYPE: lua_Debug
+CALLBACK: void lua_Hook ( lua_State* L, lua_Debug* ar ) ;
+
+FUNCTION: int lua_getstack ( lua_State* L, int level, lua_Debug* ar ) ;
+FUNCTION: int lua_getinfo ( lua_State* L, c-string[ascii] what, lua_Debug* ar ) ;
+FUNCTION: c-string[ascii] lua_getlocal ( lua_State* L, lua_Debug* ar, int n ) ;
+FUNCTION: c-string[ascii] lua_setlocal ( lua_State* L, lua_Debug* ar, int n ) ;
+FUNCTION: c-string[ascii] lua_getupvalue ( lua_State* L, int funcindex, int n ) ;
+FUNCTION: c-string[ascii] lua_setupvalue ( lua_State* L, int funcindex, int n ) ;
+
+FUNCTION: int lua_sethook ( lua_State* L, lua_Hook func, int mask, int count ) ;
+FUNCTION: lua_Hook lua_gethook ( lua_State* L ) ;
+FUNCTION: int lua_gethookmask ( lua_State* L ) ;
+FUNCTION: int lua_gethookcount ( lua_State* L ) ;
+
+STRUCT: lua_Debug
+    { event           int              }
+    { name            char*            }
+    { namewhat        char*            }
+    { what            char*            }
+    { source          char*            }
+    { currentline     int              }
+    { nups            int              }
+    { linedefined     int              }
+    { lastlinedefined int              }
+    { short_src       char[LUA_IDSIZE] }
+    { i_ci            int              } ;
+
+! lauxlib.h
+
+: luaL_getn ( L i -- int ) lua_objlen ; inline
+: luaL_setn ( L i j -- ) 3drop ; inline
+: LUA_ERRFILE ( -- x ) LUA_ERRERR 1 + ;
+
+STRUCT: luaL_Reg
+    { name char*         }
+    { func lua_CFunction } ;
+
+FUNCTION: void luaI_openlib ( lua_State* L, c-string[ascii] libname, luaL_Reg* l, int nup ) ;
+FUNCTION: void luaL_register ( lua_State* L, c-string[ascii] libname, luaL_Reg* l ) ;
+FUNCTION: int luaL_getmetafield ( lua_State* L, int obj, c-string[ascii] e ) ;
+FUNCTION: int luaL_callmeta ( lua_State* L, int obj, c-string[ascii] e ) ;
+FUNCTION: int luaL_typerror ( lua_State* L, int narg, c-string[ascii] tname ) ;
+FUNCTION: int luaL_argerror ( lua_State* L, int numarg, c-string[ascii] extramsg ) ;
+FUNCTION: c-string[ascii] luaL_checklstring ( lua_State* L, int numArg, size_t* l ) ;
+FUNCTION: c-string[ascii] luaL_optlstring ( lua_State* L, int numArg, c-string[ascii] def, size_t* l ) ;
+FUNCTION: lua_Number luaL_checknumber ( lua_State* L, int numArg ) ;
+FUNCTION: lua_Number luaL_optnumber ( lua_State* L, int nArg, lua_Number def ) ;
+
+FUNCTION: lua_Integer luaL_checkinteger ( lua_State* L, int numArg ) ;
+FUNCTION: lua_Integer luaL_optinteger ( lua_State* L, int nArg, lua_Integer def ) ;
+
+FUNCTION: void luaL_checkstack ( lua_State* L, int sz, c-string[ascii] msg ) ;
+FUNCTION: void luaL_checktype ( lua_State* L, int narg, int t ) ;
+FUNCTION: void luaL_checkany ( lua_State* L, int narg ) ;
+
+FUNCTION: int luaL_newmetatable ( lua_State* L, c-string[ascii] tname ) ;
+FUNCTION: void* luaL_checkudata ( lua_State* L, int ud, c-string[ascii] tname ) ;
+
+FUNCTION: void luaL_where ( lua_State* L, int lvl ) ;
+! FUNCTION: int luaL_error ( lua_State* L, c-string[ascii] fmt,  ... ) ;
+FUNCTION: int luaL_checkoption ( lua_State* L, int narg, c-string[ascii] def, c-string[ascii] lst ) ;
+
+FUNCTION: int luaL_ref ( lua_State* L, int t ) ;
+FUNCTION: void luaL_unref ( lua_State* L, int t, int ref ) ;
+
+FUNCTION: int luaL_loadfile ( lua_State* L, c-string[ascii] filename ) ;
+FUNCTION: int luaL_loadbuffer ( lua_State* L, c-string[ascii] buff, size_t sz, c-string[ascii] name ) ;
+FUNCTION: int luaL_loadstring ( lua_State* L, c-string[ascii] s ) ;
+
+FUNCTION: lua_State* luaL_newstate ( ) ;
+FUNCTION: c-string[ascii] luaL_gsub ( lua_State* L, c-string[ascii] s, c-string[ascii] p, c-string[ascii] r ) ;
+FUNCTION: c-string[ascii] luaL_findtable ( lua_State* L, int idx, c-string[ascii] fname, int szhint ) ;
+
+: lua_pop ( L n -- ) neg 1 - lua_settop ; inline
+: lua_newtable ( L -- ) 0 0 lua_createtable ; inline
+: lua_pushcfunction ( L f -- ) 0 lua_pushcclosure ; inline
+: lua_setglobal ( L s -- ) [ LUA_GLOBALSINDEX ] dip lua_setfield ; inline
+: lua_register ( L n f -- ) pick swap lua_pushcfunction lua_setglobal ; inline
+: lua_strlen ( L i -- size_t ) lua_objlen ; inline
+: lua_isfunction ( L n -- ? ) lua_type LUA_TFUNCTION = ; inline
+: lua_istable ( L n -- ? ) lua_type LUA_TTABLE = ; inline
+: lua_islightuserdata ( L n -- ? ) lua_type LUA_TLIGHTUSERDATA = ; inline
+: lua_isnil ( L n -- ? ) lua_type LUA_TNIL = ; inline
+: lua_isboolean ( L n -- ? ) lua_type LUA_TBOOLEAN = ; inline
+: lua_isthread ( L n -- ? ) lua_type LUA_TTHREAD = ; inline
+: lua_isnone ( L n -- ? ) lua_type LUA_TNONE = ; inline
+: lua_isnoneornil ( L n -- ? ) lua_type 0 <= ; inline
+: lua_getglobal ( L s -- ) [ LUA_GLOBALSINDEX ] dip lua_getfield ; inline
+: lua_tostring ( L i -- string ) f lua_tolstring ; inline
+: lua_open ( -- lua_State* ) luaL_newstate ; inline
+: lua_getregistry ( L -- ) LUA_REGISTRYINDEX lua_pushvalue ; inline
+: lua_getgccount ( L -- int ) LUA_GCCOUNT 0 lua_gc ; inline
+
+: luaL_argcheck ( L cond numarg extramsg -- int ) rot 0 = [ luaL_argerror ] [ 3drop 1 ] if ; inline
+: luaL_checkstring ( L n -- string ) f luaL_checklstring ; inline
+: luaL_optstring ( L n d -- string ) f luaL_optlstring ; inline
+: luaL_checkint ( L n -- int ) luaL_checkinteger ; inline
+: luaL_optint ( L  n d -- int ) luaL_optinteger ; inline
+: luaL_checklong ( L n -- long ) luaL_checkinteger ; inline
+: luaL_optlong ( L n d -- long ) luaL_optinteger ; inline
+
+: luaL_typename ( L i -- string ) dupd lua_type lua_typename ; inline
+: luaL_dofile ( L fn -- int )
+    dupd luaL_loadfile 0 = [
+        0 LUA_MULTRET 0 lua_pcall
+    ] [ drop 1 ] if ; inline
+: luaL_dostring ( L s -- int )
+    dupd luaL_loadstring 0 = [
+        0 LUA_MULTRET 0 lua_pcall
+    ] [ drop 1 ] if ; inline
+
+: luaL_getmetatable ( L n -- ) [ LUA_REGISTRYINDEX ] dip lua_getfield ; inline
+
+STRUCT: luaL_Buffer
+    { p      char*                 }
+    { lvl    int                   }
+    { L      lua_State*            }
+    { buffer char[LUAL_BUFFERSIZE] } ;
+
+FUNCTION: void luaL_buffinit ( lua_State* L, luaL_Buffer* B ) ;
+FUNCTION: char* luaL_prepbuffer ( luaL_Buffer* B ) ;
+FUNCTION: void luaL_addlstring ( luaL_Buffer* B, char* s, size_t l ) ;
+FUNCTION: void luaL_addstring ( luaL_Buffer* B, char* s ) ;
+FUNCTION: void luaL_addvalue ( luaL_Buffer* B ) ;
+FUNCTION: void luaL_pushresult ( luaL_Buffer* B ) ;
+
+:: luaL_addchar ( B c -- )
+    B p>> alien-address
+    LUAL_BUFFERSIZE B buffer>> <displaced-alien> alien-address
+    >= [ B luaL_prepbuffer drop ] when
+    c B p>> 0 set-alien-signed-1
+    B [ 1 swap <displaced-alien> ] change-p drop ; inline
+
+: luaL_putchar ( B c -- ) luaL_addchar ; inline
+: luaL_addsize ( B n -- ) [ swap <displaced-alien> ] curry change-p drop ; inline
diff --git a/extra/lua/summary.txt b/extra/lua/summary.txt
new file mode 100644 (file)
index 0000000..e4b960e
--- /dev/null
@@ -0,0 +1 @@
+FFI bindings to the Lua programming language.
diff --git a/extra/macho/a.macho b/extra/macho/a.macho
new file mode 100755 (executable)
index 0000000..bc233d7
Binary files /dev/null and b/extra/macho/a.macho differ
diff --git a/extra/macho/a2.macho b/extra/macho/a2.macho
new file mode 100755 (executable)
index 0000000..ed9a3a9
Binary files /dev/null and b/extra/macho/a2.macho differ
diff --git a/extra/macho/authors.txt b/extra/macho/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/macho/macho-tests.factor b/extra/macho/macho-tests.factor
new file mode 100644 (file)
index 0000000..561a98c
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien io io.streams.string kernel literals macho
+multiline sequences strings system tools.test ;
+IN: macho.tests
+
+STRING: validation-output
+0000000100000f1c __stub_helper    stub helpers
+0000000100001040 __program_vars  _pvars
+0000000100001068 __data          _NXArgc
+0000000100001070 __data          _NXArgv
+0000000100001080 __data          ___progname
+0000000100000000                 __mh_execute_header
+0000000100001078 __data          _environ
+0000000100000ef8 __text          _main
+0000000100000ebc __text          start
+0000000000000000                 ___gxx_personality_v0
+0000000000000000                 _exit
+0000000000000000                 _printf
+0000000000000000                 dyld_stub_binder
+
+;
+
+cpu ppc? [
+    { $ validation-output }
+    [ <string-writer> dup [ "resource:extra/macho/a.macho" macho-nm ] with-output-stream >string ]
+    unit-test
+    
+    { t } [
+        "resource:extra/macho/a2.macho" [
+            >c-ptr fat-binary-members first data>> >c-ptr macho-header 64-bit?
+        ] with-mapped-macho
+    ] unit-test
+] unless
diff --git a/extra/macho/macho.factor b/extra/macho/macho.factor
new file mode 100644 (file)
index 0000000..3c0536d
--- /dev/null
@@ -0,0 +1,972 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http:// factorcode.org/license.txt for BSD license.
+USING: accessors alien alien.c-types alien.strings alien.syntax
+classes classes.struct combinators combinators.short-circuit
+io.encodings.ascii io.encodings.string kernel literals make
+math sequences specialized-arrays typed fry io.mmap formatting
+locals splitting io.binary arrays ;
+FROM: alien.c-types => short ;
+IN: macho
+
+! FFI data
+TYPEDEF: int       integer_t
+TYPEDEF: int       vm_prot_t
+TYPEDEF: integer_t cpu_type_t
+TYPEDEF: integer_t cpu_subtype_t
+TYPEDEF: integer_t cpu_threadtype_t
+
+CONSTANT: VM_PROT_NONE        HEX: 00
+CONSTANT: VM_PROT_READ        HEX: 01
+CONSTANT: VM_PROT_WRITE       HEX: 02
+CONSTANT: VM_PROT_EXECUTE     HEX: 04
+CONSTANT: VM_PROT_DEFAULT     HEX: 03
+CONSTANT: VM_PROT_ALL         HEX: 07
+CONSTANT: VM_PROT_NO_CHANGE   HEX: 08
+CONSTANT: VM_PROT_COPY        HEX: 10
+CONSTANT: VM_PROT_WANTS_COPY  HEX: 10
+
+! loader.h
+STRUCT: mach_header
+    { magic         uint          }
+    { cputype       cpu_type_t    }
+    { cpusubtype    cpu_subtype_t }
+    { filetype      uint          }
+    { ncmds         uint          }
+    { sizeofcmds    uint          }
+    { flags         uint          } ;
+
+CONSTANT: MH_MAGIC    HEX: feedface
+CONSTANT: MH_CIGAM    HEX: cefaedfe
+
+STRUCT: mach_header_64
+    { magic         uint          }
+    { cputype       cpu_type_t    }
+    { cpusubtype    cpu_subtype_t }
+    { filetype      uint          }
+    { ncmds         uint          }
+    { sizeofcmds    uint          }
+    { flags         uint          }
+    { reserved      uint          } ;
+
+CONSTANT: MH_MAGIC_64 HEX: feedfacf
+CONSTANT: MH_CIGAM_64 HEX: cffaedfe
+
+CONSTANT: MH_OBJECT       HEX: 1
+CONSTANT: MH_EXECUTE      HEX: 2
+CONSTANT: MH_FVMLIB       HEX: 3
+CONSTANT: MH_CORE         HEX: 4
+CONSTANT: MH_PRELOAD      HEX: 5
+CONSTANT: MH_DYLIB        HEX: 6
+CONSTANT: MH_DYLINKER     HEX: 7
+CONSTANT: MH_BUNDLE       HEX: 8
+CONSTANT: MH_DYLIB_STUB   HEX: 9
+CONSTANT: MH_DSYM         HEX: a
+CONSTANT: MH_KEXT_BUNDLE  HEX: b
+
+CONSTANT: MH_NOUNDEFS                HEX: 1
+CONSTANT: MH_INCRLINK                HEX: 2
+CONSTANT: MH_DYLDLINK                HEX: 4
+CONSTANT: MH_BINDATLOAD              HEX: 8
+CONSTANT: MH_PREBOUND                HEX: 10
+CONSTANT: MH_SPLIT_SEGS              HEX: 20
+CONSTANT: MH_LAZY_INIT               HEX: 40
+CONSTANT: MH_TWOLEVEL                HEX: 80
+CONSTANT: MH_FORCE_FLAT              HEX: 100
+CONSTANT: MH_NOMULTIDEFS             HEX: 200
+CONSTANT: MH_NOFIXPREBINDING         HEX: 400
+CONSTANT: MH_PREBINDABLE             HEX: 800
+CONSTANT: MH_ALLMODSBOUND            HEX: 1000
+CONSTANT: MH_SUBSECTIONS_VIA_SYMBOLS HEX: 2000
+CONSTANT: MH_CANONICAL               HEX: 4000
+CONSTANT: MH_WEAK_DEFINES            HEX: 8000
+CONSTANT: MH_BINDS_TO_WEAK           HEX: 10000
+CONSTANT: MH_ALLOW_STACK_EXECUTION   HEX: 20000
+CONSTANT: MH_DEAD_STRIPPABLE_DYLIB   HEX: 400000
+CONSTANT: MH_ROOT_SAFE               HEX: 40000
+CONSTANT: MH_SETUID_SAFE             HEX: 80000
+CONSTANT: MH_NO_REEXPORTED_DYLIBS    HEX: 100000
+CONSTANT: MH_PIE                     HEX: 200000
+
+STRUCT: load_command
+    { cmd     uint }
+    { cmdsize uint } ;
+
+CONSTANT: LC_REQ_DYLD HEX: 80000000
+
+CONSTANT: LC_SEGMENT            HEX: 1
+CONSTANT: LC_SYMTAB             HEX: 2
+CONSTANT: LC_SYMSEG             HEX: 3
+CONSTANT: LC_THREAD             HEX: 4
+CONSTANT: LC_UNIXTHREAD         HEX: 5
+CONSTANT: LC_LOADFVMLIB         HEX: 6
+CONSTANT: LC_IDFVMLIB           HEX: 7
+CONSTANT: LC_IDENT              HEX: 8
+CONSTANT: LC_FVMFILE            HEX: 9
+CONSTANT: LC_PREPAGE            HEX: a
+CONSTANT: LC_DYSYMTAB           HEX: b
+CONSTANT: LC_LOAD_DYLIB         HEX: c
+CONSTANT: LC_ID_DYLIB           HEX: d
+CONSTANT: LC_LOAD_DYLINKER      HEX: e
+CONSTANT: LC_ID_DYLINKER        HEX: f
+CONSTANT: LC_PREBOUND_DYLIB     HEX: 10
+CONSTANT: LC_ROUTINES           HEX: 11
+CONSTANT: LC_SUB_FRAMEWORK      HEX: 12
+CONSTANT: LC_SUB_UMBRELLA       HEX: 13
+CONSTANT: LC_SUB_CLIENT         HEX: 14
+CONSTANT: LC_SUB_LIBRARY        HEX: 15
+CONSTANT: LC_TWOLEVEL_HINTS     HEX: 16
+CONSTANT: LC_PREBIND_CKSUM      HEX: 17
+CONSTANT: LC_LOAD_WEAK_DYLIB    HEX: 80000018
+CONSTANT: LC_SEGMENT_64         HEX: 19
+CONSTANT: LC_ROUTINES_64        HEX: 1a
+CONSTANT: LC_UUID               HEX: 1b
+CONSTANT: LC_RPATH              HEX: 8000001c
+CONSTANT: LC_CODE_SIGNATURE     HEX: 1d
+CONSTANT: LC_SEGMENT_SPLIT_INFO HEX: 1e
+CONSTANT: LC_REEXPORT_DYLIB     HEX: 8000001f
+CONSTANT: LC_LAZY_LOAD_DYLIB    HEX: 20
+CONSTANT: LC_ENCRYPTION_INFO    HEX: 21
+CONSTANT: LC_DYLD_INFO          HEX: 22
+CONSTANT: LC_DYLD_INFO_ONLY     HEX: 80000022
+
+UNION-STRUCT: lc_str
+    { offset    uint     }
+    { ptr       char*    } ;
+
+STRUCT: segment_command
+    { cmd            uint      }
+    { cmdsize        uint      }
+    { segname        char[16]  }
+    { vmaddr         uint      }
+    { vmsize         uint      }
+    { fileoff        uint      }
+    { filesize       uint      }
+    { maxprot        vm_prot_t }
+    { initprot       vm_prot_t }
+    { nsects         uint      }
+    { flags          uint      } ;
+
+STRUCT: segment_command_64
+    { cmd            uint       }
+    { cmdsize        uint       }
+    { segname        char[16]   }
+    { vmaddr         ulonglong  }
+    { vmsize         ulonglong  }
+    { fileoff        ulonglong  }
+    { filesize       ulonglong  }
+    { maxprot        vm_prot_t  }
+    { initprot       vm_prot_t  }
+    { nsects         uint       }
+    { flags          uint       } ;
+    
+CONSTANT: SG_HIGHVM               HEX: 1
+CONSTANT: SG_FVMLIB               HEX: 2
+CONSTANT: SG_NORELOC              HEX: 4
+CONSTANT: SG_PROTECTED_VERSION_1  HEX: 8
+
+STRUCT: section
+    { sectname        char[16] }
+    { segname         char[16] }
+    { addr            uint     }
+    { size            uint     }
+    { offset          uint     }
+    { align           uint     }
+    { reloff          uint     }
+    { nreloc          uint     }
+    { flags           uint     }
+    { reserved1       uint     }
+    { reserved2       uint     } ;
+
+STRUCT: section_64
+    { sectname        char[16]  }
+    { segname         char[16]  }
+    { addr            ulonglong }
+    { size            ulonglong }
+    { offset          uint      }
+    { align           uint      }
+    { reloff          uint      }
+    { nreloc          uint      }
+    { flags           uint      }
+    { reserved1       uint      }
+    { reserved2       uint      }
+    { reserved3       uint      } ;
+
+CONSTANT: SECTION_TYPE         HEX: 000000ff
+CONSTANT: SECTION_ATTRIBUTES   HEX: ffffff00
+
+CONSTANT: S_REGULAR                       HEX: 0
+CONSTANT: S_ZEROFILL                      HEX: 1
+CONSTANT: S_CSTRING_LITERALS              HEX: 2
+CONSTANT: S_4BYTE_LITERALS                HEX: 3
+CONSTANT: S_8BYTE_LITERALS                HEX: 4
+CONSTANT: S_LITERAL_POINTERS              HEX: 5
+CONSTANT: S_NON_LAZY_SYMBOL_POINTERS      HEX: 6
+CONSTANT: S_LAZY_SYMBOL_POINTERS          HEX: 7
+CONSTANT: S_SYMBOL_STUBS                  HEX: 8
+CONSTANT: S_MOD_INIT_FUNC_POINTERS        HEX: 9
+CONSTANT: S_MOD_TERM_FUNC_POINTERS        HEX: a
+CONSTANT: S_COALESCED                     HEX: b
+CONSTANT: S_GB_ZEROFILL                   HEX: c
+CONSTANT: S_INTERPOSING                   HEX: d
+CONSTANT: S_16BYTE_LITERALS               HEX: e
+CONSTANT: S_DTRACE_DOF                    HEX: f
+CONSTANT: S_LAZY_DYLIB_SYMBOL_POINTERS    HEX: 10
+
+CONSTANT: SECTION_ATTRIBUTES_USR     HEX: ff000000
+CONSTANT: S_ATTR_PURE_INSTRUCTIONS   HEX: 80000000
+CONSTANT: S_ATTR_NO_TOC              HEX: 40000000
+CONSTANT: S_ATTR_STRIP_STATIC_SYMS   HEX: 20000000
+CONSTANT: S_ATTR_NO_DEAD_STRIP       HEX: 10000000
+CONSTANT: S_ATTR_LIVE_SUPPORT        HEX: 08000000
+CONSTANT: S_ATTR_SELF_MODIFYING_CODE HEX: 04000000
+CONSTANT: S_ATTR_DEBUG               HEX: 02000000
+CONSTANT: SECTION_ATTRIBUTES_SYS     HEX: 00ffff00
+CONSTANT: S_ATTR_SOME_INSTRUCTIONS   HEX: 00000400
+CONSTANT: S_ATTR_EXT_RELOC           HEX: 00000200
+CONSTANT: S_ATTR_LOC_RELOC           HEX: 00000100
+
+CONSTANT: SEG_PAGEZERO      "__PAGEZERO"
+CONSTANT: SEG_TEXT          "__TEXT"
+CONSTANT: SECT_TEXT         "__text"
+CONSTANT: SECT_FVMLIB_INIT0 "__fvmlib_init0"
+CONSTANT: SECT_FVMLIB_INIT1 "__fvmlib_init1"
+CONSTANT: SEG_DATA          "__DATA"
+CONSTANT: SECT_DATA         "__data"
+CONSTANT: SECT_BSS          "__bss"
+CONSTANT: SECT_COMMON       "__common"
+CONSTANT: SEG_OBJC          "__OBJC"
+CONSTANT: SECT_OBJC_SYMBOLS "__symbol_table"
+CONSTANT: SECT_OBJC_MODULES "__module_info"
+CONSTANT: SECT_OBJC_STRINGS "__selector_strs"
+CONSTANT: SECT_OBJC_REFS    "__selector_refs"
+CONSTANT: SEG_ICON          "__ICON"
+CONSTANT: SECT_ICON_HEADER  "__header"
+CONSTANT: SECT_ICON_TIFF    "__tiff"
+CONSTANT: SEG_LINKEDIT      "__LINKEDIT"
+CONSTANT: SEG_UNIXSTACK     "__UNIXSTACK"
+CONSTANT: SEG_IMPORT        "__IMPORT"
+
+STRUCT: fvmlib
+    { name             lc_str   }
+    { minor_version    uint     }
+    { header_addr      uint     } ;
+
+STRUCT: fvmlib_command
+    { cmd        uint     }
+    { cmdsize    uint     }
+    { fvmlib     fvmlib   } ;
+
+STRUCT: dylib
+    { name                  lc_str   }
+    { timestamp             uint     }
+    { current_version       uint     }
+    { compatibility_version uint     } ;
+
+STRUCT: dylib_command
+    { cmd        uint     }
+    { cmdsize    uint     }
+    { dylib      dylib    } ;
+
+STRUCT: sub_framework_command
+    { cmd         uint     }
+    { cmdsize     uint     }
+    { umbrella    lc_str   } ;
+
+STRUCT: sub_client_command
+    { cmd        uint     }
+    { cmdsize    uint     }
+    { client     lc_str   } ;
+
+STRUCT: sub_umbrella_command
+    { cmd             uint     }
+    { cmdsize         uint     }
+    { sub_umbrella    lc_str   } ;
+
+STRUCT: sub_library_command
+    { cmd            uint     }
+    { cmdsize        uint     }
+    { sub_library    lc_str   } ;
+
+STRUCT: prebound_dylib_command
+    { cmd               uint     }
+    { cmdsize           uint     }
+    { name              lc_str   }
+    { nmodules          uint     }
+    { linked_modules    lc_str   } ;
+
+STRUCT: dylinker_command
+    { cmd        uint     }
+    { cmdsize    uint     }
+    { name       lc_str   } ;
+
+STRUCT: thread_command
+    { cmd        uint }
+    { cmdsize    uint } ;
+
+STRUCT: routines_command
+    { cmd             uint }
+    { cmdsize         uint }
+    { init_address    uint }
+    { init_module     uint }
+    { reserved1       uint }
+    { reserved2       uint }
+    { reserved3       uint }
+    { reserved4       uint }
+    { reserved5       uint }
+    { reserved6       uint } ;
+
+STRUCT: routines_command_64
+    { cmd             uint      }
+    { cmdsize         uint      }
+    { init_address    ulonglong }
+    { init_module     ulonglong }
+    { reserved1       ulonglong }
+    { reserved2       ulonglong }
+    { reserved3       ulonglong }
+    { reserved4       ulonglong }
+    { reserved5       ulonglong }
+    { reserved6       ulonglong } ;
+
+STRUCT: symtab_command
+    { cmd        uint }
+    { cmdsize    uint }
+    { symoff     uint }
+    { nsyms      uint }
+    { stroff     uint }
+    { strsize    uint } ;
+
+STRUCT: dysymtab_command
+    { cmd            uint }
+    { cmdsize        uint }
+    { ilocalsym      uint }
+    { nlocalsym      uint }
+    { iextdefsym     uint }
+    { nextdefsym     uint }
+    { iundefsym      uint }
+    { nundefsym      uint }
+    { tocoff         uint }
+    { ntoc           uint }
+    { modtaboff      uint }
+    { nmodtab        uint }
+    { extrefsymoff   uint }
+    { nextrefsyms    uint }
+    { indirectsymoff uint }
+    { nindirectsyms  uint }
+    { extreloff      uint }
+    { nextrel        uint }
+    { locreloff      uint }
+    { nlocrel        uint } ;
+
+CONSTANT: INDIRECT_SYMBOL_LOCAL HEX: 80000000
+CONSTANT: INDIRECT_SYMBOL_ABS   HEX: 40000000
+
+STRUCT: dylib_table_of_contents
+    { symbol_index uint }
+    { module_index uint } ;
+
+STRUCT: dylib_module
+    { module_name           uint }
+    { iextdefsym            uint }
+    { nextdefsym            uint }
+    { irefsym               uint }
+    { nrefsym               uint }
+    { ilocalsym             uint }
+    { nlocalsym             uint }
+    { iextrel               uint }
+    { nextrel               uint }
+    { iinit_iterm           uint }
+    { ninit_nterm           uint }
+    { objc_module_info_addr uint }
+    { objc_module_info_size uint } ;
+
+STRUCT: dylib_module_64
+    { module_name           uint      }
+    { iextdefsym            uint      }
+    { nextdefsym            uint      }
+    { irefsym               uint      }
+    { nrefsym               uint      }
+    { ilocalsym             uint      }
+    { nlocalsym             uint      }
+    { iextrel               uint      }
+    { nextrel               uint      }
+    { iinit_iterm           uint      }
+    { ninit_nterm           uint      }
+    { objc_module_info_size uint      }
+    { objc_module_info_addr ulonglong } ;
+
+STRUCT: dylib_reference
+    { isym_flags uint } ;
+
+STRUCT: twolevel_hints_command
+    { cmd     uint }
+    { cmdsize uint }
+    { offset  uint }
+    { nhints  uint } ;
+
+STRUCT: twolevel_hint
+    { isub_image_itoc uint } ;
+
+STRUCT: prebind_cksum_command
+    { cmd     uint }
+    { cmdsize uint }
+    { cksum   uint } ;
+
+STRUCT: uuid_command
+    { cmd        uint        }
+    { cmdsize    uint        }
+    { uuid       uchar[16]   } ;
+
+STRUCT: rpath_command
+    { cmd         uint     }
+    { cmdsize     uint     }
+    { path        lc_str   } ;
+
+STRUCT: linkedit_data_command
+    { cmd         uint }
+    { cmdsize     uint }
+    { dataoff     uint }
+    { datasize    uint } ;
+
+STRUCT: encryption_info_command
+    { cmd       uint }
+    { cmdsize   uint }
+    { cryptoff  uint }
+    { cryptsize uint }
+    { cryptid   uint } ;
+
+STRUCT: dyld_info_command
+    { cmd              uint }
+    { cmdsize          uint }
+    { rebase_off       uint }
+    { rebase_size      uint }
+    { bind_off         uint }
+    { bind_size        uint }
+    { weak_bind_off    uint }
+    { weak_bind_size   uint }
+    { lazy_bind_off    uint }
+    { lazy_bind_size   uint }
+    { export_off       uint }
+    { export_size      uint } ;
+
+CONSTANT: REBASE_TYPE_POINTER                     1
+CONSTANT: REBASE_TYPE_TEXT_ABSOLUTE32             2
+CONSTANT: REBASE_TYPE_TEXT_PCREL32                3
+
+CONSTANT: REBASE_OPCODE_MASK                                  HEX: F0
+CONSTANT: REBASE_IMMEDIATE_MASK                               HEX: 0F
+CONSTANT: REBASE_OPCODE_DONE                                  HEX: 00
+CONSTANT: REBASE_OPCODE_SET_TYPE_IMM                          HEX: 10
+CONSTANT: REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB           HEX: 20
+CONSTANT: REBASE_OPCODE_ADD_ADDR_ULEB                         HEX: 30
+CONSTANT: REBASE_OPCODE_ADD_ADDR_IMM_SCALED                   HEX: 40
+CONSTANT: REBASE_OPCODE_DO_REBASE_IMM_TIMES                   HEX: 50
+CONSTANT: REBASE_OPCODE_DO_REBASE_ULEB_TIMES                  HEX: 60
+CONSTANT: REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB               HEX: 70
+CONSTANT: REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB    HEX: 80
+
+CONSTANT: BIND_TYPE_POINTER                       1
+CONSTANT: BIND_TYPE_TEXT_ABSOLUTE32               2
+CONSTANT: BIND_TYPE_TEXT_PCREL32                  3
+
+CONSTANT: BIND_SPECIAL_DYLIB_SELF                     0
+CONSTANT: BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE          -1
+CONSTANT: BIND_SPECIAL_DYLIB_FLAT_LOOKUP              -2
+
+CONSTANT: BIND_SYMBOL_FLAGS_WEAK_IMPORT                   HEX: 1
+CONSTANT: BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION           HEX: 8
+
+CONSTANT: BIND_OPCODE_MASK                                    HEX: F0
+CONSTANT: BIND_IMMEDIATE_MASK                                 HEX: 0F
+CONSTANT: BIND_OPCODE_DONE                                    HEX: 00
+CONSTANT: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM                   HEX: 10
+CONSTANT: BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB                  HEX: 20
+CONSTANT: BIND_OPCODE_SET_DYLIB_SPECIAL_IMM                   HEX: 30
+CONSTANT: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM           HEX: 40
+CONSTANT: BIND_OPCODE_SET_TYPE_IMM                            HEX: 50
+CONSTANT: BIND_OPCODE_SET_ADDEND_SLEB                         HEX: 60
+CONSTANT: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB             HEX: 70
+CONSTANT: BIND_OPCODE_ADD_ADDR_ULEB                           HEX: 80
+CONSTANT: BIND_OPCODE_DO_BIND                                 HEX: 90
+CONSTANT: BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB                   HEX: A0
+CONSTANT: BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED             HEX: B0
+CONSTANT: BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB        HEX: C0
+
+CONSTANT: EXPORT_SYMBOL_FLAGS_KIND_MASK                   HEX: 03
+CONSTANT: EXPORT_SYMBOL_FLAGS_KIND_REGULAR                HEX: 00
+CONSTANT: EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL           HEX: 01
+CONSTANT: EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION             HEX: 04
+CONSTANT: EXPORT_SYMBOL_FLAGS_INDIRECT_DEFINITION         HEX: 08
+CONSTANT: EXPORT_SYMBOL_FLAGS_HAS_SPECIALIZATIONS         HEX: 10
+
+STRUCT: symseg_command
+    { cmd        uint }
+    { cmdsize    uint }
+    { offset     uint }
+    { size       uint } ;
+
+STRUCT: ident_command
+    { cmd     uint }
+    { cmdsize uint } ;
+
+STRUCT: fvmfile_command
+    { cmd            uint     }
+    { cmdsize        uint     }
+    { name           lc_str   }
+    { header_addr    uint     } ;
+
+! machine.h
+CONSTANT: CPU_STATE_MAX       4
+CONSTANT: CPU_STATE_USER      0
+CONSTANT: CPU_STATE_SYSTEM    1
+CONSTANT: CPU_STATE_IDLE      2
+CONSTANT: CPU_STATE_NICE      3
+
+CONSTANT: CPU_ARCH_MASK   HEX: ff000000
+CONSTANT: CPU_ARCH_ABI64  HEX: 01000000
+
+CONSTANT: CPU_TYPE_ANY            -1
+CONSTANT: CPU_TYPE_VAX            1
+CONSTANT: CPU_TYPE_MC680x0        6
+CONSTANT: CPU_TYPE_X86            7
+ALIAS: CPU_TYPE_I386              CPU_TYPE_X86
+CONSTANT: CPU_TYPE_X86_64         flags{ CPU_TYPE_X86 CPU_ARCH_ABI64 }
+CONSTANT: CPU_TYPE_MC98000        10
+CONSTANT: CPU_TYPE_HPPA           11
+CONSTANT: CPU_TYPE_ARM            12
+CONSTANT: CPU_TYPE_MC88000        13
+CONSTANT: CPU_TYPE_SPARC          14
+CONSTANT: CPU_TYPE_I860           15
+CONSTANT: CPU_TYPE_POWERPC        18
+CONSTANT: CPU_TYPE_POWERPC64      flags{ CPU_TYPE_POWERPC CPU_ARCH_ABI64 }
+
+CONSTANT: CPU_SUBTYPE_MASK    HEX: ff000000
+CONSTANT: CPU_SUBTYPE_LIB64   HEX: 80000000
+
+CONSTANT: CPU_SUBTYPE_MULTIPLE        -1
+CONSTANT: CPU_SUBTYPE_LITTLE_ENDIAN   0
+CONSTANT: CPU_SUBTYPE_BIG_ENDIAN      1
+
+CONSTANT: CPU_THREADTYPE_NONE     0
+
+CONSTANT: CPU_SUBTYPE_VAX_ALL 0
+CONSTANT: CPU_SUBTYPE_VAX780  1
+CONSTANT: CPU_SUBTYPE_VAX785  2
+CONSTANT: CPU_SUBTYPE_VAX750  3
+CONSTANT: CPU_SUBTYPE_VAX730  4
+CONSTANT: CPU_SUBTYPE_UVAXI   5
+CONSTANT: CPU_SUBTYPE_UVAXII  6
+CONSTANT: CPU_SUBTYPE_VAX8200 7
+CONSTANT: CPU_SUBTYPE_VAX8500 8
+CONSTANT: CPU_SUBTYPE_VAX8600 9
+CONSTANT: CPU_SUBTYPE_VAX8650 10
+CONSTANT: CPU_SUBTYPE_VAX8800 11
+CONSTANT: CPU_SUBTYPE_UVAXIII 12
+
+CONSTANT: CPU_SUBTYPE_MC680x0_ALL     1
+CONSTANT: CPU_SUBTYPE_MC68030     1
+CONSTANT: CPU_SUBTYPE_MC68040     2
+CONSTANT: CPU_SUBTYPE_MC68030_ONLY    3
+
+: CPU_SUBTYPE_INTEL ( f m -- subtype ) 4 shift + ; inline
+
+CONSTANT: CPU_SUBTYPE_I386_ALL              3
+CONSTANT: CPU_SUBTYPE_386                   3
+CONSTANT: CPU_SUBTYPE_486                   4
+CONSTANT: CPU_SUBTYPE_486SX                 132
+CONSTANT: CPU_SUBTYPE_586                   5
+CONSTANT: CPU_SUBTYPE_PENT                  5
+CONSTANT: CPU_SUBTYPE_PENTPRO               22
+CONSTANT: CPU_SUBTYPE_PENTII_M3             54
+CONSTANT: CPU_SUBTYPE_PENTII_M5             86
+CONSTANT: CPU_SUBTYPE_CELERON               103
+CONSTANT: CPU_SUBTYPE_CELERON_MOBILE        119
+CONSTANT: CPU_SUBTYPE_PENTIUM_3             8
+CONSTANT: CPU_SUBTYPE_PENTIUM_3_M           24
+CONSTANT: CPU_SUBTYPE_PENTIUM_3_XEON        40
+CONSTANT: CPU_SUBTYPE_PENTIUM_M             9
+CONSTANT: CPU_SUBTYPE_PENTIUM_4             10
+CONSTANT: CPU_SUBTYPE_PENTIUM_4_M           26
+CONSTANT: CPU_SUBTYPE_ITANIUM               11
+CONSTANT: CPU_SUBTYPE_ITANIUM_2             27
+CONSTANT: CPU_SUBTYPE_XEON                  12
+CONSTANT: CPU_SUBTYPE_XEON_MP               28
+
+: CPU_SUBTYPE_INTEL_FAMILY ( x -- family ) 15 bitand ; inline
+
+CONSTANT: CPU_SUBTYPE_INTEL_FAMILY_MAX    15
+
+: CPU_SUBTYPE_INTEL_MODEL ( x -- model ) -4 shift ; inline
+
+CONSTANT: CPU_SUBTYPE_INTEL_MODEL_ALL 0
+CONSTANT: CPU_SUBTYPE_X86_ALL         3
+CONSTANT: CPU_SUBTYPE_X86_64_ALL      3
+CONSTANT: CPU_SUBTYPE_X86_ARCH1       4
+CONSTANT: CPU_THREADTYPE_INTEL_HTT    1
+
+CONSTANT: CPU_SUBTYPE_MIPS_ALL    0
+CONSTANT: CPU_SUBTYPE_MIPS_R2300  1
+CONSTANT: CPU_SUBTYPE_MIPS_R2600  2
+CONSTANT: CPU_SUBTYPE_MIPS_R2800  3
+CONSTANT: CPU_SUBTYPE_MIPS_R2000a 4
+CONSTANT: CPU_SUBTYPE_MIPS_R2000  5
+CONSTANT: CPU_SUBTYPE_MIPS_R3000a 6
+CONSTANT: CPU_SUBTYPE_MIPS_R3000  7
+
+CONSTANT: CPU_SUBTYPE_MC98000_ALL 0
+CONSTANT: CPU_SUBTYPE_MC98601     1
+
+CONSTANT: CPU_SUBTYPE_HPPA_ALL        0
+CONSTANT: CPU_SUBTYPE_HPPA_7100       0
+CONSTANT: CPU_SUBTYPE_HPPA_7100LC     1
+
+CONSTANT: CPU_SUBTYPE_MC88000_ALL 0
+CONSTANT: CPU_SUBTYPE_MC88100     1
+CONSTANT: CPU_SUBTYPE_MC88110     2
+
+CONSTANT: CPU_SUBTYPE_SPARC_ALL       0
+
+CONSTANT: CPU_SUBTYPE_I860_ALL    0
+CONSTANT: CPU_SUBTYPE_I860_860    1
+
+CONSTANT: CPU_SUBTYPE_POWERPC_ALL     0
+CONSTANT: CPU_SUBTYPE_POWERPC_601     1
+CONSTANT: CPU_SUBTYPE_POWERPC_602     2
+CONSTANT: CPU_SUBTYPE_POWERPC_603     3
+CONSTANT: CPU_SUBTYPE_POWERPC_603e    4
+CONSTANT: CPU_SUBTYPE_POWERPC_603ev   5
+CONSTANT: CPU_SUBTYPE_POWERPC_604     6
+CONSTANT: CPU_SUBTYPE_POWERPC_604e    7
+CONSTANT: CPU_SUBTYPE_POWERPC_620     8
+CONSTANT: CPU_SUBTYPE_POWERPC_750     9
+CONSTANT: CPU_SUBTYPE_POWERPC_7400    10
+CONSTANT: CPU_SUBTYPE_POWERPC_7450    11
+CONSTANT: CPU_SUBTYPE_POWERPC_970     100
+
+CONSTANT: CPU_SUBTYPE_ARM_ALL             0
+CONSTANT: CPU_SUBTYPE_ARM_V4T             5
+CONSTANT: CPU_SUBTYPE_ARM_V6              6
+CONSTANT: CPU_SUBTYPE_ARM_V5TEJ           7
+CONSTANT: CPU_SUBTYPE_ARM_XSCALE          8
+CONSTANT: CPU_SUBTYPE_ARM_V7              9
+
+CONSTANT: CPUFAMILY_UNKNOWN    0
+CONSTANT: CPUFAMILY_POWERPC_G3 HEX: cee41549
+CONSTANT: CPUFAMILY_POWERPC_G4 HEX: 77c184ae
+CONSTANT: CPUFAMILY_POWERPC_G5 HEX: ed76d8aa
+CONSTANT: CPUFAMILY_INTEL_6_13 HEX: aa33392b
+CONSTANT: CPUFAMILY_INTEL_6_14 HEX: 73d67300
+CONSTANT: CPUFAMILY_INTEL_6_15 HEX: 426f69ef
+CONSTANT: CPUFAMILY_INTEL_6_23 HEX: 78ea4fbc
+CONSTANT: CPUFAMILY_INTEL_6_26 HEX: 6b5a4cd2
+CONSTANT: CPUFAMILY_ARM_9      HEX: e73283ae
+CONSTANT: CPUFAMILY_ARM_11     HEX: 8ff620d8
+CONSTANT: CPUFAMILY_ARM_XSCALE HEX: 53b005f5
+CONSTANT: CPUFAMILY_ARM_13     HEX: 0cc90e64
+
+ALIAS: CPUFAMILY_INTEL_YONAH   CPUFAMILY_INTEL_6_14
+ALIAS: CPUFAMILY_INTEL_MEROM   CPUFAMILY_INTEL_6_15
+ALIAS: CPUFAMILY_INTEL_PENRYN  CPUFAMILY_INTEL_6_23
+ALIAS: CPUFAMILY_INTEL_NEHALEM CPUFAMILY_INTEL_6_26
+
+ALIAS: CPUFAMILY_INTEL_CORE    CPUFAMILY_INTEL_6_14
+ALIAS: CPUFAMILY_INTEL_CORE2   CPUFAMILY_INTEL_6_15
+
+! fat.h
+CONSTANT: FAT_MAGIC HEX: cafebabe
+CONSTANT: FAT_CIGAM HEX: bebafeca
+
+STRUCT: fat_header
+    { magic        uint }
+    { nfat_arch    uint } ;
+
+STRUCT: fat_arch
+    { cputype      cpu_type_t    }
+    { cpusubtype   cpu_subtype_t }
+    { offset       uint          }
+    { size         uint          }
+    { align        uint          } ;
+
+! nlist.h
+STRUCT: nlist
+    { n_strx  int      }
+    { n_type  uchar    }
+    { n_sect  uchar    }
+    { n_desc  short    }
+    { n_value uint     } ;
+
+STRUCT: nlist_64
+    { n_strx  uint      }
+    { n_type  uchar     }
+    { n_sect  uchar     }
+    { n_desc  ushort    }
+    { n_value ulonglong } ;
+
+CONSTANT: N_STAB  HEX: e0
+CONSTANT: N_PEXT  HEX: 10
+CONSTANT: N_TYPE  HEX: 0e
+CONSTANT: N_EXT   HEX: 01
+
+CONSTANT: N_UNDF  HEX: 0
+CONSTANT: N_ABS   HEX: 2
+CONSTANT: N_SECT  HEX: e
+CONSTANT: N_PBUD  HEX: c
+CONSTANT: N_INDR  HEX: a
+
+CONSTANT: NO_SECT     0
+CONSTANT: MAX_SECT    255
+
+: GET_COMM_ALIGN ( n_desc -- align )
+    -8 shift HEX: 0f bitand ; inline
+
+: SET_COMM_ALIGN ( n_desc align -- n_desc )
+    [ HEX: f0ff bitand ]
+    [ HEX: 000f bitand 8 shift ] bi* bitor ; inline
+
+CONSTANT: REFERENCE_TYPE                              7
+CONSTANT: REFERENCE_FLAG_UNDEFINED_NON_LAZY           0
+CONSTANT: REFERENCE_FLAG_UNDEFINED_LAZY               1
+CONSTANT: REFERENCE_FLAG_DEFINED                      2
+CONSTANT: REFERENCE_FLAG_PRIVATE_DEFINED              3
+CONSTANT: REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY   4
+CONSTANT: REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY       5
+
+CONSTANT: REFERENCED_DYNAMICALLY  HEX: 0010
+
+: GET_LIBRARY_ORDINAL ( n_desc -- ordinal )
+    -8 shift HEX: ff bitand ; inline
+
+: SET_LIBRARY_ORDINAL ( n_desc ordinal -- n_desc )
+    [ HEX: 00ff bitand ]
+    [ HEX: 00ff bitand 8 shift ] bi* bitor ; inline
+
+CONSTANT: SELF_LIBRARY_ORDINAL   HEX: 0
+CONSTANT: MAX_LIBRARY_ORDINAL    HEX: fd
+CONSTANT: DYNAMIC_LOOKUP_ORDINAL HEX: fe
+CONSTANT: EXECUTABLE_ORDINAL     HEX: ff
+
+CONSTANT: N_NO_DEAD_STRIP  HEX: 0020
+CONSTANT: N_DESC_DISCARDED HEX: 0020
+CONSTANT: N_WEAK_REF       HEX: 0040
+CONSTANT: N_WEAK_DEF       HEX: 0080
+CONSTANT: N_REF_TO_WEAK    HEX: 0080
+CONSTANT: N_ARM_THUMB_DEF  HEX: 0008
+
+! ranlib.h
+CONSTANT: SYMDEF        "__.SYMDEF"
+CONSTANT: SYMDEF_SORTED "__.SYMDEF SORTED"
+
+STRUCT: ranlib
+    { ran_strx uint }
+    { ran_off  uint } ;
+
+! reloc.h
+STRUCT: relocation_info
+    { r_address                            int  }
+    { r_symbolnum_pcrel_length_extern_type uint } ;
+
+CONSTANT: R_ABS   0
+CONSTANT: R_SCATTERED HEX: 80000000
+
+STRUCT: scattered_relocation_info_big_endian
+    { r_scattered_pcrel_length_type_address  uint }
+    { r_value                                int  } ;
+
+STRUCT: scattered_relocation_info_little_endian
+    { r_address_type_length_pcrel_scattered uint }
+    { r_value                               int  } ;
+
+ENUM: reloc_type_generic
+    GENERIC_RELOC_VANILLA
+    GENERIC_RELOC_PAIR
+    GENERIC_RELOC_SECTDIFF
+    GENERIC_RELOC_PB_LA_PTR
+    GENERIC_RELOC_LOCAL_SECTDIFF ;
+
+ENUM: reloc_type_x86_64
+    X86_64_RELOC_UNSIGNED
+    X86_64_RELOC_SIGNED
+    X86_64_RELOC_BRANCH
+    X86_64_RELOC_GOT_LOAD
+    X86_64_RELOC_GOT
+    X86_64_RELOC_SUBTRACTOR
+    X86_64_RELOC_SIGNED_1
+    X86_64_RELOC_SIGNED_2
+    X86_64_RELOC_SIGNED_4 ;
+
+ENUM: reloc_type_ppc
+    PPC_RELOC_VANILLA
+    PPC_RELOC_PAIR
+    PPC_RELOC_BR14
+    PPC_RELOC_BR24
+    PPC_RELOC_HI16
+    PPC_RELOC_LO16
+    PPC_RELOC_HA16
+    PPC_RELOC_LO14
+    PPC_RELOC_SECTDIFF
+    PPC_RELOC_PB_LA_PTR
+    PPC_RELOC_HI16_SECTDIFF
+    PPC_RELOC_LO16_SECTDIFF
+    PPC_RELOC_HA16_SECTDIFF
+    PPC_RELOC_JBSR
+    PPC_RELOC_LO14_SECTDIFF
+    PPC_RELOC_LOCAL_SECTDIFF ;
+
+! Low-level interface
+SPECIALIZED-ARRAYS: section section_64 nlist nlist_64 fat_arch uchar ;
+UNION: mach_header_32/64 mach_header mach_header_64 ;
+UNION: segment_command_32/64 segment_command segment_command_64 ;
+UNION: load-command segment_command segment_command_64
+    dylib_command sub_framework_command
+    sub_client_command sub_umbrella_command sub_library_command
+    prebound_dylib_command dylinker_command thread_command
+    routines_command routines_command_64 symtab_command
+    dysymtab_command twolevel_hints_command uuid_command ;
+UNION: section_32/64 section section_64 ;
+UNION: section_32/64-array section-array section_64-array ;
+UNION: nlist_32/64 nlist nlist_64 ;
+UNION: nlist_32/64-array nlist-array nlist_64-array ;
+
+TUPLE: fat-binary-member cpu-type cpu-subtype data ;
+ERROR: not-fat-binary ;
+
+TYPED: fat-binary-members ( >c-ptr -- fat-binary-members )
+    fat_header memory>struct dup magic>> {
+        { FAT_MAGIC [ ] }
+        { FAT_CIGAM [ ] }
+        [ 2drop not-fat-binary ]
+    } case dup
+    [ >c-ptr fat_header heap-size swap <displaced-alien> ]
+    [ nfat_arch>> 4 >be le> ] bi
+    <direct-fat_arch-array> [
+        {
+            [ nip cputype>> 4 >be le> ]
+            [ nip cpusubtype>> 4 >be le> ]
+            [ offset>> 4 >be le> swap >c-ptr <displaced-alien> ]
+            [ nip size>> 4 >be le> <direct-uchar-array> ]
+        } 2cleave fat-binary-member boa
+    ] with { } map-as ;
+
+TYPED: 64-bit? ( macho: mach_header_32/64 -- ? )
+    magic>> {
+        { MH_MAGIC_64 [ t ] }
+        { MH_CIGAM_64 [ t ] }
+        [ drop f ]
+    } case ;
+
+TYPED: macho-header ( c-ptr -- macho: mach_header_32/64 )
+    dup mach_header_64 memory>struct 64-bit?
+    [ mach_header_64 memory>struct ]
+    [ mach_header memory>struct ] if ;
+
+: cmd>load-command ( cmd -- load-command )
+    {
+        { LC_UUID           [ uuid_command           ] }
+        { LC_SEGMENT        [ segment_command        ] }
+        { LC_SEGMENT_64     [ segment_command_64     ] }
+        { LC_SYMTAB         [ symtab_command         ] }
+        { LC_DYSYMTAB       [ dysymtab_command       ] }
+        { LC_THREAD         [ thread_command         ] }
+        { LC_UNIXTHREAD     [ thread_command         ] }
+        { LC_LOAD_DYLIB     [ dylib_command          ] }
+        { LC_ID_DYLIB       [ dylib_command          ] }
+        { LC_PREBOUND_DYLIB [ prebound_dylib_command ] }
+        { LC_LOAD_DYLINKER  [ dylinker_command       ] }
+        { LC_ID_DYLINKER    [ dylinker_command       ] }
+        { LC_ROUTINES       [ routines_command       ] }
+        { LC_ROUTINES_64    [ routines_command_64    ] }
+        { LC_TWOLEVEL_HINTS [ twolevel_hints_command ] }
+        { LC_SUB_FRAMEWORK  [ sub_framework_command  ] }
+        { LC_SUB_UMBRELLA   [ sub_umbrella_command   ] }
+        { LC_SUB_LIBRARY    [ sub_library_command    ] }
+        { LC_SUB_CLIENT     [ sub_client_command     ] }
+        { LC_DYLD_INFO      [ dyld_info_command      ] }
+        { LC_DYLD_INFO_ONLY [ dyld_info_command      ] }
+    } case ;
+
+: read-command ( cmd -- next-cmd )
+    dup load_command memory>struct
+    [ cmd>> cmd>load-command memory>struct , ]
+    [ cmdsize>> swap <displaced-alien> ] 2bi ;
+
+TYPED: load-commands ( macho: mach_header_32/64 -- load-commands )
+    [
+        [ class heap-size ]
+        [ >c-ptr <displaced-alien> ]
+        [ ncmds>> ] tri iota [
+            drop read-command
+        ] each drop
+    ] { } make ;
+
+: segment-commands ( load-commands -- segment-commands )
+    [ segment_command_32/64? ] filter ; inline
+
+: symtab-commands ( load-commands -- segment-commands )
+    [ symtab_command? ] filter ; inline
+
+: read-array-string ( uchar-array -- string )
+    ascii decode [ 0 = not ] filter ;
+
+: segment-sections ( segment-command -- sections )
+    {
+        [ class heap-size ]
+        [ >c-ptr <displaced-alien> ]
+        [ nsects>> ]
+        [ segment_command_64? ]
+    } cleave
+    [ <direct-section_64-array> ]
+    [ <direct-section-array> ] if ;
+
+: sections-array ( segment-commands -- sections-array )
+    [
+        dup first segment_command_64?
+        [ section_64 ] [ section ] if <struct> ,
+        segment-commands [ segment-sections [ , ] each ] each
+    ] { } make ;
+
+: symbols ( mach-header symtab-command -- symbols string-table )
+    [ symoff>> swap >c-ptr <displaced-alien> ]
+    [ nsyms>> swap 64-bit?
+      [ <direct-nlist_64-array> ]
+      [ <direct-nlist-array> ] if ]
+    [ stroff>> swap >c-ptr <displaced-alien> ] 2tri ;
+    
+: symbol-name ( symbol string-table -- name )
+    [ n_strx>> ] dip <displaced-alien> ascii alien>string ;
+
+: c-symbol-name ( symbol string-table -- name )
+    symbol-name "_" ?head drop ;
+
+: with-mapped-macho ( path quot -- )
+    '[
+        address>> macho-header @
+    ] with-mapped-file-reader ; inline
+
+: macho-nm ( path -- )
+    [| macho |
+        macho load-commands segment-commands sections-array :> sections
+        macho load-commands symtab-commands [| symtab |
+            macho symtab symbols [
+                [ drop n_value>> "%016x " printf ]
+                [
+                    drop n_sect>> sections nth sectname>>
+                    read-array-string "%-16s" printf
+                ]
+                [ symbol-name "%s\n" printf ] 2tri
+            ] curry each
+        ] each
+    ] with-mapped-macho ;
+
+: dylib-export? ( symtab-entry -- ? )
+    n_type>> {
+        [ N_EXT bitand zero? not ]
+        [ N_TYPE bitand N_UNDF = not ]
+    } 1&& ;
+
+: dylib-exports ( path -- symbol-names )
+    [| macho |
+        macho load-commands symtab-commands [| symtab |
+            macho symtab symbols
+            [ [ dylib-export? ] filter ]
+            [ [ c-symbol-name ] curry { } map-as ] bi*
+        ] { } map-as concat
+    ] with-mapped-macho ;
diff --git a/extra/macho/summary.txt b/extra/macho/summary.txt
new file mode 100644 (file)
index 0000000..aaef275
--- /dev/null
@@ -0,0 +1 @@
+Constants and structs related to the Mach object format.
index e75a2803e689fd2863304b1e34cf277348b334eb..91936c701fc2affd183ffc010e2a69a236f519e8 100644 (file)
@@ -5,6 +5,7 @@ destructors fry io io.encodings.utf8 kernel managed-server
 namespaces parser sequences sorting splitting strings.parser
 unicode.case unicode.categories calendar calendar.format
 locals io.encodings.binary io.encodings.string prettyprint ;
+FROM: namespaces => set ;
 IN: managed-server.chat
 
 TUPLE: chat-server < managed-server ;
@@ -26,7 +27,7 @@ CONSTANT: line-beginning "-!- "
     ] "" append-outputs-as send-everyone ;
 
 : handle-quit ( string -- )
-    client [ (>>object) ] [ t >>quit? drop ] bi ;
+    client [ object<< ] [ t >>quit? drop ] bi ;
 
 : handle-help ( string -- )
     [
@@ -59,7 +60,7 @@ CONSTANT: line-beginning "-!- "
         ] [
             [ username swap warn-name-changed ]
             [ username clients rename-at ]
-            [ client (>>username) ] tri
+            [ client username<< ] tri
         ] if
     ] if-empty ;
 
@@ -126,10 +127,10 @@ M: chat-server handle-client-disconnect
 
 M: chat-server handle-already-logged-in
     username username-taken-string send-line
-    t client (>>quit?) ;
+    t client quit?<< ;
 
 M: chat-server handle-managed-client*
-    readln dup f = [ t client (>>quit?) ] when
+    readln dup f = [ t client quit?<< ] when
     [
         "/" ?head [ handle-command ] [ handle-chat ] if
     ] unless-empty ;
index 6f9bdf25f109007eac438e0afc760e762809d605..d62604476623418bd3834773827d7482d3c5cebd 100644 (file)
@@ -5,6 +5,7 @@ io.encodings.binary io.servers.connection io.sockets
 io.streams.duplex fry kernel locals math math.ranges multiline
 namespaces prettyprint random sequences sets splitting threads
 tools.continuations ;
+FROM: namespaces => set ;
 IN: managed-server
 
 TUPLE: managed-server < threaded-server clients ;
@@ -66,7 +67,7 @@ PRIVATE>
     username clients key? [
         handle-already-logged-in
     ] [
-        t client (>>logged-in?)
+        t client logged-in?<<
         client username clients set-at
     ] if ;
 
index 6fedac87bd0a154a3a2c62ab20fd759c7d62154d..1018a1ec4040308aefda582eda3f2c6f841a1764 100644 (file)
@@ -1,7 +1,7 @@
 IN: mason.child.tests
 USING: mason.child mason.config tools.test namespaces io kernel sequences ;
 
-[ { "nmake" "/f" "nmakefile" } ] [
+[ { "nmake" "/f" "nmakefile" "x86-32" } ] [
     [
         "winnt" target-os set
         "x86.32" target-cpu set
@@ -33,7 +33,7 @@ USING: mason.child mason.config tools.test namespaces io kernel sequences ;
     ] with-scope
 ] unit-test
 
-[ { "./factor.com" "-i=boot.x86.32.image" "-no-user-init" } ] [
+[ { "./factor.com" "-i=boot.winnt-x86.32.image" "-no-user-init" } ] [
     [
         "winnt" target-os set
         "x86.32" target-cpu set
index 017e4401d8ecae31e6f2bc753d8f640b9b2ef972..d9821f8fcc82a7efdd12fd33413dbc27a5187542 100644 (file)
@@ -4,13 +4,20 @@ USING: accessors arrays calendar combinators.short-circuit fry
 continuations debugger io.directories io.files io.launcher
 io.pathnames io.encodings.ascii kernel make mason.common mason.config
 mason.platform mason.report mason.notify namespaces sequences
-quotations macros system combinators ;
+quotations macros system combinators splitting ;
 IN: mason.child
 
+: nmake-cmd ( -- args )
+    { "nmake" "/f" "nmakefile" }
+    target-cpu get "." split "-" join suffix ;
+
+: gnu-make-cmd ( -- args )
+    gnu-make platform 2array ;
+
 : make-cmd ( -- args )
     {
-        { [ target-os get "winnt" = ] [ { "nmake" "/f" "nmakefile" } ] }
-        [ gnu-make platform 2array ]
+        { [ target-os get "winnt" = ] [ nmake-cmd ] }
+        [ gnu-make-cmd ]
     } cond ;
 
 : make-vm ( -- )
index 912cd48c79387c945dbe03b32df5c51f65ed2bc9..db68a558e094e68031866cb76e5a4532fd445e66 100644 (file)
@@ -17,8 +17,8 @@ SYMBOL: current-git-id
 
 : short-running-process ( command -- )
     #! Give network operations and shell commands at most
-    #! 15 minutes to complete, to catch hangs.
-    >process 15 minutes >>timeout try-output-process ;
+    #! 30 minutes to complete, to catch hangs.
+    >process 30 minutes >>timeout try-output-process ;
 
 HOOK: really-delete-tree os ( path -- )
 
index 5ec44df0a90a6d9616247f506333bbc7a57a63ea..48f4d307c8ca24c64bd8ac26bcaa2f72bef2d26b 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
+! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: system io.files io.pathnames namespaces kernel accessors
 assocs ;
@@ -39,11 +39,11 @@ target-os get-global [
 ! Keep test-log around?
 SYMBOL: builder-debug
 
-! Host to send status notifications to.
-SYMBOL: status-host
+! URL for status notifications.
+SYMBOL: status-url
 
-! Username to log in.
-SYMBOL: status-username
+! Password for status notifications.
+SYMBOL: status-secret
 
 SYMBOL: upload-help?
 
index 5f48ff0d4f355c5a17c6b9f4475de707c9499746..77f651feb900d3b2adcedc5fdaf41bad792caf37 100644 (file)
@@ -6,6 +6,6 @@ USING: mason.email mason.common mason.config namespaces tools.test ;
         "linux" target-os set
         "x86.64" target-cpu set
         "12345" current-git-id set
-        status-error subject prefix-subject
+        status-error report-subject
     ] with-scope
 ] unit-test
index 302df599b48aa047f9e56c868aeafdac6197b57f..1389a2e27c4dac4d4e5b232ba18add0c95e18057 100644 (file)
@@ -1,35 +1,42 @@
-! Copyright (C) 2008, 2009 Eduardo Cavazos, Slava Pestov.
+! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel namespaces accessors combinators make smtp debugger
 prettyprint sequences io io.streams.string io.encodings.utf8 io.files
 io.sockets mason.common mason.platform mason.config ;
 IN: mason.email
 
-: prefix-subject ( str -- str' )
-    [ "mason on " % platform % ": " % % ] "" make ;
-
-: email-status ( body content-type subject -- )
+: mason-email ( body content-type subject -- )
     <email>
         builder-from get >>from
         builder-recipients get >>to
-        swap prefix-subject >>subject
+        swap >>subject
         swap >>content-type
         swap >>body
     send-email ;
 
-: subject ( status -- str )
-    [ current-git-id get 7 short head " -- " ] dip {
-        { status-clean [ "clean" ] }
-        { status-dirty [ "dirty" ] }
-        { status-error [ "error" ] }
-    } case 3append ;
+: subject-prefix ( -- string )
+    "mason on " platform ": " 3append ;
+
+: report-subject ( status -- string )
+    [
+        subject-prefix %
+        current-git-id get 7 short head %
+        " -- " %
+        {
+            { status-clean [ "clean" ] }
+            { status-dirty [ "dirty" ] }
+            { status-error [ "error" ] }
+        } case %
+    ] "" make ;
 
 : email-report ( report status -- )
-    [ "text/html" ] dip subject email-status ;
+    [ "text/html" ] dip report-subject mason-email ;
 
 : email-error ( error callstack -- )
     [
         "Fatal error on " write host-name print nl
         [ error. ] [ callstack. ] bi*
-    ] with-string-writer "text/plain" "fatal error"
-    email-status ;
+    ] with-string-writer
+    "text/plain"
+    subject-prefix "fatal error" append
+    mason-email ;
index 42f3737e11b0c68bd10a38fbb1f0465d183b593d..3afa56290b5a7a9a2f3e0c4434470f579fdf5a3d 100755 (executable)
@@ -1,8 +1,8 @@
-! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
+! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors calendar continuations debugger io
 io.directories io.files kernel mason.common
-mason.email mason.updates namespaces threads ;
+mason.email mason.updates mason.notify namespaces threads ;
 FROM: mason.build => build ;
 IN: mason
 
@@ -17,6 +17,7 @@ IN: mason
 : build-loop ( -- )
     ?prepare-build-machine
     [
+        notify-heartbeat
         [
             builds/factor set-current-directory
             new-code-available? [ build ] when
index 122c8a47cdd2eff18d8429dbe403516981184bea..144f0de122dd82766a1d5270c81652dab11badfa 100644 (file)
@@ -1,54 +1,50 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays accessors io io.sockets io.encodings.utf8 io.files
-io.launcher kernel make mason.config mason.common mason.email
-mason.twitter namespaces sequences prettyprint fry ;
+USING: accessors fry http.client io io.encodings.utf8 io.files
+kernel mason.common mason.config mason.email mason.twitter
+namespaces prettyprint sequences ;
 IN: mason.notify
 
-: status-notify ( input-file args -- )
-    status-host get [
-        [
-            "ssh" , status-host get , "-l" , status-username get ,
-            "./mason-notify" ,
-            short-host-name ,
-            target-cpu get ,
-            target-os get ,
-        ] { } make prepend
-        [ 5 ] 2dip '[
-            <process>
-                _ >>stdin
-                _ >>command
-            short-running-process
-        ] retry
-    ] [ 2drop ] if ;
+: status-notify ( report arg message -- )
+    [
+        short-host-name "host-name" set
+        target-cpu get "target-cpu" set
+        target-os get "target-os" set
+        status-secret get "secret" set
+        "message" set
+        "arg" set
+        "report" set
+    ] H{ } make-assoc
+    [ 5 ] dip '[ _ status-url get http-post 2drop ] retry ;
+
+: notify-heartbeat ( -- )
+    f f "heartbeat" status-notify ;
 
 : notify-begin-build ( git-id -- )
     [ "Starting build of GIT ID " write print flush ]
-    [ f swap "git-id" swap 2array status-notify ]
+    [ f swap "git-id" status-notify ]
     bi ;
 
 : notify-make-vm ( -- )
     "Compiling VM" print flush
-    f { "make-vm" } status-notify ;
+    f f "make-vm" status-notify ;
 
 : notify-boot ( -- )
     "Bootstrapping" print flush
-    f { "boot" } status-notify ;
+    f f "boot" status-notify ;
 
 : notify-test ( -- )
     "Running tests" print flush
-    f { "test" } status-notify ;
+    f f "test" status-notify ;
 
 : notify-report ( status -- )
     [ "Build finished with status: " write . flush ]
     [
-        [ "report" ] dip
-        [ [ utf8 file-contents ] dip email-report ]
-        [ "report" swap name>> 2array status-notify ]
-        2bi
+        [ "report" utf8 file-contents ] dip
+        [ name>> "report" status-notify ] [ email-report ] 2bi
     ] bi ;
 
 : notify-release ( archive-name -- )
     [ "Uploaded " prepend [ print flush ] [ mason-tweet ] bi ]
-    [ f swap "release" swap 2array status-notify ]
+    [ f swap "release" status-notify ]
     bi ;
index 054b15f0f59a97e5cd58bf8489d585d59d55db73..f3989ab7404f66a3e9b38abf963cd0ccaa9d0a33 100644 (file)
@@ -6,17 +6,14 @@ kernel mason.common namespaces sequences ;
 FROM: mason.config => target-os ;
 IN: mason.release.tidy
 
-: common-files ( -- seq )
+: useless-files ( -- seq )
     "build-support/cleanup" ascii file-lines
-    images [ boot-image-name ] map
-    append ;
-
-: remove-common-files ( -- )
-    common-files [ really-delete-tree ] each ;
-
-: remove-factor-app ( -- )
-    target-os get "macosx" =
-    [ "Factor.app" really-delete-tree ] unless ;
+    images [ boot-image-name ] map append
+    target-os get "macosx" = [ "Factor.app" suffix ] unless ;
 
 : tidy ( -- )
-    "factor" [ remove-factor-app remove-common-files ] with-directory ;
+    "factor" [
+        useless-files
+        [ exists? ] filter
+        [ really-delete-tree ] each
+    ] with-directory ;
diff --git a/extra/mason/server/notify/authors.txt b/extra/mason/server/notify/authors.txt
deleted file mode 100644 (file)
index d4f5d6b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Slava Pestov
\ No newline at end of file
diff --git a/extra/mason/server/notify/notify.factor b/extra/mason/server/notify/notify.factor
deleted file mode 100644 (file)
index 2c04a43..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-! Copyright (C) 2009, 2010 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors calendar combinators combinators.smart
-command-line db.tuples io io.encodings.utf8 io.files kernel
-mason.server namespaces present sequences ;
-IN: mason.server.notify
-
-SYMBOLS: host-name target-os target-cpu message message-arg ;
-
-: parse-args ( command-line -- )
-    dup last message-arg set
-    [
-        {
-            [ host-name set ]
-            [ target-cpu set ]
-            [ target-os set ]
-            [ message set ]
-        } spread
-    ] input<sequence ;
-
-: find-builder ( -- builder )
-    builder new
-        host-name get >>host-name
-        target-os get >>os
-        target-cpu get >>cpu
-    dup select-tuple [ ] [ dup insert-tuple ] ?if ;
-
-: git-id ( builder id -- )
-    >>current-git-id +starting+ >>status drop ;
-
-: make-vm ( builder -- ) +make-vm+ >>status drop ;
-
-: boot ( builder -- ) +boot+ >>status drop ;
-
-: test ( builder -- ) +test+ >>status drop ;
-
-: report ( builder status content -- )
-    [ >>status ] [ >>last-report ] bi*
-    dup status>> +clean+ = [
-        dup current-git-id>> >>clean-git-id
-        dup current-timestamp>> >>clean-timestamp
-    ] when
-    dup current-git-id>> >>last-git-id
-    dup current-timestamp>> >>last-timestamp
-    drop ;
-
-: release ( builder name -- )
-    >>last-release
-    dup clean-git-id>> >>release-git-id
-    drop ;
-
-: update-builder ( builder -- )
-    message get {
-        { "git-id" [ message-arg get git-id ] }
-        { "make-vm" [ make-vm ] }
-        { "boot" [ boot ] }
-        { "test" [ test ] }
-        { "report" [ message-arg get contents report ] }
-        { "release" [ message-arg get release ] }
-    } case ;
-
-: handle-update ( command-line timestamp -- )
-    [
-        [ parse-args find-builder ] dip >>current-timestamp
-        [ update-builder ] [ update-tuple ] bi
-    ] with-mason-db ;
-
-CONSTANT: log-file "resource:mason.log"
-
-: log-update ( command-line timestamp -- )
-    log-file utf8 [
-        present write ": " write " " join print
-    ] with-file-appender ;
-
-: main ( -- )
-    command-line get now [ log-update ] [ handle-update ] 2bi ;
-
-MAIN: main
diff --git a/extra/mason/server/release/authors.txt b/extra/mason/server/release/authors.txt
deleted file mode 100644 (file)
index d4f5d6b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Slava Pestov
\ No newline at end of file
diff --git a/extra/mason/server/release/release.factor b/extra/mason/server/release/release.factor
deleted file mode 100644 (file)
index 04ca295..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-! Copyright (C) 2010 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors calendar db db.tuples db.types grouping io
-io.encodings.ascii io.launcher kernel locals make
-mason.release.archive mason.config mason.platform mason.server
-namespaces sequences ;
-IN: mason.server.release
-
-: platform ( builder -- string )
-    [ os>> ] [ cpu>> ] bi (platform) ;
-
-: package-name ( builder -- string )
-    [ platform ] [ last-release>> ] bi "/" glue ;
-
-: release-name ( version builder -- string )
-    [
-        "releases/" %
-        over % "/" %
-        [ "factor-" % platform % "-" % % ]
-        [ os>> extension % ]
-        bi
-    ] "" make ;
-
-: release-command ( version builder -- command )
-    [
-        "cp " %
-        [ nip package-name % " " % ] [ release-name % ] 2bi
-    ] "" make ;
-
-TUPLE: release
-host-name os cpu
-last-release release-git-id ;
-
-release "RELEASES" {
-    { "host-name" "HOST_NAME" TEXT +user-assigned-id+ }
-    { "os" "OS" TEXT +user-assigned-id+ }
-    { "cpu" "CPU" TEXT +user-assigned-id+ }
-    { "last-release" "LAST_RELEASE" TEXT }
-    { "release-git-id" "RELEASE_GIT_ID" TEXT }
-} define-persistent
-
-:: <release> ( version builder -- release )
-    release new
-        builder host-name>> >>host-name
-        builder os>> >>os
-        builder cpu>> >>cpu
-        builder release-git-id>> >>release-git-id
-        version builder release-name >>last-release ;
-
-: execute-on-server ( string -- )
-    [ "ssh" , upload-host get , "-l" , upload-username get , ] { } make
-    <process>
-        swap >>command
-        5 minutes >>timeout
-    ascii [ write ] with-process-writer ;
-
-: release-script ( version builders -- string )
-    [ upload-directory get "cd " "\n" surround ] 2dip
-    [ release-command ] with map "\n" join
-    append ;
-
-: create-releases ( version builders -- )
-    release-script execute-on-server ;
-
-: update-releases ( version builders -- )
-    [
-        release new delete-tuples
-        [ <release> insert-tuple ] with each
-    ] with-transaction ;
-
-: check-releases ( builders -- )
-    [ release-git-id>> ] map all-equal?
-    [ "Not all builders are up to date" throw ] unless ;
-
-: do-release ( version -- )
-    [
-        builder new select-tuples
-        [ nip check-releases ]
-        [ create-releases ]
-        [ update-releases ]
-        2tri
-    ] with-mason-db ;
diff --git a/extra/mason/source/authors.txt b/extra/mason/source/authors.txt
deleted file mode 100644 (file)
index d4f5d6b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Slava Pestov
\ No newline at end of file
diff --git a/extra/mason/source/source.factor b/extra/mason/source/source.factor
deleted file mode 100644 (file)
index 72c6366..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-! Copyright (C) 2010 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: bootstrap.image bootstrap.image.download io io.directories
-io.directories.hierarchy io.files.unique io.launcher
-io.pathnames kernel sequences namespaces mason.common mason.config ;
-IN: mason.source
-
-: clone-factor ( -- )
-    { "git" "clone" } home "factor" append-path suffix try-process ;
-
-: save-git-id ( -- )
-    git-id "git-id" to-file ;
-
-: delete-git-tree ( -- )
-    ".git" delete-tree ;
-
-: download-images ( -- )
-    images [ download-image ] each ;
-
-: prepare-source ( -- )
-    "factor" [ save-git-id delete-git-tree download-images ] with-directory ;
-
-: package-name ( version -- string )
-    "factor-src-" ".zip" surround ;
-
-: make-tarball ( version -- path )
-    [ { "zip" "-qr9" } ] dip package-name
-    [ suffix "factor" suffix try-process ] keep ;
-
-: make-package ( version -- path )
-    unique-directory
-    [
-        clone-factor prepare-source make-tarball
-        "Package created: " write absolute-path dup print
-    ] with-directory ;
-
-: remote-location ( version -- dest )
-    [ upload-directory get "/releases/" ] dip 3append ;
-
-: remote-archive-name ( version -- dest )
-    [ remote-location ] [ package-name ] bi "/" glue ;
-
-: upload-package ( package version -- )
-    [ upload-username get upload-host get ] dip
-    remote-archive-name
-    upload-safely ;
-
-: release-source-package ( version -- )
-    [ make-package ] [ upload-package ] bi ;
index bd703d3cb9247fc0af936bcd82c81e9bb6e9953a..8e248e861b841443324a5472ad10822bb0a78e8f 100644 (file)
@@ -1,11 +1,11 @@
-! Copyright (C) 2008, 2009 Eduardo Cavazos, Slava Pestov.
+! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs benchmark bootstrap.stage2 compiler.errors
-source-files.errors generic help.html help.lint io.directories
-io.encodings.utf8 io.files kernel mason.common math namespaces
-prettyprint sequences sets sorting tools.test tools.time
-words system io tools.errors vocabs.hierarchy vocabs.errors
-vocabs.refresh locals ;
+USING: accessors assocs benchmark bootstrap.stage2
+compiler.errors generic help.html help.lint io io.directories
+io.encodings.utf8 io.files kernel locals mason.common
+namespaces sequences sets sorting source-files.errors system
+tools.errors tools.test tools.time vocabs.errors
+vocabs.hierarchy vocabs.refresh words ;
 IN: mason.test
 
 : do-load ( -- )
@@ -23,10 +23,11 @@ M: method word-vocabulary "method-generic" word-prop word-vocabulary ;
 :: do-step ( errors summary-file details-file -- )
     errors
     [ error-type +linkage-error+ eq? not ] filter
-    [ file>> ] map prune natural-sort summary-file to-file
+    [ file>> ] map members natural-sort summary-file to-file
     errors details-file utf8 [ errors. ] with-file-writer ;
 
 : do-tests ( -- )
+    forget-tests? on
     test-all test-failures get
     test-all-vocabs-file
     test-all-errors-file
@@ -51,19 +52,21 @@ M: method word-vocabulary "method-generic" word-prop word-vocabulary ;
     compiler-error-messages-file
     do-step ;
 
-: check-boot-image ( -- )
-    "" to-refresh drop 2dup [ empty? not ] either?
-    [
-        "Boot image is out of date. Changed vocabs:" print
-        append prune [ print ] each
-        flush
-        1 exit
-    ] [ 2drop ] if ;
+: outdated-core-vocabs ( -- modified-sources modified-docs any? )
+    "" to-refresh drop 2dup [ empty? not ] either? ;
+
+: outdated-boot-image. ( modified-sources modified-docs -- )
+    "Boot image is out of date. Changed vocabs:" print
+    union [ print ] each
+    flush ;
+
+: check-boot-image ( -- ? )
+    outdated-core-vocabs [ outdated-boot-image. t ] [ 2drop f ] if ;
 
 : do-all ( -- )
     ".." [
         bootstrap-time get boot-time-file to-file
-        check-boot-image
+        check-boot-image [ 1 exit ] when
         [ do-load ] benchmark load-time-file to-file
         [ generate-help ] benchmark html-help-time-file to-file
         [ do-tests ] benchmark test-time-file to-file
index b3f6847c35a755048d33385eb1d064c03e24d590..60a155eae7b3238fa99ff366a668b8a2d3fc1e06 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
+! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel io.launcher bootstrap.image.download
 mason.common mason.platform ;
@@ -20,8 +20,7 @@ IN: mason.updates
     = not ;
 
 : new-image-available? ( -- ? )
-    boot-image-name need-new-image?
-    [ boot-image-arch download-image t ] [ f ] if ;
+    boot-image-name maybe-download-image ;
 
 : new-code-available? ( -- ? )
     updates-available?
diff --git a/extra/mason/version/authors.txt b/extra/mason/version/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/mason/version/binary/authors.txt b/extra/mason/version/binary/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/mason/version/binary/binary.factor b/extra/mason/version/binary/binary.factor
new file mode 100644 (file)
index 0000000..5273b64
--- /dev/null
@@ -0,0 +1,20 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: io kernel make mason.version.common mason.version.files
+sequences ;
+IN: mason.version.binary
+
+: binary-release-command ( version builder -- command )
+    [
+        "cp " %
+        [ nip binary-package-name % " " % ]
+        [ remote-binary-release-name % ]
+        2bi
+    ] "" make ;
+
+: binary-release-script ( version builders -- string )
+    [ binary-release-command ] with map "\n" join ;
+
+: do-binary-release ( version builders -- )
+    "Copying binary releases to release directory..." print flush
+    binary-release-script execute-on-server ;
diff --git a/extra/mason/version/common/authors.txt b/extra/mason/version/common/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/mason/version/common/common.factor b/extra/mason/version/common/common.factor
new file mode 100644 (file)
index 0000000..65d01c3
--- /dev/null
@@ -0,0 +1,12 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors calendar io io.encodings.ascii io.launcher
+kernel make mason.config namespaces ;
+IN: mason.version.common
+
+: execute-on-server ( string -- )
+    [ "ssh" , upload-host get , "-l" , upload-username get , ] { } make
+    <process>
+        swap >>command
+        5 minutes >>timeout
+    ascii [ write ] with-process-writer ;
diff --git a/extra/mason/version/data/authors.txt b/extra/mason/version/data/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/mason/version/data/data.factor b/extra/mason/version/data/data.factor
new file mode 100644 (file)
index 0000000..eb735c9
--- /dev/null
@@ -0,0 +1,54 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors calendar db db.tuples db.types kernel locals
+mason.version.files sequences ;
+IN: mason.version.data
+
+TUPLE: release
+host-name os cpu
+last-release release-git-id ;
+
+release "RELEASES" {
+    { "host-name" "HOST_NAME" TEXT +user-assigned-id+ }
+    { "os" "OS" TEXT +user-assigned-id+ }
+    { "cpu" "CPU" TEXT +user-assigned-id+ }
+    { "last-release" "LAST_RELEASE" TEXT }
+    { "release-git-id" "RELEASE_GIT_ID" TEXT }
+} define-persistent
+
+:: <release> ( version builder -- release )
+    release new
+        builder host-name>> >>host-name
+        builder os>> >>os
+        builder cpu>> >>cpu
+        builder release-git-id>> >>release-git-id
+        version builder binary-release-name >>last-release ;
+
+: update-binary-releases ( version builders -- )
+    [
+        release new delete-tuples
+        [ <release> insert-tuple ] with each
+    ] with-transaction ;
+
+TUPLE: version
+id version git-id timestamp source-path announcement-url ;
+
+version "VERSIONS" {
+    { "id" "ID" INTEGER +db-assigned-id+ }
+    { "version" "VERSION" TEXT }
+    { "git-id" "GIT_ID" TEXT }
+    { "timestamp" "TIMESTAMP" TIMESTAMP }
+    { "source-path" "SOURCE_PATH" TEXT }
+    { "announcement-url" "ANNOUNCEMENT_URL" TEXT }
+} define-persistent
+
+: update-version ( version git-id announcement-url -- )
+    version new
+        swap >>announcement-url
+        swap >>git-id
+        swap [ >>version ] [ source-release-name >>source-path ] bi
+        now >>timestamp
+    insert-tuple ;
+
+: latest-version ( -- version )
+    version new select-tuples last ;
diff --git a/extra/mason/version/files/authors.txt b/extra/mason/version/files/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/mason/version/files/files.factor b/extra/mason/version/files/files.factor
new file mode 100644 (file)
index 0000000..ba09c62
--- /dev/null
@@ -0,0 +1,36 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors fry kernel make mason.config mason.platform
+mason.release.archive namespaces sequences ;
+IN: mason.version.files
+
+: release-directory ( string version -- string )
+    [ "releases/" % % "/" % % ] "" make ;
+
+: remote-directory ( string -- string' )
+    [ upload-directory get ] dip "/" glue ;
+
+: platform ( builder -- string )
+    [ os>> ] [ cpu>> ] bi (platform) ;
+
+: binary-package-name ( builder -- string )
+    [ [ platform % "/" % ] [ last-release>> % ] bi ] "" make
+    remote-directory ;
+
+: binary-release-name ( version builder -- string )
+    [
+        [
+            [ "factor-" % platform % "-" % % ]
+            [ os>> extension % ]
+            bi
+        ] "" make
+    ] [ drop ] 2bi release-directory ;
+
+: remote-binary-release-name ( version builder -- string )
+    binary-release-name remote-directory ;
+
+: source-release-name ( version -- string )
+    [ "factor-src-" ".zip" surround ] keep release-directory ;
+
+: remote-source-release-name ( version -- string )
+    source-release-name remote-directory ;
diff --git a/extra/mason/version/source/authors.txt b/extra/mason/version/source/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/mason/version/source/source.factor b/extra/mason/version/source/source.factor
new file mode 100644 (file)
index 0000000..cc41ee3
--- /dev/null
@@ -0,0 +1,51 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: bootstrap.image bootstrap.image.download io
+io.directories io.directories.hierarchy io.files.unique
+io.launcher io.pathnames kernel mason.common mason.config
+mason.version.files namespaces sequences ;
+IN: mason.version.source
+
+: clone-factor ( -- )
+    { "git" "clone" "git://factorcode.org/git/factor.git" } try-process ;
+
+: git-reset ( git-id -- )
+    { "git" "reset" "--hard" } swap suffix try-process ;
+
+: save-git-id ( git-id -- )
+    "git-id" to-file ;
+
+: delete-git-tree ( -- )
+    ".git" delete-tree
+    ".gitignore" delete-file ;
+
+: download-images ( -- )
+    images [ download-image ] each ;
+
+: prepare-source ( git-id -- )
+    "factor" [
+        [ git-reset ] [ save-git-id ] bi
+        delete-git-tree
+        download-images
+    ] with-directory ;
+
+: (make-source-release) ( version -- path )
+    [ { "zip" "-qr9" } ] dip source-release-name file-name
+    [ suffix "factor" suffix try-process ] keep ;
+
+: make-source-release ( version git-id -- path )
+    "Creating source release..." print flush
+    unique-directory
+    [
+        clone-factor prepare-source (make-source-release)
+        "Package created: " write absolute-path dup print
+    ] with-directory ;
+
+: upload-source-release ( package version -- )
+    "Uploading source release..." print flush
+    [ upload-username get upload-host get ] dip
+    remote-source-release-name
+    upload-safely ;
+
+: do-source-release ( version git-id -- )
+    [ make-source-release ] [ drop upload-source-release ] 2bi ;
diff --git a/extra/mason/version/version.factor b/extra/mason/version/version.factor
new file mode 100644 (file)
index 0000000..bb0fcbf
--- /dev/null
@@ -0,0 +1,52 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors bit.ly combinators db.tuples debugger fry
+grouping io io.streams.string kernel locals make mason.email
+mason.server mason.twitter mason.version.binary
+mason.version.common mason.version.data mason.version.files
+mason.version.source sequences threads ;
+IN: mason.version
+
+: check-releases ( builders -- )
+    [ release-git-id>> ] map all-equal?
+    [ "Some builders are out of date" throw ] unless ;
+
+: make-release-directory ( version -- )
+    "Creating release directory..." print flush
+    [ "mkdir -p " % "" release-directory remote-directory % "\n" % ] "" make
+    execute-on-server ;
+
+: tweet-release ( version announcement-url -- )
+    [
+        "Factor " %
+        [ % " released -- " % ] [ shorten-url % ] bi*
+    ] "" make mason-tweet ;
+
+:: (do-release) ( version announcement-url -- )
+    [
+        builder new select-tuples :> builders
+        builders first release-git-id>> :> git-id
+
+        builders check-releases
+        version make-release-directory
+        version builders do-binary-release
+        version builders update-binary-releases
+        version git-id do-source-release
+        version git-id announcement-url update-version
+        version announcement-url tweet-release
+
+        "Done." print flush
+    ] with-mason-db ;
+
+: send-release-email ( string version -- )
+    [ "text/plain" ] dip "Release output: " prepend mason-email ;
+
+:: do-release ( version announcement-url -- )
+    [
+        [
+            [
+                version announcement-url (do-release)
+            ] try
+        ] with-string-writer
+        version send-release-email
+    ] "Mason release" spawn drop ;
index 01d831d6b0bc34541abbcab1879cc0b5be6d5870..5ccd243a54737a444fd2aaab7b0db3f9665b3889 100644 (file)
@@ -1,7 +1,8 @@
 ! (c)Joe Groff bsd license
-USING: accessors classes.struct fry generalizations kernel locals
-math math.combinatorics math.functions math.matrices.simd math.vectors
-math.vectors.simd math.quaternions sequences sequences.private specialized-arrays
+USING: accessors classes.struct fry generalizations kernel
+locals math math.combinatorics math.functions math.matrices.simd
+math.vectors math.vectors.simd math.quaternions sequences
+sequences.generalizations sequences.private specialized-arrays
 typed ;
 FROM: sequences.private => nth-unsafe ;
 FROM: math.quaternions.private => (q*sign) ;
@@ -28,7 +29,7 @@ M: matrix4 new-sequence 2drop matrix4 (struct) ; inline
     c1 c2 c3 c4 columns 4 set-firstn-unsafe
     c ; inline
 
-: make-matrix4 ( quot: ( -- c1 c2 c3 c4 ) -- c )
+: make-matrix4 ( ..a quot: ( ..a -- ..b c1 c2 c3 c4 ) -- ..b c )
     matrix4 (struct) swap dip set-columns ; inline
 
 :: 2map-columns ( a b quot -- c )
@@ -42,7 +43,7 @@ M: matrix4 new-sequence 2drop matrix4 (struct) ; inline
         a4 b4 quot call
     ] make-matrix4 ; inline
 
-: map-columns ( a quot -- c )
+: map-columns ( ... a quot: ( ... col -- ... newcol ) -- ... c )
     '[ columns _ 4 napply ] make-matrix4 ; inline
     
 PRIVATE>
index 061ce07d1e515d5f5a482f40c08d4d2097234e8f..b78862d225fa10bf784d9f9af6be06dd22525e9d 100644 (file)
@@ -8,10 +8,9 @@ io io.encodings.ascii io.files io.files.temp kernel locals math
 math.matrices math.vectors.simd math.parser math.vectors
 method-chains namespaces sequences splitting threads ui ui.gadgets
 ui.gadgets.worlds ui.pixel-formats specialized-arrays
-specialized-vectors literals fry
-sequences.deep destructors math.bitwise opengl.gl
+specialized-vectors fry sequences.deep destructors math.bitwise opengl.gl
 game.models game.models.obj game.models.loader game.models.collada
-prettyprint images.tga ;
+prettyprint images.tga literals ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: float
 SPECIALIZED-VECTOR: uint
@@ -164,9 +163,9 @@ TUPLE: vbo
     0 0 0 0 glClearColor 
     1 glClearDepth
     HEX: ffffffff glClearStencil
-    { GL_COLOR_BUFFER_BIT
+    flags{ GL_COLOR_BUFFER_BIT
       GL_DEPTH_BUFFER_BIT
-      GL_STENCIL_BUFFER_BIT } flags glClear ;
+      GL_STENCIL_BUFFER_BIT } glClear ;
     
 : draw-model ( world -- )
     clear-screen
@@ -194,7 +193,7 @@ M: model-world wasd-far-plane drop 1024.0 ;
 M: model-world begin-game-world
     init-gpu
     { 0.0 0.0 2.0 } 0 0 set-wasd-view
-    [ <model-state> [ fill-model-state ] keep ] [ (>>model-state) ] bi ;
+    [ <model-state> [ fill-model-state ] keep ] [ model-state<< ] bi ;
 M: model-world apply-world-attributes
     {
         [ model-path>> >>model-path ]
@@ -212,7 +211,7 @@ M: model-world apply-world-attributes
              { windowed double-buffered }
            }
            { pref-dim { 1024 768 } }
-           { tick-interval-micros 16666 }
+           { tick-interval-nanos $[ 60 fps ] }
            { use-game-input? t }
            { model-path model-path }
         }
index 37cf3d115e876afb64db6cfebe7e5b54d128432c..bc20fcd04d2b464072c7a93e5d9cd6a2c0c5a54a 100644 (file)
@@ -13,7 +13,7 @@ M: conditional model-changed
             [ [ value>> ] dip set-model f ]
             [ 2drop t ] if 100 milliseconds sleep 
         ] 2curry "models.conditional" spawn-server
-    ] keep (>>thread) ;
+    ] keep thread<< ;
 
 : <conditional> ( condition -- model )
     f conditional new-model swap >>condition ;
index 8ecd5df54c8de8a74b488c52f453cc6a61c8b841..56e560f07ad924faa86240a29b8f549b0b0304e3 100644 (file)
@@ -1,12 +1,9 @@
 USING: accessors assocs bson.reader bson.writer byte-arrays
-byte-vectors combinators formatting fry io io.binary io.encodings.private
-io.encodings.binary io.encodings.string io.encodings.utf8 io.encodings.utf8.private io.files
-kernel locals math mongodb.msg namespaces sequences uuid bson.writer.private ;
-
-IN: alien.c-types
-
-M: byte-vector byte-length length ;
-
+byte-vectors combinators formatting fry io io.binary
+io.encodings.private io.encodings.binary io.encodings.string
+io.encodings.utf8 io.encodings.utf8.private io.files kernel
+locals math mongodb.msg namespaces sequences uuid
+bson.writer.private ;
 IN: mongodb.operations
 
 <PRIVATE
index 85036c8d86ae4900214b50b4855ed2e676cbe1bf..eeb73141960e2bbad89c1bf22daeacee2c40fdc6 100644 (file)
@@ -44,7 +44,7 @@ PRIVATE>
 M: mdb-persistent id>> ( object -- id )
    dup class id-slot reader-word execute( object -- id ) ;
 
-M: mdb-persistent (>>id) ( object value -- )
+M: mdb-persistent id<< ( object value -- )
    over class id-slot writer-word execute( object value -- ) ;
 
 
index caf37dbadbf7cc1e55ee413ad02e86e86b3b3765..ebe60e00f63567afe405032e7d875ddc431353f8 100644 (file)
@@ -3,9 +3,10 @@
 USING: kernel math sequences vectors classes classes.algebra
 combinators arrays words assocs parser namespaces make
 definitions prettyprint prettyprint.backend prettyprint.custom
-quotations generalizations debugger io compiler.units
-kernel.private effects accessors hashtables sorting shuffle
-math.order sets see effects.parser ;
+quotations generalizations sequences.generalizations debugger io
+compiler.units kernel.private effects accessors hashtables
+sorting shuffle math.order sets see effects.parser ;
+FROM: namespaces => set ;
 IN: multi-methods
 
 ! PART I: Converting hook specializers
index 4d0df1f454e3fad053d8e277d0eac1349c743b79..73b86f53a04184cacff61185e578f340a7e70ce2 100644 (file)
@@ -5,7 +5,7 @@ io.encodings.utf8 io.files kernel sequences system threads
 unix.utilities ;
 IN: native-thread-test
 
-FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, char** argv ) ;
+FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, c-string* argv ) ;
 
 : start-vm-in-os-thread ( args -- threadhandle )
     vm prefix
index d28bbdb9043ca01563ef851b2d66f50b09c6f437..8be2970b92b3690dc5e9731b6140452bb9123c89 100644 (file)
@@ -1,5 +1,6 @@
 USING: arrays kernel math opengl opengl.gl opengl.glu
-opengl.demo-support ui ui.gadgets ui.render literals accessors ;
+opengl.demo-support ui ui.gadgets ui.render ui.pixel-formats
+literals accessors ;
 IN: nehe.2
 
 TUPLE: nehe2-gadget < gadget ;
@@ -8,36 +9,45 @@ CONSTANT: width 256
 CONSTANT: height 256
 
 : <nehe2-gadget> (  -- gadget )
-  nehe2-gadget new ;
+    nehe2-gadget new ;
 
 M: nehe2-gadget draw-gadget* ( gadget -- )
-  drop
-  GL_PROJECTION glMatrixMode
-  glLoadIdentity
-  45.0 width height / >float 0.1 100.0 gluPerspective
-  GL_MODELVIEW glMatrixMode
-  glLoadIdentity
-  GL_SMOOTH glShadeModel
-  0.0 0.0 0.0 0.0 glClearColor
-  1.0 glClearDepth
-  GL_DEPTH_TEST glEnable
-  GL_LEQUAL glDepthFunc
-  GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
-  GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
-  glLoadIdentity
-  -1.5 0.0 -6.0 glTranslatef
-  GL_TRIANGLES [
-    0.0 1.0 0.0 glVertex3f
-    -1.0 -1.0 0.0 glVertex3f
-    1.0 -1.0 0.0 glVertex3f
-  ] do-state
-  3.0 0.0 0.0 glTranslatef
-  GL_QUADS [
-    -1.0 1.0 0.0 glVertex3f
-    1.0 1.0 0.0 glVertex3f
-    1.0 -1.0 0.0 glVertex3f
-    -1.0 -1.0 0.0 glVertex3f
-  ] do-state ;
+    drop
+    GL_PROJECTION glMatrixMode
+    glLoadIdentity
+    45.0 width height / >float 0.1 100.0 gluPerspective
+    GL_MODELVIEW glMatrixMode
+    glLoadIdentity
+    GL_SMOOTH glShadeModel
+    0.0 0.0 0.0 0.0 glClearColor
+    1.0 glClearDepth
+    GL_DEPTH_TEST glEnable
+    GL_LEQUAL glDepthFunc
+    GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
+    GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
+    glLoadIdentity
+    -1.5 0.0 -6.0 glTranslatef
+    GL_TRIANGLES [
+        0.0 1.0 0.0 glVertex3f
+        -1.0 -1.0 0.0 glVertex3f
+        1.0 -1.0 0.0 glVertex3f
+    ] do-state
+    3.0 0.0 0.0 glTranslatef
+    GL_QUADS [
+        -1.0 1.0 0.0 glVertex3f
+        1.0 1.0 0.0 glVertex3f
+        1.0 -1.0 0.0 glVertex3f
+        -1.0 -1.0 0.0 glVertex3f
+    ] do-state ;
 
-MAIN-WINDOW: run2 { { title "NeHe Tutorial 2" } { pref-dim { $ width $ height } } }
-  <nehe2-gadget> >>gadgets ;
+MAIN-WINDOW: run2
+    {
+        { title "NeHe Tutorial 2" }
+        { pref-dim { $ width $ height } }
+        { pixel-format-attributes {
+            windowed
+            double-buffered
+            T{ depth-bits { value 16 } }
+        } }
+    }
+    <nehe2-gadget> >>gadgets ;
index 0cddcfcaa3ca3b62f1753d5f91283ef4a4050a39..377f1f2a00cdfdc2f0558202bb54ae109b7f68ed 100644 (file)
@@ -1,6 +1,6 @@
 USING: arrays kernel math opengl opengl.gl opengl.glu
-opengl.demo-support ui ui.gadgets ui.render threads accessors
-calendar literals ;
+opengl.demo-support ui ui.gadgets ui.render ui.pixel-formats
+threads accessors calendar literals ;
 IN: nehe.4
 
 TUPLE: nehe4-gadget < gadget rtri rquad thread quit? ;
@@ -10,63 +10,72 @@ CONSTANT: height 256
 : redraw-interval ( -- dt ) 10 milliseconds ;
 
 : <nehe4-gadget> (  -- gadget )
-  nehe4-gadget new
+    nehe4-gadget new
     0.0 >>rtri
     0.0 >>rquad ;
 
 M: nehe4-gadget draw-gadget* ( gadget -- )
-  GL_PROJECTION glMatrixMode
-  glLoadIdentity
-  45.0 width height / >float 0.1 100.0 gluPerspective
-  GL_MODELVIEW glMatrixMode
-  glLoadIdentity
-  GL_SMOOTH glShadeModel
-  0.0 0.0 0.0 0.0 glClearColor
-  1.0 glClearDepth
-  GL_DEPTH_TEST glEnable
-  GL_LEQUAL glDepthFunc
-  GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
-  GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
-  glLoadIdentity
-  -1.5 0.0 -6.0 glTranslatef
-  dup rtri>> 0.0 1.0 0.0 glRotatef
+    GL_PROJECTION glMatrixMode
+    glLoadIdentity
+    45.0 width height / >float 0.1 100.0 gluPerspective
+    GL_MODELVIEW glMatrixMode
+    glLoadIdentity
+    GL_SMOOTH glShadeModel
+    0.0 0.0 0.0 0.0 glClearColor
+    1.0 glClearDepth
+    GL_DEPTH_TEST glEnable
+    GL_LEQUAL glDepthFunc
+    GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
+    GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
+    glLoadIdentity
+    -1.5 0.0 -6.0 glTranslatef
+    dup rtri>> 0.0 1.0 0.0 glRotatef
 
-  GL_TRIANGLES [
-    1.0 0.0 0.0 glColor3f
-    0.0 1.0 0.0 glVertex3f
-    0.0 1.0 0.0 glColor3f
-    -1.0 -1.0 0.0 glVertex3f
-    0.0 0.0 1.0 glColor3f
-    1.0 -1.0 0.0 glVertex3f
-  ] do-state
+    GL_TRIANGLES [
+        1.0 0.0 0.0 glColor3f
+        0.0 1.0 0.0 glVertex3f
+        0.0 1.0 0.0 glColor3f
+        -1.0 -1.0 0.0 glVertex3f
+        0.0 0.0 1.0 glColor3f
+        1.0 -1.0 0.0 glVertex3f
+    ] do-state
 
-  glLoadIdentity
+    glLoadIdentity
 
-  1.5 0.0 -6.0 glTranslatef
-  dup rquad>> 1.0 0.0 0.0 glRotatef
-  0.5 0.5 1.0 glColor3f
-  GL_QUADS [
-    -1.0 1.0 0.0 glVertex3f
-    1.0 1.0 0.0 glVertex3f
-    1.0 -1.0 0.0 glVertex3f
-    -1.0 -1.0 0.0 glVertex3f
-  ] do-state
-  [ 0.2 + ] change-rtri
-  [ 0.15 - ] change-rquad drop ;
+    1.5 0.0 -6.0 glTranslatef
+    dup rquad>> 1.0 0.0 0.0 glRotatef
+    0.5 0.5 1.0 glColor3f
+    GL_QUADS [
+        -1.0 1.0 0.0 glVertex3f
+        1.0 1.0 0.0 glVertex3f
+        1.0 -1.0 0.0 glVertex3f
+        -1.0 -1.0 0.0 glVertex3f
+    ] do-state
+    [ 0.2 + ] change-rtri
+    [ 0.15 - ] change-rquad drop ;
 
 : nehe4-update-thread ( gadget -- )
-  dup quit?>> [ drop ] [
-    redraw-interval sleep
-    dup relayout-1
-    nehe4-update-thread
-  ] if ;
+    dup quit?>> [ drop ] [
+        redraw-interval sleep
+        dup relayout-1
+        nehe4-update-thread
+    ] if ;
 
 M: nehe4-gadget graft* ( gadget -- )
-  f >>quit?
-  [ nehe4-update-thread ] curry in-thread ;
+    f >>quit?
+    [ nehe4-update-thread ] curry in-thread ;
 
 M: nehe4-gadget ungraft* ( gadget -- )
-  t >>quit? drop ;
+    t >>quit? drop ;
 
-MAIN-WINDOW: run4 { { title "NeHe Tutorial 4" } { pref-dim { $ width $ height } } }
-  <nehe4-gadget> >>gadgets ;
+MAIN-WINDOW: run4
+    {
+        { title "NeHe Tutorial 4" }
+        { pref-dim { $ width $ height } }
+        { pixel-format-attributes {
+            windowed
+            double-buffered
+            T{ depth-bits { value 16 } }
+        } }
+    }
+    <nehe4-gadget> >>gadgets ;
index e6f5c6e6bac1beccafbb9c40df7e4b18f4aac5db..9fc19e1cfb873bad834acf2d634ba65e88bb7212 100644 (file)
@@ -1,6 +1,6 @@
 USING: arrays kernel math opengl opengl.gl opengl.glu\r
-opengl.demo-support ui ui.gadgets ui.render threads accessors\r
-calendar literals ;\r
+opengl.demo-support ui ui.gadgets ui.render ui.pixel-formats\r
+threads accessors calendar literals ;\r
 IN: nehe.5\r
 \r
 TUPLE: nehe5-gadget < gadget rtri rquad thread quit? ;\r
@@ -9,116 +9,125 @@ CONSTANT: height 256
 : redraw-interval ( -- dt ) 10 milliseconds ;\r
 \r
 : <nehe5-gadget> (  -- gadget )\r
-  nehe5-gadget new\r
+    nehe5-gadget new\r
     0.0 >>rtri\r
     0.0 >>rquad ;\r
 \r
 M: nehe5-gadget draw-gadget* ( gadget -- )\r
-  GL_PROJECTION glMatrixMode\r
-  glLoadIdentity\r
-  45.0 width height / >float 0.1 100.0 gluPerspective\r
-  GL_MODELVIEW glMatrixMode\r
-  glLoadIdentity\r
-  GL_SMOOTH glShadeModel\r
-  0.0 0.0 0.0 0.0 glClearColor\r
-  1.0 glClearDepth\r
-  GL_DEPTH_TEST glEnable\r
-  GL_LEQUAL glDepthFunc\r
-  GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint\r
-  GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear\r
-  glLoadIdentity\r
-  -1.5 0.0 -6.0 glTranslatef\r
-  dup rtri>> 0.0 1.0 0.0 glRotatef\r
-\r
-  GL_TRIANGLES [\r
-    1.0 0.0 0.0 glColor3f\r
-    0.0 1.0 0.0 glVertex3f\r
-    0.0 1.0 0.0 glColor3f\r
-    -1.0 -1.0 1.0 glVertex3f\r
-    0.0 0.0 1.0 glColor3f\r
-    1.0 -1.0 1.0 glVertex3f\r
-\r
-    1.0 0.0 0.0 glColor3f\r
-    0.0 1.0 0.0 glVertex3f\r
-    0.0 0.0 1.0 glColor3f\r
-    1.0 -1.0 1.0 glVertex3f\r
-    0.0 1.0 0.0 glColor3f\r
-    1.0 -1.0 -1.0 glVertex3f\r
-\r
-    1.0 0.0 0.0 glColor3f\r
-    0.0 1.0 0.0 glVertex3f\r
-    0.0 1.0 0.0 glColor3f\r
-    1.0 -1.0 -1.0 glVertex3f\r
-    0.0 0.0 1.0 glColor3f\r
-    -1.0 -1.0 -1.0 glVertex3f\r
-\r
-    1.0 0.0 0.0 glColor3f\r
-    0.0 1.0 0.0 glVertex3f\r
-    0.0 0.0 1.0 glColor3f\r
-    -1.0 -1.0 -1.0 glVertex3f\r
-    0.0 1.0 0.0 glColor3f\r
-    -1.0 -1.0 1.0 glVertex3f\r
-  ] do-state\r
-\r
-  glLoadIdentity\r
-\r
-  1.5 0.0 -7.0 glTranslatef\r
-  dup rquad>> 1.0 0.0 0.0 glRotatef\r
-  GL_QUADS [\r
-    0.0 1.0 0.0 glColor3f\r
-    1.0 1.0 -1.0 glVertex3f\r
-    -1.0 1.0 -1.0 glVertex3f\r
-    -1.0 1.0 1.0 glVertex3f\r
-    1.0 1.0 1.0 glVertex3f\r
-\r
-    1.0 0.5 0.0 glColor3f\r
-    1.0 -1.0 1.0 glVertex3f\r
-    -1.0 -1.0 1.0 glVertex3f\r
-    -1.0 -1.0 -1.0 glVertex3f\r
-    1.0 -1.0 -1.0 glVertex3f\r
-\r
-    1.0 0.0 0.0 glColor3f\r
-    1.0 1.0 1.0 glVertex3f\r
-    -1.0 1.0 1.0 glVertex3f\r
-    -1.0 -1.0 1.0 glVertex3f\r
-    1.0 -1.0 1.0 glVertex3f\r
-\r
-    1.0 1.0 0.0 glColor3f\r
-    1.0 -1.0 -1.0 glVertex3f\r
-    -1.0 -1.0 -1.0 glVertex3f\r
-    -1.0 1.0 -1.0 glVertex3f\r
-    1.0 1.0 -1.0 glVertex3f\r
-\r
-    0.0 0.0 1.0 glColor3f\r
-    -1.0 1.0 1.0 glVertex3f\r
-    -1.0 1.0 -1.0 glVertex3f\r
-    -1.0 -1.0 -1.0 glVertex3f\r
-    -1.0 -1.0 1.0 glVertex3f\r
-\r
-    1.0 0.0 1.0 glColor3f\r
-    1.0 1.0 -1.0 glVertex3f\r
-    1.0 1.0 1.0 glVertex3f\r
-    1.0 -1.0 1.0 glVertex3f\r
-    1.0 -1.0 -1.0 glVertex3f\r
-  ] do-state \r
-  [ 0.2 + ] change-rtri\r
-  [ 0.15 - ] change-rquad drop ;\r
-\r
-: nehe5-update-thread ( gadget -- )  \r
-  dup quit?>> [\r
-    drop\r
-  ] [\r
-    redraw-interval sleep \r
-    dup relayout-1  \r
-    nehe5-update-thread \r
-  ] if ;\r
+    GL_PROJECTION glMatrixMode\r
+    glLoadIdentity\r
+    45.0 width height / >float 0.1 100.0 gluPerspective\r
+    GL_MODELVIEW glMatrixMode\r
+    glLoadIdentity\r
+    GL_SMOOTH glShadeModel\r
+    0.0 0.0 0.0 0.0 glClearColor\r
+    1.0 glClearDepth\r
+    GL_DEPTH_TEST glEnable\r
+    GL_LEQUAL glDepthFunc\r
+    GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint\r
+    GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear\r
+    glLoadIdentity\r
+    -1.5 0.0 -6.0 glTranslatef\r
+    dup rtri>> 0.0 1.0 0.0 glRotatef\r
+\r
+    GL_TRIANGLES [\r
+        1.0 0.0 0.0 glColor3f\r
+        0.0 1.0 0.0 glVertex3f\r
+        0.0 1.0 0.0 glColor3f\r
+        -1.0 -1.0 1.0 glVertex3f\r
+        0.0 0.0 1.0 glColor3f\r
+        1.0 -1.0 1.0 glVertex3f\r
+\r
+        1.0 0.0 0.0 glColor3f\r
+        0.0 1.0 0.0 glVertex3f\r
+        0.0 0.0 1.0 glColor3f\r
+        1.0 -1.0 1.0 glVertex3f\r
+        0.0 1.0 0.0 glColor3f\r
+        1.0 -1.0 -1.0 glVertex3f\r
+\r
+        1.0 0.0 0.0 glColor3f\r
+        0.0 1.0 0.0 glVertex3f\r
+        0.0 1.0 0.0 glColor3f\r
+        1.0 -1.0 -1.0 glVertex3f\r
+        0.0 0.0 1.0 glColor3f\r
+        -1.0 -1.0 -1.0 glVertex3f\r
+\r
+        1.0 0.0 0.0 glColor3f\r
+        0.0 1.0 0.0 glVertex3f\r
+        0.0 0.0 1.0 glColor3f\r
+        -1.0 -1.0 -1.0 glVertex3f\r
+        0.0 1.0 0.0 glColor3f\r
+        -1.0 -1.0 1.0 glVertex3f\r
+    ] do-state\r
+\r
+    glLoadIdentity\r
+\r
+    1.5 0.0 -7.0 glTranslatef\r
+    dup rquad>> 1.0 0.0 0.0 glRotatef\r
+    GL_QUADS [\r
+        0.0 1.0 0.0 glColor3f\r
+        1.0 1.0 -1.0 glVertex3f\r
+        -1.0 1.0 -1.0 glVertex3f\r
+        -1.0 1.0 1.0 glVertex3f\r
+        1.0 1.0 1.0 glVertex3f\r
+\r
+        1.0 0.5 0.0 glColor3f\r
+        1.0 -1.0 1.0 glVertex3f\r
+        -1.0 -1.0 1.0 glVertex3f\r
+        -1.0 -1.0 -1.0 glVertex3f\r
+        1.0 -1.0 -1.0 glVertex3f\r
+\r
+        1.0 0.0 0.0 glColor3f\r
+        1.0 1.0 1.0 glVertex3f\r
+        -1.0 1.0 1.0 glVertex3f\r
+        -1.0 -1.0 1.0 glVertex3f\r
+        1.0 -1.0 1.0 glVertex3f\r
+\r
+        1.0 1.0 0.0 glColor3f\r
+        1.0 -1.0 -1.0 glVertex3f\r
+        -1.0 -1.0 -1.0 glVertex3f\r
+        -1.0 1.0 -1.0 glVertex3f\r
+        1.0 1.0 -1.0 glVertex3f\r
+\r
+        0.0 0.0 1.0 glColor3f\r
+        -1.0 1.0 1.0 glVertex3f\r
+        -1.0 1.0 -1.0 glVertex3f\r
+        -1.0 -1.0 -1.0 glVertex3f\r
+        -1.0 -1.0 1.0 glVertex3f\r
+\r
+        1.0 0.0 1.0 glColor3f\r
+        1.0 1.0 -1.0 glVertex3f\r
+        1.0 1.0 1.0 glVertex3f\r
+        1.0 -1.0 1.0 glVertex3f\r
+        1.0 -1.0 -1.0 glVertex3f\r
+    ] do-state\r
+    [ 0.2 + ] change-rtri\r
+    [ 0.15 - ] change-rquad drop ;\r
+\r
+: nehe5-update-thread ( gadget -- )\r
+    dup quit?>> [\r
+        drop\r
+    ] [\r
+        redraw-interval sleep\r
+        dup relayout-1\r
+        nehe5-update-thread\r
+    ] if ;\r
 \r
 M: nehe5-gadget graft* ( gadget -- )\r
-  f >>quit?\r
-  [ nehe5-update-thread ] curry in-thread ;\r
+    f >>quit?\r
+    [ nehe5-update-thread ] curry in-thread ;\r
 \r
 M: nehe5-gadget ungraft* ( gadget -- )\r
-  t >>quit? drop ;\r
-\r
-MAIN-WINDOW: run5 { { title "NeHe Tutorial 5" } { pref-dim { $ width $ height } } }\r
-  <nehe5-gadget> >>gadgets ;\r
+    t >>quit? drop ;\r
+\r
+MAIN-WINDOW: run5\r
+    {\r
+        { title "NeHe Tutorial 5" }\r
+        { pref-dim { $ width $ height } }\r
+        { pixel-format-attributes {\r
+            windowed\r
+            double-buffered\r
+            T{ depth-bits { value 16 } }\r
+        } }\r
+    }\r
+    <nehe5-gadget> >>gadgets ;\r
index 9204fa55f124473314b2f452a7ff8e0e5fb9cd0a..9417a868a0c0e089d04b9e345bad8a99c8783252 100644 (file)
@@ -124,7 +124,7 @@ MEMO: perlin-noise-map-coords ( dim -- coords )
 
 TYPED:: perlin-noise-map ( table: byte-array transform: matrix4 coords: float-4-array -- map: float-array )
     coords [| coord | table transform coord m4.v perlin-noise ] data-map( float-4 -- c:float )
-    byte-array>float-array ;
+    float-array-cast ;
 
 : perlin-noise-image ( table transform dim -- image )
     [ perlin-noise-map-coords perlin-noise-map ] [ 5/7. 0.5 float-map>image ] bi ;
index d7abece8bc4b50da2ee1ea422458ae3b484ef6bd..51e462147618b2d415dca1f0bb1b418e246a8284 100644 (file)
@@ -18,7 +18,7 @@ IN: ogg
     { [ os winnt? ]  [ "ogg.dll" ] }
     { [ os macosx? ] [ "libogg.0.dylib" ] }
     { [ os unix? ]   [ "libogg.so" ] }
-} cond "cdecl" add-library
+} cond cdecl add-library
 
 "ogg" deploy-library
 >>
index c9141fb9e31f2a4708dedf9555945bd559d2f90d..82f4a7db5166e12b49b2991d8d7ebfbe333d2ee5 100644 (file)
@@ -19,13 +19,13 @@ IN: ogg.theora
     { [ os winnt? ]  [ "theoradec.dll" ] }
     { [ os macosx? ] [ "libtheoradec.0.dylib" ] }
     { [ os unix? ]   [ "libtheoradec.so" ] }
-} cond "cdecl" add-library
+} cond cdecl add-library
 
 "theoraenc" {
     { [ os winnt? ]  [ "theoraenc.dll" ] }
     { [ os macosx? ] [ "libtheoraenc.0.dylib" ] }
     { [ os unix? ]   [ "libtheoraenc.so" ] }
-} cond "cdecl" add-library
+} cond cdecl add-library
 >>
 
 CONSTANT: TH-EFAULT      -1
@@ -80,10 +80,10 @@ STRUCT: th-info
 ;
 
 STRUCT: th-comment
-    { user-comments char** }
+    { user-comments c-string* }
     { comment-lengths int* }
     { comments int }
-    { vendor char* }
+    { vendor c-string }
 ;
 
 TYPEDEF: uchar[64] th-quant-base
@@ -110,7 +110,7 @@ STRUCT: th-huff-code
 ;
 
 LIBRARY: theoradec
-FUNCTION: char* th_version_string ( ) ;
+FUNCTION: c-string th_version_string ( ) ;
 FUNCTION: uint th_version_number ( ) ;
 FUNCTION: longlong th_granule_frame ( void* encdec, longlong granpos) ;
 FUNCTION: int th_packet_isheader ( ogg-packet* op ) ;
@@ -118,10 +118,10 @@ FUNCTION: int th_packet_iskeyframe ( ogg-packet* op ) ;
 FUNCTION: void th_info_init ( th-info* info ) ;
 FUNCTION: void th_info_clear ( th-info* info ) ;
 FUNCTION: void th_comment_init ( th-comment* tc ) ;
-FUNCTION: void th_comment_add ( th-comment* tc, char* comment ) ;
-FUNCTION: void th_comment_add_tag ( th-comment* tc, char* tag, char* value ) ;
-FUNCTION: char* th_comment_query ( th-comment* tc, char* tag, int count ) ;
-FUNCTION: int   th_comment_query_count ( th-comment* tc, char* tag ) ;
+FUNCTION: void th_comment_add ( th-comment* tc, c-string comment ) ;
+FUNCTION: void th_comment_add_tag ( th-comment* tc, c-string tag, c-string value ) ;
+FUNCTION: c-string th_comment_query ( th-comment* tc, c-string tag, int count ) ;
+FUNCTION: int   th_comment_query_count ( th-comment* tc, c-string tag ) ;
 FUNCTION: void  th_comment_clear ( th-comment* tc ) ;
 
 CONSTANT: TH-ENCCTL-SET-HUFFMAN-CODES 0
index d5905dac9e7af006ecba3ea8867b62d53b973029..3cefbeebec517a7f7e4b25b607ae1822620b5c5c 100644 (file)
@@ -19,7 +19,7 @@ IN: ogg.vorbis
     { [ os winnt? ]  [ "vorbis.dll" ] }
     { [ os macosx? ] [ "libvorbis.0.dylib" ] }
     { [ os unix? ]   [ "libvorbis.so" ] }
-} cond "cdecl" add-library 
+} cond cdecl add-library 
 
 "vorbis" deploy-library
 >>
@@ -90,20 +90,20 @@ STRUCT: vorbis-block
     ;
 
 STRUCT: vorbis-comment
-    { usercomments char** }
+    { usercomments c-string* }
     { comment_lengths int* }
     { comments int }
-    { vendor char* }
+    { vendor c-string }
     ;
 
 FUNCTION: void     vorbis_info_init ( vorbis-info* vi ) ;
 FUNCTION: void     vorbis_info_clear ( vorbis-info* vi ) ;
 FUNCTION: int      vorbis_info_blocksize ( vorbis-info* vi, int zo ) ;
 FUNCTION: void     vorbis_comment_init ( vorbis-comment* vc ) ;
-FUNCTION: void     vorbis_comment_add ( vorbis-comment* vc, char* comment ) ;
-FUNCTION: void     vorbis_comment_add_tag ( vorbis-comment* vc, char* tag, char* contents ) ;
-FUNCTION: char*    vorbis_comment_query ( vorbis-comment* vc, char* tag, int count ) ;
-FUNCTION: int      vorbis_comment_query_count ( vorbis-comment* vc, char* tag ) ;
+FUNCTION: void     vorbis_comment_add ( vorbis-comment* vc, c-string comment ) ;
+FUNCTION: void     vorbis_comment_add_tag ( vorbis-comment* vc, c-string tag, c-string contents ) ;
+FUNCTION: c-string    vorbis_comment_query ( vorbis-comment* vc, c-string tag, int count ) ;
+FUNCTION: int      vorbis_comment_query_count ( vorbis-comment* vc, c-string tag ) ;
 FUNCTION: void     vorbis_comment_clear ( vorbis-comment* vc ) ;
 FUNCTION: int      vorbis_block_init ( vorbis-dsp-state* v, vorbis-block* vb ) ;
 FUNCTION: int      vorbis_block_clear ( vorbis-block* vb ) ;
index 9e37d9886c3aeac94af4878b6f44bc52a5116e26..07b2e4c2b610bf09585040a4801706354628c269 100755 (executable)
@@ -14,7 +14,7 @@ IN: openal.alut
             "/System/Library/Frameworks/OpenAL.framework/OpenAL"
         ] }
         { [ os unix?  ]  [ "libalut.so" ] }
-    } cond "cdecl" add-library >>
+    } cond cdecl add-library >>
 
 << os macosx? [ "alut" deploy-library ] unless >>
 
@@ -49,20 +49,20 @@ CONSTANT: ALUT_WAVEFORM_IMPULSE HEX: 104
 CONSTANT: ALUT_LOADER_BUFFER HEX: 300
 CONSTANT: ALUT_LOADER_MEMORY HEX: 301
 
-FUNCTION: ALboolean alutInit ( int* argcp, char** argv ) ;
-FUNCTION: ALboolean alutInitWithoutContext ( int* argcp, char** argv ) ;
+FUNCTION: ALboolean alutInit ( int* argcp, c-string* argv ) ;
+FUNCTION: ALboolean alutInitWithoutContext ( int* argcp, c-string* argv ) ;
 FUNCTION: ALboolean alutExit ( ) ;
 FUNCTION: ALenum alutGetError ( ) ;
-FUNCTION: char* alutGetErrorString ( ALenum error ) ;
-FUNCTION: ALuint alutCreateBufferFromFile ( char* fileName ) ;
+FUNCTION: c-string alutGetErrorString ( ALenum error ) ;
+FUNCTION: ALuint alutCreateBufferFromFile ( c-string fileName ) ;
 FUNCTION: ALuint alutCreateBufferFromFileImage ( void* data, ALsizei length ) ;
 FUNCTION: ALuint alutCreateBufferHelloWorld ( ) ;
 FUNCTION: ALuint alutCreateBufferWaveform ( ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration ) ;
-FUNCTION: void* alutLoadMemoryFromFile ( char* fileName, ALenum* format, ALsizei* size, ALfloat* frequency ) ;
+FUNCTION: void* alutLoadMemoryFromFile ( c-string fileName, ALenum* format, ALsizei* size, ALfloat* frequency ) ;
 FUNCTION: void* alutLoadMemoryFromFileImage ( void* data, ALsizei length, ALenum* format, ALsizei* size, ALfloat* frequency ) ;
 FUNCTION: void* alutLoadMemoryHelloWorld ( ALenum* format, ALsizei* size, ALfloat* frequency ) ;
 FUNCTION: void* alutLoadMemoryWaveform ( ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration, ALenum* format, ALsizei* size, ALfloat* freq ) ;
-FUNCTION: char* alutGetMIMETypes ( ALenum loader ) ;
+FUNCTION: c-string alutGetMIMETypes ( ALenum loader ) ;
 FUNCTION: ALint alutGetMajorVersion ( ) ;
 FUNCTION: ALint alutGetMinorVersion ( ) ;
 FUNCTION: ALboolean alutSleep ( ALfloat duration ) ;
index bbe61f9dc377f750b26db9dc0c60c365671c6966..853b33b38627b2a1d31034000be6006d2acd6c72 100755 (executable)
@@ -14,7 +14,7 @@ IN: openal
             "/System/Library/Frameworks/OpenAL.framework/OpenAL"
         ] }
         { [ os unix?  ]  [ "libopenal.so" ] }
-    } cond "cdecl" add-library >>
+    } cond cdecl add-library >>
 
 << os macosx? [ "openal" deploy-library ] unless >>
 
diff --git a/extra/opencl/authors.txt b/extra/opencl/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/opencl/ffi/authors.txt b/extra/opencl/ffi/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/opencl/ffi/ffi-tests.factor b/extra/opencl/ffi/ffi-tests.factor
new file mode 100644 (file)
index 0000000..1ec96e4
--- /dev/null
@@ -0,0 +1,74 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: tools.test opencl.ffi multiline locals kernel io.encodings.ascii
+io.encodings.string sequences libc alien.c-types destructors math specialized-arrays
+math.order alien ;
+FROM: alien.c-types => float ;
+SPECIALIZED-ARRAYS: float void* ;
+IN: opencl.ffi.tests
+
+STRING: kernel-source
+__kernel void square(
+    __global float* input,
+    __global float* output,
+    const unsigned int count)
+{
+    int i = get_global_id(0);
+    if (i < count)
+        output[i] = input[i] * input[i];
+}
+;
+
+ERROR: cl-error err ;
+: cl-success ( err -- )
+    dup CL_SUCCESS = [ drop ] [ cl-error ] if ;
+
+:: cl-string-array ( str -- alien )
+    str ascii encode 0 suffix :> str-buffer
+    str-buffer length malloc &free :> str-alien 
+    str-alien str-buffer dup length memcpy str-alien ;
+    
+:: opencl-square ( in -- out )
+    0 f 0 <uint> [ clGetPlatformIDs cl-success ] keep *uint
+    dup <void*-array> [ f clGetPlatformIDs cl-success ] keep first
+    CL_DEVICE_TYPE_DEFAULT 1 f <void*> [ f clGetDeviceIDs cl-success ] keep *void* :> device-id
+    f 1 device-id <void*> f f 0 <int> [ clCreateContext ] keep *int cl-success   :> context
+    context device-id 0 0 <int> [ clCreateCommandQueue ] keep *int cl-success    :> queue
+    [
+        context 1 kernel-source cl-string-array <void*>
+        f 0 <int> [ clCreateProgramWithSource ] keep *int cl-success
+        [ 0 f f f f clBuildProgram cl-success ]
+        [ "square" cl-string-array 0 <int> [ clCreateKernel ] keep *int cl-success ]
+        [ ] tri
+    ] with-destructors :> ( kernel program )
+
+    context CL_MEM_READ_ONLY in byte-length f
+    0 <int> [ clCreateBuffer ] keep *int cl-success :> input
+    
+    context CL_MEM_WRITE_ONLY in byte-length f
+    0 <int> [ clCreateBuffer ] keep *int cl-success :> output
+
+    queue input CL_TRUE 0 in byte-length in 0 f f clEnqueueWriteBuffer cl-success
+
+    kernel 0 cl_mem heap-size input <void*> clSetKernelArg cl-success
+    kernel 1 cl_mem heap-size output <void*> clSetKernelArg cl-success
+    kernel 2 uint heap-size in length <uint> clSetKernelArg cl-success
+    queue kernel 1 f in length <ulonglong> f
+    0 f f clEnqueueNDRangeKernel cl-success
+    queue clFinish cl-success
+
+    queue output CL_TRUE 0 in byte-length in length <float-array>
+    [ 0 f f clEnqueueReadBuffer cl-success ] keep
+
+    input clReleaseMemObject cl-success
+    output clReleaseMemObject cl-success
+    program clReleaseProgram cl-success
+    kernel clReleaseKernel cl-success
+    queue clReleaseCommandQueue cl-success
+    context clReleaseContext cl-success ;
+
+[ float-array{ 1.0 4.0 9.0 16.0 100.0 } ]
+[ float-array{ 1.0 2.0 3.0 4.0 10.0 } opencl-square ] unit-test
diff --git a/extra/opencl/ffi/ffi.factor b/extra/opencl/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..c3a053d
--- /dev/null
@@ -0,0 +1,619 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.libraries alien.syntax
+classes.struct combinators system alien.accessors byte-arrays
+kernel ;
+IN: opencl.ffi
+
+<< "opencl" {
+        { [ os windows? ] [ "OpenCL.dll" stdcall ] }
+        { [ os macosx? ] [ "/System/Library/Frameworks/OpenCL.framework/OpenCL" cdecl ] }
+        { [ os unix? ] [ "libOpenCL.so" cdecl ] }
+    } cond add-library >>
+LIBRARY: opencl
+
+! cl_platform.h
+TYPEDEF: char      cl_char
+TYPEDEF: uchar     cl_uchar
+TYPEDEF: short     cl_short
+TYPEDEF: ushort    cl_ushort
+TYPEDEF: int       cl_int
+TYPEDEF: uint      cl_uint
+TYPEDEF: longlong  cl_long
+TYPEDEF: ulonglong cl_ulong
+TYPEDEF: ushort    cl_half
+TYPEDEF: float     cl_float
+TYPEDEF: double    cl_double
+
+CONSTANT: CL_CHAR_BIT         8
+CONSTANT: CL_SCHAR_MAX        127
+CONSTANT: CL_SCHAR_MIN        -128
+CONSTANT: CL_CHAR_MAX         127
+CONSTANT: CL_CHAR_MIN         -128
+CONSTANT: CL_UCHAR_MAX        255
+CONSTANT: CL_SHRT_MAX         32767
+CONSTANT: CL_SHRT_MIN         -32768
+CONSTANT: CL_USHRT_MAX        65535
+CONSTANT: CL_INT_MAX          2147483647
+CONSTANT: CL_INT_MIN          -2147483648
+CONSTANT: CL_UINT_MAX         HEX: ffffffff
+CONSTANT: CL_LONG_MAX         HEX: 7FFFFFFFFFFFFFFF
+CONSTANT: CL_LONG_MIN         HEX: 8000000000000000
+CONSTANT: CL_ULONG_MAX        HEX: FFFFFFFFFFFFFFFF
+
+CONSTANT: CL_FLT_DIG          6
+CONSTANT: CL_FLT_MANT_DIG     24
+CONSTANT: CL_FLT_MAX_10_EXP   38
+CONSTANT: CL_FLT_MAX_EXP      128
+CONSTANT: CL_FLT_MIN_10_EXP   -37
+CONSTANT: CL_FLT_MIN_EXP      -125
+CONSTANT: CL_FLT_RADIX        2
+CONSTANT: CL_FLT_MAX          340282346638528859811704183484516925440.0
+CONSTANT: CL_FLT_MIN          1.175494350822287507969e-38
+CONSTANT: CL_FLT_EPSILON      HEX: 1.0p-23
+
+CONSTANT: CL_DBL_DIG          15
+CONSTANT: CL_DBL_MANT_DIG     53
+CONSTANT: CL_DBL_MAX_10_EXP   308
+CONSTANT: CL_DBL_MAX_EXP      1024
+CONSTANT: CL_DBL_MIN_10_EXP   -307
+CONSTANT: CL_DBL_MIN_EXP      -1021
+CONSTANT: CL_DBL_RADIX        2
+CONSTANT: CL_DBL_MAX          179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
+CONSTANT: CL_DBL_MIN          2.225073858507201383090e-308
+CONSTANT: CL_DBL_EPSILON      2.220446049250313080847e-16
+
+CONSTANT: CL_NAN              NAN: 0
+CONSTANT: CL_HUGE_VALF        1.0e50
+CONSTANT: CL_HUGE_VAL         1.0e500
+CONSTANT: CL_MAXFLOAT         340282346638528859811704183484516925440.0
+CONSTANT: CL_INFINITY         1.0e50
+
+TYPEDEF: uint cl_GLuint
+TYPEDEF: int  cl_GLint
+TYPEDEF: uint cl_GLenum
+
+! cl.h
+C-TYPE: _cl_platform_id
+C-TYPE: _cl_device_id
+C-TYPE: _cl_context
+C-TYPE: _cl_command_queue
+C-TYPE: _cl_mem
+C-TYPE: _cl_program
+C-TYPE: _cl_kernel
+C-TYPE: _cl_event
+C-TYPE: _cl_sampler
+
+TYPEDEF: _cl_platform_id*    cl_platform_id
+TYPEDEF: _cl_device_id*      cl_device_id
+TYPEDEF: _cl_context*        cl_context
+TYPEDEF: _cl_command_queue*  cl_command_queue
+TYPEDEF: _cl_mem*            cl_mem
+TYPEDEF: _cl_program*        cl_program
+TYPEDEF: _cl_kernel*         cl_kernel
+TYPEDEF: _cl_event*          cl_event
+TYPEDEF: _cl_sampler*        cl_sampler
+
+TYPEDEF: cl_uint             cl_bool
+TYPEDEF: cl_ulong            cl_bitfield
+TYPEDEF: cl_bitfield         cl_device_type
+TYPEDEF: cl_uint             cl_platform_info
+TYPEDEF: cl_uint             cl_device_info
+TYPEDEF: cl_bitfield         cl_device_address_info
+TYPEDEF: cl_bitfield         cl_device_fp_config
+TYPEDEF: cl_uint             cl_device_mem_cache_type
+TYPEDEF: cl_uint             cl_device_local_mem_type
+TYPEDEF: cl_bitfield         cl_device_exec_capabilities
+TYPEDEF: cl_bitfield         cl_command_queue_properties
+
+TYPEDEF: intptr_t            cl_context_properties
+TYPEDEF: cl_uint             cl_context_info
+TYPEDEF: cl_uint             cl_command_queue_info
+TYPEDEF: cl_uint             cl_channel_order
+TYPEDEF: cl_uint             cl_channel_type
+TYPEDEF: cl_bitfield         cl_mem_flags
+TYPEDEF: cl_uint             cl_mem_object_type
+TYPEDEF: cl_uint             cl_mem_info
+TYPEDEF: cl_uint             cl_image_info
+TYPEDEF: cl_uint             cl_addressing_mode
+TYPEDEF: cl_uint             cl_filter_mode
+TYPEDEF: cl_uint             cl_sampler_info
+TYPEDEF: cl_bitfield         cl_map_flags
+TYPEDEF: cl_uint             cl_program_info
+TYPEDEF: cl_uint             cl_program_build_info
+TYPEDEF: cl_int              cl_build_status
+TYPEDEF: cl_uint             cl_kernel_info
+TYPEDEF: cl_uint             cl_kernel_work_group_info
+TYPEDEF: cl_uint             cl_event_info
+TYPEDEF: cl_uint             cl_command_type
+TYPEDEF: cl_uint             cl_profiling_info
+
+STRUCT: cl_image_format
+    { image_channel_order        cl_channel_order }
+    { image_channel_data_type    cl_channel_type  } ;
+
+CONSTANT: CL_SUCCESS                                  0
+CONSTANT: CL_DEVICE_NOT_FOUND                         -1
+CONSTANT: CL_DEVICE_NOT_AVAILABLE                     -2
+CONSTANT: CL_COMPILER_NOT_AVAILABLE                   -3
+CONSTANT: CL_MEM_OBJECT_ALLOCATION_FAILURE            -4
+CONSTANT: CL_OUT_OF_RESOURCES                         -5
+CONSTANT: CL_OUT_OF_HOST_MEMORY                       -6
+CONSTANT: CL_PROFILING_INFO_NOT_AVAILABLE             -7
+CONSTANT: CL_MEM_COPY_OVERLAP                         -8
+CONSTANT: CL_IMAGE_FORMAT_MISMATCH                    -9
+CONSTANT: CL_IMAGE_FORMAT_NOT_SUPPORTED               -10
+CONSTANT: CL_BUILD_PROGRAM_FAILURE                    -11
+CONSTANT: CL_MAP_FAILURE                              -12
+
+CONSTANT: CL_INVALID_VALUE                            -30
+CONSTANT: CL_INVALID_DEVICE_TYPE                      -31
+CONSTANT: CL_INVALID_PLATFORM                         -32
+CONSTANT: CL_INVALID_DEVICE                           -33
+CONSTANT: CL_INVALID_CONTEXT                          -34
+CONSTANT: CL_INVALID_QUEUE_PROPERTIES                 -35
+CONSTANT: CL_INVALID_COMMAND_QUEUE                    -36
+CONSTANT: CL_INVALID_HOST_PTR                         -37
+CONSTANT: CL_INVALID_MEM_OBJECT                       -38
+CONSTANT: CL_INVALID_IMAGE_FORMAT_DESCRIPTOR          -39
+CONSTANT: CL_INVALID_IMAGE_SIZE                       -40
+CONSTANT: CL_INVALID_SAMPLER                          -41
+CONSTANT: CL_INVALID_BINARY                           -42
+CONSTANT: CL_INVALID_BUILD_OPTIONS                    -43
+CONSTANT: CL_INVALID_PROGRAM                          -44
+CONSTANT: CL_INVALID_PROGRAM_EXECUTABLE               -45
+CONSTANT: CL_INVALID_KERNEL_NAME                      -46
+CONSTANT: CL_INVALID_KERNEL_DEFINITION                -47
+CONSTANT: CL_INVALID_KERNEL                           -48
+CONSTANT: CL_INVALID_ARG_INDEX                        -49
+CONSTANT: CL_INVALID_ARG_VALUE                        -50
+CONSTANT: CL_INVALID_ARG_SIZE                         -51
+CONSTANT: CL_INVALID_KERNEL_ARGS                      -52
+CONSTANT: CL_INVALID_WORK_DIMENSION                   -53
+CONSTANT: CL_INVALID_WORK_GROUP_SIZE                  -54
+CONSTANT: CL_INVALID_WORK_ITEM_SIZE                   -55
+CONSTANT: CL_INVALID_GLOBAL_OFFSET                    -56
+CONSTANT: CL_INVALID_EVENT_WAIT_LIST                  -57
+CONSTANT: CL_INVALID_EVENT                            -58
+CONSTANT: CL_INVALID_OPERATION                        -59
+CONSTANT: CL_INVALID_GL_OBJECT                        -60
+CONSTANT: CL_INVALID_BUFFER_SIZE                      -61
+CONSTANT: CL_INVALID_MIP_LEVEL                        -62
+CONSTANT: CL_INVALID_GLOBAL_WORK_SIZE                 -63
+
+CONSTANT: CL_VERSION_1_0                              1
+
+CONSTANT: CL_FALSE                                    0
+CONSTANT: CL_TRUE                                     1
+
+CONSTANT: CL_PLATFORM_PROFILE                         HEX: 0900
+CONSTANT: CL_PLATFORM_VERSION                         HEX: 0901
+CONSTANT: CL_PLATFORM_NAME                            HEX: 0902
+CONSTANT: CL_PLATFORM_VENDOR                          HEX: 0903
+CONSTANT: CL_PLATFORM_EXTENSIONS                      HEX: 0904
+
+CONSTANT: CL_DEVICE_TYPE_DEFAULT                      1
+CONSTANT: CL_DEVICE_TYPE_CPU                          2
+CONSTANT: CL_DEVICE_TYPE_GPU                          4
+CONSTANT: CL_DEVICE_TYPE_ACCELERATOR                  8
+CONSTANT: CL_DEVICE_TYPE_ALL                          HEX: FFFFFFFF
+
+CONSTANT: CL_DEVICE_TYPE                              HEX: 1000
+CONSTANT: CL_DEVICE_VENDOR_ID                         HEX: 1001
+CONSTANT: CL_DEVICE_MAX_COMPUTE_UNITS                 HEX: 1002
+CONSTANT: CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS          HEX: 1003
+CONSTANT: CL_DEVICE_MAX_WORK_GROUP_SIZE               HEX: 1004
+CONSTANT: CL_DEVICE_MAX_WORK_ITEM_SIZES               HEX: 1005
+CONSTANT: CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR       HEX: 1006
+CONSTANT: CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT      HEX: 1007
+CONSTANT: CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT        HEX: 1008
+CONSTANT: CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG       HEX: 1009
+CONSTANT: CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT      HEX: 100A
+CONSTANT: CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE     HEX: 100B
+CONSTANT: CL_DEVICE_MAX_CLOCK_FREQUENCY               HEX: 100C
+CONSTANT: CL_DEVICE_ADDRESS_BITS                      HEX: 100D
+CONSTANT: CL_DEVICE_MAX_READ_IMAGE_ARGS               HEX: 100E
+CONSTANT: CL_DEVICE_MAX_WRITE_IMAGE_ARGS              HEX: 100F
+CONSTANT: CL_DEVICE_MAX_MEM_ALLOC_SIZE                HEX: 1010
+CONSTANT: CL_DEVICE_IMAGE2D_MAX_WIDTH                 HEX: 1011
+CONSTANT: CL_DEVICE_IMAGE2D_MAX_HEIGHT                HEX: 1012
+CONSTANT: CL_DEVICE_IMAGE3D_MAX_WIDTH                 HEX: 1013
+CONSTANT: CL_DEVICE_IMAGE3D_MAX_HEIGHT                HEX: 1014
+CONSTANT: CL_DEVICE_IMAGE3D_MAX_DEPTH                 HEX: 1015
+CONSTANT: CL_DEVICE_IMAGE_SUPPORT                     HEX: 1016
+CONSTANT: CL_DEVICE_MAX_PARAMETER_SIZE                HEX: 1017
+CONSTANT: CL_DEVICE_MAX_SAMPLERS                      HEX: 1018
+CONSTANT: CL_DEVICE_MEM_BASE_ADDR_ALIGN               HEX: 1019
+CONSTANT: CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE          HEX: 101A
+CONSTANT: CL_DEVICE_SINGLE_FP_CONFIG                  HEX: 101B
+CONSTANT: CL_DEVICE_GLOBAL_MEM_CACHE_TYPE             HEX: 101C
+CONSTANT: CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE         HEX: 101D
+CONSTANT: CL_DEVICE_GLOBAL_MEM_CACHE_SIZE             HEX: 101E
+CONSTANT: CL_DEVICE_GLOBAL_MEM_SIZE                   HEX: 101F
+CONSTANT: CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE          HEX: 1020
+CONSTANT: CL_DEVICE_MAX_CONSTANT_ARGS                 HEX: 1021
+CONSTANT: CL_DEVICE_LOCAL_MEM_TYPE                    HEX: 1022
+CONSTANT: CL_DEVICE_LOCAL_MEM_SIZE                    HEX: 1023
+CONSTANT: CL_DEVICE_ERROR_CORRECTION_SUPPORT          HEX: 1024
+CONSTANT: CL_DEVICE_PROFILING_TIMER_RESOLUTION        HEX: 1025
+CONSTANT: CL_DEVICE_ENDIAN_LITTLE                     HEX: 1026
+CONSTANT: CL_DEVICE_AVAILABLE                         HEX: 1027
+CONSTANT: CL_DEVICE_COMPILER_AVAILABLE                HEX: 1028
+CONSTANT: CL_DEVICE_EXECUTION_CAPABILITIES            HEX: 1029
+CONSTANT: CL_DEVICE_QUEUE_PROPERTIES                  HEX: 102A
+CONSTANT: CL_DEVICE_NAME                              HEX: 102B
+CONSTANT: CL_DEVICE_VENDOR                            HEX: 102C
+CONSTANT: CL_DRIVER_VERSION                           HEX: 102D
+CONSTANT: CL_DEVICE_PROFILE                           HEX: 102E
+CONSTANT: CL_DEVICE_VERSION                           HEX: 102F
+CONSTANT: CL_DEVICE_EXTENSIONS                        HEX: 1030
+CONSTANT: CL_DEVICE_PLATFORM                          HEX: 1031
+
+CONSTANT: CL_FP_DENORM                                1
+CONSTANT: CL_FP_INF_NAN                               2
+CONSTANT: CL_FP_ROUND_TO_NEAREST                      4
+CONSTANT: CL_FP_ROUND_TO_ZERO                         8
+CONSTANT: CL_FP_ROUND_TO_INF                          16
+CONSTANT: CL_FP_FMA                                   32
+
+CONSTANT: CL_NONE                                     0
+CONSTANT: CL_READ_ONLY_CACHE                          1
+CONSTANT: CL_READ_WRITE_CACHE                         2
+
+CONSTANT: CL_LOCAL                                    1
+CONSTANT: CL_GLOBAL                                   2
+
+CONSTANT: CL_EXEC_KERNEL                              1
+CONSTANT: CL_EXEC_NATIVE_KERNEL                       2
+
+CONSTANT: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE      1
+CONSTANT: CL_QUEUE_PROFILING_ENABLE                   2
+
+CONSTANT: CL_CONTEXT_REFERENCE_COUNT                  HEX: 1080
+CONSTANT: CL_CONTEXT_DEVICES                          HEX: 1081
+CONSTANT: CL_CONTEXT_PROPERTIES                       HEX: 1082
+
+CONSTANT: CL_CONTEXT_PLATFORM                         HEX: 1084
+
+CONSTANT: CL_QUEUE_CONTEXT                            HEX: 1090
+CONSTANT: CL_QUEUE_DEVICE                             HEX: 1091
+CONSTANT: CL_QUEUE_REFERENCE_COUNT                    HEX: 1092
+CONSTANT: CL_QUEUE_PROPERTIES                         HEX: 1093
+
+CONSTANT: CL_MEM_READ_WRITE                           1
+CONSTANT: CL_MEM_WRITE_ONLY                           2
+CONSTANT: CL_MEM_READ_ONLY                            4
+CONSTANT: CL_MEM_USE_HOST_PTR                         8
+CONSTANT: CL_MEM_ALLOC_HOST_PTR                       16
+CONSTANT: CL_MEM_COPY_HOST_PTR                        32
+
+CONSTANT: CL_R                                        HEX: 10B0
+CONSTANT: CL_A                                        HEX: 10B1
+CONSTANT: CL_RG                                       HEX: 10B2
+CONSTANT: CL_RA                                       HEX: 10B3
+CONSTANT: CL_RGB                                      HEX: 10B4
+CONSTANT: CL_RGBA                                     HEX: 10B5
+CONSTANT: CL_BGRA                                     HEX: 10B6
+CONSTANT: CL_ARGB                                     HEX: 10B7
+CONSTANT: CL_INTENSITY                                HEX: 10B8
+CONSTANT: CL_LUMINANCE                                HEX: 10B9
+
+CONSTANT: CL_SNORM_INT8                               HEX: 10D0
+CONSTANT: CL_SNORM_INT16                              HEX: 10D1
+CONSTANT: CL_UNORM_INT8                               HEX: 10D2
+CONSTANT: CL_UNORM_INT16                              HEX: 10D3
+CONSTANT: CL_UNORM_SHORT_565                          HEX: 10D4
+CONSTANT: CL_UNORM_SHORT_555                          HEX: 10D5
+CONSTANT: CL_UNORM_INT_101010                         HEX: 10D6
+CONSTANT: CL_SIGNED_INT8                              HEX: 10D7
+CONSTANT: CL_SIGNED_INT16                             HEX: 10D8
+CONSTANT: CL_SIGNED_INT32                             HEX: 10D9
+CONSTANT: CL_UNSIGNED_INT8                            HEX: 10DA
+CONSTANT: CL_UNSIGNED_INT16                           HEX: 10DB
+CONSTANT: CL_UNSIGNED_INT32                           HEX: 10DC
+CONSTANT: CL_HALF_FLOAT                               HEX: 10DD
+CONSTANT: CL_FLOAT                                    HEX: 10DE
+
+CONSTANT: CL_MEM_OBJECT_BUFFER                        HEX: 10F0
+CONSTANT: CL_MEM_OBJECT_IMAGE2D                       HEX: 10F1
+CONSTANT: CL_MEM_OBJECT_IMAGE3D                       HEX: 10F2
+
+CONSTANT: CL_MEM_TYPE                                 HEX: 1100
+CONSTANT: CL_MEM_FLAGS                                HEX: 1101
+CONSTANT: CL_MEM_SIZE                                 HEX: 1102
+CONSTANT: CL_MEM_HOST_PTR                             HEX: 1103
+CONSTANT: CL_MEM_MAP_COUNT                            HEX: 1104
+CONSTANT: CL_MEM_REFERENCE_COUNT                      HEX: 1105
+CONSTANT: CL_MEM_CONTEXT                              HEX: 1106
+
+CONSTANT: CL_IMAGE_FORMAT                             HEX: 1110
+CONSTANT: CL_IMAGE_ELEMENT_SIZE                       HEX: 1111
+CONSTANT: CL_IMAGE_ROW_PITCH                          HEX: 1112
+CONSTANT: CL_IMAGE_SLICE_PITCH                        HEX: 1113
+CONSTANT: CL_IMAGE_WIDTH                              HEX: 1114
+CONSTANT: CL_IMAGE_HEIGHT                             HEX: 1115
+CONSTANT: CL_IMAGE_DEPTH                              HEX: 1116
+
+CONSTANT: CL_ADDRESS_NONE                             HEX: 1130
+CONSTANT: CL_ADDRESS_CLAMP_TO_EDGE                    HEX: 1131
+CONSTANT: CL_ADDRESS_CLAMP                            HEX: 1132
+CONSTANT: CL_ADDRESS_REPEAT                           HEX: 1133
+
+CONSTANT: CL_FILTER_NEAREST                           HEX: 1140
+CONSTANT: CL_FILTER_LINEAR                            HEX: 1141
+
+CONSTANT: CL_SAMPLER_REFERENCE_COUNT                  HEX: 1150
+CONSTANT: CL_SAMPLER_CONTEXT                          HEX: 1151
+CONSTANT: CL_SAMPLER_NORMALIZED_COORDS                HEX: 1152
+CONSTANT: CL_SAMPLER_ADDRESSING_MODE                  HEX: 1153
+CONSTANT: CL_SAMPLER_FILTER_MODE                      HEX: 1154
+
+CONSTANT: CL_MAP_READ                                 1
+CONSTANT: CL_MAP_WRITE                                2
+
+CONSTANT: CL_PROGRAM_REFERENCE_COUNT                  HEX: 1160
+CONSTANT: CL_PROGRAM_CONTEXT                          HEX: 1161
+CONSTANT: CL_PROGRAM_NUM_DEVICES                      HEX: 1162
+CONSTANT: CL_PROGRAM_DEVICES                          HEX: 1163
+CONSTANT: CL_PROGRAM_SOURCE                           HEX: 1164
+CONSTANT: CL_PROGRAM_BINARY_SIZES                     HEX: 1165
+CONSTANT: CL_PROGRAM_BINARIES                         HEX: 1166
+
+CONSTANT: CL_PROGRAM_BUILD_STATUS                     HEX: 1181
+CONSTANT: CL_PROGRAM_BUILD_OPTIONS                    HEX: 1182
+CONSTANT: CL_PROGRAM_BUILD_LOG                        HEX: 1183
+
+CONSTANT: CL_BUILD_SUCCESS                            0
+CONSTANT: CL_BUILD_NONE                               -1
+CONSTANT: CL_BUILD_ERROR                              -2
+CONSTANT: CL_BUILD_IN_PROGRESS                        -3
+
+CONSTANT: CL_KERNEL_FUNCTION_NAME                     HEX: 1190
+CONSTANT: CL_KERNEL_NUM_ARGS                          HEX: 1191
+CONSTANT: CL_KERNEL_REFERENCE_COUNT                   HEX: 1192
+CONSTANT: CL_KERNEL_CONTEXT                           HEX: 1193
+CONSTANT: CL_KERNEL_PROGRAM                           HEX: 1194
+
+CONSTANT: CL_KERNEL_WORK_GROUP_SIZE                   HEX: 11B0
+CONSTANT: CL_KERNEL_COMPILE_WORK_GROUP_SIZE           HEX: 11B1
+CONSTANT: CL_KERNEL_LOCAL_MEM_SIZE                    HEX: 11B2
+
+CONSTANT: CL_EVENT_COMMAND_QUEUE                      HEX: 11D0
+CONSTANT: CL_EVENT_COMMAND_TYPE                       HEX: 11D1
+CONSTANT: CL_EVENT_REFERENCE_COUNT                    HEX: 11D2
+CONSTANT: CL_EVENT_COMMAND_EXECUTION_STATUS           HEX: 11D3
+
+CONSTANT: CL_COMMAND_NDRANGE_KERNEL                   HEX: 11F0
+CONSTANT: CL_COMMAND_TASK                             HEX: 11F1
+CONSTANT: CL_COMMAND_NATIVE_KERNEL                    HEX: 11F2
+CONSTANT: CL_COMMAND_READ_BUFFER                      HEX: 11F3
+CONSTANT: CL_COMMAND_WRITE_BUFFER                     HEX: 11F4
+CONSTANT: CL_COMMAND_COPY_BUFFER                      HEX: 11F5
+CONSTANT: CL_COMMAND_READ_IMAGE                       HEX: 11F6
+CONSTANT: CL_COMMAND_WRITE_IMAGE                      HEX: 11F7
+CONSTANT: CL_COMMAND_COPY_IMAGE                       HEX: 11F8
+CONSTANT: CL_COMMAND_COPY_IMAGE_TO_BUFFER             HEX: 11F9
+CONSTANT: CL_COMMAND_COPY_BUFFER_TO_IMAGE             HEX: 11FA
+CONSTANT: CL_COMMAND_MAP_BUFFER                       HEX: 11FB
+CONSTANT: CL_COMMAND_MAP_IMAGE                        HEX: 11FC
+CONSTANT: CL_COMMAND_UNMAP_MEM_OBJECT                 HEX: 11FD
+CONSTANT: CL_COMMAND_MARKER                           HEX: 11FE
+CONSTANT: CL_COMMAND_ACQUIRE_GL_OBJECTS               HEX: 11FF
+CONSTANT: CL_COMMAND_RELEASE_GL_OBJECTS               HEX: 1200
+
+CONSTANT: CL_COMPLETE                                 HEX: 0
+CONSTANT: CL_RUNNING                                  HEX: 1
+CONSTANT: CL_SUBMITTED                                HEX: 2
+CONSTANT: CL_QUEUED                                   HEX: 3
+
+CONSTANT: CL_PROFILING_COMMAND_QUEUED                 HEX: 1280
+CONSTANT: CL_PROFILING_COMMAND_SUBMIT                 HEX: 1281
+CONSTANT: CL_PROFILING_COMMAND_START                  HEX: 1282
+CONSTANT: CL_PROFILING_COMMAND_END                    HEX: 1283
+
+FUNCTION: cl_int clGetPlatformIDs ( cl_uint num_entries, cl_platform_id* platforms, cl_uint* num_platforms ) ;
+FUNCTION: cl_int clGetPlatformInfo ( cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_int clGetDeviceIDs ( cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices ) ;
+FUNCTION: cl_int clGetDeviceInfo ( cl_device_id device, cl_device_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+CALLBACK: void cl_create_context_cb ( char* a, void* b, size_t s, void* c ) ;
+FUNCTION: cl_context clCreateContext ( cl_context_properties*  properties, cl_uint num_devices, cl_device_id* devices, cl_create_context_cb pfn_notify, void* user_data, cl_int* errcode_ret ) ;
+FUNCTION: cl_context clCreateContextFromType ( cl_context_properties* properties, cl_device_type device_type, cl_create_context_cb pfn_notify, void* user_data, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clRetainContext ( cl_context context ) ;
+FUNCTION: cl_int clReleaseContext ( cl_context context ) ;
+FUNCTION: cl_int clGetContextInfo ( cl_context context, cl_context_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_command_queue clCreateCommandQueue ( cl_context context, cl_device_id device, cl_command_queue_properties properties, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clRetainCommandQueue ( cl_command_queue command_queue ) ;
+FUNCTION: cl_int clReleaseCommandQueue ( cl_command_queue command_queue ) ;
+FUNCTION: cl_int clGetCommandQueueInfo ( cl_command_queue command_queue, cl_command_queue_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_int clSetCommandQueueProperty ( cl_command_queue command_queue, cl_command_queue_properties properties, cl_bool enable, cl_command_queue_properties* old_properties ) ;
+FUNCTION: cl_mem clCreateBuffer ( cl_context context, cl_mem_flags flags, size_t size, void* host_ptr, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateImage2D ( cl_context context, cl_mem_flags flags, cl_image_format* image_format, size_t image_width, size_t image_height, size_t image_row_pitch, void* host_ptr, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateImage3D ( cl_context context, cl_mem_flags flags, cl_image_format* image_format, size_t image_width, size_t image_height, size_t image_depth, size_t image_row_pitch, size_t image_slice_pitch, void* host_ptr, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clRetainMemObject ( cl_mem memobj ) ;
+FUNCTION: cl_int clReleaseMemObject ( cl_mem memobj ) ;
+FUNCTION: cl_int clGetSupportedImageFormats ( cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, cl_uint num_entries, cl_image_format* image_formats, cl_uint* num_image_formats ) ;
+FUNCTION: cl_int clGetMemObjectInfo ( cl_mem memobj, cl_mem_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_int clGetImageInfo ( cl_mem image, cl_image_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_sampler clCreateSampler ( cl_context context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clRetainSampler ( cl_sampler sampler ) ;
+FUNCTION: cl_int clReleaseSampler ( cl_sampler sampler ) ;
+FUNCTION: cl_int clGetSamplerInfo ( cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_program clCreateProgramWithSource ( cl_context context, cl_uint count, char** strings, size_t* lengths, cl_int* errcode_ret ) ;
+FUNCTION: cl_program clCreateProgramWithBinary ( cl_context context, cl_uint num_devices, cl_device_id* device_list, size_t* lengths, char** binaries, cl_int* binary_status, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clRetainProgram ( cl_program  program ) ;
+FUNCTION: cl_int clReleaseProgram ( cl_program  program ) ;
+CALLBACK: void cl_build_program_cb ( cl_program program, void* user_data ) ;
+FUNCTION: cl_int clBuildProgram ( cl_program program, cl_uint num_devices, cl_device_id* device_list, char* options, cl_build_program_cb pfn_notify, void* user_data ) ;
+FUNCTION: cl_int clUnloadCompiler ( ) ;
+FUNCTION: cl_int clGetProgramInfo ( cl_program program, cl_program_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_int clGetProgramBuildInfo ( cl_program program, cl_device_id device, cl_program_build_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_kernel clCreateKernel ( cl_program program, char* kernel_name, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clCreateKernelsInProgram ( cl_program program, cl_uint num_kernels, cl_kernel* kernels, cl_uint* num_kernels_ret ) ;
+FUNCTION: cl_int clRetainKernel ( cl_kernel kernel ) ;
+FUNCTION: cl_int clReleaseKernel ( cl_kernel kernel ) ;
+FUNCTION: cl_int clSetKernelArg ( cl_kernel kernel, cl_uint arg_index, size_t arg_size, void* arg_value ) ;
+FUNCTION: cl_int clGetKernelInfo ( cl_kernel kernel, cl_kernel_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_int clGetKernelWorkGroupInfo ( cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_int clWaitForEvents ( cl_uint num_events, cl_event* event_list ) ;
+FUNCTION: cl_int clGetEventInfo ( cl_event event, cl_event_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_int clRetainEvent ( cl_event  event ) ;
+FUNCTION: cl_int clReleaseEvent ( cl_event  event ) ;
+FUNCTION: cl_int clGetEventProfilingInfo ( cl_event event, cl_profiling_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_int clFlush ( cl_command_queue command_queue ) ;
+FUNCTION: cl_int clFinish ( cl_command_queue command_queue ) ;
+FUNCTION: cl_int clEnqueueReadBuffer ( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t cb, void* ptr, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueWriteBuffer ( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t offset, size_t cb, void* ptr, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueCopyBuffer ( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t cb, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueReadImage ( cl_command_queue command_queue, cl_mem image, cl_bool blocking_read, size_t** origin, size_t** region, size_t row_pitch, size_t slice_pitch, void* ptr, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueWriteImage ( cl_command_queue command_queue, cl_mem image, cl_bool blocking_write, size_t** origin, size_t** region, size_t input_row_pitch, size_t input_slice_pitch, void* ptr, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueCopyImage ( cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image, size_t** src_origin, size_t** dst_origin, size_t** region, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueCopyImageToBuffer ( cl_command_queue command_queue, cl_mem src_image, cl_mem dst_buffer, size_t** src_origin, size_t** region, size_t dst_offset, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueCopyBufferToImage ( cl_command_queue  command_queue, cl_mem src_buffer, cl_mem dst_image, size_t src_offset, size_t** dst_origin, size_t** region, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: void* clEnqueueMapBuffer ( cl_command_queue  command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t cb, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event, cl_int* errcode_ret ) ;
+FUNCTION: void* clEnqueueMapImage ( cl_command_queue command_queue, cl_mem image, cl_bool blocking_map, cl_map_flags map_flags, size_t** origin, size_t** region, size_t* image_row_pitch, size_t* image_slice_pitch, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clEnqueueUnmapMemObject ( cl_command_queue  command_queue, cl_mem memobj, void* mapped_ptr, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueNDRangeKernel ( cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, size_t* global_work_offset, size_t* global_work_size, size_t* local_work_size, cl_uint num_events_in_wait_list, cl_event*  event_wait_list, cl_event* event ) ;
+CALLBACK: void cl_enqueue_task_cb ( void* args ) ;
+FUNCTION: cl_int clEnqueueTask ( cl_command_queue command_queue, cl_kernel kernel, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueNativeKernel ( cl_command_queue command_queue, cl_enqueue_task_cb user_func, void* args, size_t cb_args, cl_uint num_mem_objects, cl_mem* mem_list, void** args_mem_loc, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueMarker ( cl_command_queue command_queue, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueWaitForEvents ( cl_command_queue command_queue, cl_uint num_events, cl_event* event_list ) ;
+FUNCTION: cl_int clEnqueueBarrier ( cl_command_queue command_queue ) ;
+FUNCTION: void* clGetExtensionFunctionAddress ( char* func_name ) ;
+
+! cl_ext.h
+CONSTANT: CL_DEVICE_DOUBLE_FP_CONFIG HEX: 1032
+CONSTANT: CL_DEVICE_HALF_FP_CONFIG   HEX: 1033
+
+! cl_khr_icd.txt
+CONSTANT: CL_PLATFORM_ICD_SUFFIX_KHR HEX: 0920
+CONSTANT: CL_PLATFORM_NOT_FOUND_KHR  -1001
+
+FUNCTION: cl_int clIcdGetPlatformIDsKHR ( cl_uint num_entries, cl_platform_id* platforms, cl_uint* num_platforms ) ;
+
+! cl_gl.h
+TYPEDEF: cl_uint cl_gl_object_type
+TYPEDEF: cl_uint cl_gl_texture_info
+TYPEDEF: cl_uint cl_gl_platform_info
+
+CONSTANT: CL_GL_OBJECT_BUFFER             HEX: 2000
+CONSTANT: CL_GL_OBJECT_TEXTURE2D          HEX: 2001
+CONSTANT: CL_GL_OBJECT_TEXTURE3D          HEX: 2002
+CONSTANT: CL_GL_OBJECT_RENDERBUFFER       HEX: 2003
+CONSTANT: CL_GL_TEXTURE_TARGET            HEX: 2004
+CONSTANT: CL_GL_MIPMAP_LEVEL              HEX: 2005
+
+FUNCTION: cl_mem clCreateFromGLBuffer ( cl_context context, cl_mem_flags flags, cl_GLuint bufobj, int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromGLTexture2D ( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromGLTexture3D ( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromGLRenderbuffer ( cl_context context, cl_mem_flags flags, cl_GLuint renderbuffer, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clGetGLObjectInfo ( cl_mem memobj, cl_gl_object_type* gl_object_type, cl_GLuint* gl_object_name ) ;
+FUNCTION: cl_int clGetGLTextureInfo ( cl_mem memobj, cl_gl_texture_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+FUNCTION: cl_int clEnqueueAcquireGLObjects ( cl_command_queue command_queue, cl_uint num_objects, cl_mem* mem_objects, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueReleaseGLObjects ( cl_command_queue command_queue, cl_uint num_objects, cl_mem* mem_objects, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+
+! cl_khr_gl_sharing.txt
+TYPEDEF: cl_uint cl_gl_context_info
+
+CONSTANT: CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR  -1000
+CONSTANT: CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR    HEX: 2006
+CONSTANT: CL_DEVICES_FOR_GL_CONTEXT_KHR           HEX: 2007
+CONSTANT: CL_GL_CONTEXT_KHR                       HEX: 2008
+CONSTANT: CL_EGL_DISPLAY_KHR                      HEX: 2009
+CONSTANT: CL_GLX_DISPLAY_KHR                      HEX: 200A
+CONSTANT: CL_WGL_HDC_KHR                          HEX: 200B
+CONSTANT: CL_CGL_SHAREGROUP_KHR                   HEX: 200C
+
+FUNCTION: cl_int clGetGLContextInfoKHR ( cl_context_properties* properties, cl_gl_context_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) ;
+
+! cl_nv_d3d9_sharing.txt
+CONSTANT: CL_D3D9_DEVICE_NV                     HEX: 4022
+CONSTANT: CL_D3D9_ADAPTER_NAME_NV               HEX: 4023
+CONSTANT: CL_PREFERRED_DEVICES_FOR_D3D9_NV      HEX: 4024
+CONSTANT: CL_ALL_DEVICES_FOR_D3D9_NV            HEX: 4025
+CONSTANT: CL_CONTEXT_D3D9_DEVICE_NV             HEX: 4026
+CONSTANT: CL_MEM_D3D9_RESOURCE_NV               HEX: 4027
+CONSTANT: CL_IMAGE_D3D9_FACE_NV                 HEX: 4028
+CONSTANT: CL_IMAGE_D3D9_LEVEL_NV                HEX: 4029
+CONSTANT: CL_COMMAND_ACQUIRE_D3D9_OBJECTS_NV    HEX: 402A
+CONSTANT: CL_COMMAND_RELEASE_D3D9_OBJECTS_NV    HEX: 402B
+CONSTANT: CL_INVALID_D3D9_DEVICE_NV             -1010
+CONSTANT: CL_INVALID_D3D9_RESOURCE_NV           -1011
+CONSTANT: CL_D3D9_RESOURCE_ALREADY_ACQUIRED_NV  -1012
+CONSTANT: CL_D3D9_RESOURCE_NOT_ACQUIRED_NV      -1013
+
+TYPEDEF: void* cl_d3d9_device_source_nv 
+TYPEDEF: void* cl_d3d9_device_set_nv 
+
+FUNCTION: cl_int clGetDeviceIDsFromD3D9NV ( cl_platform_id platform, cl_d3d9_device_source_nv d3d_device_source, void* d3d_object, cl_d3d9_device_set_nv d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices ) ;
+FUNCTION: cl_mem clCreateFromD3D9VertexBufferNV ( cl_context context, cl_mem_flags flags, void* id3dvb9_resource, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromD3D9IndexBufferNV ( cl_context context, cl_mem_flags flags, void* id3dib9_resource, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromD3D9SurfaceNV ( cl_context context, cl_mem_flags flags, void* id3dsurface9_resource, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromD3D9TextureNV ( cl_context context, cl_mem_flags flags, void* id3dtexture9_resource, uint miplevel, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromD3D9CubeTextureNV ( cl_context context, cl_mem_flags flags, void* id3dct9_resource, int facetype, uint miplevel, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromD3D9VolumeTextureNV ( cl_context context, cl_mem_flags flags, void* id3dvt9-resource, uint miplevel, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clEnqueueAcquireD3D9ObjectsNV ( cl_command_queue command_queue, cl_uint num_objects, cl_mem* mem_objects, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueReleaseD3D9ObjectsNV ( cl_command_queue command_queue, cl_uint num_objects, cl_mem* mem_objects, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+
+! cl_nv_d3d10_sharing.txt
+CONSTANT: CL_D3D10_DEVICE_NV                     HEX: 4010
+CONSTANT: CL_D3D10_DXGI_ADAPTER_NV               HEX: 4011
+CONSTANT: CL_PREFERRED_DEVICES_FOR_D3D10_NV      HEX: 4012
+CONSTANT: CL_ALL_DEVICES_FOR_D3D10_NV            HEX: 4013
+CONSTANT: CL_CONTEXT_D3D10_DEVICE_NV             HEX: 4014
+CONSTANT: CL_MEM_D3D10_RESOURCE_NV               HEX: 4015
+CONSTANT: CL_IMAGE_D3D10_SUBRESOURCE_NV          HEX: 4016
+CONSTANT: CL_COMMAND_ACQUIRE_D3D10_OBJECTS_NV    HEX: 4017
+CONSTANT: CL_COMMAND_RELEASE_D3D10_OBJECTS_NV    HEX: 4018
+CONSTANT: CL_INVALID_D3D10_DEVICE_NV             -1002
+CONSTANT: CL_INVALID_D3D10_RESOURCE_NV           -1003
+CONSTANT: CL_D3D10_RESOURCE_ALREADY_ACQUIRED_NV  -1004
+CONSTANT: CL_D3D10_RESOURCE_NOT_ACQUIRED_NV      -1005
+
+TYPEDEF: void* cl_d3d10_device_source_nv 
+TYPEDEF: void* cl_d3d10_device_set_nv 
+
+FUNCTION: cl_int clGetDeviceIDsFromD3D10NV ( cl_platform_id platform, cl_d3d10_device_source_nv d3d_device_source, void* d3d_object, cl_d3d10_device_set_nv d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices ) ;
+FUNCTION: cl_mem clCreateFromD3D10BufferNV ( cl_context context, cl_mem_flags flags, void* id3d10buffer_resource, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromD3D10Texture2DNV ( cl_context context, cl_mem_flags flags, void* id3d10texture2d_resource, uint subresource, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromD3D10Texture3DNV ( cl_context context, cl_mem_flags flags, void* id3d10texture3d_resource, uint subresource, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clEnqueueAcquireD3D10ObjectsNV ( cl_command_queue command_queue, cl_uint num_objects, cl_mem* mem_objects, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueReleaseD3D10ObjectsNV ( cl_command_queue command_queue, cl_uint num_objects, cl_mem* mem_objects, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+
+! cl_nv_d3d11_sharing.txt
+CONSTANT: CL_D3D11_DEVICE_NV                     HEX: 4019
+CONSTANT: CL_D3D11_DXGI_ADAPTER_NV               HEX: 401A
+CONSTANT: CL_PREFERRED_DEVICES_FOR_D3D11_NV      HEX: 401B
+CONSTANT: CL_ALL_DEVICES_FOR_D3D11_NV            HEX: 401C
+CONSTANT: CL_CONTEXT_D3D11_DEVICE_NV             HEX: 401D
+CONSTANT: CL_MEM_D3D11_RESOURCE_NV               HEX: 401E
+CONSTANT: CL_IMAGE_D3D11_SUBRESOURCE_NV          HEX: 401F
+CONSTANT: CL_COMMAND_ACQUIRE_D3D11_OBJECTS_NV    HEX: 4020
+CONSTANT: CL_COMMAND_RELEASE_D3D11_OBJECTS_NV    HEX: 4021
+CONSTANT: CL_INVALID_D3D11_DEVICE_NV             -1006
+CONSTANT: CL_INVALID_D3D11_RESOURCE_NV           -1007
+CONSTANT: CL_D3D11_RESOURCE_ALREADY_ACQUIRED_NV  -1008
+CONSTANT: CL_D3D11_RESOURCE_NOT_ACQUIRED_NV      -1009
+
+TYPEDEF: void* cl_d3d11_device_source_nv 
+TYPEDEF: void* cl_d3d11_device_set_nv 
+
+FUNCTION: cl_int clGetDeviceIDsFromD3D11NV ( cl_platform_id platform, cl_d3d11_device_source_nv d3d_device_source, void* d3d_object, cl_d3d11_device_set_nv d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices ) ;
+FUNCTION: cl_mem clCreateFromD3D11BufferNV ( cl_context context, cl_mem_flags flags, void* id3d11buffer_resource, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromD3D11Texture2DNV ( cl_context context, cl_mem_flags flags, void* id3d11texture2d_resource, uint subresource, cl_int* errcode_ret ) ;
+FUNCTION: cl_mem clCreateFromD3D11Texture3DNV ( cl_context context, cl_mem_flags flags, void* id3dtexture3d_resource, uint subresource, cl_int* errcode_ret ) ;
+FUNCTION: cl_int clEnqueueAcquireD3D11ObjectsNV ( cl_command_queue command_queue, cl_uint num_objects, cl_mem* mem_objects, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+FUNCTION: cl_int clEnqueueReleaseD3D11ObjectsNV ( cl_command_queue command_queue, cl_uint num_objects, cl_mem* mem_objects, cl_uint num_events_in_wait_list, cl_event* event_wait_list, cl_event* event ) ;
+
+! Utility words needed for working with the API
+: *size_t ( c-ptr -- value )
+    size_t heap-size {
+        { 4 [ 0 alien-unsigned-4 ] }
+        { 8 [ 0 alien-unsigned-8 ] }
+    } case ; inline
+
+: <size_t> ( value -- c-ptr )
+    size_t heap-size [ (byte-array) ] keep {
+        { 4 [ [ 0 set-alien-unsigned-4 ] keep ] }
+        { 8 [ [ 0 set-alien-unsigned-8 ] keep ] }
+    } case ; inline
diff --git a/extra/opencl/ffi/summary.txt b/extra/opencl/ffi/summary.txt
new file mode 100644 (file)
index 0000000..e699c14
--- /dev/null
@@ -0,0 +1 @@
+Bindings to OpenCL
diff --git a/extra/opencl/ffi/tags.txt b/extra/opencl/ffi/tags.txt
new file mode 100644 (file)
index 0000000..ba3ee02
--- /dev/null
@@ -0,0 +1,2 @@
+bindings
+not tested
diff --git a/extra/opencl/opencl-docs.factor b/extra/opencl/opencl-docs.factor
new file mode 100644 (file)
index 0000000..dc881e4
--- /dev/null
@@ -0,0 +1,246 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel quotations strings opencl.private
+math byte-arrays alien ;
+IN: opencl
+
+HELP: cl-addressing-mode
+{ $values
+    { "sampler" cl-sampler }
+    { "addressing-mode" cl-addressing-mode }
+}
+{ $description "Returns the addressing mode of the given sampler." } ;
+
+HELP: cl-barrier
+{ $description "Insert a synchronization barrier into the current command queue." } ;
+
+HELP: cl-barrier-events
+{ $values
+    { "event/events" "a single event or sequence of events" }
+}
+{ $description "Insert a synchronization barrier for the specified events into the current command queue." } ;
+
+HELP: cl-buffer
+{ $var-description "Tuple wrapper which will release the memory object handle when disposed." } ;
+
+HELP: cl-buffer-ptr
+{ $var-description "A buffer and offset pair for specifying a starting point for a copy." } ;
+
+HELP: cl-buffer-range
+{ $var-description "A buffer, offset and size triplet for specifying copy ranges." } ;
+
+HELP: cl-context
+{ $var-description "Tuple wrapper which will release the context handle when disposed." } ;
+
+HELP: cl-current-context
+{ $var-description "Symbol for the current cl-context tuple." } ;
+
+HELP: cl-current-device
+{ $var-description "Symbol for the current cl-device tuple." } ;
+
+HELP: cl-current-queue
+{ $var-description "Symbol for the current cl-queue tuple." } ;
+
+HELP: cl-device
+{ $var-description "Tuple wrapper which will release the device handle when disposed." } ;
+
+HELP: cl-event
+{ $var-description "Tuple wrapper which will release the event handle when disposed." } ;
+
+HELP: cl-event-status
+{ $values
+    { "event" cl-event }
+    { "execution-status" cl-execution-status }
+}
+{ $description "Returns the current execution status of the operation represented by the event." } ;
+
+HELP: cl-event-type
+{ $values
+    { "event" cl-event }
+    { "command-type" cl-execution-status }
+}
+{ $description "Returns the type of operation that created the event." } ;
+
+HELP: cl-filter-mode
+{ $values
+    { "sampler" cl-sampler }
+    { "filter-mode" cl-filter-mode }
+}
+{ $description "Returns the filter mode of the sampler object." } ;
+
+HELP: cl-finish
+{ $description "Flush the current command queue and wait till all operations are completed." } ;
+
+HELP: cl-flush
+{ $description "Flush the current command queue to kick off pending operations." } ;
+
+HELP: cl-kernel
+{ $var-description "Tuple wrapper which will release the kernel handle when disposed." } ;
+
+HELP: cl-kernel-arity
+{ $values
+    { "kernel" cl-kernel }
+    { "arity" integer }
+}
+{ $description "Returns the number of inputs that this kernel function accepts." } ;
+
+HELP: cl-kernel-local-size
+{ $values
+    { "kernel" cl-kernel }
+    { "size" integer }
+}
+{ $description "Returns the maximum size of a local work group for this kernel." } ;
+
+HELP: cl-kernel-name
+{ $values
+    { "kernel" cl-kernel }
+    { "string" string }
+}
+{ $description "Returns the name of the kernel function." } ;
+
+HELP: cl-marker
+{ $values
+    
+    { "event" cl-event }
+}
+{ $description "Inserts a marker into the current command queue." } ;
+
+HELP: cl-normalized-coords?
+{ $values
+    { "sampler" cl-sampler }
+    { "?" boolean }
+}
+{ $description "Returns whether the sampler uses normalized coords or not." } ;
+
+HELP: cl-out-of-order-execution?
+{ $values
+    { "command-queue" cl-queue }
+    { "?" boolean }
+}
+{ $description "Returns whether the given command queue allows out of order execution or not." } ;
+
+HELP: cl-platform
+{ $var-description "Tuple summarizing the capabilities and devices of an OpenCL platform." } ;
+
+HELP: cl-platforms
+{ $values
+    
+    { "platforms" "sequence of cl-platform"}
+}
+{ $description "Returns the platforms available for OpenCL computation on this hardware." } ;
+
+HELP: cl-profile-counters
+{ $values
+    { "event" cl-event }
+    { "queued" integer } { "submitted" integer } { "started" integer } { "finished" integer }
+}
+{ $description "Returns the profiling counters for the operation represented by event." } ;
+
+HELP: cl-profiling?
+{ $values
+    { "command-queue" cl-queue }
+    { "?" boolean }
+}
+{ $description "Returns true if the command queue allows profiling." } ;
+
+HELP: cl-program
+{ $var-description "Tuple wrapper which will release the program handle when disposed." } ;
+
+HELP: cl-queue
+{ $var-description "Tuple wrapper which will release the command queue handle when disposed." } ;
+
+HELP: cl-read-buffer
+{ $values
+    { "buffer-range" cl-buffer-range }
+    { "byte-array" byte-array }
+}
+{ $description "Synchronously read a byte-array from the specified buffer location." } ;
+
+HELP: cl-sampler
+{ $var-description "Tuple wrapper which will release the sampler handle when disposed." } ;
+
+HELP: cl-queue-copy-buffer
+{ $values
+    { "src-buffer-ptr" cl-buffer-ptr } { "dst-buffer-ptr" cl-buffer-ptr } { "size" integer } { "dependent-events" "sequence of events" }
+    { "event" cl-event }
+}
+{ $description "Queue a copy operation from " { $snippet "src-buffer-ptr" } " to " { $snippet "dst-buffer-ptr" } ". Dependent events can be passed to order the operation relative to other operations." } ;
+
+HELP: cl-queue-kernel
+{ $values
+    { "kernel" cl-kernel } { "args" "sequence of cl-buffer or byte-array" } { "sizes" "sequence of integers" } { "dependent-events" "sequence of events" }
+    { "event" cl-event }
+}
+{ $description "Queue a kernel for execution with the given arguments. The " { $snippet "sizes" } " argument specifies input array sizes for each dimension. Dependent events can be passed to order the operation relative to other operations." } ;
+
+HELP: cl-queue-read-buffer
+{ $values
+    { "buffer-range" cl-buffer-range } { "alien" alien } { "dependent-events" "a sequence of events" }
+    { "event" cl-event }
+}
+{ $description "Queue a read operation from " { $snippet "buffer-range" } " to " { $snippet "alien" } ". Dependent events can be passed to order the operation relative to other operations." } ;
+
+HELP: cl-queue-write-buffer
+{ $values
+    { "buffer-range" cl-buffer-range } { "alien" alien } { "dependent-events" "a sequence of events" }
+    { "event" cl-event }
+}
+{ $description "Queue a write operation from " { $snippet "alien" } " to " { $snippet "buffer-range" } ". Dependent events can be passed to order the operation relative to other operations." } ;
+
+HELP: cl-wait
+{ $values
+    { "event/events" "a single event or sequence of events" }
+}
+{ $description "Synchronously wait for the events to complete." } ;
+
+HELP: cl-write-buffer
+{ $values
+    { "buffer-range" cl-buffer-range } { "byte-array" byte-array }
+}
+{ $description "Synchronously write a byte-array to the specified buffer location." } ;
+
+HELP: <cl-program>
+{ $values
+    { "options" string } { "strings" "sequence of source code strings" }
+    { "program" "compiled cl-program" }
+}
+{ $description "Compile the given source code and return a program object. A " { $link cl-error } " is thrown in the event of a compile error." } ;
+
+HELP: with-cl-state
+{ $values
+  { "context/f" { $maybe cl-context } } { "device/f" { $maybe cl-device } } { "queue/f" { $maybe cl-queue } } { "quot" quotation }
+}
+{ $description "Run the specified quotation with the given context, device and command queue. False arguments are not bound." } ;
+
+ARTICLE: "opencl" "OpenCL"
+"The " { $vocab-link "opencl" } " vocabulary provides high-level words for using OpenCL."
+{ $subsections
+  cl-platforms
+  <cl-queue>
+  with-cl-state
+}
+"Memory Objects:"
+{ $subsections
+  <cl-buffer>
+  cl-queue-copy-buffer
+  cl-read-buffer
+  cl-queue-read-buffer
+  cl-write-buffer
+  cl-queue-write-buffer
+}
+"Programs and Kernels:"
+{ $subsections
+  <cl-program>
+  <cl-kernel>
+}
+
+"Running and Waiting for Completion:"
+{ $subsections
+  cl-queue-kernel
+  cl-wait
+  cl-flush
+  cl-finish
+}
+;
+
+ABOUT: "opencl"
diff --git a/extra/opencl/opencl-tests.factor b/extra/opencl/opencl-tests.factor
new file mode 100644 (file)
index 0000000..6fd7bb5
--- /dev/null
@@ -0,0 +1,44 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: multiline locals io.encodings.ascii io.encodings.string sequences
+math specialized-arrays alien.c-types math.order alien opencl tools.test
+accessors arrays destructors kernel namespaces ;
+FROM: alien.c-types => float ;
+SPECIALIZED-ARRAY: float
+IN: opencl.tests
+    
+STRING: kernel-source
+__kernel void square(
+    __global float* input,
+    __global float* output,
+    const unsigned int count)
+{
+    int i = get_global_id(0);
+    if (i < count)
+        output[i] = input[i] * input[i];
+}
+;
+
+:: opencl-square ( in -- out )
+    [
+        in byte-length                         :> num-bytes
+        in length                              :> num-floats
+        cl-platforms first devices>> first     :> device
+        device 1array <cl-context> &dispose    :> context
+        context device f f <cl-queue> &dispose :> queue
+
+        context device queue [
+            "" kernel-source 1array <cl-program> &dispose "square" <cl-kernel> &dispose :> kernel
+            cl-read-access num-bytes in <cl-buffer> &dispose :> in-buffer
+            cl-write-access num-bytes f <cl-buffer> &dispose :> out-buffer
+            
+            kernel in-buffer out-buffer num-floats <uint> 3array
+            { num-floats } [ ] cl-queue-kernel &dispose drop
+            
+            cl-finish
+            out-buffer 0 num-bytes <cl-buffer-range> cl-read-buffer num-floats <direct-float-array>
+        ] with-cl-state
+    ] with-destructors ;
+
+[ float-array{ 1.0 4.0 9.0 16.0 100.0 } ]
+[ float-array{ 1.0 2.0 3.0 4.0 10.0 } opencl-square ] unit-test
diff --git a/extra/opencl/opencl.factor b/extra/opencl/opencl.factor
new file mode 100644 (file)
index 0000000..17f0143
--- /dev/null
@@ -0,0 +1,590 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien alien.c-types arrays byte-arrays combinators
+combinators.smart destructors io.encodings.ascii io.encodings.string
+kernel libc locals math namespaces opencl.ffi sequences shuffle
+specialized-arrays variants ;
+IN: opencl
+SPECIALIZED-ARRAYS: void* char size_t ;
+
+<PRIVATE
+ERROR: cl-error err ;
+
+: cl-success ( err -- )
+    dup CL_SUCCESS = [ drop ] [ cl-error ] if ; inline
+
+: cl-not-null ( err -- )
+    dup f = [ cl-error ] [ drop ] if ; inline
+: info-data-size ( handle name info-quot -- size_t )
+    [ 0 f 0 <size_t> ] dip [ call cl-success ] 2keep drop *size_t ; inline
+
+: info-data-bytes ( handle name info-quot size -- bytes )
+    swap [ dup <byte-array> f ] dip [ call cl-success ] 3keep 2drop ; inline
+
+: info ( handle name info-quot lift-quot -- value )
+    [ 3dup info-data-size info-data-bytes ] dip call ; inline
+
+: 2info-data-size ( handle1 handle2 name info-quot -- size_t )
+    [ 0 f 0 <size_t> ] dip [ call cl-success ] 2keep drop *size_t ; inline
+
+: 2info-data-bytes ( handle1 handle2 name info-quot size -- bytes )
+    swap [ dup <byte-array> f ] dip [ call cl-success ] 3keep 2drop ; inline
+
+: 2info ( handle1 handle2 name info_quot lift_quot -- value )
+    [ 4dup 2info-data-size 2info-data-bytes ] dip call ; inline
+    
+: info-bool ( handle name quot -- ? )
+    [ *uint CL_TRUE = ] info ; inline
+
+: info-ulong ( handle name quot -- ulong )
+    [ *ulonglong ] info ; inline
+
+: info-int ( handle name quot -- int )
+    [ *int ] info ; inline
+
+: info-uint ( handle name quot -- uint )
+    [ *uint ] info ; inline
+
+: info-size_t ( handle name quot -- size_t )
+    [ *size_t ] info ; inline
+
+: 2info-size_t ( handle1 handle2 name quot -- size_t )
+    [ *size_t ] 2info ; inline
+
+: info-string ( handle name quot -- string )
+    [ ascii decode 1 head* ] info ; inline
+
+: 2info-string ( handle name quot -- string )
+    [ ascii decode 1 head* ] 2info ; inline
+
+: info-size_t-array ( handle name quot -- size_t-array )
+    [ [ length size_t heap-size / ] keep swap <direct-size_t-array> ] info ; inline
+
+TUPLE: cl-handle < disposable handle ;
+PRIVATE>
+
+VARIANT: cl-device-type
+    cl-device-default cl-device-cpu cl-device-gpu cl-device-accelerator ;
+
+: size_t>cl-device-type ( size_t -- cl-device-type )
+    {
+        { CL_DEVICE_TYPE_DEFAULT     [ cl-device-default     ] }
+        { CL_DEVICE_TYPE_CPU         [ cl-device-cpu         ] }
+        { CL_DEVICE_TYPE_GPU         [ cl-device-gpu         ] }
+        { CL_DEVICE_TYPE_ACCELERATOR [ cl-device-accelerator ] }
+    } case ; inline
+
+VARIANT: cl-fp-feature
+    cl-denorm cl-inf-and-nan cl-round-to-nearest cl-round-to-zero cl-round-to-inf cl-fma ;
+
+VARIANT: cl-cache-type
+    cl-no-cache cl-read-only-cache cl-read-write-cache ;
+
+VARIANT: cl-buffer-access-mode
+    cl-read-access cl-write-access cl-read-write-access ;
+
+VARIANT: cl-image-channel-order
+    cl-channel-order-r cl-channel-order-a cl-channel-order-rg cl-channel-order-ra
+    cl-channel-order-rga cl-channel-order-rgba cl-channel-order-bgra cl-channel-order-argb
+    cl-channel-order-intensity cl-channel-order-luminance ;
+
+VARIANT: cl-image-channel-type
+    cl-channel-type-snorm-int8 cl-channel-type-snorm-int16 cl-channel-type-unorm-int8
+    cl-channel-type-unorm-int16 cl-channel-type-unorm-short-565
+    cl-channel-type-unorm-short-555 cl-channel-type-unorm-int-101010
+    cl-channel-type-signed-int8 cl-channel-type-signed-int16 cl-channel-type-signed-int32
+    cl-channel-type-unsigned-int8 cl-channel-type-unsigned-int16
+    cl-channel-type-unsigned-int32 cl-channel-type-half-float cl-channel-type-float ;
+
+VARIANT: cl-addressing-mode
+    cl-repeat-addressing cl-clamp-to-edge-addressing cl-clamp-addressing cl-no-addressing ;
+
+VARIANT: cl-filter-mode
+    cl-filter-nearest cl-filter-linear ;
+
+VARIANT: cl-command-type
+    cl-ndrange-kernel-command cl-task-command cl-native-kernel-command cl-read-buffer-command
+    cl-write-buffer-command cl-copy-buffer-command cl-read-image-command cl-write-image-command
+    cl-copy-image-command cl-copy-buffer-to-image-command cl-copy-image-to-buffer-command
+    cl-map-buffer-command cl-map-image-command cl-unmap-mem-object-command
+    cl-marker-command cl-acquire-gl-objects-command cl-release-gl-objects-command ;
+
+VARIANT: cl-execution-status
+    cl-queued cl-submitted cl-running cl-complete cl-failure ;
+
+TUPLE: cl-platform
+    id profile version name vendor extensions devices ;
+
+TUPLE: cl-device
+    id type vendor-id max-compute-units max-work-item-dimensions
+    max-work-item-sizes max-work-group-size preferred-vector-width-char 
+    preferred-vector-width-short preferred-vector-width-int 
+    preferred-vector-width-long preferred-vector-width-float 
+    preferred-vector-width-double max-clock-frequency address-bits 
+    max-mem-alloc-size image-support max-read-image-args max-write-image-args
+    image2d-max-width image2d-max-height image3d-max-width image3d-max-height 
+    image3d-max-depth max-samplers max-parameter-size mem-base-addr-align
+    min-data-type-align-size single-fp-config global-mem-cache-type
+    global-mem-cacheline-size global-mem-cache-size global-mem-size 
+    max-constant-buffer-size max-constant-args local-mem? local-mem-size 
+    error-correction-support profiling-timer-resolution endian-little 
+    available compiler-available execute-kernels? execute-native-kernels?
+    out-of-order-exec-available? profiling-available?
+    name vendor driver-version profile version extensions ;
+
+TUPLE: cl-context < cl-handle ;
+TUPLE: cl-queue   < cl-handle ;
+TUPLE: cl-buffer  < cl-handle ;
+TUPLE: cl-sampler < cl-handle ;
+TUPLE: cl-program < cl-handle ;
+TUPLE: cl-kernel  < cl-handle ;
+TUPLE: cl-event   < cl-handle ;
+
+M: cl-context dispose* handle>> clReleaseContext      cl-success ;
+M: cl-queue   dispose* handle>> clReleaseCommandQueue cl-success ;
+M: cl-buffer  dispose* handle>> clReleaseMemObject    cl-success ;
+M: cl-sampler dispose* handle>> clReleaseSampler      cl-success ;
+M: cl-program dispose* handle>> clReleaseProgram      cl-success ;
+M: cl-kernel  dispose* handle>> clReleaseKernel       cl-success ;
+M: cl-event   dispose* handle>> clReleaseEvent        cl-success ;
+
+TUPLE: cl-buffer-ptr
+    { buffer cl-buffer read-only }
+    { offset integer   read-only } ;
+C: <cl-buffer-ptr> cl-buffer-ptr
+
+TUPLE: cl-buffer-range
+    { buffer cl-buffer read-only }
+    { offset integer   read-only }
+    { size   integer   read-only } ;
+C: <cl-buffer-range> cl-buffer-range
+
+SYMBOLS: cl-current-context cl-current-queue cl-current-device ;
+
+<PRIVATE
+
+: (current-cl-context) ( -- cl-context )
+    cl-current-context get ; inline
+
+: (current-cl-queue) ( -- cl-queue )
+    cl-current-queue get ; inline
+
+: (current-cl-device) ( -- cl-device )
+    cl-current-device get ; inline
+
+GENERIC: buffer-access-constant ( buffer-access-mode -- n )
+M: cl-read-write-access buffer-access-constant drop CL_MEM_READ_WRITE ;
+M: cl-read-access       buffer-access-constant drop CL_MEM_READ_ONLY ;
+M: cl-write-access      buffer-access-constant drop CL_MEM_WRITE_ONLY ;
+
+GENERIC: buffer-map-flags ( buffer-access-mode -- n )
+M: cl-read-write-access buffer-map-flags drop CL_MAP_READ CL_MAP_WRITE bitor ;
+M: cl-read-access       buffer-map-flags drop CL_MAP_READ ;
+M: cl-write-access      buffer-map-flags drop CL_MAP_WRITE ;
+
+GENERIC: addressing-mode-constant ( addressing-mode -- n )
+M: cl-repeat-addressing        addressing-mode-constant drop CL_ADDRESS_REPEAT ;
+M: cl-clamp-to-edge-addressing addressing-mode-constant drop CL_ADDRESS_CLAMP_TO_EDGE ;
+M: cl-clamp-addressing         addressing-mode-constant drop CL_ADDRESS_CLAMP ;
+M: cl-no-addressing            addressing-mode-constant drop CL_ADDRESS_NONE ;
+
+GENERIC: filter-mode-constant ( filter-mode -- n )
+M: cl-filter-nearest filter-mode-constant drop CL_FILTER_NEAREST ;
+M: cl-filter-linear  filter-mode-constant drop CL_FILTER_LINEAR ;
+
+: cl_addressing_mode>addressing-mode ( cl_addressing_mode -- addressing-mode )
+    {
+        { CL_ADDRESS_REPEAT        [ cl-repeat-addressing        ] }
+        { CL_ADDRESS_CLAMP_TO_EDGE [ cl-clamp-to-edge-addressing ] }
+        { CL_ADDRESS_CLAMP         [ cl-clamp-addressing         ] }
+        { CL_ADDRESS_NONE          [ cl-no-addressing            ] }
+    } case ; inline
+
+: cl_filter_mode>filter-mode ( cl_filter_mode -- filter-mode )
+    {
+        { CL_FILTER_LINEAR  [ cl-filter-linear  ] }
+        { CL_FILTER_NEAREST [ cl-filter-nearest ] }
+    } case ; inline
+
+: platform-info-string ( handle name -- string )
+    [ clGetPlatformInfo ] info-string ;
+
+: platform-info ( id -- profile version name vendor extensions )
+    {
+        [ CL_PLATFORM_PROFILE    platform-info-string ]
+        [ CL_PLATFORM_VERSION    platform-info-string ]
+        [ CL_PLATFORM_NAME       platform-info-string ]
+        [ CL_PLATFORM_VENDOR     platform-info-string ]
+        [ CL_PLATFORM_EXTENSIONS platform-info-string ] 
+    } cleave ;
+
+: cl_device_fp_config>flags ( ulong -- sequence )
+    [ {
+        [ CL_FP_DENORM           bitand 0 = [ f ] [ cl-denorm           ] if ]
+        [ CL_FP_INF_NAN          bitand 0 = [ f ] [ cl-inf-and-nan      ] if ]
+        [ CL_FP_ROUND_TO_NEAREST bitand 0 = [ f ] [ cl-round-to-nearest ] if ]
+        [ CL_FP_ROUND_TO_ZERO    bitand 0 = [ f ] [ cl-round-to-zero    ] if ]
+        [ CL_FP_ROUND_TO_INF     bitand 0 = [ f ] [ cl-round-to-inf     ] if ]
+        [ CL_FP_FMA              bitand 0 = [ f ] [ cl-fma              ] if ]
+    } cleave ] { } output>sequence sift ;
+
+: cl_device_mem_cache_type>cache-type ( uint -- cache-type )
+    {
+        { CL_NONE             [ cl-no-cache         ] }
+        { CL_READ_ONLY_CACHE  [ cl-read-only-cache  ] }
+        { CL_READ_WRITE_CACHE [ cl-read-write-cache ] }
+    } case ; inline
+
+: device-info-bool ( handle name -- ? )
+    [ clGetDeviceInfo ] info-bool ;
+
+: device-info-ulong ( handle name -- ulong )
+    [ clGetDeviceInfo ] info-ulong ;
+
+: device-info-uint ( handle name -- uint )
+    [ clGetDeviceInfo ] info-uint ;
+
+: device-info-string ( handle name -- string )
+    [ clGetDeviceInfo ] info-string ;
+
+: device-info-size_t ( handle name -- size_t )
+    [ clGetDeviceInfo ] info-size_t ;
+
+: device-info-size_t-array ( handle name -- size_t-array )
+    [ clGetDeviceInfo ] info-size_t-array ;
+
+: device-info ( device-id -- device )
+    dup {
+        [ CL_DEVICE_TYPE                          device-info-size_t size_t>cl-device-type ]
+        [ CL_DEVICE_VENDOR_ID                     device-info-uint         ]
+        [ CL_DEVICE_MAX_COMPUTE_UNITS             device-info-uint         ]
+        [ CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS      device-info-uint         ]
+        [ CL_DEVICE_MAX_WORK_ITEM_SIZES           device-info-size_t-array ]
+        [ CL_DEVICE_MAX_WORK_GROUP_SIZE           device-info-size_t       ]
+        [ CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR   device-info-uint         ]
+        [ CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT  device-info-uint         ]
+        [ CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT    device-info-uint         ]
+        [ CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG   device-info-uint         ]
+        [ CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT  device-info-uint         ]
+        [ CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE device-info-uint         ]
+        [ CL_DEVICE_MAX_CLOCK_FREQUENCY           device-info-uint         ]
+        [ CL_DEVICE_ADDRESS_BITS                  device-info-uint         ]
+        [ CL_DEVICE_MAX_MEM_ALLOC_SIZE            device-info-ulong        ]
+        [ CL_DEVICE_IMAGE_SUPPORT                 device-info-bool         ]
+        [ CL_DEVICE_MAX_READ_IMAGE_ARGS           device-info-uint         ]
+        [ CL_DEVICE_MAX_WRITE_IMAGE_ARGS          device-info-uint         ]
+        [ CL_DEVICE_IMAGE2D_MAX_WIDTH             device-info-size_t       ]
+        [ CL_DEVICE_IMAGE2D_MAX_HEIGHT            device-info-size_t       ]
+        [ CL_DEVICE_IMAGE3D_MAX_WIDTH             device-info-size_t       ]
+        [ CL_DEVICE_IMAGE3D_MAX_HEIGHT            device-info-size_t       ]
+        [ CL_DEVICE_IMAGE3D_MAX_DEPTH             device-info-size_t       ]
+        [ CL_DEVICE_MAX_SAMPLERS                  device-info-uint         ]
+        [ CL_DEVICE_MAX_PARAMETER_SIZE            device-info-size_t       ]
+        [ CL_DEVICE_MEM_BASE_ADDR_ALIGN           device-info-uint         ]
+        [ CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE      device-info-uint         ]
+        [ CL_DEVICE_SINGLE_FP_CONFIG              device-info-ulong cl_device_fp_config>flags           ]
+        [ CL_DEVICE_GLOBAL_MEM_CACHE_TYPE         device-info-uint  cl_device_mem_cache_type>cache-type ]
+        [ CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE     device-info-uint         ]
+        [ CL_DEVICE_GLOBAL_MEM_CACHE_SIZE         device-info-ulong        ]
+        [ CL_DEVICE_GLOBAL_MEM_SIZE               device-info-ulong        ]
+        [ CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE      device-info-ulong        ]
+        [ CL_DEVICE_MAX_CONSTANT_ARGS             device-info-uint         ]
+        [ CL_DEVICE_LOCAL_MEM_TYPE                device-info-uint CL_LOCAL = ]
+        [ CL_DEVICE_LOCAL_MEM_SIZE                device-info-ulong        ]
+        [ CL_DEVICE_ERROR_CORRECTION_SUPPORT      device-info-bool         ]
+        [ CL_DEVICE_PROFILING_TIMER_RESOLUTION    device-info-size_t       ]
+        [ CL_DEVICE_ENDIAN_LITTLE                 device-info-bool         ]
+        [ CL_DEVICE_AVAILABLE                     device-info-bool         ]
+        [ CL_DEVICE_COMPILER_AVAILABLE            device-info-bool         ]
+        [ CL_DEVICE_EXECUTION_CAPABILITIES        device-info-ulong CL_EXEC_KERNEL                         bitand 0 = not ]
+        [ CL_DEVICE_EXECUTION_CAPABILITIES        device-info-ulong CL_EXEC_NATIVE_KERNEL                  bitand 0 = not ]
+        [ CL_DEVICE_QUEUE_PROPERTIES              device-info-ulong CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE bitand 0 = not ]
+        [ CL_DEVICE_QUEUE_PROPERTIES              device-info-ulong CL_QUEUE_PROFILING_ENABLE              bitand 0 = not ]
+        [ CL_DEVICE_NAME                          device-info-string       ]
+        [ CL_DEVICE_VENDOR                        device-info-string       ]
+        [ CL_DRIVER_VERSION                       device-info-string       ]
+        [ CL_DEVICE_PROFILE                       device-info-string       ]
+        [ CL_DEVICE_VERSION                       device-info-string       ]
+        [ CL_DEVICE_EXTENSIONS                    device-info-string       ]
+    } cleave cl-device boa ;
+
+: platform-devices ( platform-id -- devices )
+    CL_DEVICE_TYPE_ALL [
+        0 f 0 <uint> [ clGetDeviceIDs cl-success ] keep *uint
+    ] [
+        rot dup <void*-array> [ f clGetDeviceIDs cl-success ] keep
+    ] 2bi ; inline
+
+: command-queue-info-ulong ( handle name -- ulong )
+    [ clGetCommandQueueInfo ] info-ulong ;
+
+: sampler-info-bool ( handle name -- ? )
+    [ clGetSamplerInfo ] info-bool ;
+
+: sampler-info-uint ( handle name -- uint )
+    [ clGetSamplerInfo ] info-uint ;
+
+: program-build-info-string ( program-handle device-handle name -- string )
+    [ clGetProgramBuildInfo ] 2info-string ;
+
+: program-build-log ( program-handle device-handle -- string )
+    CL_PROGRAM_BUILD_LOG program-build-info-string ;
+
+: strings>char*-array ( strings -- char*-array )
+    [ ascii encode dup length dup malloc [ cl-not-null ]
+      keep &free [ -rot memcpy ] keep ] void*-array{ } map-as ;
+
+: (program) ( cl-context sources -- program-handle )
+    [ handle>> ] dip [
+        [ length ]
+        [ strings>char*-array ]
+        [ [ length ] size_t-array{ } map-as ] tri
+        0 <int> [ clCreateProgramWithSource ] keep *int cl-success
+    ] with-destructors ;
+
+:: (build-program) ( program-handle device options -- program )
+    program-handle 1 device 1array [ id>> ] void*-array{ } map-as
+    options ascii encode 0 suffix f f clBuildProgram
+    {
+        { CL_BUILD_PROGRAM_FAILURE [
+            program-handle device id>> program-build-log program-handle
+            clReleaseProgram cl-success cl-error f ] }
+        { CL_SUCCESS [ cl-program new-disposable program-handle >>handle ] }
+        [ program-handle clReleaseProgram cl-success cl-success f ]
+    } case ;
+
+: kernel-info-string ( handle name -- string )
+    [ clGetKernelInfo ] info-string ;
+
+: kernel-info-uint ( handle name -- uint )
+    [ clGetKernelInfo ] info-uint ;
+
+: kernel-work-group-info-size_t ( handle1 handle2 name -- size_t )
+    [ clGetKernelWorkGroupInfo ] 2info-size_t ;
+
+: event-info-uint ( handle name -- uint )
+    [ clGetEventInfo ] info-uint ;
+
+: event-info-int ( handle name -- int )
+    [ clGetEventInfo ] info-int ;
+
+: cl_command_type>command-type ( cl_command-type -- command-type )
+    {
+        { CL_COMMAND_NDRANGE_KERNEL       [ cl-ndrange-kernel-command       ] }
+        { CL_COMMAND_TASK                 [ cl-task-command                 ] }
+        { CL_COMMAND_NATIVE_KERNEL        [ cl-native-kernel-command        ] }
+        { CL_COMMAND_READ_BUFFER          [ cl-read-buffer-command          ] }
+        { CL_COMMAND_WRITE_BUFFER         [ cl-write-buffer-command         ] }
+        { CL_COMMAND_COPY_BUFFER          [ cl-copy-buffer-command          ] }
+        { CL_COMMAND_READ_IMAGE           [ cl-read-image-command           ] }
+        { CL_COMMAND_WRITE_IMAGE          [ cl-write-image-command          ] }
+        { CL_COMMAND_COPY_IMAGE           [ cl-copy-image-command           ] }
+        { CL_COMMAND_COPY_BUFFER_TO_IMAGE [ cl-copy-buffer-to-image-command ] }
+        { CL_COMMAND_COPY_IMAGE_TO_BUFFER [ cl-copy-image-to-buffer-command ] }
+        { CL_COMMAND_MAP_BUFFER           [ cl-map-buffer-command           ] }
+        { CL_COMMAND_MAP_IMAGE            [ cl-map-image-command            ] }
+        { CL_COMMAND_UNMAP_MEM_OBJECT     [ cl-unmap-mem-object-command     ] }
+        { CL_COMMAND_MARKER               [ cl-marker-command               ] }
+        { CL_COMMAND_ACQUIRE_GL_OBJECTS   [ cl-acquire-gl-objects-command   ] }
+        { CL_COMMAND_RELEASE_GL_OBJECTS   [ cl-release-gl-objects-command   ] }
+    } case ;
+
+: cl_int>execution-status ( clint -- execution-status )
+    {
+        { CL_QUEUED    [ cl-queued    ] }
+        { CL_SUBMITTED [ cl-submitted ] }
+        { CL_RUNNING   [ cl-running   ] }
+        { CL_COMPLETE  [ cl-complete  ] }
+        [ drop cl-failure ]
+    } case ; inline
+
+: profiling-info-ulong ( handle name -- ulong )
+    [ clGetEventProfilingInfo ] info-ulong ;
+
+: bind-kernel-arg-buffer ( kernel index buffer -- )
+    [ handle>> ] [ cl_mem heap-size ] [ handle>> <void*> ] tri*
+    clSetKernelArg cl-success ; inline
+
+: bind-kernel-arg-data ( kernel index byte-array -- )
+    [ handle>> ] 2dip
+    [ byte-length ] keep clSetKernelArg cl-success ; inline
+
+GENERIC: bind-kernel-arg ( kernel index data -- )
+M: cl-buffer  bind-kernel-arg bind-kernel-arg-buffer ;
+M: byte-array bind-kernel-arg bind-kernel-arg-data ;
+PRIVATE>
+
+: with-cl-state ( context/f device/f queue/f quot -- )
+    [
+        [
+            [ cl-current-queue   set ] when*
+            [ cl-current-device  set ] when*
+            [ cl-current-context set ] when*
+        ] 3curry H{ } make-assoc
+    ] dip bind ; inline
+
+: cl-platforms ( -- platforms )
+    0 f 0 <uint> [ clGetPlatformIDs cl-success ] keep *uint
+    dup <void*-array> [ f clGetPlatformIDs cl-success ] keep
+    [
+        dup
+        [ platform-info ]
+        [ platform-devices [ device-info ] { } map-as ] bi
+        cl-platform boa
+    ] { } map-as ;
+
+: <cl-context> ( devices -- cl-context )
+    [ f ] dip
+    [ length ] [ [ id>> ] void*-array{ } map-as ] bi
+    f f 0 <int> [ clCreateContext ] keep *int cl-success
+    cl-context new-disposable swap >>handle ;
+
+: <cl-queue> ( context device out-of-order? profiling? -- command-queue )
+    [ [ handle>> ] [ id>> ] bi* ] 2dip
+    [ [ CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ] [ 0 ] if ]
+    [ [ CL_QUEUE_PROFILING_ENABLE ] [ 0 ] if ] bi* bitor
+    0 <int> [ clCreateCommandQueue ] keep *int cl-success
+    cl-queue new-disposable swap >>handle ;
+
+: cl-out-of-order-execution? ( command-queue -- ? )
+    CL_QUEUE_PROPERTIES command-queue-info-ulong
+    CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE bitand 0 = not ; inline
+
+: cl-profiling? ( command-queue -- ? )
+    CL_QUEUE_PROPERTIES command-queue-info-ulong
+    CL_QUEUE_PROFILING_ENABLE bitand 0 = not ; inline
+
+: <cl-buffer> ( buffer-access-mode size initial-data -- buffer )
+    [ (current-cl-context) ] 3dip
+    swap over [
+        [ handle>> ]
+        [ buffer-access-constant ]
+        [ [ CL_MEM_COPY_HOST_PTR ] [ CL_MEM_ALLOC_HOST_PTR ] if ] tri* bitor
+    ] 2dip
+    0 <int> [ clCreateBuffer ] keep *int cl-success
+    cl-buffer new-disposable swap >>handle ;
+
+: cl-read-buffer ( buffer-range -- byte-array )
+    [ (current-cl-queue) handle>> ] dip
+    [ buffer>> handle>> CL_TRUE ]
+    [ offset>> ]
+    [ size>> dup <byte-array> ] tri
+    [ 0 f f clEnqueueReadBuffer cl-success ] keep ; inline
+
+: cl-write-buffer ( buffer-range byte-array -- )
+    [
+        [ (current-cl-queue) handle>> ] dip
+        [ buffer>> handle>> CL_TRUE ]
+        [ offset>> ]
+        [ size>> ] tri
+    ] dip 0 f f clEnqueueWriteBuffer cl-success ; inline
+
+: cl-queue-copy-buffer ( src-buffer-ptr dst-buffer-ptr size dependent-events -- event )
+    [
+        (current-cl-queue)
+        [ handle>> ]
+        [ [ buffer>> handle>> ] [ offset>> ] bi ]
+        [ [ buffer>> handle>> ] [ offset>> ] bi ]
+        tri* swapd
+    ] 2dip [ length ] keep [ f ] [ [ handle>> ] void*-array{ } map-as ] if-empty
+    f <void*> [ clEnqueueCopyBuffer cl-success ] keep *void* cl-event
+    new-disposable swap >>handle ;
+
+: cl-queue-read-buffer ( buffer-range alien dependent-events -- event )
+    [
+        [ (current-cl-queue) handle>> ] dip
+        [ buffer>> handle>> CL_FALSE ] [ offset>> ] [ size>> ] tri
+    ] 2dip [ length ] keep [ f ] [ [ handle>> ] void*-array{ } map-as ] if-empty
+    f <void*> [ clEnqueueReadBuffer cl-success ] keep *void* cl-event
+    new-disposable swap >>handle ;
+
+: cl-queue-write-buffer ( buffer-range alien dependent-events -- event )
+    [
+        [ (current-cl-queue) handle>> ] dip
+        [ buffer>> handle>> CL_FALSE ] [ offset>> ] [ size>> ] tri
+    ] 2dip [ length ] keep [ f ] [ [ handle>> ] void*-array{ } map-as ] if-empty
+    f <void*> [ clEnqueueWriteBuffer cl-success ] keep *void* cl-event
+    new-disposable swap >>handle ;
+
+: <cl-sampler> ( normalized-coords? addressing-mode filter-mode -- sampler )
+    [ (current-cl-context) ] 3dip
+    [ [ CL_TRUE ] [ CL_FALSE ] if ]
+    [ addressing-mode-constant ]
+    [ filter-mode-constant ]
+    tri* 0 <int> [ clCreateSampler ] keep *int cl-success 
+    cl-sampler new-disposable swap >>handle ;
+
+: cl-normalized-coords? ( sampler -- ? )
+    handle>> CL_SAMPLER_NORMALIZED_COORDS sampler-info-bool ; inline
+
+: cl-addressing-mode ( sampler -- addressing-mode )
+    handle>> CL_SAMPLER_ADDRESSING_MODE sampler-info-uint cl_addressing_mode>addressing-mode ; inline
+
+: cl-filter-mode ( sampler -- filter-mode )
+    handle>> CL_SAMPLER_FILTER_MODE sampler-info-uint cl_filter_mode>filter-mode ; inline
+
+: <cl-program> ( options strings -- program )
+    [ (current-cl-device) ] 2dip
+    [ (current-cl-context) ] dip
+    (program) -rot (build-program) ;
+
+: <cl-kernel> ( program kernel-name -- kernel )
+    [ handle>> ] [ ascii encode 0 suffix ] bi*
+    0 <int> [ clCreateKernel ] keep *int cl-success
+    cl-kernel new-disposable swap >>handle ; inline
+
+: cl-kernel-name ( kernel -- string )
+    handle>> CL_KERNEL_FUNCTION_NAME kernel-info-string ;
+
+: cl-kernel-arity ( kernel -- arity )
+    handle>> CL_KERNEL_NUM_ARGS kernel-info-uint ;
+
+: cl-kernel-local-size ( kernel -- size )
+    (current-cl-device) [ handle>> ] bi@ CL_KERNEL_WORK_GROUP_SIZE kernel-work-group-info-size_t ; inline
+
+:: cl-queue-kernel ( kernel args sizes dependent-events -- event )
+    args [| arg idx | kernel idx arg bind-kernel-arg ] each-index
+    (current-cl-queue) handle>>
+    kernel handle>>
+    sizes [ length f ] [ [ ] size_t-array{ } map-as f ] bi
+    dependent-events [ length ] [ [ f ] [ [ handle>> ] void*-array{ } map-as ] if-empty ] bi
+    f <void*> [ clEnqueueNDRangeKernel cl-success ] keep *void*
+    cl-event new-disposable swap >>handle ;
+
+: cl-event-type ( event -- command-type )
+    handle>> CL_EVENT_COMMAND_TYPE event-info-uint cl_command_type>command-type ; inline
+
+: cl-event-status ( event -- execution-status )
+    handle>> CL_EVENT_COMMAND_EXECUTION_STATUS event-info-int cl_int>execution-status ; inline
+
+: cl-profile-counters ( event -- queued submitted started finished )
+    handle>> {
+        [ CL_PROFILING_COMMAND_QUEUED profiling-info-ulong ]
+        [ CL_PROFILING_COMMAND_SUBMIT profiling-info-ulong ]
+        [ CL_PROFILING_COMMAND_START  profiling-info-ulong ]
+        [ CL_PROFILING_COMMAND_END    profiling-info-ulong ]
+    } cleave ; inline
+
+: cl-barrier-events ( event/events -- )
+    [ (current-cl-queue) handle>> ] dip
+    dup sequence? [ 1array ] unless
+    [ handle>> ] void*-array{ } map-as [ length ] keep clEnqueueWaitForEvents cl-success ; inline
+
+: cl-marker ( -- event )
+    (current-cl-queue)
+    f <void*> [ clEnqueueMarker cl-success ] keep *void* cl-event new-disposable
+    swap >>handle ; inline
+
+: cl-barrier ( -- )
+    (current-cl-queue) clEnqueueBarrier cl-success ; inline
+: cl-flush ( -- )
+    (current-cl-queue) handle>> clFlush cl-success ; inline
+
+: cl-wait ( event/events -- )
+    dup sequence? [ 1array ] unless
+    [ handle>> ] void*-array{ } map-as [ length ] keep clWaitForEvents cl-success ; inline
+
+: cl-finish ( -- )
+    (current-cl-queue) handle>> clFinish cl-success ; inline
diff --git a/extra/opencl/summary.txt b/extra/opencl/summary.txt
new file mode 100644 (file)
index 0000000..ccb14a0
--- /dev/null
@@ -0,0 +1 @@
+High-level vocabulary for using OpenCL
diff --git a/extra/opencl/syntax/authors.txt b/extra/opencl/syntax/authors.txt
new file mode 100644 (file)
index 0000000..6f03a12
--- /dev/null
@@ -0,0 +1 @@
+Erik Charlebois
diff --git a/extra/opencl/syntax/syntax.factor b/extra/opencl/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..e9dbabd
--- /dev/null
@@ -0,0 +1,8 @@
+! Copyright (C) 2010 Erik Charlebois.
+! See http://factorcode.org/license.txt for BSD license.
+USING: classes.parser classes.singleton classes.union kernel lexer
+sequences ;
+IN: opencl.syntax
+
+SYNTAX: SINGLETONS-UNION:
+    CREATE-CLASS ";" parse-tokens [ create-class-in [ define-singleton-class ] keep ] map define-union-class ;
diff --git a/extra/opencl/syntax/tags.txt b/extra/opencl/syntax/tags.txt
new file mode 100644 (file)
index 0000000..700f0dc
--- /dev/null
@@ -0,0 +1 @@
+not tested
diff --git a/extra/opencl/tags.txt b/extra/opencl/tags.txt
new file mode 100644 (file)
index 0000000..ba3ee02
--- /dev/null
@@ -0,0 +1,2 @@
+bindings
+not tested
index 6409a3781b97368fac4b1ad8c87840f66be0d28d..856740d22956cad3d5c2ce5c49d53c37c236a466 100644 (file)
@@ -9,7 +9,7 @@ IN: opengl.glu
 os {
     { [ dup macosx? ] [ drop ] }
     { [ dup windows? ] [ drop ] }
-    { [ dup unix? ] [ drop "glu" "libGLU.so.1" "cdecl" add-library ] }
+    { [ dup unix? ] [ drop "glu" "libGLU.so.1" cdecl add-library ] }
 } cond
 
 >>
@@ -218,9 +218,9 @@ FUNCTION: void gluEndCurve ( GLUnurbs* nurb ) ;
 FUNCTION: void gluEndPolygon ( GLUtesselator* tess ) ;
 FUNCTION: void gluEndSurface ( GLUnurbs* nurb ) ;
 FUNCTION: void gluEndTrim ( GLUnurbs* nurb ) ;
-FUNCTION: char* gluErrorString ( GLenum error ) ;
+FUNCTION: c-string gluErrorString ( GLenum error ) ;
 FUNCTION: void gluGetNurbsProperty ( GLUnurbs* nurb, GLenum property, GLfloat* data ) ;
-FUNCTION: char* gluGetString ( GLenum name ) ;
+FUNCTION: c-string gluGetString ( GLenum name ) ;
 FUNCTION: void gluGetTessProperty ( GLUtesselator* tess, GLenum which, GLdouble* data ) ;
 FUNCTION: void gluLoadSamplingMatrices ( GLUnurbs* nurb, GLfloat* model, GLfloat* perspective, GLint* view ) ;
 FUNCTION: void gluLookAt ( GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ ) ;
index 2b19d95833a482ca9b90055791749c60907fc223..201b91e5e7b3f918a88a19731800a48d4ef53c9d 100644 (file)
@@ -23,7 +23,7 @@ M: pair at*
     ] if-key ; inline
 
 M: pair set-at
-    [ (>>value) ] [
+    [ value<< ] [
         [ set-at ]
         [ [ associate ] dip swap >>hash drop ] if-hash
     ] if-key ; inline
diff --git a/extra/path-finding/authors.txt b/extra/path-finding/authors.txt
new file mode 100644 (file)
index 0000000..f3b0233
--- /dev/null
@@ -0,0 +1 @@
+Samuel Tardieu
diff --git a/extra/path-finding/path-finding-docs.factor b/extra/path-finding/path-finding-docs.factor
new file mode 100644 (file)
index 0000000..46f1048
--- /dev/null
@@ -0,0 +1,97 @@
+! Copyright (C) 2010 Samuel Tardieu.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax ;
+IN: path-finding
+
+{ <astar> <bfs> } related-words
+
+HELP: astar
+{ $description "This tuple must be subclassed and its method " { $link cost } ", "
+  { $link heuristic } ", and " { $link neighbours } " must be implemented. "
+  "Alternatively, the " { $link <astar> } " word can be used to build a non-specialized version." } ;
+
+HELP: cost
+{ $values
+  { "from" "a node" }
+  { "to" "a node" }
+  { "astar" "an instance of a subclassed " { $link astar } " tuple" }
+  { "n" "a number" }
+}
+{ $description "Return the cost to go from " { $snippet "from" } " to " { $snippet "to" } ". "
+  { $snippet "to" } " is necessarily a neighbour of " { $snippet "from" } "."
+} ;
+
+HELP: heuristic
+{ $values
+  { "from" "a node" }
+  { "to" "a node" }
+  { "astar" "an instance of a subclassed " { $link astar } " tuple" }
+  { "n" "a number" }
+}
+{ $description "Return the estimated (undervalued) cost to go from " { $snippet "from" } " to " { $snippet "to" } ". "
+  { $snippet "from" } " and " { $snippet "to" } " are not necessarily neighbours."
+} ;
+
+HELP: neighbours
+{ $values
+  { "node" "a node" }
+  { "astar" "an instance of a subclassed " { $link astar } " tuple" }
+  { "seq" "a sequence of nodes" }
+}
+{ $description "Return the list of nodes reachable from " { $snippet "node" } "." } ;
+
+HELP: <astar>
+{ $values
+  { "neighbours" "a quotation with stack effect ( node -- seq )" }
+  { "cost" "a quotation with stack effect ( from to -- cost )" }
+  { "heuristic" "a quotation with stack effect ( pos target -- cost )" }
+  { "astar" "a astar tuple" }
+}
+{ $description "Build an astar object from the given quotations. The "
+  { $snippet "neighbours" } " one builds the list of neighbours. The "
+  { $snippet "cost" } " and " { $snippet "heuristic" } " ones represent "
+  "respectively the cost for transitioning from a node to one of its neighbour, "
+  "and the underestimated cost for going from a node to the target. This solution "
+  "may not be as efficient as subclassing the " { $link astar } " tuple."
+} ;
+
+HELP: <bfs>
+{ $values
+  { "neighbours" "an assoc" }
+  { "astar" "a astar tuple" }
+}
+{ $description "Build an astar object from the " { $snippet "neighbours" } " assoc. "
+  "When used with " { $link find-path } ", this astar tuple will use the breadth-first search (BFS) "
+  "path finding algorithm which is a particular case of the general A* algorithm."
+} ;
+
+HELP: find-path
+{ $values
+  { "start" "a node" }
+  { "target" "a node" }
+  { "astar" "a astar tuple" }
+  { "path/f" "an optimal path from " { $snippet "start" } " to " { $snippet "target" }
+    ", or f if no such path exists" }
+}
+{ $description "Find a path between " { $snippet "start" } " and " { $snippet "target" }
+  " using the A* algorithm."
+} ;
+
+HELP: considered
+{ $values
+  { "astar" "a astar tuple" }
+  { "considered" "a sequence" }
+}
+{ $description "When called after a call to " { $link find-path } ", return a list of nodes "
+  "which have been examined during the A* exploration."
+} ;
+
+ARTICLE: "path-finding" "Path finding using the A* algorithm"
+"The " { $vocab-link "path-finding" } " vocabulary implements a graph search algorithm for finding the least-cost path from one node to another using the A* algorithm." $nl
+"The " { $link astar } " tuple may be derived from and its " { $link cost } ", " { $link heuristic } ", and " { $link neighbours } " methods overwritten, or the " { $link <astar> } " or " { $link <bfs> } " words can be used to build a new tuple." $nl
+"Make an A* object:"
+{ $subsections <astar> <bfs> }
+"Find a path between nodes:"
+{ $subsections find-path } ;
+
+ABOUT: "path-finding"
diff --git a/extra/path-finding/path-finding-tests.factor b/extra/path-finding/path-finding-tests.factor
new file mode 100644 (file)
index 0000000..11a047c
--- /dev/null
@@ -0,0 +1,122 @@
+! Copyright (C) 2010 Samuel Tardieu.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs combinators hashtables kernel literals math math.functions
+math.vectors memoize path-finding sequences sorting splitting strings tools.test ;
+IN: path-finding.tests
+
+! Use a 10x9 maze (see below) to try to go from s to e, f or g.
+! X means that a position is unreachable.
+! The costs model is:
+!   - going up costs 5 points
+!   - going down costs 1 point
+!   - going left or right costs 2 points
+
+<<
+
+TUPLE: maze < astar ;
+
+: reachable? ( pos -- ? )
+    first2 [ 2 * 5 + ] [ 2 + ] bi* $[
+"    0 1 2 3 4 5 6 7 8 9
+
+  0  X X X X X X X X X X
+  1  X s           f X X
+  2  X X X X   X X X X X
+  3  X X X X   X X X X X
+  4  X X X X   X       X
+  5  X X       X   X   X
+  6  X X X X   X   X e X
+  7  X g   X           X
+  8  X X X X X X X X X X"
+        "\n" split ] nth nth CHAR: X = not ;
+
+M: maze neighbours
+    drop
+    first2
+    { [ 1 + 2array ] [ 1 - 2array ] [ [ 1 + ] dip 2array ] [ [ 1 - ] dip 2array ] } 2cleave
+    4array
+    [ reachable? ] filter ;
+
+M: maze heuristic
+    drop v- [ abs ] [ + ] map-reduce ;
+
+M: maze cost
+    drop 2dup [ first ] bi@ = [ [ second ] bi@ > 1 5 ? ] [ 2drop 2 ] if ;
+
+: test1 ( to -- path considered )
+    { 1 1 } swap maze new [ find-path ] [ considered ] bi ;
+>>
+
+! Existing path from s to f
+[
+    {
+        { 1 1 }
+        { 2 1 }
+        { 3 1 }
+        { 4 1 }
+        { 4 2 }
+        { 4 3 }
+        { 4 4 }
+        { 4 5 }
+        { 4 6 }
+        { 4 7 }
+        { 5 7 }
+        { 6 7 }
+        { 7 7 }
+        { 8 7 }
+        { 8 6 }
+    }
+] [
+    { 8 6 } test1 drop
+] unit-test
+
+! Check that only the right positions have been considered in the s to f path
+[ 7 ] [ { 7 1 } test1 nip length ] unit-test
+
+! Non-existing path from s to g -- all positions must have been considered
+[ f 26 ] [ { 1 7 } test1 length ] unit-test
+
+! Look for a path between A and C. The best path is A --> D --> C. C will be placed
+! in the open set early because B will be examined first. This checks that the evaluation
+! of C is correctly replaced in the open set.
+!
+! We use no heuristic here and always return 0.
+!
+!       (5)
+!     B ---> C <--------
+!                        \ (2)
+!     ^      ^            |
+!     |      |            |
+! (1) |      | (2)        |
+!     |      |            |
+!
+!     A ---> D ---------> E ---> F
+!       (2)       (1)       (1)
+
+<<
+
+! In this version, we will use the quotations-aware version through <astar>.
+
+MEMO: routes ( -- hash ) $[ { "ABD" "BC" "C" "DCE" "ECF" } [ unclip swap 2array ] map >hashtable ] ;
+
+: n ( pos -- neighbours )
+    routes at ;
+
+: c ( from to -- cost )
+    "" 2sequence H{ { "AB" 1 } { "AD" 2 } { "BC" 5 } { "DC" 2 } { "DE" 1 } { "EC" 2 } { "EF" 1 } } at ;
+
+: test2 ( fromto -- path considered )
+    first2 [ n ] [ c ] [ 2drop 0 ] <astar> [ find-path ] [ considered natural-sort >string ] bi ;
+>>
+
+! Check path from A to C -- all nodes but F must have been examined
+[ "ADC" "ABCDE" ] [ "AC" test2 [ >string ] dip ] unit-test
+
+! No path from D to B -- all nodes reachable from D must have been examined
+[ f "CDEF" ] [ "DB" test2 ] unit-test
+
+! Find a path using BFS. There are no path from F to A, and the path from D to
+! C does not include any other node.
+
+[ f ] [ "FA" first2 routes <bfs> find-path ] unit-test
+[ "DC" ] [ "DC" first2 routes <bfs> find-path >string ] unit-test
diff --git a/extra/path-finding/path-finding.factor b/extra/path-finding/path-finding.factor
new file mode 100644 (file)
index 0000000..cd63a5c
--- /dev/null
@@ -0,0 +1,89 @@
+! Copyright (C) 2010 Samuel Tardieu.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors assocs hash-sets heaps kernel math sequences sets shuffle ;
+IN: path-finding
+
+! This implements the A* algorithm. See http://en.wikipedia.org/wiki/A*
+
+TUPLE: astar g in-closed-set ;
+GENERIC: cost ( from to astar -- n )
+GENERIC: heuristic ( from to astar -- n )
+GENERIC: neighbours ( node astar -- seq )
+
+<PRIVATE
+
+TUPLE: (astar) astar goal origin in-open-set open-set ;
+
+: (add-to-open-set) ( h node astar -- )
+    2dup in-open-set>> at* [ over open-set>> heap-delete ] [ drop ] if
+    [ swapd open-set>> heap-push* ] [ in-open-set>> set-at ] 2bi ;
+
+: add-to-open-set ( node astar -- )
+    [ astar>> g>> at ] 2keep
+    [ [ goal>> ] [ astar>> heuristic ] bi + ] 2keep
+    (add-to-open-set) ;
+
+: ?add-to-open-set ( node astar -- )
+    2dup astar>> in-closed-set>> in? [ 2drop ] [ add-to-open-set ] if ;
+
+: move-to-closed-set ( node astar -- )
+    [ astar>> in-closed-set>> adjoin ] [ in-open-set>> delete-at ] 2bi ;
+
+: get-first ( astar -- node )
+    [ open-set>> heap-pop drop dup ] [ move-to-closed-set ] bi ;
+
+: set-g ( origin g node astar -- )
+    [ [ origin>> set-at ] [ astar>> g>> set-at ] bi-curry bi-curry bi* ] [ ?add-to-open-set ] 2bi ;
+
+: cost-through ( origin node astar -- cost )
+    [ astar>> cost ] [ nip astar>> g>> at ] 3bi + ;
+
+: ?set-g ( origin node astar -- )
+    [ cost-through ] 3keep [ swap ] 2dip
+    3dup astar>> g>> at [ 1/0. ] unless* > [ 4drop ] [ set-g ] if ;
+
+: build-path ( target astar -- path )
+    [ over ] [ over [ [ origin>> at ] keep ] dip ] produce 2nip reverse ;
+
+: handle ( node astar -- )
+    dupd [ astar>> neighbours ] keep [ ?set-g ] curry with each ;
+
+: (find-path) ( astar -- path/f )
+    dup open-set>> heap-empty? [
+        drop f
+    ] [
+        [ get-first ] keep 2dup goal>> = [ build-path ] [ [ handle ] [ (find-path) ] bi ] if
+    ] if ;
+
+: (init) ( from to astar -- )
+    swap >>goal
+    H{ } clone over astar>> g<<
+    { } <hash-set> over astar>> in-closed-set<<
+    H{ } clone >>origin
+    H{ } clone >>in-open-set
+    <min-heap> >>open-set
+    [ 0 ] 2dip [ (add-to-open-set) ] [ astar>> g>> set-at ] 3bi ;
+
+TUPLE: astar-simple < astar cost heuristic neighbours ;
+M: astar-simple cost cost>> call( n1 n2 -- c ) ;
+M: astar-simple heuristic heuristic>> call( n1 n2 -- c ) ;
+M: astar-simple neighbours neighbours>> call( n -- neighbours ) ;
+
+TUPLE: bfs < astar neighbours ;
+M: bfs cost 3drop 1 ;
+M: bfs heuristic 3drop 0 ;
+M: bfs neighbours neighbours>> at ;
+
+PRIVATE>
+
+: find-path ( start target astar -- path/f )
+    (astar) new [ astar<< ] keep [ (init) ] [ (find-path) ] bi ;
+
+: <astar> ( neighbours cost heuristic -- astar )
+    astar-simple new swap >>heuristic swap >>cost swap >>neighbours ;
+
+: considered ( astar -- considered )
+    in-closed-set>> members ;
+
+: <bfs> ( neighbours -- astar )
+    [ bfs new ] dip >>neighbours ;
diff --git a/extra/path-finding/summary.txt b/extra/path-finding/summary.txt
new file mode 100644 (file)
index 0000000..ff3167a
--- /dev/null
@@ -0,0 +1 @@
+A* path-finding algorithm
index b33b8e5710e3fb1a79d1913277cc821225e0f825..75af1b604a0468529b265163b998c239919a365a 100644 (file)
@@ -263,4 +263,4 @@ ERROR: bad-suit-symbol ch ;
     string>value value>hand-name ;
 
 SYNTAX: HAND{
-    "}" parse-tokens [ card> ] { } map-as suffix! ;
+    "}" [ card> ] map-tokens suffix! ;
index 030d265f37ac37d566f4c0f808b174d5f400e8b3..c99eb8678e11914ff6a83d24d885cdbad6014fa8 100644 (file)
@@ -45,7 +45,7 @@ TUPLE: raw-source top headers content ;
 : get-ok-and-total ( -- total )
     stream [
         readln dup "+OK" head? [
-            " " split second string>number dup account (>>count)
+            " " split second string>number dup account count<<
         ] [ throw ] if
     ] with-stream* ;
 
@@ -78,13 +78,13 @@ TUPLE: raw-source top headers content ;
 : (list) ( -- )
     stream [
         "LIST" command
-        readlns account (>>list)
+        readlns account list<<
     ] with-stream* ;
 
 : (uidls) ( -- )
     stream [
         "UIDL" command
-        readlns account (>>uidls)
+        readlns account uidls<<
     ] with-stream* ;
 
 PRIVATE>
@@ -115,7 +115,7 @@ PRIVATE>
 : capa ( -- array )
     stream [
         "CAPA" command
-        readlns dup account (>>capa)
+        readlns dup account capa<<
     ] with-stream* ;
 
 : count ( -- n )
@@ -140,7 +140,7 @@ PRIVATE>
         "TOP " _ number>string append " "
         append _ number>string append
         command
-        readlns dup raw (>>top)
+        readlns dup raw top<<
     ] with-stream* ;
 
 : headers ( -- assoc )
@@ -168,7 +168,7 @@ PRIVATE>
 : retrieve ( message# -- seq )
     [ stream ] dip '[
         "RETR " _ number>string append command
-        readlns dup raw (>>content)
+        readlns dup raw content<<
     ] with-stream* ;
 
 : delete ( message# -- )
index fe09914d9f2edc125dd065df911e0383b825eab2..342e8d1a9edde3b95cdb33431cec84cc1408e039 100644 (file)
@@ -29,7 +29,7 @@ IN: project-euler.004
 PRIVATE>
 
 : euler004 ( -- answer )
-    source-004 dup cartesian-product [ product ] map prune max-palindrome ;
+    source-004 dup [ * ] cartesian-map combine max-palindrome ;
 
 ! [ euler004 ] 100 ave-time
 ! 1164 ms ave run time - 39.35 SD (100 trials)
index 0c697236aaa63d86dc05e17d46853db172e5c23c..cd2620bc4f7d30dc2185c08ce9fd6f02db678ecf 100644 (file)
@@ -47,7 +47,7 @@ IN: project-euler.027
 
 : source-027 ( -- seq )
     1000 iota [ prime? ] filter [ dup [ neg ] map append ] keep
-    cartesian-product [ first2 < ] filter ;
+    cartesian-product concat [ first2 < ] filter ;
 
 : quadratic ( b a n -- m )
     dup sq -rot * + + ;
index 73773e1887d146ab5e83b77e0883b64e03d0cb75..944d345938edaa51be30ff726224ec204279aad9 100644 (file)
@@ -29,7 +29,7 @@ IN: project-euler.029
 ! --------
 
 : euler029 ( -- answer )
-    2 100 [a,b] dup cartesian-product [ first2 ^ ] map prune length ;
+    2 100 [a,b] dup [ ^ ] cartesian-map concat members length ;
 
 ! [ euler029 ] 100 ave-time
 ! 704 ms ave run time - 28.07 SD (100 trials)
index 8fb7a2bfaa8c83b45d0d8d7203cb1fb6ac3b1a46..de0cb72609faf3bb0f1d0755d97b32af09289b51 100644 (file)
@@ -48,7 +48,7 @@ IN: project-euler.032
 PRIVATE>
 
 : euler032 ( -- answer )
-    source-032 [ valid? ] filter products prune sum ;
+    source-032 [ valid? ] filter products members sum ;
 
 ! [ euler032 ] 10 ave-time
 ! 16361 ms ave run time - 417.8 SD (10 trials)
@@ -62,17 +62,17 @@ PRIVATE>
 
 <PRIVATE
 
-: source-032a ( -- seq )
-    50 [1,b] 2000 [1,b] cartesian-product ;
-
 ! multiplicand/multiplier/product
-: mmp ( pair -- n )
-    first2 2dup * [ number>string ] tri@ 3append string>number ;
+: mmp ( x y -- n )
+    2dup * [ number>string ] tri@ 3append string>number ;
 
 PRIVATE>
 
 : euler032a ( -- answer )
-    source-032a [ mmp ] map [ pandigital? ] filter products prune sum ;
+    50 [1,b] 2000 [1,b]
+    [ mmp ] cartesian-map concat
+    [ pandigital? ] filter
+    products members sum ;
 
 ! [ euler032a ] 10 ave-time
 ! 2624 ms ave run time - 131.91 SD (10 trials)
index 780015ab77b8b6e90a96559036c2d69b0c4a20f8..77bae6d2f2309fb1ab3dfd8de21096bb9b7db677 100644 (file)
@@ -30,7 +30,7 @@ IN: project-euler.033
 <PRIVATE
 
 : source-033 ( -- seq )
-    10 99 [a,b] dup cartesian-product [ first2 < ] filter ;
+    10 99 [a,b] dup cartesian-product concat [ first2 < ] filter ;
 
 : safe? ( ax xb -- ? )
     [ 10 /mod ] bi@ [ = ] dip zero? not and nip ;
index 7d98de62b1bb26a7825e75ff71a91d79cae19f29..ee4af8172016213ced8ab0e03b7a9c50f241b35a 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (c) 2008 Aaron Schaefer.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel math math.combinatorics math.parser math.primes
-    project-euler.common sequences sets ;
+    project-euler.common sequences ;
 IN: project-euler.035
 
 ! http://projecteuler.net/index.php?section=problems&id=35
@@ -28,7 +28,7 @@ IN: project-euler.035
 
 : possible? ( seq -- ? )
     dup length 1 > [
-        dup { 0 2 4 5 6 8 } diff =
+        [ even? ] any? not
     ] [
         drop t
     ] if ;
index 4991d65a895c4f7c032ed0f68c134d774c35d23b..ab59843e2155ec30f91ec9cc48a50b6b00cdd990 100644 (file)
@@ -86,7 +86,8 @@ PRIVATE>
 
 : interesting-pandigitals ( -- seq )
     17 candidates { 13 11 7 5 3 2 } [
-        candidates swap cartesian-product [ overlap? ] filter clean
+        candidates swap cartesian-product concat
+        [ overlap? ] filter clean
     ] each [ add-missing-digit ] map ;
 
 PRIVATE>
index ff45e9e58a031552dc6650b3add204d1b957272e..f0bdd69901e1fc26bb75c54caa4e0db5118e776c 100644 (file)
@@ -29,6 +29,7 @@
 USING: assocs kernel math math.combinatorics math.functions
 math.parser math.primes namespaces project-euler.common
 sequences sets strings grouping math.ranges arrays fry math.order ;
+FROM: namespaces => set ;
 IN: project-euler.051
 <PRIVATE
 SYMBOL: family-count
index 76c275e4dde21dbabc1d3cb43061f3b9685e8cae..98e39ebd3695464c772a9777d9deab7b2b7878ec 100644 (file)
@@ -23,7 +23,7 @@ IN: project-euler.056
 ! Through analysis, you only need to check when a and b > 90
 
 : euler056 ( -- answer )
-    90 100 [a,b) dup cartesian-product
+    90 100 [a,b) dup cartesian-product concat
     [ first2 ^ number>digits sum ] [ max ] map-reduce ;
 
 ! [ euler056 ] 100 ave-time
index 1fb5c7c8bbd8328b3ade34d079d0853441387e71..306746b601f667adf60016ae519281bf7f4c296d 100644 (file)
@@ -70,7 +70,7 @@ INSTANCE: rollover immutable-sequence
     over length <rollover> swap [ bitxor ] 2map ;
 
 : frequency-analysis ( seq -- seq )
-    dup prune [
+    dup members [
         [ 2dup [ = ] curry count 2array , ] each
     ] { } make nip ; inline
 
index 3ad740670312e4462f25d2bc0c3b7fe0cec156ec..e0a616dc52f1dbbc91a52ce1d648295e21bfd3a8 100644 (file)
@@ -35,7 +35,7 @@ IN: project-euler.079
     ] { } make ;
 
 : find-source ( seq -- elt )
-    unzip diff prune
+    unzip diff
     [ "Topological sort failed" throw ] [ first ] if-empty ;
 
 : remove-source ( seq elt -- seq )
@@ -52,7 +52,7 @@ PRIVATE>
 
 : topological-sort ( seq -- seq )
     [ [ (topological-sort) ] { } make ] keep
-    concat prune over diff append ;
+    combine over diff append ;
 
 : euler079 ( -- answer )
     source-079 >edges topological-sort 10 digits>integer ;
@@ -60,7 +60,7 @@ PRIVATE>
 ! [ euler079 ] 100 ave-time
 ! 1 ms ave run time - 0.46 SD (100 trials)
 
-! TODO: prune and diff are relatively slow; topological sort could be
+! TODO: set words on sequences are relatively slow; topological sort could be
 ! cleaned up and generalized much better, but it works for this problem
 
 SOLUTION: euler079
index cc5e93d7a86412702e52cf175c1151c1b3162273..73936ba2ed1510e4ad1db4c8f60fb81f37365b01 100644 (file)
@@ -60,8 +60,8 @@ IN: project-euler.081
     3dup minimal-path-sum-to '[ _ + ] change-matrix ;
 
 : (euler081) ( matrix -- n )
-    dup first length iota dup cartesian-product
-    [ first2 pick update-minimal-path-sum ] each
+    dup first length iota dup
+    [ pick update-minimal-path-sum ] cartesian-each
     last last ;
 
 PRIVATE>
index 9c12367cdfd727b1f24fc8edea5a060d11e3182c..bc94811a7662b503231f2e94f35321f9a493e57d 100644 (file)
@@ -29,7 +29,7 @@ IN: project-euler.085
 : rectangles-count ( a b -- n )
     2dup [ 1 + ] bi@ * * * 4 /i ; inline
 
-:: each-unique-product ( a b quot: ( i j -- ) -- )
+:: each-unique-product ( ... a b quot: ( ... i j -- ... ) -- ... )
     a b [a,b] [| i |
         i b [a,b] [| j |
             i j quot call
index 806098b865ebea4754e88b3c9be2226377870306..2077fe328e51b2267aadddf79095d902ee0d83a3 100644 (file)
@@ -45,7 +45,7 @@ IN: project-euler.203
     [ 0 prefix ] [ 0 suffix ] bi [ + ] 2map ;
 
 : generate ( n -- seq )
-    1 - { 1 } [ (generate) ] iterate concat prune ;
+    1 - { 1 } [ (generate) ] iterate combine ;
 
 : squarefree ( n -- ? )
     factors all-unique? ;
index 06946d4db7548225a79c5d3cd4ce643f3e36b645..10f5259bdc4146382612eee01836f17554acb482 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (c) 2010 Aaron Schaefer. All rights reserved.
 ! The contents of this file are licensed under the Simplified BSD License
 ! A copy of the license is available at http://factorcode.org/license.txt
-USING: grouping kernel math math.ranges project-euler.common sequences ;
+USING: grouping kernel math math.ranges project-euler.common
+sequences sequences.cords assocs ;
 IN: project-euler.206
 
 ! http://projecteuler.net/index.php?section=problems&id=206
@@ -30,10 +31,10 @@ CONSTANT: hi 1389026570
 
 : form-fitting? ( n -- ? )
     number>digits 2 group [ first ] map
-    { 1 2 3 4 5 6 7 8 9 0 } = ;
+    { 1 2 3 4 5 6 7 8 9 0 } sequence= ;
 
 : candidates ( -- seq )
-    lo lo 40 + [ hi 100 <range> ] bi@ append ;
+    lo lo 40 + [ hi 100 <range> ] bi@ cord-append ;
 
 PRIVATE>
 
diff --git a/extra/project-euler/265/265-tests.factor b/extra/project-euler/265/265-tests.factor
new file mode 100644 (file)
index 0000000..5e6a7f4
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (c) 2010 Samuel Tardieu.
+! See http://factorcode.org/license.txt for BSD license.
+USING: project-euler.265 tools.test ;
+
+[ 209110240768 ] [ euler265 ] unit-test
diff --git a/extra/project-euler/265/265.factor b/extra/project-euler/265/265.factor
new file mode 100644 (file)
index 0000000..f9ae939
--- /dev/null
@@ -0,0 +1,63 @@
+! Copyright (c) 2010 Samuel Tardieu.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math math.functions project-euler.common sequences sets ;
+IN: project-euler.265
+
+! http://projecteuler.net/index.php?section=problems&id=265
+
+! 2^(N) binary digits can be placed in a circle so that all the N-digit
+! clockwise subsequences are distinct.
+
+! For N=3, two such circular arrangements are possible, ignoring rotations.
+
+! For the first arrangement, the 3-digit subsequences, in clockwise order, are:
+! 000, 001, 010, 101, 011, 111, 110 and 100.
+
+! Each circular arrangement can be encoded as a number by concatenating
+! the binary digits starting with the subsequence of all zeros as the most
+! significant bits and proceeding clockwise. The two arrangements for N=3 are
+! thus represented as 23 and 29:
+! 00010111 _(2) = 23
+! 00011101 _(2) = 29
+
+! Calling S(N) the sum of the unique numeric representations, we can see that S(3) = 23 + 29 = 52.
+
+! Find S(5).
+
+CONSTANT: N 5
+
+: decompose ( n -- seq )
+    N iota [ drop [ 2/ ] [ 1 bitand ] bi ] map nip reverse ;
+
+: bits ( seq -- n )
+    0 [ [ 2 * ] [ + ] bi* ] reduce ;
+
+: complete ( seq -- seq' )
+    unclip decompose append [ 1 bitand ] map ;
+
+: rotate-bits ( seq -- seq' )
+    dup length iota [ cut prepend bits ] with map ;
+
+: ?register ( acc seq -- )
+    complete rotate-bits
+    dup [ 2 N ^ mod ] map all-unique? [ infimum swap push ] [ 2drop ] if ;
+
+: add-bit ( seen bit -- seen' t/f )
+    over last 2 * + 2 N ^ mod
+    2dup swap member? [ drop f ] [ suffix t ] if ;
+
+: iterate ( acc left seen -- )
+    over 0 = [
+        nip ?register
+    ] [
+        [ 1 - ] dip
+        { 0 1 } [ add-bit [ iterate ] [ 3drop ] if ] with with with each
+    ] if ;
+
+: euler265 ( -- answer )
+    V{ } clone [ 2 N ^ N - { 0 } iterate ] [ sum ] bi ;
+
+! [ euler265 ] time
+! Running time: 0.376389019 seconds
+
+SOLUTION: euler265
index 48520ef56528f4dd17e5f45925f0a00ac461d876..7474850f8f1e34bc65fc7ec55122d7b13c2256e3 100644 (file)
@@ -68,9 +68,6 @@ PRIVATE>
 : alpha-value ( str -- n )
     >lower [ CHAR: a - 1 + ] map-sum ;
 
-: cartesian-product ( seq1 seq2 -- seq1xseq2 )
-    [ [ 2array ] with map ] curry map concat ;
-
 : mediant ( a/c b/d -- (a+b)/(c+d) )
     2>fraction [ + ] 2bi@ / ;
 
@@ -160,6 +157,6 @@ PRIVATE>
 SYNTAX: SOLUTION:
     scan-word
     [ name>> "-main" append create-in ] keep
-    [ drop current-vocab (>>main) ]
+    [ drop current-vocab main<< ]
     [ [ . ] swap prefix (( -- )) define-declared ]
     2bi ;
index 4131f41b1f74b00c54ff2996e9eb11c204587eb1..77017ce5780e4fd91f9a8334edd36599a873170f 100644 (file)
@@ -26,7 +26,7 @@ USING: definitions io io.files io.pathnames kernel math math.parser
     project-euler.134 project-euler.148 project-euler.150 project-euler.151
     project-euler.164 project-euler.169 project-euler.173 project-euler.175
     project-euler.186 project-euler.188 project-euler.190 project-euler.203
-    project-euler.206 project-euler.215 project-euler.255 ;
+    project-euler.206 project-euler.215 project-euler.255 project-euler.265 ;
 IN: project-euler
 
 <PRIVATE
index 7c2bdd0d28007546253a9b696c72f5651ae1da9e..ab0e9bda23bcda7b42c39188a0b3333f5ee2907a 100644 (file)
@@ -80,7 +80,7 @@ DEFER: in-rect*
 
 : leaf-insert ( value point leaf -- )
     2dup leaf-replaceable?
-    [ [ (>>point) ] [ (>>value) ] bi ]
+    [ [ point<< ] [ value<< ] bi ]
     [ split-leaf ] if ;
 
 : node-insert ( value point node -- )
index 3fda392d805ab4ee2ab5a23eec0f24d2984d4edd..44bb016267299335e3cce635d4ee2d0e92bf9f89 100644 (file)
@@ -42,7 +42,7 @@ M:: cmwc random-32* ( cmwc -- n )
     [ [ i>> ] [ Q>> ] bi nth-unsafe * ]
     [ c>> + ] tri
 
-    [ >fixnum -32 shift cmwc (>>c) ]
+    [ >fixnum -32 shift cmwc c<< ]
     [ cmwc [ b>> bitand ] [ c>> + ] bi 32 bits ] bi
 
     dup cmwc r>> > [
index 7157e3f025a059f1cc51f3de1061ac838bf43d12..4689633b61f013955a568e9ebd3c5317e4ccdfe0 100644 (file)
@@ -12,7 +12,7 @@ TUPLE: repeating circular len ;
     dupd <repeating> swap like ;
 
 M: repeating length len>> ;
-M: repeating set-length (>>len) ;
+M: repeating set-length len<< ;
 
 M: repeating virtual@ ( n seq -- n' seq' ) circular>> ;
 
diff --git a/extra/set-n/set-n.factor b/extra/set-n/set-n.factor
deleted file mode 100644 (file)
index 80d8bf2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-USING: accessors assocs fry generalizations kernel locals math
-namespaces parser sequences shuffle words ;
-IN: set-n
-: get* ( var n -- val ) namestack dup length rot - head assoc-stack ;
-
-: set* ( val var n -- ) 1 + namestack [ length swap - ] keep nth set-at ;
-
-! dynamic lambda
-SYNTAX: :| (:) dup in>> dup length [ spin '[ _ narray _ swap zip _ bind ] ] 2curry dip define-declared ;
index dcae438679e80c4eacd9e2adbd7e17e0ab1a8899..5d97284551e01cc92dcf0891705718688d65d8a5 100644 (file)
@@ -48,4 +48,4 @@ PRIVATE>
     ] unless ;
 
 : stop-site-watcher ( -- )
-    running-site-watcher get [ cancel-alarm ] when* ;
+    running-site-watcher get [ stop-alarm ] when* ;
diff --git a/extra/slots/syntax/authors.txt b/extra/slots/syntax/authors.txt
new file mode 100755 (executable)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/slots/syntax/syntax-docs.factor b/extra/slots/syntax/syntax-docs.factor
new file mode 100755 (executable)
index 0000000..84e6e89
--- /dev/null
@@ -0,0 +1,32 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax ;
+IN: slots.syntax
+
+HELP: slots[
+{ $description "Outputs several slot values to the stack." }
+{ $example "USING: kernel prettyprint slots.syntax ;"
+           "IN: slots.syntax.example"
+           "TUPLE: rectangle width height ;"
+           "T{ rectangle { width 3 } { height 5 } } slots[ width height ] [ . ] bi@"
+           """3
+5"""
+} ;
+
+HELP: slots{
+{ $description "Outputs an array of slot values from a tuple." }
+{ $example "USING: prettyprint slots.syntax ;"
+           "IN: slots.syntax.example"
+           "TUPLE: rectangle width height ;"
+           "T{ rectangle { width 3 } { height 5 } } slots{ width height } ."
+           "{ 3 5 }"
+} ;
+
+ARTICLE: "slots.syntax" "Slots syntax sugar"
+"The " { $vocab-link "slots.syntax" } " vocabulary provides an alternative syntax for taking a sequence of slots from a tuple." $nl
+"Syntax sugar for cleaving slots to the stack:"
+{ $subsections POSTPONE: slots[ }
+"Syntax sugar for cleaving slots to an array:"
+{ $subsections POSTPONE: slots{ } ;
+
+ABOUT: "slots.syntax"
diff --git a/extra/slots/syntax/syntax-tests.factor b/extra/slots/syntax/syntax-tests.factor
new file mode 100755 (executable)
index 0000000..e4dac6e
--- /dev/null
@@ -0,0 +1,14 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: tools.test slots.syntax ;
+IN: slots.syntax.tests
+
+TUPLE: slot-test a b c ;
+
+[ 1 2 3 ] [ T{ slot-test f 1 2 3 } slots[ a b c ] ] unit-test
+[ 3 ] [ T{ slot-test f 1 2 3 } slots[ c ] ] unit-test
+[ ] [ T{ slot-test f 1 2 3 } slots[ ] ] unit-test
+
+[ { 1 2 3 } ] [ T{ slot-test f 1 2 3 } slots{ a b c } ] unit-test
+[ { 3 } ] [ T{ slot-test f 1 2 3 } slots{ c } ] unit-test
+[ { } ] [ T{ slot-test f 1 2 3 } slots{ } ] unit-test
diff --git a/extra/slots/syntax/syntax.factor b/extra/slots/syntax/syntax.factor
new file mode 100755 (executable)
index 0000000..7bfe238
--- /dev/null
@@ -0,0 +1,13 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: combinators combinators.smart fry lexer quotations
+sequences slots  ;
+IN: slots.syntax
+
+SYNTAX: slots[
+    "]" [ reader-word 1quotation ] map-tokens
+    '[ _ cleave ] append! ;
+
+SYNTAX: slots{
+    "}" [ reader-word 1quotation ] map-tokens
+    '[ [ _ cleave ] output>array ] append! ;
index 0c1a5c07d17d21e0073ddfb824ea2a84b309966b..fcb76c413503b9de83f6af47a9d3831ae5b8afc9 100644 (file)
@@ -2,10 +2,11 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs combinators.short-circuit
 continuations fry kernel namespaces quotations sequences sets
-generalizations slots locals.types splitting math
-locals.rewrite.closures generic words combinators locals smalltalk.ast
-smalltalk.compiler.lexenv smalltalk.compiler.assignment
-smalltalk.compiler.return smalltalk.selectors smalltalk.classes ;
+generalizations sequences.generalizations slots locals.types
+splitting math locals.rewrite.closures generic words combinators
+locals smalltalk.ast smalltalk.compiler.lexenv
+smalltalk.compiler.assignment smalltalk.compiler.return
+smalltalk.selectors smalltalk.classes ;
 IN: smalltalk.compiler
 
 GENERIC: compile-ast ( lexenv ast -- quot )
index 8f171f3eedc115a01dbaf6949b04870f79029b47..e6b648c3e4d3e7d234e03806a00e21ce74617a89 100644 (file)
@@ -19,6 +19,6 @@ lexenv set
 [ [ \ tuple ] ] [ "Object" lexenv get lookup-reader ] unit-test
 
 [ [ fake-local ] ] [ "jumble" lexenv get lookup-writer ] unit-test
-[ [ fake-self (>>y) ] ] [ "y" lexenv get lookup-writer ] unit-test
+[ [ fake-self y<< ] ] [ "y" lexenv get lookup-writer ] unit-test
 
 [ "blahblah" lexenv get lookup-writer ] must-fail
\ No newline at end of file
index 01bf6217697a6de602b9aa11a5aa5cc43f5fa773..14277a1f2845dfb458a7cb6f011c95b8567762b9 100755 (executable)
@@ -72,7 +72,7 @@ CONSTANT: SOUND-UFO-HIT      8
 
 : init-sounds ( cpu -- )
   init-openal
-  [ 9 gen-sources swap (>>sounds) ] keep
+  [ 9 gen-sources swap sounds<< ] keep
   [ SOUND-SHOT        "vocab:space-invaders/resources/Shot.wav" init-sound ] keep 
   [ SOUND-UFO         "vocab:space-invaders/resources/Ufo.wav" init-sound ] keep 
   [ sounds>> SOUND-UFO swap nth AL_LOOPING AL_TRUE set-source-param ] keep
@@ -83,10 +83,10 @@ CONSTANT: SOUND-UFO-HIT      8
   [ SOUND-WALK3       "vocab:space-invaders/resources/Walk3.wav" init-sound ] keep 
   [ SOUND-WALK4       "vocab:space-invaders/resources/Walk4.wav" init-sound ] keep 
   [ SOUND-UFO-HIT    "vocab:space-invaders/resources/UfoHit.wav" init-sound ] keep
-  f swap (>>looping?) ;
+  f swap looping?<< ;
 
 : cpu-init ( cpu -- cpu )
-  make-opengl-bitmap over (>>bitmap)
+  make-opengl-bitmap over bitmap<<
   [ init-sounds ] keep
   [ reset ] keep ;
 
@@ -108,7 +108,7 @@ CONSTANT: SOUND-UFO-HIT      8
   #! Bit 5 = player one left
   #! Bit 6 = player one right
   [ port1>> dup HEX: FE bitand ] keep 
(>>port1) ;
port1<< ;
 
 : read-port2 ( cpu -- byte )
   #! Port 2 maps player 2 controls and dip switches
@@ -139,7 +139,7 @@ M: space-invaders read-port ( port cpu -- byte )
 
 : write-port2 ( value cpu -- )
   #! Setting this value affects the value read from port 3
-  (>>port2o) ;
+  port2o<< ;
 
 :: bit-newly-set? ( old-value new-value bit -- bool )
   new-value bit bit? [ old-value bit bit? not ] dip and ;
@@ -159,23 +159,23 @@ M: space-invaders read-port ( port cpu -- byte )
   #! Bit 4 = Extended play sound
   over 0 bit? over looping?>> not and [ 
     dup SOUND-UFO play-invaders-sound 
-    t over (>>looping?)
+    t over looping?<<
   ] when 
   over 0 bit? not over looping?>> and [ 
     dup SOUND-UFO stop-invaders-sound 
-    f over (>>looping?)
+    f over looping?<<
   ] when 
   2dup 0 port3-newly-set? [ dup SOUND-UFO  play-invaders-sound ] when
   2dup 1 port3-newly-set? [ dup SOUND-SHOT play-invaders-sound ] when
   2dup 2 port3-newly-set? [ dup SOUND-BASE-HIT play-invaders-sound ] when
   2dup 3 port3-newly-set? [ dup SOUND-INVADER-HIT play-invaders-sound ] when
-  (>>port3o) ;
+  port3o<< ;
 
 : write-port4 ( value cpu -- )
   #! Affects the value returned by reading port 3
   [ port4hi>> ] keep 
-  [ (>>port4lo) ] keep 
-  (>>port4hi) ;
+  [ port4lo<< ] keep 
+  port4hi<< ;
 
 : write-port5 ( value cpu -- )
   #! Plays sounds
@@ -190,7 +190,7 @@ M: space-invaders read-port ( port cpu -- byte )
   2dup 2 port5-newly-set? [ dup SOUND-WALK3 play-invaders-sound ] when
   2dup 3 port5-newly-set? [ dup SOUND-WALK4 play-invaders-sound ] when
   2dup 4 port5-newly-set? [ dup SOUND-UFO-HIT play-invaders-sound ] when
-  (>>port5o) ;
+  port5o<< ;
 
 M: space-invaders write-port ( value port cpu -- )
   #! Write a byte to the hardware port, where 'port' is
@@ -219,7 +219,7 @@ M: space-invaders reset ( cpu -- )
   over get-cycles over inc-cycles
   [ swap instructions nth call( cpu -- ) ] keep  
   [ pc>> HEX: FFFF bitand ] keep 
-  (>>pc) ;
+  pc<< ;
 
 : gui-frame/2 ( cpu -- )
   [ gui-step ] keep
@@ -227,11 +227,11 @@ M: space-invaders reset ( cpu -- )
   over 16667 < [ ! cycles cpu
     nip gui-frame/2
   ] [
-    [ [ 16667 - ] dip (>>cycles) ] keep
+    [ [ 16667 - ] dip cycles<< ] keep
     dup last-interrupt>> HEX: 10 = [
-      HEX: 08 over (>>last-interrupt) HEX: 08 swap interrupt
+      HEX: 08 over last-interrupt<< HEX: 08 swap interrupt
     ] [
-      HEX: 10 over (>>last-interrupt) HEX: 10 swap interrupt
+      HEX: 10 over last-interrupt<< HEX: 10 swap interrupt
     ] if     
   ] if ;
 
@@ -239,46 +239,46 @@ M: space-invaders reset ( cpu -- )
   dup gui-frame/2 gui-frame/2 ;
 
 : coin-down ( cpu -- )
-  [ port1>> 1 bitor ] keep (>>port1) ;
+  [ port1>> 1 bitor ] keep port1<< ;
 
 : coin-up ( cpu --  )
-  [ port1>> 255 1 - bitand ] keep (>>port1) ;
+  [ port1>> 255 1 - bitand ] keep port1<< ;
 
 : player1-down ( cpu -- )
-  [ port1>> 4 bitor ] keep (>>port1) ;
+  [ port1>> 4 bitor ] keep port1<< ;
 
 : player1-up ( cpu -- )
-  [ port1>> 255 4 - bitand ] keep (>>port1) ;
+  [ port1>> 255 4 - bitand ] keep port1<< ;
 
 : player2-down ( cpu -- )
-  [ port1>> 2 bitor ] keep (>>port1) ;
+  [ port1>> 2 bitor ] keep port1<< ;
 
 : player2-up ( cpu -- )
-  [ port1>> 255 2 - bitand ] keep (>>port1) ;
+  [ port1>> 255 2 - bitand ] keep port1<< ;
 
 : fire-down ( cpu -- )
-  [ port1>> HEX: 10 bitor ] keep (>>port1) ;
+  [ port1>> HEX: 10 bitor ] keep port1<< ;
 
 : fire-up ( cpu -- )
-  [ port1>> 255 HEX: 10 - bitand ] keep (>>port1) ;
+  [ port1>> 255 HEX: 10 - bitand ] keep port1<< ;
 
 : left-down ( cpu -- )
-  [ port1>> HEX: 20 bitor ] keep (>>port1) ;
+  [ port1>> HEX: 20 bitor ] keep port1<< ;
 
 : left-up ( cpu -- )
-  [ port1>> 255 HEX: 20 - bitand ] keep (>>port1) ;
+  [ port1>> 255 HEX: 20 - bitand ] keep port1<< ;
 
 : right-down ( cpu -- )
-  [ port1>> HEX: 40 bitor ] keep (>>port1) ;
+  [ port1>> HEX: 40 bitor ] keep port1<< ;
 
 : right-up ( cpu -- )
-  [ port1>> 255 HEX: 40 - bitand ] keep (>>port1) ;
+  [ port1>> 255 HEX: 40 - bitand ] keep port1<< ;
 
 
 TUPLE: invaders-gadget < gadget cpu quit? windowed? ;
 
 invaders-gadget H{
-    { T{ key-down f f "ESC" }    [ t over (>>quit?) dup windowed?>> [ close-window ] [ drop ] if ] }
+    { T{ key-down f f "ESC" }    [ t over quit?<< dup windowed?>> [ close-window ] [ drop ] if ] }
     { T{ key-down f f "BACKSPACE" } [ cpu>> coin-down ] }
     { T{ key-up   f f "BACKSPACE" } [ cpu>> coin-up ] }
     { T{ key-down f f "1" }         [ cpu>> player1-down ] }
@@ -377,12 +377,12 @@ M: space-invaders update-video ( value addr cpu -- )
 
 M: invaders-gadget graft* ( gadget -- )
   dup cpu>> init-sounds
-  f over (>>quit?)
+  f over quit?<<
   [ system:system-micros swap invaders-process ] curry
   "Space invaders" threads:spawn drop ;
 
 M: invaders-gadget ungraft* ( gadget -- )
- t swap (>>quit?) ;
+ t swap quit?<< ;
 
 : (run) ( title cpu rom-info -- )
   over load-rom* <invaders-gadget> t >>windowed? swap open-window ;
diff --git a/extra/spelling/authors.txt b/extra/spelling/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/extra/spelling/spelling-tests.factor b/extra/spelling/spelling-tests.factor
new file mode 100644 (file)
index 0000000..f323638
--- /dev/null
@@ -0,0 +1,14 @@
+USING: spelling tools.test memoize ;
+IN: spelling.tests
+
+MEMO: test-dictionary ( -- assoc )
+    "vocab:spelling/test.txt" load-dictionary ;
+
+: test-correct ( word -- word/f )
+    test-dictionary (correct) ;
+
+[ "government" ] [ "goverment" test-correct ] unit-test
+[ "government" ] [ "govxernment" test-correct ] unit-test
+[ "government" ] [ "govermnent" test-correct ] unit-test
+[ "government" ] [ "govxermnent" test-correct ] unit-test
+[ "government" ] [ "govyrmnent" test-correct ] unit-test
diff --git a/extra/spelling/spelling.factor b/extra/spelling/spelling.factor
new file mode 100644 (file)
index 0000000..b8a90bd
--- /dev/null
@@ -0,0 +1,78 @@
+USING: arrays ascii assocs combinators combinators.smart fry
+http.client io.encodings.ascii io.files io.files.temp kernel
+locals math math.statistics memoize sequences sorting splitting
+strings urls ;
+IN: spelling
+
+! http://norvig.com/spell-correct.html
+
+CONSTANT: ALPHABET "abcdefghijklmnopqrstuvwxyz"
+
+: splits ( word -- sequence )
+    dup length iota [ cut 2array ] with map ;
+
+: deletes ( sequence -- sequence' )
+    [ second length 0 > ] filter [ first2 rest append ] map ;
+
+: transposes ( sequence -- sequence' )
+    [ second length 1 > ] filter [
+        [
+            {
+                [ first ]
+                [ second second 1string ]
+                [ second first 1string ]
+                [ second 2 tail ]
+            } cleave
+        ] "" append-outputs-as
+    ] map ;
+
+: replaces ( sequence -- sequence' )
+    [ second length 0 > ] filter [
+        [ ALPHABET ] dip first2
+        '[ 1string _ _ rest surround ] { } map-as
+    ] map concat ;
+
+: inserts ( sequence -- sequence' )
+    [
+        ALPHABET
+        [ [ first2 ] dip 1string glue ] with { } map-as
+    ] map concat ;
+
+: edits1 ( word -- edits )
+    [
+        splits {
+            [ deletes ]
+            [ transposes ]
+            [ replaces ]
+            [ inserts ]
+        } cleave
+    ] append-outputs ;
+
+: edits2 ( word -- edits )
+    edits1 [ edits1 ] map concat ;
+
+: filter-known ( words dictionary -- words' )
+    '[ _ key? ] filter ;
+
+:: corrections ( word dictionary -- words )
+    word 1array dictionary filter-known
+    [ word edits1 dictionary filter-known ] when-empty
+    [ word edits2 dictionary filter-known ] when-empty
+    [ dictionary at 1 or ] sort-with ;
+
+: words ( string -- words )
+    >lower [ letter? not ] split-when harvest ;
+
+: load-dictionary ( file -- assoc )
+    ascii file-contents words histogram ;
+
+MEMO: default-dictionary ( -- counts )
+    "big.txt" temp-file dup exists?
+    [ URL" http://norvig.com/big.txt" over download-to ] unless
+    load-dictionary ;
+
+: (correct) ( word dictionary -- word/f )
+    corrections [ f ] [ first ] if-empty ;
+
+: correct ( word -- word/f )
+    default-dictionary (correct) ;
diff --git a/extra/spelling/summary.txt b/extra/spelling/summary.txt
new file mode 100644 (file)
index 0000000..7fa9068
--- /dev/null
@@ -0,0 +1 @@
+Peter Norvig's spelling corrector
diff --git a/extra/spelling/tags.txt b/extra/spelling/tags.txt
new file mode 100644 (file)
index 0000000..1e107f5
--- /dev/null
@@ -0,0 +1 @@
+examples
diff --git a/extra/spelling/test.txt b/extra/spelling/test.txt
new file mode 100644 (file)
index 0000000..5b9de09
--- /dev/null
@@ -0,0 +1,246 @@
+AMERICAN FOREIGN RELATIONS (1865-98)
+
+=French Intrigues in Mexico Blocked.=--Between the war for the union and
+the war with Spain, the Department of State had many an occasion to
+present the rights of America among the powers of the world. Only a
+little while after the civil conflict came to a close, it was called
+upon to deal with a dangerous situation created in Mexico by the
+ambitions of Napoleon III. During the administration of Buchanan, Mexico
+had fallen into disorder through the strife of the Liberal and the
+Clerical parties; the President asked for authority to use American
+troops to bring to a peaceful haven "a wreck upon the ocean, drifting
+about as she is impelled by different factions." Our own domestic crisis
+then intervened.
+
+Observing the United States heavily involved in its own problems, the
+great powers, England, France, and Spain, decided in the autumn of 1861
+to take a hand themselves in restoring order in Mexico. They entered
+into an agreement to enforce the claims of their citizens against Mexico
+and to protect their subjects residing in that republic. They invited
+the United States to join them, and, on meeting a polite refusal, they
+prepared for a combined military and naval demonstration on their own
+account. In the midst of this action England and Spain, discovering the
+sinister purposes of Napoleon, withdrew their troops and left the field
+to him.
+
+The French Emperor, it was well known, looked with jealousy upon the
+growth of the United States and dreamed of establishing in the Western
+hemisphere an imperial power to offset the American republic.
+Intervention to collect debts was only a cloak for his deeper designs.
+Throwing off that guise in due time, he made the Archduke Maximilian, a
+brother of the ruler of Austria, emperor in Mexico, and surrounded his
+throne by French soldiers, in spite of all protests.
+
+This insolent attack upon the Mexican republic, deeply resented in the
+United States, was allowed to drift in its course until 1865. At that
+juncture General Sheridan was dispatched to the Mexican border with a
+large armed force; General Grant urged the use of the American army to
+expel the French from this continent. The Secretary of State, Seward,
+counseled negotiation first, and, applying the Monroe Doctrine, was able
+to prevail upon Napoleon III to withdraw his troops. Without the support
+of French arms, the sham empire in Mexico collapsed like a house of
+cards and the unhappy Maximilian, the victim of French ambition and
+intrigue, met his death at the hands of a Mexican firing squad.
+
+=Alaska Purchased.=--The Mexican affair had not been brought to a close
+before the Department of State was busy with negotiations which resulted
+in the purchase of Alaska from Russia. The treaty of cession, signed on
+March 30, 1867, added to the United States a domain of nearly six
+hundred thousand square miles, a territory larger than Texas and nearly
+three-fourths the size of the Louisiana purchase. Though it was a
+distant colony separated from our continental domain by a thousand miles
+of water, no question of "imperialism" or "colonization foreign to
+American doctrines" seems to have been raised at the time. The treaty
+was ratified promptly by the Senate. The purchase price, $7,200,000, was
+voted by the House of Representatives after the display of some
+resentment against a system that compelled it to appropriate money to
+fulfill an obligation which it had no part in making. Seward, who
+formulated the treaty, rejoiced, as he afterwards said, that he had kept
+Alaska out of the hands of England.
+
+=American Interest in the Caribbean.=--Having achieved this diplomatic
+triumph, Seward turned to the increase of American power in another
+direction. He negotiated, with Denmark, a treaty providing for the
+purchase of the islands of St. John and St. Thomas in the West Indies,
+strategic points in the Caribbean for sea power. This project, long
+afterward brought to fruition by other men, was defeated on this
+occasion by the refusal of the Senate to ratify the treaty. Evidently it
+was not yet prepared to exercise colonial dominion over other races.
+
+Undaunted by the misadventure in Caribbean policies, President Grant
+warmly advocated the acquisition of Santo Domingo. This little republic
+had long been in a state of general disorder. In 1869 a treaty of
+annexation was concluded with its president. The document Grant
+transmitted to the Senate with his cordial approval, only to have it
+rejected. Not at all changed in his opinion by the outcome of his
+effort, he continued to urge the subject of annexation. Even in his last
+message to Congress he referred to it, saying that time had only proved
+the wisdom of his early course. The addition of Santo Domingo to the
+American sphere of protection was the work of a later generation. The
+State Department, temporarily checked, had to bide its time.
+
+=The _Alabama_ Claims Arbitrated.=--Indeed, it had in hand a far more
+serious matter, a vexing issue that grew out of Civil War diplomacy. The
+British government, as already pointed out in other connections, had
+permitted Confederate cruisers, including the famous _Alabama_, built in
+British ports, to escape and prey upon the commerce of the Northern
+states. This action, denounced at the time by our government as a grave
+breach of neutrality as well as a grievous injury to American citizens,
+led first to remonstrances and finally to repeated claims for damages
+done to American ships and goods. For a long time Great Britain was
+firm. Her foreign secretary denied all obligations in the premises,
+adding somewhat curtly that "he wished to say once for all that Her
+Majesty's government disclaimed any responsibility for the losses and
+hoped that they had made their position perfectly clear." Still
+President Grant was not persuaded that the door of diplomacy, though
+closed, was barred. Hamilton Fish, his Secretary of State, renewed the
+demand. Finally he secured from the British government in 1871 the
+treaty of Washington providing for the arbitration not merely of the
+_Alabama_ and other claims but also all points of serious controversy
+between the two countries.
+
+The tribunal of arbitration thus authorized sat at Geneva in
+Switzerland, and after a long and careful review of the arguments on
+both sides awarded to the United States the lump sum of $15,500,000 to
+be distributed among the American claimants. The damages thus allowed
+were large, unquestionably larger than strict justice required and it is
+not surprising that the decision excited much adverse comment in
+England. Nevertheless, the prompt payment by the British government
+swept away at once a great cloud of ill-feeling in America. Moreover,
+the spectacle of two powerful nations choosing the way of peaceful
+arbitration to settle an angry dispute seemed a happy, if illusory, omen
+of a modern method for avoiding the arbitrament of war.
+
+=Samoa.=--If the Senate had its doubts at first about the wisdom of
+acquiring strategic points for naval power in distant seas, the same
+could not be said of the State Department or naval officers. In 1872
+Commander Meade, of the United States navy, alive to the importance of
+coaling stations even in mid-ocean, made a commercial agreement with the
+chief of Tutuila, one of the Samoan Islands, far below the equator, in
+the southern Pacific, nearer to Australia than to California. This
+agreement, providing among other things for our use of the harbor of
+Pago Pago as a naval base, was six years later changed into a formal
+treaty ratified by the Senate.
+
+Such enterprise could not escape the vigilant eyes of England and
+Germany, both mindful of the course of the sea power in history. The
+German emperor, seizing as a pretext a quarrel between his consul in the
+islands and a native king, laid claim to an interest in the Samoan
+group. England, aware of the dangers arising from German outposts in the
+southern seas so near to Australia, was not content to stand aside. So
+it happened that all three countries sent battleships to the Samoan
+waters, threatening a crisis that was fortunately averted by friendly
+settlement. If, as is alleged, Germany entertained a notion of
+challenging American sea power then and there, the presence of British
+ships must have dispelled that dream.
+
+The result of the affair was a tripartite agreement by which the three
+powers in 1889 undertook a protectorate over the islands. But joint
+control proved unsatisfactory. There was constant friction between the
+Germans and the English. The spheres of authority being vague and open
+to dispute, the plan had to be abandoned at the end of ten years.
+England withdrew altogether, leaving to Germany all the islands except
+Tutuila, which was ceded outright to the United States. Thus one of the
+finest harbors in the Pacific, to the intense delight of the American
+navy, passed permanently under American dominion. Another triumph in
+diplomacy was set down to the credit of the State Department.
+
+=Cleveland and the Venezuela Affair.=--In the relations with South
+America, as well as in those with the distant Pacific, the diplomacy of
+the government at Washington was put to the test. For some time it had
+been watching a dispute between England and Venezuela over the western
+boundary of British Guiana and, on an appeal from Venezuela, it had
+taken a lively interest in the contest. In 1895 President Cleveland saw
+that Great Britain would yield none of her claims. After hearing the
+arguments of Venezuela, his Secretary of State, Richard T. Olney, in a
+note none too conciliatory, asked the British government whether it was
+willing to arbitrate the points in controversy. This inquiry he
+accompanied by a warning to the effect that the United States could not
+permit any European power to contest its mastery in this hemisphere.
+"The United States," said the Secretary, "is practically sovereign on
+this continent and its fiat is law upon the subjects to which it
+confines its interposition.... Its infinite resources, combined with its
+isolated position, render it master of the situation and practically
+invulnerable against any or all other powers."
+
+The reply evoked from the British government by this strong statement
+was firm and clear. The Monroe Doctrine, it said, even if not so widely
+stretched by interpretation, was not binding in international law; the
+dispute with Venezuela was a matter of interest merely to the parties
+involved; and arbitration of the question was impossible. This response
+called forth President Cleveland's startling message of 1895. He asked
+Congress to create a commission authorized to ascertain by researches
+the true boundary between Venezuela and British Guiana. He added that it
+would be the duty of this country "to resist by every means in its
+power, as a willful aggression upon its rights and interests, the
+appropriation by Great Britain of any lands or the exercise of
+governmental jurisdiction over any territory which, after investigation,
+we have determined of right belongs to Venezuela." The serious character
+of this statement he thoroughly understood. He declared that he was
+conscious of his responsibilities, intimating that war, much as it was
+to be deplored, was not comparable to "a supine submission to wrong and
+injustice and the consequent loss of national self-respect and honor."
+
+[Illustration: GROVER CLEVELAND]
+
+The note of defiance which ran through this message, greeted by shrill
+cries of enthusiasm in many circles, was viewed in other quarters as a
+portent of war. Responsible newspapers in both countries spoke of an
+armed settlement of the dispute as inevitable. Congress created the
+commission and appropriated money for the investigation; a body of
+learned men was appointed to determine the merits of the conflicting
+boundary claims. The British government, deaf to the clamor of the
+bellicose section of the London press, deplored the incident,
+courteously replied in the affirmative to a request for assistance in
+the search for evidence, and finally agreed to the proposition that the
+issue be submitted to arbitration. The outcome of this somewhat perilous
+dispute contributed not a little to Cleveland's reputation as "a
+sterling representative of the true American spirit." This was not
+diminished when the tribunal of arbitration found that Great Britain was
+on the whole right in her territorial claims against Venezuela.
+
+=The Annexation of Hawaii.=--While engaged in the dangerous Venezuela
+controversy, President Cleveland was compelled by a strange turn in
+events to consider the annexation of the Hawaiian Islands in the
+mid-Pacific. For more than half a century American missionaries had been
+active in converting the natives to the Christian faith and enterprising
+American business men had been developing the fertile sugar plantations.
+Both the Department of State and the Navy Department were fully
+conscious of the strategic relation of the islands to the growth of sea
+power and watched with anxiety any developments likely to bring them
+under some other Dominion.
+
+The country at large was indifferent, however, until 1893, when a
+revolution, headed by Americans, broke out, ending in the overthrow of
+the native government, the abolition of the primitive monarchy, and the
+retirement of Queen Liliuokalani to private life. This crisis, a
+repetition of the Texas affair in a small theater, was immediately
+followed by a demand from the new Hawaiian government for annexation to
+the United States. President Harrison looked with favor on the proposal,
+negotiated the treaty of annexation, and laid it before the Senate for
+approval. There it still rested when his term of office was brought to a
+close.
+
+Harrison's successor, Cleveland, it was well known, had doubts about the
+propriety of American action in Hawaii. For the purpose of making an
+inquiry into the matter, he sent a special commissioner to the islands.
+On the basis of the report of his agent, Cleveland came to the
+conclusion that "the revolution in the island kingdom had been
+accomplished by the improper use of the armed forces of the United
+States and that the wrong should be righted by a restoration of the
+queen to her throne." Such being his matured conviction, though the
+facts upon which he rested it were warmly controverted, he could do
+nothing but withdraw the treaty from the Senate and close the incident.
+
+To the Republicans this sharp and cavalier disposal of their plans,
+carried out in a way that impugned the motives of a Republican
+President, was nothing less than "a betrayal of American interests." In
+their platform of 1896 they made clear their position: "Our foreign
+policy should be at all times firm, vigorous, and dignified and all our
+interests in the Western hemisphere carefully watched and guarded. The
+Hawaiian Islands should be controlled by the United States and no
+foreign power should be permitted to interfere with them." There was no
+mistaking this view of the issue. As the vote in the election gave
+popular sanction to Republican policies, Congress by a joint resolution,
+passed on July 6, 1898, annexed the islands to the United States and
+later conferred upon them the ordinary territorial form of government.
index c8ea4734d28a79294a182ecd33c04d9bcc57f2e7..2a0b2946e5536ede02ba8989ffba916e2f519947 100644 (file)
@@ -48,7 +48,7 @@ fetched-in parsed-html links processed-in fetched-at ;
     nonmatching>> push-links ;
 
 : filter-base-links ( spider spider-result -- base-links nonmatching-links )
-    [ base>> host>> ] [ links>> prune ] bi*
+    [ base>> host>> ] [ links>> members ] bi*
     [ host>> = ] with partition ;
 
 : add-spidered ( spider spider-result -- )
index 978fb32d423492a5c7afd22192f3b616648415ad..e71b136940892e36919b8fc4870a339a4a584ee1 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2008 Alex Chapman
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types combinators kernel locals math
+USING: accessors alien combinators kernel locals math
 math.ranges openal sequences sequences.merged specialized-arrays ;
-FROM: alien.c-types => short ;
+FROM: alien.c-types => short uchar ;
 SPECIALIZED-ARRAY: uchar
 SPECIALIZED-ARRAY: short
 IN: synth.buffers
index 90645e35623b75f0cc8b0dbe570a84b318a131c5..2b9fd8da0b8b0eb5833d1bfe4fa4fd08258582e9 100755 (executable)
@@ -16,7 +16,7 @@ MEMO: single-sine-wave ( samples/wave -- seq )
     [ sample-freq>> -rot sine-wave ] keep swap >>data ;
 
 : >silent-buffer ( seconds buffer -- buffer )
-    [ sample-freq>> * >integer 0 <repetition> ] [ (>>data) ] [ ] tri ;
+    [ sample-freq>> * >integer 0 <repetition> ] [ data<< ] [ ] tri ;
 
 TUPLE: harmonic n amplitude ;
 C: <harmonic> harmonic
@@ -32,5 +32,5 @@ C: <note> note
     harmonic amplitude>> <scaled> ;
 
 : >note ( harmonics note buffer -- buffer )
-    [ [ note-harmonic-data ] 2curry map <summed> ] [ (>>data) ] [ ] tri ;
+    [ [ note-harmonic-data ] 2curry map <summed> ] [ data<< ] [ ] tri ;
 
index e4838061f51644cef6a8f7233ce360dcd9312455..e1051cf21b8b52d4d0d8bada9eb4bf3f0f566782 100644 (file)
@@ -120,7 +120,7 @@ terrain-world H{
     read-keyboard keys>> :> keys
 
     key-left-shift keys nth
-    VELOCITY-MODIFIER-FAST VELOCITY-MODIFIER-NORMAL ? player (>>velocity-modifier)
+    VELOCITY-MODIFIER-FAST VELOCITY-MODIFIER-NORMAL ? player velocity-modifier<<
 
     {
         [ key-1 keys nth 1  f ? ]
@@ -128,7 +128,7 @@ terrain-world H{
         [ key-3 keys nth 3  f ? ]
         [ key-4 keys nth 4  f ? ]
         [ key-5 keys nth 10000 f ? ]
-    } 0|| player (>>reverse-time)
+    } 0|| player reverse-time<<
 
     key-w keys nth [ player walk-forward ] when 
     key-s keys nth [ player walk-backward ] when 
@@ -203,7 +203,7 @@ TYPED:: collide ( world: terrain-world player: player -- )
     world history>> :> history
     history length 0 > [
         history length reverse-time 1 - - 1 max history set-length
-        history pop world (>>player)
+        history pop world player<<
     ] when ;
 
 : tick-player-forward ( world player -- )
@@ -298,5 +298,5 @@ GAME: terrain-game {
         { use-game-input? t }
         { grab-input? t }
         { pref-dim { 1024 768 } }
-        { tick-interval-micros $[ 60 fps ] }
+        { tick-interval-nanos $[ 60 fps ] }
     } ;
index 66df0cdb2d7161f82549b5891ec92c045f60abef..839d9690c2d6dea2b17f583610438313d20e452c 100644 (file)
@@ -52,10 +52,10 @@ tetris-gadget H{
     [ tetris>> ?update ] [ relayout-1 ] bi ;
 
 M: tetris-gadget graft* ( gadget -- )
-    [ [ tick ] curry 100 milliseconds every ] keep (>>alarm) ;
+    [ [ tick ] curry 100 milliseconds every ] keep alarm<< ;
 
 M: tetris-gadget ungraft* ( gadget -- )
-    [ cancel-alarm f ] change-alarm drop ;
+    [ stop-alarm f ] change-alarm drop ;
 
 : tetris-window ( -- ) 
     [
index ea6d20fc2d3013a5c14d8ea7682a5fced97c8887..fc7f0d5e599748cab4d95ce161ef26961ac31a35 100644 (file)
@@ -7,4 +7,4 @@ IN: tokyo.abstractdb
 
 : <tokyo-abstractdb> ( name -- tokyo-abstractdb )
     tcadbnew [ swap tcadbopen drop ] keep
-    tokyo-abstractdb new [ (>>handle) ] keep ;
+    tokyo-abstractdb new [ handle<< ] keep ;
index efba5f037477108220397df907ea17b2b6682906..84163ce080ddf3518f1e5a45204314c01f95f127 100644 (file)
@@ -9,50 +9,49 @@ LIBRARY: tokyocabinet
 
 TYPEDEF: void* TCADB
 
-C-ENUM:
-    ADBOVOID
-    ADBOMDB
-    ADBONDB
-    ADBOHDB
-    ADBOBDB
-    ADBOFDB
-    ADBOTDB
-    ADBOSKEL ;
+CONSTANT: ADBOVOID 0
+CONSTANT: ADBOMDB 1
+CONSTANT: ADBONDB 2
+CONSTANT: ADBOHDB 3
+CONSTANT: ADBOBDB 4
+CONSTANT: ADBOFDB 5
+CONSTANT: ADBOTDB 6
+CONSTANT: ADBOSKEL 7
 
 FUNCTION: TCADB* tcadbnew ( ) ;
 FUNCTION: void tcadbdel ( TCADB* adb ) ;
-FUNCTION: bool tcadbopen ( TCADB* adb, char* name ) ;
+FUNCTION: bool tcadbopen ( TCADB* adb, c-string name ) ;
 FUNCTION: bool tcadbclose ( TCADB* adb ) ;
 FUNCTION: bool tcadbput ( TCADB* adb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcadbput2 ( TCADB* adb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcadbput2 ( TCADB* adb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcadbputkeep ( TCADB* adb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcadbputkeep2 ( TCADB* adb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcadbputkeep2 ( TCADB* adb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcadbputcat ( TCADB* adb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcadbputcat2 ( TCADB* adb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcadbputcat2 ( TCADB* adb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcadbout ( TCADB* adb, void* kbuf, int ksiz ) ;
-FUNCTION: bool tcadbout2 ( TCADB* adb, char* kstr ) ;
+FUNCTION: bool tcadbout2 ( TCADB* adb, c-string kstr ) ;
 FUNCTION: void* tcadbget ( TCADB* adb, void* kbuf, int ksiz, int* sp ) ;
-FUNCTION: char* tcadbget2 ( TCADB* adb, char* kstr ) ;
+FUNCTION: c-string tcadbget2 ( TCADB* adb, c-string kstr ) ;
 FUNCTION: int tcadbvsiz ( TCADB* adb, void* kbuf, int ksiz ) ;
-FUNCTION: int tcadbvsiz2 ( TCADB* adb, char* kstr ) ;
+FUNCTION: int tcadbvsiz2 ( TCADB* adb, c-string kstr ) ;
 FUNCTION: bool tcadbiterinit ( TCADB* adb ) ;
 FUNCTION: void* tcadbiternext ( TCADB* adb, int* sp ) ;
-FUNCTION: char* tcadbiternext2 ( TCADB* adb ) ;
+FUNCTION: c-string tcadbiternext2 ( TCADB* adb ) ;
 FUNCTION: TCLIST* tcadbfwmkeys ( TCADB* adb, void* pbuf, int psiz, int max ) ;
-FUNCTION: TCLIST* tcadbfwmkeys2 ( TCADB* adb, char* pstr, int max ) ;
+FUNCTION: TCLIST* tcadbfwmkeys2 ( TCADB* adb, c-string pstr, int max ) ;
 FUNCTION: int tcadbaddint ( TCADB* adb, void* kbuf, int ksiz, int num ) ;
 FUNCTION: double tcadbadddouble ( TCADB* adb, void* kbuf, int ksiz, double num ) ;
 FUNCTION: bool tcadbsync ( TCADB* adb ) ;
-FUNCTION: bool tcadboptimize ( TCADB* adb, char* params ) ;
+FUNCTION: bool tcadboptimize ( TCADB* adb, c-string params ) ;
 FUNCTION: bool tcadbvanish ( TCADB* adb ) ;
-FUNCTION: bool tcadbcopy ( TCADB* adb, char* path ) ;
+FUNCTION: bool tcadbcopy ( TCADB* adb, c-string path ) ;
 FUNCTION: bool tcadbtranbegin ( TCADB* adb ) ;
 FUNCTION: bool tcadbtrancommit ( TCADB* adb ) ;
 FUNCTION: bool tcadbtranabort ( TCADB* adb ) ;
-FUNCTION: char* tcadbpath ( TCADB* adb ) ;
+FUNCTION: c-string tcadbpath ( TCADB* adb ) ;
 FUNCTION: ulonglong tcadbrnum ( TCADB* adb ) ;
 FUNCTION: ulonglong tcadbsize ( TCADB* adb ) ;
-FUNCTION: TCLIST* tcadbmisc ( TCADB* adb, char* name, TCLIST* args ) ;
+FUNCTION: TCLIST* tcadbmisc ( TCADB* adb, c-string name, TCLIST* args ) ;
 
 ! -----
 
@@ -66,4 +65,4 @@ FUNCTION: void* tcadbreveal ( TCADB* adb ) ;
 FUNCTION: bool tcadbputproc ( TCADB* adb, void* kbuf, int ksiz, void* vbuf, int vsiz, TCPDPROC proc, void* op ) ;
 FUNCTION: bool tcadbforeach ( TCADB* adb, TCITER iter, void* op ) ;
 FUNCTION: bool tcadbmapbdb ( TCADB* adb, TCLIST* keys, TCBDB* bdb, ADBMAPPROC proc, void* op, longlong csiz ) ;
-FUNCTION: bool tcadbmapbdbemit ( void* map, char* kbuf, int ksiz, char* vbuf, int vsiz ) ;
+FUNCTION: bool tcadbmapbdbemit ( void* map, c-string kbuf, int ksiz, c-string vbuf, int vsiz ) ;
index 8739e04608a6b33d932c9058cd019bffc00f1394..2233ceeb93e8fde54f475c519596917717e5377f 100644 (file)
@@ -27,12 +27,11 @@ CONSTANT: BDBOTSYNC  64
 
 TYPEDEF: void* BDBCUR
 
-C-ENUM:
-    BDBCPCURRENT
-    BDBCPBEFORE
-    BDBCPAFTER ;
+CONSTANT: BDBCPCURRENT 0
+CONSTANT: BDBCPBEFORE 1
+CONSTANT: BDBCPAFTER 2
 
-FUNCTION: char* tcbdberrmsg ( int ecode ) ;
+FUNCTION: c-string tcbdberrmsg ( int ecode ) ;
 FUNCTION: TCBDB* tcbdbnew ( ) ;
 FUNCTION: void tcbdbdel ( TCBDB* bdb ) ;
 FUNCTION: int tcbdbecode ( TCBDB* bdb ) ;
@@ -41,42 +40,42 @@ FUNCTION: bool tcbdbsetcmpfunc ( TCBDB* bdb, TCCMP cmp, void* cmpop ) ;
 FUNCTION: bool tcbdbtune ( TCBDB* bdb, int lmemb, int nmemb, longlong bnum, char apow, char fpow, uchar opts ) ;
 FUNCTION: bool tcbdbsetcache ( TCBDB* bdb, int lcnum, int ncnum ) ;
 FUNCTION: bool tcbdbsetxmsiz ( TCBDB* bdb, longlong xmsiz ) ;
-FUNCTION: bool tcbdbopen ( TCBDB* bdb, char* path, int omode ) ;
+FUNCTION: bool tcbdbopen ( TCBDB* bdb, c-string path, int omode ) ;
 FUNCTION: bool tcbdbclose ( TCBDB* bdb ) ;
 FUNCTION: bool tcbdbput ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcbdbput2 ( TCBDB* bdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcbdbput2 ( TCBDB* bdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcbdbputkeep ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcbdbputkeep2 ( TCBDB* bdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcbdbputkeep2 ( TCBDB* bdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcbdbputcat ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcbdbputcat2 ( TCBDB* bdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcbdbputcat2 ( TCBDB* bdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcbdbputdup ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcbdbputdup2 ( TCBDB* bdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcbdbputdup2 ( TCBDB* bdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcbdbputdup3 ( TCBDB* bdb, void* kbuf, int ksiz, TCLIST* vals ) ;
 FUNCTION: bool tcbdbout ( TCBDB* bdb, void* kbuf, int ksiz ) ;
-FUNCTION: bool tcbdbout2 ( TCBDB* bdb, char* kstr ) ;
+FUNCTION: bool tcbdbout2 ( TCBDB* bdb, c-string kstr ) ;
 FUNCTION: bool tcbdbout3 ( TCBDB* bdb, void* kbuf, int ksiz ) ;
 FUNCTION: void* tcbdbget ( TCBDB* bdb, void* kbuf, int ksiz, int* sp ) ;
-FUNCTION: char* tcbdbget2 ( TCBDB* bdb, char* kstr ) ;
+FUNCTION: c-string tcbdbget2 ( TCBDB* bdb, c-string kstr ) ;
 FUNCTION: void* tcbdbget3 ( TCBDB* bdb, void* kbuf, int ksiz, int* sp ) ;
 FUNCTION: TCLIST* tcbdbget4 ( TCBDB* bdb, void* kbuf, int ksiz ) ;
 FUNCTION: int tcbdbvnum ( TCBDB* bdb, void* kbuf, int ksiz ) ;
-FUNCTION: int tcbdbvnum2 ( TCBDB* bdb, char* kstr ) ;
+FUNCTION: int tcbdbvnum2 ( TCBDB* bdb, c-string kstr ) ;
 FUNCTION: int tcbdbvsiz ( TCBDB* bdb, void* kbuf, int ksiz ) ;
-FUNCTION: int tcbdbvsiz2 ( TCBDB* bdb, char* kstr ) ;
+FUNCTION: int tcbdbvsiz2 ( TCBDB* bdb, c-string kstr ) ;
 FUNCTION: TCLIST* tcbdbrange ( TCBDB* bdb, void* bkbuf, int bksiz, bool binc, void* ekbuf, int eksiz, bool einc, int max ) ;
-FUNCTION: TCLIST* tcbdbrange2 ( TCBDB* bdb, char* bkstr, bool binc, char* ekstr, bool einc, int max ) ;
+FUNCTION: TCLIST* tcbdbrange2 ( TCBDB* bdb, c-string bkstr, bool binc, c-string ekstr, bool einc, int max ) ;
 FUNCTION: TCLIST* tcbdbfwmkeys ( TCBDB* bdb, void* pbuf, int psiz, int max ) ;
-FUNCTION: TCLIST* tcbdbfwmkeys2 ( TCBDB* bdb, char* pstr, int max ) ;
+FUNCTION: TCLIST* tcbdbfwmkeys2 ( TCBDB* bdb, c-string pstr, int max ) ;
 FUNCTION: int tcbdbaddint ( TCBDB* bdb, void* kbuf, int ksiz, int num ) ;
 FUNCTION: double tcbdbadddouble ( TCBDB* bdb, void* kbuf, int ksiz, double num ) ;
 FUNCTION: bool tcbdbsync ( TCBDB* bdb ) ;
 FUNCTION: bool tcbdboptimize ( TCBDB* bdb, int lmemb, int nmemb, longlong bnum, char apow, char fpow, uchar opts ) ;
 FUNCTION: bool tcbdbvanish ( TCBDB* bdb ) ;
-FUNCTION: bool tcbdbcopy ( TCBDB* bdb, char* path ) ;
+FUNCTION: bool tcbdbcopy ( TCBDB* bdb, c-string path ) ;
 FUNCTION: bool tcbdbtranbegin ( TCBDB* bdb ) ;
 FUNCTION: bool tcbdbtrancommit ( TCBDB* bdb ) ;
 FUNCTION: bool tcbdbtranabort ( TCBDB* bdb ) ;
-FUNCTION: char* tcbdbpath ( TCBDB* bdb ) ;
+FUNCTION: c-string tcbdbpath ( TCBDB* bdb ) ;
 FUNCTION: ulonglong tcbdbrnum ( TCBDB* bdb ) ;
 FUNCTION: ulonglong tcbdbfsiz ( TCBDB* bdb ) ;
 FUNCTION: BDBCUR* tcbdbcurnew ( TCBDB* bdb ) ;
@@ -84,23 +83,23 @@ FUNCTION: void tcbdbcurdel ( BDBCUR* cur ) ;
 FUNCTION: bool tcbdbcurfirst ( BDBCUR* cur ) ;
 FUNCTION: bool tcbdbcurlast ( BDBCUR* cur ) ;
 FUNCTION: bool tcbdbcurjump ( BDBCUR* cur, void* kbuf, int ksiz ) ;
-FUNCTION: bool tcbdbcurjump2 ( BDBCUR* cur, char* kstr ) ;
+FUNCTION: bool tcbdbcurjump2 ( BDBCUR* cur, c-string kstr ) ;
 FUNCTION: bool tcbdbcurprev ( BDBCUR* cur ) ;
 FUNCTION: bool tcbdbcurnext ( BDBCUR* cur ) ;
 FUNCTION: bool tcbdbcurput ( BDBCUR* cur, void* vbuf, int vsiz, int cpmode ) ;
-FUNCTION: bool tcbdbcurput2 ( BDBCUR* cur, char* vstr, int cpmode ) ;
+FUNCTION: bool tcbdbcurput2 ( BDBCUR* cur, c-string vstr, int cpmode ) ;
 FUNCTION: bool tcbdbcurout ( BDBCUR* cur ) ;
 FUNCTION: void* tcbdbcurkey ( BDBCUR* cur, int* sp ) ;
-FUNCTION: char* tcbdbcurkey2 ( BDBCUR* cur ) ;
+FUNCTION: c-string tcbdbcurkey2 ( BDBCUR* cur ) ;
 FUNCTION: void* tcbdbcurkey3 ( BDBCUR* cur, int* sp ) ;
 FUNCTION: void* tcbdbcurval ( BDBCUR* cur, int* sp ) ;
-FUNCTION: char* tcbdbcurval2 ( BDBCUR* cur ) ;
+FUNCTION: c-string tcbdbcurval2 ( BDBCUR* cur ) ;
 FUNCTION: void* tcbdbcurval3 ( BDBCUR* cur, int* sp ) ;
 FUNCTION: bool tcbdbcurrec ( BDBCUR* cur, TCXSTR* kxstr, TCXSTR* vxstr ) ;
 
 ! -----------
 
-FUNCTION: void tcbdbsetecode ( TCBDB* bdb, int ecode, char* filename, int line, char* func ) ;
+FUNCTION: void tcbdbsetecode ( TCBDB* bdb, int ecode, c-string filename, int line, c-string func ) ;
 FUNCTION: void tcbdbsetdbgfd ( TCBDB* bdb, int fd ) ;
 FUNCTION: int tcbdbdbgfd ( TCBDB* bdb ) ;
 FUNCTION: bool tcbdbhasmutex ( TCBDB* bdb ) ;
@@ -119,14 +118,14 @@ FUNCTION: ulonglong tcbdbinode ( TCBDB* bdb ) ;
 FUNCTION: tokyo_time_t tcbdbmtime ( TCBDB* bdb ) ;
 FUNCTION: uchar tcbdbflags ( TCBDB* bdb ) ;
 FUNCTION: uchar tcbdbopts ( TCBDB* bdb ) ;
-FUNCTION: char* tcbdbopaque ( TCBDB* bdb ) ;
+FUNCTION: c-string tcbdbopaque ( TCBDB* bdb ) ;
 FUNCTION: ulonglong tcbdbbnumused ( TCBDB* bdb ) ;
 FUNCTION: bool tcbdbsetlsmax ( TCBDB* bdb, uint lsmax ) ;
 FUNCTION: bool tcbdbsetcapnum ( TCBDB* bdb, ulonglong capnum ) ;
 FUNCTION: bool tcbdbsetcodecfunc ( TCBDB* bdb, TCCODEC enc, void* encop, TCCODEC dec, void* decop ) ;
 FUNCTION: bool tcbdbputdupback ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcbdbputdupback2 ( TCBDB* bdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcbdbputdupback2 ( TCBDB* bdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcbdbputproc ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz, TCPDPROC proc, void* op ) ;
 FUNCTION: bool tcbdbcurjumpback ( BDBCUR* cur, void* kbuf, int ksiz ) ;
-FUNCTION: bool tcbdbcurjumpback2 ( BDBCUR* cur, char* kstr ) ;
+FUNCTION: bool tcbdbcurjumpback2 ( BDBCUR* cur, c-string kstr ) ;
 FUNCTION: bool tcbdbforeach ( TCBDB* bdb, TCITER iter, void* op ) ;
index 91400aaf4e2cb0ec9e44596fffb90888bcf816ff..cde71f27a5ba54980dcade297f8da389577fbbc0 100644 (file)
@@ -22,40 +22,40 @@ CONSTANT: FDBIDPREV -2
 CONSTANT: FDBIDMAX  -3
 CONSTANT: FDBIDNEXT -4
 
-FUNCTION: char* tcfdberrmsg ( int ecode ) ;
+FUNCTION: c-string tcfdberrmsg ( int ecode ) ;
 FUNCTION: TCFDB* tcfdbnew ( ) ;
 FUNCTION: void tcfdbdel ( TCFDB* fdb ) ;
 FUNCTION: int tcfdbecode ( TCFDB* fdb ) ;
 FUNCTION: bool tcfdbsetmutex ( TCFDB* fdb ) ;
 FUNCTION: bool tcfdbtune ( TCFDB* fdb, int width, longlong limsiz ) ;
-FUNCTION: bool tcfdbopen ( TCFDB* fdb, char* path, int omode ) ;
+FUNCTION: bool tcfdbopen ( TCFDB* fdb, c-string path, int omode ) ;
 FUNCTION: bool tcfdbclose ( TCFDB* fdb ) ;
 FUNCTION: bool tcfdbput ( TCFDB* fdb, longlong id, void* vbuf, int vsiz ) ;
 FUNCTION: bool tcfdbput2 ( TCFDB* fdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcfdbput3 ( TCFDB* fdb, char* kstr, void* vstr ) ;
+FUNCTION: bool tcfdbput3 ( TCFDB* fdb, c-string kstr, void* vstr ) ;
 FUNCTION: bool tcfdbputkeep ( TCFDB* fdb, longlong id, void* vbuf, int vsiz ) ;
 FUNCTION: bool tcfdbputkeep2 ( TCFDB* fdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcfdbputkeep3 ( TCFDB* fdb, char* kstr, void* vstr ) ;
+FUNCTION: bool tcfdbputkeep3 ( TCFDB* fdb, c-string kstr, void* vstr ) ;
 FUNCTION: bool tcfdbputcat ( TCFDB* fdb, longlong id, void* vbuf, int vsiz ) ;
 FUNCTION: bool tcfdbputcat2 ( TCFDB* fdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcfdbputcat3 ( TCFDB* fdb, char* kstr, void* vstr ) ;
+FUNCTION: bool tcfdbputcat3 ( TCFDB* fdb, c-string kstr, void* vstr ) ;
 FUNCTION: bool tcfdbout ( TCFDB* fdb, longlong id ) ;
 FUNCTION: bool tcfdbout2 ( TCFDB* fdb, void* kbuf, int ksiz ) ;
-FUNCTION: bool tcfdbout3 ( TCFDB* fdb, char* kstr ) ;
+FUNCTION: bool tcfdbout3 ( TCFDB* fdb, c-string kstr ) ;
 FUNCTION: void* tcfdbget ( TCFDB* fdb, longlong id, int* sp ) ;
 FUNCTION: void* tcfdbget2 ( TCFDB* fdb, void* kbuf, int ksiz, int* sp ) ;
-FUNCTION: char* tcfdbget3 ( TCFDB* fdb, char* kstr ) ;
+FUNCTION: c-string tcfdbget3 ( TCFDB* fdb, c-string kstr ) ;
 FUNCTION: int tcfdbget4 ( TCFDB* fdb, longlong id, void* vbuf, int max ) ;
 FUNCTION: int tcfdbvsiz ( TCFDB* fdb, longlong id ) ;
 FUNCTION: int tcfdbvsiz2 ( TCFDB* fdb, void* kbuf, int ksiz ) ;
-FUNCTION: int tcfdbvsiz3 ( TCFDB* fdb, char* kstr ) ;
+FUNCTION: int tcfdbvsiz3 ( TCFDB* fdb, c-string kstr ) ;
 FUNCTION: bool tcfdbiterinit ( TCFDB* fdb ) ;
 FUNCTION: ulonglong tcfdbiternext ( TCFDB* fdb ) ;
 FUNCTION: void* tcfdbiternext2 ( TCFDB* fdb, int* sp ) ;
-FUNCTION: char* tcfdbiternext3 ( TCFDB* fdb ) ;
+FUNCTION: c-string tcfdbiternext3 ( TCFDB* fdb ) ;
 FUNCTION: ulonglong* tcfdbrange ( TCFDB* fdb, longlong lower, longlong upper, int max, int* np ) ;
 FUNCTION: TCLIST* tcfdbrange2 ( TCFDB* fdb, void* lbuf, int lsiz, void* ubuf, int usiz, int max ) ;
-FUNCTION: TCLIST* tcfdbrange3 ( TCFDB* fdb, char* lstr, char* ustr, int max ) ;
+FUNCTION: TCLIST* tcfdbrange3 ( TCFDB* fdb, c-string lstr, c-string ustr, int max ) ;
 FUNCTION: TCLIST* tcfdbrange4 ( TCFDB* fdb, void* ibuf, int isiz, int max ) ;
 FUNCTION: TCLIST* tcfdbrange5 ( TCFDB* fdb, void* istr, int max ) ;
 FUNCTION: int tcfdbaddint ( TCFDB* fdb, longlong id, int num ) ;
@@ -63,17 +63,17 @@ FUNCTION: double tcfdbadddouble ( TCFDB* fdb, longlong id, double num ) ;
 FUNCTION: bool tcfdbsync ( TCFDB* fdb ) ;
 FUNCTION: bool tcfdboptimize ( TCFDB* fdb, int width, longlong limsiz ) ;
 FUNCTION: bool tcfdbvanish ( TCFDB* fdb ) ;
-FUNCTION: bool tcfdbcopy ( TCFDB* fdb, char* path ) ;
+FUNCTION: bool tcfdbcopy ( TCFDB* fdb, c-string path ) ;
 FUNCTION: bool tcfdbtranbegin ( TCFDB* fdb ) ;
 FUNCTION: bool tcfdbtrancommit ( TCFDB* fdb ) ;
 FUNCTION: bool tcfdbtranabort ( TCFDB* fdb ) ;
-FUNCTION: char* tcfdbpath ( TCFDB* fdb ) ;
+FUNCTION: c-string tcfdbpath ( TCFDB* fdb ) ;
 FUNCTION: ulonglong tcfdbrnum ( TCFDB* fdb ) ;
 FUNCTION: ulonglong tcfdbfsiz ( TCFDB* fdb ) ;
 
 ! --------
 
-FUNCTION: void tcfdbsetecode ( TCFDB* fdb, int ecode, char* filename, int line, char* func ) ;
+FUNCTION: void tcfdbsetecode ( TCFDB* fdb, int ecode, c-string filename, int line, c-string func ) ;
 FUNCTION: void tcfdbsetdbgfd ( TCFDB* fdb, int fd ) ;
 FUNCTION: int tcfdbdbgfd ( TCFDB* fdb ) ;
 FUNCTION: bool tcfdbhasmutex ( TCFDB* fdb ) ;
@@ -88,7 +88,7 @@ FUNCTION: tokyo_time_t tcfdbmtime ( TCFDB* fdb ) ;
 FUNCTION: int tcfdbomode ( TCFDB* fdb ) ;
 FUNCTION: uchar tcfdbtype ( TCFDB* fdb ) ;
 FUNCTION: uchar tcfdbflags ( TCFDB* fdb ) ;
-FUNCTION: char* tcfdbopaque ( TCFDB* fdb ) ;
+FUNCTION: c-string tcfdbopaque ( TCFDB* fdb ) ;
 FUNCTION: bool tcfdbputproc ( TCFDB* fdb, longlong id, void* vbuf, int vsiz, TCPDPROC proc, void* op ) ;
 FUNCTION: bool tcfdbforeach ( TCFDB* fdb, TCITER iter, void* op ) ;
-FUNCTION: longlong tcfdbkeytoid ( char* kbuf, int ksiz ) ;
+FUNCTION: longlong tcfdbkeytoid ( c-string kbuf, int ksiz ) ;
index fd0464fcec0ab00d12f007f13d5a0dca58949c31..65d00b2a698641fc2cb4b5dff3c5321d051e8a91 100644 (file)
@@ -26,7 +26,7 @@ CONSTANT: HDBONOLCK  16
 CONSTANT: HDBOLCKNB  32
 CONSTANT: HDBOTSYNC  64
 
-FUNCTION: char* tchdberrmsg ( int ecode ) ;
+FUNCTION: c-string tchdberrmsg ( int ecode ) ;
 FUNCTION: TCHDB* tchdbnew ( ) ;
 FUNCTION: void tchdbdel ( TCHDB* hdb ) ;
 FUNCTION: int tchdbecode ( TCHDB* hdb ) ;
@@ -34,45 +34,45 @@ FUNCTION: bool tchdbsetmutex ( TCHDB* hdb ) ;
 FUNCTION: bool tchdbtune ( TCHDB* hdb, longlong bnum, char apow, char fpow, uchar opts ) ;
 FUNCTION: bool tchdbsetcache ( TCHDB* hdb, int rcnum ) ;
 FUNCTION: bool tchdbsetxmsiz ( TCHDB* hdb, longlong xmsiz ) ;
-FUNCTION: bool tchdbopen ( TCHDB* hdb, char* path, int omode ) ;
+FUNCTION: bool tchdbopen ( TCHDB* hdb, c-string path, int omode ) ;
 FUNCTION: bool tchdbclose ( TCHDB* hdb ) ;
 FUNCTION: bool tchdbput ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tchdbput2 ( TCHDB* hdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tchdbput2 ( TCHDB* hdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tchdbputkeep ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tchdbputkeep2 ( TCHDB* hdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tchdbputkeep2 ( TCHDB* hdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tchdbputcat ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tchdbputcat2 ( TCHDB* hdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tchdbputcat2 ( TCHDB* hdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tchdbputasync ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tchdbputasync2 ( TCHDB* hdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tchdbputasync2 ( TCHDB* hdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tchdbout ( TCHDB* hdb, void* kbuf, int ksiz ) ;
-FUNCTION: bool tchdbout2 ( TCHDB* hdb, char* kstr ) ;
+FUNCTION: bool tchdbout2 ( TCHDB* hdb, c-string kstr ) ;
 FUNCTION: void* tchdbget ( TCHDB* hdb, void* kbuf, int ksiz, int* sp ) ;
-FUNCTION: char* tchdbget2 ( TCHDB* hdb, char* kstr ) ;
+FUNCTION: c-string tchdbget2 ( TCHDB* hdb, c-string kstr ) ;
 FUNCTION: int tchdbget3 ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int max ) ;
 FUNCTION: int tchdbvsiz ( TCHDB* hdb, void* kbuf, int ksiz ) ;
-FUNCTION: int tchdbvsiz2 ( TCHDB* hdb, char* kstr ) ;
+FUNCTION: int tchdbvsiz2 ( TCHDB* hdb, c-string kstr ) ;
 FUNCTION: bool tchdbiterinit ( TCHDB* hdb ) ;
 FUNCTION: void* tchdbiternext ( TCHDB* hdb, int* sp ) ;
-FUNCTION: char* tchdbiternext2 ( TCHDB* hdb ) ;
+FUNCTION: c-string tchdbiternext2 ( TCHDB* hdb ) ;
 FUNCTION: bool tchdbiternext3 ( TCHDB* hdb, TCXSTR* kxstr, TCXSTR* vxstr ) ;
 FUNCTION: TCLIST* tchdbfwmkeys ( TCHDB* hdb, void* pbuf, int psiz, int max ) ;
-FUNCTION: TCLIST* tchdbfwmkeys2 ( TCHDB* hdb, char* pstr, int max ) ;
+FUNCTION: TCLIST* tchdbfwmkeys2 ( TCHDB* hdb, c-string pstr, int max ) ;
 FUNCTION: int tchdbaddint ( TCHDB* hdb, void* kbuf, int ksiz, int num ) ;
 FUNCTION: double tchdbadddouble ( TCHDB* hdb, void* kbuf, int ksiz, double num ) ;
 FUNCTION: bool tchdbsync ( TCHDB* hdb ) ;
 FUNCTION: bool tchdboptimize ( TCHDB* hdb, longlong bnum, char apow, char fpow, uchar opts ) ;
 FUNCTION: bool tchdbvanish ( TCHDB* hdb ) ;
-FUNCTION: bool tchdbcopy ( TCHDB* hdb, char* path ) ;
+FUNCTION: bool tchdbcopy ( TCHDB* hdb, c-string path ) ;
 FUNCTION: bool tchdbtranbegin ( TCHDB* hdb ) ;
 FUNCTION: bool tchdbtrancommit ( TCHDB* hdb ) ;
 FUNCTION: bool tchdbtranabort ( TCHDB* hdb ) ;
-FUNCTION: char* tchdbpath ( TCHDB* hdb ) ;
+FUNCTION: c-string tchdbpath ( TCHDB* hdb ) ;
 FUNCTION: ulonglong tchdbrnum ( TCHDB* hdb ) ;
 FUNCTION: ulonglong tchdbfsiz ( TCHDB* hdb ) ;
 
 ! --------
 
-FUNCTION: void tchdbsetecode ( TCHDB* hdb, int ecode, char* filename, int line, char* func ) ;
+FUNCTION: void tchdbsetecode ( TCHDB* hdb, int ecode, c-string filename, int line, c-string func ) ;
 FUNCTION: void tchdbsettype ( TCHDB* hdb, uchar type ) ;
 FUNCTION: void tchdbsetdbgfd ( TCHDB* hdb, int fd ) ;
 FUNCTION: int tchdbdbgfd ( TCHDB* hdb ) ;
@@ -89,13 +89,13 @@ FUNCTION: int tchdbomode ( TCHDB* hdb ) ;
 FUNCTION: uchar tchdbtype ( TCHDB* hdb ) ;
 FUNCTION: uchar tchdbflags ( TCHDB* hdb ) ;
 FUNCTION: uchar tchdbopts ( TCHDB* hdb ) ;
-FUNCTION: char* tchdbopaque ( TCHDB* hdb ) ;
+FUNCTION: c-string tchdbopaque ( TCHDB* hdb ) ;
 FUNCTION: ulonglong tchdbbnumused ( TCHDB* hdb ) ;
 FUNCTION: bool tchdbsetcodecfunc ( TCHDB* hdb, TCCODEC enc, void* encop, TCCODEC dec, void* decop ) ;
 FUNCTION: void tchdbcodecfunc ( TCHDB* hdb, TCCODEC* ep, void* *eop, TCCODEC* dp, void* *dop ) ;
 FUNCTION: bool tchdbputproc ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int vsiz, TCPDPROC proc, void* op ) ;
 FUNCTION: void* tchdbgetnext ( TCHDB* hdb, void* kbuf, int ksiz, int* sp ) ;
-FUNCTION: char* tchdbgetnext2 ( TCHDB* hdb, char* kstr ) ;
-FUNCTION: char* tchdbgetnext3 ( TCHDB* hdb, char* kbuf, int ksiz, int* sp, char* *vbp, int* vsp ) ;
+FUNCTION: c-string tchdbgetnext2 ( TCHDB* hdb, c-string kstr ) ;
+FUNCTION: c-string tchdbgetnext3 ( TCHDB* hdb, c-string kbuf, int ksiz, int* sp, c-string *vbp, int* vsp ) ;
 FUNCTION: bool tchdbforeach ( TCHDB* hdb, TCITER iter, void* op ) ;
 FUNCTION: bool tchdbtranvoid ( TCHDB* hdb ) ;
index a6e59dbe032b8cd73324689455e0e1bfa6391751..7f98f431c7898eb1251c548296d6efb68caf892b 100644 (file)
@@ -9,7 +9,7 @@ IN: tokyo.alien.tcrdb
     { [ os macosx? ] [ "/opt/local/lib/libtokyotyrant.dylib" ] }
     { [ os unix? ] [ "libtokyotyrant.so" ] }
     { [ os windows? ] [ "tokyotyrant.dll" ] }
-} cond "cdecl" add-library >>
+} cond cdecl add-library >>
 
 LIBRARY: tokyotyrant
 
@@ -17,24 +17,23 @@ C-TYPE: TCRDB
 ! STRUCT: TCRDB
 !     { mmtx pthread_mutex_t }
 !     { eckey pthread_key_t }
-!     { host char* }
+!     { host c-string }
 !     { port int }
-!     { expr char* }
+!     { expr c-string }
 !     { fd int }
 !     { sock TTSOCK* }
 !     { timeout double }
 !     { opts int } ;
 
-C-ENUM:
-    TTESUCCESS
-    TTEINVALID
-    TTENOHOST
-    TTEREFUSED
-    TTESEND
-    TTERECV
-    TTEKEEP
-    TTENOREC ;
-CONSTANT: TTEMISC 9999
+CONSTANT: TTESUCCESS 0
+CONSTANT: TTEINVALID 1
+CONSTANT: TTENOHOST  2
+CONSTANT: TTEREFUSED 3
+CONSTANT: TTESEND    4
+CONSTANT: TTERECV    5
+CONSTANT: TTEKEEP    6
+CONSTANT: TTENOREC   7
+CONSTANT: TTEMISC    9999
 
 CONSTANT: RDBTRECON   1
 CONSTANT: RDBXOLCKREC 1
@@ -42,52 +41,52 @@ CONSTANT: RDBXOLCKGLB 2
 CONSTANT: RDBROCHKCON 1
 CONSTANT: RDBMONOULOG 1
 
-FUNCTION: char* tcrdberrmsg ( int ecode ) ;
+FUNCTION: c-string tcrdberrmsg ( int ecode ) ;
 FUNCTION: TCRDB* tcrdbnew ( ) ;
 FUNCTION: void tcrdbdel ( TCRDB* rdb ) ;
 FUNCTION: int tcrdbecode ( TCRDB* rdb ) ;
 FUNCTION: bool tcrdbtune ( TCRDB* rdb, double timeout, int opts ) ;
-FUNCTION: bool tcrdbopen ( TCRDB* rdb, char* host, int port ) ;
-FUNCTION: bool tcrdbopen2 ( TCRDB* rdb, char* expr ) ;
+FUNCTION: bool tcrdbopen ( TCRDB* rdb, c-string host, int port ) ;
+FUNCTION: bool tcrdbopen2 ( TCRDB* rdb, c-string expr ) ;
 FUNCTION: bool tcrdbclose ( TCRDB* rdb ) ;
 FUNCTION: bool tcrdbput ( TCRDB* rdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcrdbput2 ( TCRDB* rdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcrdbput2 ( TCRDB* rdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcrdbputkeep ( TCRDB* rdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcrdbputkeep2 ( TCRDB* rdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcrdbputkeep2 ( TCRDB* rdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcrdbputcat ( TCRDB* rdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcrdbputcat2 ( TCRDB* rdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcrdbputcat2 ( TCRDB* rdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcrdbputshl ( TCRDB* rdb, void* kbuf, int ksiz, void* vbuf, int vsiz, int width ) ;
-FUNCTION: bool tcrdbputshl2 ( TCRDB* rdb, char* kstr, char* vstr, int width ) ;
+FUNCTION: bool tcrdbputshl2 ( TCRDB* rdb, c-string kstr, c-string vstr, int width ) ;
 FUNCTION: bool tcrdbputnr ( TCRDB* rdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
-FUNCTION: bool tcrdbputnr2 ( TCRDB* rdb, char* kstr, char* vstr ) ;
+FUNCTION: bool tcrdbputnr2 ( TCRDB* rdb, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcrdbout ( TCRDB* rdb, void* kbuf, int ksiz ) ;
-FUNCTION: bool tcrdbout2 ( TCRDB* rdb, char* kstr ) ;
+FUNCTION: bool tcrdbout2 ( TCRDB* rdb, c-string kstr ) ;
 FUNCTION: void* tcrdbget ( TCRDB* rdb, void* kbuf, int ksiz, int* sp ) ;
-FUNCTION: char* tcrdbget2 ( TCRDB* rdb, char* kstr ) ;
+FUNCTION: c-string tcrdbget2 ( TCRDB* rdb, c-string kstr ) ;
 FUNCTION: bool tcrdbget3 ( TCRDB* rdb, TCMAP* recs ) ;
 FUNCTION: int tcrdbvsiz ( TCRDB* rdb, void* kbuf, int ksiz ) ;
-FUNCTION: int tcrdbvsiz2 ( TCRDB* rdb, char* kstr ) ;
+FUNCTION: int tcrdbvsiz2 ( TCRDB* rdb, c-string kstr ) ;
 FUNCTION: bool tcrdbiterinit ( TCRDB* rdb ) ;
 FUNCTION: void* tcrdbiternext ( TCRDB* rdb, int* sp ) ;
-FUNCTION: char* tcrdbiternext2 ( TCRDB* rdb ) ;
+FUNCTION: c-string tcrdbiternext2 ( TCRDB* rdb ) ;
 FUNCTION: TCLIST* tcrdbfwmkeys ( TCRDB* rdb, void* pbuf, int psiz, int max ) ;
-FUNCTION: TCLIST* tcrdbfwmkeys2 ( TCRDB* rdb, char* pstr, int max ) ;
+FUNCTION: TCLIST* tcrdbfwmkeys2 ( TCRDB* rdb, c-string pstr, int max ) ;
 FUNCTION: int tcrdbaddint ( TCRDB* rdb, void* kbuf, int ksiz, int num ) ;
 FUNCTION: double tcrdbadddouble ( TCRDB* rdb, void* kbuf, int ksiz, double num ) ;
-FUNCTION: void* tcrdbext ( TCRDB* rdb, char* name, int opts, void* kbuf, int ksiz, void* vbuf, int vsiz, int* sp ) ;
-FUNCTION: char* tcrdbext2 ( TCRDB* rdb, char* name, int opts, char* kstr, char* vstr ) ;
+FUNCTION: void* tcrdbext ( TCRDB* rdb, c-string name, int opts, void* kbuf, int ksiz, void* vbuf, int vsiz, int* sp ) ;
+FUNCTION: c-string tcrdbext2 ( TCRDB* rdb, c-string name, int opts, c-string kstr, c-string vstr ) ;
 FUNCTION: bool tcrdbsync ( TCRDB* rdb ) ;
-FUNCTION: bool tcrdboptimize ( TCRDB* rdb, char* params ) ;
+FUNCTION: bool tcrdboptimize ( TCRDB* rdb, c-string params ) ;
 FUNCTION: bool tcrdbvanish ( TCRDB* rdb ) ;
-FUNCTION: bool tcrdbcopy ( TCRDB* rdb, char* path ) ;
-FUNCTION: bool tcrdbrestore ( TCRDB* rdb, char* path, ulonglong ts, int opts ) ;
-FUNCTION: bool tcrdbsetmst ( TCRDB* rdb, char* host, int port, int opts ) ;
-FUNCTION: bool tcrdbsetmst2 ( TCRDB* rdb, char* expr, int opts ) ;
-FUNCTION: char* tcrdbexpr ( TCRDB* rdb ) ;
+FUNCTION: bool tcrdbcopy ( TCRDB* rdb, c-string path ) ;
+FUNCTION: bool tcrdbrestore ( TCRDB* rdb, c-string path, ulonglong ts, int opts ) ;
+FUNCTION: bool tcrdbsetmst ( TCRDB* rdb, c-string host, int port, int opts ) ;
+FUNCTION: bool tcrdbsetmst2 ( TCRDB* rdb, c-string expr, int opts ) ;
+FUNCTION: c-string tcrdbexpr ( TCRDB* rdb ) ;
 FUNCTION: ulonglong tcrdbrnum ( TCRDB* rdb ) ;
 FUNCTION: ulonglong tcrdbsize ( TCRDB* rdb ) ;
-FUNCTION: char* tcrdbstat ( TCRDB* rdb ) ;
-FUNCTION: TCLIST* tcrdbmisc ( TCRDB* rdb, char* name, int opts, TCLIST* args ) ;
+FUNCTION: c-string tcrdbstat ( TCRDB* rdb ) ;
+FUNCTION: TCLIST* tcrdbmisc ( TCRDB* rdb, c-string name, int opts, TCLIST* args ) ;
 
 CONSTANT: RDBITLEXICAL TDBITLEXICAL
 CONSTANT: RDBITDECIMAL TDBITDECIMAL
@@ -128,12 +127,12 @@ FUNCTION: bool tcrdbtblputkeep ( TCRDB* rdb, void* pkbuf, int pksiz, TCMAP* cols
 FUNCTION: bool tcrdbtblputcat ( TCRDB* rdb, void* pkbuf, int pksiz, TCMAP* cols ) ;
 FUNCTION: bool tcrdbtblout ( TCRDB* rdb, void* pkbuf, int pksiz ) ;
 FUNCTION: TCMAP* tcrdbtblget ( TCRDB* rdb, void* pkbuf, int pksiz ) ;
-FUNCTION: bool tcrdbtblsetindex ( TCRDB* rdb, char* name, int type ) ;
+FUNCTION: bool tcrdbtblsetindex ( TCRDB* rdb, c-string name, int type ) ;
 FUNCTION: longlong tcrdbtblgenuid ( TCRDB* rdb ) ;
 FUNCTION: RDBQRY* tcrdbqrynew ( TCRDB* rdb ) ;
 FUNCTION: void tcrdbqrydel ( RDBQRY* qry ) ;
-FUNCTION: void tcrdbqryaddcond ( RDBQRY* qry, char* name, int op, char* expr ) ;
-FUNCTION: void tcrdbqrysetorder ( RDBQRY* qry, char* name, int type ) ;
+FUNCTION: void tcrdbqryaddcond ( RDBQRY* qry, c-string name, int op, c-string expr ) ;
+FUNCTION: void tcrdbqrysetorder ( RDBQRY* qry, c-string name, int type ) ;
 FUNCTION: void tcrdbqrysetlimit ( RDBQRY* qry, int max, int skip ) ;
 FUNCTION: TCLIST* tcrdbqrysearch ( RDBQRY* qry ) ;
 FUNCTION: bool tcrdbqrysearchout ( RDBQRY* qry ) ;
index 9e8071d0dfc81a5d365a19e1eb849b0eaa8fb58a..072f428d581532345fa51dc5c6370e2c928b267b 100644 (file)
@@ -27,9 +27,8 @@ CONSTANT: TDBONOLCK  16
 CONSTANT: TDBOLCKNB  32
 CONSTANT: TDBOTSYNC  64
 
-C-ENUM:
-  TDBITLEXICAL
-  TDBITDECIMAL ;
+CONSTANT: TDBITLEXICAL 0
+CONSTANT: TDBITDECIMAL 1
 
 CONSTANT: TDBITOPT  9998
 CONSTANT: TDBITVOID 9999
@@ -38,31 +37,29 @@ CONSTANT: TDBITKEEP 16777216
 C-TYPE: TDBCOND
 C-TYPE: TDBQRY
 
-C-ENUM:
-    TDBQCSTREQ
-    TDBQCSTRINC
-    TDBQCSTRBW
-    TDBQCSTREW
-    TDBQCSTRAND
-    TDBQCSTROR
-    TDBQCSTROREQ
-    TDBQCSTRRX
-    TDBQCNUMEQ
-    TDBQCNUMGT
-    TDBQCNUMGE
-    TDBQCNUMLT
-    TDBQCNUMLE
-    TDBQCNUMBT
-    TDBQCNUMOREQ ;
+CONSTANT: TDBQCSTREQ   0
+CONSTANT: TDBQCSTRINC  1
+CONSTANT: TDBQCSTRBW   2
+CONSTANT: TDBQCSTREW   3
+CONSTANT: TDBQCSTRAND  4
+CONSTANT: TDBQCSTROR   5
+CONSTANT: TDBQCSTROREQ 6
+CONSTANT: TDBQCSTRRX   7
+CONSTANT: TDBQCNUMEQ   8
+CONSTANT: TDBQCNUMGT   9
+CONSTANT: TDBQCNUMGE   10
+CONSTANT: TDBQCNUMLT   11
+CONSTANT: TDBQCNUMLE   12
+CONSTANT: TDBQCNUMBT   13
+CONSTANT: TDBQCNUMOREQ 14
 
 CONSTANT: TDBQCNEGATE 16777216
 CONSTANT: TDBQCNOIDX  33554432
 
-C-ENUM:
-    TDBQOSTRASC
-    TDBQOSTRDESC
-    TDBQONUMASC
-    TDBQONUMDESC ;
+CONSTANT: TDBQOSTRASC  0
+CONSTANT: TDBQOSTRDESC 1
+CONSTANT: TDBQONUMASC  2
+CONSTANT: TDBQONUMDESC 3
 
 CONSTANT: TDBQPPUT  1
 CONSTANT: TDBQPOUT  2
@@ -71,7 +68,7 @@ CONSTANT: TDBQPSTOP 16777216
 ! int (*)(const void *pkbuf, int pksiz, TCMAP *cols, void *op);
 TYPEDEF: void* TDBQRYPROC
 
-FUNCTION: char* tctdberrmsg ( int ecode ) ;
+FUNCTION: c-string tctdberrmsg ( int ecode ) ;
 FUNCTION: TCTDB* tctdbnew ( ) ;
 FUNCTION: void tctdbdel ( TCTDB* tdb ) ;
 FUNCTION: int tctdbecode ( TCTDB* tdb ) ;
@@ -79,56 +76,56 @@ FUNCTION: bool tctdbsetmutex ( TCTDB* tdb ) ;
 FUNCTION: bool tctdbtune ( TCTDB* tdb, longlong bnum, char apow, char fpow, uchar opts ) ;
 FUNCTION: bool tctdbsetcache ( TCTDB* tdb, int rcnum, int lcnum, int ncnum ) ;
 FUNCTION: bool tctdbsetxmsiz ( TCTDB* tdb, longlong xmsiz ) ;
-FUNCTION: bool tctdbopen ( TCTDB* tdb, char* path, int omode ) ;
+FUNCTION: bool tctdbopen ( TCTDB* tdb, c-string path, int omode ) ;
 FUNCTION: bool tctdbclose ( TCTDB* tdb ) ;
 FUNCTION: bool tctdbput ( TCTDB* tdb, void* pkbuf, int pksiz, TCMAP* cols ) ;
 FUNCTION: bool tctdbput2 ( TCTDB* tdb, void* pkbuf, int pksiz, void* cbuf, int csiz ) ;
-FUNCTION: bool tctdbput3 ( TCTDB* tdb, char* pkstr, char* cstr ) ;
+FUNCTION: bool tctdbput3 ( TCTDB* tdb, c-string pkstr, c-string cstr ) ;
 FUNCTION: bool tctdbputkeep ( TCTDB* tdb, void* pkbuf, int pksiz, TCMAP* cols ) ;
 FUNCTION: bool tctdbputkeep2 ( TCTDB* tdb, void* pkbuf, int pksiz, void* cbuf, int csiz ) ;
-FUNCTION: bool tctdbputkeep3 ( TCTDB* tdb, char* pkstr, char* cstr ) ;
+FUNCTION: bool tctdbputkeep3 ( TCTDB* tdb, c-string pkstr, c-string cstr ) ;
 FUNCTION: bool tctdbputcat ( TCTDB* tdb, void* pkbuf, int pksiz, TCMAP* cols ) ;
 FUNCTION: bool tctdbputcat2 ( TCTDB* tdb, void* pkbuf, int pksiz, void* cbuf, int csiz ) ;
-FUNCTION: bool tctdbputcat3 ( TCTDB* tdb, char* pkstr, char* cstr ) ;
+FUNCTION: bool tctdbputcat3 ( TCTDB* tdb, c-string pkstr, c-string cstr ) ;
 FUNCTION: bool tctdbout ( TCTDB* tdb, void* pkbuf, int pksiz ) ;
-FUNCTION: bool tctdbout2 ( TCTDB* tdb, char* pkstr ) ;
+FUNCTION: bool tctdbout2 ( TCTDB* tdb, c-string pkstr ) ;
 FUNCTION: TCMAP* tctdbget ( TCTDB* tdb, void* pkbuf, int pksiz ) ;
-FUNCTION: char* tctdbget2 ( TCTDB* tdb, void* pkbuf, int pksiz, int* sp ) ;
-FUNCTION: char* tctdbget3 ( TCTDB* tdb, char* pkstr ) ;
+FUNCTION: c-string tctdbget2 ( TCTDB* tdb, void* pkbuf, int pksiz, int* sp ) ;
+FUNCTION: c-string tctdbget3 ( TCTDB* tdb, c-string pkstr ) ;
 FUNCTION: int tctdbvsiz ( TCTDB* tdb, void* pkbuf, int pksiz ) ;
-FUNCTION: int tctdbvsiz2 ( TCTDB* tdb, char* pkstr ) ;
+FUNCTION: int tctdbvsiz2 ( TCTDB* tdb, c-string pkstr ) ;
 FUNCTION: bool tctdbiterinit ( TCTDB* tdb ) ;
 FUNCTION: void* tctdbiternext ( TCTDB* tdb, int* sp ) ;
-FUNCTION: char* tctdbiternext2 ( TCTDB* tdb ) ;
+FUNCTION: c-string tctdbiternext2 ( TCTDB* tdb ) ;
 FUNCTION: TCLIST* tctdbfwmkeys ( TCTDB* tdb, void* pbuf, int psiz, int max ) ;
-FUNCTION: TCLIST* tctdbfwmkeys2 ( TCTDB* tdb, char* pstr, int max ) ;
+FUNCTION: TCLIST* tctdbfwmkeys2 ( TCTDB* tdb, c-string pstr, int max ) ;
 FUNCTION: int tctdbaddint ( TCTDB* tdb, void* pkbuf, int pksiz, int num ) ;
 FUNCTION: double tctdbadddouble ( TCTDB* tdb, void* pkbuf, int pksiz, double num ) ;
 FUNCTION: bool tctdbsync ( TCTDB* tdb ) ;
 FUNCTION: bool tctdboptimize ( TCTDB* tdb, longlong bnum, char apow, char fpow, uchar opts ) ;
 FUNCTION: bool tctdbvanish ( TCTDB* tdb ) ;
-FUNCTION: bool tctdbcopy ( TCTDB* tdb, char* path ) ;
+FUNCTION: bool tctdbcopy ( TCTDB* tdb, c-string path ) ;
 FUNCTION: bool tctdbtranbegin ( TCTDB* tdb ) ;
 FUNCTION: bool tctdbtrancommit ( TCTDB* tdb ) ;
 FUNCTION: bool tctdbtranabort ( TCTDB* tdb ) ;
-FUNCTION: char* tctdbpath ( TCTDB* tdb ) ;
+FUNCTION: c-string tctdbpath ( TCTDB* tdb ) ;
 FUNCTION: ulonglong tctdbrnum ( TCTDB* tdb ) ;
 FUNCTION: ulonglong tctdbfsiz ( TCTDB* tdb ) ;
-FUNCTION: bool tctdbsetindex ( TCTDB* tdb, char* name, int type ) ;
+FUNCTION: bool tctdbsetindex ( TCTDB* tdb, c-string name, int type ) ;
 FUNCTION: longlong tctdbgenuid ( TCTDB* tdb ) ;
 FUNCTION: TDBQRY* tctdbqrynew ( TCTDB* tdb ) ;
 FUNCTION: void tctdbqrydel ( TDBQRY* qry ) ;
-FUNCTION: void tctdbqryaddcond ( TDBQRY* qry, char* name, int op, char* expr ) ;
-FUNCTION: void tctdbqrysetorder ( TDBQRY* qry, char* name, int type ) ;
+FUNCTION: void tctdbqryaddcond ( TDBQRY* qry, c-string name, int op, c-string expr ) ;
+FUNCTION: void tctdbqrysetorder ( TDBQRY* qry, c-string name, int type ) ;
 FUNCTION: void tctdbqrysetlimit ( TDBQRY* qry, int max, int skip ) ;
 FUNCTION: TCLIST* tctdbqrysearch ( TDBQRY* qry ) ;
 FUNCTION: bool tctdbqrysearchout ( TDBQRY* qry ) ;
 FUNCTION: bool tctdbqryproc ( TDBQRY* qry, TDBQRYPROC proc, void* op ) ;
-FUNCTION: char* tctdbqryhint ( TDBQRY* qry ) ;
+FUNCTION: c-string tctdbqryhint ( TDBQRY* qry ) ;
 
 ! =======
 
-FUNCTION: void tctdbsetecode ( TCTDB* tdb, int ecode, char* filename, int line, char* func ) ;
+FUNCTION: void tctdbsetecode ( TCTDB* tdb, int ecode, c-string filename, int line, c-string func ) ;
 FUNCTION: void tctdbsetdbgfd ( TCTDB* tdb, int fd ) ;
 FUNCTION: int tctdbdbgfd ( TCTDB* tdb ) ;
 FUNCTION: bool tctdbhasmutex ( TCTDB* tdb ) ;
@@ -140,7 +137,7 @@ FUNCTION: ulonglong tctdbinode ( TCTDB* tdb ) ;
 FUNCTION: tokyo_time_t tctdbmtime ( TCTDB* tdb ) ;
 FUNCTION: uchar tctdbflags ( TCTDB* tdb ) ;
 FUNCTION: uchar tctdbopts ( TCTDB* tdb ) ;
-FUNCTION: char* tctdbopaque ( TCTDB* tdb ) ;
+FUNCTION: c-string tctdbopaque ( TCTDB* tdb ) ;
 FUNCTION: ulonglong tctdbbnumused ( TCTDB* tdb ) ;
 FUNCTION: int tctdbinum ( TCTDB* tdb ) ;
 FUNCTION: longlong tctdbuidseed ( TCTDB* tdb ) ;
@@ -150,7 +147,7 @@ FUNCTION: bool tctdbputproc ( TCTDB* tdb, void* pkbuf, int pksiz, void* cbuf, in
 FUNCTION: bool tctdbforeach ( TCTDB* tdb, TCITER iter, void* op ) ;
 FUNCTION: bool tctdbqryproc2 ( TDBQRY* qry, TDBQRYPROC proc, void* op ) ;
 FUNCTION: bool tctdbqrysearchout2 ( TDBQRY* qry ) ;
-FUNCTION: int tctdbstrtoindextype ( char* str ) ;
+FUNCTION: int tctdbstrtoindextype ( c-string str ) ;
 FUNCTION: int tctdbqrycount ( TDBQRY* qry ) ;
-FUNCTION: int tctdbqrystrtocondop ( char* str ) ;
-FUNCTION: int tctdbqrystrtoordertype ( char* str ) ;
+FUNCTION: int tctdbqrystrtocondop ( c-string str ) ;
+FUNCTION: int tctdbqrystrtoordertype ( c-string str ) ;
index 7cb6c5e09218bf170491e1ba343a00491f445408..54fe000df77af8c243518c340cb86c701dbbdc44 100644 (file)
@@ -8,15 +8,14 @@ IN: tokyo.alien.tcutil
     { [ os macosx? ] [ "/opt/local/lib/libtokyocabinet.dylib" ] }
     { [ os unix? ] [ "libtokyocabinet.so" ] }
     { [ os windows? ] [ "tokyocabinet.dll" ] }
-} cond "cdecl" add-library >>
+} cond cdecl add-library >>
 
 LIBRARY: tokyocabinet
 
-C-ENUM:
-    TCDBTHASH
-    TCDBTBTREE
-    TCDBTFIXED
-    TCDBTTABLE ;
+CONSTANT: TCDBTHASH 0
+CONSTANT: TCDBTBTREE 1
+CONSTANT: TCDBTFIXED 2
+CONSTANT: TCDBTTABLE 3
 
 ! FIXME: on windows 64bits this isn't correct, because long is 32bits there, and time_t is int64
 TYPEDEF: long tokyo_time_t
@@ -28,9 +27,9 @@ FUNCTION: TCLIST* tclistnew2 ( int anum ) ;
 FUNCTION: void tclistdel ( TCLIST* list ) ;
 FUNCTION: int tclistnum ( TCLIST* list ) ;
 FUNCTION: void* tclistval ( TCLIST* list, int index, int* sp ) ;
-FUNCTION: char* tclistval2 ( TCLIST* list, int index ) ;
+FUNCTION: c-string tclistval2 ( TCLIST* list, int index ) ;
 FUNCTION: void tclistpush ( TCLIST* list, void* ptr, int size ) ;
-FUNCTION: void tclistpush2 ( TCLIST* list, char* str ) ;
+FUNCTION: void tclistpush2 ( TCLIST* list, c-string str ) ;
 FUNCTION: void tcfree ( void* ptr ) ;
 
 TYPEDEF: void* TCCMP
index c8761e16f3cfff8e6d861ebbaf938e36e6f92ba3..4ae1f4dcedc11323262be7650ca632e4e3e3a294 100644 (file)
@@ -7,4 +7,4 @@ IN: tokyo.remotedb
 
 : <tokyo-remotedb> ( host port -- tokyo-remotedb )
     [ tcrdbnew dup ] 2dip tcrdbopen drop
-    tokyo-remotedb new [ (>>handle) ] keep ;
+    tokyo-remotedb new [ handle<< ] keep ;
index f9edc9c3b8f7c01d4ee770e2573ae5df1cfea6d5..41a6310a64c60471d323f41acdae868804b159b8 100644 (file)
@@ -1,5 +1,5 @@
 USING: kernel tools.test trees trees.avl math random sequences
-assocs accessors ;
+assocs accessors trees.avl.private trees.private ;
 IN: trees.avl.tests
 
 [ "key1" 0 "key2" 0 ] [
index 4903307af1698a5a9bf3f6cdf28b7713c347c6cc..9b4819d3aa19cbdbcd22feca4b159bab12fdde1b 100644 (file)
@@ -2,7 +2,8 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: combinators kernel generic math math.functions
 math.parser namespaces io sequences trees shuffle
-assocs parser accessors math.order prettyprint.custom ;
+assocs parser accessors math.order prettyprint.custom
+trees.private ;
 IN: trees.avl
 
 TUPLE: avl < tree ;
@@ -10,6 +11,8 @@ TUPLE: avl < tree ;
 : <avl> ( -- tree )
     avl new-tree ;
 
+<PRIVATE
+
 TUPLE: avl-node < node balance ;
 
 : <avl-node> ( key value -- node )
@@ -20,12 +23,15 @@ TUPLE: avl-node < node balance ;
     swap [ + ] change-balance drop ;
 
 : rotate ( node -- node )
-    dup node+link dup node-link pick set-node+link
-    tuck set-node-link ;    
+    dup node+link
+    dup node-link
+    pick set-node+link
+    [ set-node-link ] keep ;    
 
 : single-rotate ( node -- node )
-    0 over (>>balance) 0 over node+link 
-    (>>balance) rotate ;
+    0 >>balance
+    0 over node+link 
+    balance<< rotate ;
 
 : pick-balances ( a node -- balance balance )
     balance>> {
@@ -38,8 +44,8 @@ TUPLE: avl-node < node balance ;
     [
         node+link [
             node-link current-side get neg
-            over pick-balances rot 0 swap (>>balance)
-        ] keep (>>balance)
+            over pick-balances rot 0 swap balance<<
+        ] keep balance<<
     ] keep swap >>balance
     dup node+link [ rotate ] with-other-side
     over set-node+link rotate ;
@@ -61,14 +67,14 @@ DEFER: avl-set
 : avl-insert ( value key node -- node taller? )
     2dup key>> before? left right ? [
         [ node-link avl-set ] keep swap
-        [ tuck set-node-link ] dip
+        [ [ set-node-link ] keep ] dip
         [ dup current-side get increase-balance balance-insert ]
         [ f ] if
     ] with-side ;
 
 : (avl-set) ( value key node -- node taller? )
     2dup key>> = [
-        -rot pick (>>key) over (>>value) f
+        -rot pick key<< over value<< f
     ] [ avl-insert ] if ;
 
 : avl-set ( value key node -- node taller? )
@@ -79,8 +85,8 @@ M: avl set-at ( value key node -- node )
 
 : delete-select-rotate ( node -- node shorter? )
     dup node+link balance>> zero? [
-        current-side get neg over (>>balance)
-        current-side get over node+link (>>balance) rotate f
+        current-side get neg over balance<<
+        current-side get over node+link balance<< rotate f
     ] [
         select-rotate t
     ] if ;
@@ -94,7 +100,7 @@ M: avl set-at ( value key node -- node )
 
 : balance-delete ( node -- node shorter? )
     current-side get over balance>> {
-        { [ dup zero? ] [ drop neg over (>>balance) f ] }
+        { [ dup zero? ] [ drop neg over balance<< f ] }
         { [ dupd = ] [ drop 0 >>balance t ] }
         [ dupd neg increase-balance rebalance-delete ]
     } cond ;
@@ -146,6 +152,8 @@ M: avl delete-at ( key node -- )
 
 M: avl new-assoc 2drop <avl> ;
 
+PRIVATE>
+
 : >avl ( assoc -- avl )
     T{ avl f f 0 } assoc-clone-like ;
 
index 67b2f6b62456aeca32e71650a0bcd67f6ba783f2..3b39bfe6427dac1f415dbb4b4b3ace38cfa4ccfb 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (c) 2005 Mackenzie Straight.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays kernel math namespaces sequences assocs parser
-trees generic math.order accessors prettyprint.custom shuffle ;
+trees generic math.order accessors prettyprint.custom
+trees.private combinators ;
 IN: trees.splay
 
 TUPLE: splay < tree ;
@@ -9,73 +10,78 @@ TUPLE: splay < tree ;
 : <splay> ( -- tree )
     \ splay new-tree ;
 
+<PRIVATE
+
 : rotate-right ( node -- node )
     dup left>>
-    [ right>> swap (>>left) ] 2keep
-    [ (>>right) ] keep ;
+    [ right>> swap left<< ] 2keep
+    [ right<< ] keep ;
                                                         
 : rotate-left ( node -- node )
     dup right>>
-    [ left>> swap (>>right) ] 2keep
-    [ (>>left) ] keep ;
+    [ left>> swap right<< ] 2keep
+    [ left<< ] keep ;
 
 : link-right ( left right key node -- left right key node )
-    swap [ [ swap (>>left) ] 2keep
+    swap [ [ swap left<< ] 2keep
     nip dup left>> ] dip swap ;
 
 : link-left ( left right key node -- left right key node )
-    swap [ rot [ (>>right) ] 2keep
+    swap [ rot [ right<< ] 2keep
     drop dup right>> swapd ] dip swap ;
 
-: cmp ( key node -- obj node -1/0/1 )
-    2dup key>> key-side ;
+: cmp ( key node -- obj node <=> )
+    2dup key>> <=> ;
 
-: lcmp ( key node -- obj node -1/0/1 ) 
-    2dup left>> key>> key-side ;
+: lcmp ( key node -- obj node <=> ) 
+    2dup left>> key>> <=> ;
 
-: rcmp ( key node -- obj node -1/0/1 ) 
-    2dup right>> key>> key-side ;
+: rcmp ( key node -- obj node <=> ) 
+    2dup right>> key>> <=> ;
 
 DEFER: (splay)
 
 : splay-left ( left right key node -- left right key node )
     dup left>> [
-        lcmp 0 < [ rotate-right ] when
+        lcmp +lt+ = [ rotate-right ] when
         dup left>> [ link-right (splay) ] when
     ] when ;
 
 : splay-right ( left right key node -- left right key node )
     dup right>> [
-        rcmp 0 > [ rotate-left ] when
+        rcmp +gt+ = [ rotate-left ] when
         dup right>> [ link-left (splay) ] when
     ] when ;
 
 : (splay) ( left right key node -- left right key node )
-    cmp dup 0 <
-    [ drop splay-left ] [ 0 > [ splay-right ] when ] if ;
+    cmp {
+        { +lt+ [ splay-left ] }
+        { +gt+ [ splay-right ] }
+        { +eq+ [ ] }
+    } case ;
 
 : assemble ( head left right node -- root )
-    [ right>> swap (>>left) ] keep
-    [ left>> swap (>>right) ] keep
-    [ swap left>> swap (>>right) ] 2keep
-    [ swap right>> swap (>>left) ] keep ;
+    [ right>> swap left<< ] keep
+    [ left>> swap right<< ] keep
+    [ swap left>> swap right<< ] 2keep
+    [ swap right>> swap left<< ] keep ;
 
 : splay-at ( key node -- node )
     [ T{ node } clone dup dup ] 2dip
     (splay) nip assemble ;
 
-: splay ( key tree -- )
-    [ root>> splay-at ] keep (>>root) ;
+: do-splay ( key tree -- )
+    [ root>> splay-at ] keep root<< ;
 
 : splay-split ( key tree -- node node )
-    2dup splay root>> cmp 0 < [
-        nip dup left>> swap f over (>>left)
+    2dup do-splay root>> cmp +lt+ = [
+        nip dup left>> swap f over left<<
     ] [
-        nip dup right>> swap f over (>>right) swap
+        nip dup right>> swap f over right<< swap
     ] if ;
 
 : get-splay ( key tree -- node ? )
-    2dup splay root>> cmp 0 = [
+    2dup do-splay root>> cmp +eq+ = [
         nip t
     ] [
         2drop f f
@@ -89,28 +95,28 @@ DEFER: (splay)
 
 : splay-join ( n2 n1 -- node )
     splay-largest [
-        [ (>>right) ] keep
+        [ right<< ] keep
     ] [
         drop f
     ] if* ;
 
 : remove-splay ( key tree -- )
-    tuck get-splay nip [
+    [ get-splay nip ] keep [
         dup dec-count
         dup right>> swap left>> splay-join
-        swap (>>root)
+        swap root<<
     ] [ drop ] if* ;
 
 : set-splay ( value key tree -- )
-    2dup get-splay [ 2nip (>>value) ] [
+    2dup get-splay [ 2nip value<< ] [
        drop dup inc-count
        2dup splay-split rot
-       [ [ swapd ] dip node boa ] dip (>>root)
+       [ [ swapd ] dip node boa ] dip root<<
     ] if ;
 
 : new-root ( value key tree -- )
     1 >>count
-    [ swap <node> ] dip (>>root) ;
+    [ swap <node> ] dip root<< ;
 
 M: splay set-at ( value key tree -- )
     dup root>> [ set-splay ] [ new-root ] if ;
@@ -128,6 +134,8 @@ M: splay delete-at ( key tree -- )
 M: splay new-assoc
     2drop <splay> ;
 
+PRIVATE>
+
 : >splay ( assoc -- tree )
     T{ splay f f 0 } assoc-clone-like ;
 
index 77e5e5bdc066ab7cecbd99b6f3ea86ad57df0ba9..d56e33823451a2de6a0a94085d6c0f66c9d0da99 100644 (file)
@@ -2,22 +2,27 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel generic math sequences arrays io namespaces
 prettyprint.private kernel.private assocs random combinators
-parser math.order accessors deques make prettyprint.custom 
-shuffle ;
+parser math.order accessors deques make prettyprint.custom ;
 IN: trees
 
 TUPLE: tree root count ;
 
+<PRIVATE
+
 : new-tree ( class -- tree )
     new
         f >>root
         0 >>count ; inline
 
+PRIVATE>
+
 : <tree> ( -- tree )
     tree new-tree ;
 
 INSTANCE: tree assoc
 
+<PRIVATE
+
 TUPLE: node key value left right ;
 
 : new-node ( key value class -- node )
@@ -50,7 +55,7 @@ CONSTANT: right 1
     go-left? xor [ left>> ] [ right>> ] if ;
 
 : set-node-link@ ( left parent ? -- ) 
-    go-left? xor [ (>>left) ] [ (>>right) ] if ;
+    go-left? xor [ left<< ] [ right<< ] if ;
 
 : node-link ( node -- child ) f node-link@  ;
 
@@ -61,7 +66,7 @@ CONSTANT: right 1
 : set-node+link ( child node -- ) t set-node-link@ ;
 
 : with-side ( side quot -- )
-    [ swap current-side set call ] with-scope ; inline
+    [ current-side ] dip with-variable ; inline
 
 : with-other-side ( quot -- )
     current-side get neg swap with-side ; inline
@@ -137,9 +142,9 @@ DEFER: delete-node
 
 : (prune-extremity) ( parent node -- new-extremity )
     dup node-link [
-        rot drop (prune-extremity)
+        [ nip ] dip (prune-extremity)
     ] [
-        tuck delete-node swap set-node-link
+        [ delete-node ] [ set-node-link ] bi
     ] if* ;
 
 : prune-extremity ( node -- new-extremity )
@@ -183,9 +188,15 @@ DEFER: delete-node
     2dup key>> key-side dup 0 eq? [
         drop nip delete-node
     ] [
-        [ tuck node-link delete-bst-node over set-node-link ] with-side
+        [
+            [ node-link delete-bst-node ]
+            [ set-node-link ]
+            [ ] tri
+        ] with-side
     ] if ;
 
+PRIVATE>
+
 M: tree delete-at
     [ delete-bst-node ] change-root drop ;
 
diff --git a/extra/twitter/summary.txt b/extra/twitter/summary.txt
new file mode 100644 (file)
index 0000000..ee9d6c7
--- /dev/null
@@ -0,0 +1 @@
+Wrapper for Twitter web service
diff --git a/extra/twitter/tags.txt b/extra/twitter/tags.txt
new file mode 100644 (file)
index 0000000..0a8d552
--- /dev/null
@@ -0,0 +1 @@
+web services
index 06f1de6bc8c05d4c2ba0ae7ef21f95ad28f1501e..249698e8dc11038de050f62bdd39fb1f40d420f9 100644 (file)
@@ -78,7 +78,7 @@ M: list focusable-child* drop t ;
     dup list-empty? [
         2drop
     ] [
-        [ control-value length rem ] [ (>>index) ] [ ] tri
+        [ control-value length rem ] [ index<< ] [ ] tri
         [ relayout-1 ] [ scroll>selected ] bi
     ] if ;
 
diff --git a/extra/variables/variables.factor b/extra/variables/variables.factor
new file mode 100644 (file)
index 0000000..e4632d0
--- /dev/null
@@ -0,0 +1,98 @@
+! (c)2010 Joe Groff bsd license
+USING: accessors arrays combinators definitions fry kernel
+locals.types namespaces parser quotations see sequences slots
+words ;
+FROM: kernel.private => declare ;
+FROM: help.markup.private => link-effect? ;
+IN: variables
+
+PREDICATE: variable < word
+    "variable-setter" word-prop ;
+
+GENERIC: variable-setter ( word -- word' )
+
+M: variable variable-setter "variable-setter" word-prop ;
+M: local-reader variable-setter "local-writer" word-prop ;
+
+SYNTAX: set:
+    scan-object variable-setter suffix! ;
+
+: [variable-getter] ( variable -- quot )
+    '[ _ get ] ;
+: [variable-setter] ( variable -- quot )
+    '[ _ set ] ;
+
+: (define-variable) ( word getter setter -- )
+    [ (( -- value )) define-inline ]
+    [
+        [
+            [ name>> "set: " prepend <uninterned-word> ]
+            [ over "variable-setter" set-word-prop ] bi
+        ] dip (( value -- )) define-inline
+    ] bi-curry* bi ;
+
+: define-variable ( word -- )
+    dup [ [variable-getter] ] [ [variable-setter] ] bi (define-variable) ;
+
+SYNTAX: VAR:
+    CREATE-WORD define-variable ;    
+
+M: variable definer drop \ VAR: f ;
+M: variable definition drop f ;
+M: variable link-effect? drop f ;
+M: variable print-stack-effect? drop f ;
+
+PREDICATE: typed-variable < variable
+    "variable-type" word-prop ;
+
+: [typed-getter] ( quot type -- quot )
+    1array '[ @ _ declare ] ;
+: [typed-setter] ( quot type -- quot )
+    instance-check-quot prepose ;
+
+: define-typed-variable ( word type -- )
+    dupd {
+        [ [ [variable-getter] ] dip [typed-getter] ]
+        [ [ [variable-setter] ] dip [typed-setter] ]
+        [ "variable-type" set-word-prop ]
+        [ initial-value swap set-global ]
+    } 2cleave (define-variable) ;
+
+SYNTAX: TYPED-VAR:
+    CREATE-WORD scan-object define-typed-variable ;    
+
+M: typed-variable definer drop \ TYPED-VAR: f ;
+M: typed-variable definition "variable-type" word-prop 1quotation ;
+
+TUPLE: global-box value ;
+
+PREDICATE: global-variable < variable
+    def>> first global-box? ;
+
+: [global-getter] ( box -- quot )
+    '[ _ value>> ] ;
+: [global-setter] ( box -- quot )
+    '[ _ value<< ] ;
+
+: define-global ( word -- )
+    global-box new [ [global-getter] ] [ [global-setter] ] bi (define-variable) ;
+
+SYNTAX: GLOBAL:
+    CREATE-WORD define-global ;
+
+M: global-variable definer drop \ GLOBAL: f ;
+
+INTERSECTION: typed-global-variable
+    global-variable typed-variable ;
+
+: define-typed-global ( word type -- )
+    2dup "variable-type" set-word-prop
+    dup initial-value global-box boa swap
+    [ [ [global-getter] ] dip [typed-getter] ]
+    [ [ [global-setter] ] dip [typed-setter] ] 2bi (define-variable) ;
+
+SYNTAX: TYPED-GLOBAL:
+    CREATE-WORD scan-object define-typed-global ;
+
+M: typed-global-variable definer drop \ TYPED-GLOBAL: f ;
+
diff --git a/extra/vars/authors.txt b/extra/vars/authors.txt
deleted file mode 100644 (file)
index 6cfd5da..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Eduardo Cavazos
diff --git a/extra/vars/summary.txt b/extra/vars/summary.txt
deleted file mode 100644 (file)
index 9f5f717..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Shorthand notation for variables
diff --git a/extra/vars/tags.txt b/extra/vars/tags.txt
deleted file mode 100644 (file)
index f427429..0000000
+++ /dev/null
@@ -1 +0,0 @@
-extensions
diff --git a/extra/vars/vars.factor b/extra/vars/vars.factor
deleted file mode 100644 (file)
index 21c9b30..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos
-
-! Thanks to Mackenzie Straight for the idea
-
-USING: accessors kernel parser lexer words words.symbol
-namespaces sequences quotations ;
-
-IN: vars
-
-: define-var-getter ( word -- )
-    [ name>> ">" append create-in ] [ [ get ] curry ] bi
-    (( -- value )) define-declared ;
-
-: define-var-setter ( word -- )
-    [ name>> ">" prepend create-in ] [ [ set ] curry ] bi
-    (( value -- )) define-declared ;
-
-: define-var ( str -- )
-    create-in
-    [ define-symbol ]
-    [ define-var-getter ]
-    [ define-var-setter ] tri ;
-
-SYNTAX: VAR: ! var
-    scan define-var ;
-
-: define-vars ( seq -- )
-    [ define-var ] each ;
-
-SYNTAX: VARS: ! vars ...
-    ";" parse-tokens define-vars ;
index bcaed59ea4816e5f2bd4f9148e1da4a6720159e4..f6b364f089eed50e882d2789fbe6e5933a2766de 100644 (file)
@@ -23,7 +23,7 @@
 
                <p>This is the <a href="http://factorcode.org" target="_top">Factor</a>
                documentation, generated offline from a
-               <code>load-everything</code> image. If you want, you can also browse the
+               <code>load-all</code> image. If you want, you can also browse the
                documentation from within the <a href="http://factorcode.org" target="_top">Factor</a> UI.</p>
                
                <p>You may search article titles below; for example, try searching for "HTTP".</p>
index 7e50f958cd7346a21eddd6211639a47b5457a5e0..27102056f8fbff8d110a61eab356656bb3177647 100644 (file)
@@ -28,6 +28,7 @@
 
     <table border="1">
       <tr><td>Host name:</td><td><t:xml t:name="host-name" /></td></tr>
+      <tr><td>Last heartbeat:</td><td><t:label t:name="current-timestamp" /></td></tr>
       <tr><td>Current status:</td><td><t:xml t:name="status" /></td></tr>
       <tr><td>Last build:</td><td><t:xml t:name="last-build" /></td></tr>
       <tr><td>Last clean build:</td><td><t:xml t:name="last-clean-build" /></td></tr>
diff --git a/extra/webapps/mason/downloads.xml b/extra/webapps/mason/downloads.xml
new file mode 100644 (file)
index 0000000..82d6572
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version='1.0' ?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
+
+<h2>Stable release: <t:link t:name="stable-release" /></h2>
+
+<table id="mytable" cellspacing="0" summary="Stable releases">
+       <t:xml t:name="release-grid" />
+</table>
+
+<p><b>Source code</b>: <t:link t:name="source-release" /></p>
+
+<h2>Development release</h2>
+
+<table id="mytable" cellspacing="0" summary="Development releases">
+       <t:xml t:name="package-grid" />
+</table>
+
+</t:chloe>
diff --git a/extra/webapps/mason/downloads/authors.txt b/extra/webapps/mason/downloads/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/webapps/mason/downloads/downloads.factor b/extra/webapps/mason/downloads/downloads.factor
new file mode 100644 (file)
index 0000000..7ff9e64
--- /dev/null
@@ -0,0 +1,25 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors furnace.actions html.components html.forms
+kernel mason.server mason.version.data webapps.mason.grids
+webapps.mason.utils ;
+IN: webapps.mason.downloads
+
+: stable-release ( version -- link )
+    [ version>> ] [ announcement-url>> ] bi <simple-link> ;
+
+: source-release ( version -- link )
+    [ version>> ] [ source-path>> download-url ] bi <simple-link> ;
+
+: <downloads-action> ( -- action )
+    <page-action>
+    [
+        [
+            package-grid "package-grid" set-value
+            release-grid "release-grid" set-value
+
+            latest-version
+            [ stable-release "stable-release" set-value ]
+            [ source-release "source-release" set-value ] bi
+        ] with-mason-db
+    ] >>init ;
index 86d9ba38b3e3060559569f36f1c7766207bc23c5..d9d12ef74571d7cd7af6d0d4aa94f7ae61e0cff2 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs db.tuples furnace.actions
 furnace.utilities http.server.responses kernel locals
-mason.server mason.server.release sequences splitting urls
+mason.server mason.version.data sequences splitting urls
 webapps.mason.utils xml.syntax xml.writer ;
 IN: webapps.mason.grids
 
@@ -19,7 +19,6 @@ CONSTANT: oses
     { "macosx" "Mac OS X" }
     { "linux" "Linux" }
     { "freebsd" "FreeBSD" }
-    { "netbsd" "NetBSD" }
     { "openbsd" "OpenBSD" }
 }
 
@@ -36,7 +35,7 @@ CONSTANT: cpus
 :: render-grid-row ( cpu quot -- xml )
     cpu second oses keys [| os | cpu os quot render-grid-cell ] map
     [XML <tr><th align='center' scope='row'><-></th><-></tr> XML] ;
-    
+
 :: render-grid ( quot -- xml )
     render-grid-header
     cpus [ quot render-grid-row ] map
index f12ba014f2fc64d5813b9e0f2393abb876159439..7143d819abddf52d11ef0e9684ab82abb2d1251f 100644 (file)
   </head>
   <body>
     <t:form t:action="$mason-app/make-release">
-       Version: <t:field t:name="version" />
-       <button type="submit">Go</button>
+       <table>
+               <tr><td>Version:</td><td><t:field t:name="version" /></td></tr>
+               <tr><td>Announcement URL:</td><td><t:field t:name="announcement-url" /></td></tr>
+       </table>
+
+       <p><button type="submit">Go</button></p>
     </t:form>
   </body>
 </html>
index 4cc3873d91b93243d232117d82089a7370f6b553..e7cd13a8951a980818443a30cb35ab5ce5e583cb 100644 (file)
@@ -1,16 +1,20 @@
 ! Copyright (C) 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors furnace.actions html.forms
-http.server.responses mason.server mason.server.release
-validators ;
+http.server.responses mason.server mason.version validators ;
 IN: webapps.mason.make-release
 
 : <make-release-action> ( -- action )
     <page-action>
-    [ { { "version" [ v-one-line ] } } validate-params ] >>validate
+    [
+        {
+            { "version" [ v-one-line ] }
+            { "announcement-url" [ v-url ] }
+        } validate-params
+    ] >>validate
     [
         [
-            "version" value do-release
+            "version" value "announcement-url" value do-release
             "OK" "text/html" <content>
         ] with-mason-db
     ] >>submit ;
index e134778fc725e141dfe59c75c00d625924da6889..81eb36a17dbfbf85e71d09b3ce77f52feab8a714 100644 (file)
@@ -3,7 +3,8 @@
 USING: accessors furnace.auth furnace.db
 http.server.dispatchers mason.server webapps.mason.grids
 webapps.mason.make-release webapps.mason.package
-webapps.mason.release webapps.mason.report ;
+webapps.mason.release webapps.mason.report
+webapps.mason.downloads webapps.mason.status-update ;
 IN: webapps.mason
 
 TUPLE: mason-app < dispatcher ;
@@ -21,21 +22,20 @@ can-make-releases? define-capability
         { mason-app "download-package" } >>template
         "package" add-responder
 
-    <package-grid-action>
-        "packages" add-responder
-
     <download-release-action>
         { mason-app "download-release" } >>template
         "release" add-responder
 
-    <release-grid-action>
-        "releases" add-responder
+    <downloads-action>
+        { mason-app "downloads" } >>template
+        "downloads" add-responder
 
     <make-release-action>
         { mason-app "make-release" } >>template
-
         <protected>
             "make releases" >>description
             { can-make-releases? } >>capabilities
+        "make-release" add-responder
 
-        "make-release" add-responder ;
+    <status-update-action>
+        "status-update" add-responder ;
index d1ed03cbf47016d9587c28aeb447e05cf87e9d74..504ba7093f21e0eaffb181c7ae509a357691e4f9 100644 (file)
@@ -2,8 +2,9 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays combinators furnace.actions html.forms
 kernel mason.platform mason.report mason.server present
-sequences webapps.mason webapps.mason.report
-webapps.mason.utils xml.syntax ;
+sequences webapps.mason webapps.mason.report webapps.mason.utils
+xml.syntax ;
+FROM: mason.version.files => platform ;
 IN: webapps.mason.package
 
 : building ( builder string -- xml )
@@ -31,7 +32,7 @@ IN: webapps.mason.package
     over [ [ git-link ] [ present ] bi* " (built on " ")" surround 2array ] [ 2drop f ] if ;
 
 : packages-url ( builder -- url )
-    [ os>> ] [ cpu>> ] bi (platform) "http://downloads.factorcode.org/" prepend ;
+    platform download-url ;
 
 : package-link ( builder -- xml )
     [ packages-url ] [ last-release>> ] bi [ "/" glue ] keep link ;
@@ -40,7 +41,7 @@ IN: webapps.mason.package
     packages-url dup link ;
 
 : clean-image-url ( builder -- url )
-    [ os>> ] [ cpu>> ] bi (platform) "http://factorcode.org/images/clean/" prepend ;
+    platform "http://factorcode.org/images/clean/" prepend ;
 
 : clean-image-link ( builder -- link )
     clean-image-url dup link ;
@@ -65,6 +66,7 @@ IN: webapps.mason.package
                 [ current-status "status" set-value ]
                 [ last-build-status "last-build" set-value ]
                 [ clean-build-status "last-clean-build" set-value ]
+                [ current-timestamp>> "current-timestamp" set-value ]
                 [ packages-link "binaries" set-value ]
                 [ clean-image-link "clean-images" set-value ]
                 [ report-link "last-report" set-value ]
index a7c0f711546ee55482f2298535838547dc7a3fdc..98fa42b68c2dc96c3206c4b6f3e5ac1c528cdf60 100644 (file)
@@ -6,8 +6,7 @@ webapps.mason.utils io.pathnames ;
 IN: webapps.mason.release
 
 : release-link ( builder -- xml )
-    [ "http://downloads.factorcode.org/" ] dip
-    last-release>> [ "/" glue ] [ file-name ] bi link ;
+    last-release>> [ download-url ] [ file-name ] bi link ;
 
 : <download-release-action> ( -- action )
     <page-action>
diff --git a/extra/webapps/mason/status-update/authors.txt b/extra/webapps/mason/status-update/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/webapps/mason/status-update/status-update.factor b/extra/webapps/mason/status-update/status-update.factor
new file mode 100644 (file)
index 0000000..5156b1e
--- /dev/null
@@ -0,0 +1,74 @@
+! Copyright (C) 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors calendar combinators db.tuples furnace.actions
+furnace.redirection html.forms http.server.responses io kernel
+mason.config mason.server namespaces validators ;
+IN: webapps.mason.status-update
+
+: find-builder ( -- builder )
+    builder new
+        "host-name" value >>host-name
+        "target-os" value >>os
+        "target-cpu" value >>cpu
+    dup select-tuple [ ] [ dup insert-tuple ] ?if ;
+
+: git-id ( builder id -- ) >>current-git-id +starting+ >>status drop ;
+
+: make-vm ( builder -- ) +make-vm+ >>status drop ;
+
+: boot ( builder -- ) +boot+ >>status drop ;
+
+: test ( builder -- ) +test+ >>status drop ;
+
+: report ( builder status content -- )
+    [ >>status ] [ >>last-report ] bi*
+    dup status>> +clean+ = [
+        dup current-git-id>> >>clean-git-id
+        dup current-timestamp>> >>clean-timestamp
+    ] when
+    dup current-git-id>> >>last-git-id
+    dup current-timestamp>> >>last-timestamp
+    drop ;
+
+: release ( builder name -- )
+    >>last-release
+    dup clean-git-id>> >>release-git-id
+    drop ;
+
+: update-builder ( builder -- )
+    "message" value {
+        { "heartbeat" [ drop ] }
+        { "git-id" [ "arg" value git-id ] }
+        { "make-vm" [ make-vm ] }
+        { "boot" [ boot ] }
+        { "test" [ test ] }
+        { "report" [ "arg" value "report" value report ] }
+        { "release" [ "arg" value release ] }
+    } case ;
+
+: <status-update-action> ( -- action )
+    <action>
+    [
+        {
+            { "host-name" [ v-one-line ] }
+            { "target-cpu" [ v-one-line ] }
+            { "target-os" [ v-one-line ] }
+            { "message" [ v-one-line ] }
+            { "arg" [ [ v-one-line ] v-optional ] }
+            { "report" [ ] }
+            { "secret" [ v-one-line ] }
+        } validate-params
+
+        "secret" value status-secret get = [ validation-failed ] unless
+    ] >>validate
+
+    [
+        [
+            [
+                find-builder
+                now >>current-timestamp
+                [ update-builder ] [ update-tuple ] bi
+            ] with-mason-db
+            "OK" "text/html" <content>
+        ] if-secure
+    ] >>submit ;
index 8197cce820eb0fee327525e179eb15d75b8acaf5..ad56737bc1cb91299a312ae9c19ee70446522147 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs db.tuples furnace.actions
-html.forms kernel mason.server mason.server.release sequences
+html.forms kernel mason.server mason.version.data sequences
 validators xml.syntax ;
 IN: webapps.mason.utils
 
@@ -38,3 +38,6 @@ IN: webapps.mason.utils
         ] [ drop f ] if
     ] bi
     2array sift [ [XML <li><-></li> XML] ] map [XML <ul><-></ul> XML] ;
+
+: download-url ( string -- string' )
+    "http://downloads.factorcode.org/" prepend ;
index 9866c8819a656352f55bcac8fbdf86e542370e74..b202a19a0a3df7c3e063037d9f09bddcfeda2cc1 100644 (file)
                        <tr><th class="field-label">Author: </th><td><t:field t:name="author" /></td></tr>
                        <tr><th class="field-label">Mode: </th><td><t:choice t:name="mode" t:choices="modes" /></td></tr>
                        <tr><th class="field-label big-field-label">Body: </th><td><t:textarea t:name="contents" t:rows="20" t:cols="60" /></td></tr>
-                       <tr><th class="field-label">Captcha: </th><td><t:field t:name="captcha" /></td></tr>
-                       <tr>
-                       <td></td>
-                       <td>Leave the captcha blank. Spam-bots will fill it indiscriminantly, so their attempts to register will be blocked.</td>
-                       </tr>
+                       <tr><td colspan="2"><t:recaptcha /></td></tr>
                </table>
 
                <p> <button type="submit">Submit</button> </p>
index 6e1cb53664df5227c8a01b6ea070ad7354f07396..d88e66450cf26af3348d9c0359265f70efdd3ef4 100644 (file)
                                <tr><th class="field-label">Author: </th><td><t:field t:name="author" /></td></tr>
                                <tr><th class="field-label">Mode: </th><td><t:choice t:name="mode" t:choices="modes" /></td></tr>
                                <tr><th class="field-label big-field-label">Body: </th><td><t:textarea t:name="contents" t:rows="20" t:cols="60" /></td></tr>
-                               <tr><th class="field-label">Captcha: </th><td><t:field t:name="captcha" /></td></tr>
-                               <tr>
-                               <td></td>
-                               <td>Leave the captcha blank. Spam-bots will fill it indiscriminantly, so their attempts to register will be blocked.</td>
-                               </tr>
+                               <tr><td colspan="2"><t:recaptcha /></td></tr>
                        </table>
 
                        <p> <button type="submit">Done</button> </p>
index 48e6ed030bc452f5da3f953d1bf4ab4808e96f53..fccf47d468394d38d64310495bc43a18882d6cde 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2007, 2008 Slava Pestov
+! Copyright (C) 2007, 2010 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
 USING: namespaces assocs sorting sequences kernel accessors
 hashtables db.types db.tuples db combinators
@@ -17,7 +17,9 @@ furnace.redirection
 furnace.auth
 furnace.auth.login
 furnace.boilerplate
-furnace.syndication ;
+furnace.recaptcha
+furnace.syndication
+furnace.conversations ;
 IN: webapps.pastebin
 
 TUPLE: pastebin < dispatcher ;
@@ -156,8 +158,8 @@ M: annotation entity-url
         { "author" [ v-one-line ] }
         { "mode" [ v-mode ] }
         { "contents" [ v-required ] }
-        { "captcha" [ v-captcha ] }
-    } validate-params ;
+    } validate-params
+    validate-recaptcha ;
 
 : deposit-entity-slots ( tuple -- )
     now >>date
index eb51acbe1a698e3dcaf8ce9972f5b4a335437209..a003c8b618b4768f6f3a44da2ef0b2d1427bb860 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel accessors sequences sorting math math.order
 calendar alarms logging concurrency.combinators namespaces
@@ -194,4 +194,7 @@ posting "POSTINGS"
         { planet "planet-common" } >>template ;
 
 : start-update-task ( db -- )
-    '[ _ [ update-cached-postings ] with-db ] 10 minutes every drop ;
+    '[
+        "webapps.planet"
+        [ _ [ update-cached-postings ] with-db ] with-logging
+    ] 10 minutes every drop ;
index 6bdc449dc8f459758585cb2bf0ce786725a1fb4d..bd2b897c0e9c4504c1eb3f605e3d2deafbea7cc4 100644 (file)
@@ -15,7 +15,7 @@
                                        <div class="contents">
                                                <t:bind t:name="contents">
                                                        <h2>
-                                                               <t:a t:href="$wiki/view" t:query="title">
+                                                               <t:a t:href="$wiki/view" t:rest="title">
                                                                        <t:label t:name="title" />
                                                                </t:a>
                                                        </h2>
index e6178a55c3604589045f2cc24a2415c2599b44ba..8f89b1b4aead2a17742fb565a48a2a674d11e1e9 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: cocoa cocoa.application cocoa.types cocoa.classes cocoa.windows
-core-graphics.types kernel math.bitwise ;
+core-graphics.types kernel math.bitwise literals ;
 IN: webkit-demo
 
 FRAMEWORK: /System/Library/Frameworks/WebKit.framework
@@ -13,13 +13,13 @@ IMPORT: WebView
     WebView -> alloc
     rect f f -> initWithFrame:frameName:groupName: ;
 
-: window-style ( -- n )
-    {
+CONSTANT: window-style
+    flags{
         NSClosableWindowMask
         NSMiniaturizableWindowMask
         NSResizableWindowMask
         NSTitledWindowMask
-    } flags ;
+    }
 
 : <WebWindow> ( -- id )
     <WebView> rect window-style <ViewWindow> ;
index 92a4942fe65563ff79476e20a288895dc71d353c..efa4c4b6354530f1e540532a292535e58777d2ed 100644 (file)
@@ -19,6 +19,7 @@ furnace.auth.features.registration
 furnace.auth.features.deactivate-user
 furnace.boilerplate
 furnace.redirection
+furnace.recaptcha
 webapps.pastebin
 webapps.planet
 webapps.wiki
@@ -54,6 +55,12 @@ TUPLE: factor-website < dispatcher ;
         allow-edit-profile
         allow-deactivation ;
 
+: <factor-recaptcha> ( responder -- responder' )
+    <recaptcha>
+        "concatenative.org" >>domain
+        "6LeJWQgAAAAAAFlYV7SuBClE9uSpGtV_ZS-qVON7" >>public-key
+        "6LeJWQgAAAAAALh-XJgSSQ6xKygRgJ8-029Ip2Xv" >>private-key ;
+
 : <factor-website> ( -- responder )
     factor-website new-dispatcher
         URL" /wiki/view/Front Page" <redirect-responder> "" add-responder ;
@@ -77,7 +84,7 @@ SYMBOL: dh-file
     <factor-website>
         <wiki> <login-config> <factor-boilerplate> "wiki" add-responder
         <user-admin> <login-config> <factor-boilerplate> "user-admin" add-responder
-        <pastebin> <login-config> <factor-boilerplate> "pastebin" add-responder
+        <pastebin> <factor-recaptcha> <login-config> <factor-boilerplate> "pastebin" add-responder
         <planet> <login-config> <factor-boilerplate> "planet" add-responder
         <mason-app> <login-config> "mason" add-responder
         "/tmp/docs/" <help-webapp> "docs" add-responder
@@ -96,7 +103,7 @@ SYMBOL: dh-file
             <wiki> "wiki" add-responder
             <user-admin> "user-admin" add-responder
         <login-config> <factor-boilerplate> test-db <alloy> "concatenative.org" add-responder
-        <pastebin> <login-config> <factor-boilerplate> test-db <alloy> "paste.factorcode.org" add-responder
+        <pastebin> <factor-recaptcha> <login-config> <factor-boilerplate> test-db <alloy> "paste.factorcode.org" add-responder
         <planet> <login-config> <factor-boilerplate> test-db <alloy> "planet.factorcode.org" add-responder
         <mason-app> <login-config> test-db <alloy> "builds.factorcode.org" add-responder
         home "docs" append-path <help-webapp> "docs.factorcode.org" add-responder
index 8115627742ad9f7be7f778d7d66e2cd733e15336..dc0c57b7d5ca6417bce4d7a0432813a70af96fe7 100644 (file)
@@ -9,7 +9,7 @@ body, button {
        border: none;
 }
 
-a, .link {
+a:link, a:visited, .link {
        color: #222;
        border-bottom:1px dotted #666;
        text-decoration:none;
diff --git a/extra/z-algorithm/authors.txt b/extra/z-algorithm/authors.txt
new file mode 100644 (file)
index 0000000..e1702c7
--- /dev/null
@@ -0,0 +1 @@
+Dmitry Shubin
diff --git a/extra/z-algorithm/summary.txt b/extra/z-algorithm/summary.txt
new file mode 100644 (file)
index 0000000..c7fadf9
--- /dev/null
@@ -0,0 +1 @@
+Z algorithm for pattern preprocessing
diff --git a/extra/z-algorithm/tags.txt b/extra/z-algorithm/tags.txt
new file mode 100644 (file)
index 0000000..49b4f23
--- /dev/null
@@ -0,0 +1 @@
+algorithms
diff --git a/extra/z-algorithm/z-algorithm-docs.factor b/extra/z-algorithm/z-algorithm-docs.factor
new file mode 100644 (file)
index 0000000..395dd49
--- /dev/null
@@ -0,0 +1,49 @@
+! Copyright (C) 2010 Dmitry Shubin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays help.markup help.syntax sequences ;
+IN: z-algorithm
+
+HELP: lcp
+{ $values
+  { "seq1" sequence } { "seq2" sequence }
+  { "n" "a non-negative integer" }
+}
+{ $description
+  "Outputs the length of longest common prefix of two sequences."
+} ;
+
+HELP: z-values
+{ $values
+  { "seq" sequence } { "Z" array }
+}
+{ $description
+  "Outputs an array of the same length as " { $snippet "seq" }
+  ", containing Z-values for given sequence. See "
+  { $link "z-algorithm" } " for details."
+} ;
+
+ARTICLE: "z-algorithm" "Z algorithm"
+{ $heading "Definition" }
+"Given the sequence " { $snippet "S" } " and the index "
+{ $snippet "i" } ", let " { $snippet "i" } "-th Z value of "
+{ $snippet "S" } " be the length of the longest subsequence of "
+{ $snippet "S" } " that starts at " { $snippet "i" }
+" and matches the prefix of " { $snippet "S" } "."
+
+{ $heading "Example" }
+"Here is an example for string " { $snippet "\"abababaca\"" } ":"
+{ $table
+  { { $snippet "i:" } "0" "1" "2" "3" "4" "5" "6" "7" "8" }
+  { { $snippet "S:" } "a" "b" "a" "b" "a" "b" "a" "c" "a" }
+  { { $snippet "Z:" } "9" "0" "5" "0" "3" "0" "1" "0" "1" }
+}
+
+{ $heading "Summary" }
+"The " { $vocab-link "z-algorithm" }
+" vocabulary implements algorithm for finding all Z values for sequence "
+{ $snippet "S" }
+" in linear time. In contrast to naive approach which takes "
+{ $snippet "Θ(n^2)" } " time."
+;
+
+ABOUT: "z-algorithm"
diff --git a/extra/z-algorithm/z-algorithm-tests.factor b/extra/z-algorithm/z-algorithm-tests.factor
new file mode 100644 (file)
index 0000000..8a8fd97
--- /dev/null
@@ -0,0 +1,13 @@
+! Copyright (C) 2010 Dmitry Shubin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: tools.test z-algorithm ;
+IN: z-algorithm.tests
+
+[ 0 ] [ "qwerty" "" lcp ] unit-test
+[ 0 ] [ "qwerty" "asdf" lcp ] unit-test
+[ 3 ] [ "qwerty" "qwe" lcp ] unit-test
+[ 3 ] [ "qwerty" "qwet" lcp ] unit-test
+
+[ { } ] [ "" z-values ] unit-test
+[ { 1 } ] [ "q" z-values ] unit-test
+[ { 9 0 5 0 3 0 1 0 1 } ] [ "abababaca" z-values ] unit-test
diff --git a/extra/z-algorithm/z-algorithm.factor b/extra/z-algorithm/z-algorithm.factor
new file mode 100644 (file)
index 0000000..bd31275
--- /dev/null
@@ -0,0 +1,38 @@
+! Copyright (C) 2010 Dmitry Shubin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays combinators.smart kernel locals math math.ranges
+sequences sequences.private ;
+IN: z-algorithm
+
+: lcp ( seq1 seq2 -- n )
+    [ min-length ] 2keep mismatch [ nip ] when* ;
+
+<PRIVATE
+
+:: out-of-zbox ( seq Z l r k -- seq Z l r )
+    seq k tail-slice seq lcp :> Zk
+    Zk Z push seq Z
+    Zk 0 > [ k Zk k + 1 - ] [ l r ] if ; inline
+
+:: inside-zbox ( seq Z l r k -- seq Z l r )
+    k l - Z nth :> Zk'
+    r k - 1 +   :> b
+    seq Z Zk' b <
+    [ Zk' Z push l r ] ! still inside
+    [
+        seq r 1 + seq b [ tail-slice ] 2bi@ lcp :> q
+        q b + Z push k q r +
+    ] if ; inline
+
+: (z-value) ( seq Z l r k -- seq Z l r )
+    2dup < [ out-of-zbox ] [ inside-zbox ] if ; inline
+
+:: (z-values) ( seq -- Z )
+    V{ } clone 0 0 seq length :> ( Z l r len )
+    len Z push [ seq Z l r 1 len [a,b) [ (z-value) ] each ]
+    drop-outputs Z ; inline
+
+PRIVATE>
+
+: z-values ( seq -- Z )
+    dup length 0 > [ (z-values) ] when >array ;
index 983e1bcb98fff95635a780977e25fb622b187667..8d3990fcd8efddbfbe02ee98aee82235f327a84b 100644 (file)
     (,fuel-syntax--type-definition-regex 2 'factor-font-lock-type-name)
     (,fuel-syntax--method-definition-regex (1 'factor-font-lock-type-name)
                                            (2 'factor-font-lock-word))
+    (,fuel-syntax--before-definition-regex (1 'factor-font-lock-type-name)
+                                           (2 'factor-font-lock-word))
+    (,fuel-syntax--after-definition-regex  (1 'factor-font-lock-type-name)
+                                           (2 'factor-font-lock-word))
     (,fuel-syntax--tuple-decl-regex 2 'factor-font-lock-type-name)
     (,fuel-syntax--constructor-regex . 'factor-font-lock-constructor)
     (,fuel-syntax--setter-regex . 'factor-font-lock-setter-word)
index 6f42b4efc423880aec89563848e4e926e1f780e2..98aad10e22f57a7af9360c17b10fa5f769833a54 100644 (file)
@@ -174,8 +174,11 @@ interacting with a factor listener is at your disposal.
   (setq fuel-stack-mode-string "/S")
   (when fuel-mode-stack-p (fuel-stack-mode fuel-mode))
 
-  (when (and fuel-mode (not (file-exists-p (buffer-file-name))))
-    (fuel-scaffold--maybe-insert)))
+  (let ((file-name (buffer-file-name)))
+    (when (and fuel-mode
+               file-name
+               (not (file-exists-p file-name)))
+      (fuel-scaffold--maybe-insert))))
 
 \f
 ;;; Keys:
index dc2a09713d847c4f60d6bfc5406e0d8b96b1eaca..0078300fd1908f5907b75c74a8f28a8a27629c56 100644 (file)
@@ -96,6 +96,10 @@ IN: %s
   (let ((cmd `(:fuel* (,vocab ,summary fuel-scaffold-summary) "fuel")))
     (fuel-eval--send/wait cmd)))
 
+(defsubst fuel-scaffold--create-platforms (vocab platforms)
+  (let ((cmd `(:fuel* (,vocab ,platforms fuel-scaffold-platforms) "fuel")))
+    (fuel-eval--send/wait cmd)))
+
 (defun fuel-scaffold--help (parent)
   (when (and parent (fuel-scaffold--check-auto fuel-scaffold-help-autoinsert-p))
     (let* ((ret (fuel-scaffold--create-docs (fuel-scaffold--vocab parent)))
@@ -131,6 +135,7 @@ You can configure `fuel-scaffold-developer-name' (set by default to
                                 nil t (or root-hint "resource:")))
          (summary (read-string "Vocab summary (empty for none): "))
          (tags (read-string "Vocab tags (empty for none): "))
+         (platforms (read-string "Vocab platforms (empty for all): "))
          (help (y-or-n-p "Scaffold help? "))
          (tests (y-or-n-p "Scaffold tests? "))
          (cmd `(:fuel* ((,root ,name ,fuel-scaffold-developer-name)
@@ -143,6 +148,8 @@ You can configure `fuel-scaffold-developer-name' (set by default to
       (fuel-scaffold--create-summary name summary))
     (when (not (equal "" tags))
       (fuel-scaffold--create-tags name tags))
+    (when (not (equal "" platforms))
+      (fuel-scaffold--create-platforms name platforms))
     (when help
          (fuel-scaffold--create-docs name))
     (when tests
@@ -221,6 +228,18 @@ You can configure `fuel-scaffold-developer-name' (set by default to
           (error "Error creating summary file" (car (fuel-eval--retort-error ret))))
         (find-file file)))
 
+(defun fuel-scaffold-platforms (&optional arg)
+  "Creates, if it does not already exist, a platforms file for the current vocabulary."
+  (interactive "P")
+  (let* ((vocab (or (and (not arg ) (fuel-syntax--current-vocab))
+                    (fuel-completion--read-vocab nil)))
+         (platforms (read-string "Platforms: "))
+         (ret (fuel-scaffold--create-platforms vocab platforms))
+         (file (fuel-eval--retort-result ret)))
+        (unless file
+          (error "Error creating platforms file" (car (fuel-eval--retort-error ret))))
+        (find-file file)))
+
 \f
 (provide 'fuel-scaffold)
 ;;; fuel-scaffold.el ends here
index 7de627f8f5e9e22c542e159d391aef7049a497b9..80010235b1c1c6dcffd826ff3e1eb4ca97f75ad7 100644 (file)
@@ -1,3 +1,4 @@
+\r
 ;;; fuel-syntax.el --- auxiliar definitions for factor code navigation.\r
 \r
 ;; Copyright (C) 2008, 2009  Jose Antonio Ortega Ruiz\r
@@ -44,9 +45,9 @@
 \r
 (defconst fuel-syntax--parsing-words\r
   '(":" "::" ";" "&:" "<<" "<PRIVATE" ">>"\r
-    "ABOUT:" "ALIAS:" "ALIEN:" "ARTICLE:"\r
-    "B" "BIN:"\r
-    "C:" "CALLBACK:" "C-ENUM:" "C-STRUCT:" "C-TYPE:" "C-UNION:" "CHAR:" "CONSTANT:" "call-next-method"\r
+    "ABOUT:" "AFTER:" "ALIAS:" "ALIEN:" "ARTICLE:"\r
+    "B" "BEFORE:" "BIN:"\r
+    "C:" "CALLBACK:" "ENUM:" "C-TYPE:" "CHAR:" "COM-INTERFACE:" "CONSTANT:" "CONSULT:" "call-next-method"\r
     "DEFER:"\r
     "EBNF:" ";EBNF" "ERROR:" "EXCLUDE:"\r
     "f" "FORGET:" "FROM:" "FUNCTION:"\r
     "LIBRARY:"\r
     "M:" "M::" "MACRO:" "MACRO::" "MAIN:" "MATH:"\r
     "MEMO:" "MEMO:" "METHOD:" "MIXIN:"\r
+    "NAN:"\r
     "OCT:"\r
-    "POSTPONE:" "PREDICATE:" "PRIMITIVE:" "PRIVATE>" "PROVIDE:"\r
+    "POSTPONE:" "PREDICATE:" "PRIMITIVE:" "PRIVATE>" "PROTOCOL:" "PROVIDE:"\r
     "QUALIFIED-WITH:" "QUALIFIED:"\r
     "read-only" "RENAME:" "REQUIRE:"  "REQUIRES:"\r
     "SINGLETON:" "SINGLETONS:" "SLOT:" "SPECIALIZED-ARRAY:" "SPECIALIZED-ARRAYS:" "STRING:" "STRUCT:" "SYMBOL:" "SYMBOLS:" "SYNTAX:"\r
     "TUPLE:" "t" "t?" "TYPEDEF:" "TYPED:" "TYPED::"\r
     "UNIFORM-TUPLE:" "UNION:" "UNION-STRUCT:" "USE:" "USING:"\r
-    "VARS:" "VERTEX-FORMAT:"))\r
+    "VARIANT:" "VERTEX-FORMAT:"))\r
 \r
 (defconst fuel-syntax--parsing-words-regex\r
   (regexp-opt fuel-syntax--parsing-words 'words))\r
 (defconst fuel-syntax--method-definition-regex\r
   "^M::? +\\([^ ]+\\) +\\([^ ]+\\)")\r
 \r
+(defconst fuel-syntax--before-definition-regex\r
+  "^BEFORE: +\\([^ ]+\\) +\\([^ ]+\\)")\r
+\r
+(defconst fuel-syntax--after-definition-regex\r
+  "^AFTER: +\\([^ ]+\\) +\\([^ ]+\\)")\r
+\r
 (defconst fuel-syntax--integer-regex\r
   "\\_<-?[0-9]+\\_>")\r
 \r
 (defconst fuel-syntax--raw-float-regex\r
-  "[0-9]*\\.[0-9]*\\([eE][+-]?[0-9]+\\)?")\r
+  "[0-9]*\\.[0-9]*\\([eEpP][+-]?[0-9]+\\)?")\r
 \r
 (defconst fuel-syntax--float-regex\r
   (format "\\_<-?%s\\_>" fuel-syntax--raw-float-regex))\r
   (format "\\_<\\(%s\\)?: +\\_<\\(\\w+\\)\\_>"\r
           (regexp-opt\r
            '(":" "GENERIC" "DEFER" "HOOK" "MAIN" "MATH" "POSTPONE"\r
-             "SYMBOL" "SYNTAX" "TYPED" "RENAME"))))\r
+             "SYMBOL" "SYNTAX" "TYPED" "TYPED:" "RENAME"))))\r
 \r
 (defconst fuel-syntax--alias-definition-regex\r
   "^ALIAS: +\\(\\_<.+?\\_>\\) +\\(\\_<.+?\\_>\\)")\r
    '("IN:" "USE:" "FROM:" "EXCLUDE:" "QUALIFIED:" "QUALIFIED-WITH:")))\r
 \r
 (defconst fuel-syntax--int-constant-def-regex\r
-  (fuel-syntax--second-word-regex '("ALIEN:" "CHAR:" "BIN:" "HEX:" "OCT:")))\r
+  (fuel-syntax--second-word-regex '("ALIEN:" "CHAR:" "BIN:" "HEX:" "NAN:" "OCT:")))\r
 \r
 (defconst fuel-syntax--type-definition-regex\r
   (fuel-syntax--second-word-regex\r
-   '("C-STRUCT:" "C-UNION:" "MIXIN:" "TUPLE:" "SINGLETON:" "SPECIALIZED-ARRAY:" "STRUCT:" "UNION:" "UNION-STRUCT:")))\r
+   '("C-STRUCT:" "C-UNION:" "COM-INTERFACE:" "MIXIN:" "TUPLE:" "SINGLETON:" "SPECIALIZED-ARRAY:" "STRUCT:" "UNION:" "UNION-STRUCT:")))\r
 \r
 (defconst fuel-syntax--tuple-decl-regex\r
   "^TUPLE: +\\([^ \n]+\\) +< +\\([^ \n]+\\)\\_>")\r
   "\\_<CALLBACK: \\(\\w+\\) \\(\\w+\\)")\r
 \r
 (defconst fuel-syntax--indent-def-starts '("" ":"\r
-                                           "C-ENUM" "C-STRUCT" "C-UNION"\r
+                                           "AFTER" "BEFORE"\r
+                                           "ENUM" "COM-INTERFACE" "CONSULT"\r
                                            "FROM" "FUNCTION:"\r
                                            "INTERSECTION:"\r
                                            "M" "M:" "MACRO" "MACRO:"\r
                                            "MEMO" "MEMO:" "METHOD"\r
                                            "SYNTAX"\r
-                                           "PREDICATE" "PRIMITIVE"\r
-                                           "STRUCT" "TAG" "TUPLE"\r
+                                           "PREDICATE" "PRIMITIVE" "PROTOCOL"\r
+                                           "SINGLETONS"\r
+                                           "STRUCT" "SYMBOLS" "TAG" "TUPLE"\r
                                            "TYPED" "TYPED:"\r
                                            "UNIFORM-TUPLE"\r
                                            "UNION-STRUCT" "UNION"\r
-                                           "VERTEX-FORMAT"))\r
+                                           "VARIANT" "VERTEX-FORMAT"))\r
 \r
 (defconst fuel-syntax--no-indent-def-starts '("ARTICLE"\r
                                               "HELP"\r
-                                              "SINGLETONS"\r
-                                              "SPECIALIZED-ARRAYS"\r
-                                              "SYMBOLS"\r
-                                              "VARS"))\r
+                                              "SPECIALIZED-ARRAYS"))\r
 \r
 (defconst fuel-syntax--indent-def-start-regex\r
   (format "^\\(%s:\\)\\( \\|\n\\)" (regexp-opt fuel-syntax--indent-def-starts)))\r
                 "IN:" "INSTANCE:"\r
                 "LIBRARY:"\r
                 "MAIN:" "MATH:" "MIXIN:"\r
+                "NAN:"\r
                 "OCT:"\r
                 "POSTPONE:" "PRIVATE>" "<PRIVATE"\r
                 "QUALIFIED-WITH:" "QUALIFIED:"\r
     ("\\_<\\(U\\)SING: \\(;\\)" (1 "<b") (2 ">b"))\r
     ("\\_<USING:\\( \\)" (1 "<b"))\r
     ("\\_<\\(C\\)-ENUM: \\(;\\)" (1 "<b") (2 ">b"))\r
-    ("\\_<C-ENUM:\\( \\|\n\\)" (1 "<b"))\r
+    ("\\_<ENUM:\\( \\|\n\\)" (1 "<b"))\r
     ("\\_<TUPLE: +\\w+? +< +\\w+? *\\( \\|\n\\)\\([^;]\\|$\\)" (1 "<b"))\r
     ("\\_<TUPLE: +\\w+? *\\( \\|\n\\)\\([^;<\n]\\|\\_>\\)" (1 "<b"))\r
-    ("\\_<\\(SYMBOLS\\|VARS\\|SPECIALIZED-ARRAYS\\|SINGLETONS\\): *?\\( \\|\n\\)\\([^;\n]\\|\\_>\\)"\r
+    ("\\_<\\(SYMBOLS\\|SPECIALIZED-ARRAYS\\|SINGLETONS\\|VARIANT\\): *?\\( \\|\n\\)\\([^;\n]\\|\\_>\\)"\r
      (2 "<b"))\r
     ("\\(\n\\| \\);\\_>" (1 ">b"))\r
     ;; Let and lambda:\r
index ee69d954eafe13c785eb949914ce1887440cf762..6428bead751fdc9383f89409b9d041d95ceb2374 100644 (file)
@@ -76,7 +76,7 @@ PRIVATE>
 
 : compile-c-library ( -- )
     compile-library? [ compile-library ] when
-    c-library get dup library-path "cdecl" add-library ;
+    c-library get dup library-path cdecl add-library ;
 
 : define-c-function ( function types effect body -- )
     [
diff --git a/unmaintained/closures/closures.factor b/unmaintained/closures/closures.factor
new file mode 100644 (file)
index 0000000..faa8ec0
--- /dev/null
@@ -0,0 +1,13 @@
+USING: assocs io.pathnames fry namespaces namespaces.private kernel sequences parser hashtables ;
+IN: closures
+SYMBOL: |
+
+! Selective Binding
+: delayed-bind-with ( vars quot -- quot' ) '[ _ dup [ get ] map zip >hashtable [ _ bind ] curry ] ;
+SYNTAX: C[ | parse-until parse-quotation delayed-bind-with append! ;
+! Common ones
+SYNTAX: DIR[ parse-quotation { current-directory } swap delayed-bind-with append! ;
+
+! Namespace Binding
+: bind-to-namespace ( quot -- quot' ) '[ namespace [ _ bind ] curry ] ;
+SYNTAX: NS[ parse-quotation bind-to-namespace append! ;
index 38e6817f6c6862be1fb200c3893c3a5b5ca036f1..e2b13e8cb1e3f81e431b2412a82de97379c18b50 100644 (file)
@@ -13,9 +13,9 @@ USING: alien kernel system combinators alien.syntax ;
 IN: cryptlib.libcl
 
 << "libcl" {
-        { [ win32? ] [ "cl32.dll" "stdcall" ] }
-        { [ macosx? ] [ "libcl.dylib" "cdecl" ] }
-        { [ unix? ] [ "libcl.so" "cdecl" ] }
+        { [ win32? ] [ "cl32.dll" stdcall ] }
+        { [ macosx? ] [ "libcl.dylib" cdecl ] }
+        { [ unix? ] [ "libcl.so" cdecl ] }
     } cond add-library >>
 
 ! ===============================================
@@ -878,13 +878,11 @@ TYPEDEF: int CRYPT_KEYID_TYPE
 ! Internal keyset options
 ! (As _NONE but open for exclusive access, _CRYPT_DEFINED
 ! Last possible key option type, _CRYPT_DEFINED Last external keyset option)
-C-ENUM:
-    CRYPT_KEYOPT_NONE
-    CRYPT_KEYOPT_READONLY
-    CRYPT_KEYOPT_CREATE
-    CRYPT_IKEYOPT_EXCLUSIVEACCESS
-    CRYPT_KEYOPT_LAST
-;
+CONSTANT: CRYPT_KEYOPT_NONE 0
+CONSTANT: CRYPT_KEYOPT_READONLY 1
+CONSTANT: CRYPT_KEYOPT_CREATE 2
+CONSTANT: CRYPT_IKEYOPT_EXCLUSIVEACCESS 3
+CONSTANT: CRYPT_KEYOPT_LAST 4
 
 : CRYPT_KEYOPT_LAST_EXTERNAL   3 ; inline ! = CRYPT_KEYOPT_CREATE + 1
 
index c047393c99978165815f361667639f7a55c89ba8..98fd0b38cb403674a2fa63f68f251cb72f70504f 100644 (file)
@@ -6,9 +6,9 @@ USING: alien alien.syntax combinators kernel system ;
 IN: db.mysql.ffi
 
 << "mysql" {
-    { [ os winnt? ] [ "libmySQL.dll" "stdcall" ] }
-    { [ os macosx? ] [ "libmysqlclient.14.dylib" "cdecl" ] }
-    { [ os unix? ] [ "libmysqlclient.so.14" "cdecl" ] }
+    { [ os winnt? ] [ "libmySQL.dll" stdcall ] }
+    { [ os macosx? ] [ "libmysqlclient.14.dylib" cdecl ] }
+    { [ os unix? ] [ "libmysqlclient.so.14" cdecl ] }
 } cond add-library >>
 
 LIBRARY: mysql
diff --git a/unmaintained/fries/authors.txt b/unmaintained/fries/authors.txt
new file mode 100644 (file)
index 0000000..ce0899f
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
\ No newline at end of file
diff --git a/unmaintained/fries/fries.factor b/unmaintained/fries/fries.factor
new file mode 100644 (file)
index 0000000..3f970a8
--- /dev/null
@@ -0,0 +1,17 @@
+USING: arrays vectors combinators effects kernel math sequences splitting
+strings.parser parser fry sequences.extras ;
+
+! a b c glue => acb
+! c b a [ append ] dip prepend
+
+IN: fries
+: str-fry ( str on -- quot ) split
+    [ unclip-last [ [ [ append ] [ prepend ] bi* ] reduce-r ] 2curry ]
+    [ length 1 - 1 <effect> [ call-effect ] 2curry ] bi ;
+: gen-fry ( str on -- quot ) split
+    [ unclip-last [ [ [ 1array ] [ append ] [ prepend ] tri* ] reduce-r ] 2curry ]
+    [ length 1 - 1 <effect> [ call-effect ] 2curry ] bi ;
+
+SYNTAX: i" parse-string rest "_" str-fry append! ;
+SYNTAX: i{ \ } parse-until >array { _ } gen-fry append! ;
+SYNTAX: iV{ \ } parse-until >vector V{ _ } gen-fry append! ;
diff --git a/unmaintained/fries/summary.txt b/unmaintained/fries/summary.txt
new file mode 100644 (file)
index 0000000..44e9456
--- /dev/null
@@ -0,0 +1 @@
+Generalized Frying
\ No newline at end of file
index 49bc57b108033f0d8e0cfc6485b011e41cc00850..d809d899de82e7d58dd0f8d6b853747089ca8a5a 100644 (file)
@@ -296,61 +296,61 @@ FUNCTION: jint JNI_CreateJavaVM ( void** pvm, void** penv, void* args ) ;
   ] when ;
 
 : (destroy-java-vm) 
-  "int" { "void*" } "cdecl" alien-indirect ;
+  "int" { "void*" } cdecl alien-indirect ;
 
 : (attach-current-thread) 
-  "int" { "void*" "void*" "void*" } "cdecl" alien-indirect ;
+  "int" { "void*" "void*" "void*" } cdecl alien-indirect ;
 
 : (detach-current-thread) 
-  "int" { "void*" } "cdecl" alien-indirect ;
+  "int" { "void*" } cdecl alien-indirect ;
 
 : (get-env) 
-  "int" { "void*" "void*" "int" } "cdecl" alien-indirect ;
+  "int" { "void*" "void*" "int" } cdecl alien-indirect ;
 
 : (attach-current-thread-as-daemon) 
-  "int" { "void*" "void*" "void*" } "cdecl" alien-indirect ;
+  "int" { "void*" "void*" "void*" } cdecl alien-indirect ;
 
 : destroy-java-vm ( javavm -- int )
   dup JavaVM-functions JNIInvokeInterface-DestroyJavaVM (destroy-java-vm) ;
 
 : (get-version) 
-  "jint" { "JNIEnv*" } "cdecl" alien-indirect ;
+  "jint" { "JNIEnv*" } cdecl alien-indirect ;
 
 : get-version ( jnienv -- int )
   dup JNIEnv-functions JNINativeInterface-GetVersion (get-version) ;
   
 : (find-class) 
-  "void*" { "JNINativeInterface*" "char*" } "cdecl" alien-indirect ;
+  "void*" { "JNINativeInterface*" "char*" } cdecl alien-indirect ;
 
 : find-class ( name jnienv -- int )
   dup swapd JNIEnv-functions JNINativeInterface-FindClass (find-class) ;
 
 : (get-static-field-id) 
-  "void*" { "JNINativeInterface*" "void*" "char*" "char*" } "cdecl" alien-indirect ;
+  "void*" { "JNINativeInterface*" "void*" "char*" "char*" } cdecl alien-indirect ;
 
 : get-static-field-id ( class name sig jnienv -- int )
   dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-GetStaticFieldID (get-static-field-id) ;
 
 : (get-static-object-field) 
-  "void*" { "JNINativeInterface*" "void*" "void*" } "cdecl" alien-indirect ;
+  "void*" { "JNINativeInterface*" "void*" "void*" } cdecl alien-indirect ;
 
 : get-static-object-field ( class id jnienv -- int )
   dup >r >r 2array r> swap first2 r> JNIEnv-functions JNINativeInterface-GetStaticObjectField (get-static-object-field) ;
 
 : (get-method-id) 
-  "void*" { "JNINativeInterface*" "void*" "char*" "char*" } "cdecl" alien-indirect ;
+  "void*" { "JNINativeInterface*" "void*" "char*" "char*" } cdecl alien-indirect ;
 
 : get-method-id ( class name sig jnienv -- int )
   dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-GetMethodID (get-method-id) ;
 
 : (new-string) 
-  "void*" { "JNINativeInterface*" "char*" "int" } "cdecl" alien-indirect ;
+  "void*" { "JNINativeInterface*" "char*" "int" } cdecl alien-indirect ;
 
 : new-string ( str jnienv -- str )
   dup >r >r dup length 2array r> swap first2 r> JNIEnv-functions JNINativeInterface-NewString (new-string) ;
 
 : (call1) 
-  "void" { "JNINativeInterface*" "void*" "void*" "int" } "cdecl" alien-indirect ;
+  "void" { "JNINativeInterface*" "void*" "void*" "int" } cdecl alien-indirect ;
 
 : call1 ( obj method-id jstr jnienv -- )
   dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-CallObjectMethod (call1) ;
index 6db68840712a579f7a7f5d94978f7410288e44c6..9b7dd36a699345b7f53e49c115bbfe9e534e8d5b 100644 (file)
@@ -10,9 +10,9 @@ USING: alien alien.syntax combinators kernel system ;
 IN: ldap.libldap
 
 << "libldap" {
-    { [ win32? ]  [ "libldap.dll" "stdcall" ] }
-    { [ macosx? ] [ "libldap.dylib" "cdecl" ] }
-    { [ unix? ]   [ "libldap.so" "cdecl" ] }
+    { [ win32? ]  [ "libldap.dll" stdcall ] }
+    { [ macosx? ] [ "libldap.dylib" cdecl ] }
+    { [ unix? ]   [ "libldap.so" cdecl ] }
 } cond add-library >>
  
 : LDAP_VERSION1     1 ; inline
index 9877c700626d53e4945da172855eb3bebf0a28b7..093a110fba130a27d654ffb3e63583bae6c7edf8 100644 (file)
@@ -52,7 +52,7 @@ SYMBOL: def-hash-keys
         [ t ] [ f ]
         [ { } ]
         [ drop f ]
-        [ "cdecl" ]
+        [ cdecl ]
         [ first ] [ second ] [ third ] [ fourth ]
         [ ">" write ] [ "/>" write ]
     } ;
index 06d47b8937542bf6c4da3facc7e3081b355b2ce7..6dcddb5bd53f426c7c351ed37b8934c4c23e1ed4 100644 (file)
@@ -5,7 +5,7 @@ combinators alien.c-types strings sequences namespaces make
 words math threads io.encodings.ascii ;
 IN: odbc
 
-<< "odbc" "odbc32.dll" "stdcall" add-library >>
+<< "odbc" "odbc32.dll" stdcall add-library >>
 
 LIBRARY: odbc
 
index aa04aef39fb894848b9b32f951c1be8a95bf1275..4e8ebfc860b88548e6b4210dcf11f8cb786dfddf 100644 (file)
@@ -12,9 +12,9 @@ USING: alien alien.syntax combinators kernel system ;
 IN: oracle.liboci
 
 "oci" {
-    { [ os winnt? ] [ "oci.dll" "stdcall" ] }
-    { [ os macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" "cdecl" ] }
-    { [ os unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" "cdecl" ] }
+    { [ os winnt? ] [ "oci.dll" stdcall ] }
+    { [ os macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" cdecl ] }
+    { [ os unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" cdecl ] }
 } cond add-library
 
 ! ===============================================
index a40b7cddeed165c3c81d51c7bb0f44a3fd5be0b8..49e02d4f8fb5cdf097de355db697b0b6302f09ac 100644 (file)
@@ -10,9 +10,9 @@ USING: alien alien.syntax combinators system ;
 IN: pdf.libhpdf
 
 << "libhpdf" {
-    { [ win32? ] [ "libhpdf.dll" "stdcall" ] }
-    { [ macosx? ] [ "libhpdf.dylib" "cdecl" ] }
-    { [ unix? ] [ "$LD_LIBRARY_PATH/libhpdf.so" "cdecl" ] }
+    { [ win32? ] [ "libhpdf.dll" stdcall ] }
+    { [ macosx? ] [ "libhpdf.dylib" cdecl ] }
+    { [ unix? ] [ "$LD_LIBRARY_PATH/libhpdf.so" cdecl ] }
 } cond add-library >>
 
 ! compression mode
@@ -24,13 +24,11 @@ IN: pdf.libhpdf
 : HPDF_COMP_MASK      HEX: FF ; inline
 
 ! page mode
-C-ENUM:
-    HPDF_PAGE_MODE_USE_NONE
-    HPDF_PAGE_MODE_USE_OUTLINE
-    HPDF_PAGE_MODE_USE_THUMBS
-    HPDF_PAGE_MODE_FULL_SCREEN
-    HPDF_PAGE_MODE_EOF
-;
+CONSTANT: HPDF_PAGE_MODE_USE_NONE 0
+CONSTANT: HPDF_PAGE_MODE_USE_OUTLINE 1
+CONSTANT: HPDF_PAGE_MODE_USE_THUMBS 2
+CONSTANT: HPDF_PAGE_MODE_FULL_SCREEN 3
+CONSTANT: HPDF_PAGE_MODE_EOF 4
 
 : error-code ( -- seq ) {
      { HEX: 1001  "HPDF_ARRAY_COUNT_ERR\nInternal error. The consistency of the data was lost." }
diff --git a/unmaintained/set-n/set-n.factor b/unmaintained/set-n/set-n.factor
new file mode 100644 (file)
index 0000000..0807b76
--- /dev/null
@@ -0,0 +1,9 @@
+USING: accessors assocs fry generalizations kernel locals math
+namespaces parser sequences shuffle words effects.parser ;
+IN: set-n
+: get* ( var n -- val ) namestack dup length rot - head assoc-stack ;
+
+: set* ( val var n -- ) 1 + namestack [ length swap - ] keep nth set-at ;
+
+! dynamic lambda
+SYNTAX: :| (:) dup in>> dup length [ spin '[ _ narray _ swap zip _ bind ] ] 2curry dip define-declared ;
index a0dbe228e530a99041057c188da9c5d536041e85..4dc56cfaedc4d19999722dd8644f45e897d88ccb 100644 (file)
@@ -1,4 +1,4 @@
 include vm/Config.unix
-PLAF_DLL_OBJS += vm/os-genunix.o vm/os-freebsd.o
+PLAF_DLL_OBJS += vm/os-genunix.o vm/os-freebsd.o vm/mvm-unix.o
 CFLAGS += -export-dynamic
 LIBS = -L/usr/local/lib/ -lm -lrt $(X11_UI_LIBS)
index 4a859b1216ec1c404a5ee04bd182146669000432..00ff73522a1391610d0a74856b3a4e23e46985d7 100644 (file)
@@ -1,4 +1,4 @@
 include vm/Config.unix
-PLAF_DLL_OBJS += vm/os-genunix.o vm/os-linux.o
+PLAF_DLL_OBJS += vm/os-genunix.o vm/os-linux.o vm/mvm-unix.o
 CFLAGS += -export-dynamic
 LIBS = -ldl -lm -lrt -lpthread $(X11_UI_LIBS)
index 89fe239668bd53f2c1af3b78ff49c05d14cbbcc7..5b9de7f5cf8fb5a45f372df1390b8c5530d9e9fc 100644 (file)
@@ -1,7 +1,7 @@
 include vm/Config.unix
 CFLAGS += -fPIC
 
-PLAF_DLL_OBJS += vm/os-macosx.o vm/mach_signal.o
+PLAF_DLL_OBJS += vm/os-macosx.o vm/mach_signal.o vm/mvm-unix.o
 
 DLL_EXTENSION = .dylib
 SHARED_DLL_EXTENSION = .dylib
index 72a4056c90b4e44c96b9bc66f09a4681f81c7b97..2838f9d4c57d7392341f286485fec48eb7d8cf69 100644 (file)
@@ -1,5 +1,5 @@
 include vm/Config.unix
-PLAF_DLL_OBJS += vm/os-genunix.o vm/os-netbsd.o
+PLAF_DLL_OBJS += vm/os-genunix.o vm/os-netbsd.o vm/mvm-none.o
 CFLAGS += -export-dynamic
 LIBPATH = -L/usr/X11R7/lib -Wl,-rpath,/usr/X11R7/lib -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
 LIBS = -lm -lrt -lssl -lcrypto $(X11_UI_LIBS)
index c7d2672e6b326209ee1e11ab4ab8e275e206e8ae..6983223b747260e62f1e8235ab5a136ffaa8a280 100644 (file)
@@ -1,5 +1,5 @@
 include vm/Config.unix
-PLAF_DLL_OBJS += vm/os-genunix.o vm/os-openbsd.o
+PLAF_DLL_OBJS += vm/os-genunix.o vm/os-openbsd.o vm/mvm-unix.o
 CC = egcc
 CPP = eg++
 CFLAGS += -export-dynamic -fno-inline-functions
index ffaa899fe1e35cd875d0e7a46ef7f88207de8d57..322649dc0663925a536516a9cab569d8725d9737 100644 (file)
@@ -1,7 +1,7 @@
 LIBS = -lm
 EXE_SUFFIX=
 DLL_SUFFIX=
-PLAF_DLL_OBJS += vm/os-windows-nt.o
+PLAF_DLL_OBJS += vm/os-windows-nt.o vm/mvm-windows-nt.o
 PLAF_EXE_OBJS += vm/resources.o
 PLAF_EXE_OBJS += vm/main-windows-nt.o
 CFLAGS += -mwindows
index d27629fe8358552f93499239c2f1cb63a70aca9b..73bf064ce54042bf08adcfa3506c4fdc557727c7 100644 (file)
@@ -1,3 +1,4 @@
+PLAF_DLL_OBJS += vm/os-windows-nt-x86.32.o
 DLL_PATH=http://factorcode.org/dlls
 WINDRES=windres
 include vm/Config.windows.nt
index ddb61480e5cf8c340bf8a1708b0cda2fa259d5a4..495a3ccac9ac49925dde97c13c13132955445463 100644 (file)
@@ -1,3 +1,4 @@
+PLAF_DLL_OBJS += vm/os-windows-nt-x86.64.o
 DLL_PATH=http://factorcode.org/dlls/64
 CC=$(WIN64_PATH)-gcc.exe
 WINDRES=$(WIN64_PATH)-windres.exe
index 38078b66790ebf0c7d704d72989d8cc557ea4185..1fa86389a12b7c6ab7f8064378b19a63f3f82bca 100755 (executable)
@@ -13,7 +13,7 @@ char *factor_vm::pinned_alien_offset(cell obj)
                {
                        alien *ptr = untag<alien>(obj);
                        if(to_boolean(ptr->expired))
-                               general_error(ERROR_EXPIRED,obj,false_object,NULL);
+                               general_error(ERROR_EXPIRED,obj,false_object);
                        if(to_boolean(ptr->base))
                                type_error(ALIEN_TYPE,obj);
                        else
@@ -35,8 +35,8 @@ VM_C_API char *pinned_alien_offset(cell obj, factor_vm *parent)
 /* make an alien */
 cell factor_vm::allot_alien(cell delegate_, cell displacement)
 {
-       if(delegate_ == false_object && displacement == 0)
-               return false_object;
+       if(displacement == 0)
+               return delegate_;
 
        data_root<object> delegate(delegate_,this);
        data_root<alien> new_alien(allot<alien>(sizeof(alien)),this);
@@ -104,28 +104,16 @@ void *factor_vm::alien_pointer()
 #define DEFINE_ALIEN_ACCESSOR(name,type,from,to) \
        VM_C_API void primitive_alien_##name(factor_vm *parent) \
        { \
-               parent->ctx->push(from(*(type*)(parent->alien_pointer()),parent)); \
+               parent->ctx->push(parent->from(*(type*)(parent->alien_pointer()))); \
        } \
        VM_C_API void primitive_set_alien_##name(factor_vm *parent) \
        { \
                type *ptr = (type *)parent->alien_pointer(); \
-               type value = (type)to(parent->ctx->pop(),parent); \
+               type value = (type)parent->to(parent->ctx->pop()); \
                *ptr = value; \
        }
 
-DEFINE_ALIEN_ACCESSOR(signed_cell,fixnum,from_signed_cell,to_fixnum)
-DEFINE_ALIEN_ACCESSOR(unsigned_cell,cell,from_unsigned_cell,to_cell)
-DEFINE_ALIEN_ACCESSOR(signed_8,s64,from_signed_8,to_signed_8)
-DEFINE_ALIEN_ACCESSOR(unsigned_8,u64,from_unsigned_8,to_unsigned_8)
-DEFINE_ALIEN_ACCESSOR(signed_4,s32,from_signed_4,to_fixnum)
-DEFINE_ALIEN_ACCESSOR(unsigned_4,u32,from_unsigned_4,to_cell)
-DEFINE_ALIEN_ACCESSOR(signed_2,s16,from_signed_2,to_fixnum)
-DEFINE_ALIEN_ACCESSOR(unsigned_2,u16,from_unsigned_2,to_cell)
-DEFINE_ALIEN_ACCESSOR(signed_1,s8,from_signed_1,to_fixnum)
-DEFINE_ALIEN_ACCESSOR(unsigned_1,u8,from_unsigned_1,to_cell)
-DEFINE_ALIEN_ACCESSOR(float,float,from_float,to_float)
-DEFINE_ALIEN_ACCESSOR(double,double,from_double,to_double)
-DEFINE_ALIEN_ACCESSOR(cell,void *,allot_alien,pinned_alien_offset)
+EACH_ALIEN_PRIMITIVE(DEFINE_ALIEN_ACCESSOR)
 
 /* open a native library and push a handle */
 void factor_vm::primitive_dlopen()
@@ -199,58 +187,4 @@ VM_C_API char *alien_offset(cell obj, factor_vm *parent)
        return parent->alien_offset(obj);
 }
 
-/* For FFI calls passing structs by value. Cannot allocate */
-void factor_vm::to_value_struct(cell src, void *dest, cell size)
-{
-       memcpy(dest,alien_offset(src),size);
-}
-
-VM_C_API void to_value_struct(cell src, void *dest, cell size, factor_vm *parent)
-{
-       return parent->to_value_struct(src,dest,size);
-}
-
-/* For FFI callbacks receiving structs by value */
-cell factor_vm::from_value_struct(void *src, cell size)
-{
-       byte_array *bytes = allot_byte_array(size);
-       memcpy(bytes->data<void>(),src,size);
-       return tag<byte_array>(bytes);
-}
-
-VM_C_API cell from_value_struct(void *src, cell size, factor_vm *parent)
-{
-       return parent->from_value_struct(src,size);
-}
-
-/* On some x86 OSes, structs <= 8 bytes are returned in registers. */
-cell factor_vm::from_small_struct(cell x, cell y, cell size)
-{
-       cell data[2];
-       data[0] = x;
-       data[1] = y;
-       return from_value_struct(data,size);
-}
-
-VM_C_API cell from_small_struct(cell x, cell y, cell size, factor_vm *parent)
-{
-       return parent->from_small_struct(x,y,size);
-}
-
-/* On OS X/PPC, complex numbers are returned in registers. */
-cell factor_vm::from_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size)
-{
-       cell data[4];
-       data[0] = x1;
-       data[1] = x2;
-       data[2] = x3;
-       data[3] = x4;
-       return from_value_struct(data,size);
-}
-
-VM_C_API cell from_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size, factor_vm *parent)
-{
-       return parent->from_medium_struct(x1, x2, x3, x4, size);
-}
-
 }
index add6f4ba728ebd1e86946ba787f83403c8cbad6a..cd0120db6f010784116c8c5f6530f84c2080456c 100755 (executable)
@@ -4,9 +4,5 @@ namespace factor
 VM_C_API char *alien_offset(cell object, factor_vm *vm);
 VM_C_API char *pinned_alien_offset(cell object, factor_vm *vm);
 VM_C_API cell allot_alien(void *address, factor_vm *vm);
-VM_C_API void to_value_struct(cell src, void *dest, cell size, factor_vm *vm);
-VM_C_API cell from_value_struct(void *src, cell size, factor_vm *vm);
-VM_C_API cell from_small_struct(cell x, cell y, cell size, factor_vm *vm);
-VM_C_API cell from_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size, factor_vm *vm);
 
 }
index c3d47d45f37c3549a7209ac0df6bb2cf44de5fad..47896340cd8ce45dfaa686d5b9a1f4eeadb2e0b4 100755 (executable)
@@ -330,7 +330,7 @@ bignum *factor_vm::bignum_remainder(bignum * numerator, bignum * denominator)
 }
 
 /* allocates memory */
-#define FOO_TO_BIGNUM(name,type,utype)                                 \
+#define FOO_TO_BIGNUM(name,type,stype,utype)                           \
 bignum * factor_vm::name##_to_bignum(type n)                           \
 {                                                                      \
        int negative_p;                                                 \
@@ -341,7 +341,7 @@ bignum * factor_vm::name##_to_bignum(type n)                                \
        if (n == 1) return (BIGNUM_ONE (0));                            \
        if (n < (type)0 && n == (type)-1) return (BIGNUM_ONE (1));      \
        {                                                               \
-               utype accumulator = ((negative_p = (n < (type)0)) ? (-n) : n); \
+               utype accumulator = ((negative_p = (n < (type)0)) ? ((type)(-(stype)n)) : n); \
                do                                                      \
                {                                                       \
                        (*end_digits++) = (accumulator & BIGNUM_DIGIT_MASK); \
@@ -360,13 +360,13 @@ bignum * factor_vm::name##_to_bignum(type n)                              \
        }                                                               \
 }
 
-FOO_TO_BIGNUM(cell,cell,cell)
-FOO_TO_BIGNUM(fixnum,fixnum,cell)
-FOO_TO_BIGNUM(long_long,s64,u64)
-FOO_TO_BIGNUM(ulong_long,u64,u64)
+FOO_TO_BIGNUM(cell,cell,fixnum,cell)
+FOO_TO_BIGNUM(fixnum,fixnum,fixnum,cell)
+FOO_TO_BIGNUM(long_long,s64,s64,u64)
+FOO_TO_BIGNUM(ulong_long,u64,s64,u64)
 
 /* cannot allocate memory */
-#define BIGNUM_TO_FOO(name,type,utype)                                 \
+#define BIGNUM_TO_FOO(name,type,stype,utype)                           \
        type factor_vm::bignum_to_##name(bignum * bignum)               \
        {                                                               \
                if (BIGNUM_ZERO_P (bignum))                             \
@@ -377,14 +377,14 @@ FOO_TO_BIGNUM(ulong_long,u64,u64)
                        bignum_digit_type * scan = (start + (BIGNUM_LENGTH (bignum))); \
                        while (start < scan)                            \
                                accumulator = ((accumulator << BIGNUM_DIGIT_LENGTH) + (*--scan)); \
-                       return ((BIGNUM_NEGATIVE_P (bignum)) ? (-((type)accumulator)) : accumulator); \
+                       return ((BIGNUM_NEGATIVE_P (bignum)) ? ((type)(-(stype)accumulator)) : accumulator); \
                }                                                       \
        }
 
-BIGNUM_TO_FOO(cell,cell,cell);
-BIGNUM_TO_FOO(fixnum,fixnum,cell);
-BIGNUM_TO_FOO(long_long,s64,u64)
-BIGNUM_TO_FOO(ulong_long,u64,u64)
+BIGNUM_TO_FOO(cell,cell,fixnum,cell);
+BIGNUM_TO_FOO(fixnum,fixnum,fixnum,cell);
+BIGNUM_TO_FOO(long_long,s64,s64,u64)
+BIGNUM_TO_FOO(ulong_long,u64,s64,u64)
 
 double factor_vm::bignum_to_double(bignum * bignum)
 {
index dedb385f3d474279a6e08d59f6cd9e97605359c8..86b2a7dc6cb372c84783a6e487f6f59801b31040 100644 (file)
@@ -3,14 +3,4 @@
 namespace factor
 {
 
-VM_C_API bool to_boolean(cell value, factor_vm *parent)
-{
-       return to_boolean(value);
-}
-
-VM_C_API cell from_boolean(bool value, factor_vm *parent)
-{
-       return parent->tag_boolean(value);
-}
-
 }
index a11103c5c6f7f8053aad5612fd8dd962d0debb40..55fea6c1933122354a2baf6acf9d18b99db2a308 100644 (file)
@@ -1,9 +1,6 @@
 namespace factor
 {
 
-VM_C_API bool to_boolean(cell value, factor_vm *vm);
-VM_C_API cell from_boolean(bool value, factor_vm *vm);
-
 /* Cannot allocate */
 inline static bool to_boolean(cell value)
 {
index 1986b5d35cea9333491ee228316a1dc74579bcea..d59563d81c448d82b434819fc8f52808c5d0c385 100644 (file)
@@ -10,6 +10,11 @@ byte_array *factor_vm::allot_byte_array(cell size)
        return array;
 }
 
+VM_C_API cell allot_byte_array(cell size, factor_vm *parent)
+{
+       return tag<byte_array>(parent->allot_byte_array(size));
+}
+
 void factor_vm::primitive_byte_array()
 {
        cell size = unbox_array_size();
index a96baff6ec33d64a2b796c3be4e880d4d5745f1c..2da036709f6cf46e8c21a65ffddb28f7d3852378 100755 (executable)
@@ -20,4 +20,6 @@ template<typename Type> byte_array *factor_vm::byte_array_from_value(Type *value
        return data;
 }
 
+VM_C_API cell allot_byte_array(cell size, factor_vm *parent);
+
 }
old mode 100644 (file)
new mode 100755 (executable)
index 416c139..38479a3
@@ -19,7 +19,25 @@ void factor_vm::init_callbacks(cell size)
        callbacks = new callback_heap(size,this);
 }
 
-void callback_heap::store_callback_operand(code_block *stub, cell index, cell value)
+bool callback_heap::setup_seh_p()
+{
+#if defined(WINDOWS) && defined(FACTOR_X86)
+       return true;
+#else
+       return false;
+#endif
+}
+
+bool callback_heap::return_takes_param_p()
+{
+#if defined(FACTOR_X86) || defined(FACTOR_AMD64)
+       return true;
+#else
+       return false;
+#endif
+}
+
+instruction_operand callback_heap::callback_operand(code_block *stub, cell index)
 {
        tagged<array> code_template(parent->special_objects[CALLBACK_STUB]);
 
@@ -33,12 +51,23 @@ void callback_heap::store_callback_operand(code_block *stub, cell index, cell va
                offset);
 
        instruction_operand op(rel,stub,0);
-       op.store_value(value);
+
+       return op;
+}
+
+void callback_heap::store_callback_operand(code_block *stub, cell index)
+{
+       parent->store_external_address(callback_operand(stub,index));
+}
+
+void callback_heap::store_callback_operand(code_block *stub, cell index, cell value)
+{
+       callback_operand(stub,index).store_value(value);
 }
 
 void callback_heap::update(code_block *stub)
 {
-       store_callback_operand(stub,1,(cell)callback_entry_point(stub));
+       store_callback_operand(stub,setup_seh_p() ? 2 : 1,(cell)callback_entry_point(stub));
        stub->flush_icache();
 }
 
@@ -65,11 +94,23 @@ code_block *callback_heap::add(cell owner, cell return_rewind)
        /* Store VM pointer */
        store_callback_operand(stub,0,(cell)parent);
 
+       cell index;
+
+       if(setup_seh_p())
+       {
+               store_callback_operand(stub,1);
+               index = 1;
+       }
+       else
+               index = 0;
+
+       /* Store VM pointer */
+       store_callback_operand(stub,index + 2,(cell)parent);
+
        /* On x86, the RET instruction takes an argument which depends on
        the callback's calling convention */
-#if defined(FACTOR_X86) || defined(FACTOR_AMD64)
-       store_callback_operand(stub,2,return_rewind);
-#endif
+       if(return_takes_param_p())
+               store_callback_operand(stub,index + 3,return_rewind);
 
        update(stub);
 
index 607984ad233c9136c927bdf2c084136c394433e2..a0ab3d6bf965b2ea77527dcdc9781105d89294d3 100644 (file)
@@ -38,6 +38,10 @@ struct callback_heap {
                return w->entry_point;
        }
 
+       bool setup_seh_p();
+       bool return_takes_param_p();
+       instruction_operand callback_operand(code_block *stub, cell index);
+       void store_callback_operand(code_block *stub, cell index);
        void store_callback_operand(code_block *stub, cell index, cell value);
 
        void update(code_block *stub);
index 195b212d8b3899b1b741a39e19c7a20af58ca9ad..bb716cbc6dd3ad7bb9465eb588b07329a74843ca 100755 (executable)
@@ -13,16 +13,22 @@ void factor_vm::check_frame(stack_frame *frame)
 
 callstack *factor_vm::allot_callstack(cell size)
 {
-       callstack *stack = allot<callstack>(callstack_size(size));
+       callstack *stack = allot<callstack>(callstack_object_size(size));
        stack->length = tag_fixnum(size);
        return stack;
 }
 
-stack_frame *factor_vm::fix_callstack_top(stack_frame *top, stack_frame *bottom)
+/* If 'stack' points into the middle of the frame, find the nearest valid stack
+pointer where we can resume execution and hope to capture the call trace without
+crashing. Also, make sure we have at least 'stack_reserved' bytes available so
+that we don't run out of callstack space while handling the error. */
+stack_frame *factor_vm::fix_callstack_top(stack_frame *stack)
 {
-       stack_frame *frame = bottom - 1;
+       stack_frame *frame = ctx->callstack_bottom - 1;
 
-       while(frame >= top)
+       while(frame >= stack
+               && frame >= ctx->callstack_top
+               && (cell)frame >= ctx->callstack_seg->start + stack_reserved)
                frame = frame_successor(frame);
 
        return frame + 1;
@@ -36,7 +42,7 @@ This means that if 'callstack' is called in tail position, we
 will have popped a necessary frame... however this word is only
 called by continuation implementation, and user code shouldn't
 be calling it at all, so we leave it as it is for now. */
-stack_frame *factor_vm::second_from_top_stack_frame()
+stack_frame *factor_vm::second_from_top_stack_frame(context *ctx)
 {
        stack_frame *frame = ctx->callstack_bottom - 1;
        while(frame >= ctx->callstack_top
@@ -48,16 +54,27 @@ stack_frame *factor_vm::second_from_top_stack_frame()
        return frame + 1;
 }
 
-void factor_vm::primitive_callstack()
+cell factor_vm::capture_callstack(context *ctx)
 {
-       stack_frame *top = second_from_top_stack_frame();
+       stack_frame *top = second_from_top_stack_frame(ctx);
        stack_frame *bottom = ctx->callstack_bottom;
 
        fixnum size = std::max((fixnum)0,(fixnum)bottom - (fixnum)top);
 
        callstack *stack = allot_callstack(size);
        memcpy(stack->top(),top,size);
-       ctx->push(tag<callstack>(stack));
+       return tag<callstack>(stack);
+}
+
+void factor_vm::primitive_callstack()
+{
+       ctx->push(capture_callstack(ctx));
+}
+
+void factor_vm::primitive_callstack_for()
+{
+       context *other_ctx = (context *)pinned_alien_offset(ctx->pop());
+       ctx->push(capture_callstack(other_ctx));
 }
 
 code_block *factor_vm::frame_code(stack_frame *frame)
@@ -105,7 +122,7 @@ cell factor_vm::frame_scan(stack_frame *frame)
                        if(obj.type_p(QUOTATION_TYPE))
                        {
                                char *return_addr = (char *)FRAME_RETURN_ADDRESS(frame,this);
-                               char *quot_entry_point = (char *)(frame_code(frame) + 1);
+                               char *quot_entry_point = (char *)frame_code(frame)->entry_point();
 
                                return tag_fixnum(quot_code_offset_to_scan(
                                        obj.value(),(cell)(return_addr - quot_entry_point)));
@@ -197,4 +214,10 @@ void factor_vm::primitive_set_innermost_stack_frame_quot()
        FRAME_RETURN_ADDRESS(inner,this) = (char *)quot->entry_point + offset;
 }
 
+void factor_vm::primitive_callstack_bounds()
+{
+       ctx->push(allot_alien((void*)ctx->callstack_seg->start));
+       ctx->push(allot_alien((void*)ctx->callstack_seg->end));
+}
+
 }
index 9f8867447cc1686dea09a2331c20017c825eeccc..9f0693eb7648036ee0d9ecf03cb1af650ef293a2 100755 (executable)
@@ -1,7 +1,7 @@
 namespace factor
 {
 
-inline static cell callstack_size(cell size)
+inline static cell callstack_object_size(cell size)
 {
        return sizeof(callstack) + size;
 }
index ac5d140783f45d62691a1bba121607b6a065c90b..deaa41e4b8ef7b282ffdae7b1cabefab41c1fcaa 100644 (file)
@@ -114,7 +114,7 @@ template<typename Visitor>
 void code_block_visitor<Visitor>::visit_context_code_blocks()
 {
        call_frame_code_block_visitor<Visitor> call_frame_visitor(parent,visitor);
-       parent->iterate_active_frames(call_frame_visitor);
+       parent->iterate_active_callstacks(call_frame_visitor);
 }
 
 template<typename Visitor>
index e002b26afcfeee0e40bf1f41128e48dbf30cd9a2..e8c6216d8d958cdbc40f002396c5cec799347409 100755 (executable)
@@ -144,12 +144,12 @@ void factor_vm::update_word_references(code_block *compiled, bool reset_inline_c
 image load */
 void factor_vm::undefined_symbol()
 {
-       general_error(ERROR_UNDEFINED_SYMBOL,false_object,false_object,NULL);
+       general_error(ERROR_UNDEFINED_SYMBOL,false_object,false_object);
 }
 
 void undefined_symbol()
 {
-       return tls_vm()->undefined_symbol();
+       return current_vm()->undefined_symbol();
 }
 
 /* Look up an external library symbol referenced by a compiled code block */
@@ -225,8 +225,13 @@ void factor_vm::store_external_address(instruction_operand op)
        case RT_DECKS_OFFSET:
                op.store_value(decks_offset);
                break;
+#ifdef WINDOWS
+       case RT_EXCEPTION_HANDLER:
+               op.store_value((cell)&factor::exception_handler);
+               break;
+#endif
        default:
-               critical_error("Bad rel type",op.rel_type());
+               critical_error("Bad rel type in store_external_address()",op.rel_type());
                break;
        }
 }
index 40fe00b0e9ff6a2ac906ac6ef606887998db6796..96d95416655ccb4af9251b28890fc46b637b9fcc 100755 (executable)
@@ -7,8 +7,14 @@ code_heap::code_heap(cell size)
 {
        if(size > ((u64)1 << (sizeof(cell) * 8 - 6))) fatal_error("Heap too large",size);
        seg = new segment(align_page(size),true);
-       if(!seg) fatal_error("Out of memory in heap allocator",size);
-       allocator = new free_list_allocator<code_block>(size,seg->start);
+       if(!seg) fatal_error("Out of memory in code_heap constructor",size);
+
+       cell start = seg->start + seh_area_size;
+
+       allocator = new free_list_allocator<code_block>(seg->end - start,start);
+
+       /* See os-windows-nt-x86.64.cpp for seh_area usage */
+       seh_area = (char *)seg->start;
 }
 
 code_heap::~code_heap()
index 78ffa6c76a19cd06926c002f8031daca7aba8337..20ce03c8357a83648c483dc993ef8000eb6f3917 100755 (executable)
@@ -1,10 +1,19 @@
 namespace factor
 {
 
+#if defined(WINDOWS) && defined(FACTOR_64)
+       const cell seh_area_size = 1024;
+#else
+       const cell seh_area_size = 0;
+#endif
+
 struct code_heap {
        /* The actual memory area */
        segment *seg;
 
+       /* Memory area reserved for SEH. Only used on Windows */
+       char *seh_area;
+
        /* Memory allocator */
        free_list_allocator<code_block> *allocator;
 
index ece4926c281464e7ae1ad66b368ef9ba2d12b14a..0b8b473e8b3704fd10c5487e1e09c6c551bdfba9 100644 (file)
@@ -1,6 +1,8 @@
 namespace factor
 {
 
+struct must_start_gc_again {};
+
 template<typename TargetGeneration, typename Policy> struct data_workhorse {
        factor_vm *parent;
        TargetGeneration *target;
@@ -27,8 +29,7 @@ template<typename TargetGeneration, typename Policy> struct data_workhorse {
        {
                cell size = untagged->size();
                object *newpointer = target->allot(size);
-               /* XXX not exception-safe */
-               if(!newpointer) longjmp(parent->current_gc->gc_unwind,1);
+               if(!newpointer) throw must_start_gc_again();
 
                memcpy(newpointer,untagged,size);
                untagged->forward_to(newpointer);
index 394d14e55dc2a309ab38e84f80e3fc6e8331da97..25fe0e5280cc43a82617111119e981303ec6424b 100644 (file)
 namespace factor
 {
 
-context::context(cell ds_size, cell rs_size) :
+context::context(cell datastack_size, cell retainstack_size, cell callstack_size) :
        callstack_top(NULL),
        callstack_bottom(NULL),
        datastack(0),
        retainstack(0),
-       datastack_region(new segment(ds_size,false)),
-       retainstack_region(new segment(rs_size,false)),
-       catchstack_save(0),
-       current_callback_save(0),
-       next(NULL)
+       callstack_save(0),
+       datastack_seg(new segment(datastack_size,false)),
+       retainstack_seg(new segment(retainstack_size,false)),
+       callstack_seg(new segment(callstack_size,false))
+{
+       reset();
+}
+
+void context::reset_datastack()
+{
+       datastack = datastack_seg->start - sizeof(cell);
+}
+
+void context::reset_retainstack()
+{
+       retainstack = retainstack_seg->start - sizeof(cell);
+}
+
+void context::reset_callstack()
+{
+       callstack_top = callstack_bottom = CALLSTACK_BOTTOM(this);
+}
+
+void context::reset_context_objects()
+{
+       memset_cell(context_objects,false_object,context_object_count * sizeof(cell));
+}
+
+void context::reset()
 {
        reset_datastack();
        reset_retainstack();
+       reset_callstack();
+       reset_context_objects();
+}
+
+void context::fix_stacks()
+{
+       if(datastack + sizeof(cell) < datastack_seg->start
+               || datastack + stack_reserved >= datastack_seg->end)
+               reset_datastack();
+
+       if(retainstack + sizeof(cell) < retainstack_seg->start
+               || retainstack + stack_reserved >= retainstack_seg->end)
+               reset_retainstack();
+}
+
+context::~context()
+{
+       delete datastack_seg;
+       delete retainstack_seg;
+       delete callstack_seg;
+}
+
+/* called on startup */
+void factor_vm::init_contexts(cell datastack_size_, cell retainstack_size_, cell callstack_size_)
+{
+       datastack_size = datastack_size_;
+       retainstack_size = retainstack_size_;
+       callstack_size = callstack_size_;
+
+       ctx = NULL;
+       spare_ctx = new_context();
+}
+
+void factor_vm::delete_contexts()
+{
+       assert(!ctx);
+       std::vector<context *>::const_iterator iter = unused_contexts.begin();
+       std::vector<context *>::const_iterator end = unused_contexts.end();
+       while(iter != end)
+       {
+               delete *iter;
+               iter++;
+       }
 }
 
-context *factor_vm::alloc_context()
+context *factor_vm::new_context()
 {
        context *new_context;
 
-       if(unused_contexts)
+       if(unused_contexts.empty())
        {
-               new_context = unused_contexts;
-               unused_contexts = unused_contexts->next;
+               new_context = new context(datastack_size,
+                       retainstack_size,
+                       callstack_size);
        }
        else
-               new_context = new context(ds_size,rs_size);
+       {
+               new_context = unused_contexts.back();
+               unused_contexts.pop_back();
+       }
+
+       new_context->reset();
+
+       active_contexts.insert(new_context);
+
+       return new_context;
+}
 
+void factor_vm::init_context(context *ctx)
+{
+       ctx->context_objects[OBJ_CONTEXT] = allot_alien(ctx);
+}
+
+context *new_context(factor_vm *parent)
+{
+       context *new_context = parent->new_context();
+       parent->init_context(new_context);
        return new_context;
 }
 
-void factor_vm::dealloc_context(context *old_context)
+void factor_vm::delete_context(context *old_context)
 {
-       old_context->next = unused_contexts;
-       unused_contexts = old_context;
+       unused_contexts.push_back(old_context);
+       active_contexts.erase(old_context);
 }
 
-/* called on entry into a compiled callback */
-void factor_vm::nest_stacks()
+VM_C_API void delete_context(factor_vm *parent, context *old_context)
 {
-       context *new_ctx = alloc_context();
+       parent->delete_context(old_context);
+}
 
-       new_ctx->callstack_bottom = (stack_frame *)-1;
-       new_ctx->callstack_top = (stack_frame *)-1;
+cell factor_vm::begin_callback(cell quot_)
+{
+       data_root<object> quot(quot_,this);
 
-       /* save per-callback special_objects */
-       new_ctx->current_callback_save = special_objects[OBJ_CURRENT_CALLBACK];
-       new_ctx->catchstack_save = special_objects[OBJ_CATCHSTACK];
+       ctx->reset();
+       spare_ctx = new_context();
+       callback_ids.push_back(callback_id++);
 
-       new_ctx->reset_datastack();
-       new_ctx->reset_retainstack();
+       init_context(ctx);
 
-       new_ctx->next = ctx;
-       ctx = new_ctx;
+       return quot.value();
 }
 
-void nest_stacks(factor_vm *parent)
+cell begin_callback(factor_vm *parent, cell quot)
 {
-       return parent->nest_stacks();
+       return parent->begin_callback(quot);
 }
 
-/* called when leaving a compiled callback */
-void factor_vm::unnest_stacks()
+void factor_vm::end_callback()
 {
-       /* restore per-callback special_objects */
-       special_objects[OBJ_CURRENT_CALLBACK] = ctx->current_callback_save;
-       special_objects[OBJ_CATCHSTACK] = ctx->catchstack_save;
+       callback_ids.pop_back();
+       delete_context(ctx);
+}
 
-       context *old_ctx = ctx;
-       ctx = old_ctx->next;
-       dealloc_context(old_ctx);
+void end_callback(factor_vm *parent)
+{
+       parent->end_callback();
 }
 
-void unnest_stacks(factor_vm *parent)
+void factor_vm::primitive_current_callback()
 {
-       return parent->unnest_stacks();
+       ctx->push(tag_fixnum(callback_ids.back()));
 }
 
-/* called on startup */
-void factor_vm::init_stacks(cell ds_size_, cell rs_size_)
+void factor_vm::primitive_context_object()
 {
-       ds_size = ds_size_;
-       rs_size = rs_size_;
-       ctx = NULL;
-       unused_contexts = NULL;
+       fixnum n = untag_fixnum(ctx->peek());
+       ctx->replace(ctx->context_objects[n]);
 }
 
-bool factor_vm::stack_to_array(cell bottom, cell top)
+void factor_vm::primitive_set_context_object()
+{
+       fixnum n = untag_fixnum(ctx->pop());
+       cell value = ctx->pop();
+       ctx->context_objects[n] = value;
+}
+
+void factor_vm::primitive_context_object_for()
+{
+       context *other_ctx = (context *)pinned_alien_offset(ctx->pop());
+       fixnum n = untag_fixnum(ctx->pop());
+       ctx->push(other_ctx->context_objects[n]);
+}
+
+cell factor_vm::stack_to_array(cell bottom, cell top)
 {
        fixnum depth = (fixnum)(top - bottom + sizeof(cell));
 
        if(depth < 0)
-               return false;
+               return false_object;
        else
        {
                array *a = allot_uninitialized_array<array>(depth / sizeof(cell));
                memcpy(a + 1,(void*)bottom,depth);
-               ctx->push(tag<array>(a));
-               return true;
+               return tag<array>(a);
+       }
+}
+
+cell factor_vm::datastack_to_array(context *ctx)
+{
+       cell array = stack_to_array(ctx->datastack_seg->start,ctx->datastack);
+       if(array == false_object)
+       {
+               general_error(ERROR_DATASTACK_UNDERFLOW,false_object,false_object);
+               return false_object;
        }
+       else
+               return array;
 }
 
 void factor_vm::primitive_datastack()
 {
-       if(!stack_to_array(ctx->datastack_region->start,ctx->datastack))
-               general_error(ERROR_DS_UNDERFLOW,false_object,false_object,NULL);
+       ctx->push(datastack_to_array(ctx));
+}
+
+void factor_vm::primitive_datastack_for()
+{
+       context *other_ctx = (context *)pinned_alien_offset(ctx->pop());
+       ctx->push(datastack_to_array(other_ctx));
+}
+
+cell factor_vm::retainstack_to_array(context *ctx)
+{
+       cell array = stack_to_array(ctx->retainstack_seg->start,ctx->retainstack);
+       if(array == false_object)
+       {
+               general_error(ERROR_RETAINSTACK_UNDERFLOW,false_object,false_object);
+               return false_object;
+       }
+       else
+               return array;
 }
 
 void factor_vm::primitive_retainstack()
 {
-       if(!stack_to_array(ctx->retainstack_region->start,ctx->retainstack))
-               general_error(ERROR_RS_UNDERFLOW,false_object,false_object,NULL);
+       ctx->push(retainstack_to_array(ctx));
+}
+
+void factor_vm::primitive_retainstack_for()
+{
+       context *other_ctx = (context *)pinned_alien_offset(ctx->pop());
+       ctx->push(retainstack_to_array(other_ctx));
 }
 
 /* returns pointer to top of stack */
@@ -124,14 +253,24 @@ cell factor_vm::array_to_stack(array *array, cell bottom)
        return bottom + depth - sizeof(cell);
 }
 
+void factor_vm::set_datastack(context *ctx, array *array)
+{
+       ctx->datastack = array_to_stack(array,ctx->datastack_seg->start);
+}
+
 void factor_vm::primitive_set_datastack()
 {
-       ctx->datastack = array_to_stack(untag_check<array>(ctx->pop()),ctx->datastack_region->start);
+       set_datastack(ctx,untag_check<array>(ctx->pop()));
+}
+
+void factor_vm::set_retainstack(context *ctx, array *array)
+{
+       ctx->retainstack = array_to_stack(array,ctx->retainstack_seg->start);
 }
 
 void factor_vm::primitive_set_retainstack()
 {
-       ctx->retainstack = array_to_stack(untag_check<array>(ctx->pop()),ctx->retainstack_region->start);
+       set_retainstack(ctx,untag_check<array>(ctx->pop()));
 }
 
 /* Used to implement call( */
@@ -142,12 +281,12 @@ void factor_vm::primitive_check_datastack()
        fixnum height = out - in;
        array *saved_datastack = untag_check<array>(ctx->pop());
        fixnum saved_height = array_capacity(saved_datastack);
-       fixnum current_height = (ctx->datastack - ctx->datastack_region->start + sizeof(cell)) / sizeof(cell);
+       fixnum current_height = (ctx->datastack - ctx->datastack_seg->start + sizeof(cell)) / sizeof(cell);
        if(current_height - height != saved_height)
                ctx->push(false_object);
        else
        {
-               cell *ds_bot = (cell *)ctx->datastack_region->start;
+               cell *ds_bot = (cell *)ctx->datastack_seg->start;
                for(fixnum i = 0; i < saved_height - in; i++)
                {
                        if(ds_bot[i] != array_nth(saved_datastack,i))
index 9ba9bb313cf520daa45a91160becc6ff2aaf50c8..582fab173f9bc7a0c7b3c89c161d50ba5b10fca0 100644 (file)
@@ -1,9 +1,21 @@
 namespace factor
 {
 
-/* Assembly code makes assumptions about the layout of this struct */
+static const cell context_object_count = 10;
+
+enum context_object {
+       OBJ_NAMESTACK,
+       OBJ_CATCHSTACK,
+       OBJ_CONTEXT,
+};
+
+static const cell stack_reserved = 1024;
+
 struct context {
-       /* C stack pointer on entry */
+
+       // First 4 fields accessed directly by compiler. See basis/vm/vm.factor
+
+       /* Factor callstack pointers */
        stack_frame *callstack_top;
        stack_frame *callstack_bottom;
 
@@ -13,19 +25,26 @@ struct context {
        /* current retain stack top pointer */
        cell retainstack;
 
-       /* memory region holding current datastack */
-       segment *datastack_region;
+       /* C callstack pointer */
+       cell callstack_save;
 
-       /* memory region holding current retain stack */
-       segment *retainstack_region;
+       segment *datastack_seg;
+       segment *retainstack_seg;
+       segment *callstack_seg;
 
-       /* saved special_objects slots on entry to callback */
-       cell catchstack_save;
-       cell current_callback_save;
+       /* context-specific special objects, accessed by context-object and
+       set-context-object primitives */
+       cell context_objects[context_object_count];
 
-       context *next;
+       context(cell datastack_size, cell retainstack_size, cell callstack_size);
+       ~context();
 
-       context(cell ds_size, cell rs_size);
+       void reset_datastack();
+       void reset_retainstack();
+       void reset_callstack();
+       void reset_context_objects();
+       void reset();
+       void fix_stacks();
 
        cell peek()
        {
@@ -49,32 +68,11 @@ struct context {
                datastack += sizeof(cell);
                replace(tagged);
        }
-
-       void reset_datastack()
-       {
-               datastack = datastack_region->start - sizeof(cell);
-       }
-
-       void reset_retainstack()
-       {
-               retainstack = retainstack_region->start - sizeof(cell);
-       }
-
-       static const cell stack_reserved = (64 * sizeof(cell));
-
-       void fix_stacks()
-       {
-               if(datastack + sizeof(cell) < datastack_region->start
-                       || datastack + stack_reserved >= datastack_region->end)
-                       reset_datastack();
-
-               if(retainstack + sizeof(cell) < retainstack_region->start
-                       || retainstack + stack_reserved >= retainstack_region->end)
-                       reset_retainstack();
-       }
 };
 
-VM_C_API void nest_stacks(factor_vm *vm);
-VM_C_API void unnest_stacks(factor_vm *vm);
+VM_C_API context *new_context(factor_vm *parent);
+VM_C_API void delete_context(factor_vm *parent, context *old_context);
+VM_C_API cell begin_callback(factor_vm *parent, cell quot);
+VM_C_API void end_callback(factor_vm *parent);
 
 }
index d09fc173ea5bcc1348d783ec811b825cac9df6d9..e6244e366e304475e730fc55fceb73d4b3d93f5c 100644 (file)
@@ -3,6 +3,8 @@ namespace factor
 
 #define FACTOR_CPU_STRING "ppc"
 
+#define CALLSTACK_BOTTOM(ctx) (stack_frame *)(ctx->callstack_seg->end - 32)
+
 /* In the instruction sequence:
 
    LOAD32 r3,...
old mode 100644 (file)
new mode 100755 (executable)
index ac8ac51..89d7fb7
@@ -5,6 +5,8 @@ namespace factor
 
 #define FRAME_RETURN_ADDRESS(frame,vm) *(void **)(vm->frame_successor(frame) + 1)
 
+#define CALLSTACK_BOTTOM(ctx) (stack_frame *)(ctx->callstack_seg->end - sizeof(cell) * 5)
+
 inline static void flush_icache(cell start, cell len) {}
 
 /* In the instruction sequence:
index 22ef39e8681f54d3f9f886bf1f04c5da5cc2b598..9b28215bb835d7a236b2a7837a6796b3ebb1dd97 100755 (executable)
@@ -159,7 +159,7 @@ cell object::size() const
        case WRAPPER_TYPE:
                return align(sizeof(wrapper),data_alignment);
        case CALLSTACK_TYPE:
-               return align(callstack_size(untag_fixnum(((callstack *)this)->length)),data_alignment);
+               return align(callstack_object_size(untag_fixnum(((callstack *)this)->length)),data_alignment);
        default:
                critical_error("Invalid header",(cell)this);
                return 0; /* can't happen */
index e82394951a0682315500c14b25300d48dffa1ca1..bb3a8b0ce51df052c92403b660b521340d4fdc82 100755 (executable)
@@ -6,7 +6,7 @@ namespace factor
 std::ostream &operator<<(std::ostream &out, const string *str)
 {
        for(cell i = 0; i < string_capacity(str); i++)
-               out << (char)str->nth(i);
+               out << (char)str->data()[i];
        return out;
 }
 
@@ -145,13 +145,13 @@ void factor_vm::print_objects(cell *start, cell *end)
 void factor_vm::print_datastack()
 {
        std::cout << "==== DATA STACK:\n";
-       print_objects((cell *)ctx->datastack_region->start,(cell *)ctx->datastack);
+       print_objects((cell *)ctx->datastack_seg->start,(cell *)ctx->datastack);
 }
 
 void factor_vm::print_retainstack()
 {
        std::cout << "==== RETAIN STACK:\n";
-       print_objects((cell *)ctx->retainstack_region->start,(cell *)ctx->retainstack);
+       print_objects((cell *)ctx->retainstack_seg->start,(cell *)ctx->retainstack);
 }
 
 struct stack_frame_printer {
@@ -421,9 +421,9 @@ void factor_vm::factorbug()
                else if(strcmp(cmd,"t") == 0)
                        full_output = !full_output;
                else if(strcmp(cmd,"s") == 0)
-                       dump_memory(ctx->datastack_region->start,ctx->datastack);
+                       dump_memory(ctx->datastack_seg->start,ctx->datastack);
                else if(strcmp(cmd,"r") == 0)
-                       dump_memory(ctx->retainstack_region->start,ctx->retainstack);
+                       dump_memory(ctx->retainstack_seg->start,ctx->retainstack);
                else if(strcmp(cmd,".s") == 0)
                        print_datastack();
                else if(strcmp(cmd,".r") == 0)
index b0f9159da79042bb769fd4c429b46050b92aa7cc..480da1fd035c80614e0c791eb30d2a21e1c68228 100755 (executable)
@@ -148,8 +148,8 @@ void quotation_jit::emit_mega_cache_lookup(cell methods_, fixnum index, cell cac
        data_root<array> methods(methods_,parent);
        data_root<array> cache(cache_,parent);
 
-       /* Generate machine code to determine the object's class. */
-       emit_class_lookup(index,PIC_TUPLE);
+       /* Load the object from the datastack. */
+       emit_with_literal(parent->special_objects[PIC_LOAD],tag_fixnum(-index * sizeof(cell)));
 
        /* Do a cache lookup. */
        emit_with_literal(parent->special_objects[MEGA_LOOKUP],cache.value());
index ae560012aa6f49902c5dbc123e437b4361e3b341..1867965108e04be7676cf9f5586e30bdc8bbb986 100755 (executable)
@@ -17,18 +17,20 @@ void critical_error(const char *msg, cell tagged)
        std::cout << "critical_error: " << msg;
        std::cout << ": " << std::hex << tagged << std::dec;
        std::cout << std::endl;
-       tls_vm()->factorbug();
+       current_vm()->factorbug();
 }
 
 void out_of_memory()
 {
        std::cout << "Out of memory\n\n";
-       tls_vm()->dump_generations();
+       current_vm()->dump_generations();
        exit(1);
 }
 
-void factor_vm::throw_error(cell error, stack_frame *callstack_top)
+void factor_vm::throw_error(cell error, stack_frame *stack)
 {
+       assert(stack);
+
        /* If the error handler is set, we rewind any C stack frames and
        pass the error to user-space. */
        if(!current_gc && to_boolean(special_objects[ERROR_HANDLER_QUOT]))
@@ -41,22 +43,13 @@ void factor_vm::throw_error(cell error, stack_frame *callstack_top)
                bignum_roots.clear();
                code_roots.clear();
 
-               /* If we had an underflow or overflow, stack pointers might be
-               out of bounds */
+               /* If we had an underflow or overflow, data or retain stack
+               pointers might be out of bounds */
                ctx->fix_stacks();
 
                ctx->push(error);
 
-               /* Errors thrown from C code pass NULL for this parameter.
-               Errors thrown from Factor code, or signal handlers, pass the
-               actual stack pointer at the time, since the saved pointer is
-               not necessarily up to date at that point. */
-               if(callstack_top)
-                       callstack_top = fix_callstack_top(callstack_top,ctx->callstack_bottom);
-               else
-                       callstack_top = ctx->callstack_top;
-
-               unwind_native_frames(special_objects[ERROR_HANDLER_QUOT],callstack_top);
+               unwind_native_frames(special_objects[ERROR_HANDLER_QUOT],stack);
        }
        /* Error was thrown in early startup before error handler is set, just
        crash. */
@@ -70,67 +63,61 @@ void factor_vm::throw_error(cell error, stack_frame *callstack_top)
        }
 }
 
-void factor_vm::general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *callstack_top)
+void factor_vm::general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *stack)
 {
        throw_error(allot_array_4(special_objects[OBJ_ERROR],
-               tag_fixnum(error),arg1,arg2),callstack_top);
+               tag_fixnum(error),arg1,arg2),stack);
 }
 
-void factor_vm::type_error(cell type, cell tagged)
+void factor_vm::general_error(vm_error_type error, cell arg1, cell arg2)
 {
-       general_error(ERROR_TYPE,tag_fixnum(type),tagged,NULL);
+       throw_error(allot_array_4(special_objects[OBJ_ERROR],
+               tag_fixnum(error),arg1,arg2),ctx->callstack_top);
 }
 
-void factor_vm::not_implemented_error()
+void factor_vm::type_error(cell type, cell tagged)
 {
-       general_error(ERROR_NOT_IMPLEMENTED,false_object,false_object,NULL);
+       general_error(ERROR_TYPE,tag_fixnum(type),tagged);
 }
 
-/* Test if 'fault' is in the guard page at the top or bottom (depending on
-offset being 0 or -1) of area+area_size */
-bool factor_vm::in_page(cell fault, cell area, cell area_size, int offset)
+void factor_vm::not_implemented_error()
 {
-       int pagesize = getpagesize();
-       area += area_size;
-       area += offset * pagesize;
-
-       return fault >= area && fault <= area + pagesize;
+       general_error(ERROR_NOT_IMPLEMENTED,false_object,false_object);
 }
 
-void factor_vm::memory_protection_error(cell addr, stack_frame *native_stack)
+void factor_vm::memory_protection_error(cell addr, stack_frame *stack)
 {
-       if(in_page(addr, ctx->datastack_region->start, 0, -1))
-               general_error(ERROR_DS_UNDERFLOW,false_object,false_object,native_stack);
-       else if(in_page(addr, ctx->datastack_region->start, ds_size, 0))
-               general_error(ERROR_DS_OVERFLOW,false_object,false_object,native_stack);
-       else if(in_page(addr, ctx->retainstack_region->start, 0, -1))
-               general_error(ERROR_RS_UNDERFLOW,false_object,false_object,native_stack);
-       else if(in_page(addr, ctx->retainstack_region->start, rs_size, 0))
-               general_error(ERROR_RS_OVERFLOW,false_object,false_object,native_stack);
-       else if(in_page(addr, nursery.end, 0, 0))
-               critical_error("allot_object() missed GC check",0);
+       /* Retain and call stack underflows are not supposed to happen */
+
+       if(ctx->datastack_seg->underflow_p(addr))
+               general_error(ERROR_DATASTACK_UNDERFLOW,false_object,false_object,stack);
+       else if(ctx->datastack_seg->overflow_p(addr))
+               general_error(ERROR_DATASTACK_OVERFLOW,false_object,false_object,stack);
+       else if(ctx->retainstack_seg->underflow_p(addr))
+               general_error(ERROR_RETAINSTACK_UNDERFLOW,false_object,false_object,stack);
+       else if(ctx->retainstack_seg->overflow_p(addr))
+               general_error(ERROR_RETAINSTACK_OVERFLOW,false_object,false_object,stack);
+       else if(ctx->callstack_seg->underflow_p(addr))
+               general_error(ERROR_CALLSTACK_OVERFLOW,false_object,false_object,stack);
+       else if(ctx->callstack_seg->overflow_p(addr))
+               general_error(ERROR_CALLSTACK_UNDERFLOW,false_object,false_object,stack);
        else
-               general_error(ERROR_MEMORY,allot_cell(addr),false_object,native_stack);
+               general_error(ERROR_MEMORY,allot_cell(addr),false_object,stack);
 }
 
-void factor_vm::signal_error(cell signal, stack_frame *native_stack)
+void factor_vm::signal_error(cell signal, stack_frame *stack)
 {
-       general_error(ERROR_SIGNAL,allot_cell(signal),false_object,native_stack);
+       general_error(ERROR_SIGNAL,allot_cell(signal),false_object,stack);
 }
 
 void factor_vm::divide_by_zero_error()
 {
-       general_error(ERROR_DIVIDE_BY_ZERO,false_object,false_object,NULL);
-}
-
-void factor_vm::fp_trap_error(unsigned int fpu_status, stack_frame *signal_callstack_top)
-{
-       general_error(ERROR_FP_TRAP,tag_fixnum(fpu_status),false_object,signal_callstack_top);
+       general_error(ERROR_DIVIDE_BY_ZERO,false_object,false_object);
 }
 
-void factor_vm::primitive_call_clear()
+void factor_vm::fp_trap_error(unsigned int fpu_status, stack_frame *stack)
 {
-       unwind_native_frames(ctx->pop(),ctx->callstack_bottom);
+       general_error(ERROR_FP_TRAP,tag_fixnum(fpu_status),false_object,stack);
 }
 
 /* For testing purposes */
@@ -146,7 +133,7 @@ void factor_vm::memory_signal_handler_impl()
 
 void memory_signal_handler_impl()
 {
-       tls_vm()->memory_signal_handler_impl();
+       current_vm()->memory_signal_handler_impl();
 }
 
 void factor_vm::misc_signal_handler_impl()
@@ -156,7 +143,7 @@ void factor_vm::misc_signal_handler_impl()
 
 void misc_signal_handler_impl()
 {
-       tls_vm()->misc_signal_handler_impl();
+       current_vm()->misc_signal_handler_impl();
 }
 
 void factor_vm::fp_signal_handler_impl()
@@ -166,7 +153,7 @@ void factor_vm::fp_signal_handler_impl()
 
 void fp_signal_handler_impl()
 {
-       tls_vm()->fp_signal_handler_impl();
+       current_vm()->fp_signal_handler_impl();
 }
 
 }
index 4b237e03a023c707fec6fc49cbe1e2ca3da37f68..34a23bd46dbda3b49f92dbd55072e9f355fc86cf 100755 (executable)
@@ -14,10 +14,12 @@ enum vm_error_type
        ERROR_C_STRING,
        ERROR_FFI,
        ERROR_UNDEFINED_SYMBOL,
-       ERROR_DS_UNDERFLOW,
-       ERROR_DS_OVERFLOW,
-       ERROR_RS_UNDERFLOW,
-       ERROR_RS_OVERFLOW,
+       ERROR_DATASTACK_UNDERFLOW,
+       ERROR_DATASTACK_OVERFLOW,
+       ERROR_RETAINSTACK_UNDERFLOW,
+       ERROR_RETAINSTACK_OVERFLOW,
+       ERROR_CALLSTACK_UNDERFLOW,
+       ERROR_CALLSTACK_OVERFLOW,
        ERROR_MEMORY,
        ERROR_FP_TRAP,
 };
index fb14336ae41ffd8266a7cf963ead858fc1b62e49..9c565750098393b3b7c2cabb2a757c38054dffef 100755 (executable)
@@ -3,19 +3,25 @@
 namespace factor
 {
 
-std::map<THREADHANDLE, factor_vm*> thread_vms;
-
 void init_globals()
 {
-       init_platform_globals();
+       init_mvm();
 }
 
 void factor_vm::default_parameters(vm_parameters *p)
 {
        p->image_path = NULL;
 
-       p->ds_size = 32 * sizeof(cell);
-       p->rs_size = 32 * sizeof(cell);
+       p->datastack_size = 32 * sizeof(cell);
+       p->retainstack_size = 32 * sizeof(cell);
+
+#if defined(__OpenBSD__) && defined(FACTOR_X86)
+       p->callstack_size = 64 * sizeof(cell);
+#elif defined(FACTOR_PPC)
+       p->callstack_size = 256 * sizeof(cell);
+#else
+       p->callstack_size = 128 * sizeof(cell);
+#endif
 
        p->code_size = 8 * sizeof(cell);
        p->young_size = sizeof(cell) / 4;
@@ -59,8 +65,9 @@ void factor_vm::init_parameters_from_args(vm_parameters *p, int argc, vm_char **
        {
                vm_char *arg = argv[i];
                if(STRCMP(arg,STRING_LITERAL("--")) == 0) break;
-               else if(factor_arg(arg,STRING_LITERAL("-datastack=%d"),&p->ds_size));
-               else if(factor_arg(arg,STRING_LITERAL("-retainstack=%d"),&p->rs_size));
+               else if(factor_arg(arg,STRING_LITERAL("-datastack=%d"),&p->datastack_size));
+               else if(factor_arg(arg,STRING_LITERAL("-retainstack=%d"),&p->retainstack_size));
+               else if(factor_arg(arg,STRING_LITERAL("-callstack=%d"),&p->callstack_size));
                else if(factor_arg(arg,STRING_LITERAL("-young=%d"),&p->young_size));
                else if(factor_arg(arg,STRING_LITERAL("-aging=%d"),&p->aging_size));
                else if(factor_arg(arg,STRING_LITERAL("-tenured=%d"),&p->tenured_size));
@@ -91,8 +98,9 @@ void factor_vm::prepare_boot_image()
 void factor_vm::init_factor(vm_parameters *p)
 {
        /* Kilobytes */
-       p->ds_size = align_page(p->ds_size << 10);
-       p->rs_size = align_page(p->rs_size << 10);
+       p->datastack_size = align_page(p->datastack_size << 10);
+       p->retainstack_size = align_page(p->retainstack_size << 10);
+       p->callstack_size = align_page(p->callstack_size << 10);
        p->callback_size = align_page(p->callback_size << 10);
 
        /* Megabytes */
@@ -117,11 +125,11 @@ void factor_vm::init_factor(vm_parameters *p)
 
        srand((unsigned int)system_micros());
        init_ffi();
-       init_stacks(p->ds_size,p->rs_size);
+       init_contexts(p->datastack_size,p->retainstack_size,p->callstack_size);
        init_callbacks(p->callback_size);
        load_image(p);
        init_c_io();
-       init_inline_caching(p->max_pic_size);
+       init_inline_caching((int)p->max_pic_size);
        if(p->signals)
                init_signals();
 
@@ -136,6 +144,7 @@ void factor_vm::init_factor(vm_parameters *p)
        special_objects[OBJ_EXECUTABLE] = allot_alien(false_object,(cell)p->executable_path);
        special_objects[OBJ_ARGS] = false_object;
        special_objects[OBJ_EMBEDDED] = false_object;
+       special_objects[OBJ_VM_COMPILER] = allot_alien(false_object,(cell)FACTOR_COMPILER_VERSION);
 
        /* We can GC now */
        gc_off = false;
@@ -160,16 +169,12 @@ void factor_vm::start_factor(vm_parameters *p)
 {
        if(p->fep) factorbug();
 
-       nest_stacks();
        c_to_factor_toplevel(special_objects[OBJ_STARTUP_QUOT]);
-       unnest_stacks();
 }
 
 void factor_vm::stop_factor()
 {
-       nest_stacks();
        c_to_factor_toplevel(special_objects[OBJ_SHUTDOWN_QUOT]);
-       unnest_stacks();
 }
 
 char *factor_vm::factor_eval_string(char *string)
@@ -205,11 +210,6 @@ void factor_vm::start_standalone_factor(int argc, vm_char **argv)
        start_factor(&p);
 }
 
-struct startargs {
-       int argc;
-       vm_char **argv;
-};
-
 factor_vm *new_factor_vm()
 {
        factor_vm *newvm = new factor_vm();
@@ -219,28 +219,10 @@ factor_vm *new_factor_vm()
        return newvm;
 }
 
-// arg must be new'ed because we're going to delete it!
-void *start_standalone_factor_thread(void *arg) 
-{
-       factor_vm *newvm = new_factor_vm();
-       startargs *args = (startargs*) arg;
-       int argc = args->argc; vm_char **argv = args->argv;
-       delete args;
-       newvm->start_standalone_factor(argc, argv);
-       return 0;
-}
-
 VM_C_API void start_standalone_factor(int argc, vm_char **argv)
 {
        factor_vm *newvm = new_factor_vm();
        return newvm->start_standalone_factor(argc,argv);
 }
 
-VM_C_API THREADHANDLE start_standalone_factor_in_new_thread(int argc, vm_char **argv)
-{
-       startargs *args = new startargs;
-       args->argc = argc; args->argv = argv; 
-       return start_thread(start_standalone_factor_thread,args);
-}
-
 }
index cec59bcc5c412f4c85738ba7be5add194e8a25ad..f2dd6af0bf5b62b50edfb4b81eefa71c59fdf053 100755 (executable)
@@ -2,7 +2,7 @@ namespace factor
 {
 
 VM_C_API void init_globals();
+factor_vm *new_factor_vm();
 VM_C_API void start_standalone_factor(int argc, vm_char **argv);
-VM_C_API THREADHANDLE start_standalone_factor_in_new_thread(int argc, vm_char **argv);
 
 }
index 11f7498f307445737de372a1c8cb7a45d1a69692..7d9abe2f87f3968cfde47bb0dba7e55b7507b8eb 100755 (executable)
@@ -56,7 +56,7 @@ int ffi_test_9(int a, int b, int c, int d, int e, int f, int g)
 
 int ffi_test_10(int a, int b, double c, int d, float e, int f, int g, int h)
 {
-       return a - b - c - d - e - f - g - h;
+       return (int)(a - b - c - d - e - f - g - h);
 }
 
 int ffi_test_11(int a, struct foo b, int c)
@@ -66,7 +66,7 @@ int ffi_test_11(int a, struct foo b, int c)
 
 int ffi_test_12(int a, int b, struct rect c, int d, int e, int f)
 {
-       return a + b + c.x + c.y + c.w + c.h + d + e + f;
+       return (int)(a + b + c.x + c.y + c.w + c.h + d + e + f);
 }
 
 int ffi_test_13(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k)
@@ -128,7 +128,7 @@ long long ffi_test_21(long x, long y)
 
 long ffi_test_22(long x, long long y, long long z)
 {
-       return x + y / z;
+       return (long)(x + y / z);
 }
 
 float ffi_test_23(float x[3], float y[3])
@@ -262,7 +262,7 @@ unsigned long long ffi_test_38(unsigned long long x, unsigned long long y)
 int ffi_test_39(long a, long b, struct test_struct_13 s)
 {
        assert(a == b);
-       return s.x1 + s.x2 + s.x3 + s.x4 + s.x5 + s.x6;
+       return (int)(s.x1 + s.x2 + s.x3 + s.x4 + s.x5 + s.x6);
 }
 
 struct test_struct_14 ffi_test_40(double x1, double x2)
@@ -329,3 +329,55 @@ short ffi_test_48(struct bool_field_test x)
 }
 
 #endif
+
+FACTOR_FASTCALL(int) ffi_test_49(int x)
+{
+       return x + 1;
+}
+
+FACTOR_FASTCALL(int) ffi_test_50(int x, int y)
+{
+       return x + y + 1;
+}
+
+FACTOR_FASTCALL(int) ffi_test_51(int x, int y, int z)
+{
+       return x + y + z + 1;
+}
+
+FACTOR_FASTCALL(int) ffi_test_52(int x, float y, int z)
+{
+       return (int)(x + y + z + 1);
+}
+
+FACTOR_FASTCALL(int) ffi_test_53(int x, float y, int z, int w)
+{
+       return (int)(x + y + z + w + 1);
+}
+
+FACTOR_FASTCALL(int) ffi_test_54(struct test_struct_11 x, int y)
+{
+       return x.x + x.y + y + 1;
+}
+
+FACTOR_FASTCALL(int) ffi_test_55(struct test_struct_11 x, int y, int z)
+{
+       return x.x + x.y + y + z + 1;
+}
+
+FACTOR_FASTCALL(int) ffi_test_56(struct test_struct_11 x, int y, int z, int w)
+{
+       return x.x + x.y + y + z + w + 1;
+}
+
+FACTOR_FASTCALL(struct test_struct_11) ffi_test_57(int x, int y)
+{
+       struct test_struct_11 r = { x + y, x - y };
+       return r;
+}
+
+FACTOR_FASTCALL(struct test_struct_11) ffi_test_58(int x, int y, int z)
+{
+       struct test_struct_11 r = { x + y, y - z };
+       return r;
+}
index c61c95d6df835517b1202fdce9e5290851f0e0a8..08b8f95c397adce3552c2fe55e4a7999dccd7e7c 100755 (executable)
@@ -1,9 +1,12 @@
 #if defined(_MSC_VER)
        #define FACTOR_STDCALL(return_type) return_type __stdcall
+       #define FACTOR_FASTCALL(return_type) return_type __fastcall
 #elif defined(i386) || defined(__i386) || defined(__i386__)
        #define FACTOR_STDCALL(return_type) __attribute__((stdcall)) return_type
+       #define FACTOR_FASTCALL(return_type) __attribute__((fastcall)) return_type
 #else
        #define FACTOR_STDCALL(return_type) return_type
+       #define FACTOR_FASTCALL(return_type) return_type
 #endif
 
 #if defined(__APPLE__)
@@ -119,3 +122,14 @@ struct bool_field_test {
 FACTOR_EXPORT short ffi_test_48(struct bool_field_test x);
 
 #endif
+
+FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_49(int x);
+FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_50(int x, int y);
+FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_51(int x, int y, int z);
+FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_52(int x, float y, int z);
+FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_53(int x, float y, int z, int w);
+FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_54(struct test_struct_11 x, int y);
+FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_55(struct test_struct_11 x, int y, int z);
+FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_56(struct test_struct_11 x, int y, int z, int w);
+FACTOR_EXPORT FACTOR_FASTCALL(struct test_struct_11) ffi_test_57(int x, int y);
+FACTOR_EXPORT FACTOR_FASTCALL(struct test_struct_11) ffi_test_58(int x, int y, int z);
index a57f338c4473db4c59316cff42cbe588b6cebc8a..599ed3cd31ef7bbedd2369930ce3927218793d51 100755 (executable)
--- a/vm/gc.cpp
+++ b/vm/gc.cpp
@@ -135,49 +135,57 @@ void factor_vm::gc(gc_op op, cell requested_bytes, bool trace_contexts_p)
 
        /* Keep trying to GC higher and higher generations until we don't run out
        of space */
-       if(setjmp(current_gc->gc_unwind))
+       for(;;)
        {
-               /* We come back here if a generation is full */
-               start_gc_again();
-       }
-
-       current_gc->event->op = current_gc->op;
-
-       switch(current_gc->op)
-       {
-       case collect_nursery_op:
-               collect_nursery();
-               break;
-       case collect_aging_op:
-               collect_aging();
-               if(data->high_fragmentation_p())
+               try
                {
-                       current_gc->op = collect_full_op;
-                       current_gc->event->op = collect_full_op;
-                       collect_full(trace_contexts_p);
+                       current_gc->event->op = current_gc->op;
+
+                       switch(current_gc->op)
+                       {
+                       case collect_nursery_op:
+                               collect_nursery();
+                               break;
+                       case collect_aging_op:
+                               collect_aging();
+                               if(data->high_fragmentation_p())
+                               {
+                                       current_gc->op = collect_full_op;
+                                       current_gc->event->op = collect_full_op;
+                                       collect_full(trace_contexts_p);
+                               }
+                               break;
+                       case collect_to_tenured_op:
+                               collect_to_tenured();
+                               if(data->high_fragmentation_p())
+                               {
+                                       current_gc->op = collect_full_op;
+                                       current_gc->event->op = collect_full_op;
+                                       collect_full(trace_contexts_p);
+                               }
+                               break;
+                       case collect_full_op:
+                               collect_full(trace_contexts_p);
+                               break;
+                       case collect_compact_op:
+                               collect_compact(trace_contexts_p);
+                               break;
+                       case collect_growing_heap_op:
+                               collect_growing_heap(requested_bytes,trace_contexts_p);
+                               break;
+                       default:
+                               critical_error("Bad GC op",current_gc->op);
+                               break;
+                       }
+
+                       break;
                }
-               break;
-       case collect_to_tenured_op:
-               collect_to_tenured();
-               if(data->high_fragmentation_p())
+               catch(const must_start_gc_again &)
                {
-                       current_gc->op = collect_full_op;
-                       current_gc->event->op = collect_full_op;
-                       collect_full(trace_contexts_p);
+                       /* We come back here if a generation is full */
+                       start_gc_again();
+                       continue;
                }
-               break;
-       case collect_full_op:
-               collect_full(trace_contexts_p);
-               break;
-       case collect_compact_op:
-               collect_compact(trace_contexts_p);
-               break;
-       case collect_growing_heap_op:
-               collect_growing_heap(requested_bytes,trace_contexts_p);
-               break;
-       default:
-               critical_error("Bad GC op",current_gc->op);
-               break;
        }
 
        end_gc();
@@ -207,16 +215,34 @@ void factor_vm::primitive_compact_gc()
                true /* trace contexts? */);
 }
 
-void factor_vm::inline_gc(cell *data_roots_base, cell data_roots_size)
+void factor_vm::inline_gc(cell gc_roots_)
 {
-       data_roots.push_back(data_root_range(data_roots_base,data_roots_size));
-       primitive_minor_gc();
-       data_roots.pop_back();
+       cell stack_pointer = (cell)ctx->callstack_top;
+
+       if(to_boolean(gc_roots_))
+       {
+               tagged<array> gc_roots(gc_roots_);
+
+               cell capacity = array_capacity(gc_roots.untagged());
+               for(cell i = 0; i < capacity; i++)
+               {
+                       cell spill_slot = untag_fixnum(array_nth(gc_roots.untagged(),i));
+                       cell *address = (cell *)(spill_slot + stack_pointer);
+                       data_roots.push_back(data_root_range(address,1));
+               }
+
+               primitive_minor_gc();
+
+               for(cell i = 0; i < capacity; i++)
+                       data_roots.pop_back();
+       }
+       else
+               primitive_minor_gc();
 }
 
-VM_C_API void inline_gc(cell *data_roots_base, cell data_roots_size, factor_vm *parent)
+VM_C_API void inline_gc(cell gc_roots, factor_vm *parent)
 {
-       parent->inline_gc(data_roots_base,data_roots_size);
+       parent->inline_gc(gc_roots);
 }
 
 /*
index 5224dec3e296c21b515b4d4766095733a028eb0d..39a69e34f4c0678ee93ffd964fcc74a5754df26a 100755 (executable)
--- a/vm/gc.hpp
+++ b/vm/gc.hpp
@@ -45,7 +45,6 @@ struct gc_event {
 struct gc_state {
        gc_op op;
        u64 start_time;
-       jmp_buf gc_unwind;
        gc_event *event;
 
        explicit gc_state(gc_op op_, factor_vm *parent);
@@ -53,6 +52,6 @@ struct gc_state {
        void start_again(gc_op op_, factor_vm *parent);
 };
 
-VM_C_API void inline_gc(cell *data_roots_base, cell data_roots_size, factor_vm *parent);
+VM_C_API void inline_gc(cell gc_roots, factor_vm *parent);
 
 }
index c74351c1911301846969058ea466505df2433ff3..ccce96a952c56970c8b728293989347173338bc6 100755 (executable)
@@ -258,7 +258,7 @@ void factor_vm::load_image(vm_parameters *p)
        init_objects(&h);
 
        cell data_offset = data->tenured->start - h.data_relocation_base;
-       cell code_offset = code->seg->start - h.code_relocation_base;
+       cell code_offset = code->allocator->start - h.code_relocation_base;
 
        fixup_data(data_offset,code_offset);
        fixup_code(data_offset,code_offset);
@@ -285,7 +285,7 @@ bool factor_vm::save_image(const vm_char *saving_filename, const vm_char *filena
        h.version = image_version;
        h.data_relocation_base = data->tenured->start;
        h.data_size = data->tenured->occupied_space();
-       h.code_relocation_base = code->seg->start;
+       h.code_relocation_base = code->allocator->start;
        h.code_size = code->allocator->occupied_space();
 
        h.true_object = true_object;
index 101482b1dac740dbe905d8d04a986b25ae7e6579..40ffa28d114c4e70b0f248ef2afe127f5a3ee788 100755 (executable)
@@ -30,7 +30,7 @@ struct image_header {
 struct vm_parameters {
        const vm_char *image_path;
        const vm_char *executable_path;
-       cell ds_size, rs_size;
+       cell datastack_size, retainstack_size, callstack_size;
        cell young_size, aging_size, tenured_size;
        cell code_size;
        bool fep;
index c8a1b228790132942e9af38d322d5f1e6bff062d..b7cd7630acd42e4b7848fef29d392f9f0965ccf2 100755 (executable)
@@ -89,7 +89,8 @@ void inline_cache_jit::compile_inline_cache(fixnum index,
        parent->update_pic_count(inline_cache_type);
 
        /* Generate machine code to determine the object's class. */
-       emit_class_lookup(index,inline_cache_type);
+       emit_with_literal(parent->special_objects[PIC_LOAD],tag_fixnum(-index * sizeof(cell)));
+       emit(parent->special_objects[inline_cache_type]);
 
        /* Generate machine code to check, in turn, if the class is one of the cached entries. */
        cell i;
index 59dbf1ef8e3e702a47faa159ed665955538169ab..b11db279a5bfc536e62df76e0ddbeaed0b460e53 100644 (file)
@@ -49,6 +49,8 @@ fixnum instruction_operand::load_value(cell relative_to)
                return load_value_masked(rel_indirect_arm_mask,20,0) + relative_to + sizeof(cell);
        case RC_ABSOLUTE_2:
                return *(u16 *)(pointer - sizeof(u16));
+       case RC_ABSOLUTE_1:
+               return *(u8 *)(pointer - sizeof(u8));
        default:
                critical_error("Bad rel class",rel.rel_class());
                return 0;
@@ -124,6 +126,9 @@ void instruction_operand::store_value(fixnum absolute_value)
        case RC_ABSOLUTE_2:
                *(u16 *)(pointer - sizeof(u16)) = (u16)absolute_value;
                break;
+       case RC_ABSOLUTE_1:
+               *(u8 *)(pointer - sizeof(u8)) = (u8)absolute_value;
+               break;
        default:
                critical_error("Bad rel class",rel.rel_class());
                break;
index dc8aa9d841d24a2f47b275a29aaa5b1ef61565f6..475e48d20673cd55ca67e4623cb3dc9499ab7c20 100644 (file)
@@ -26,14 +26,19 @@ enum relocation_type {
        RT_CARDS_OFFSET,
        /* value of vm->decks_offset */
        RT_DECKS_OFFSET,
+       /* address of exception_handler -- this exists as a separate relocation
+       type since its used in a situation where relocation arguments cannot
+       be passed in, and so RT_DLSYM is inappropriate (Windows only) */
+       RT_EXCEPTION_HANDLER,
+
 };
 
 enum relocation_class {
-       /* absolute address in a 64-bit location */
+       /* absolute address in a pointer-width location */
        RC_ABSOLUTE_CELL,
-       /* absolute address in a 32-bit location */
+       /* absolute address in a 4 byte location */
        RC_ABSOLUTE,
-       /* relative address in a 32-bit location */
+       /* relative address in a 4 byte location */
        RC_RELATIVE,
        /* absolute address in a PowerPC LIS/ORI sequence */
        RC_ABSOLUTE_PPC_2_2,
@@ -49,8 +54,10 @@ enum relocation_class {
        RC_INDIRECT_ARM,
        /* pointer to address in an ARM LDR/STR instruction offset by 8 bytes */
        RC_INDIRECT_ARM_PC,
-       /* absolute address in a 16-bit location */
-       RC_ABSOLUTE_2
+       /* absolute address in a 2 byte location */
+       RC_ABSOLUTE_2,
+       /* absolute address in a 1 byte location */
+       RC_ABSOLUTE_1,
 };
 
 static const cell rel_absolute_ppc_2_mask = 0xffff;
@@ -105,9 +112,10 @@ struct relocation_entry {
                case RT_MEGAMORPHIC_CACHE_HITS:
                case RT_CARDS_OFFSET:
                case RT_DECKS_OFFSET:
+               case RT_EXCEPTION_HANDLER:
                        return 0;
                default:
-                       critical_error("Bad rel type",rel_type());
+                       critical_error("Bad rel type in number_of_parameters()",rel_type());
                        return -1; /* Can't happen */
                }
        }
index 8eaaa453b5015be9898222177c3d354621ae1366..ba1e429802d8ac0d93d1ffd2b8ff17c4a08bb620 100755 (executable)
--- a/vm/io.cpp
+++ b/vm/io.cpp
@@ -28,26 +28,28 @@ void factor_vm::io_error()
                return;
 #endif
 
-       general_error(ERROR_IO,tag_fixnum(errno),false_object,NULL);
+       general_error(ERROR_IO,tag_fixnum(errno),false_object);
 }
 
 FILE *factor_vm::safe_fopen(char *filename, char *mode)
 {
        FILE *file;
-       do {
+       for(;;)
+       {
                file = fopen(filename,mode);
                if(file == NULL)
                        io_error();
                else
                        break;
-       } while(errno == EINTR);
+       }
        return file;
 }
 
 int factor_vm::safe_fgetc(FILE *stream)
 {
        int c;
-       do {
+       for(;;)
+       {
                c = fgetc(stream);
                if(c == EOF)
                {
@@ -58,38 +60,53 @@ int factor_vm::safe_fgetc(FILE *stream)
                }
                else
                        break;
-       } while(errno == EINTR);
+       }
        return c;
 }
 
 size_t factor_vm::safe_fread(void *ptr, size_t size, size_t nitems, FILE *stream)
 {
        size_t items_read = 0;
+       size_t ret = 0;
 
-       do {
-               items_read += fread((void*)((int*)ptr+items_read*size),size,nitems-items_read,stream);
-       } while(items_read != nitems && errno == EINTR);
+       do
+       {
+               ret = fread((void*)((int*)ptr+items_read*size),size,nitems-items_read,stream);
+               if(ret == 0)
+               {
+                       if(feof(stream))
+                               break;
+                       else
+                               io_error();
+               }
+               items_read += ret;
+       } while(items_read != nitems);
 
        return items_read;
 }
 
 void factor_vm::safe_fputc(int c, FILE *stream)
 {
-       do {
+       for(;;)
+       {
                if(fputc(c,stream) == EOF)
                        io_error();
                else
                        break;
-       } while(errno == EINTR);
+       }
 }
 
 size_t factor_vm::safe_fwrite(void *ptr, size_t size, size_t nitems, FILE *stream)
 {
        size_t items_written = 0;
+       size_t ret = 0;
 
        do {
-               items_written += fwrite((void*)((int*)ptr+items_written*size),size,nitems-items_written,stream);
-       } while(items_written != nitems && errno == EINTR);
+               ret = fwrite((void*)((int*)ptr+items_written*size),size,nitems-items_written,stream);
+               if(ret == 0)
+                       io_error();
+               items_written += ret;
+       } while(items_written != nitems);
 
        return items_written;
 }
@@ -97,12 +114,13 @@ size_t factor_vm::safe_fwrite(void *ptr, size_t size, size_t nitems, FILE *strea
 int factor_vm::safe_ftell(FILE *stream)
 {
        off_t offset;
-       do {
+       for(;;)
+       {
                if((offset = FTELL(stream)) == -1)
                        io_error();
                else
                        break;
-       } while(errno == EINTR);
+       }
        return offset;
 }
 
@@ -117,32 +135,35 @@ void factor_vm::safe_fseek(FILE *stream, off_t offset, int whence)
                critical_error("Bad value for whence",whence);
        }
 
-       do {
+       for(;;)
+       {
                if(FSEEK(stream,offset,whence) == -1)
                        io_error();
                else
                        break;
-       } while(errno == EINTR);
+       }
 }
 
 void factor_vm::safe_fflush(FILE *stream)
 {
-       do {
+       for(;;)
+       {
                if(fflush(stream) == EOF)
                        io_error();
                else
                        break;
-       } while(errno == EINTR);
+       }
 }
 
 void factor_vm::safe_fclose(FILE *stream)
 {
-       do {
+       for(;;)
+       {
                if(fclose(stream) == EOF)
                        io_error();
                else
                        break;
-       } while(errno == EINTR);
+       }
 }
 
 void factor_vm::primitive_fopen()
@@ -187,20 +208,15 @@ void factor_vm::primitive_fread()
 
        data_root<byte_array> buf(allot_uninitialized_array<byte_array>(size),this);
 
-       int c = safe_fread(buf.untagged() + 1,1,size,file);
+       size_t c = safe_fread(buf.untagged() + 1,1,size,file);
        if(c == 0)
-       {
-               if(feof(file))
-                       ctx->push(false_object);
-               else
-                       io_error();
-       }
+               ctx->push(false_object);
        else
        {
                if(feof(file))
                {
                        byte_array *new_buf = allot_byte_array(c);
-                       memcpy(new_buf + 1, buf.untagged() + 1,c);
+                       memcpy(new_buf->data<char>(), buf->data<char>(),c);
                        buf = new_buf;
                }
 
@@ -212,20 +228,19 @@ void factor_vm::primitive_fputc()
 {
        FILE *file = pop_file_handle();
        fixnum ch = to_fixnum(ctx->pop());
-       safe_fputc(ch, file);
+       safe_fputc((int)ch, file);
 }
 
 void factor_vm::primitive_fwrite()
 {
        FILE *file = pop_file_handle();
-       byte_array *text = untag_check<byte_array>(ctx->pop());
-       cell length = array_capacity(text);
-       char *string = (char *)(text + 1);
+       cell length = to_cell(ctx->pop());
+       char *text = alien_offset(ctx->pop());
 
        if(length == 0)
                return;
 
-       size_t written = safe_fwrite(string,1,length,file);
+       size_t written = safe_fwrite(text,1,length,file);
        if(written != length)
                io_error();
 }
@@ -238,9 +253,9 @@ void factor_vm::primitive_ftell()
 
 void factor_vm::primitive_fseek()
 {
-       int whence = to_fixnum(ctx->pop());
        FILE *file = pop_file_handle();
-       off_t offset = to_signed_8(ctx->pop());
+       int whence = (int)to_fixnum(ctx->pop());
+       off_t offset = (off_t)to_signed_8(ctx->pop());
        safe_fseek(file,offset,whence);
 }
 
index 8d2f5abb9a1739c3408e36e98a1d000b1ee15419..3324cfb366179a28926b8d7c0e405ea910827976 100644 (file)
@@ -103,12 +103,6 @@ bool jit::emit_subprimitive(cell word_, bool tail_call_p, bool stack_frame_p)
        return false;
 }
        
-void jit::emit_class_lookup(fixnum index, cell type)
-{
-       emit_with_literal(parent->special_objects[PIC_LOAD],tag_fixnum(-index * sizeof(cell)));
-       emit(parent->special_objects[type]);
-}
-
 /* Facility to convert compiled code offsets to quotation offsets.
 Call jit_compute_offset() with the compiled code offset, then emit
 code, and at the end jit->position is the quotation position. */
index a9716cab79a8b93f003b1b176b4da28505029b86..963115d6abdf4d73ff9c53373a56df3457e771ad 100644 (file)
@@ -47,8 +47,6 @@ struct jit {
 
        bool emit_subprimitive(cell word_, bool tail_call_p, bool stack_frame_p);
 
-       void emit_class_lookup(fixnum index, cell type);
-
        fixnum get_position()
        {
                if(computing_offset_p)
index 9b574e554d359ebb6307296837e889dddb9c4c77..5e7ca0279f73582e1476c895ff4e8dc4939169c7 100644 (file)
@@ -91,8 +91,6 @@ inline static cell tag_fixnum(fixnum untagged)
        return RETAG(untagged << TAG_BITS,FIXNUM_TYPE);
 }
 
-struct object;
-
 #define NO_TYPE_CHECK static const cell type_number = TYPE_COUNT
 
 struct object {
@@ -205,8 +203,6 @@ struct string : public object {
        cell hashcode;
 
        u8 *data() const { return (u8 *)(this + 1); }
-
-       cell nth(cell i) const;
 };
 
 struct code_block;
index 3fa7dcbf078c3aa9534a7b83eaa3a0472015d86b..af14c3a49a963643db39ea74e459216d5913ef83 100644 (file)
@@ -35,19 +35,9 @@ void factor_vm::call_fault_handler(
        MACH_THREAD_STATE_TYPE *thread_state,
        MACH_FLOAT_STATE_TYPE *float_state)
 {
-       /* There is a race condition here, but in practice an exception
-       delivered during stack frame setup/teardown or while transitioning
-       from Factor to C is a sign of things seriously gone wrong, not just
-       a divide by zero or stack underflow in the listener */
-
-       /* Are we in compiled Factor code? Then use the current stack pointer */
-       if(in_code_heap_p(MACH_PROGRAM_COUNTER(thread_state)))
-               signal_callstack_top = (stack_frame *)MACH_STACK_POINTER(thread_state);
-       /* Are we in C? Then use the saved callstack top */
-       else
-               signal_callstack_top = NULL;
+       MACH_STACK_POINTER(thread_state) = (cell)fix_callstack_top((stack_frame *)MACH_STACK_POINTER(thread_state));
 
-       MACH_STACK_POINTER(thread_state) = align_stack_pointer(MACH_STACK_POINTER(thread_state));
+       signal_callstack_top = (stack_frame *)MACH_STACK_POINTER(thread_state);
 
        /* Now we point the program counter at the right handler function. */
        if(exception == EXC_BAD_ACCESS)
@@ -82,11 +72,14 @@ static void call_fault_handler(
        MACH_THREAD_STATE_TYPE *thread_state,
        MACH_FLOAT_STATE_TYPE *float_state)
 {
+       /* Look up the VM instance involved */
        THREADHANDLE thread_id = pthread_from_mach_thread_np(thread);
        assert(thread_id);
        std::map<THREADHANDLE, factor_vm*>::const_iterator vm = thread_vms.find(thread_id);
+
+       /* Handle the exception */
        if (vm != thread_vms.end())
-           vm->second->call_fault_handler(exception,code,exc_state,thread_state,float_state);
+               vm->second->call_fault_handler(exception,code,exc_state,thread_state,float_state);
 }
 
 /* Handle an exception by invoking the user's fault handler and/or forwarding
@@ -100,15 +93,14 @@ catch_exception_raise (mach_port_t exception_port,
        exception_data_t code,
        mach_msg_type_number_t code_count)
 {
-       MACH_EXC_STATE_TYPE exc_state;
-       MACH_THREAD_STATE_TYPE thread_state;
-       MACH_FLOAT_STATE_TYPE float_state;
-       mach_msg_type_number_t exc_state_count, thread_state_count, float_state_count;
+       /* 10.6 likes to report exceptions from child processes too. Ignore those */
+       if(task != mach_task_self()) return KERN_FAILURE;
 
        /* Get fault information and the faulting thread's register contents..
        
        See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_get_state.html.  */
-       exc_state_count = MACH_EXC_STATE_COUNT;
+       MACH_EXC_STATE_TYPE exc_state;
+       mach_msg_type_number_t exc_state_count = MACH_EXC_STATE_COUNT;
        if (thread_get_state (thread, MACH_EXC_STATE_FLAVOR,
                              (natural_t *)&exc_state, &exc_state_count)
                != KERN_SUCCESS)
@@ -118,7 +110,8 @@ catch_exception_raise (mach_port_t exception_port,
                return KERN_FAILURE;
        }
 
-       thread_state_count = MACH_THREAD_STATE_COUNT;
+       MACH_THREAD_STATE_TYPE thread_state;
+       mach_msg_type_number_t thread_state_count = MACH_THREAD_STATE_COUNT;
        if (thread_get_state (thread, MACH_THREAD_STATE_FLAVOR,
                              (natural_t *)&thread_state, &thread_state_count)
                != KERN_SUCCESS)
@@ -128,7 +121,8 @@ catch_exception_raise (mach_port_t exception_port,
                return KERN_FAILURE;
        }
 
-       float_state_count = MACH_FLOAT_STATE_COUNT;
+       MACH_FLOAT_STATE_TYPE float_state;
+       mach_msg_type_number_t float_state_count = MACH_FLOAT_STATE_COUNT;
        if (thread_get_state (thread, MACH_FLOAT_STATE_FLAVOR,
                              (natural_t *)&float_state, &float_state_count)
                != KERN_SUCCESS)
index 70736c1bd9d127dbe26c29b5bf7b75a885dd848b..a111a86b699be1d910347f1de2ef28f28adffa84 100755 (executable)
@@ -16,7 +16,6 @@
 #include <fcntl.h>
 #include <limits.h>
 #include <math.h>
-#include <setjmp.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <vector>
 #include <iostream>
 
+#define FACTOR_STRINGIZE(x) #x
+
+/* Record compiler version */
+#if defined(__clang__)
+       #define FACTOR_COMPILER_VERSION "Clang (GCC " __VERSION__ ")"
+#elif defined(__INTEL_COMPILER)
+       #define FACTOR_COMPILER_VERSION "Intel C Compiler " FACTOR_STRINGIZE(__INTEL_COMPILER)
+#elif defined(__GNUC__)
+       #define FACTOR_COMPILER_VERSION "GCC " __VERSION__
+#elif defined(_MSC_FULL_VER)
+       #define FACTOR_COMPILER_VERSION "Microsoft Visual C++ " FACTOR_STRINGIZE(_MSC_FULL_VER)
+#else
+       #define FACTOR_COMPILER_VERSION "unknown"
+#endif
+
 /* Detect target CPU type */
 #if defined(__arm__)
        #define FACTOR_ARM
@@ -117,6 +131,7 @@ namespace factor
 #include "jit.hpp"
 #include "quotations.hpp"
 #include "inline_cache.hpp"
+#include "mvm.hpp"
 #include "factor.hpp"
 #include "utilities.hpp"
 
index bb5d9c13c499b026214872e8e75552629b138789..737b35ab85735d11f9f4f39d699bbcac295b2991 100755 (executable)
@@ -246,7 +246,7 @@ cell factor_vm::unbox_array_size_slow()
                }
        }
 
-       general_error(ERROR_ARRAY_SIZE,ctx->pop(),tag_fixnum(array_size_max),NULL);
+       general_error(ERROR_ARRAY_SIZE,ctx->pop(),tag_fixnum(array_size_max));
        return 0; /* can't happen */
 }
 
@@ -260,10 +260,12 @@ void factor_vm::primitive_bignum_to_float()
        ctx->replace(allot_float(bignum_to_float(ctx->peek())));
 }
 
-void factor_vm::primitive_float_to_str()
+void factor_vm::primitive_format_float()
 {
-       byte_array *array = allot_byte_array(33);
-       SNPRINTF((char *)(array + 1),32,"%.16g",untag_float_check(ctx->pop()));
+       byte_array *array = allot_byte_array(100);
+       char *format = alien_offset(ctx->pop());
+       double value = untag_float_check(ctx->pop());
+       SNPRINTF(array->data<char>(),99,format,value);
        ctx->push(tag<byte_array>(array));
 }
 
@@ -489,9 +491,9 @@ s64 factor_vm::to_signed_8(cell obj)
        }
 }
 
-VM_C_API s64 to_signed_8(cell obj, factor_vm *parent)
+VM_C_API void to_signed_8(cell obj, s64 *out, factor_vm *parent)
 {
-       return parent->to_signed_8(obj);
+       *out = parent->to_signed_8(obj);
 }
 
 cell factor_vm::from_unsigned_8(u64 n)
@@ -522,9 +524,9 @@ u64 factor_vm::to_unsigned_8(cell obj)
        }
 }
 
-VM_C_API u64 to_unsigned_8(cell obj, factor_vm *parent)
+VM_C_API void to_unsigned_8(cell obj, u64 *out, factor_vm *parent)
 {
-       return parent->to_unsigned_8(obj);
+       *out = parent->to_unsigned_8(obj);
 }
  
 VM_C_API cell from_float(float flo, factor_vm *parent)
index d78ae54010af1bbfb7027e9569c83668e537b86e..13934048cdce68968b8666785147ac30dc597152 100644 (file)
@@ -90,8 +90,8 @@ VM_C_API cell from_unsigned_cell(cell integer, factor_vm *vm);
 VM_C_API cell from_signed_8(s64 n, factor_vm *vm);
 VM_C_API cell from_unsigned_8(u64 n, factor_vm *vm);
 
-VM_C_API s64 to_signed_8(cell obj, factor_vm *vm);
-VM_C_API u64 to_unsigned_8(cell obj, factor_vm *vm);
+VM_C_API void to_signed_8(cell obj, s64 *out, factor_vm *parent);
+VM_C_API void to_unsigned_8(cell obj, u64 *out, factor_vm *parent);
 
 VM_C_API fixnum to_fixnum(cell tagged, factor_vm *vm);
 VM_C_API cell to_cell(cell tagged, factor_vm *vm);
diff --git a/vm/mvm-none.cpp b/vm/mvm-none.cpp
new file mode 100644 (file)
index 0000000..ab1b53a
--- /dev/null
@@ -0,0 +1,28 @@
+#include "master.hpp"
+
+/* Multi-VM threading is not supported on NetBSD due to
+http://gnats.netbsd.org/25563 */
+
+namespace factor
+{
+
+factor_vm *global_vm;
+
+void init_mvm()
+{
+       global_vm = NULL;
+}
+
+void register_vm_with_thread(factor_vm *vm)
+{
+       assert(!global_vm);
+       global_vm = vm;
+}
+
+factor_vm *current_vm()
+{
+       assert(global_vm != NULL);
+       return global_vm;
+}
+
+}
diff --git a/vm/mvm-unix.cpp b/vm/mvm-unix.cpp
new file mode 100644 (file)
index 0000000..adba52b
--- /dev/null
@@ -0,0 +1,26 @@
+#include "master.hpp"
+
+namespace factor
+{
+
+pthread_key_t current_vm_tls_key;
+
+void init_mvm()
+{
+       if(pthread_key_create(&current_vm_tls_key, NULL) != 0)
+               fatal_error("pthread_key_create() failed",0);
+}
+
+void register_vm_with_thread(factor_vm *vm)
+{
+       pthread_setspecific(current_vm_tls_key,vm);
+}
+
+factor_vm *current_vm()
+{
+       factor_vm *vm = (factor_vm*)pthread_getspecific(current_vm_tls_key);
+       assert(vm != NULL);
+       return vm;
+}
+
+}
diff --git a/vm/mvm-windows-nt.cpp b/vm/mvm-windows-nt.cpp
new file mode 100644 (file)
index 0000000..92c2067
--- /dev/null
@@ -0,0 +1,27 @@
+#include "master.hpp"
+
+namespace factor
+{
+
+DWORD current_vm_tls_key; 
+
+void init_mvm()
+{
+       if((current_vm_tls_key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
+               fatal_error("TlsAlloc() failed",0);
+}
+
+void register_vm_with_thread(factor_vm *vm)
+{
+       if(!TlsSetValue(current_vm_tls_key, vm))
+               fatal_error("TlsSetValue() failed",0);
+}
+
+factor_vm *current_vm()
+{
+       factor_vm *vm = (factor_vm *)TlsGetValue(current_vm_tls_key);
+       assert(vm != NULL);
+       return vm;
+}
+
+}
diff --git a/vm/mvm.cpp b/vm/mvm.cpp
new file mode 100644 (file)
index 0000000..df5d85e
--- /dev/null
@@ -0,0 +1,31 @@
+#include "master.hpp"
+
+namespace factor
+{
+
+std::map<THREADHANDLE, factor_vm*> thread_vms;
+
+struct startargs {
+       int argc;
+       vm_char **argv;
+};
+
+// arg must be new'ed because we're going to delete it!
+void *start_standalone_factor_thread(void *arg) 
+{
+       factor_vm *newvm = new_factor_vm();
+       startargs *args = (startargs*) arg;
+       int argc = args->argc; vm_char **argv = args->argv;
+       delete args;
+       newvm->start_standalone_factor(argc, argv);
+       return 0;
+}
+
+VM_C_API THREADHANDLE start_standalone_factor_in_new_thread(int argc, vm_char **argv)
+{
+       startargs *args = new startargs;
+       args->argc = argc; args->argv = argv; 
+       return start_thread(start_standalone_factor_thread,args);
+}
+
+}
diff --git a/vm/mvm.hpp b/vm/mvm.hpp
new file mode 100644 (file)
index 0000000..52430b7
--- /dev/null
@@ -0,0 +1,12 @@
+namespace factor
+{
+
+void init_mvm();
+void register_vm_with_thread(factor_vm *vm);
+factor_vm *current_vm();
+
+VM_C_API THREADHANDLE start_standalone_factor_in_new_thread(int argc, vm_char **argv);
+
+extern std::map<THREADHANDLE, factor_vm *> thread_vms;
+
+}
index f1201c4de7c4c759a893042fc88eba50433e3c9f..6b007f5d420f220c13130dcbd5f582df93dc8c53 100644 (file)
@@ -5,15 +5,15 @@ namespace factor
 
 void factor_vm::primitive_special_object()
 {
-       fixnum e = untag_fixnum(ctx->peek());
-       ctx->replace(special_objects[e]);
+       fixnum n = untag_fixnum(ctx->peek());
+       ctx->replace(special_objects[n]);
 }
 
 void factor_vm::primitive_set_special_object()
 {
-       fixnum e = untag_fixnum(ctx->pop());
+       fixnum n = untag_fixnum(ctx->pop());
        cell value = ctx->pop();
-       special_objects[e] = value;
+       special_objects[n] = value;
 }
 
 void factor_vm::primitive_identity_hashcode()
index fdc5758a8d2159bb6730307c764f2bc7ff8f6202..778df8642e6ff519dce79f564e02827a5be951dc 100644 (file)
@@ -4,11 +4,7 @@ namespace factor
 static const cell special_object_count = 70;
 
 enum special_object {
-       OBJ_NAMESTACK,             /* used by library only */
-       OBJ_CATCHSTACK,            /* used by library only, per-callback */
-
-       OBJ_CURRENT_CALLBACK = 2,  /* used by library only, per-callback */
-       OBJ_WALKER_HOOK,           /* non-local exit hook, used by library only */
+       OBJ_WALKER_HOOK = 3,       /* non-local exit hook, used by library only */
        OBJ_CALLCC_1,              /* used to pass the value in callcc1 */
 
        ERROR_HANDLER_QUOT = 5,    /* quotation called when VM throws an error */
@@ -95,6 +91,8 @@ enum special_object {
        OBJ_THREADS = 64,
        OBJ_RUN_QUEUE = 65,
        OBJ_SLEEP_QUEUE = 66,
+
+       OBJ_VM_COMPILER = 67,     /* version string of the compiler we were built with */
 };
 
 /* save-image-and-exit discards special objects that are filled in on startup
index 7797a7199b9c44545aaf43e8e112a923fec5711e..177a920d87f752ddafd70c71664640d84d9d5c2b 100644 (file)
@@ -6,3 +6,5 @@ extern "C" int getosreldate();
 #ifndef KERN_PROC_PATHNAME
 #define KERN_PROC_PATHNAME 12
 #endif
+
+#define UAP_STACK_POINTER_TYPE __register_t
index 301b68fb528bb96ce302f5d3b54675a12110c4bb..fb5ecf9f50a37e7c9181fe4ba6334d2d45d04f4e 100644 (file)
@@ -9,7 +9,7 @@ void factor_vm::c_to_factor_toplevel(cell quot)
        c_to_factor(quot);
 }
 
-void init_signals()
+void factor_vm::init_signals()
 {
        unix_init_signals();
 }
@@ -38,8 +38,7 @@ const char *default_image_path()
 u64 nano_count()
 {
        struct timespec t;
-       int ret;
-       ret = clock_gettime(CLOCK_MONOTONIC,&t);
+       int ret = clock_gettime(CLOCK_MONOTONIC,&t);
        if(ret != 0)
                fatal_error("clock_gettime failed", 0);
        return (u64)t.tv_sec * 1000000000 + t.tv_nsec;
index ff5d29ecd715169681fa809244d71e5e697ba7c1..a40e891a6e7ae9318ec0c77acdac1416921d3322 100644 (file)
@@ -2,17 +2,9 @@ namespace factor
 {
 
 #define VM_C_API extern "C"
-#define NULL_DLL NULL
 
-void c_to_factor_toplevel(cell quot);
-void init_signals();
 void early_init();
 const char *vm_executable_path();
 const char *default_image_path();
 
-template<typename Type> Type align_stack_pointer(Type sp)
-{
-       return sp;
-}
-
 }
index 07eda12186d1437466ed8dec4c8c48a927228f59..8e131b9011b8df4ef4573c7a7598931689a6c4c1 100644 (file)
@@ -25,7 +25,7 @@ void flush_icache(cell start, cell len)
                : "r0","r1","r2");
 
        if(result < 0)
-               tls_vm()critical_error("flush_icache() failed",result);
+               critical_error("flush_icache() failed",result);
 }
 
 }
index de13896b9ab555ea0f9cf29fcf11732e74df275a..6c490de2602040bed7b965d6b6fd1d0e290832f0 100644 (file)
@@ -7,4 +7,6 @@ VM_C_API int inotify_init();
 VM_C_API int inotify_add_watch(int fd, const char *name, u32 mask);
 VM_C_API int inotify_rm_watch(int fd, u32 wd);
 
+#define UAP_STACK_POINTER_TYPE greg_t
+
 }
index 30fd4b2081bc9624dd553a668688673894518afe..90da9a26f3108ced64939f2f0d65bf5b453fa0f6 100644 (file)
@@ -62,11 +62,6 @@ inline static unsigned int uap_fpu_status(void *uap)
        return mach_fpu_status(UAP_FS(uap));
 }
 
-template<typename Type> Type align_stack_pointer(Type sp)
-{
-       return sp;
-}
-
 inline static void mach_clear_fpu_status(ppc_float_state_t *float_state)
 {
        FPSCR(float_state) &= 0x0007f8ff;
index a6fe8e27034d255056171e840882acb8da66c424..3d754ae9e48c0b00c2f774d7074564fa0132ddc1 100644 (file)
@@ -64,11 +64,6 @@ inline static unsigned int uap_fpu_status(void *uap)
        return mach_fpu_status(UAP_FS(uap));
 }
 
-template<typename Type> Type align_stack_pointer(Type sp)
-{
-       return (Type)((((cell)sp + 4) & ~15) - 4);
-}
-
 inline static void mach_clear_fpu_status(i386_float_state_t *float_state)
 {
         MXCSR(float_state) &= 0xffffffc0;
index cb1980ddbf66cb0056ebe9e29cb174d0fb508044..7cef436327076d200392898a3f80d9f99e6c3f7f 100644 (file)
@@ -62,11 +62,6 @@ inline static unsigned int uap_fpu_status(void *uap)
        return mach_fpu_status(UAP_FS(uap));
 }
 
-template<typename Type> Type align_stack_pointer(Type sp)
-{
-       return (Type)((((cell)sp + 8) & ~15) - 8);
-}
-
 inline static void mach_clear_fpu_status(x86_float_state64_t *float_state)
 {
        MXCSR(float_state) &= 0xffffffc0;
index 0d230f48e3651c0568e6f7935ebc80596def9521..27eba772159ccc6521c4bbea608263d298c1fe1e 100644 (file)
@@ -3,16 +3,14 @@ namespace factor
 
 #define VM_C_API extern "C" __attribute__((visibility("default")))
 #define FACTOR_OS_STRING "macosx"
-#define NULL_DLL "libfactor.dylib"
 
-void init_signals();
 void early_init();
 
 const char *vm_executable_path();
 const char *default_image_path();
 
-void c_to_factor_toplevel(cell quot);
-
 #define UAP_STACK_POINTER(ucontext) (((ucontext_t *)ucontext)->uc_stack.ss_sp)
 
+#define UAP_STACK_POINTER_TYPE void*
+
 }
index 92694a4599a19770b1db16807189e9221c9d0901..05a9aef5c8c665aaa743ae101437aea8c636dd7b 100644 (file)
@@ -70,7 +70,7 @@ const char *default_image_path(void)
        return [returnVal UTF8String];
 }
 
-void init_signals(void)
+void factor_vm::init_signals(void)
 {
        unix_init_signals();
        mach_initialize();
@@ -87,14 +87,19 @@ Protocol *objc_getProtocol(char *name)
 
 u64 nano_count()
 {
-       u64 t;
-       mach_timebase_info_data_t info;
-       kern_return_t ret;
-       t = mach_absolute_time();
-       ret = mach_timebase_info(&info);
-       if(ret != 0)
-               fatal_error("mach_timebase_info failed",ret);
-       return t * (info.numer/info.denom);
+       u64 time = mach_absolute_time();
+
+       static u64 scaling_factor = 0;
+       if(!scaling_factor)
+       {
+               mach_timebase_info_data_t info;
+               kern_return_t ret = mach_timebase_info(&info);
+               if(ret != 0)
+                       fatal_error("mach_timebase_info failed",ret);
+               scaling_factor = info.numer/info.denom;
+       }
+
+       return time * scaling_factor;
 }
 
 }
index d45b2ac1630eb74de287b6a73cbe66fb5e47c672..e79d1bf375efab975c2b8514fdda6c81c8b23ec2 100644 (file)
@@ -1,8 +1,5 @@
 #include <ucontext.h>
 
-namespace factor
-{
+#define UAP_PROGRAM_COUNTER(uap) _UC_MACHINE_PC((ucontext_t *)uap)
 
-#define UAP_PROGRAM_COUNTER(uap)    _UC_MACHINE_PC((ucontext_t *)uap)
-
-}
+#define UAP_STACK_POINTER_TYPE __greg_t
diff --git a/vm/os-openbsd.hpp b/vm/os-openbsd.hpp
new file mode 100644 (file)
index 0000000..b3b47c0
--- /dev/null
@@ -0,0 +1 @@
+#define UAP_STACK_POINTER_TYPE __register_t
index 15f8132a634e560e12db87c5bef62f0c9ac9971d..034dfcbf5f2f7643e93615c0177bc8eb9adad727 100644 (file)
@@ -13,31 +13,10 @@ THREADHANDLE start_thread(void *(*start_routine)(void *),void *args)
                fatal_error("pthread_attr_setdetachstate() failed",0);
        if (pthread_create (&thread, &attr, start_routine, args) != 0)
                fatal_error("pthread_create() failed",0);
-       pthread_attr_destroy (&attr);
+       pthread_attr_destroy(&attr);
        return thread;
 }
 
-pthread_key_t tlsKey = 0;
-
-void init_platform_globals()
-{
-       if (pthread_key_create(&tlsKey, NULL) != 0)
-               fatal_error("pthread_key_create() failed",0);
-
-}
-
-void register_vm_with_thread(factor_vm *vm)
-{
-       pthread_setspecific(tlsKey,vm);
-}
-
-factor_vm *tls_vm()
-{
-       factor_vm *vm = (factor_vm*)pthread_getspecific(tlsKey);
-       assert(vm != NULL);
-       return vm;
-}
-
 static void *null_dll;
 
 u64 system_micros()
@@ -67,8 +46,7 @@ void sleep_nanos(u64 nsec)
 
 void factor_vm::init_ffi()
 {
-       /* NULL_DLL is "libfactor.dylib" for OS X and NULL for generic unix */
-       null_dll = dlopen(NULL_DLL,RTLD_LAZY);
+       null_dll = dlopen(NULL,RTLD_LAZY);
 }
 
 void factor_vm::ffi_dlopen(dll *dll)
@@ -85,7 +63,7 @@ void *factor_vm::ffi_dlsym(dll *dll, symbol_char *symbol)
 void factor_vm::ffi_dlclose(dll *dll)
 {
        if(dlclose(dll->handle))
-               general_error(ERROR_FFI,false_object,false_object,NULL);
+               general_error(ERROR_FFI,false_object,false_object);
        dll->handle = NULL;
 }
 
@@ -99,11 +77,14 @@ void factor_vm::primitive_existsp()
 void factor_vm::move_file(const vm_char *path1, const vm_char *path2)
 {
        int ret = 0;
-       do {
+       do
+       {
                ret = rename((path1),(path2));
-       } while(ret < 0 && errno == EINTR);
+       }
+       while(ret < 0 && errno == EINTR);
+
        if(ret < 0)
-               general_error(ERROR_IO,tag_fixnum(errno),false_object,NULL);
+               general_error(ERROR_IO,tag_fixnum(errno),false_object);
 }
 
 segment::segment(cell size_, bool executable_p)
@@ -141,36 +122,29 @@ segment::~segment()
 
 void factor_vm::dispatch_signal(void *uap, void (handler)())
 {
-       if(in_code_heap_p(UAP_PROGRAM_COUNTER(uap)))
-       {
-               stack_frame *ptr = (stack_frame *)UAP_STACK_POINTER(uap);
-               assert(ptr);
-               signal_callstack_top = ptr;
-       }
-       else
-               signal_callstack_top = NULL;
-
-       UAP_STACK_POINTER(uap) = align_stack_pointer(UAP_STACK_POINTER(uap));
+       UAP_STACK_POINTER(uap) = (UAP_STACK_POINTER_TYPE)fix_callstack_top((stack_frame *)UAP_STACK_POINTER(uap));
        UAP_PROGRAM_COUNTER(uap) = (cell)handler;
+
+       signal_callstack_top = (stack_frame *)UAP_STACK_POINTER(uap);
 }
 
 void memory_signal_handler(int signal, siginfo_t *siginfo, void *uap)
 {
-       factor_vm *vm = tls_vm();
+       factor_vm *vm = current_vm();
        vm->signal_fault_addr = (cell)siginfo->si_addr;
        vm->dispatch_signal(uap,factor::memory_signal_handler_impl);
 }
 
 void misc_signal_handler(int signal, siginfo_t *siginfo, void *uap)
 {
-       factor_vm *vm = tls_vm();
+       factor_vm *vm = current_vm();
        vm->signal_number = signal;
        vm->dispatch_signal(uap,factor::misc_signal_handler_impl);
 }
 
 void fpe_signal_handler(int signal, siginfo_t *siginfo, void *uap)
 {
-       factor_vm *vm = tls_vm();
+       factor_vm *vm = current_vm();
        vm->signal_number = signal;
        vm->signal_fpu_status = fpu_status(uap_fpu_status(uap));
        uap_clear_fpu_status(uap);
@@ -194,8 +168,23 @@ static void sigaction_safe(int signum, const struct sigaction *act, struct sigac
                fatal_error("sigaction failed", 0);
 }
 
-void unix_init_signals()
+void factor_vm::unix_init_signals()
 {
+       /* OpenBSD doesn't support sigaltstack() if we link against
+       libpthread. See http://redmine.ruby-lang.org/issues/show/1239 */
+
+#ifndef __OpenBSD__
+       signal_callstack_seg = new segment(callstack_size,false);
+
+       stack_t signal_callstack;
+       signal_callstack.ss_sp = (char *)signal_callstack_seg->start;
+       signal_callstack.ss_size = signal_callstack_seg->size;
+       signal_callstack.ss_flags = 0;
+
+       if(sigaltstack(&signal_callstack,(stack_t *)NULL) < 0)
+               fatal_error("sigaltstack() failed",0);
+#endif
+
        struct sigaction memory_sigaction;
        struct sigaction misc_sigaction;
        struct sigaction fpe_sigaction;
@@ -204,7 +193,7 @@ void unix_init_signals()
        memset(&memory_sigaction,0,sizeof(struct sigaction));
        sigemptyset(&memory_sigaction.sa_mask);
        memory_sigaction.sa_sigaction = memory_signal_handler;
-       memory_sigaction.sa_flags = SA_SIGINFO;
+       memory_sigaction.sa_flags = SA_SIGINFO | SA_ONSTACK;
 
        sigaction_safe(SIGBUS,&memory_sigaction,NULL);
        sigaction_safe(SIGSEGV,&memory_sigaction,NULL);
@@ -212,14 +201,14 @@ void unix_init_signals()
        memset(&fpe_sigaction,0,sizeof(struct sigaction));
        sigemptyset(&fpe_sigaction.sa_mask);
        fpe_sigaction.sa_sigaction = fpe_signal_handler;
-       fpe_sigaction.sa_flags = SA_SIGINFO;
+       fpe_sigaction.sa_flags = SA_SIGINFO | SA_ONSTACK;
 
        sigaction_safe(SIGFPE,&fpe_sigaction,NULL);
 
        memset(&misc_sigaction,0,sizeof(struct sigaction));
        sigemptyset(&misc_sigaction.sa_mask);
        misc_sigaction.sa_sigaction = misc_signal_handler;
-       misc_sigaction.sa_flags = SA_SIGINFO;
+       misc_sigaction.sa_flags = SA_SIGINFO | SA_ONSTACK;
 
        sigaction_safe(SIGQUIT,&misc_sigaction,NULL);
        sigaction_safe(SIGILL,&misc_sigaction,NULL);
index 29378bb52331bba35e2c298af705fdc42237949f..3673c4e12114b5f09f7b0b78e4fd09d048f2c8c0 100644 (file)
@@ -39,18 +39,12 @@ typedef pthread_t THREADHANDLE;
 THREADHANDLE start_thread(void *(*start_routine)(void *),void *args);
 inline static THREADHANDLE thread_id() { return pthread_self(); }
 
-void unix_init_signals();
 void signal_handler(int signal, siginfo_t* siginfo, void* uap);
 void dump_stack_signal(int signal, siginfo_t* siginfo, void* uap);
 
 u64 system_micros();
 u64 nano_count();
 void sleep_nanos(u64 nsec);
-
-void init_platform_globals();
-
-void register_vm_with_thread(factor_vm *vm);
-factor_vm *tls_vm();
 void open_console();
 
 void move_file(const vm_char *path1, const vm_char *path2);
diff --git a/vm/os-windows-nt-x86.32.cpp b/vm/os-windows-nt-x86.32.cpp
new file mode 100644 (file)
index 0000000..61cf9f6
--- /dev/null
@@ -0,0 +1,12 @@
+#include "master.hpp"
+
+namespace factor
+{
+
+void factor_vm::c_to_factor_toplevel(cell quot)
+{
+       /* 32-bit Windows SEH is set up in basis/cpu/x86/32/winnt/bootstrap.factor */
+       c_to_factor(quot);
+}
+
+}
diff --git a/vm/os-windows-nt-x86.64.cpp b/vm/os-windows-nt-x86.64.cpp
new file mode 100644 (file)
index 0000000..876d0c5
--- /dev/null
@@ -0,0 +1,85 @@
+#include "master.hpp"
+
+namespace factor {
+
+typedef unsigned char UBYTE;
+
+const UBYTE UNW_FLAG_EHANDLER = 0x1;
+
+struct UNWIND_INFO {
+       UBYTE Version:3;
+       UBYTE Flags:5;
+       UBYTE SizeOfProlog;
+       UBYTE CountOfCodes;
+       UBYTE FrameRegister:4;
+       UBYTE FrameOffset:4;
+       ULONG ExceptionHandler;
+       ULONG ExceptionData[1];
+};
+
+struct seh_data {
+       UNWIND_INFO unwind_info;
+       RUNTIME_FUNCTION func;
+       UBYTE handler[32];
+};
+
+void factor_vm::c_to_factor_toplevel(cell quot)
+{
+       /* The annoying thing about Win64 SEH is that the offsets in
+        * function tables are 32-bit integers, and the exception handler
+        * itself must reside between the start and end pointers, so
+        * we stick everything at the beginning of the code heap and
+        * generate a small trampoline that jumps to the real
+        * exception handler. */
+
+       seh_data *seh_area = (seh_data *)code->seh_area;
+       cell base = code->seg->start;
+
+       /* Should look at generating this with the Factor assembler */
+
+       /* mov rax,0 */
+       seh_area->handler[0] = 0x48;
+       seh_area->handler[1] = 0xb8;
+       seh_area->handler[2] = 0x0;
+       seh_area->handler[3] = 0x0;
+       seh_area->handler[4] = 0x0;
+       seh_area->handler[5] = 0x0;
+       seh_area->handler[6] = 0x0;
+       seh_area->handler[7] = 0x0;
+       seh_area->handler[8] = 0x0;
+       seh_area->handler[9] = 0x0;
+
+       /* jmp rax */
+       seh_area->handler[10] = 0x48;
+       seh_area->handler[11] = 0xff;
+       seh_area->handler[12] = 0xe0;
+
+       /* Store address of exception handler in the operand of the 'mov' */
+       cell handler = (cell)&factor::exception_handler;
+       memcpy(&seh_area->handler[2],&handler,sizeof(cell));
+
+       UNWIND_INFO *unwind_info = &seh_area->unwind_info;
+       unwind_info->Version = 1;
+       unwind_info->Flags = UNW_FLAG_EHANDLER;
+       unwind_info->SizeOfProlog = 0;
+       unwind_info->CountOfCodes = 0;
+       unwind_info->FrameRegister = 0;
+       unwind_info->FrameOffset = 0;
+       unwind_info->ExceptionHandler = (DWORD)((cell)&seh_area->handler[0] - base);
+       unwind_info->ExceptionData[0] = 0;
+
+       RUNTIME_FUNCTION *func = &seh_area->func;
+       func->BeginAddress = 0;
+       func->EndAddress = (DWORD)(code->seg->end - base);
+       func->UnwindData = (DWORD)((cell)&seh_area->unwind_info - base);
+
+       if(!RtlAddFunctionTable(func,1,base))
+               fatal_error("RtlAddFunctionTable() failed",0);
+
+       c_to_factor(quot);
+
+       if(!RtlDeleteFunctionTable(func))
+               fatal_error("RtlDeleteFunctionTable() failed",0);
+}
+
+}
index 07d428fb4925a7bd33b23f6aecb522945213ea98..97cd2146afe50b54b5dc3910ea65a36574a521dc 100755 (executable)
@@ -8,27 +8,6 @@ THREADHANDLE start_thread(void *(*start_routine)(void *), void *args)
        return (void *)CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)start_routine, args, 0, 0);
 }
 
-DWORD dwTlsIndex; 
-
-void init_platform_globals()
-{
-       if ((dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES)
-               fatal_error("TlsAlloc failed - out of indexes",0);
-}
-
-void register_vm_with_thread(factor_vm *vm)
-{
-       if (! TlsSetValue(dwTlsIndex, vm))
-               fatal_error("TlsSetValue failed",0);
-}
-
-factor_vm *tls_vm()
-{
-       factor_vm *vm = (factor_vm*)TlsGetValue(dwTlsIndex);
-       assert(vm != NULL);
-       return vm;
-}
-
 u64 system_micros()
 {
        FILETIME t;
@@ -39,17 +18,24 @@ u64 system_micros()
 
 u64 nano_count()
 {
-       LARGE_INTEGER count;
-       LARGE_INTEGER frequency;
+       static double scale_factor;
+
        static u32 hi = 0;
        static u32 lo = 0;
-       BOOL ret;
-       ret = QueryPerformanceCounter(&count);
+
+       LARGE_INTEGER count;
+       BOOL ret = QueryPerformanceCounter(&count);
        if(ret == 0)
                fatal_error("QueryPerformanceCounter", 0);
-       ret = QueryPerformanceFrequency(&frequency);
-       if(ret == 0)
-               fatal_error("QueryPerformanceFrequency", 0);
+
+       if(scale_factor == 0.0)
+       {
+               LARGE_INTEGER frequency;
+               BOOL ret = QueryPerformanceFrequency(&frequency);
+               if(ret == 0)
+                       fatal_error("QueryPerformanceFrequency", 0);
+               scale_factor = (1000000000.0 / frequency.QuadPart);
+       }
 
 #ifdef FACTOR_64
        hi = count.HighPart;
@@ -61,7 +47,7 @@ u64 nano_count()
 #endif
        lo = count.LowPart;
 
-       return (u64)((((u64)hi << 32) | (u64)lo)*(1000000000.0/frequency.QuadPart));
+       return (u64)((((u64)hi << 32) | (u64)lo) * scale_factor);
 }
 
 void sleep_nanos(u64 nsec)
@@ -69,15 +55,10 @@ void sleep_nanos(u64 nsec)
        Sleep((DWORD)(nsec/1000000));
 }
 
-LONG factor_vm::exception_handler(PEXCEPTION_POINTERS pe)
+LONG factor_vm::exception_handler(PEXCEPTION_RECORD e, void *frame, PCONTEXT c, void *dispatch)
 {
-       PEXCEPTION_RECORD e = (PEXCEPTION_RECORD)pe->ExceptionRecord;
-       CONTEXT *c = (CONTEXT*)pe->ContextRecord;
-
-       if(in_code_heap_p(c->EIP))
-               signal_callstack_top = (stack_frame *)c->ESP;
-       else
-               signal_callstack_top = NULL;
+       c->ESP = (cell)fix_callstack_top((stack_frame *)c->ESP);
+       signal_callstack_top = (stack_frame *)c->ESP;
 
        switch (e->ExceptionCode)
        {
@@ -104,35 +85,18 @@ LONG factor_vm::exception_handler(PEXCEPTION_POINTERS pe)
                MXCSR(c) &= 0xffffffc0;
                c->EIP = (cell)factor::fp_signal_handler_impl;
                break;
-       case 0x40010006:
-               /* If the Widcomm bluetooth stack is installed, the BTTray.exe
-               process injects code into running programs. For some reason this
-               results in random SEH exceptions with this (undocumented)
-               exception code being raised. The workaround seems to be ignoring
-               this altogether, since that is what happens if SEH is not
-               enabled. Don't really have any idea what this exception means. */
-               break;
        default:
                signal_number = e->ExceptionCode;
                c->EIP = (cell)factor::misc_signal_handler_impl;
                break;
        }
-       return EXCEPTION_CONTINUE_EXECUTION;
-}
 
-FACTOR_STDCALL(LONG) exception_handler(PEXCEPTION_POINTERS pe)
-{
-       return tls_vm()->exception_handler(pe);
+       return 0;
 }
 
-void factor_vm::c_to_factor_toplevel(cell quot)
+VM_C_API LONG exception_handler(PEXCEPTION_RECORD e, void *frame, PCONTEXT c, void *dispatch)
 {
-       if(!AddVectoredExceptionHandler(0, (PVECTORED_EXCEPTION_HANDLER)factor::exception_handler))
-               fatal_error("AddVectoredExceptionHandler failed", 0);
-
-       c_to_factor(quot);
-
-       RemoveVectoredExceptionHandler((void *)factor::exception_handler);
+       return current_vm()->exception_handler(e,frame,c,dispatch);
 }
 
 void factor_vm::open_console()
index 8ad34ed147c7011d1eb94363343c82a7183043bf..60990c0986510a6188daf1bb5887667fd12b9488 100755 (executable)
@@ -20,15 +20,9 @@ typedef char symbol_char;
 
 #define FACTOR_OS_STRING "winnt"
 
-#define FACTOR_DLL L"factor.dll"
+#define FACTOR_DLL NULL
 
-#ifdef _MSC_VER
-       #define FACTOR_STDCALL(return_type) return_type __stdcall
-#else
-       #define FACTOR_STDCALL(return_type) __attribute__((stdcall)) return_type
-#endif
-
-FACTOR_STDCALL(LONG) exception_handler(PEXCEPTION_POINTERS pe);
+VM_C_API LONG exception_handler(PEXCEPTION_RECORD e, void *frame, PCONTEXT c, void *dispatch);
 
 // SSE traps raise these exception codes, which are defined in internal NT headers
 // but not winbase.h
@@ -45,8 +39,4 @@ typedef HANDLE THREADHANDLE;
 THREADHANDLE start_thread(void *(*start_routine)(void *),void *args);
 inline static THREADHANDLE thread_id() { return GetCurrentThread(); }
 
-void init_platform_globals();
-void register_vm_with_thread(factor_vm *vm);
-factor_vm *tls_vm();
-
 }
index 08f59321725f63cb0d1224b16a8d81c051a648d3..1ff1b174b5b3a80d380a134f9733b49b4f89bb24 100755 (executable)
@@ -140,7 +140,9 @@ long getpagesize()
 void factor_vm::move_file(const vm_char *path1, const vm_char *path2)
 {
        if(MoveFileEx((path1),(path2),MOVEFILE_REPLACE_EXISTING) == false)
-               general_error(ERROR_IO,tag_fixnum(GetLastError()),false_object,NULL);
+               general_error(ERROR_IO,tag_fixnum(GetLastError()),false_object);
 }
 
+void factor_vm::init_signals() {}
+
 }
index 92a3c73a99ed42f96c215bc995dacca2e48f9b0b..020a506038dc4d001531867c6b6c9bb62f6af0c8 100755 (executable)
@@ -43,7 +43,6 @@ typedef wchar_t vm_char;
 /* Difference between Jan 1 00:00:00 1601 and Jan 1 00:00:00 1970 */
 #define EPOCH_OFFSET 0x019db1ded53e8000LL
 
-inline static void init_signals() {}
 inline static void early_init() {}
 
 u64 system_micros();
index 2a38c911715c776a3cdda93646f0f26809681de6..e5a07a05d426e5ac580e8aab98faae2563fcd29f 100755 (executable)
@@ -3,8 +3,8 @@
                #include "os-windows-ce.hpp"
                #include "os-windows.hpp"
        #elif defined(WINNT)
-               #include "os-windows-nt.hpp"
                #include "os-windows.hpp"
+               #include "os-windows-nt.hpp"
 
                #if defined(FACTOR_AMD64)
                        #include "os-windows-nt.64.hpp"
@@ -48,6 +48,7 @@
                        #endif
                #elif defined(__OpenBSD__)
                        #define FACTOR_OS_STRING "openbsd"
+                       #include "os-openbsd.hpp"
 
                        #if defined(FACTOR_X86)
                                #include "os-openbsd-x86.32.hpp"
@@ -58,6 +59,7 @@
                        #endif
                #elif defined(__NetBSD__)
                        #define FACTOR_OS_STRING "netbsd"
+                       #include "os-netbsd.hpp"
 
                        #if defined(FACTOR_X86)
                                #include "os-netbsd-x86.32.hpp"
@@ -67,7 +69,6 @@
                                #error "Unsupported NetBSD flavor"
                        #endif
 
-                       #include "os-netbsd.hpp"
                #elif defined(linux)
                        #define FACTOR_OS_STRING "linux"
                        #include "os-linux.hpp"
index be9d5c6ff6e2d809731b2fb2ec4943093b22e475..104b180341a60741f88309663c1c75709aabac4c 100644 (file)
@@ -8,129 +8,6 @@ namespace factor
        parent->primitive_##name(); \
 }
 
-PRIMITIVE(alien_address)
-PRIMITIVE(all_instances)
-PRIMITIVE(array)
-PRIMITIVE(array_to_quotation)
-PRIMITIVE(become)
-PRIMITIVE(bignum_add)
-PRIMITIVE(bignum_and)
-PRIMITIVE(bignum_bitp)
-PRIMITIVE(bignum_divint)
-PRIMITIVE(bignum_divmod)
-PRIMITIVE(bignum_eq)
-PRIMITIVE(bignum_greater)
-PRIMITIVE(bignum_greatereq)
-PRIMITIVE(bignum_less)
-PRIMITIVE(bignum_lesseq)
-PRIMITIVE(bignum_log2)
-PRIMITIVE(bignum_mod)
-PRIMITIVE(bignum_multiply)
-PRIMITIVE(bignum_not)
-PRIMITIVE(bignum_or)
-PRIMITIVE(bignum_shift)
-PRIMITIVE(bignum_subtract)
-PRIMITIVE(bignum_to_fixnum)
-PRIMITIVE(bignum_to_float)
-PRIMITIVE(bignum_xor)
-PRIMITIVE(bits_double)
-PRIMITIVE(bits_float)
-PRIMITIVE(byte_array)
-PRIMITIVE(byte_array_to_bignum)
-PRIMITIVE(call_clear)
-PRIMITIVE(callback)
-PRIMITIVE(callstack)
-PRIMITIVE(callstack_to_array)
-PRIMITIVE(check_datastack)
-PRIMITIVE(clone)
-PRIMITIVE(code_blocks)
-PRIMITIVE(code_room)
-PRIMITIVE(compact_gc)
-PRIMITIVE(compute_identity_hashcode)
-PRIMITIVE(data_room)
-PRIMITIVE(datastack)
-PRIMITIVE(die)
-PRIMITIVE(disable_gc_events)
-PRIMITIVE(dispatch_stats)
-PRIMITIVE(displaced_alien)
-PRIMITIVE(dlclose)
-PRIMITIVE(dll_validp)
-PRIMITIVE(dlopen)
-PRIMITIVE(dlsym)
-PRIMITIVE(double_bits)
-PRIMITIVE(enable_gc_events)
-PRIMITIVE(existsp)
-PRIMITIVE(exit)
-PRIMITIVE(fclose)
-PRIMITIVE(fflush)
-PRIMITIVE(fgetc)
-PRIMITIVE(fixnum_divint)
-PRIMITIVE(fixnum_divmod)
-PRIMITIVE(fixnum_shift)
-PRIMITIVE(fixnum_to_bignum)
-PRIMITIVE(fixnum_to_float)
-PRIMITIVE(float_add)
-PRIMITIVE(float_bits)
-PRIMITIVE(float_divfloat)
-PRIMITIVE(float_eq)
-PRIMITIVE(float_greater)
-PRIMITIVE(float_greatereq)
-PRIMITIVE(float_less)
-PRIMITIVE(float_lesseq)
-PRIMITIVE(float_mod)
-PRIMITIVE(float_multiply)
-PRIMITIVE(float_subtract)
-PRIMITIVE(float_to_bignum)
-PRIMITIVE(float_to_fixnum)
-PRIMITIVE(float_to_str)
-PRIMITIVE(fopen)
-PRIMITIVE(fputc)
-PRIMITIVE(fread)
-PRIMITIVE(fseek)
-PRIMITIVE(ftell)
-PRIMITIVE(full_gc)
-PRIMITIVE(fwrite)
-PRIMITIVE(identity_hashcode)
-PRIMITIVE(innermost_stack_frame_executing)
-PRIMITIVE(innermost_stack_frame_scan)
-PRIMITIVE(jit_compile)
-PRIMITIVE(load_locals)
-PRIMITIVE(lookup_method)
-PRIMITIVE(mega_cache_miss)
-PRIMITIVE(minor_gc)
-PRIMITIVE(modify_code_heap)
-PRIMITIVE(nano_count)
-PRIMITIVE(optimized_p)
-PRIMITIVE(profiling)
-PRIMITIVE(quot_compiled_p)
-PRIMITIVE(quotation_code)
-PRIMITIVE(reset_dispatch_stats)
-PRIMITIVE(resize_array)
-PRIMITIVE(resize_byte_array)
-PRIMITIVE(resize_string)
-PRIMITIVE(retainstack)
-PRIMITIVE(save_image)
-PRIMITIVE(save_image_and_exit)
-PRIMITIVE(set_datastack)
-PRIMITIVE(set_innermost_stack_frame_quot)
-PRIMITIVE(set_retainstack)
-PRIMITIVE(set_slot)
-PRIMITIVE(set_special_object)
-PRIMITIVE(set_string_nth_fast)
-PRIMITIVE(set_string_nth_slow)
-PRIMITIVE(size)
-PRIMITIVE(sleep)
-PRIMITIVE(special_object)
-PRIMITIVE(string)
-PRIMITIVE(string_nth)
-PRIMITIVE(strip_stack_traces)
-PRIMITIVE(system_micros)
-PRIMITIVE(tuple)
-PRIMITIVE(tuple_boa)
-PRIMITIVE(unimplemented)
-PRIMITIVE(uninitialized_byte_array)
-PRIMITIVE(word)
-PRIMITIVE(word_code)
-PRIMITIVE(wrapper)
+EACH_PRIMITIVE(PRIMITIVE)
 
 }
index 520df423a14833de4085e1ec079c012328e9d7e2..9cda1db9a8d68e919de8397c1d485848f52a6399 100644 (file)
 namespace factor
 {
 
-#define DECLARE_PRIMITIVE(name) VM_C_API void primitive_##name(factor_vm *parent);
-
 /* Generated with PRIMITIVE in primitives.cpp */
-DECLARE_PRIMITIVE(alien_address)
-DECLARE_PRIMITIVE(all_instances)
-DECLARE_PRIMITIVE(array)
-DECLARE_PRIMITIVE(array_to_quotation)
-DECLARE_PRIMITIVE(become)
-DECLARE_PRIMITIVE(bignum_add)
-DECLARE_PRIMITIVE(bignum_and)
-DECLARE_PRIMITIVE(bignum_bitp)
-DECLARE_PRIMITIVE(bignum_divint)
-DECLARE_PRIMITIVE(bignum_divmod)
-DECLARE_PRIMITIVE(bignum_eq)
-DECLARE_PRIMITIVE(bignum_greater)
-DECLARE_PRIMITIVE(bignum_greatereq)
-DECLARE_PRIMITIVE(bignum_less)
-DECLARE_PRIMITIVE(bignum_lesseq)
-DECLARE_PRIMITIVE(bignum_log2)
-DECLARE_PRIMITIVE(bignum_mod)
-DECLARE_PRIMITIVE(bignum_multiply)
-DECLARE_PRIMITIVE(bignum_not)
-DECLARE_PRIMITIVE(bignum_or)
-DECLARE_PRIMITIVE(bignum_shift)
-DECLARE_PRIMITIVE(bignum_subtract)
-DECLARE_PRIMITIVE(bignum_to_fixnum)
-DECLARE_PRIMITIVE(bignum_to_float)
-DECLARE_PRIMITIVE(bignum_xor)
-DECLARE_PRIMITIVE(bits_double)
-DECLARE_PRIMITIVE(bits_float)
-DECLARE_PRIMITIVE(byte_array)
-DECLARE_PRIMITIVE(byte_array_to_bignum)
-DECLARE_PRIMITIVE(call_clear)
-DECLARE_PRIMITIVE(callback)
-DECLARE_PRIMITIVE(callstack)
-DECLARE_PRIMITIVE(callstack_to_array)
-DECLARE_PRIMITIVE(check_datastack)
-DECLARE_PRIMITIVE(clone)
-DECLARE_PRIMITIVE(code_blocks)
-DECLARE_PRIMITIVE(code_room)
-DECLARE_PRIMITIVE(compact_gc)
-DECLARE_PRIMITIVE(compute_identity_hashcode)
-DECLARE_PRIMITIVE(data_room)
-DECLARE_PRIMITIVE(datastack)
-DECLARE_PRIMITIVE(die)
-DECLARE_PRIMITIVE(disable_gc_events)
-DECLARE_PRIMITIVE(dispatch_stats)
-DECLARE_PRIMITIVE(displaced_alien)
-DECLARE_PRIMITIVE(dlclose)
-DECLARE_PRIMITIVE(dll_validp)
-DECLARE_PRIMITIVE(dlopen)
-DECLARE_PRIMITIVE(dlsym)
-DECLARE_PRIMITIVE(double_bits)
-DECLARE_PRIMITIVE(enable_gc_events)
-DECLARE_PRIMITIVE(existsp)
-DECLARE_PRIMITIVE(exit)
-DECLARE_PRIMITIVE(fclose)
-DECLARE_PRIMITIVE(fflush)
-DECLARE_PRIMITIVE(fgetc)
-DECLARE_PRIMITIVE(fixnum_divint)
-DECLARE_PRIMITIVE(fixnum_divmod)
-DECLARE_PRIMITIVE(fixnum_shift)
-DECLARE_PRIMITIVE(fixnum_to_bignum)
-DECLARE_PRIMITIVE(fixnum_to_float)
-DECLARE_PRIMITIVE(float_add)
-DECLARE_PRIMITIVE(float_bits)
-DECLARE_PRIMITIVE(float_divfloat)
-DECLARE_PRIMITIVE(float_eq)
-DECLARE_PRIMITIVE(float_greater)
-DECLARE_PRIMITIVE(float_greatereq)
-DECLARE_PRIMITIVE(float_less)
-DECLARE_PRIMITIVE(float_lesseq)
-DECLARE_PRIMITIVE(float_mod)
-DECLARE_PRIMITIVE(float_multiply)
-DECLARE_PRIMITIVE(float_subtract)
-DECLARE_PRIMITIVE(float_to_bignum)
-DECLARE_PRIMITIVE(float_to_fixnum)
-DECLARE_PRIMITIVE(float_to_str)
-DECLARE_PRIMITIVE(fopen)
-DECLARE_PRIMITIVE(fputc)
-DECLARE_PRIMITIVE(fread)
-DECLARE_PRIMITIVE(fseek)
-DECLARE_PRIMITIVE(ftell)
-DECLARE_PRIMITIVE(full_gc)
-DECLARE_PRIMITIVE(fwrite)
-DECLARE_PRIMITIVE(identity_hashcode)
-DECLARE_PRIMITIVE(innermost_stack_frame_executing)
-DECLARE_PRIMITIVE(innermost_stack_frame_scan)
-DECLARE_PRIMITIVE(jit_compile)
-DECLARE_PRIMITIVE(load_locals)
-DECLARE_PRIMITIVE(lookup_method)
-DECLARE_PRIMITIVE(mega_cache_miss)
-DECLARE_PRIMITIVE(minor_gc)
-DECLARE_PRIMITIVE(modify_code_heap)
-DECLARE_PRIMITIVE(nano_count)
-DECLARE_PRIMITIVE(optimized_p)
-DECLARE_PRIMITIVE(profiling)
-DECLARE_PRIMITIVE(quot_compiled_p)
-DECLARE_PRIMITIVE(quotation_code)
-DECLARE_PRIMITIVE(reset_dispatch_stats)
-DECLARE_PRIMITIVE(resize_array)
-DECLARE_PRIMITIVE(resize_byte_array)
-DECLARE_PRIMITIVE(resize_string)
-DECLARE_PRIMITIVE(retainstack)
-DECLARE_PRIMITIVE(save_image)
-DECLARE_PRIMITIVE(save_image_and_exit)
-DECLARE_PRIMITIVE(set_datastack)
-DECLARE_PRIMITIVE(set_innermost_stack_frame_quot)
-DECLARE_PRIMITIVE(set_retainstack)
-DECLARE_PRIMITIVE(set_slot)
-DECLARE_PRIMITIVE(set_special_object)
-DECLARE_PRIMITIVE(set_string_nth_fast)
-DECLARE_PRIMITIVE(set_string_nth_slow)
-DECLARE_PRIMITIVE(size)
-DECLARE_PRIMITIVE(sleep)
-DECLARE_PRIMITIVE(special_object)
-DECLARE_PRIMITIVE(string)
-DECLARE_PRIMITIVE(string_nth)
-DECLARE_PRIMITIVE(strip_stack_traces)
-DECLARE_PRIMITIVE(system_micros)
-DECLARE_PRIMITIVE(tuple)
-DECLARE_PRIMITIVE(tuple_boa)
-DECLARE_PRIMITIVE(unimplemented)
-DECLARE_PRIMITIVE(uninitialized_byte_array)
-DECLARE_PRIMITIVE(word)
-DECLARE_PRIMITIVE(word_code)
-DECLARE_PRIMITIVE(wrapper)
 
-/* These are generated with macros in alien.cpp, and not with PRIMIIVE in
-primitives.cpp */
-DECLARE_PRIMITIVE(alien_signed_cell)
-DECLARE_PRIMITIVE(set_alien_signed_cell)
-DECLARE_PRIMITIVE(alien_unsigned_cell)
-DECLARE_PRIMITIVE(set_alien_unsigned_cell)
-DECLARE_PRIMITIVE(alien_signed_8)
-DECLARE_PRIMITIVE(set_alien_signed_8)
-DECLARE_PRIMITIVE(alien_unsigned_8)
-DECLARE_PRIMITIVE(set_alien_unsigned_8)
-DECLARE_PRIMITIVE(alien_signed_4)
-DECLARE_PRIMITIVE(set_alien_signed_4)
-DECLARE_PRIMITIVE(alien_unsigned_4)
-DECLARE_PRIMITIVE(set_alien_unsigned_4)
-DECLARE_PRIMITIVE(alien_signed_2)
-DECLARE_PRIMITIVE(set_alien_signed_2)
-DECLARE_PRIMITIVE(alien_unsigned_2)
-DECLARE_PRIMITIVE(set_alien_unsigned_2)
-DECLARE_PRIMITIVE(alien_signed_1)
-DECLARE_PRIMITIVE(set_alien_signed_1)
-DECLARE_PRIMITIVE(alien_unsigned_1)
-DECLARE_PRIMITIVE(set_alien_unsigned_1)
-DECLARE_PRIMITIVE(alien_float)
-DECLARE_PRIMITIVE(set_alien_float)
-DECLARE_PRIMITIVE(alien_double)
-DECLARE_PRIMITIVE(set_alien_double)
-DECLARE_PRIMITIVE(alien_cell)
-DECLARE_PRIMITIVE(set_alien_cell)
+#define EACH_PRIMITIVE(_) \
+       _(alien_address) \
+       _(all_instances) \
+       _(array) \
+       _(array_to_quotation) \
+       _(become) \
+       _(bignum_add) \
+       _(bignum_and) \
+       _(bignum_bitp) \
+       _(bignum_divint) \
+       _(bignum_divmod) \
+       _(bignum_eq) \
+       _(bignum_greater) \
+       _(bignum_greatereq) \
+       _(bignum_less) \
+       _(bignum_lesseq) \
+       _(bignum_log2) \
+       _(bignum_mod) \
+       _(bignum_multiply) \
+       _(bignum_not) \
+       _(bignum_or) \
+       _(bignum_shift) \
+       _(bignum_subtract) \
+       _(bignum_to_fixnum) \
+       _(bignum_to_float) \
+       _(bignum_xor) \
+       _(bits_double) \
+       _(bits_float) \
+       _(byte_array) \
+       _(byte_array_to_bignum) \
+       _(callback) \
+       _(callstack) \
+       _(callstack_bounds) \
+       _(callstack_for) \
+       _(callstack_to_array) \
+       _(check_datastack) \
+       _(clone) \
+       _(code_blocks) \
+       _(code_room) \
+       _(compact_gc) \
+       _(compute_identity_hashcode) \
+       _(context_object) \
+       _(context_object_for) \
+       _(current_callback) \
+       _(data_room) \
+       _(datastack) \
+       _(datastack_for) \
+       _(die) \
+       _(disable_gc_events) \
+       _(dispatch_stats) \
+       _(displaced_alien) \
+       _(dlclose) \
+       _(dll_validp) \
+       _(dlopen) \
+       _(dlsym) \
+       _(double_bits) \
+       _(enable_gc_events) \
+       _(existsp) \
+       _(exit) \
+       _(fclose) \
+       _(fflush) \
+       _(fgetc) \
+       _(fixnum_divint) \
+       _(fixnum_divmod) \
+       _(fixnum_shift) \
+       _(fixnum_to_bignum) \
+       _(fixnum_to_float) \
+       _(float_add) \
+       _(float_bits) \
+       _(float_divfloat) \
+       _(float_eq) \
+       _(float_greater) \
+       _(float_greatereq) \
+       _(float_less) \
+       _(float_lesseq) \
+       _(float_mod) \
+       _(float_multiply) \
+       _(float_subtract) \
+       _(float_to_bignum) \
+       _(float_to_fixnum) \
+       _(fopen) \
+       _(format_float) \
+       _(fputc) \
+       _(fread) \
+       _(fseek) \
+       _(ftell) \
+       _(full_gc) \
+       _(fwrite) \
+       _(identity_hashcode) \
+       _(innermost_stack_frame_executing) \
+       _(innermost_stack_frame_scan) \
+       _(jit_compile) \
+       _(load_locals) \
+       _(lookup_method) \
+       _(mega_cache_miss) \
+       _(minor_gc) \
+       _(modify_code_heap) \
+       _(nano_count) \
+       _(optimized_p) \
+       _(profiling) \
+       _(quot_compiled_p) \
+       _(quotation_code) \
+       _(reset_dispatch_stats) \
+       _(resize_array) \
+       _(resize_byte_array) \
+       _(resize_string) \
+       _(retainstack) \
+       _(retainstack_for) \
+       _(save_image) \
+       _(save_image_and_exit) \
+       _(set_context_object) \
+       _(set_datastack) \
+       _(set_innermost_stack_frame_quot) \
+       _(set_retainstack) \
+       _(set_slot) \
+       _(set_special_object) \
+       _(set_string_nth_fast) \
+       _(size) \
+       _(sleep) \
+       _(special_object) \
+       _(string) \
+       _(strip_stack_traces) \
+       _(system_micros) \
+       _(tuple) \
+       _(tuple_boa) \
+       _(unimplemented) \
+       _(uninitialized_byte_array) \
+       _(word) \
+       _(word_code) \
+       _(wrapper)
+
+#define EACH_ALIEN_PRIMITIVE(_) \
+       _(signed_cell,fixnum,from_signed_cell,to_fixnum) \
+       _(unsigned_cell,cell,from_unsigned_cell,to_cell) \
+       _(signed_8,s64,from_signed_8,to_signed_8) \
+       _(unsigned_8,u64,from_unsigned_8,to_unsigned_8) \
+       _(signed_4,s32,from_signed_4,to_fixnum) \
+       _(unsigned_4,u32,from_unsigned_4,to_cell) \
+       _(signed_2,s16,from_signed_2,to_fixnum) \
+       _(unsigned_2,u16,from_unsigned_2,to_cell) \
+       _(signed_1,s8,from_signed_1,to_fixnum) \
+       _(unsigned_1,u8,from_unsigned_1,to_cell) \
+       _(float,float,allot_float,to_float) \
+       _(double,double,allot_float,to_double) \
+       _(cell,void *,allot_alien,pinned_alien_offset)
+
+#define DECLARE_PRIMITIVE(name) VM_C_API void primitive_##name(factor_vm *parent);
+
+#define DECLARE_ALIEN_PRIMITIVE(name, type, from, to) \
+       DECLARE_PRIMITIVE(alien_##name) \
+       DECLARE_PRIMITIVE(set_alien_##name)
 
+EACH_PRIMITIVE(DECLARE_PRIMITIVE)
+EACH_ALIEN_PRIMITIVE(DECLARE_ALIEN_PRIMITIVE)
 }
diff --git a/vm/safeseh.asm b/vm/safeseh.asm
new file mode 100755 (executable)
index 0000000..fb706c1
--- /dev/null
@@ -0,0 +1,5 @@
+.386\r
+.model flat\r
+exception_handler proto\r
+.safeseh exception_handler\r
+end\r
index 5cedada57803e9afe1962ef8ed31f13dab2c4d98..7f86c3548522d38213ab04a680bb44a6bf377037 100644 (file)
@@ -15,6 +15,16 @@ struct segment {
 
        explicit segment(cell size, bool executable_p);
        ~segment();
+
+       bool underflow_p(cell addr)
+       {
+               return (addr >= start - getpagesize() && addr < start);
+       }
+
+       bool overflow_p(cell addr)
+       {
+               return (addr >= end && addr < end + getpagesize());
+       }
 };
 
 }
index 0ab9cc171d703f36e0e4dee65f09c892f87bc822..d4dd44bed1a59b81cc78b5bdc50b04dedfb8ed75 100644 (file)
@@ -26,6 +26,7 @@ template<typename Visitor> struct slot_visitor {
 
        cell visit_pointer(cell pointer);
        void visit_handle(cell *handle);
+       void visit_object_array(cell *start, cell *end);
        void visit_slots(object *ptr, cell payload_start);
        void visit_slots(object *ptr);
        void visit_stack_elements(segment *region, cell *top);
@@ -55,6 +56,12 @@ void slot_visitor<Visitor>::visit_handle(cell *handle)
        *handle = visit_pointer(*handle);
 }
 
+template<typename Visitor>
+void slot_visitor<Visitor>::visit_object_array(cell *start, cell *end)
+{
+       while(start < end) visit_handle(start++);
+}
+
 template<typename Visitor>
 void slot_visitor<Visitor>::visit_slots(object *ptr, cell payload_start)
 {
@@ -64,7 +71,7 @@ void slot_visitor<Visitor>::visit_slots(object *ptr, cell payload_start)
        if(slot != end)
        {
                slot++;
-               for(; slot < end; slot++) visit_handle(slot);
+               visit_object_array(slot,end);
        }
 }
 
@@ -77,8 +84,7 @@ void slot_visitor<Visitor>::visit_slots(object *ptr)
 template<typename Visitor>
 void slot_visitor<Visitor>::visit_stack_elements(segment *region, cell *top)
 {
-       for(cell *ptr = (cell *)region->start; ptr <= top; ptr++)
-               visit_handle(ptr);
+       visit_object_array((cell *)region->start,top + 1);
 }
 
 template<typename Visitor>
@@ -88,11 +94,7 @@ void slot_visitor<Visitor>::visit_data_roots()
        std::vector<data_root_range>::const_iterator end = parent->data_roots.end();
 
        for(; iter < end; iter++)
-       {
-               data_root_range r = *iter;
-               for(cell index = 0; index < r.len; index++)
-                       visit_handle(r.start + index);
-       }
+               visit_object_array(iter->start,iter->start + iter->len);
 }
 
 template<typename Visitor>
@@ -162,24 +164,23 @@ void slot_visitor<Visitor>::visit_roots()
        visit_callback_roots();
        visit_literal_table_roots();
 
-       for(cell i = 0; i < special_object_count; i++)
-               visit_handle(&parent->special_objects[i]);
+       visit_object_array(parent->special_objects,parent->special_objects + special_object_count);
 }
 
 template<typename Visitor>
 void slot_visitor<Visitor>::visit_contexts()
 {
-       context *ctx = parent->ctx;
-
-       while(ctx)
+       std::set<context *>::const_iterator begin = parent->active_contexts.begin();
+       std::set<context *>::const_iterator end = parent->active_contexts.end();
+       while(begin != end)
        {
-               visit_stack_elements(ctx->datastack_region,(cell *)ctx->datastack);
-               visit_stack_elements(ctx->retainstack_region,(cell *)ctx->retainstack);
+               context *ctx = *begin;
 
-               visit_handle(&ctx->catchstack_save);
-               visit_handle(&ctx->current_callback_save);
+               visit_stack_elements(ctx->datastack_seg,(cell *)ctx->datastack);
+               visit_stack_elements(ctx->retainstack_seg,(cell *)ctx->retainstack);
+               visit_object_array(ctx->context_objects,ctx->context_objects + context_object_count);
 
-               ctx = ctx->next;
+               begin++;
        }
 }
 
index 5aad936a9eb3e378efad85517bb6ab314a16c7a1..aea4641905a85725bb7ea225842e4a12df7a21e7 100644 (file)
@@ -3,66 +3,6 @@
 namespace factor
 {
 
-cell string::nth(cell index) const
-{
-       /* If high bit is set, the most significant 16 bits of the char
-       come from the aux vector. The least significant bit of the
-       corresponding aux vector entry is negated, so that we can
-       XOR the two components together and get the original code point
-       back. */
-       cell lo_bits = data()[index];
-
-       if((lo_bits & 0x80) == 0)
-               return lo_bits;
-       else
-       {
-               byte_array *aux = untag<byte_array>(this->aux);
-               cell hi_bits = aux->data<u16>()[index];
-               return (hi_bits << 7) ^ lo_bits;
-       }
-}
-
-void factor_vm::set_string_nth_fast(string *str, cell index, cell ch)
-{
-       str->data()[index] = (u8)ch;
-}
-
-void factor_vm::set_string_nth_slow(string *str_, cell index, cell ch)
-{
-       data_root<string> str(str_,this);
-
-       byte_array *aux;
-
-       str->data()[index] = ((ch & 0x7f) | 0x80);
-
-       if(to_boolean(str->aux))
-               aux = untag<byte_array>(str->aux);
-       else
-       {
-               /* We don't need to pre-initialize the
-               byte array with any data, since we
-               only ever read from the aux vector
-               if the most significant bit of a
-               character is set. Initially all of
-               the bits are clear. */
-               aux = allot_uninitialized_array<byte_array>(untag_fixnum(str->length) * sizeof(u16));
-
-               str->aux = tag<byte_array>(aux);
-               write_barrier(&str->aux);
-       }
-
-       aux->data<u16>()[index] = (u16)((ch >> 7) ^ 1);
-}
-
-/* allocates memory */
-void factor_vm::set_string_nth(string *str, cell index, cell ch)
-{
-       if(ch <= 0x7f)
-               set_string_nth_fast(str,index,ch);
-       else
-               set_string_nth_slow(str,index,ch);
-}
-
 /* Allocates memory */
 string *factor_vm::allot_string_internal(cell capacity)
 {
@@ -81,13 +21,23 @@ void factor_vm::fill_string(string *str_, cell start, cell capacity, cell fill)
        data_root<string> str(str_,this);
 
        if(fill <= 0x7f)
-               memset(&str->data()[start],(int)fill,capacity - start);
+               memset(&str->data()[start],(u8)fill,capacity - start);
        else
        {
-               cell i;
+               byte_array *aux;
+               if(to_boolean(str->aux))
+                       aux = untag<byte_array>(str->aux);
+               else
+               {
+                       aux = allot_uninitialized_array<byte_array>(untag_fixnum(str->length) * 2);
+                       str->aux = tag<byte_array>(aux);
+                       write_barrier(&str->aux);
+               }
 
-               for(i = start; i < capacity; i++)
-                       set_string_nth(str.untagged(),i,fill);
+               u8 lo_fill = (u8)((fill & 0x7f) | 0x80);
+               u16 hi_fill = (u16)((fill >> 7) ^ 0x1);
+               memset(&str->data()[start],lo_fill,capacity - start);
+               memset_2(&aux->data<u16>()[start],hi_fill,(capacity - start) * sizeof(u16));
        }
 }
 
@@ -141,8 +91,7 @@ string* factor_vm::reallot_string(string *str_, cell capacity)
 
                if(to_boolean(str->aux))
                {
-                       byte_array *new_aux = allot_byte_array(capacity * sizeof(u16));
-
+                       byte_array *new_aux = allot_uninitialized_array<byte_array>(capacity * 2);
                        new_str->aux = tag<byte_array>(new_aux);
                        write_barrier(&new_str->aux);
 
@@ -163,27 +112,12 @@ void factor_vm::primitive_resize_string()
        ctx->push(tag<string>(reallot_string(str.untagged(),capacity)));
 }
 
-void factor_vm::primitive_string_nth()
-{
-       string *str = untag<string>(ctx->pop());
-       cell index = untag_fixnum(ctx->pop());
-       ctx->push(tag_fixnum(str->nth(index)));
-}
-
 void factor_vm::primitive_set_string_nth_fast()
 {
        string *str = untag<string>(ctx->pop());
        cell index = untag_fixnum(ctx->pop());
        cell value = untag_fixnum(ctx->pop());
-       set_string_nth_fast(str,index,value);
-}
-
-void factor_vm::primitive_set_string_nth_slow()
-{
-       string *str = untag<string>(ctx->pop());
-       cell index = untag_fixnum(ctx->pop());
-       cell value = untag_fixnum(ctx->pop());
-       set_string_nth_slow(str,index,value);
+       str->data()[index] = (u8)value;
 }
 
 }
index cea70c0c372e755468ae2a5095b75a55ffa7bdb3..e75d3ece123f7423946953eb506cc2dbd14280eb 100755 (executable)
@@ -1,6 +1,27 @@
 namespace factor
 {
 
+inline static void memset_2(void *dst, u16 pattern, size_t size)
+{
+#ifdef __APPLE__
+       cell cell_pattern = (pattern | (pattern << 16));
+       memset_pattern4(dst,&cell_pattern,size);
+#else
+       if(pattern == 0)
+               memset(dst,0,size);
+       else
+       {
+               u16 *start = (u16 *)dst;
+               u16 *end = (u16 *)((cell)dst + size);
+               while(start < end)
+               {
+                       *start = pattern;
+                       start++;
+               }
+       }
+#endif
+}
+
 inline static void memset_cell(void *dst, cell pattern, size_t size)
 {
 #ifdef __APPLE__
index be43371087b969b3454ac1a42f149ea05387efe7..e9ade19cc6f3bfc362e36b12d3e2dead26a231b1 100755 (executable)
--- a/vm/vm.cpp
+++ b/vm/vm.cpp
@@ -5,6 +5,7 @@ namespace factor
 
 factor_vm::factor_vm() :
        nursery(0,0),
+       callback_id(0),
        c_to_factor_func(NULL),
        profiling_p(false),
        gc_off(false),
@@ -12,9 +13,20 @@ factor_vm::factor_vm() :
        gc_events(NULL),
        fep_disabled(false),
        full_output(false),
-       last_nano_count(0)
+       last_nano_count(0),
+       signal_callstack_seg(NULL)
 {
        primitive_reset_dispatch_stats();
 }
 
+factor_vm::~factor_vm()
+{
+       delete_contexts();
+       if(signal_callstack_seg)
+       {
+               delete signal_callstack_seg;
+               signal_callstack_seg = NULL;
+       }
+}
+
 }
index 714794aa32606a530262ff689ce96339fda8be1b..645e748ea45af82dc102a0462544526f24389dee 100755 (executable)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -6,11 +6,14 @@ struct code_root;
 
 struct factor_vm
 {
-       // First five fields accessed directly by assembler. See vm.factor
+       // First 5 fields accessed directly by compiler. See basis/vm/vm.factor
 
-       /* Current stacks */
+       /* Current context */
        context *ctx;
-       
+
+       /* Spare context -- for callbacks */
+       context *spare_ctx;
+
        /* New objects are allocated here */
        nursery_space nursery;
 
@@ -18,14 +21,24 @@ struct factor_vm
        cell cards_offset;
        cell decks_offset;
 
-       /* TAGGED user environment data; see getenv/setenv prims */
+       /* Various special objects, accessed by special-object and
+       set-special-object primitives */
        cell special_objects[special_object_count];
 
        /* Data stack and retain stack sizes */
-       cell ds_size, rs_size;
+       cell datastack_size, retainstack_size, callstack_size;
+
+       /* Stack of callback IDs */
+       std::vector<int> callback_ids;
+
+       /* Next callback ID */
+       int callback_id;
 
-       /* Pooling unused contexts to make callbacks cheaper */
-       context *unused_contexts;
+       /* Pooling unused contexts to make context allocation cheaper */
+       std::vector<context *> unused_contexts;
+
+       /* Active contexts, for tracing by the GC */
+       std::set<context *> active_contexts;
 
        /* Canonical truth value. In Factor, 't' */
        cell true_object;
@@ -94,30 +107,41 @@ struct factor_vm
        decrease */
        u64 last_nano_count;
 
+       /* Stack for signal handlers, only used on Unix */
+       segment *signal_callstack_seg;
+
        // contexts
-       context *alloc_context();
-       void dealloc_context(context *old_context);
-       void nest_stacks();
-       void unnest_stacks();
-       void init_stacks(cell ds_size_, cell rs_size_);
-       bool stack_to_array(cell bottom, cell top);
-       cell array_to_stack(array *array, cell bottom);
+       context *new_context();
+       void init_context(context *ctx);
+       void delete_context(context *old_context);
+       void init_contexts(cell datastack_size_, cell retainstack_size_, cell callstack_size_);
+       void delete_contexts();
+       cell begin_callback(cell quot);
+       void end_callback();
+       void primitive_current_callback();
+       void primitive_context_object();
+       void primitive_context_object_for();
+       void primitive_set_context_object();
+       cell stack_to_array(cell bottom, cell top);
+       cell datastack_to_array(context *ctx);
        void primitive_datastack();
+       void primitive_datastack_for();
+       cell retainstack_to_array(context *ctx);
        void primitive_retainstack();
+       void primitive_retainstack_for();
+       cell array_to_stack(array *array, cell bottom);
+       void set_datastack(context *ctx, array *array);
        void primitive_set_datastack();
+       void set_retainstack(context *ctx, array *array);
        void primitive_set_retainstack();
        void primitive_check_datastack();
        void primitive_load_locals();
 
-       template<typename Iterator> void iterate_active_frames(Iterator &iter)
+       template<typename Iterator> void iterate_active_callstacks(Iterator &iter)
        {
-               context *ctx = this->ctx;
-
-               while(ctx)
-               {
-                       iterate_callstack(ctx,iter);
-                       ctx = ctx->next;
-               }
+               std::set<context *>::const_iterator begin = active_contexts.begin();
+               std::set<context *>::const_iterator end = active_contexts.end();
+               while(begin != end) iterate_callstack(*begin++,iter);
        }
 
        // run
@@ -145,20 +169,19 @@ struct factor_vm
        void primitive_profiling();
 
        // errors
-       void throw_error(cell error, stack_frame *callstack_top);
+       void throw_error(cell error, stack_frame *stack);
+       void general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *stack);
+       void general_error(vm_error_type error, cell arg1, cell arg2);
+       void type_error(cell type, cell tagged);
        void not_implemented_error();
-       bool in_page(cell fault, cell area, cell area_size, int offset);
-       void memory_protection_error(cell addr, stack_frame *native_stack);
-       void signal_error(cell signal, stack_frame *native_stack);
+       void memory_protection_error(cell addr, stack_frame *stack);
+       void signal_error(cell signal, stack_frame *stack);
        void divide_by_zero_error();
-       void fp_trap_error(unsigned int fpu_status, stack_frame *signal_callstack_top);
-       void primitive_call_clear();
+       void fp_trap_error(unsigned int fpu_status, stack_frame *stack);
        void primitive_unimplemented();
        void memory_signal_handler_impl();
        void misc_signal_handler_impl();
        void fp_signal_handler_impl();
-       void type_error(cell type, cell tagged);
-       void general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *native_stack);
 
        // bignum
        int bignum_equal_p(bignum * x, bignum * y);
@@ -297,7 +320,7 @@ struct factor_vm
        void primitive_minor_gc();
        void primitive_full_gc();
        void primitive_compact_gc();
-       void inline_gc(cell *data_roots_base, cell data_roots_size);
+       void inline_gc(cell gc_roots);
        void primitive_enable_gc_events();
        void primitive_disable_gc_events();
        object *allot_object(cell type, cell size);
@@ -324,7 +347,7 @@ struct factor_vm
        template<typename Array> bool reallot_array_in_place_p(Array *array, cell capacity);
        template<typename Array> Array *reallot_array(Array *array_, cell capacity);
 
-       //debug
+       // debug
        void print_chars(string* str);
        void print_word(word* word, cell nesting);
        void print_factor_string(string* str);
@@ -347,7 +370,7 @@ struct factor_vm
        void factorbug();
        void primitive_die();
 
-       //arrays
+       // arrays
        inline void set_array_nth(array *array, cell slot, cell value);
        array *allot_array(cell capacity, cell fill_);
        void primitive_array();
@@ -357,11 +380,7 @@ struct factor_vm
        void primitive_resize_array();
        cell std_vector_to_array(std::vector<cell> &elements);
 
-       //strings
-       cell string_nth(const string *str, cell index);
-       void set_string_nth_fast(string *str, cell index, cell ch);
-       void set_string_nth_slow(string *str_, cell index, cell ch);
-       void set_string_nth(string *str, cell index, cell ch);
+       // strings
        string *allot_string_internal(cell capacity);
        void fill_string(string *str_, cell start, cell capacity, cell fill);
        string *allot_string(cell capacity, cell fill);
@@ -369,17 +388,15 @@ struct factor_vm
        bool reallot_string_in_place_p(string *str, cell capacity);
        string* reallot_string(string *str_, cell capacity);
        void primitive_resize_string();
-       void primitive_string_nth();
        void primitive_set_string_nth_fast();
-       void primitive_set_string_nth_slow();
 
-       //booleans
+       // booleans
        cell tag_boolean(cell untagged)
        {
                return (untagged ? true_object : false_object);
        }
 
-       //byte arrays
+       // byte arrays
        byte_array *allot_byte_array(cell size);
        void primitive_byte_array();
        void primitive_uninitialized_byte_array();
@@ -387,11 +404,11 @@ struct factor_vm
 
        template<typename Type> byte_array *byte_array_from_value(Type *value);
 
-       //tuples
+       // tuples
        void primitive_tuple();
        void primitive_tuple_boa();
 
-       //words
+       // words
        word *allot_word(cell name_, cell vocab_, cell hashcode_);
        void primitive_word();
        void primitive_word_code();
@@ -402,7 +419,7 @@ struct factor_vm
        cell find_all_words();
        void compile_all_words();
 
-       //math
+       // math
        void primitive_bignum_to_fixnum();
        void primitive_float_to_fixnum();
        void primitive_fixnum_divint();
@@ -441,7 +458,7 @@ struct factor_vm
        cell unbox_array_size_slow();
        void primitive_fixnum_to_float();
        void primitive_bignum_to_float();
-       void primitive_float_to_str();
+       void primitive_format_float();
        void primitive_float_eq();
        void primitive_float_add();
        void primitive_float_subtract();
@@ -488,7 +505,7 @@ struct factor_vm
        // tagged
        template<typename Type> Type *untag_check(cell value);
 
-       //io
+       // io
        void init_c_io();
        void io_error();
        FILE* safe_fopen(char *filename, char *mode);
@@ -511,7 +528,7 @@ struct factor_vm
        void primitive_fflush();
        void primitive_fclose();
 
-       //code_block
+       // code_block
        cell compute_entry_point_address(cell obj);
        cell compute_entry_point_pic_address(word *w, cell tagged_quot);
        cell compute_entry_point_pic_address(cell w_);
@@ -548,11 +565,11 @@ struct factor_vm
        cell code_blocks();
        void primitive_code_blocks();
 
-       //callbacks
+       // callbacks
        void init_callbacks(cell size);
        void primitive_callback();
 
-       //image
+       // image
        void init_objects(image_header *h);
        void load_data_heap(FILE *file, image_header *h, vm_parameters *p);
        void load_code_heap(FILE *file, image_header *h, vm_parameters *p);
@@ -563,13 +580,15 @@ struct factor_vm
        void fixup_code(cell data_offset, cell code_offset);
        void load_image(vm_parameters *p);
 
-       //callstack
+       // callstack
        template<typename Iterator> void iterate_callstack_object(callstack *stack_, Iterator &iterator);
        void check_frame(stack_frame *frame);
        callstack *allot_callstack(cell size);
-       stack_frame *fix_callstack_top(stack_frame *top, stack_frame *bottom);
-       stack_frame *second_from_top_stack_frame();
+       stack_frame *fix_callstack_top(stack_frame *top);
+       stack_frame *second_from_top_stack_frame(context *ctx);
+       cell capture_callstack(context *ctx);
        void primitive_callstack();
+       void primitive_callstack_for();
        code_block *frame_code(stack_frame *frame);
        code_block_type frame_type(stack_frame *frame);
        cell frame_executing(stack_frame *frame);
@@ -581,9 +600,10 @@ struct factor_vm
        void primitive_innermost_stack_frame_executing();
        void primitive_innermost_stack_frame_scan();
        void primitive_set_innermost_stack_frame_quot();
+       void primitive_callstack_bounds();
        template<typename Iterator> void iterate_callstack(context *ctx, Iterator &iterator);
 
-       //alien
+       // alien
        char *pinned_alien_offset(cell obj);
        cell allot_alien(cell delegate_, cell displacement);
        cell allot_alien(void *address);
@@ -595,12 +615,8 @@ struct factor_vm
        void primitive_dlclose();
        void primitive_dll_validp();
        char *alien_offset(cell obj);
-       void to_value_struct(cell src, void *dest, cell size);
-       cell from_value_struct(void *src, cell size);
-       cell from_small_struct(cell x, cell y, cell size);
-       cell from_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size);
 
-       //quotations
+       // quotations
        void primitive_jit_compile();
        code_block *lazy_jit_compile_block();
        void primitive_array_to_quotation();
@@ -615,7 +631,7 @@ struct factor_vm
        cell find_all_quotations();
        void initialize_all_quotations();
 
-       //dispatch
+       // dispatch
        cell search_lookup_alist(cell table, cell klass);
        cell search_lookup_hash(cell table, cell klass, cell hashcode);
        cell nth_superclass(tuple_layout *layout, fixnum echelon);
@@ -630,7 +646,7 @@ struct factor_vm
        void primitive_reset_dispatch_stats();
        void primitive_dispatch_stats();
 
-       //inline cache
+       // inline cache
        void init_inline_caching(int max_size);
        void deallocate_inline_cache(cell return_address);
        cell determine_inline_cache_type(array *cache_entries);
@@ -642,11 +658,11 @@ struct factor_vm
        void update_pic_transitions(cell pic_size);
        void *inline_cache_miss(cell return_address);
 
-       //entry points
+       // entry points
        void c_to_factor(cell quot);
        void unwind_native_frames(cell quot, stack_frame *to);
 
-       //factor
+       // factor
        void default_parameters(vm_parameters *p);
        bool factor_arg(const vm_char *str, const vm_char *arg, cell *value);
        void init_parameters_from_args(vm_parameters *p, int argc, vm_char **argv);
@@ -670,6 +686,7 @@ struct factor_vm
        void *ffi_dlsym(dll *dll, symbol_char *symbol);
        void ffi_dlclose(dll *dll);
        void c_to_factor_toplevel(cell quot);
+       void init_signals();
 
        // os-windows
   #if defined(WINDOWS)
@@ -680,10 +697,12 @@ struct factor_vm
 
   #if defined(WINNT)
        void open_console();
-       LONG exception_handler(PEXCEPTION_POINTERS pe);
+       LONG exception_handler(PEXCEPTION_RECORD e, void *frame, PCONTEXT c, void *dispatch);
   #endif
+
   #else  // UNIX
        void dispatch_signal(void *uap, void (handler)());
+       void unix_init_signals();
   #endif
 
   #ifdef __APPLE__
@@ -691,9 +710,7 @@ struct factor_vm
   #endif
 
        factor_vm();
-
+       ~factor_vm();
 };
 
-extern std::map<THREADHANDLE, factor_vm *> thread_vms;
-
 }